Commit:    a6da14164dbd84919f238b03bc49695e5e306008
Author:    Hannes Magnusson <[email protected]>         Thu, 27 Mar 2014 
16:15:46 -0700
Parents:   f500516676b99915a4f76dfa12f1cb33fdc58f0f 
0b79b4acad16439befdf4bcde39a6052073af883
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=a6da14164dbd84919f238b03bc49695e5e306008

Log:
Merge pull request #36 from heiglandreas/feature/addCountryCodeMapping

Adds possibility to map alpha3 to alpha2 code

* heiglandreas/feature/addCountryCodeMapping:
  Adds possibility to map alpha3 to alpha2 code

Bugs:
https://bugs.php.net/36

Changed paths:
  MM  ug.php


Diff:
diff --cc ug.php
index 28a3d48,76747c3..3f83046
--- a/ug.php
+++ b/ug.php
@@@ -98,10 -98,19 +98,19 @@@ function print_ug_matches($matches) 
      echo "</dl>";
  }
  
- $country = isset($_GET["cc"]) ? $_GET["cc"] : $COUNTRY;
+ function get_alpha2_country_from_alpha3($country) {
+     $countries = include dirname(__FILE__) . 
'/include/countries_alpha_mapping.inc';
+     if (! isset($countries[$country])) {
+         return '';
+     }
+     return $countries[$country];
+ }
+ $COUNTRY_ALPHA_2 = get_alpha2_country_from_alpha3($COUNTRY);
+ echo $COUNTRY_ALPHA_2 . '::' . $COUNTRY;
+ $country = isset($_GET["cc"]) ? $_GET["cc"] : $COUNTRY_ALPHA_2;
  $allcountries = array();
 +$matches = get_usergroups_in($country, $allcountries);
  if (isset($COUNTRIES_ALPHA2[$country])) {
 -    $matches = get_usergroups_in($country, $allcountries);
      print_cc_header($country);
      print_ug_matches($matches);
  } else {


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to