r99261 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99260‎ | r99261 | r99262 >
Date:21:22, 7 October 2011
Author:khorn
Status:ok
Tags:fundraising 
Comment:
General cruft removal + one silly bug fix.
r99228
Modified paths:
  • /branches/fundraising/extensions/DonationInterface/donate_interface/donate_interface.php (deleted) (history)
  • /branches/fundraising/extensions/DonationInterface/donationinterface.php (modified) (history)
  • /branches/fundraising/extensions/DonationInterface/extras/conversion_log/conversion_log.php (deleted) (history)
  • /branches/fundraising/extensions/DonationInterface/extras/custom_filters/custom_filters.php (deleted) (history)
  • /branches/fundraising/extensions/DonationInterface/extras/extras.php (deleted) (history)
  • /branches/fundraising/extensions/DonationInterface/extras/recaptcha/recaptcha.php (deleted) (history)
  • /branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.php (deleted) (history)
  • /branches/fundraising/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php (deleted) (history)
  • /branches/fundraising/extensions/DonationInterface/paypal_gateway/paypal_gateway.i18n.php (deleted) (history)
  • /branches/fundraising/extensions/DonationInterface/paypal_gateway/paypal_gateway.php (deleted) (history)

Diff [purge]

Index: branches/fundraising/extensions/DonationInterface/donationinterface.php
@@ -41,7 +41,6 @@
4242 'Minfraud' => false, //this is definitely an Extra
4343 'Minfraud_as_filter' => false, //extra
4444 'Recaptcha' => false, //extra
45 - 'Paypal' => false, //this is the paypal redirect. TODO: Determine if we're even using this anymore.
4645 'PayflowPro' => false,
4746 'GlobalCollect' => false,
4847
@@ -159,6 +158,7 @@
160159
161160 /**
162161 * The URL to redirect a transaction to PayPal
 162+ * This should probably point to ContributionTracking.
163163 */
164164 $wgDonationInterfacePaypalURL = '';
165165 $wgDonationInterfaceRetrySeconds = 5;
@@ -265,13 +265,6 @@
266266 $wgPayflowProGatewayAllowedHtmlForms = $wgDonationInterfaceAllowedHtmlForms;
267267 }
268268
269 -//Paypal gateway globals
270 -if ( $optionalParts['Paypal'] === true ){
271 - // default variables that should be set in LocalSettings.php
272 - $wgPaypalEmail = '';
273 - $wgPaypalUrl = 'http://wikimediafoundation.org/wiki/Special:ContributionTracking?';
274 -}
275 -
276269 //Stomp globals
277270 if ($optionalParts['Stomp'] === true){
278271 $wgStompServer = "";
@@ -409,26 +402,6 @@
410403 //Unit tests
411404 $wgHooks['UnitTestsList'][] = 'efDonationInterfaceUnitTests';
412405
413 -//PayflowPro gateway hooks
414 -if ( $optionalParts['PayflowPro'] === true ){
415 - //TODO: Determine once and for all if this is actually as crufty as it looks.
416 - $wgHooks['DonationInterface_Value'][] = 'pfpGatewayValue';
417 - $wgHooks['DonationInterface_Page'][] = 'pfpGatewayPage';
418 -}
419 -
420 -//Paypal gateway hooks
421 -if ( $optionalParts['Paypal'] === true ){
422 - //TODO: Determine if this is all cruft. I'm guessing "Probably".
423 - /**
424 - * Hooks required to interface with the donation extension (include <donate> on page)
425 - *
426 - * gwValue supplies the value of the form option, the name that appears on the form
427 - * and the currencies supported by the gateway in the $values array
428 - */
429 - $wgHooks['DonationInterface_Value'][] = 'paypalGatewayValue';
430 - $wgHooks['DonationInterface_Page'][] = 'paypalGatewayPage';
431 -}
432 -
433406 //Stomp hooks
434407 if ($optionalParts['Stomp'] === true){
435408 $wgHooks['ParserFirstCallInit'][] = 'efStompSetup';
@@ -507,11 +480,6 @@
508481 $wgAjaxExportList[] = "fnPayflowProofofWork";
509482 }
510483
511 -//Paypal magical globals
512 -if ( $optionalParts['Paypal'] === true ){
513 - $wgExtensionMessagesFiles['PaypalGateway'] = $donationinterface_dir . 'paypal_gateway/paypal_gateway.i18n.php';
514 -}
515 -
516484 //Minfraud magical globals
517485 if ( $optionalParts['Minfraud'] === true ){ //We do not want this in filter mode.
518486 $wgExtensionFunctions[] = 'efMinFraudSetup';
@@ -542,20 +510,8 @@
543511 require_once( $donationinterface_dir . 'extras/custom_filters/filters/minfraud/minfraud.php' );
544512 }
545513
546 -//---Paypal functions---
547 -if ($optionalParts['Paypal'] === true){
548 - require_once( $donationinterface_dir . 'paypal_gateway/paypal_gateway.php' );
549 -}
550 -
551 -//---PayflowPro functions---
552 -if ($optionalParts['PayflowPro'] === true){
553 - require_once( $donationinterface_dir . 'payflowpro_gateway/payflowpro_gateway.php' );
554 -}
555 -
556 -
557 -
558514 function efDonationInterfaceUnitTests( &$files ) {
559 - $files[] = $donationinterface_dir . 'tests/AllTests.php';
 515+ $files[] = dirname( __FILE__ ) . '/tests/AllTests.php';
560516 return true;
561517 }
562518
Index: branches/fundraising/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php
@@ -1,169 +0,0 @@
2 -<?php
3 -
4 -# Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly.
5 -if ( !defined( 'MEDIAWIKI' ) ) {
6 - echo <<<EOT
7 -To install PayflowPro Gateway extension, put the following line in LocalSettings.php:
8 -require_once( "\$IP/extensions/payflowpro_gateway/payflowpro_gateway.php" );
9 -EOT;
10 - exit( 1 );
11 -}
12 -
13 -// Extension credits that will show up on Special:Version
14 -$wgExtensionCredits['specialpage'][] = array(
15 - 'name' => 'PayflowPro Gateway',
16 - 'author' => 'Four Kitchens',
17 - 'version' => '1.0.0',
18 - 'descriptionmsg' => 'payflowpro_gateway-desc',
19 - 'url' => 'http://www.mediawiki.org/wiki/Extension:PayflowProGateway',
20 -);
21 -
22 -// Set up the new special page
23 -$dir = dirname( __FILE__ ) . '/';
24 -//$wgAutoloadClasses['PayflowProGateway'] = $dir . 'payflowpro_gateway.body.php';
25 -//$wgAutoloadClasses['PayflowProAdapter'] = $dir . 'payflowpro.adapter.php';
26 -
27 -//$wgExtensionMessagesFiles['PayflowProGateway'] = $dir . 'payflowpro_gateway.i18n.php';
28 -//$wgExtensionMessagesFiles['PayflowProGatewayCountries'] = $dir . 'payflowpro_gateway.countries.i18n.php';
29 -//$wgExtensionMessagesFiles['PayflowProGatewayUSStates'] = $dir . 'payflowpro_gateway.us-states.i18n.php';
30 -//$wgExtensionAliasesFiles['PayflowProGateway'] = $dir . 'payflowpro_gateway.alias.php';
31 -//$wgSpecialPages['PayflowProGateway'] = 'PayflowProGateway';
32 -//$wgAjaxExportList[] = "fnPayflowProofofWork";
33 -
34 -
35 -// set defaults, these should be assigned in LocalSettings.php
36 -//$wgPayflowProGatewayURL = 'https://payflowpro.paypal.com';
37 -//$wgPayflowProGatewayTestingURL = 'https://pilot-payflowpro.paypal.com'; // Payflow testing URL
38 -
39 -//$wgPayFlowProGatewayCSSVersion = 1;
40 -//
41 -//$wgPayflowProGatewayPartnerID = ''; // PayPal or original authorized reseller
42 -//$wgPayflowProGatewayVendorID = ''; // paypal merchant login ID
43 -//$wgPayflowProGatewayUserID = ''; // if one or more users are set up, authorized user ID, else same as VENDOR
44 -//$wgPayflowProGatewayPassword = ''; // merchant login password
45 -// a boolean to determine if we're in testing mode
46 -//$wgPayflowProGatewayTest = FALSE;
47 -
48 -// timeout in seconds for communicating with paypal
49 -//$wgPayflowProGatewayTimeout = 5;
50 -
51 -/**
52 - * The default form to use
53 - */
54 -//$wgPayflowProGatewayDefaultForm = 'TwoStepTwoColumn';
55 -
56 -/**
57 - * A string or array of strings for making tokens more secure
58 - *
59 - * Please set this! If you do not, tokens are easy to get around, which can
60 - * potentially leave you and your users vulnerable to CSRF or other forms of
61 - * attack.
62 - */
63 -//$wgPayflowProGatewaySalt = $wgSecretKey;
64 -
65 -///**
66 -// * A string that can contain wikitext to display at the head of the credit card form
67 -// *
68 -// * This string gets run like so: $wg->addHtml( $wg->Parse( $wgpayflowGatewayHeader ))
69 -// * You can use '@language' as a placeholder token to extract the user's language.
70 -// *
71 -// */
72 -//$wgPayflowProGatewayHeader = NULL;
73 -//
74 -///**
75 -// * A string containing full URL for Javascript-disabled credit card form redirect
76 -// */
77 -//$wgPayflowProGatewayNoScriptRedirect = null;
78 -//
79 -///**
80 -// * Proxy settings
81 -// *
82 -// * If you need to use an HTTP proxy for outgoing traffic,
83 -// * set wgPayflowGatweayUseHTTPProxy=TRUE and set $wgPayflowProGatewayHTTPProxy
84 -// * to the proxy desination.
85 -// * eg:
86 -// * $wgPayflowProGatewayUseHTTPProxy=TRUE;
87 -// * $wgPayflowProGatewayHTTPProxy='192.168.1.1:3128'
88 -// */
89 -//$wgPayflowProGatewayUseHTTPProxy = FALSE;
90 -//$wgPayflowProGatewayHTTPProxy = '';
91 -//
92 -///**
93 -// * Set the max-age value for Squid
94 -// *
95 -// * If you have Squid enabled for caching, use this variable to configure
96 -// * the s-max-age for cached requests.
97 -// * @var int Time in seconds
98 -// */
99 -//$wgPayflowProGatewaySMaxAge = 6000;
100 -
101 -/**
102 - * Directory for HTML forms (used by RapidHtml form class)
103 - * @var string
104 - */
105 -//$wgPayflowProGatewayHtmlFormDir = dirname( __FILE__ ) . "/forms/html";
106 -
107 -/**
108 - * An array of allowed HTML forms.
109 - *
110 - * Be sure to use full paths. If your HTML form is not listed here, it will
111 - * /never/ be loaded by the rapid html form loader!
112 - * @var string
113 - */
114 -//$wgPayflowProGatewayAllowedHtmlForms = $wgDonationInterfaceAllowedHtmlForms;
115 -
116 -///**
117 -// * Configure price ceiling and floor for valid contribution amount. Values
118 -// * should be in USD.
119 -// */
120 -//$wgPayflowProGatewayPriceFloor = '1.00';
121 -//$wgPayflowProGatewayPriceCeiling = '10000.00';
122 -
123 -/**
124 - * Hooks required to interface with the donation extension (include <donate> on page)
125 - *
126 - * gwValue supplies the value of the form option, the name that appears on the form
127 - * and the currencies supported by the gateway in the $values array
128 -// */
129 -//$wgHooks['DonationInterface_Value'][] = 'pfpGatewayValue';
130 -//$wgHooks['DonationInterface_Page'][] = 'pfpGatewayPage';
131 -
132 -//// enable the API
133 -//$wgAPIModules['pfp'] = 'ApiPayflowProGateway';
134 -//$wgAutoloadClasses['ApiPayflowProGateway'] = $dir . 'api_payflowpro_gateway.php';
135 -
136 -/**
137 - * Hook to register form value and display name of this gateway
138 - * also supplies currencies supported by this gateway
139 - */
140 -function pfpGatewayValue( &$values ) {
141 - $values['payflow'] = array(
142 - 'gateway' => 'payflow',
143 - 'display_name' => 'Credit Card',
144 - 'form_value' => 'payflow',
145 - 'currencies' => array(
146 - 'GBP' => 'GBP: British Pound',
147 - 'EUR' => 'EUR: Euro',
148 - 'USD' => 'USD: U.S. Dollar',
149 - 'AUD' => 'AUD: Australian Dollar',
150 - 'CAD' => 'CAD: Canadian Dollar',
151 - 'JPY' => 'JPY: Japanese Yen',
152 - ),
153 - );
154 -
155 - return true;
156 -}
157 -
158 -/**
159 - * Hook to supply the page address of the payment gateway
160 - *
161 - * The user will redirected here with supplied data with input data appended (GET).
162 - * For example, if $url[$key] = index.php?title=Special:PayflowProGateway
163 - * the result might look like this: http://www.yourdomain.com/index.php?title=Special:PayflowProGateway&amount=75.00&currency_code=USD&payment_method=payflow
164 - */
165 -function pfpGatewayPage( &$url ) {
166 - global $wgScript;
167 -
168 - $url['payflow'] = $wgScript . "?title=Special:PayflowProGateway";
169 - return true;
170 -}
Index: branches/fundraising/extensions/DonationInterface/extras/extras.php
@@ -1,21 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * An abstract class and set up for gateway 'extras'
6 - *
7 - * To install the DontaionInterface extension, put the following line in LocalSettings.php:
8 - * require_once( "\$IP/extensions/DonationInterface/donationinterface.php" );
9 - *
10 - * TODO: Remove this file. :)
11 - */
12 -if ( !defined( 'MEDIAWIKI' ) ) {
13 - die( "This file is part of Gateway extension. It is not a valid entry point.\n" );
14 -}
15 -
16 -$wgExtensionCredits['gateway_extras'][] = array(
17 - 'name' => 'extras',
18 - 'author' => 'Arthur Richards',
19 - 'url' => '',
20 - 'description' => "This extension handles some of the set up required for Gateway extras"
21 -);
22 -
Index: branches/fundraising/extensions/DonationInterface/extras/custom_filters/custom_filters.php
@@ -1,29 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Provides a unified way to define and run custom filters for incoming transactions
6 - *
7 - * Running filters through 'custom filters' rather than directly through the validate hook in the gateway
8 - * offers the advantage of simplifying the passage of relvent data between filters/validators that's
9 - * needed to perform more complex validation/filtering of transactions.
10 - *
11 - * The actual filters themselves are regular MW extensions and can optional be organized in filters/
12 - * They should be invoked by using the 'GatewayCustomFilter' hook, which will pass the entire
13 - * CustomFilter object to the filter. The gateway object and its data are included in the CustomFilter
14 - * object.
15 - *
16 - * To install the DontaionInterface extension, put the following line in LocalSettings.php:
17 - * require_once( "\$IP/extensions/DonationInterface/donationinterface.php" );
18 - *
19 - * TODO: Remove this file. :)
20 - */
21 -if ( !defined( 'MEDIAWIKI' ) ) {
22 - die( "This file is part of the MinFraud for Gateway extension. It is not a valid entry point.\n" );
23 -}
24 -
25 -$wgExtensionCredits['gateway_custom_filters'][] = array(
26 - 'name' => 'custom filters',
27 - 'author' => 'Arthur Richards',
28 - 'url' => '',
29 - 'description' => 'This extension provides a way to define custom filters for incoming transactions for the gateway.'
30 -);
Index: branches/fundraising/extensions/DonationInterface/extras/conversion_log/conversion_log.php
@@ -1,22 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Extra to log gateway response during post processing hook
6 - *
7 - * @fixme Class/file names should likely change to reflect change in purpose...
8 - *
9 - * To install the DontaionInterface extension, put the following line in LocalSettings.php:
10 - * require_once( "\$IP/extensions/DonationInterface/donationinterface.php" );
11 - *
12 - * TODO: Remove this file. :)
13 - */
14 -if ( !defined( 'MEDIAWIKI' ) ) {
15 - die( "This file is part of the Conversion Log for Gateway extension. It is not a valid entry point.\n" );
16 -}
17 -
18 -$wgExtensionCredits['gateway_extras_conversionLog'][] = array(
19 - 'name' => 'conversion log',
20 - 'author' => 'Arthur Richards',
21 - 'url' => '',
22 - 'description' => "This extension handles logging for Gateway extension 'extras'"
23 -);
Index: branches/fundraising/extensions/DonationInterface/extras/recaptcha/recaptcha.php
@@ -1,20 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Extra to expose a recaptcha for 'challenged' transactions
6 - *
7 - * To install the DontaionInterface extension, put the following line in LocalSettings.php:
8 - * require_once( "\$IP/extensions/DonationInterface/donationinterface.php" );
9 - *
10 - * TODO: Remove this file. :)
11 - */
12 -if ( !defined( 'MEDIAWIKI' ) ) {
13 - die( "This file is part of the ReCaptcha for Gateway extension. It is not a valid entry point.\n" );
14 -}
15 -
16 -$wgExtensionCredits['extras_recaptcha'][] = array(
17 - 'name' => 'reCaptcha',
18 - 'author' => 'Arthur Richards',
19 - 'url' => '',
20 - 'description' => "This extension exposes a reCpathca for 'challenged' transactions in the Gateway"
21 -);
Index: branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.php
@@ -1,128 +0,0 @@
2 -<?php
3 -/**
4 - * TODO: Remove this file. :)
5 - */
6 -
7 -# Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly.
8 -if ( !defined( 'MEDIAWIKI' ) ) {
9 - echo <<<EOT
10 -To install GlobalCollect Gateway extension, put the following line in LocalSettings.php:
11 -require_once( "\$IP/extensions/globalcollect_gateway/globalcollect_gateway.php" );
12 -EOT;
13 - exit( 1 );
14 -}
15 -
16 -// Extension credits that will show up on Special:Version
17 -$wgExtensionCredits['specialpage'][] = array(
18 - 'name' => 'GlobalCollect Gateway',
19 - 'author' => 'Four Kitchens',
20 - 'version' => '1.0.0',
21 - 'descriptionmsg' => 'globalcollect_gateway-desc',
22 - 'url' => 'http://www.mediawiki.org/wiki/Extension:GlobalCollectGateway',
23 -);
24 -
25 -//$wgGlobalCollectGatewayUseSyslog = false;
26 -
27 -// Set up the new special page
28 -$dir = dirname( __FILE__ ) . '/';
29 -//$wgAutoloadClasses['GlobalCollectGateway'] = $dir . 'globalcollect_gateway.body.php';
30 -//$wgAutoloadClasses['GlobalCollectGatewayResult'] = $dir . 'globalcollect_resultswitcher.body.php';
31 -//$wgAutoloadClasses['GlobalCollectAdapter'] = $dir . 'globalcollect.adapter.php';
32 -//$wgExtensionMessagesFiles['GlobalCollectGateway'] = $dir . '../payflowpro_gateway/payflowpro_gateway.i18n.php';
33 -//$wgExtensionMessagesFiles['GlobalCollectGatewayCountries'] = $dir . '../payflowpro_gateway/payflowpro_gateway.countries.i18n.php';
34 -//$wgExtensionMessagesFiles['GlobalCollectGatewayUSStates'] = $dir . '../payflowpro_gateway/payflowpro_gateway.us-states.i18n.php';
35 -//$wgExtensionAliasesFiles['GlobalCollectGateway'] = $dir . '../payflowpro_gateway/payflowpro_gateway.alias.php';
36 -//$wgSpecialPages['GlobalCollectGateway'] = 'GlobalCollectGateway';
37 -//$wgSpecialPages['GlobalCollectGatewayResult'] = 'GlobalCollectGatewayResult';
38 -//$wgAjaxExportList[] = "fnGlobalCollectofofWork";
39 -// set defaults, these should be assigned in LocalSettings.php
40 -//$wgGlobalCollectGatewayURL = 'https://ps.gcsip.nl/wdl/wdl';
41 -//$wgGlobalCollectGatewayTestingURL = 'https://'; // GlobalCollect testing URL
42 -
43 -//$wgGlobalCollectGatewayCSSVersion = 1;
44 -
45 -//$wgGlobalCollectGatewayMerchantID = ''; // GlobalCollect ID
46 -// a boolean to determine if we're in testing mode
47 -//$wgGlobalCollectGatewayTest = FALSE;
48 -
49 -// timeout in seconds for communicating with [gateway]
50 -//$wgGlobalCollectGatewayTimeout = 2;
51 -
52 -/**
53 - * The default form to use
54 - */
55 -//$wgGlobalCollectGatewayDefaultForm = 'TwoStepTwoColumn';
56 -
57 -/**
58 - * A string or array of strings for making tokens more secure
59 - *
60 - * Please set this! If you do not, tokens are easy to get around, which can
61 - * potentially leave you and your users vulnerable to CSRF or other forms of
62 - * attack.
63 - */
64 -//$wgGlobalCollectGatewaySalt = $wgSecretKey;
65 -
66 -
67 -/**
68 - * A string that can contain wikitext to display at the head of the credit card form
69 - *
70 - * This string gets run like so: $wg->addHtml( $wg->Parse( $wgpayflowGatewayHeader ))
71 - * You can use '@language' as a placeholder token to extract the user's language.
72 - *
73 - */
74 -//$wgGlobalCollectGatewayHeader = NULL;
75 -
76 -/**
77 - * A string containing full URL for Javascript-disabled credit card form redirect
78 - */
79 -//$wgGlobalCollectGatewayNoScriptRedirect = null;
80 -
81 -/**
82 - * Proxy settings
83 - *
84 - * If you need to use an HTTP proxy for outgoing traffic,
85 - * set wgGlobalCollectGatweayUseHTTPProxy=TRUE and set $wgGlobalCollectGatewayHTTPProxy
86 - * to the proxy desination.
87 - * eg:
88 - * $wgGlobalCollectGatewayUseHTTPProxy=TRUE;
89 - * $wgGlobalCollectGatewayHTTPProxy='192.168.1.1:3128'
90 - */
91 -//$wgGlobalCollectGatewayUseHTTPProxy = FALSE;
92 -//$wgGlobalCollectGatewayHTTPProxy = '';
93 -
94 -/**
95 - * Set the max-age value for Squid
96 - *
97 - * If you have Squid enabled for caching, use this variable to configure
98 - * the s-max-age for cached requests.
99 - * @var int Time in seconds
100 - */
101 -//$wgGlobalCollectGatewaySMaxAge = 6000;
102 -
103 -/**
104 - * Directory for HTML forms (used by RapidHtml form class)
105 - * @var string
106 - */
107 -//$wgGlobalCollectGatewayHtmlFormDir = dirname( __FILE__ ) . "/forms/html";
108 -
109 -/**
110 - * An array of allowed HTML forms.
111 - *
112 - * Be sure to use full paths. If your HTML form is not listed here, it will
113 - * /never/ be loaded by the rapid html form loader!
114 - * @var string
115 - */
116 -//$wgGlobalCollectGatewayAllowedHtmlForms = $wgDonationInterfaceAllowedHtmlForms;
117 -
118 -///**
119 -// * Configure price cieling and floor for valid contribution amount. Values
120 -// * should be in USD.
121 -// */
122 -//$wgGlobalCollectGatewayPriceFloor = '1.00';
123 -//$wgGlobalCollectGatewayPriceCeiling = '10000.00';
124 -//
125 -///**
126 -// * Thank You & Fail pages.
127 -// */
128 -//$wgGlobalCollectGatewayThankYouPage = $wgDonationInterfaceThankYouPage;
129 -//$wgGlobalCollectGatewayFailPage = $wgDonationInterfaceFailPage;
\ No newline at end of file
Index: branches/fundraising/extensions/DonationInterface/paypal_gateway/paypal_gateway.i18n.php
@@ -1,280 +0,0 @@
2 -<?php
3 -/**
4 - * Internationalization file for the Donation Interface- Paypal Gateway - extension
5 - *
6 - * @file
7 - * @ingroup Extensions
8 - */
9 -
10 -$messages = array();
11 -
12 -/** English */
13 -$messages['en'] = array(
14 - // 'paypalgateway' => 'Paypal gateway', // FIXME: remove? Appears to be unused.
15 - 'paypal_gateway-desc' => 'Registers PayPal as a donation mechanism',
16 -);
17 -
18 -/** Message documentation (Message documentation)
19 - * @author Fryed-peach
20 - */
21 -$messages['qqq'] = array(
22 - 'paypal_gateway-desc' => '{{desc}}',
23 -);
24 -
25 -/** Afrikaans (Afrikaans)
26 - * @author Naudefj
27 - */
28 -$messages['af'] = array(
29 - 'paypal_gateway-desc' => "Registreer PayPal as 'n skenkingsmeganisme",
30 -);
31 -
32 -/** Arabic (العربية)
33 - * @author OsamaK
34 - */
35 -$messages['ar'] = array(
36 - 'paypal_gateway-desc' => 'تسجل PayPal كآلية تبرع',
37 -);
38 -
39 -/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
40 - * @author EugeneZelenko
41 - */
42 -$messages['be-tarask'] = array(
43 - 'paypal_gateway-desc' => 'Рэгіструе PayPal у якасьці сэрвісу ахвяраваньняў',
44 -);
45 -
46 -/** Breton (Brezhoneg)
47 - * @author Fulup
48 - */
49 -$messages['br'] = array(
50 - 'paypal_gateway-desc' => 'Enrollañ a ra PayPal da wikefre evit ober un donezon',
51 -);
52 -
53 -/** Bosnian (Bosanski)
54 - * @author CERminator
55 - */
56 -$messages['bs'] = array(
57 - 'paypal_gateway-desc' => 'Registruje PayPal kao mehanizam za donacije',
58 -);
59 -
60 -/** Czech (Česky)
61 - * @author Mormegil
62 - */
63 -$messages['cs'] = array(
64 - 'paypal_gateway-desc' => 'Zaregistruje PayPal jako příspěvkový prostředek',
65 -);
66 -
67 -/** German (Deutsch) */
68 -$messages['de'] = array(
69 - 'paypal_gateway-desc' => 'Registriert PayPal als Spendensystem',
70 -);
71 -
72 -/** Zazaki (Zazaki)
73 - * @author Xoser
74 - */
75 -$messages['diq'] = array(
76 - 'paypal_gateway-desc' => 'PayPal xo qeyd keno',
77 -);
78 -
79 -/** Lower Sorbian (Dolnoserbski)
80 - * @author Michawiki
81 - */
82 -$messages['dsb'] = array(
83 - 'paypal_gateway-desc' => 'Registrěrujo PayPal ako pósćiwański mechanizm',
84 -);
85 -
86 -/** Esperanto (Esperanto)
87 - * @author Yekrats
88 - */
89 -$messages['eo'] = array(
90 - 'paypal_gateway-desc' => 'Registras Paypal-on kiel donacilo',
91 -);
92 -
93 -/** Spanish (Español)
94 - * @author Locos epraix
95 - */
96 -$messages['es'] = array(
97 - 'paypal_gateway-desc' => 'Registra PayPal como mecanismo de donación',
98 -);
99 -
100 -/** Finnish (Suomi)
101 - * @author Str4nd
102 - */
103 -$messages['fi'] = array(
104 - 'paypal_gateway-desc' => 'Rekisteröi PayPalin lahjoitusmekanismina.',
105 -);
106 -
107 -/** French (Français)
108 - * @author PieRRoMaN
109 - */
110 -$messages['fr'] = array(
111 - 'paypal_gateway-desc' => 'Inscrit PayPal comme mécanisme de donation',
112 -);
113 -
114 -/** Galician (Galego)
115 - * @author Toliño
116 - */
117 -$messages['gl'] = array(
118 - 'paypal_gateway-desc' => 'Rexistra o PayPal como un mecanismo de doazón',
119 -);
120 -
121 -/** Swiss German (Alemannisch)
122 - * @author Als-Holder
123 - */
124 -$messages['gsw'] = array(
125 - 'paypal_gateway-desc' => 'Regischtriert PayPal as Spänd-Inschtrumänt',
126 -);
127 -
128 -/** Upper Sorbian (Hornjoserbsce)
129 - * @author Michawiki
130 - */
131 -$messages['hsb'] = array(
132 - 'paypal_gateway-desc' => 'Registruje PayPal jako darjenski mechanizm',
133 -);
134 -
135 -/** Hungarian (Magyar)
136 - * @author Glanthor Reviol
137 - */
138 -$messages['hu'] = array(
139 - 'paypal_gateway-desc' => 'PayPal regisztrálása mint adakozási mód',
140 -);
141 -
142 -/** Interlingua (Interlingua)
143 - * @author McDutchie
144 - */
145 -$messages['ia'] = array(
146 - 'paypal_gateway-desc' => 'Registra PayPal como mechanismo de donation',
147 -);
148 -
149 -/** Indonesian (Bahasa Indonesia)
150 - * @author IvanLanin
151 - */
152 -$messages['id'] = array(
153 - 'paypal_gateway-desc' => 'Mendaftarkan PayPal sebagai suatu mekanisme donasi',
154 -);
155 -
156 -/** Japanese (日本語)
157 - * @author Fryed-peach
158 - */
159 -$messages['ja'] = array(
160 - 'paypal_gateway-desc' => 'PayPal を寄付のための方法として登録する',
161 -);
162 -
163 -/** Ripoarisch (Ripoarisch)
164 - * @author Purodha
165 - */
166 -$messages['ksh'] = array(
167 - 'paypal_gateway-desc' => 'Deiht <i lang="en">PayPal</i> als ene Wääsch för Spände enndraare.',
168 -);
169 -
170 -/** Luxembourgish (Lëtzebuergesch)
171 - * @author Robby
172 - */
173 -$messages['lb'] = array(
174 - 'paypal_gateway-desc' => 'Registréiert PayPal als Mechanismus fir Donen',
175 -);
176 -
177 -/** Macedonian (Македонски)
178 - * @author Bjankuloski06
179 - */
180 -$messages['mk'] = array(
181 - 'paypal_gateway-desc' => 'Го регистрира PayPal како механизам за донирање',
182 -);
183 -
184 -/** Malayalam (മലയാളം)
185 - * @author Praveenp
186 - */
187 -$messages['ml'] = array(
188 - 'paypal_gateway-desc' => 'സംഭാവനയ്ക്കുള്ള മാർഗ്ഗമായി പേപാൽ രജിസ്റ്റർ ചെയ്യുക',
189 -);
190 -
191 -/** Dutch (Nederlands)
192 - * @author Siebrand
193 - */
194 -$messages['nl'] = array(
195 - 'paypal_gateway-desc' => 'Registreert PayPal als een donateursinstrument',
196 -);
197 -
198 -/** Norwegian Nynorsk (‪Norsk (nynorsk)‬)
199 - * @author Gunnernett
200 - */
201 -$messages['nn'] = array(
202 - 'paypal_gateway-desc' => 'Registrerer PayPal som ein mogleg stad å gje gåver',
203 -);
204 -
205 -/** Occitan (Occitan)
206 - * @author Cedric31
207 - */
208 -$messages['oc'] = array(
209 - 'paypal_gateway-desc' => 'Inscritz PayPal coma mecanisme de donacion',
210 -);
211 -
212 -/** Piedmontese (Piemontèis)
213 - * @author Dragonòt
214 - */
215 -$messages['pms'] = array(
216 - 'paypal_gateway-desc' => 'A registra PayPal com un mecanism ëd donassion',
217 -);
218 -
219 -/** Portuguese (Português)
220 - * @author Hamilton Abreu
221 - */
222 -$messages['pt'] = array(
223 - 'paypal_gateway-desc' => 'Regista o PayPal como mecanismo de contribuições monetárias',
224 -);
225 -
226 -/** Tarandíne (Tarandíne)
227 - * @author Joetaras
228 - */
229 -$messages['roa-tara'] = array(
230 - 'paypal_gateway-desc' => "PayPal reggistrate cumme 'nu meccanisme de donazziune",
231 -);
232 -
233 -/** Russian (Русский)
234 - * @author Александр Сигачёв
235 - */
236 -$messages['ru'] = array(
237 - 'paypal_gateway-desc' => 'Регистрирует PayPal в качестве механизма пожертвований',
238 -);
239 -
240 -/** Serbian Cyrillic ekavian (Српски (ћирилица))
241 - * @author Михајло Анђелковић
242 - */
243 -$messages['sr-ec'] = array(
244 - 'paypal_gateway-desc' => 'Региструје PayPal као механизам за донације',
245 -);
246 -
247 -/** Turkish (Türkçe)
248 - * @author Joseph
249 - */
250 -$messages['tr'] = array(
251 - 'paypal_gateway-desc' => "Bir bağış düzeneği olarak PayPal'ı kaydeder",
252 -);
253 -
254 -/** Ukrainian (Українська)
255 - * @author Prima klasy4na
256 - */
257 -$messages['uk'] = array(
258 - 'paypal_gateway-desc' => 'Реєструє PayPal в якості механізму для здійснення пожертв',
259 -);
260 -
261 -/** Vèneto (Vèneto)
262 - * @author Candalua
263 - */
264 -$messages['vec'] = array(
265 - 'paypal_gateway-desc' => 'Registra PayPal come mecanismo de donassion',
266 -);
267 -
268 -/** Vietnamese (Tiếng Việt)
269 - * @author Vinhtantran
270 - */
271 -$messages['vi'] = array(
272 - 'paypal_gateway-desc' => 'Đăng ký PayPal làm cơ chế quyên góp',
273 -);
274 -
275 -/** Simplified Chinese (‪中文(简体)‬)
276 - * @author Bencmq
277 - */
278 -$messages['zh-hans'] = array(
279 - 'paypal_gateway-desc' => '将PayPal注册为捐助方式',
280 -);
281 -
Index: branches/fundraising/extensions/DonationInterface/paypal_gateway/paypal_gateway.php
@@ -1,79 +0,0 @@
2 -<?php
3 -/**
4 - *
5 - * To install the DontaionInterface extension, put the following line in LocalSettings.php:
6 - * require_once( "\$IP/extensions/DonationInterface/donationinterface.php" );
7 - *
8 - * TODO: Remove this file. :)
9 - */
10 -
11 -# Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly.
12 -if ( !defined( 'MEDIAWIKI' ) ) {
13 - echo <<<EOT
14 -To install my extension, put the following line in LocalSettings.php:
15 -require_once( "\$IP/extensions/DonationInterface/paypal_gateway/paypal_gateway.php" );
16 -EOT;
17 - exit( 1 );
18 -}
19 -
20 -// Extension credits that will show up on Special:Version
21 -$wgExtensionCredits['specialpage'][] = array(
22 - 'name' => 'Paypal Gateway',
23 - 'author' => 'Four Kitchens',
24 - 'url' => 'http://www.mediawiki.org/wiki/Extension:PaypalGateway',
25 - 'descriptionmsg' => 'paypal_gateway-desc',
26 - 'version' => '1.0.0',
27 -);
28 -
29 -/**
30 - * Hook to register form value and display name of this gateway
31 - * also supplies currencies supported by this gateway
32 - */
33 -function paypalGatewayValue( &$values ) {
34 - $values['paypal'] = array(
35 - 'gateway' => 'paypal',
36 - 'display_name' => 'Paypal',
37 - 'form_value' => 'paypal',
38 - 'currencies' => array(
39 - 'GBP' => 'GBP: British Pound',
40 - 'EUR' => 'EUR: Euro',
41 - 'USD' => 'USD: U.S. Dollar',
42 - 'AUD' => 'AUD: Australian Dollar',
43 - 'CAD' => 'CAD: Canadian Dollar',
44 - 'CHF' => 'CHF: Swiss Franc',
45 - 'CZK' => 'CZK: Czech Koruna',
46 - 'DKK' => 'DKK: Danish Krone',
47 - 'HKD' => 'HKD: Hong Kong Dollar',
48 - 'HUF' => 'HUF: Hungarian Forint',
49 - 'JPY' => 'JPY: Japanese Yen',
50 - 'NZD' => 'NZD: New Zealand Dollar',
51 - 'NOK' => 'NOK: Norwegian Krone',
52 - 'PLN' => 'PLN: Polish Zloty',
53 - 'SGD' => 'SGD: Singapore Dollar',
54 - 'SEK' => 'SEK: Swedish Krona',
55 - 'ILS' => 'ILS: Israeli Shekel',
56 - ),
57 - );
58 -
59 - return true;
60 -}
61 -
62 -/**
63 - * Hook to supply the page address of the payment gateway
64 - *
65 - * The user will redirected here with amount and currency code appended (GET).
66 - * NOTE: $wgPaypalEmail is the business email associated with the Paypal account
67 - * It is set in the LocalSettings.php file
68 - */
69 -function paypalGatewayPage( &$url ) {
70 - // Business email address set in LocalSettings.php
71 - global $wgPaypalUrl;
72 -
73 - // to go directly to Paypal, will be used for this extension in general
74 - // $url['paypal'] = "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=" . urlencode( $wgPaypalEmail ) . "&lc=US&no_note=1&no_shipping=1&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted";
75 -
76 - // specifically for Wikimedia, goes to processor page
77 - $url['paypal'] = $wgPaypalUrl;
78 -
79 - return true;
80 -}
Index: branches/fundraising/extensions/DonationInterface/donate_interface/donate_interface.php
@@ -1,354 +0,0 @@
2 -<?php
3 -/**
4 - * DonateInterface extension
5 - *
6 - * @file
7 - * @ingroup Extensions
8 - * @link http://www.mediawiki.org/wiki/Extension:DonateInterface Documentation
9 - *
10 - * To install the DontaionInterface extension, put the following line in LocalSettings.php:
11 - * require_once( "\$IP/extensions/DonationInterface/donationinterface.php" );
12 - *
13 - * TODO: Remove this file. :)
14 - */
15 -
16 -if ( !defined( 'MEDIAWIKI' ) ) {
17 - die( "This is not a valid entry point.\n" );
18 -}
19 -
20 -// Extension credits that will show up on Special:Version
21 -
22 -$wgExtensionCredits['specialpage'][] = array(
23 - 'path' => __FILE__,
24 - 'name' => 'DonateInterface',
25 - // 'author' => array( 'diana' ), // FIXME: Committer does not have details in http://svn.wikimedia.org/viewvc/mediawiki/USERINFO/
26 - 'descriptionmsg' => 'donate_interface-desc',
27 - 'url' => 'http://www.mediawiki.org/wiki/Extension:DonateInterface',
28 -);
29 -
30 -// Set up i18n
31 -$dir = dirname( __FILE__ ) . '/';
32 -$wgExtensionMessagesFiles['DonateInterface'] = $dir . 'donate_interface.i18n.php';
33 -
34 -$wgHooks['ParserFirstCallInit'][] = 'efDonateSetup';
35 -$wgHooks['DonationInterface_DisplayForm'][] = 'fnProcessDonationForm';
36 -
37 -/**
38 - * Create <donate /> tag to include landing page donation form
39 - */
40 -function efDonateSetup( &$parser ) {
41 - $parser->setHook( 'donate', 'efDonateRender' );
42 -
43 - return true;
44 -}
45 -
46 -
47 -
48 -/**
49 - * Function called by the <donate> parser tag
50 - *
51 - * Outputs the donation landing page form which collects
52 - * the donation amount, currency and payment processor type.
53 - */
54 -function efDonateRender( $input, $args, $parser ) {
55 - global $wgOut, $wgExtensionAssetsPath;
56 - static $formProcessed = false;
57 -
58 - $parser->disableCache();
59 -
60 - // if chapter exists for user's country, redirect
61 - // not currently in use - in place for adding it when ready
62 - // $chapter = fnDonateChapterRedirect();
63 -
64 - // add JavaScript validation to <head>
65 - $wgOut->addScriptFile( $wgExtensionAssetsPath . '/DonationInterface/donate_interface/donate_interface_validate_donation.js' );
66 -
67 - if ( !$formProcessed ) {
68 - // process form
69 - wfRunHooks( 'DonationInterface_DisplayForm' );
70 - $formProcessed = true;
71 - }
72 -
73 - // display form to gather data from user
74 - $output = fnDonateCreateOutput();
75 -
76 - return $output;
77 -}
78 -
79 -/**
80 - * Supplies the form to efDonateRender()
81 - *
82 - * Payment gateway options are created with the hook "gwValue". Each potential payment
83 - * option supplies it's value and name for the form, as well as currencies it supports.
84 - */
85 -function fnDonateCreateOutput() {
86 - global $wgRequest;
87 -
88 - // set them equal to post data
89 - $utm_source = $wgRequest->getText( 'utm_source' );
90 - $utm_medium = $wgRequest->getText( 'utm_medium' );
91 - $utm_campaign = $wgRequest->getText( 'utm_campaign' );
92 - $referrer = $wgRequest->getHeader( 'referer' );
93 -
94 - // get language from URL
95 - $url = $wgRequest->getRequestURL();
96 -
97 - if ( $url ) {
98 - $getLang = explode( '/', $url );
99 - $language = substr( $getLang[3], 0, 2 );
100 - }
101 -
102 - // error check and set "en" as default
103 - if ( !preg_match( '/^[a-z-]+$/', $language ) ) {
104 - $language = 'en';
105 - }
106 -
107 - // get payment method gateway value and name from each gateway and create menu of options
108 - $values = array();
109 - wfRunHooks( 'DonationInterface_Value', array( &$values ) );
110 -
111 - $gatewayMenu = '';
112 -
113 - foreach ( $values as $current ) {
114 - $gatewayMenu .= Xml::option( $current['display_name'], $current['form_value'] );
115 - }
116 -
117 - // get available currencies
118 -
119 - $currencies = array( 'USD' => "USD: U.S. Dollar" );
120 - // FIXME: It uses the currencies of the last gateway to be loaded. It should probably use the union of currencies, (currencies allowed by any gateway).
121 - foreach ( $values as $key ) {
122 - if ( isset( $key['currencies'] ) ) {
123 - $currencies = $key['currencies'];
124 - }
125 - }
126 -
127 - $currencyMenu = '';
128 -
129 - foreach ( $currencies as $value => $fullName ) {
130 - $currencyMenu .= Xml::option( $fullName, $value );
131 - }
132 -
133 - $output = Xml::openElement( 'form', array( 'name' => "donate", 'method' => "post", 'action' => "", 'onsubmit' => 'return DonateValidateForm(this)' ) ) .
134 - Xml::openElement( 'div', array( 'id' => 'mw-donation-intro' ) ) .
135 - Xml::element( 'p', array( 'class' => 'mw-donation-intro-text' ), wfMsg( 'donate_interface-intro' ) ) .
136 - Xml::closeElement( 'div' );
137 -
138 - $output .= Html::hidden( 'utm_source', $utm_source ) .
139 - Html::hidden( 'utm_medium', $utm_medium ) .
140 - Html::hidden( 'utm_campaign', $utm_campaign ) .
141 - Html::hidden( 'language', $language ) .
142 - Html::hidden( 'referrer', $referrer ) .
143 - Html::hidden( 'process', '_yes_' );
144 -
145 - $amount = array(
146 - Xml::radioLabel( wfMsg( 'donate_interface-big-amount-display' ), 'amount', wfMsg( 'donate_interface-big-amount-value' ), 'input_amount_3', false ),
147 - Xml::radioLabel( wfMsg( 'donate_interface-medium-amount-display' ), 'amount', wfMsg( 'donate_interface-medium-amount-value' ), 'input_amount_2', false ),
148 - Xml::radioLabel( wfMsg( 'donate_interface-small-amount-display' ), 'amount', wfMsg( 'donate_interface-small-amount-value' ), 'input_amount_1', false ),
149 - Xml::inputLabel( wfMsg( 'donate_interface-other-amount' ), 'amountGiven', 'input_amount_other', '5' ),
150 - );
151 -
152 - $amountFields = '<table><tr>';
153 - foreach ( $amount as $value ) {
154 - $amountFields .= '<td>' . $value . '</td>';
155 - }
156 - $amountFields .= '</tr></table>';
157 -
158 - $output .= Xml::fieldset( wfMsg( 'donate_interface-amount' ), $amountFields, array( 'class' => "mw-donation-amount" ) );
159 -
160 - // Build currency options
161 - $default_currency = fnDonateDefaultCurrency();
162 -
163 - $currency_options = '';
164 - foreach ( $currencies as $code => $name ) {
165 - $selected = '';
166 - if ( $code == $default_currency ) {
167 - $selected = ' selected="selected"';
168 - }
169 - $currency_options .= '<option value="' . $code . '"' . $selected . '>' . wfMsg( 'donate_interface-' . $code ) . '</option>';
170 - }
171 -
172 - $currencyFields = Xml::openElement( 'select', array( 'name' => 'currency_code', 'id' => "input_currency_code" ) ) .
173 - $currency_options .
174 - Xml::closeElement( 'select' );
175 -
176 - $output .= Xml::fieldset( wfMsg( 'donate_interface-currency' ), $currencyFields, array( 'class' => "mw-donation-currency" ) );
177 -
178 - $gatewayFields = Xml::openElement( 'select', array( 'name' => 'payment_method', 'id' => 'select_payment_method' ) ) .
179 - $gatewayMenu .
180 - Xml::closeElement( 'select' );
181 -
182 - $output .= Xml::fieldset( wfMsg( 'donate_interface-gateway' ), $gatewayFields, array( 'class' => 'mw-donation-gateway' ) );
183 -
184 - $publicComment = Xml::element( 'div', array( 'class' => 'mw-donation-comment-message' ), wfMsg( 'donate_interface-comment-message' ) ) .
185 - Xml::inputLabel( wfMsg( 'donate_interface-comment-label' ), 'comment', 'comment', '30', '', array( 'maxlength' => '200' ) ) .
186 - Xml::openElement( 'div', array( 'id' => 'mw-donation-checkbox' ) ) .
187 - Xml::checkLabel( wfMsg( 'donate_interface-anon-message' ), 'comment-option', 'input_comment-option', TRUE ) .
188 - Xml::closeElement( 'div' ) .
189 - Xml::openElement( 'div', array( 'id' => 'mw-donation-checkbox' ) ) .
190 - Xml::check( 'email-opt', TRUE ) .
191 - Xml::tags( 'span', array( 'class' => 'mw-email-agreement' ), wfMsg( 'donate_interface-email-agreement' ) ) .
192 - Xml::closeElement( 'div' );
193 -
194 - $output .= Xml::fieldset( wfMsg( 'donate_interface-comment-title' ), $publicComment, array( 'class' => 'mw-donation-public-comment' ) );
195 -
196 - $output .= Xml::submitButton( wfMsg( 'donate_interface-submit-button' ) );
197 -
198 - $output .= Xml::closeElement( 'form' );
199 -
200 - // NOTE: For testing: show country of origin
201 - // $country = fnDonateGetCountry();
202 - // $output .= Xml::element('p', array('class' => 'mw-donation-test-message'), 'Country:' . $country);
203 -
204 - // NOTE: for testing: show default currency
205 - // $currencyTest = fnDonateDefaultCurrency();
206 - // $output .= Xml::element('p', array('class' => 'mw-donation-test-message'), wfMsg( 'donate_interface-currency' ) . $currencyTest);
207 -
208 - // NOTE: for testing: show IP address
209 - // $referrer = $_SERVER['HTTP_REFERER'];
210 - // $output .= '<p>' . 'Referrer:' . $referrer . '</p>';
211 -
212 - // for testing to show language culled from URL
213 - $output .= '<p>' . ' Language: ' . $language . '</p>';
214 -
215 - return $output;
216 -}
217 -
218 -/*
219 -* Redirects user to their chosen payment processor
220 -*
221 -* Includes the user's input passed as GET
222 -* $url for the gateway was supplied with the gwPage hook and the key
223 -* matches the form value (also supplied by the gateway)
224 -*/
225 -function fnDonateRedirectToProcessorPage( $userInput, $url ) {
226 - global $wgOut;
227 -
228 - $chosenGateway = $userInput['gateway'];
229 -
230 - $redirectionData = wfArrayToCGI( $userInput );
231 -
232 - // $wgOut->redirect(
233 - // $wgPaymentGatewayHost . $url[$chosenGateway] . $redirectionData
234 - // );
235 -
236 - $wgOut->redirect(
237 - $url[$chosenGateway] . '&' . $redirectionData
238 - );
239 -}
240 -
241 -/**
242 - * Gets country code based on IP if GeoIP extension is installed
243 - * returns country code or UNKNOWN if unable to assign one
244 - */
245 -function fnDonateGetCountry() {
246 - $country_code = null;
247 -
248 - if ( function_exists( 'fnGetGeoIP' ) ) {
249 - try {
250 - $country_code = fnGetGeoIP();
251 - } catch ( NotFoundGeoIP $e ) {
252 - $country_code = 'UNKNOWN';
253 - } catch ( UnsupportedGeoIP $e ) {
254 - $country_code = 'UNKNOWN';
255 - }
256 - }
257 -
258 - return $country_code;
259 -}
260 -
261 -/**
262 - * Uses GeoIP extension to translate country based on IP
263 - * into default currency shown in drop down menu
264 - */
265 -function fnDonateDefaultCurrency() {
266 - require_once( 'country2currency.inc' );
267 -
268 - $country_code = null;
269 -
270 - if ( function_exists( 'fnGetCountry' ) ) {
271 - $country_code = fnGetCountry();
272 - }
273 -
274 - $currency = fnCountry2Currency( $country_code );
275 -
276 - return $currency ? $currency : 'USD';
277 -}
278 -
279 -/**
280 - * Will use GeoIP extension to redirect user to
281 - * chapter page as dictated by IP address
282 - * NOT CURRENTLY IN USE
283 - */
284 -function fnDonateChapterRedirect() {
285 - require_once( 'chapters.inc' );
286 -
287 - $country_code = null;
288 -
289 - if ( function_exists( 'fnGetCountry' ) ) {
290 - $country_code = fnDonateGetCountry();
291 - }
292 -
293 - $chapter = fnDonateGetChapter( $country_code );
294 -
295 - if ( $chapter ) {
296 - global $wgOut;
297 - $wgOut->redirect( 'http://' . $chapter );
298 - } else {
299 - return null;
300 - }
301 -
302 -}
303 -
304 -function fnProcessDonationForm( ) {
305 - global $wgRequest, $wgOut;
306 -
307 - // Checking that it was posted is not enough, donate_interface-amount-error
308 - // would be shown on previews, anon purges... (bug 22640)
309 - if ( ( !$wgRequest->wasPosted() ) || ( $wgRequest->getVal( 'process' ) != "_yes_" ) ) {
310 - return true;
311 - }
312 - // if form has been submitted, assign data and redirect user to chosen payment gateway
313 -
314 - // find out which amount option was chosen for amount, redefined buttons or text box
315 - if ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amount' ) ) ) {
316 - $amount = number_format( $wgRequest->getText( 'amount' ), 2 );
317 - } elseif ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amountGiven' ) ) ) {
318 - $amount = number_format( $wgRequest->getText( 'amountGiven' ), 2, '.', '' );
319 - } else {
320 - $wgOut->addHTML( wfMsg( 'donate_interface-amount-error' ) );
321 - return true;
322 - }
323 -
324 - // create array of user input from post data
325 - $userInput = array (
326 - 'currency_code' => $wgRequest->getText( 'currency_code', 'USD' ),
327 - 'amount' => $amount,
328 - 'gateway' => $wgRequest->getText( 'payment_method', 'payflow' ),
329 - 'referrer' => $wgRequest->getText( 'referrer', '' ),
330 - 'utm_source' => $wgRequest->getText( 'utm_source', '' ),
331 - 'utm_medium' => $wgRequest->getText( 'utm_medium', '' ),
332 - 'utm_campaign' => $wgRequest->getText( 'utm_campaign', '' ),
333 - 'language' => $wgRequest->getText( 'language', 'en' ),
334 - 'comment' => $wgRequest->getText( 'comment', '' ),
335 - 'comment-option' => $wgRequest->getText( 'comment-option', '0' ),
336 - 'email-opt' => $wgRequest->getText( 'email-opt', 0 ),
337 - 'fname' => $wgRequest->getText( 'fname', null ),
338 - 'lname' => $wgRequest->getText( 'lname', null ),
339 - 'email' => $wgRequest->getText( 'emailAdd', null ),
340 - );
341 -
342 - // ask payment processor extensions for their URL/page title
343 - $url = '';
344 -
345 - if ( wfRunHooks( 'DonationInterface_Page', array( &$url ) ) ) {
346 - // send user to correct page for payment
347 - fnDonateRedirectToProcessorPage( $userInput, $url );
348 - } else {
349 - $wgOut->addHTML( wfMsg( 'donate_interface-processing-error' ) );
350 - }
351 -
352 - return true;
353 -}
354 -
355 -

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99228Donationinterface.php has now eaten the two current gateway adapters. Identif...khorn18:38, 7 October 2011

Status & tagging log