a', 'gravityforms' ), esc_html__( 'Eritrea', 'gravityforms' ), esc_html__( 'Estonia', 'gravityforms' ), esc_html__( 'Ethiopia', 'gravityforms' ), esc_html__( 'Faroe Islands', 'gravityforms' ), esc_html__( 'Fiji', 'gravityforms' ), esc_html__( 'Finland', 'gravityforms' ), esc_html__( 'France', 'gravityforms' ), esc_html__( 'French Polynesia', 'gravityforms' ), esc_html__( 'Gabon', 'gravityforms' ), esc_html__( 'Gambia', 'gravityforms' ), esc_html( _x( 'Georgia', 'Country', 'gravityforms' ) ), esc_html__( 'Germany', 'gravityforms' ), esc_html__( 'Ghana', 'gravityforms' ), esc_html__( 'Greece', 'gravityforms' ), esc_html__( 'Greenland', 'gravityforms' ), esc_html__( 'Grenada', 'gravityforms' ), esc_html__( 'Guam', 'gravityforms' ), esc_html__( 'Guatemala', 'gravityforms' ), esc_html__( 'Guinea', 'gravityforms' ), esc_html__( 'Guinea-Bissau', 'gravityforms' ), esc_html__( 'Guyana', 'gravityforms' ), esc_html__( 'Haiti', 'gravityforms' ), esc_html__( 'Honduras', 'gravityforms' ), esc_html__( 'Hong Kong', 'gravityforms' ), esc_html__( 'Hungary', 'gravityforms' ), esc_html__( 'Iceland', 'gravityforms' ), esc_html__( 'India', 'gravityforms' ), esc_html__( 'Indonesia', 'gravityforms' ), esc_html__( 'Iran', 'gravityforms' ), esc_html__( 'Iraq', 'gravityforms' ), esc_html__( 'Ireland', 'gravityforms' ), esc_html__( 'Israel', 'gravityforms' ), esc_html__( 'Italy', 'gravityforms' ), esc_html__( 'Jamaica', 'gravityforms' ), esc_html__( 'Japan', 'gravityforms' ), esc_html__( 'Jordan', 'gravityforms' ), esc_html__( 'Kazakhstan', 'gravityforms' ), esc_html__( 'Kenya', 'gravityforms' ), esc_html__( 'Kiribati', 'gravityforms' ), esc_html__( 'North Korea', 'gravityforms' ), esc_html__( 'South Korea', 'gravityforms' ), esc_html__( 'Kosovo', 'gravityforms' ), esc_html__( 'Kuwait', 'gravityforms' ), esc_html__( 'Kyrgyzstan', 'gravityforms' ), esc_html__( 'Laos', 'gravityforms' ), esc_html__( 'Latvia', 'gravityforms' ), esc_html__( 'Lebanon', 'gravityforms' ), esc_html__( 'Lesotho', 'gravityforms' ), esc_html__( 'Liberia', 'gravityforms' ), esc_html__( 'Libya', 'gravityforms' ), esc_html__( 'Liechtenstein', 'gravityforms' ), esc_html__( 'Lithuania', 'gravityforms' ), esc_html__( 'Luxembourg', 'gravityforms' ), esc_html__( 'Macedonia', 'gravityforms' ), esc_html__( 'Madagascar', 'gravityforms' ), esc_html__( 'Malawi', 'gravityforms' ), esc_html__( 'Malaysia', 'gravityforms' ), esc_html__( 'Maldives', 'gravityforms' ), esc_html__( 'Mali', 'gravityforms' ), esc_html__( 'Malta', 'gravityforms' ), esc_html__( 'Marshall Islands', 'gravityforms' ), esc_html__( 'Mauritania', 'gravityforms' ), esc_html__( 'Mauritius', 'gravityforms' ), esc_html__( 'Mexico', 'gravityforms' ), esc_html__( 'Micronesia', 'gravityforms' ), esc_html__( 'Moldova', 'gravityforms' ), esc_html__( 'Monaco', 'gravityforms' ), esc_html__( 'Mongolia', 'gravityforms' ), esc_html__( 'Montenegro', 'gravityforms' ), esc_html__( 'Morocco', 'gravityforms' ), esc_html__( 'Mozambique', 'gravityforms' ), esc_html__( 'Myanmar', 'gravityforms' ), esc_html__( 'Namibia', 'gravityforms' ), esc_html__( 'Nauru', 'gravityforms' ), esc_html__( 'Nepal', 'gravityforms' ), esc_html__( 'Netherlands', 'gravityforms' ), esc_html__( 'New Zealand', 'gravityforms' ), esc_html__( 'Nicaragua', 'gravityforms' ), esc_html__( 'Niger', 'gravityforms' ), esc_html__( 'Nigeria', 'gravityforms' ), esc_html__( 'Northern Mariana Islands', 'gravityforms' ), esc_html__( 'Norway', 'gravityforms' ), esc_html__( 'Oman', 'gravityforms' ), esc_html__( 'Pakistan', 'gravityforms' ), esc_html__( 'Palau', 'gravityforms' ), esc_html__( 'Palestine, State of', 'gravityforms' ), esc_html__( 'Panama', 'gravityforms' ), esc_html__( 'Papua New Guinea', 'gravityforms' ), esc_html__( 'Paraguay', 'gravityforms' ), esc_html__( 'Peru', 'gravityforms' ), esc_html__( 'Philippines', 'gravityforms' ), esc_html__( 'Poland', 'gravityforms' ), esc_html__( 'Portugal', 'gravityforms' ), esc_html__( 'Puerto Rico', 'gravityforms' ), esc_html__( 'Qatar', 'gravityforms' ), esc_html__( 'Romania', 'gravityforms' ), esc_html__( 'Russia', 'gravityforms' ), esc_html__( 'Rwanda', 'gravityforms' ), esc_html__( 'Saint Kitts and Nevis', 'gravityforms' ), esc_html__( 'Saint Lucia', 'gravityforms' ), esc_html__( 'Saint Vincent and the Grenadines', 'gravityforms' ), esc_html__( 'Samoa', 'gravityforms' ), esc_html__( 'San Marino', 'gravityforms' ), esc_html__( 'Sao Tome and Principe', 'gravityforms' ), esc_html__( 'Saudi Arabia', 'gravityforms' ), esc_html__( 'Senegal', 'gravityforms' ), esc_html__( 'Serbia', 'gravityforms' ), esc_html__( 'Seychelles', 'gravityforms' ), esc_html__( 'Sierra Leone', 'gravityforms' ), esc_html__( 'Singapore', 'gravityforms' ), esc_html__( 'Sint Maarten', 'gravityforms' ), esc_html__( 'Slovakia', 'gravityforms' ), esc_html__( 'Slovenia', 'gravityforms' ), esc_html__( 'Solomon Islands', 'gravityforms' ), esc_html__( 'Somalia', 'gravityforms' ), esc_html__( 'South Africa', 'gravityforms' ), esc_html__( 'Spain', 'gravityforms' ), esc_html__( 'Sri Lanka', 'gravityforms' ), esc_html__( 'Sudan', 'gravityforms' ), esc_html__( 'Sudan, South', 'gravityforms' ), esc_html__( 'Suriname', 'gravityforms' ), esc_html__( 'Swaziland', 'gravityforms' ), esc_html__( 'Sweden', 'gravityforms' ), esc_html__( 'Switzerland', 'gravityforms' ), esc_html__( 'Syria', 'gravityforms' ), esc_html__( 'Taiwan', 'gravityforms' ), esc_html__( 'Tajikistan', 'gravityforms' ), esc_html__( 'Tanzania', 'gravityforms' ), esc_html__( 'Thailand', 'gravityforms' ), esc_html__( 'Togo', 'gravityforms' ), esc_html__( 'Tonga', 'gravityforms' ), esc_html__( 'Trinidad and Tobago', 'gravityforms' ), esc_html__( 'Tunisia', 'gravityforms' ), esc_html__( 'Turkey', 'gravityforms' ), esc_html__( 'Turkmenistan', 'gravityforms' ), esc_html__( 'Tuvalu', 'gravityforms' ), esc_html__( 'Uganda', 'gravityforms' ), esc_html__( 'Ukraine', 'gravityforms' ), esc_html__( 'United Arab Emirates', 'gravityforms' ), esc_html__( 'United Kingdom', 'gravityforms' ), esc_html__( 'United States', 'gravityforms' ), esc_html__( 'Uruguay', 'gravityforms' ), esc_html__( 'Uzbekistan', 'gravityforms' ), esc_html__( 'Vanuatu', 'gravityforms' ), esc_html__( 'Vatican City', 'gravityforms' ), esc_html__( 'Venezuela', 'gravityforms' ), esc_html__( 'Vietnam', 'gravityforms' ), esc_html__( 'Virgin Islands, British', 'gravityforms' ), esc_html__( 'Virgin Islands, U.S.', 'gravityforms' ), esc_html__( 'Yemen', 'gravityforms' ), esc_html__( 'Zambia', 'gravityforms' ), esc_html__( 'Zimbabwe', 'gravityforms' ), ) ); } public function get_country_code( $country_name ) { $codes = $this->get_country_codes(); return rgar( $codes, GFCommon::safe_strtoupper( $country_name ) ); } public function get_country_codes() { $codes = array( esc_html__( 'AFGHANISTAN', 'gravityforms' ) => 'AF', esc_html__( 'ALBANIA', 'gravityforms' ) => 'AL', esc_html__( 'ALGERIA', 'gravityforms' ) => 'DZ', esc_html__( 'AMERICAN SAMOA', 'gravityforms' ) => 'AS', esc_html__( 'ANDORRA', 'gravityforms' ) => 'AD', esc_html__( 'ANGOLA', 'gravityforms' ) => 'AO', esc_html__( 'ANTIGUA AND BARBUDA', 'gravityforms' ) => 'AG', esc_html__( 'ARGENTINA', 'gravityforms' ) => 'AR', esc_html__( 'ARMENIA', 'gravityforms' ) => 'AM', esc_html__( 'AUSTRALIA', 'gravityforms' ) => 'AU', esc_html__( 'AUSTRIA', 'gravityforms' ) => 'AT', esc_html__( 'AZERBAIJAN', 'gravityforms' ) => 'AZ', esc_html__( 'BAHAMAS', 'gravityforms' ) => 'BS', esc_html__( 'BAHRAIN', 'gravityforms' ) => 'BH', esc_html__( 'BANGLADESH', 'gravityforms' ) => 'BD', esc_html__( 'BARBADOS', 'gravityforms' ) => 'BB', esc_html__( 'BELARUS', 'gravityforms' ) => 'BY', esc_html__( 'BELGIUM', 'gravityforms' ) => 'BE', esc_html__( 'BELIZE', 'gravityforms' ) => 'BZ', esc_html__( 'BENIN', 'gravityforms' ) => 'BJ', esc_html__( 'BERMUDA', 'gravityforms' ) => 'BM', esc_html__( 'BHUTAN', 'gravityforms' ) => 'BT', esc_html__( 'BOLIVIA', 'gravityforms' ) => 'BO', esc_html__( 'BOSNIA AND HERZEGOVINA', 'gravityforms' ) => 'BA', esc_html__( 'BOTSWANA', 'gravityforms' ) => 'BW', esc_html__( 'BRAZIL', 'gravityforms' ) => 'BR', esc_html__( 'BRUNEI', 'gravityforms' ) => 'BN', esc_html__( 'BULGARIA', 'gravityforms' ) => 'BG', esc_html__( 'BURKINA FASO', 'gravityforms' ) => 'BF', esc_html__( 'BURUNDI', 'gravityforms' ) => 'BI', esc_html__( 'CAMBODIA', 'gravityforms' ) => 'KH', esc_html__( 'CAMEROON', 'gravityforms' ) => 'CM', esc_html__( 'CANADA', 'gravityforms' ) => 'CA', esc_html__( 'CAPE VERDE', 'gravityforms' ) => 'CV', esc_html__( 'CAYMAN ISLANDS', 'gravityforms' ) => 'KY', esc_html__( 'CENTRAL AFRICAN REPUBLIC', 'gravityforms' ) => 'CF', esc_html__( 'CHAD', 'gravityforms' ) => 'TD', esc_html__( 'CHILE', 'gravityforms' ) => 'CL', esc_html__( 'CHINA', 'gravityforms' ) => 'CN', esc_html__( 'COLOMBIA', 'gravityforms' ) => 'CO', esc_html__( 'COMOROS', 'gravityforms' ) => 'KM', esc_html__( 'CONGO, DEMOCRATIC REPUBLIC OF THE', 'gravityforms' ) => 'CD', esc_html__( 'CONGO, REPUBLIC OF THE', 'gravityforms' ) => 'CG', esc_html__( 'COSTA RICA', 'gravityforms' ) => 'CR', esc_html__( "CÔTE D'IVOIRE", 'gravityforms' ) => 'CI', esc_html__( 'CROATIA', 'gravityforms' ) => 'HR', esc_html__( 'CUBA', 'gravityforms' ) => 'CU', esc_html__( 'CURAÇAO', 'gravityforms' ) => 'CW', esc_html__( 'CYPRUS', 'gravityforms' ) => 'CY', esc_html__( 'CZECH REPUBLIC', 'gravityforms' ) => 'CZ', esc_html__( 'DENMARK', 'gravityforms' ) => 'DK', esc_html__( 'DJIBOUTI', 'gravityforms' ) => 'DJ', esc_html__( 'DOMINICA', 'gravityforms' ) => 'DM', esc_html__( 'DOMINICAN REPUBLIC', 'gravityforms' ) => 'DO', esc_html__( 'EAST TIMOR', 'gravityforms' ) => 'TL', esc_html__( 'ECUADOR', 'gravityforms' ) => 'EC', esc_html__( 'EGYPT', 'gravityforms' ) => 'EG', esc_html__( 'EL SALVADOR', 'gravityforms' ) => 'SV', esc_html__( 'EQUATORIAL GUINEA', 'gravityforms' ) => 'GQ', esc_html__( 'ERITREA', 'gravityforms' ) => 'ER', esc_html__( 'ESTONIA', 'gravityforms' ) => 'EE', esc_html__( 'ETHIOPIA', 'gravityforms' ) => 'ET', esc_html__( 'FAROE ISLANDS', 'gravityforms' ) => 'FO', esc_html__( 'FIJI', 'gravityforms' ) => 'FJ', esc_html__( 'FINLAND', 'gravityforms' ) => 'FI', esc_html__( 'FRANCE', 'gravityforms' ) => 'FR', esc_html__( 'FRENCH POLYNESIA', 'gravityforms' ) => 'PF', esc_html__( 'GABON', 'gravityforms' ) => 'GA', esc_html__( 'GAMBIA', 'gravityforms' ) => 'GM', esc_html( _x( 'GEORGIA', 'Country', 'gravityforms' ) ) => 'GE', esc_html__( 'GERMANY', 'gravityforms' ) => 'DE', esc_html__( 'GHANA', 'gravityforms' ) => 'GH', esc_html__( 'GREECE', 'gravityforms' ) => 'GR', esc_html__( 'GREENLAND', 'gravityforms' ) => 'GL', esc_html__( 'GRENADA', 'gravityforms' ) => 'GD', esc_html__( 'GUAM', 'gravityforms' ) => 'GU', esc_html__( 'GUATEMALA', 'gravityforms' ) => 'GT', esc_html__( 'GUINEA', 'gravityforms' ) => 'GN', esc_html__( 'GUINEA-BISSAU', 'gravityforms' ) => 'GW', esc_html__( 'GUYANA', 'gravityforms' ) => 'GY', esc_html__( 'HAITI', 'gravityforms' ) => 'HT', esc_html__( 'HONDURAS', 'gravityforms' ) => 'HN', esc_html__( 'HONG KONG', 'gravityforms' ) => 'HK', esc_html__( 'HUNGARY', 'gravityforms' ) => 'HU', esc_html__( 'ICELAND', 'gravityforms' ) => 'IS', esc_html__( 'INDIA', 'gravityforms' ) => 'IN', esc_html__( 'INDONESIA', 'gravityforms' ) => 'ID', esc_html__( 'IRAN', 'gravityforms' ) => 'IR', esc_html__( 'IRAQ', 'gravityforms' ) => 'IQ', esc_html__( 'IRELAND', 'gravityforms' ) => 'IE', esc_html__( 'ISRAEL', 'gravityforms' ) => 'IL', esc_html__( 'ITALY', 'gravityforms' ) => 'IT', esc_html__( 'JAMAICA', 'gravityforms' ) => 'JM', esc_html__( 'JAPAN', 'gravityforms' ) => 'JP', esc_html__( 'JORDAN', 'gravityforms' ) => 'JO', esc_html__( 'KAZAKHSTAN', 'gravityforms' ) => 'KZ', esc_html__( 'KENYA', 'gravityforms' ) => 'KE', esc_html__( 'KIRIBATI', 'gravityforms' ) => 'KI', esc_html__( 'NORTH KOREA', 'gravityforms' ) => 'KP', esc_html__( 'SOUTH KOREA', 'gravityforms' ) => 'KR', esc_html__( 'KOSOVO', 'gravityforms' ) => 'KV', esc_html__( 'KUWAIT', 'gravityforms' ) => 'KW', esc_html__( 'KYRGYZSTAN', 'gravityforms' ) => 'KG', esc_html__( 'LAOS', 'gravityforms' ) => 'LA', esc_html__( 'LATVIA', 'gravityforms' ) => 'LV', esc_html__( 'LEBANON', 'gravityforms' ) => 'LB', esc_html__( 'LESOTHO', 'gravityforms' ) => 'LS', esc_html__( 'LIBERIA', 'gravityforms' ) => 'LR', esc_html__( 'LIBYA', 'gravityforms' ) => 'LY', esc_html__( 'LIECHTENSTEIN', 'gravityforms' ) => 'LI', esc_html__( 'LITHUANIA', 'gravityforms' ) => 'LT', esc_html__( 'LUXEMBOURG', 'gravityforms' ) => 'LU', esc_html__( 'MACEDONIA', 'gravityforms' ) => 'MK', esc_html__( 'MADAGASCAR', 'gravityforms' ) => 'MG', esc_html__( 'MALAWI', 'gravityforms' ) => 'MW', esc_html__( 'MALAYSIA', 'gravityforms' ) => 'MY', esc_html__( 'MALDIVES', 'gravityforms' ) => 'MV', esc_html__( 'MALI', 'gravityforms' ) => 'ML', esc_html__( 'MALTA', 'gravityforms' ) => 'MT', esc_html__( 'MARSHALL ISLANDS', 'gravityforms' ) => 'MH', esc_html__( 'MAURITANIA', 'gravityforms' ) => 'MR', esc_html__( 'MAURITIUS', 'gravityforms' ) => 'MU', esc_html__( 'MEXICO', 'gravityforms' ) => 'MX', esc_html__( 'MICRONESIA', 'gravityforms' ) => 'FM', esc_html__( 'MOLDOVA', 'gravityforms' ) => 'MD', esc_html__( 'MONACO', 'gravityforms' ) => 'MC', esc_html__( 'MONGOLIA', 'gravityforms' ) => 'MN', esc_html__( 'MONTENEGRO', 'gravityforms' ) => 'ME', esc_html__( 'MOROCCO', 'gravityforms' ) => 'MA', esc_html__( 'MOZAMBIQUE', 'gravityforms' ) => 'MZ', esc_html__( 'MYANMAR', 'gravityforms' ) => 'MM', esc_html__( 'NAMIBIA', 'gravityforms' ) => 'NA', esc_html__( 'NAURU', 'gravityforms' ) => 'NR', esc_html__( 'NEPAL', 'gravityforms' ) => 'NP', esc_html__( 'NETHERLANDS', 'gravityforms' ) => 'NL', esc_html__( 'NEW ZEALAND', 'gravityforms' ) => 'NZ', esc_html__( 'NICARAGUA', 'gravityforms' ) => 'NI', esc_html__( 'NIGER', 'gravityforms' ) => 'NE', esc_html__( 'NIGERIA', 'gravityforms' ) => 'NG', esc_html__( 'NORTHERN MARIANA ISLANDS', 'gravityforms' ) => 'MP', esc_html__( 'NORWAY', 'gravityforms' ) => 'NO', esc_html__( 'OMAN', 'gravityforms' ) => 'OM', esc_html__( 'PAKISTAN', 'gravityforms' ) => 'PK', esc_html__( 'PALAU', 'gravityforms' ) => 'PW', esc_html__( 'PALESTINE, STATE OF', 'gravityforms' ) => 'PS', esc_html__( 'PANAMA', 'gravityforms' ) => 'PA', esc_html__( 'PAPUA NEW GUINEA', 'gravityforms' ) => 'PG', esc_html__( 'PARAGUAY', 'gravityforms' ) => 'PY', esc_html__( 'PERU', 'gravityforms' ) => 'PE', esc_html__( 'PHILIPPINES', 'gravityforms' ) => 'PH', esc_html__( 'POLAND', 'gravityforms' ) => 'PL', esc_html__( 'PORTUGAL', 'gravityforms' ) => 'PT', esc_html__( 'PUERTO RICO', 'gravityforms' ) => 'PR', esc_html__( 'QATAR', 'gravityforms' ) => 'QA', esc_html__( 'ROMANIA', 'gravityforms' ) => 'RO', esc_html__( 'RUSSIA', 'gravityforms' ) => 'RU', esc_html__( 'RWANDA', 'gravityforms' ) => 'RW', esc_html__( 'SAINT KITTS AND NEVIS', 'gravityforms' ) => 'KN', esc_html__( 'SAINT LUCIA', 'gravityforms' ) => 'LC', esc_html__( 'SAINT VINCENT AND THE GRENADINES', 'gravityforms' ) => 'VC', esc_html__( 'SAMOA', 'gravityforms' ) => 'WS', esc_html__( 'SAN MARINO', 'gravityforms' ) => 'SM', esc_html__( 'SAO TOME AND PRINCIPE', 'gravityforms' ) => 'ST', esc_html__( 'SAUDI ARABIA', 'gravityforms' ) => 'SA', esc_html__( 'SENEGAL', 'gravityforms' ) => 'SN', esc_html__( 'SERBIA', 'gravityforms' ) => 'RS', esc_html__( 'SEYCHELLES', 'gravityforms' ) => 'SC', esc_html__( 'SIERRA LEONE', 'gravityforms' ) => 'SL', esc_html__( 'SINGAPORE', 'gravityforms' ) => 'SG', esc_html__( 'SINT MAARTEN', 'gravityforms' ) => 'SX', esc_html__( 'SLOVAKIA', 'gravityforms' ) => 'SK', esc_html__( 'SLOVENIA', 'gravityforms' ) => 'SI', esc_html__( 'SOLOMON ISLANDS', 'gravityforms' ) => 'SB', esc_html__( 'SOMALIA', 'gravityforms' ) => 'SO', esc_html__( 'SOUTH AFRICA', 'gravityforms' ) => 'ZA', esc_html__( 'SPAIN', 'gravityforms' ) => 'ES', esc_html__( 'SRI LANKA', 'gravityforms' ) => 'LK', esc_html__( 'SUDAN', 'gravityforms' ) => 'SD', esc_html__( 'SUDAN, SOUTH', 'gravityforms' ) => 'SS', esc_html__( 'SURINAME', 'gravityforms' ) => 'SR', esc_html__( 'SWAZILAND', 'gravityforms' ) => 'SZ', esc_html__( 'SWEDEN', 'gravityforms' ) => 'SE', esc_html__( 'SWITZERLAND', 'gravityforms' ) => 'CH', esc_html__( 'SYRIA', 'gravityforms' ) => 'SY', esc_html__( 'TAIWAN', 'gravityforms' ) => 'TW', esc_html__( 'TAJIKISTAN', 'gravityforms' ) => 'TJ', esc_html__( 'TANZANIA', 'gravityforms' ) => 'TZ', esc_html__( 'THAILAND', 'gravityforms' ) => 'TH', esc_html__( 'TOGO', 'gravityforms' ) => 'TG', esc_html__( 'TONGA', 'gravityforms' ) => 'TO', esc_html__( 'TRINIDAD AND TOBAGO', 'gravityforms' ) => 'TT', esc_html__( 'TUNISIA', 'gravityforms' ) => 'TN', esc_html__( 'TURKEY', 'gravityforms' ) => 'TR', esc_html__( 'TURKMENISTAN', 'gravityforms' ) => 'TM', esc_html__( 'TUVALU', 'gravityforms' ) => 'TV', esc_html__( 'UGANDA', 'gravityforms' ) => 'UG', esc_html__( 'UKRAINE', 'gravityforms' ) => 'UA', esc_html__( 'UNITED ARAB EMIRATES', 'gravityforms' ) => 'AE', esc_html__( 'UNITED KINGDOM', 'gravityforms' ) => 'GB', esc_html__( 'UNITED STATES', 'gravityforms' ) => 'US', esc_html__( 'URUGUAY', 'gravityforms' ) => 'UY', esc_html__( 'UZBEKISTAN', 'gravityforms' ) => 'UZ', esc_html__( 'VANUATU', 'gravityforms' ) => 'VU', esc_html__( 'VATICAN CITY', 'gravityforms' ) => 'VA', esc_html__( 'VENEZUELA', 'gravityforms' ) => 'VE', esc_html__( 'VIRGIN ISLANDS, BRITISH', 'gravityforms' ) => 'VG', esc_html__( 'VIRGIN ISLANDS, U.S.', 'gravityforms' ) => 'VI', esc_html__( 'VIETNAM', 'gravityforms' ) => 'VN', esc_html__( 'YEMEN', 'gravityforms' ) => 'YE', esc_html__( 'ZAMBIA', 'gravityforms' ) => 'ZM', esc_html__( 'ZIMBABWE', 'gravityforms' ) => 'ZW', ); return $codes; } public function get_us_states() { return apply_filters( 'gform_us_states', array( esc_html__( 'Alabama', 'gravityforms' ), esc_html__( 'Alaska', 'gravityforms' ), esc_html__( 'Arizona', 'gravityforms' ), esc_html__( 'Arkansas', 'gravityforms' ), esc_html__( 'California', 'gravityforms' ), esc_html__( 'Colorado', 'gravityforms' ), esc_html__( 'Connecticut', 'gravityforms' ), esc_html__( 'Delaware', 'gravityforms' ), esc_html__( 'District of Columbia', 'gravityforms' ), esc_html__( 'Florida', 'gravityforms' ), esc_html( _x( 'Georgia', 'US State', 'gravityforms' ) ), esc_html__( 'Hawaii', 'gravityforms' ), esc_html__( 'Idaho', 'gravityforms' ), esc_html__( 'Illinois', 'gravityforms' ), esc_html__( 'Indiana', 'gravityforms' ), esc_html__( 'Iowa', 'gravityforms' ), esc_html__( 'Kansas', 'gravityforms' ), esc_html__( 'Kentucky', 'gravityforms' ), esc_html__( 'Louisiana', 'gravityforms' ), esc_html__( 'Maine', 'gravityforms' ), esc_html__( 'Maryland', 'gravityforms' ), esc_html__( 'Massachusetts', 'gravityforms' ), esc_html__( 'Michigan', 'gravityforms' ), esc_html__( 'Minnesota', 'gravityforms' ), esc_html__( 'Mississippi', 'gravityforms' ), esc_html__( 'Missouri', 'gravityforms' ), esc_html__( 'Montana', 'gravityforms' ), esc_html__( 'Nebraska', 'gravityforms' ), esc_html__( 'Nevada', 'gravityforms' ), esc_html__( 'New Hampshire', 'gravityforms' ), esc_html__( 'New Jersey', 'gravityforms' ), esc_html__( 'New Mexico', 'gravityforms' ), esc_html__( 'New York', 'gravityforms' ), esc_html__( 'North Carolina', 'gravityforms' ), esc_html__( 'North Dakota', 'gravityforms' ), esc_html__( 'Ohio', 'gravityforms' ), esc_html__( 'Oklahoma', 'gravityforms' ), esc_html__( 'Oregon', 'gravityforms' ), esc_html__( 'Pennsylvania', 'gravityforms' ), esc_html__( 'Rhode Island', 'gravityforms' ), esc_html__( 'South Carolina', 'gravityforms' ), esc_html__( 'South Dakota', 'gravityforms' ), esc_html__( 'Tennessee', 'gravityforms' ), esc_html__( 'Texas', 'gravityforms' ), esc_html__( 'Utah', 'gravityforms' ), esc_html__( 'Vermont', 'gravityforms' ), esc_html__( 'Virginia', 'gravityforms' ), esc_html__( 'Washington', 'gravityforms' ), esc_html__( 'West Virginia', 'gravityforms' ), esc_html__( 'Wisconsin', 'gravityforms' ), esc_html__( 'Wyoming', 'gravityforms' ), esc_html__( 'Armed Forces Americas', 'gravityforms' ), esc_html__( 'Armed Forces Europe', 'gravityforms' ), esc_html__( 'Armed Forces Pacific', 'gravityforms' ), ) ); } public function get_us_state_code( $state_name ) { $states = array( GFCommon::safe_strtoupper( esc_html__( 'Alabama', 'gravityforms' ) ) => 'AL', GFCommon::safe_strtoupper( esc_html__( 'Alaska', 'gravityforms' ) ) => 'AK', GFCommon::safe_strtoupper( esc_html__( 'Arizona', 'gravityforms' ) ) => 'AZ', GFCommon::safe_strtoupper( esc_html__( 'Arkansas', 'gravityforms' ) ) => 'AR', GFCommon::safe_strtoupper( esc_html__( 'California', 'gravityforms' ) ) => 'CA', GFCommon::safe_strtoupper( esc_html__( 'Colorado', 'gravityforms' ) ) => 'CO', GFCommon::safe_strtoupper( esc_html__( 'Connecticut', 'gravityforms' ) ) => 'CT', GFCommon::safe_strtoupper( esc_html__( 'Delaware', 'gravityforms' ) ) => 'DE', GFCommon::safe_strtoupper( esc_html__( 'District of Columbia', 'gravityforms' ) ) => 'DC', GFCommon::safe_strtoupper( esc_html__( 'Florida', 'gravityforms' ) ) => 'FL', GFCommon::safe_strtoupper( esc_html( _x( 'Georgia', 'US State', 'gravityforms' ) ) ) => 'GA', GFCommon::safe_strtoupper( esc_html__( 'Hawaii', 'gravityforms' ) ) => 'HI', GFCommon::safe_strtoupper( esc_html__( 'Idaho', 'gravityforms' ) ) => 'ID', GFCommon::safe_strtoupper( esc_html__( 'Illinois', 'gravityforms' ) ) => 'IL', GFCommon::safe_strtoupper( esc_html__( 'Indiana', 'gravityforms' ) ) => 'IN', GFCommon::safe_strtoupper( esc_html__( 'Iowa', 'gravityforms' ) ) => 'IA', GFCommon::safe_strtoupper( esc_html__( 'Kansas', 'gravityforms' ) ) => 'KS', GFCommon::safe_strtoupper( esc_html__( 'Kentucky', 'gravityforms' ) ) => 'KY', GFCommon::safe_strtoupper( esc_html__( 'Louisiana', 'gravityforms' ) ) => 'LA', GFCommon::safe_strtoupper( esc_html__( 'Maine', 'gravityforms' ) ) => 'ME', GFCommon::safe_strtoupper( esc_html__( 'Maryland', 'gravityforms' ) ) => 'MD', GFCommon::safe_strtoupper( esc_html__( 'Massachusetts', 'gravityforms' ) ) => 'MA', GFCommon::safe_strtoupper( esc_html__( 'Michigan', 'gravityforms' ) ) => 'MI', GFCommon::safe_strtoupper( esc_html__( 'Minnesota', 'gravityforms' ) ) => 'MN', GFCommon::safe_strtoupper( esc_html__( 'Mississippi', 'gravityforms' ) ) => 'MS', GFCommon::safe_strtoupper( esc_html__( 'Missouri', 'gravityforms' ) ) => 'MO', GFCommon::safe_strtoupper( esc_html__( 'Montana', 'gravityforms' ) ) => 'MT', GFCommon::safe_strtoupper( esc_html__( 'Nebraska', 'gravityforms' ) ) => 'NE', GFCommon::safe_strtoupper( esc_html__( 'Nevada', 'gravityforms' ) ) => 'NV', GFCommon::safe_strtoupper( esc_html__( 'New Hampshire', 'gravityforms' ) ) => 'NH', GFCommon::safe_strtoupper( esc_html__( 'New Jersey', 'gravityforms' ) ) => 'NJ', GFCommon::safe_strtoupper( esc_html__( 'New Mexico', 'gravityforms' ) ) => 'NM', GFCommon::safe_strtoupper( esc_html__( 'New York', 'gravityforms' ) ) => 'NY', GFCommon::safe_strtoupper( esc_html__( 'North Carolina', 'gravityforms' ) ) => 'NC', GFCommon::safe_strtoupper( esc_html__( 'North Dakota', 'gravityforms' ) ) => 'ND', GFCommon::safe_strtoupper( esc_html__( 'Ohio', 'gravityforms' ) ) => 'OH', GFCommon::safe_strtoupper( esc_html__( 'Oklahoma', 'gravityforms' ) ) => 'OK', GFCommon::safe_strtoupper( esc_html__( 'Oregon', 'gravityforms' ) ) => 'OR', GFCommon::safe_strtoupper( esc_html__( 'Pennsylvania', 'gravityforms' ) ) => 'PA', GFCommon::safe_strtoupper( esc_html__( 'Rhode Island', 'gravityforms' ) ) => 'RI', GFCommon::safe_strtoupper( esc_html__( 'South Carolina', 'gravityforms' ) ) => 'SC', GFCommon::safe_strtoupper( esc_html__( 'South Dakota', 'gravityforms' ) ) => 'SD', GFCommon::safe_strtoupper( esc_html__( 'Tennessee', 'gravityforms' ) ) => 'TN', GFCommon::safe_strtoupper( esc_html__( 'Texas', 'gravityforms' ) ) => 'TX', GFCommon::safe_strtoupper( esc_html__( 'Utah', 'gravityforms' ) ) => 'UT', GFCommon::safe_strtoupper( esc_html__( 'Vermont', 'gravityforms' ) ) => 'VT', GFCommon::safe_strtoupper( esc_html__( 'Virginia', 'gravityforms' ) ) => 'VA', GFCommon::safe_strtoupper( esc_html__( 'Washington', 'gravityforms' ) ) => 'WA', GFCommon::safe_strtoupper( esc_html__( 'West Virginia', 'gravityforms' ) ) => 'WV', GFCommon::safe_strtoupper( esc_html__( 'Wisconsin', 'gravityforms' ) ) => 'WI', GFCommon::safe_strtoupper( esc_html__( 'Wyoming', 'gravityforms' ) ) => 'WY', GFCommon::safe_strtoupper( esc_html__( 'Armed Forces Americas', 'gravityforms' ) ) => 'AA', GFCommon::safe_strtoupper( esc_html__( 'Armed Forces Europe', 'gravityforms' ) ) => 'AE', GFCommon::safe_strtoupper( esc_html__( 'Armed Forces Pacific', 'gravityforms' ) ) => 'AP', ); $state_name = GFCommon::safe_strtoupper( $state_name ); $code = isset( $states[ $state_name ] ) ? $states[ $state_name ] : $state_name; return $code; } public function get_canadian_provinces() { return array( esc_html__( 'Alberta', 'gravityforms' ), esc_html__( 'British Columbia', 'gravityforms' ), esc_html__( 'Manitoba', 'gravityforms' ), esc_html__( 'New Brunswick', 'gravityforms' ), esc_html__( 'Newfoundland & Labrador', 'gravityforms' ), esc_html__( 'Northwest Territories', 'gravityforms' ), esc_html__( 'Nova Scotia', 'gravityforms' ), esc_html__( 'Nunavut', 'gravityforms' ), esc_html__( 'Ontario', 'gravityforms' ), esc_html__( 'Prince Edward Island', 'gravityforms' ), esc_html__( 'Quebec', 'gravityforms' ), esc_html__( 'Saskatchewan', 'gravityforms' ), esc_html__( 'Yukon', 'gravityforms' ) ); } public function get_state_dropdown( $states, $selected_state = '', $placeholder = '' ) { $str = ''; foreach ( $states as $code => $state ) { if ( is_array( $state ) ) { $str .= sprintf( '%2$s', esc_attr( $code ), $this->get_state_dropdown( $state, $selected_state, $placeholder ) ); } else { if ( is_numeric( $code ) ) { $code = $state; } if ( empty( $state ) ) { $state = $placeholder; } $str .= $this->get_select_option( $code, $state, $selected_state ); } } return $str; } /** * Returns the option tag for the current choice. * * @param string $value The choice value. * @param string $label The choice label. * @param string $selected_value The value for the selected choice. * * @return string */ public function get_select_option( $value, $label, $selected_value ) { $selected = $value == $selected_value ? "selected='selected'" : ''; return sprintf( "", esc_attr( $value ), $selected, esc_html( $label ) ); } public function get_us_state_dropdown( $selected_state = '' ) { $states = array_merge( array( '' ), $this->get_us_states() ); $str = ''; foreach ( $states as $code => $state ) { if ( is_numeric( $code ) ) { $code = $state; } $selected = $code == $selected_state ? "selected='selected'" : ''; $str .= "'; } return $str; } public function get_canadian_provinces_dropdown( $selected_province = '' ) { $states = array_merge( array( '' ), $this->get_canadian_provinces() ); $str = ''; foreach ( $states as $state ) { $selected = $state == $selected_province ? "selected='selected'" : ''; $str .= "'; } return $str; } public function get_country_dropdown( $selected_country = '', $placeholder = '' ) { $str = ''; $selected_country = strtolower( $selected_country ); $countries = array_merge( array( '' ), $this->get_countries() ); foreach ( $countries as $code => $country ) { if ( is_numeric( $code ) ) { $code = $country; } if ( empty( $country ) ) { $country = $placeholder; } $selected = strtolower( $code ) == $selected_country ? "selected='selected'" : ''; $str .= "'; } return $str; } public function get_value_entry_detail( $value, $currency = '', $use_text = false, $format = 'html', $media = 'screen' ) { if ( is_array( $value ) ) { $street_value = trim( rgget( $this->id . '.1', $value ) ); $street2_value = trim( rgget( $this->id . '.2', $value ) ); $city_value = trim( rgget( $this->id . '.3', $value ) ); $state_value = trim( rgget( $this->id . '.4', $value ) ); $zip_value = trim( rgget( $this->id . '.5', $value ) ); $country_value = trim( rgget( $this->id . '.6', $value ) ); if ( $format === 'html' ) { $street_value = esc_html( $street_value ); $street2_value = esc_html( $street2_value ); $city_value = esc_html( $city_value ); $state_value = esc_html( $state_value ); $zip_value = esc_html( $zip_value ); $country_value = esc_html( $country_value ); $line_break = '
'; } else { $line_break = "\n"; } /** * Filters the format that the address is displayed in. * * @since Unknown * * @param string 'default' The format to use. Defaults to 'default'. * @param GF_Field_Address $this An instance of the GF_Field_Address object. */ $address_display_format = apply_filters( 'gform_address_display_format', 'default', $this ); if ( $address_display_format == 'zip_before_city' ) { /* Sample: 3333 Some Street suite 16 2344 City, State Country */ $addr_ary = array(); $addr_ary[] = $street_value; if ( ! empty( $street2_value ) ) { $addr_ary[] = $street2_value; } $zip_line = trim( $zip_value . ' ' . $city_value ); $zip_line .= ! empty( $zip_line ) && ! empty( $state_value ) ? ", {$state_value}" : $state_value; $zip_line = trim( $zip_line ); if ( ! empty( $zip_line ) ) { $addr_ary[] = $zip_line; } if ( ! empty( $country_value ) ) { $addr_ary[] = $country_value; } $address = implode( '
', $addr_ary ); } else { $address = $street_value; $address .= ! empty( $address ) && ! empty( $street2_value ) ? $line_break . $street2_value : $street2_value; $address .= ! empty( $address ) && ( ! empty( $city_value ) || ! empty( $state_value ) ) ? $line_break . $city_value : $city_value; $address .= ! empty( $address ) && ! empty( $city_value ) && ! empty( $state_value ) ? ", $state_value" : $state_value; $address .= ! empty( $address ) && ! empty( $zip_value ) ? " $zip_value" : $zip_value; $address .= ! empty( $address ) && ! empty( $country_value ) ? $line_break . $country_value : $country_value; } // Adding map link. /** * Disables the Google Maps link from displaying in the address field. * * @since 1.9 * * @param bool false Determines if the map link should be disabled. Set to true to disable. Defaults to false. */ $map_link_disabled = apply_filters( 'gform_disable_address_map_link', false ); if ( ! empty( $address ) && $format == 'html' && ! $map_link_disabled ) { $address_qs = str_replace( $line_break, ' ', $address ); //replacing
and \n with spaces $address_qs = urlencode( $address_qs ); $address .= "
Map It"; } return $address; } else { return ''; } } public function get_input_property( $input_id, $property_name ) { $input = GFFormsModel::get_input( $this, $input_id ); return rgar( $input, $property_name ); } public function sanitize_settings() { parent::sanitize_settings(); if ( $this->addressType ) { $this->addressType = wp_strip_all_tags( $this->addressType ); } if ( $this->defaultCountry ) { $this->defaultCountry = wp_strip_all_tags( $this->defaultCountry ); } if ( $this->defaultProvince ) { $this->defaultProvince = wp_strip_all_tags( $this->defaultProvince ); } } public function get_value_export( $entry, $input_id = '', $use_text = false, $is_csv = false ) { if ( empty( $input_id ) ) { $input_id = $this->id; } if ( absint( $input_id ) == $input_id ) { $street_value = str_replace( ' ', ' ', trim( rgar( $entry, $input_id . '.1' ) ) ); $street2_value = str_replace( ' ', ' ', trim( rgar( $entry, $input_id . '.2' ) ) ); $city_value = str_replace( ' ', ' ', trim( rgar( $entry, $input_id . '.3' ) ) ); $state_value = str_replace( ' ', ' ', trim( rgar( $entry, $input_id . '.4' ) ) ); $zip_value = trim( rgar( $entry, $input_id . '.5' ) ); $country_value = $this->get_country_code( trim( rgar( $entry, $input_id . '.6' ) ) ); $address = $street_value; $address .= ! empty( $address ) && ! empty( $street2_value ) ? " $street2_value" : $street2_value; $address .= ! empty( $address ) && ( ! empty( $city_value ) || ! empty( $state_value ) ) ? ", $city_value," : $city_value; $address .= ! empty( $address ) && ! empty( $city_value ) && ! empty( $state_value ) ? " $state_value" : $state_value; $address .= ! empty( $address ) && ! empty( $zip_value ) ? " $zip_value," : $zip_value; $address .= ! empty( $address ) && ! empty( $country_value ) ? " $country_value" : $country_value; return $address; } else { return rgar( $entry, $input_id ); } } } GF_Fields::register( new GF_Field_Address() );