Index: trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.php |
— | — | @@ -40,9 +40,11 @@ |
41 | 41 | * or not they are passed through the querystring. |
42 | 42 | */ |
43 | 43 | $wgFundraiserLPDefaults = array( |
44 | | - 'template' => 'Lp-wrapper', |
| 44 | + 'template' => 'Lp-layout-default', |
45 | 45 | 'appeal' => 'Appeal-default', |
46 | | - 'form' => 'Form-default', |
| 46 | + 'appeal-template' => 'Appeal-template-default', |
| 47 | + 'form-template' => 'Form-template-default', |
| 48 | + 'form-countryspecific' => 'Form-countryspecific-control', |
47 | 49 | 'country' => 'XX' // per Charles Barr |
48 | 50 | ); |
49 | 51 | |
Index: trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php |
— | — | @@ -23,11 +23,27 @@ |
24 | 24 | |
25 | 25 | # clear output variable to be safe |
26 | 26 | $output = ''; |
| 27 | + |
| 28 | + # begin generating the template call |
| 29 | + $template = $this->make_safe( $wgRequest->getText( 'template', $wgFundraiserLPDefaults[ 'template' ] ) ); |
| 30 | + $output .= "{{ $template\n"; |
| 31 | + |
| 32 | + # get the required variables (except template and country) to use for the landing page |
| 33 | + $requiredParams = array( |
| 34 | + 'appeal', |
| 35 | + 'appeal-template', |
| 36 | + 'form-template', |
| 37 | + 'form-countryspecific' |
| 38 | + ); |
| 39 | + foreach( $requiredParams as $requiredParam ) { |
| 40 | + $param = $this->make_safe( |
| 41 | + $wgRequest->getText( $requiredParam, $wgFundraiserLPDefaults[$requiredParam] ) |
| 42 | + ); |
| 43 | + // Add them to the template call |
| 44 | + $output .= "| $requiredParam = $param\n"; |
| 45 | + } |
27 | 46 | |
28 | | - # get the required variables to use for the landing page |
29 | | - $template = $this->make_safe( $wgRequest->getText( 'template', $wgFundraiserLPDefaults[ 'template' ] ) ); |
30 | | - $appeal = $this->make_safe( $wgRequest->getText( 'appeal', $wgFundraiserLPDefaults[ 'appeal' ] ) ); |
31 | | - $form = $this->make_safe( $wgRequest->getText( 'form', $wgFundraiserLPDefaults[ 'form' ] ) ); |
| 47 | + # get the country code |
32 | 48 | $country = $wgRequest->getVal( 'country' ); |
33 | 49 | // If no country was passed do a GeoIP lookup |
34 | 50 | if ( !$country ) { |
— | — | @@ -43,17 +59,17 @@ |
44 | 60 | $country = $wgFundraiserLPDefaults[ 'country' ]; |
45 | 61 | } |
46 | 62 | $country = $this->make_safe( $country ); |
| 63 | + $output .= "| country = $country\n"; |
47 | 64 | |
48 | | - # begin generating the template call |
49 | | - $output .= "{{ $template\n| appeal = $appeal\n| form = $form\n| country = $country\n"; |
50 | | - |
51 | | - # add any parameters passed in the querystring |
| 65 | + $excludeKeys = $requiredParams + array( 'template', 'country', 'title' ); |
| 66 | + |
| 67 | + # add any other parameters passed in the querystring |
52 | 68 | foreach ( $wgRequest->getValues() as $k_unsafe => $v_unsafe ) { |
53 | 69 | # skip the required variables |
54 | | - if ( $k_unsafe == "template" || $k_unsafe == "appeal" || $k_unsafe == "form" || $k_unsafe == "country" ) { |
| 70 | + if ( in_array( $k_unsafe, $excludeKeys ) ) { |
55 | 71 | continue; |
56 | 72 | } |
57 | | - # get the variables name and value |
| 73 | + # get the variable's name and value |
58 | 74 | $key = $this->make_safe( $k_unsafe ); |
59 | 75 | $val = $this->make_safe( $v_unsafe ); |
60 | 76 | # print to the template in wiki-syntax |