com web/php: Merge pull request #36 from heiglandreas/feature/addCountryCodeMapping: ug.php

From: Date: Thu, 27 Mar 2014 23:15:46 +0000
Subject: com web/php: Merge pull request #36 from heiglandreas/feature/addCountryCodeMapping: ug.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-18626@lists.php.net to get a copy of this message
Commit: 8846685196c928f05fb57152878ef0bc8274d491 Author: Hannes Magnusson <bjori@mongodb.com> Thu, 27 Mar 2014 16:15:46 -0700 Parents: 5204bc8aa0364216d0f229702259953627d9414b 36363ee66ccf98f81dcb872f0679cec89ccc1b9b Branches: master Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=8846685196c928f05fb57152878ef0bc8274d491 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 {

« previous php.webmaster (#18626) next »