Index: branches/fundraising/extensions/DonationInterface/donationinterface.php |
— | — | @@ -1,5 +1,14 @@ |
2 | 2 | <?php |
3 | 3 | |
| 4 | +/** |
| 5 | + * Donation Interface |
| 6 | + * |
| 7 | + * To install the DontaionInterface extension, put the following line in LocalSettings.php: |
| 8 | + * require_once( "\$IP/extensions/DonationInterface/donationinterface.php" ); |
| 9 | + * |
| 10 | + */ |
| 11 | + |
| 12 | + |
4 | 13 | # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly. |
5 | 14 | if ( !defined( 'MEDIAWIKI' ) ) { |
6 | 15 | echo <<<EOT |
— | — | @@ -20,28 +29,47 @@ |
21 | 30 | |
22 | 31 | $donationinterface_dir = dirname( __FILE__ ) . '/'; |
23 | 32 | |
24 | | -//TODO: It may be a good idea to make all these stop behaving like they're independent extensions. |
25 | | -//Better yet, we should decide if they're a required part of this or not, |
26 | | -//and split 'em entirely off, or roll 'em all the way in to this file. |
27 | | -require_once( $donationinterface_dir . 'donate_interface/donate_interface.php' ); |
28 | | -require_once( $donationinterface_dir . 'activemq_stomp/activemq_stomp.php' ); |
| 33 | +/** |
| 34 | + * Figure out what we've got enabled. |
| 35 | + */ |
29 | 36 | |
30 | | -require_once( $donationinterface_dir . 'extras/extras.php' ); |
31 | | -require_once( $donationinterface_dir . 'extras/custom_filters/custom_filters.php' ); |
32 | | -require_once( $donationinterface_dir . 'extras/conversion_log/conversion_log.php' ); |
33 | | -require_once( $donationinterface_dir . 'extras/minfraud/minfraud.php' ); |
34 | | -require_once( $donationinterface_dir . 'extras/recaptcha/recaptcha.php' ); |
| 37 | +$optionalParts = array( //define as fail closed. This variable will be unset before we leave this file. |
| 38 | + 'Extras' => false, //this one gets set in the next loop, so don't bother. |
| 39 | + 'Stomp' => false, |
| 40 | + 'CustomFilters' => false, //this is definitely an Extra |
| 41 | + 'ConversionLog' => false, //this is definitely an Extra |
| 42 | + 'Minfraud' => false, //this is definitely an Extra |
| 43 | + 'Minfraud_as_filter' => false, //extra |
| 44 | + 'Recaptcha' => false, //extra |
| 45 | + 'Paypal' => false, //this is the paypal redirect. TODO: Determine if we're even using this anymore. |
| 46 | + 'PayflowPro' => false, |
| 47 | + 'GlobalCollect' => false, |
| 48 | + |
| 49 | +); |
35 | 50 | |
| 51 | +foreach ($optionalParts as $subextension => $enabled){ |
| 52 | + $globalname = 'wgDonationInterfaceEnable' . $subextension; |
| 53 | + global $$globalname; |
| 54 | + if ( isset( $$globalname ) && $$globalname === true ) { |
| 55 | + $optionalParts[$subextension] = true; |
| 56 | + if ( $subextension === 'CustomFilters' || |
| 57 | + $subextension === 'ConversionLog' || |
| 58 | + $subextension === 'Minfraud' || |
| 59 | + $subextension === 'Recaptcha' ) { |
| 60 | + |
| 61 | + $optionalParts['Extras'] = true; |
| 62 | + } |
| 63 | + } |
| 64 | +} |
36 | 65 | |
| 66 | + |
37 | 67 | /** |
38 | | - * Global form dir and whitelist |
| 68 | + * CLASSES |
39 | 69 | */ |
40 | | -$wgDonationInterfaceHtmlFormDir = dirname( __FILE__ ) . "/gateway_forms/html"; |
41 | | -//ffname is the $key from now on. |
42 | | -$wgDonationInterfaceAllowedHtmlForms = array( |
43 | | - 'demo' => $wgDonationInterfaceHtmlFormDir . "/demo.html", |
44 | | - 'globalcollect_test' => $wgDonationInterfaceHtmlFormDir . "/globalcollect_test.html", |
45 | | -); |
| 70 | +$wgAutoloadClasses['DonationData'] = $donationinterface_dir . 'gateway_common/DonationData.php'; |
| 71 | +$wgAutoloadClasses['GatewayAdapter'] = $donationinterface_dir . 'gateway_common/gateway.adapter.php'; |
| 72 | +$wgAutoloadClasses['GatewayForm'] = $donationinterface_dir . 'gateway_common/GatewayForm.php'; |
| 73 | +$wgAutoloadClasses['DonationApi'] = $donationinterface_dir . 'gateway_common/donation.api.php'; |
46 | 74 | |
47 | 75 | //load all possible form classes |
48 | 76 | $wgAutoloadClasses['Gateway_Form'] = $donationinterface_dir . 'gateway_forms/Form.php'; |
— | — | @@ -66,50 +94,248 @@ |
67 | 95 | $wgAutoloadClasses['Gateway_Form_SingleColumn'] = $donationinterface_dir . 'gateway_forms/SingleColumn.php'; |
68 | 96 | |
69 | 97 | |
70 | | -$wgAutoloadClasses['DonationData'] = $donationinterface_dir . 'gateway_common/DonationData.php'; |
71 | | -$wgAutoloadClasses['GatewayAdapter'] = $donationinterface_dir . 'gateway_common/gateway.adapter.php'; |
72 | | -$wgAutoloadClasses['GatewayForm'] = $donationinterface_dir . 'gateway_common/GatewayForm.php'; |
73 | | -$wgAutoloadClasses['DonationApi'] = $donationinterface_dir . 'gateway_common/donation.api.php'; |
74 | 98 | |
75 | | -//THE GATEWAYS WILL RESET THIS when they are instantiated. You can override it, but it won't stick around that way. |
76 | | -$wgDonationInterfaceTest = false; |
| 99 | +//Stomp classes |
| 100 | +if ($optionalParts['Stomp'] === true){ |
| 101 | + $wgAutoloadClasses['activemq_stomp'] = $donationinterface_dir . 'activemq_stomp/activemq_stomp.php'; # Tell MediaWiki to load the extension body. |
| 102 | +} |
77 | 103 | |
| 104 | +//Extras classes - required for ANY optional class that is considered an "extra". |
| 105 | +if ($optionalParts['Extras'] === true){ |
| 106 | + $wgAutoloadClasses['Gateway_Extras'] = $donationinterface_dir . "extras/extras.body.php"; |
| 107 | +} |
78 | 108 | |
| 109 | +//Custom Filters classes |
| 110 | +if ($optionalParts['CustomFilters'] === true){ |
| 111 | + $wgAutoloadClasses['Gateway_Extras_CustomFilters'] = $donationinterface_dir . "extras/custom_filters/custom_filters.body.php"; |
| 112 | +} |
| 113 | + |
| 114 | +//Conversion Log classes |
| 115 | +if ($optionalParts['ConversionLog'] === true){ |
| 116 | + $wgAutoloadClasses['Gateway_Extras_ConversionLog'] = $donationinterface_dir . "extras/conversion_log/conversion_log.body.php"; |
| 117 | +} |
| 118 | + |
| 119 | +//Minfraud classes |
| 120 | +if ( $optionalParts['Minfraud'] === true || $optionalParts['Minfraud_as_filter'] === true ){ |
| 121 | + $wgAutoloadClasses['Gateway_Extras_MinFraud'] = $donationinterface_dir . "extras/minfraud/minfraud.body.php"; |
| 122 | +} |
| 123 | + |
| 124 | +//Minfraud as Filter classes |
| 125 | +if ( $optionalParts['Minfraud_as_filter'] === true ){ |
| 126 | + $wgAutoloadClasses['Gateway_Extras_CustomFilters_MinFraud'] = $donationinterface_dir . "extras/custom_filters/filters/minfraud/minfraud.body.php"; |
| 127 | +} |
| 128 | + |
| 129 | +//Recaptcha classes |
| 130 | +if ( $optionalParts['Recaptcha'] === true ){ |
| 131 | + $wgAutoloadClasses['Gateway_Extras_ReCaptcha'] = $donationinterface_dir . "extras/recaptcha/recaptcha.body.php"; |
| 132 | +} |
| 133 | + |
| 134 | + |
79 | 135 | /** |
| 136 | + * GLOBALS |
| 137 | + */ |
| 138 | + |
| 139 | +/** |
| 140 | + * Global form dir and RapidHTML whitelist |
| 141 | + */ |
| 142 | +$wgDonationInterfaceHtmlFormDir = dirname( __FILE__ ) . "/gateway_forms/html"; |
| 143 | +//ffname is the $key from now on. |
| 144 | +$wgDonationInterfaceAllowedHtmlForms = array( |
| 145 | + 'demo' => $wgDonationInterfaceHtmlFormDir . "/demo.html", |
| 146 | + 'globalcollect_test' => $wgDonationInterfaceHtmlFormDir . "/globalcollect_test.html", |
| 147 | +); |
| 148 | + |
| 149 | +$wgDonationInterfaceTest = false; |
| 150 | + |
| 151 | +/** |
80 | 152 | * Default Thank You and Fail pages for all of donationinterface - language will be calc'd and appended at runtime. |
81 | 153 | */ |
82 | 154 | //$wgDonationInterfaceThankYouPage = 'https://wikimediafoundation.org/wiki/Thank_You'; |
83 | 155 | $wgDonationInterfaceThankYouPage = 'Donate-thanks'; |
84 | 156 | $wgDonationInterfaceFailPage = 'Donate-error'; |
85 | 157 | |
86 | | -//This is going to be a little funky. |
87 | | -//Override this in LocalSettings.php BEFORE you include this file, if you want |
88 | | -//to disable gateways. |
89 | | -//TODO: Unfunktify, if you have a better idea here for auto-loading the classes after LocalSettings.php runs all the way. |
90 | | -if ( !isset( $wgDonationInterfaceEnabledGateways ) ) { |
91 | | - $wgDonationInterfaceEnabledGateways = array( |
92 | | - 'paypal', |
93 | | - 'payflowpro', |
94 | | - 'globalcollect' |
| 158 | +/** |
| 159 | + * The URL to redirect a transaction to PayPal |
| 160 | + */ |
| 161 | +$wgDonationInterfacePaypalURL = ''; |
| 162 | +$wgDonationInterfaceRetrySeconds = 5; |
| 163 | + |
| 164 | + |
| 165 | +//Paypal gateway globals |
| 166 | +if ( $optionalParts['Paypal'] === true ){ |
| 167 | + // default variables that should be set in LocalSettings.php |
| 168 | + $wgPaypalEmail = ''; |
| 169 | + $wgPaypalUrl = 'http://wikimediafoundation.org/wiki/Special:ContributionTracking?'; |
| 170 | +} |
| 171 | + |
| 172 | +//Stomp globals |
| 173 | +if ($optionalParts['Stomp'] === true){ |
| 174 | + $wgStompServer = ""; |
| 175 | + //$wgStompQueueName = ""; //only set this with an actual value. Default is unset. |
| 176 | + //$wgPendingStompQueueName = ""; //only set this with an actual value. Default is unset. |
| 177 | +} |
| 178 | + |
| 179 | +//Extras globals - required for ANY optional class that is considered an "extra". |
| 180 | +if ($optionalParts['Extras'] === true){ |
| 181 | + $wgDonationInterfaceExtrasLog = ''; |
| 182 | +} |
| 183 | + |
| 184 | +//Custom Filters globals |
| 185 | +if ( $optionalParts['CustomFilters'] === true ){ |
| 186 | + //Define the action to take for a given $risk_score |
| 187 | + $wgDonationInterfaceCustomFiltersActionRanges = array( |
| 188 | + 'process' => array( 0, 100 ), |
| 189 | + 'review' => array( -1, -1 ), |
| 190 | + 'challenge' => array( -1, -1 ), |
| 191 | + 'reject' => array( -1, -1 ), |
95 | 192 | ); |
| 193 | + |
| 194 | + /** |
| 195 | + * A value for tracking the 'riskiness' of a transaction |
| 196 | + * |
| 197 | + * The action to take based on a transaction's riskScore is determined by |
| 198 | + * $action_ranges. This is built assuming a range of possible risk scores |
| 199 | + * as 0-100, although you can probably bend this as needed. |
| 200 | + */ |
| 201 | + $wgDonationInterfaceCustomFiltersRiskScore = 0; |
96 | 202 | } |
97 | 203 | |
98 | | -foreach ( $wgDonationInterfaceEnabledGateways as $gateway ) { |
99 | | - //include 'em |
100 | | - require_once( $donationinterface_dir . $gateway . '_gateway/' . $gateway . '_gateway.php' ); |
| 204 | +//Minfraud globals |
| 205 | +if ( $optionalParts['Minfraud'] === true || $optionalParts['Minfraud_as_filter'] === true ){ |
| 206 | + /** |
| 207 | + * Your minFraud license key. |
| 208 | + */ |
| 209 | + $wgMinFraudLicenseKey = ''; |
| 210 | + |
| 211 | + /** |
| 212 | + * Set the risk score ranges that will cause a particular 'action' |
| 213 | + * |
| 214 | + * The keys to the array are the 'actions' to be taken (eg 'process'). |
| 215 | + * The value for one of these keys is an array representing the lower |
| 216 | + * and upper bounds for that action. For instance, |
| 217 | + * $wgMinFraudActionRagnes = array( |
| 218 | + * 'process' => array( 0, 100) |
| 219 | + * ... |
| 220 | + * ); |
| 221 | + * means that any transaction with a risk score greather than or equal |
| 222 | + * to 0 and less than or equal to 100 will be given the 'process' action. |
| 223 | + * |
| 224 | + * These are evauluated on a >= or <= basis. Please refer to minFraud |
| 225 | + * documentation for a thorough explanation of the 'riskScore'. |
| 226 | + */ |
| 227 | + $wgMinFraudActionRanges = array( |
| 228 | + 'process' => array( 0, 100 ), |
| 229 | + 'review' => array( -1, -1 ), |
| 230 | + 'challenge' => array( -1, -1 ), |
| 231 | + 'reject' => array( -1, -1 ) |
| 232 | + ); |
| 233 | + |
| 234 | + // Timeout in seconds for communicating with MaxMind |
| 235 | + $wgMinFraudTimeout = 2; |
| 236 | + |
| 237 | + /** |
| 238 | + * Define whether or not to run minFraud in stand alone mode |
| 239 | + * |
| 240 | + * If this is set to run in standalone, these scripts will be |
| 241 | + * accessed directly via the "GatewayValidate" hook. |
| 242 | + * You may not want to run this in standalone mode if you prefer |
| 243 | + * to use this in conjunction with Custom Filters. This has the |
| 244 | + * advantage of sharing minFraud info with other filters. |
| 245 | + */ |
| 246 | + $wgMinFraudStandalone = TRUE; |
| 247 | + |
101 | 248 | } |
102 | 249 | |
| 250 | +//Minfraud as Filter globals |
| 251 | +if ( $optionalParts['Minfraud_as_filter'] === true ){ |
| 252 | + $wgMinFraudStandalone = FALSE; |
| 253 | +} |
| 254 | + |
| 255 | +//Recaptcha globals |
| 256 | +if ( $optionalParts['Recaptcha'] === true ){ |
| 257 | + /** |
| 258 | + * Public and Private reCaptcha keys |
| 259 | + * |
| 260 | + * These can be obtained at: |
| 261 | + * http://www.google.com/recaptcha/whyrecaptcha |
| 262 | + */ |
| 263 | + $wgDonationInterfaceRecaptchaPublicKey = ''; |
| 264 | + $wgDonationInterfaceRecaptchaPrivateKey = ''; |
| 265 | + |
| 266 | + // Timeout (in seconds) for communicating with reCatpcha |
| 267 | + $wgDonationInterfaceRecaptchaTimeout = 2; |
| 268 | + |
| 269 | + /** |
| 270 | + * HTTP Proxy settings |
| 271 | + * |
| 272 | + * Default to settings in DonationInterface |
| 273 | + */ |
| 274 | + //TODO: I think we can get rid of these entirely, due to the way we are now checking for globals in the extras. |
| 275 | + //$wgDonationInterfaceRecaptchaUseHTTPProxy = $wgDonationInterfaceUseHTTPProxy; |
| 276 | + //$wgDonationInterfaceRecaptchaHTTPProxy = $wgDonationInterfaceHTTPProxy; |
| 277 | + |
| 278 | + /** |
| 279 | + * Use SSL to communicate with reCaptcha |
| 280 | + */ |
| 281 | + $wgDonationInterfaceRecaptchaUseSSL = 1; |
| 282 | + |
| 283 | + /** |
| 284 | + * The # of times to retry communicating with reCaptcha if communication fails |
| 285 | + * @var int |
| 286 | + */ |
| 287 | + $wgDonationInterfaceRecaptchaComsRetryLimit = 3; |
| 288 | +} |
| 289 | + |
| 290 | + |
103 | 291 | /** |
104 | | - * Hooks required to interface with the donation extension (include <donate> on page) |
105 | | - * |
106 | | - * gwValue supplies the value of the form option, the name that appears on the form |
107 | | - * and the currencies supported by the gateway in the $values array |
| 292 | + * HOOKS |
108 | 293 | */ |
109 | | -//$wgHooks['DonationInterface_Value'][] = 'pfpGatewayValue'; |
110 | | -//$wgHooks['DonationInterface_Page'][] = 'pfpGatewayPage'; |
111 | | -# Unit tests |
| 294 | + |
| 295 | +//Unit tests |
112 | 296 | $wgHooks['UnitTestsList'][] = 'efDonationInterfaceUnitTests'; |
113 | 297 | |
| 298 | + |
| 299 | +//Paypal gateway globals |
| 300 | +if ( $optionalParts['Paypal'] === true ){ |
| 301 | + //TODO: Determine if this is all cruft. I'm guessing "Probably". |
| 302 | + /** |
| 303 | + * Hooks required to interface with the donation extension (include <donate> on page) |
| 304 | + * |
| 305 | + * gwValue supplies the value of the form option, the name that appears on the form |
| 306 | + * and the currencies supported by the gateway in the $values array |
| 307 | + */ |
| 308 | + $wgHooks['DonationInterface_Value'][] = 'paypalGatewayValue'; |
| 309 | + $wgHooks['DonationInterface_Page'][] = 'paypalGatewayPage'; |
| 310 | +} |
| 311 | + |
| 312 | +//Stomp hooks |
| 313 | +if ($optionalParts['Stomp'] === true){ |
| 314 | + $wgHooks['ParserFirstCallInit'][] = 'efStompSetup'; |
| 315 | + $wgHooks['gwStomp'][] = 'sendSTOMP'; |
| 316 | + $wgHooks['gwPendingStomp'][] = 'sendPendingSTOMP'; |
| 317 | +} |
| 318 | + |
| 319 | +//Custom Filters hooks |
| 320 | +if ($optionalParts['CustomFilters'] === true){ |
| 321 | + $wgHooks["GatewayValidate"][] = array( 'Gateway_Extras_CustomFilters::onValidate' ); |
| 322 | +} |
| 323 | + |
| 324 | +//Conversion Log hooks |
| 325 | +if ($optionalParts['ConversionLog'] === true){ |
| 326 | + // Sets the 'conversion log' as logger for post-processing |
| 327 | + $wgHooks["GatewayPostProcess"][] = array( "Gateway_Extras_ConversionLog::onPostProcess" ); |
| 328 | +} |
| 329 | + |
| 330 | +//Recaptcha hooks |
| 331 | +if ($optionalParts['Recaptcha'] === true){ |
| 332 | + // Set reCpatcha as plugin for 'challenge' action |
| 333 | + $wgHooks["GatewayChallenge"][] = array( "Gateway_Extras_ReCaptcha::onChallenge" ); |
| 334 | +} |
| 335 | + |
| 336 | +/** |
| 337 | + * ADDITIONAL MAGICAL GLOBALS |
| 338 | + */ |
| 339 | + |
114 | 340 | // enable the API |
115 | 341 | $wgAPIModules['donate'] = 'DonationApi'; |
116 | 342 | |
— | — | @@ -127,14 +353,74 @@ |
128 | 354 | 'position' => 'top' |
129 | 355 | ) + $wgResourceTemplate; |
130 | 356 | |
| 357 | +$wgExtensionMessagesFiles['DonateInterface'] = $donationinterface_dir . 'donate_interface/donate_interface.i18n.php'; |
131 | 358 | |
| 359 | +//Paypal magical globals |
| 360 | +if ( $optionalParts['Paypal'] === true ){ |
| 361 | + $wgExtensionMessagesFiles['PaypalGateway'] = $donationinterface_dir . 'paypal_gateway/paypal_gateway.i18n.php'; |
| 362 | +} |
| 363 | + |
| 364 | +//Minfraud magical globals |
| 365 | +if ( $optionalParts['Minfraud'] === true ){ //We do not want this in filter mode. |
| 366 | + $wgExtensionFunctions[] = 'efMinFraudSetup'; |
| 367 | +} |
| 368 | + |
| 369 | +//Minfraud as Filter globals |
| 370 | +if ( $optionalParts['Minfraud_as_filter'] === true ){ |
| 371 | + $wgExtensionFunctions[] = 'efCustomFiltersMinFraudSetup'; |
| 372 | +} |
| 373 | + |
| 374 | + |
132 | 375 | /** |
133 | | - * The URL to redirect a transaction to PayPal |
| 376 | + * FUNCTIONS |
134 | 377 | */ |
135 | | -$wgDonationInterfacePaypalURL = ''; |
136 | | -$wgDonationInterfaceRetrySeconds = 5; |
137 | 378 | |
| 379 | +//---Stomp functions--- |
| 380 | +if ($optionalParts['Stomp'] === true){ |
| 381 | + require_once( $donationinterface_dir . 'activemq_stomp/activemq_stomp.php' ); |
| 382 | +} |
| 383 | + |
| 384 | +//---Minfraud functions--- |
| 385 | +if ($optionalParts['Minfraud'] === true){ |
| 386 | + require_once( $donationinterface_dir . 'extras/minfraud/minfraud.php' ); |
| 387 | +} |
| 388 | + |
| 389 | +//---Minfraud as filter functions--- |
| 390 | +if ($optionalParts['Minfraud_as_filter'] === true){ |
| 391 | + require_once( $donationinterface_dir . 'extras/custom_filters/filters/minfraud/minfraud.php' ); |
| 392 | +} |
| 393 | + |
| 394 | +//---Paypal functions--- |
| 395 | +if ($optionalParts['Paypal'] === true){ |
| 396 | + require_once( $donationinterface_dir . 'paypal_gateway/paypal_gateway.php' ); |
| 397 | +} |
| 398 | + |
| 399 | + |
| 400 | + |
| 401 | + |
| 402 | + |
| 403 | + |
| 404 | + |
| 405 | +//This is going to be a little funky. |
| 406 | +//Override this in LocalSettings.php BEFORE you include this file, if you want |
| 407 | +//to disable gateways. |
| 408 | +//TODO: Unfunktify, if you have a better idea here for auto-loading the classes after LocalSettings.php runs all the way. |
| 409 | +if ( !isset( $wgDonationInterfaceEnabledGateways ) ) { |
| 410 | + $wgDonationInterfaceEnabledGateways = array( |
| 411 | + 'payflowpro', |
| 412 | + 'globalcollect' |
| 413 | + ); |
| 414 | +} |
| 415 | + |
| 416 | +foreach ( $wgDonationInterfaceEnabledGateways as $gateway ) { |
| 417 | + //include 'em |
| 418 | + require_once( $donationinterface_dir . $gateway . '_gateway/' . $gateway . '_gateway.php' ); |
| 419 | +} |
| 420 | + |
| 421 | + |
138 | 422 | function efDonationInterfaceUnitTests( &$files ) { |
139 | | - $files[] = dirname( __FILE__ ) . '/tests/AllTests.php'; |
| 423 | + $files[] = $donationinterface_dir . 'tests/AllTests.php'; |
140 | 424 | return true; |
141 | 425 | } |
| 426 | + |
| 427 | +unset( $optionalParts ); |
Index: branches/fundraising/extensions/DonationInterface/payflowpro_gateway/api_payflowpro_gateway.php |
— | — | @@ -2,6 +2,7 @@ |
3 | 3 | /** |
4 | 4 | * PayflowPro Gateway API extension |
5 | 5 | * Call with api.php?action=pfp |
| 6 | + * TODO: Determine if this is being used by anything anymore, and if so, what. |
6 | 7 | */ |
7 | 8 | |
8 | 9 | class ApiPayflowProGateway extends ApiBase { |
— | — | @@ -124,6 +125,8 @@ |
125 | 126 | global $wgPayflowProGatewaySalt; |
126 | 127 | |
127 | 128 | // fetch the order_id |
| 129 | + //TODO: This include should be *very* deprecated. All the functionality there has been |
| 130 | + //recently eaten by gateway.adapter.php and DontationData.php. |
128 | 131 | require_once( 'includes/payflowUser.inc' ); |
129 | 132 | $payflow_data = payflowUser(); |
130 | 133 | $order_id = $payflow_data[ 'order_id' ]; |
Index: branches/fundraising/extensions/DonationInterface/extras/custom_filters/custom_filters.body.php |
— | — | @@ -26,8 +26,8 @@ |
27 | 27 | public function __construct( &$gateway_adapter ) { |
28 | 28 | parent::__construct( $gateway_adapter ); //gateway_adapter is set in there. |
29 | 29 | // load user action ranges and risk score |
30 | | - $this->action_ranges = $this->getGlobal( 'CustomFiltersActionRanges' ); |
31 | | - $this->risk_score = $this->getGlobal( 'CustomFiltersRiskScore' ); |
| 30 | + $this->action_ranges = $this->gateway_adapter->getGlobal( 'CustomFiltersActionRanges' ); |
| 31 | + $this->risk_score = $this->gateway_adapter->getGlobal( 'CustomFiltersRiskScore' ); |
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
Index: branches/fundraising/extensions/DonationInterface/extras/custom_filters/custom_filters.php |
— | — | @@ -10,7 +10,12 @@ |
11 | 11 | * The actual filters themselves are regular MW extensions and can optional be organized in filters/ |
12 | 12 | * They should be invoked by using the 'GatewayCustomFilter' hook, which will pass the entire |
13 | 13 | * CustomFilter object to the filter. The gateway object and its data are included in the CustomFilter |
14 | | - * object. |
| 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. :) |
15 | 20 | */ |
16 | 21 | if ( !defined( 'MEDIAWIKI' ) ) { |
17 | 22 | die( "This file is part of the MinFraud for Gateway extension. It is not a valid entry point.\n" ); |
— | — | @@ -22,27 +27,3 @@ |
23 | 28 | 'url' => '', |
24 | 29 | 'description' => 'This extension provides a way to define custom filters for incoming transactions for the gateway.' |
25 | 30 | ); |
26 | | - |
27 | | -/** |
28 | | - * Define the action to take for a given $risk_score |
29 | | - */ |
30 | | -$wgDonationInterfaceCustomFiltersActionRanges = array( |
31 | | - 'process' => array( 0, 100 ), |
32 | | - 'review' => array( -1, -1 ), |
33 | | - 'challenge' => array( -1, -1 ), |
34 | | - 'reject' => array( -1, -1 ), |
35 | | -); |
36 | | - |
37 | | -/** |
38 | | - * A value for tracking the 'riskiness' of a transaction |
39 | | - * |
40 | | - * The action to take based on a transaction's riskScore is determined by |
41 | | - * $action_ranges. This is built assuming a range of possible risk scores |
42 | | - * as 0-100, although you can probably bend this as needed. |
43 | | - */ |
44 | | -$wgDonationInterfaceCustomFiltersRiskScore = 0; |
45 | | - |
46 | | -$dir = dirname( __FILE__ ) . "/"; |
47 | | -$wgAutoloadClasses['Gateway_Extras_CustomFilters'] = $dir . "custom_filters.body.php"; |
48 | | - |
49 | | -$wgHooks["GatewayValidate"][] = array( 'Gateway_Extras_CustomFilters::onValidate' ); |
Index: branches/fundraising/extensions/DonationInterface/extras/custom_filters/filters/minfraud/minfraud.php |
— | — | @@ -32,14 +32,14 @@ |
33 | 33 | * you will want to make sure you know whether minFraud queries are |
34 | 34 | * happening before or after custom filters, defined by the order of |
35 | 35 | * your require statements in LocalSettings. |
| 36 | + * |
| 37 | + * To install the DontaionInterface extension, put the following line in LocalSettings.php: |
| 38 | + * require_once( "\$IP/extensions/DonationInterface/donationinterface.php" ); |
| 39 | + * |
| 40 | + * TODO: Outline required globals to include this bad boy! |
| 41 | + * |
36 | 42 | */ |
37 | | -$wgMinFraudStandalone = FALSE; |
38 | 43 | |
39 | | -$dir = dirname( __FILE__ ) . "/"; |
40 | | -$wgAutoloadClasses['Gateway_Extras_MinFraud'] = $dir . "../../../minfraud/minfraud.body.php"; |
41 | | -$wgAutoloadClasses['Gateway_Extras_CustomFilters_MinFraud'] = $dir . "minfraud.body.php"; |
42 | | -$wgExtensionFunctions[] = 'efCustomFiltersMinFraudSetup'; |
43 | | - |
44 | 44 | function efCustomFiltersMinFraudSetup() { |
45 | 45 | global $wgMinFraudStandalone, $wgHooks; |
46 | 46 | if ( !$wgMinFraudStandalone ) |
Index: branches/fundraising/extensions/DonationInterface/extras/minfraud/minfraud.body.php |
— | — | @@ -157,8 +157,6 @@ |
158 | 158 | * @return array containing hash for minfraud query |
159 | 159 | */ |
160 | 160 | public function build_query( array $data ) { |
161 | | - global $wgDonationInterfaceTest; |
162 | | - |
163 | 161 | // mapping of data keys -> minfraud array keys |
164 | 162 | $map = array( |
165 | 163 | "city" => "city", |
— | — | @@ -175,7 +173,7 @@ |
176 | 174 | $minfraud_array["license_key"] = $this->minfraud_license_key; |
177 | 175 | |
178 | 176 | // user's IP address |
179 | | - $minfraud_array["i"] = ( $wgDonationInterfaceTest ) ? '12.12.12.12' : wfGetIP(); |
| 177 | + $minfraud_array["i"] = ( $this->gateway_adapter->getGlobal( "Test" ) ) ? '12.12.12.12' : wfGetIP(); |
180 | 178 | |
181 | 179 | // user's user agent |
182 | 180 | global $wgRequest; |
Index: branches/fundraising/extensions/DonationInterface/extras/minfraud/minfraud.php |
— | — | @@ -5,9 +5,11 @@ |
6 | 6 | * |
7 | 7 | * For more details on minFraud, go: http://www.maxmind.com/app/minfraud |
8 | 8 | * |
9 | | - * To install: |
10 | | - * require_once( "$IP/extensions/DonationInterface/extras/minfraud/minfraud.php" ); |
11 | | - * |
| 9 | + * To install the DontaionInterface extension, put the following line in LocalSettings.php: |
| 10 | + * require_once( "\$IP/extensions/DonationInterface/donationinterface.php" ); |
| 11 | + * |
| 12 | + * TODO: Outline required globals to include this bad boy! |
| 13 | + * |
12 | 14 | */ |
13 | 15 | if ( !defined( 'MEDIAWIKI' ) ) { |
14 | 16 | die( "This file is part of the MinFraud for Gateway extension. It is not a valid entry point.\n" ); |
— | — | @@ -20,53 +22,6 @@ |
21 | 23 | 'description' => 'This extension uses the MaxMind minFraud service as a validator for the gateway.' |
22 | 24 | ); |
23 | 25 | |
24 | | -/** |
25 | | - * Your minFraud license key. |
26 | | - */ |
27 | | -$wgMinFraudLicenseKey = ''; |
28 | | - |
29 | | -/** |
30 | | - * Set the risk score ranges that will cause a particular 'action' |
31 | | - * |
32 | | - * The keys to the array are the 'actions' to be taken (eg 'process'). |
33 | | - * The value for one of these keys is an array representing the lower |
34 | | - * and upper bounds for that action. For instance, |
35 | | - * $wgMinFraudActionRagnes = array( |
36 | | - * 'process' => array( 0, 100) |
37 | | - * ... |
38 | | - * ); |
39 | | - * means that any transaction with a risk score greather than or equal |
40 | | - * to 0 and less than or equal to 100 will be given the 'process' action. |
41 | | - * |
42 | | - * These are evauluated on a >= or <= basis. Please refer to minFraud |
43 | | - * documentation for a thorough explanation of the 'riskScore'. |
44 | | - */ |
45 | | -$wgMinFraudActionRanges = array( |
46 | | - 'process' => array( 0, 100 ), |
47 | | - 'review' => array( -1, -1 ), |
48 | | - 'challenge' => array( -1, -1 ), |
49 | | - 'reject' => array( -1, -1 ) |
50 | | -); |
51 | | - |
52 | | -// Timeout in seconds for communicating with MaxMind |
53 | | -$wgMinFraudTimeout = 2; |
54 | | - |
55 | | -/** |
56 | | - * Define whether or not to run minFraud in stand alone mode |
57 | | - * |
58 | | - * If this is set to run in standalone, these scripts will be |
59 | | - * accessed directly via the "GatewayValidate" hook. |
60 | | - * You may not want to run this in standalone mode if you prefer |
61 | | - * to use this in conjunction with Custom Filters. This has the |
62 | | - * advantage of sharing minFraud info with other filters. |
63 | | - */ |
64 | | -$wgMinFraudStandalone = TRUE; |
65 | | - |
66 | | -$dir = dirname( __FILE__ ) . "/"; |
67 | | -$wgAutoloadClasses['Gateway_Extras_MinFraud'] = $dir . "minfraud.body.php"; |
68 | | - |
69 | | -$wgExtensionFunctions[] = 'efMinFraudSetup'; |
70 | | - |
71 | 26 | function efMinFraudSetup() { |
72 | 27 | // if we're in standalone mode, use the GatewayValidate hook |
73 | 28 | global $wgMinFraudStandalone, $wgHooks; |
Index: branches/fundraising/extensions/DonationInterface/extras/conversion_log/conversion_log.php |
— | — | @@ -5,8 +5,10 @@ |
6 | 6 | * |
7 | 7 | * @fixme Class/file names should likely change to reflect change in purpose... |
8 | 8 | * |
9 | | - * To install: |
10 | | - * require_once( "$IP/extensions/DonationInterface/extras/conversion_log/conversion_log.php" |
| 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. :) |
11 | 13 | */ |
12 | 14 | if ( !defined( 'MEDIAWIKI' ) ) { |
13 | 15 | die( "This file is part of the Conversion Log for Gateway extension. It is not a valid entry point.\n" ); |
— | — | @@ -18,9 +20,3 @@ |
19 | 21 | 'url' => '', |
20 | 22 | 'description' => "This extension handles logging for Gateway extension 'extras'" |
21 | 23 | ); |
22 | | - |
23 | | -$dir = dirname( __FILE__ ) . "/"; |
24 | | -$wgAutoloadClasses['Gateway_Extras_ConversionLog'] = $dir . "conversion_log.body.php"; |
25 | | - |
26 | | -// Sets the 'conversion log' as logger for post-processing |
27 | | -$wgHooks["GatewayPostProcess"][] = array( "Gateway_Extras_ConversionLog::onPostProcess" ); |
Index: branches/fundraising/extensions/DonationInterface/extras/extras.body.php |
— | — | @@ -15,24 +15,12 @@ |
16 | 16 | public function __construct( &$gateway_adapter ) { |
17 | 17 | $this->gateway_adapter = &$gateway_adapter; |
18 | 18 | |
19 | | - $extrasLog = $this->getGlobal( 'ExtrasLog' ); |
| 19 | + $extrasLog = $this->gateway_adapter->getGlobal( 'ExtrasLog' ); |
20 | 20 | // prepare the log file if the user has specified one |
21 | 21 | if ( strlen( $extrasLog ) > 0 ) |
22 | 22 | $this->prepare_log_file( $extrasLog ); |
23 | 23 | } |
24 | 24 | |
25 | | - function getGlobal( $varname ) { |
26 | | - //basically, if the global is defined in the adapter, use the overridden value. |
27 | | - //otherwise, grab the default. |
28 | | - $ret = $this->gateway_adapter->getGlobal( $varname ); |
29 | | - if ( empty( $ret ) ) { |
30 | | - $globalname = 'wgDonationInterface' . $varname; |
31 | | - global $$globalname; |
32 | | - $ret = $$globalname; |
33 | | - } |
34 | | - return $ret; |
35 | | - } |
36 | | - |
37 | 25 | /** |
38 | 26 | * Prepare logging mechanism |
39 | 27 | * |
— | — | @@ -91,7 +79,7 @@ |
92 | 80 | * @return string The hash of the data |
93 | 81 | */ |
94 | 82 | public function generate_hash( $data ) { |
95 | | - $salt = $this->getGlobal( 'Salt' ); |
| 83 | + $salt = $this->gateway_adapter->getGlobal( 'Salt' ); |
96 | 84 | return hash( "sha512", $salt . $data ); |
97 | 85 | } |
98 | 86 | |
Index: branches/fundraising/extensions/DonationInterface/extras/recaptcha/recaptcha.php |
— | — | @@ -3,8 +3,10 @@ |
4 | 4 | /** |
5 | 5 | * Extra to expose a recaptcha for 'challenged' transactions |
6 | 6 | * |
7 | | - * To install: |
8 | | - * require_once( "$IP/extensions/DonationInterface/extras/recaptcha/recaptcha.php" |
| 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. :) |
9 | 11 | */ |
10 | 12 | if ( !defined( 'MEDIAWIKI' ) ) { |
11 | 13 | die( "This file is part of the ReCaptcha for Gateway extension. It is not a valid entry point.\n" ); |
— | — | @@ -16,41 +18,3 @@ |
17 | 19 | 'url' => '', |
18 | 20 | 'description' => "This extension exposes a reCpathca for 'challenged' transactions in the Gateway" |
19 | 21 | ); |
20 | | - |
21 | | -/** |
22 | | - * Public and Private reCaptcha keys |
23 | | - * |
24 | | - * These can be obtained at: |
25 | | - * http://www.google.com/recaptcha/whyrecaptcha |
26 | | - */ |
27 | | -$wgDonationInterfaceRecaptchaPublicKey = ''; |
28 | | -$wgDonationInterfaceRecaptchaPrivateKey = ''; |
29 | | - |
30 | | -// Timeout (in seconds) for communicating with reCatpcha |
31 | | -$wgDonationInterfaceRecaptchaTimeout = 2; |
32 | | - |
33 | | -/** |
34 | | - * HTTP Proxy settings |
35 | | - * |
36 | | - * Default to settings in DonationInterface |
37 | | - */ |
38 | | -//TODO: I think we can get rid of these entirely, due to the way we are now checking for globals in the extras. |
39 | | -//$wgDonationInterfaceRecaptchaUseHTTPProxy = $wgDonationInterfaceUseHTTPProxy; |
40 | | -//$wgDonationInterfaceRecaptchaHTTPProxy = $wgDonationInterfaceHTTPProxy; |
41 | | - |
42 | | -/** |
43 | | - * Use SSL to communicate with reCaptcha |
44 | | - */ |
45 | | -$wgDonationInterfaceRecaptchaUseSSL = 1; |
46 | | - |
47 | | -/** |
48 | | - * The # of times to retry communicating with reCaptcha if communication fails |
49 | | - * @var int |
50 | | - */ |
51 | | -$wgDonationInterfaceRecaptchaComsRetryLimit = 3; |
52 | | - |
53 | | -$dir = dirname( __FILE__ ) . "/"; |
54 | | -$wgAutoloadClasses['Gateway_Extras_ReCaptcha'] = $dir . "recaptcha.body.php"; |
55 | | - |
56 | | -// Set reCpatcha as plugin for 'challenge' action |
57 | | -$wgHooks["GatewayChallenge"][] = array( "Gateway_Extras_ReCaptcha::onChallenge" ); |
Index: branches/fundraising/extensions/DonationInterface/extras/recaptcha/recaptcha.body.php |
— | — | @@ -22,11 +22,11 @@ |
23 | 23 | //stash all the vars that reCaptcha is going to need in a global just for it. |
24 | 24 | //I know this is vaguely unpleasant, but it's the quickest way back to zero. |
25 | 25 | global $wgReCaptchaConfData; |
26 | | - $wgReCaptchaConfData['UseHTTPProxy'] = $this->getGlobal( 'RecaptchaUseHTTPProxy' ); |
27 | | - $wgReCaptchaConfData['HTTPProxy'] = $this->getGlobal( 'RecaptchaHTTPProxy' ); |
28 | | - $wgReCaptchaConfData['Timeout'] = $this->getGlobal( 'RecaptchaTimeout' ); |
29 | | - $wgReCaptchaConfData['UseSSL'] = $this->getGlobal( 'RecaptchaUseSSL' ); |
30 | | - $wgReCaptchaConfData['ComsRetryLimit'] = $this->getGlobal( 'RecaptchaComsRetryLimit' ); |
| 26 | + $wgReCaptchaConfData['UseHTTPProxy'] = $this->gateway_adapter->getGlobal( 'RecaptchaUseHTTPProxy' ); |
| 27 | + $wgReCaptchaConfData['HTTPProxy'] = $this->gateway_adapter->getGlobal( 'RecaptchaHTTPProxy' ); |
| 28 | + $wgReCaptchaConfData['Timeout'] = $this->gateway_adapter->getGlobal( 'RecaptchaTimeout' ); |
| 29 | + $wgReCaptchaConfData['UseSSL'] = $this->gateway_adapter->getGlobal( 'RecaptchaUseSSL' ); |
| 30 | + $wgReCaptchaConfData['ComsRetryLimit'] = $this->gateway_adapter->getGlobal( 'RecaptchaComsRetryLimit' ); |
31 | 31 | $wgReCaptchaConfData['GatewayClass'] = $this->gateway_adapter->getGatewayAdapterClass(); //for properly routing the logging |
32 | 32 | // load the reCaptcha API |
33 | 33 | require_once( dirname( __FILE__ ) . '/recaptcha-php/recaptchalib.php' ); |
— | — | @@ -60,8 +60,8 @@ |
61 | 61 | */ |
62 | 62 | public function display_captcha() { |
63 | 63 | global $wgOut; |
64 | | - $publicKey = $this->getGlobal( 'RecaptchaPublicKey' ); |
65 | | - $useSSL = $this->getGlobal( 'RecaptchaUseSSL' ); |
| 64 | + $publicKey = $this->gateway_adapter->getGlobal( 'RecaptchaPublicKey' ); |
| 65 | + $useSSL = $this->gateway_adapter->getGlobal( 'RecaptchaUseSSL' ); |
66 | 66 | |
67 | 67 | // log that a captcha's been triggered |
68 | 68 | $this->log( $this->gateway_adapter->getData( 'contribution_tracking_id' ), 'Captcha triggered' ); |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | */ |
96 | 96 | public function check_captcha() { |
97 | 97 | global $wgRequest; |
98 | | - $privateKey = $this->getGlobal( 'RecaptchaPrivateKey' ); |
| 98 | + $privateKey = $this->gateway_adapter->getGlobal( 'RecaptchaPrivateKey' ); |
99 | 99 | $resp = recaptcha_check_answer( $privateKey, wfGetIP(), $wgRequest->getText( 'recaptcha_challenge_field' ), $wgRequest->getText( 'recaptcha_response_field' ) ); |
100 | 100 | |
101 | 101 | return $resp; |
Index: branches/fundraising/extensions/DonationInterface/extras/extras.php |
— | — | @@ -3,9 +3,10 @@ |
4 | 4 | /** |
5 | 5 | * An abstract class and set up for gateway 'extras' |
6 | 6 | * |
7 | | - * To install: |
8 | | - * require_once( "$IP/extensions/DonationInterface/extras/extras.php" |
9 | | - * Note: This should be specified in LocalSettings.php BEFORE requiring any of the other 'extras' |
| 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. :) |
10 | 11 | */ |
11 | 12 | if ( !defined( 'MEDIAWIKI' ) ) { |
12 | 13 | die( "This file is part of Gateway extension. It is not a valid entry point.\n" ); |
— | — | @@ -18,12 +19,3 @@ |
19 | 20 | 'description' => "This extension handles some of the set up required for Gateway extras" |
20 | 21 | ); |
21 | 22 | |
22 | | -/** |
23 | | - * Full path to file to use for logging for Gateway scripts |
24 | | - * |
25 | | - * Declare in LocalSettings.php |
26 | | - */ |
27 | | -$wgDonationInterfaceExtrasLog = ''; |
28 | | - |
29 | | -$dir = dirname( __FILE__ ) . "/"; |
30 | | -$wgAutoloadClasses['Gateway_Extras'] = $dir . "extras.body.php"; |
\ No newline at end of file |
Index: branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php |
— | — | @@ -29,6 +29,9 @@ |
30 | 30 | $wgOut->addExtensionStyle( |
31 | 31 | $wgExtensionAssetsPath . '/DonationInterface/gateway_forms/css/gateway.css?284' . |
32 | 32 | $CSSVersion ); |
| 33 | + |
| 34 | + // Hide unneeded interface elements |
| 35 | + $wgOut->addModules( 'donationInterface.skinOverride' ); |
33 | 36 | |
34 | 37 | $gateway_id = $this->adapter->getIdentifier(); |
35 | 38 | |
Index: branches/fundraising/extensions/DonationInterface/paypal_gateway/paypal_gateway.php |
— | — | @@ -1,4 +1,12 @@ |
2 | 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 | + |
3 | 11 | # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly. |
4 | 12 | if ( !defined( 'MEDIAWIKI' ) ) { |
5 | 13 | echo <<<EOT |
— | — | @@ -17,24 +25,7 @@ |
18 | 26 | 'version' => '1.0.0', |
19 | 27 | ); |
20 | 28 | |
21 | | -// Set up i18n |
22 | | -$dir = dirname( __FILE__ ) . '/'; |
23 | | -$wgExtensionMessagesFiles['PaypalGateway'] = $dir . 'paypal_gateway.i18n.php'; |
24 | | - |
25 | | -// default variables that should be set in LocalSettings.php |
26 | | -$wgPaypalEmail = ''; |
27 | | -$wgPaypalUrl = 'http://wikimediafoundation.org/wiki/Special:ContributionTracking?'; |
28 | | - |
29 | 29 | /** |
30 | | - * Hooks required to interface with the donation extension (include <donate> on page) |
31 | | - * |
32 | | - * gwValue supplies the value of the form option, the name that appears on the form |
33 | | - * and the currencies supported by the gateway in the $values array |
34 | | - */ |
35 | | -$wgHooks['DonationInterface_Value'][] = 'paypalGatewayValue'; |
36 | | -$wgHooks['DonationInterface_Page'][] = 'paypalGatewayPage'; |
37 | | - |
38 | | -/** |
39 | 30 | * Hook to register form value and display name of this gateway |
40 | 31 | * also supplies currencies supported by this gateway |
41 | 32 | */ |
Index: branches/fundraising/extensions/DonationInterface/gateway_common/DonationData.php |
— | — | @@ -714,20 +714,6 @@ |
715 | 715 | } |
716 | 716 | } |
717 | 717 | |
718 | | - public function decrementNumAttempt() { |
719 | | - //minfraud... |
720 | | - //TODO: Determine if I killed this or not. |
721 | | - if ( $this->isSomething( 'numAttempt' ) ) { |
722 | | - $attempts = $this->getVal( 'numAttempt' ); |
723 | | - if ( is_numeric( $attempts ) ) { |
724 | | - $this->setVal( 'numAttempt', $attempts - 1 ); |
725 | | - } else { |
726 | | - //I guess... |
727 | | - $this->setVal( 'numAttempt', 0 ); |
728 | | - } |
729 | | - } |
730 | | - } |
731 | | - |
732 | 718 | } |
733 | 719 | |
734 | 720 | ?> |
Index: branches/fundraising/extensions/DonationInterface/donate_interface/donate_interface.php |
— | — | @@ -5,6 +5,11 @@ |
6 | 6 | * @file |
7 | 7 | * @ingroup Extensions |
8 | 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. :) |
9 | 14 | */ |
10 | 15 | |
11 | 16 | if ( !defined( 'MEDIAWIKI' ) ) { |
Index: branches/fundraising/extensions/DonationInterface/activemq_stomp/activemq_stomp.php |
— | — | @@ -17,14 +17,6 @@ |
18 | 18 | 'version' => '1.0.0', |
19 | 19 | ); |
20 | 20 | |
21 | | -$dir = dirname( __FILE__ ) . '/'; |
22 | | - |
23 | | -$wgAutoloadClasses['activemq_stomp'] = $dir . 'activemq_stomp.php'; # Tell MediaWiki to load the extension body. |
24 | | -// default variables that should be set in LocalSettings |
25 | | -$wgStompServer = ""; |
26 | | - |
27 | | -$wgHooks['ParserFirstCallInit'][] = 'efStompSetup'; |
28 | | - |
29 | 21 | /* |
30 | 22 | * Create <donate /> tag to include landing page donation form |
31 | 23 | */ |
— | — | @@ -49,16 +41,13 @@ |
50 | 42 | } |
51 | 43 | |
52 | 44 | /** |
53 | | - * Hook to get user provided and order data |
54 | | - * |
| 45 | + * Hook to send complete transaction information to ActiveMQ server |
| 46 | + * @global string $wgStompServer ActiveMQ server name. |
| 47 | + * @global string $wgStompQueueName Name of the destination queue for completed transactions. |
| 48 | + * @param array $transaction Key-value array of staged and ready donation data. |
| 49 | + * @return bool Just returns true all the time. Presumably an indication that |
| 50 | + * nothing exploded big enough to kill the whole thing. |
55 | 51 | */ |
56 | | -$wgHooks['gwStomp'][] = 'sendSTOMP'; |
57 | | -$wgHooks['gwPendingStomp'][] = 'sendPendingSTOMP'; |
58 | | - |
59 | | -/* |
60 | | - * Hook to send transaction information to ActiveMQ server |
61 | | - */ |
62 | | - |
63 | 52 | function sendSTOMP( $transaction ) { |
64 | 53 | global $wgStompServer, $wgStompQueueName; |
65 | 54 | |
— | — | @@ -87,10 +76,16 @@ |
88 | 77 | return true; |
89 | 78 | } |
90 | 79 | |
91 | | -/* |
| 80 | +/** |
92 | 81 | * Hook to send transaction information to ActiveMQ server |
| 82 | + * TODO: Parameterize sendStomp instead of maintaining this copy. |
| 83 | + * @global string $wgStompServer ActiveMQ server name. |
| 84 | + * @global string $wgPendingStompQueueName Name of the destination queue for |
| 85 | + * pending transactions. |
| 86 | + * @param array $transaction Key-value array of staged and ready donation data. |
| 87 | + * @return bool Just returns true all the time. Presumably an indication that |
| 88 | + * nothing exploded big enough to kill the whole thing. |
93 | 89 | */ |
94 | | - |
95 | 90 | function sendPendingSTOMP( $transaction ) { |
96 | 91 | global $wgStompServer, $wgPendingStompQueueName; |
97 | 92 | |
— | — | @@ -121,6 +116,9 @@ |
122 | 117 | |
123 | 118 | /** |
124 | 119 | * Assign correct values to the array of data to be sent to the ActiveMQ server |
| 120 | + * TODO: Probably something else. I don't like the way this works and neither do you. |
| 121 | + * |
| 122 | + * Older notes follow: |
125 | 123 | * TODO: include optout and comments option in the donation page |
126 | 124 | * NOTES: includes middle name |
127 | 125 | * Currency in receiving module has currency set to USD, should take passed variable for these |