ninja_forms_field_country_display

Function to display our country field on the front-end.

Description

ninja_forms_field_country_display( $field_id, $data, (string) $form_id = '' ); 

Parameters (3)

0. $field_id
The field id.
1. $data
The data.
2. $form_id — Optional. (string) => ''
The form id.

Usage

  1. if ( !function_exists( 'ninja_forms_field_country_display' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/fields/country.php'; 
  3.  
  4. // The field id. 
  5. $field_id = null; 
  6.  
  7. // The data. 
  8. $data = null; 
  9.  
  10. // The form id. 
  11. $form_id = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = ninja_forms_field_country_display($field_id, $data, $form_id); 
  15.  

Defined (1)

The function is defined in the following location(s).

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