Index: branches/wmf/1.18wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.php |
— | — | @@ -40,7 +40,8 @@ |
41 | 41 | $wgFundraiserLPDefaults = array( |
42 | 42 | 'template' => 'Lp-wrapper', |
43 | 43 | 'appeal' => 'Appeal-default', |
44 | | - 'form' => 'Form-default' |
| 44 | + 'form' => 'Form-default', |
| 45 | + 'country' => 'XX' // per Charles Barr |
45 | 46 | ); |
46 | 47 | |
47 | 48 | // Adding configurrable variable for caching time |
Index: branches/wmf/1.18wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php |
— | — | @@ -29,14 +29,29 @@ |
30 | 30 | $template = $this->make_safe( $request->getText( 'template', $wgFundraiserLPDefaults[ 'template' ] ) ); |
31 | 31 | $appeal = $this->make_safe( $request->getText( 'appeal', $wgFundraiserLPDefaults[ 'appeal' ] ) ); |
32 | 32 | $form = $this->make_safe( $request->getText( 'form', $wgFundraiserLPDefaults[ 'form' ] ) ); |
| 33 | + $country = $request->getVal( 'country' ); |
| 34 | + // If no country was passed do a GeoIP lookup |
| 35 | + if ( !$country ) { |
| 36 | + if ( function_exists( 'geoip_country_code_by_name' ) ) { |
| 37 | + $ip = wfGetIP(); |
| 38 | + if ( IP::isValid( $ip ) ) { |
| 39 | + $country = geoip_country_code_by_name( $ip ); |
| 40 | + } |
| 41 | + } |
| 42 | + } |
| 43 | + // If country still isn't set, set it to the default |
| 44 | + if ( !$country ) { |
| 45 | + $country = $wgFundraiserLPDefaults[ 'country' ]; |
| 46 | + } |
| 47 | + $country = $this->make_safe( $country ); |
33 | 48 | |
34 | 49 | # begin generating the template call |
35 | | - $output .= "{{ $template\n| appeal = $appeal\n| form = $form\n"; |
| 50 | + $output .= "{{ $template\n| appeal = $appeal\n| form = $form\n| country = $country\n"; |
36 | 51 | |
37 | 52 | # add any parameters passed in the querystring |
38 | 53 | foreach ( $request->getValues() as $k_unsafe => $v_unsafe ) { |
39 | 54 | # skip the required variables |
40 | | - if ( $k_unsafe == "template" || $k_unsafe == "appeal" || $k_unsafe == "form" ) { |
| 55 | + if ( $k_unsafe == "template" || $k_unsafe == "appeal" || $k_unsafe == "form" || $k_unsafe == "country" ) { |
41 | 56 | continue; |
42 | 57 | } |
43 | 58 | # get the variables name and value |
Property changes on: branches/wmf/1.18wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
44 | 59 | Merged /trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php:r103829 |
Property changes on: branches/wmf/1.18wmf1/extensions/FundraiserLandingPage |
___________________________________________________________________ |
Added: svn:mergeinfo |
45 | 60 | Merged /branches/sqlite/extensions/FundraiserLandingPage:r58211-58321 |
46 | 61 | Merged /trunk/phase3/extensions/FundraiserLandingPage:r92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93520,93818-93822,93847,93858,93891,93935-93936,94058,94062,94068,94107,94155,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95023,95042,95072-95073,95155,95327,95332,95410,95422,95426,95442,95468,95601,95812,98578,98598,98656 |
47 | 62 | Merged /branches/new-installer/phase3/extensions/FundraiserLandingPage:r43664-66004 |
48 | 63 | Merged /branches/REL1_15/phase3/extensions/FundraiserLandingPage:r51646 |
49 | 64 | Merged /branches/REL1_18/extensions/FundraiserLandingPage:r101758,103190 |
50 | 65 | Merged /branches/REL1_17/phase3/extensions/FundraiserLandingPage:r81445,81448 |
51 | 66 | Merged /trunk/extensions/FundraiserLandingPage:r99592,99653,100092,100419,100686,100692,100699,103669,103829 |