Index: branches/wmf/1.16wmf4/extensions/LandingCheck/SpecialLandingCheck.php |
— | — | @@ -21,7 +21,19 @@ |
22 | 22 | |
23 | 23 | // Pull in query string parameters |
24 | 24 | $language = $wgRequest->getVal( 'language', 'en' ); |
25 | | - $country = $wgRequest->getVal( 'country', 'US' ); |
| 25 | + |
| 26 | + $country = $wgRequest->getVal( 'country' ); |
| 27 | + // If no country was passed, try to do GeoIP lookup |
| 28 | + if ( !$country && function_exists( geoip_country_code_by_name ) ) { |
| 29 | + $ip = wfGetIP(); |
| 30 | + if ( IP::isValid( $ip ) ) { |
| 31 | + $country = geoip_country_code_by_name( $ip ); |
| 32 | + } |
| 33 | + } |
| 34 | + if ( !$country ) { |
| 35 | + $country = 'US'; // Default |
| 36 | + } |
| 37 | + |
26 | 38 | $landingPage = $wgRequest->getVal( 'landing_page', 'Donate' ); |
27 | 39 | |
28 | 40 | // Construct new query string for tracking |
Property changes on: branches/wmf/1.16wmf4/extensions/LandingCheck |
___________________________________________________________________ |
Modified: svn:mergeinfo |
29 | 41 | Merged /trunk/extensions/LandingCheck:r77519-77521 |