Advertisement
geminilabs

Untitled

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