Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php |
— | — | @@ -211,10 +211,16 @@ |
212 | 212 | $this->setNormalizedOrderIDs(); |
213 | 213 | $this->setGateway(); |
214 | 214 | $this->setNormalizedOptOuts(); |
| 215 | + $this->setLanguage(); |
215 | 216 | array_walk( $this->normalized, array( $this, 'sanitizeInput' ) ); |
216 | 217 | } |
217 | 218 | } |
218 | 219 | |
| 220 | + /** |
| 221 | + * normalizeAndSanitize helper function |
| 222 | + * Takes all possible sources for the intended donation amount, and |
| 223 | + * normalizes them into the 'amount' field. |
| 224 | + */ |
219 | 225 | function setNormalizedAmount() { |
220 | 226 | if ( !($this->isSomething( 'amount' )) || !(preg_match( '/^\d+(\.(\d+)?)?$/', $this->getVal( 'amount' ) ) ) ) { |
221 | 227 | if ( $this->isSomething( 'amountGiven' ) && preg_match( '/^\d+(\.(\d+)?)?$/', $this->getVal( 'amountGiven' ) ) ) { |
— | — | @@ -234,6 +240,12 @@ |
235 | 241 | } |
236 | 242 | } |
237 | 243 | |
| 244 | + /** |
| 245 | + * normalizeAndSanitize helper function |
| 246 | + * Ensures that order_id and i_order_id are ready to go, depending on what |
| 247 | + * comes in populated or not, and where it came from. |
| 248 | + * @return null |
| 249 | + */ |
238 | 250 | function setNormalizedOrderIDs() { |
239 | 251 | //basically, we need a new order_id every time we come through here, but if there's an internal already there, |
240 | 252 | //we want to use that one internally. So. |
— | — | @@ -301,11 +313,28 @@ |
302 | 314 | } |
303 | 315 | } |
304 | 316 | |
| 317 | + /** |
| 318 | + * normalizeAndSanitize helper function. |
| 319 | + * Sets the gateway to be the gateway that called this class in the first |
| 320 | + * place. |
| 321 | + */ |
305 | 322 | function setGateway() { |
306 | 323 | //TODO: Hum. If we have some other gateway in the form data, should we go crazy here? (Probably) |
307 | 324 | $gateway = $this->gatewayID; |
308 | 325 | $this->setVal( 'gateway', $gateway ); |
309 | 326 | } |
| 327 | + |
| 328 | + /** |
| 329 | + * normalizeAndSanitize helper function |
| 330 | + * If the language has not yet been set, pulls the language code |
| 331 | + * from the current global language object. |
| 332 | + */ |
| 333 | + function setLanguage() { |
| 334 | + global $wgLang; |
| 335 | + if ( !$this->isSomething( 'language' ) ) { |
| 336 | + $this->setVal( 'language', $wgLang->getCode() ); |
| 337 | + } |
| 338 | + } |
310 | 339 | |
311 | 340 | function doCacheStuff() { |
312 | 341 | //TODO: Wow, name. |
Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php |
— | — | @@ -1055,7 +1055,7 @@ |
1056 | 1056 | 'response' => $this->getTransactionMessage(), |
1057 | 1057 | 'date' => time(), |
1058 | 1058 | 'gateway_txn_id' => $this->getTransactionGatewayTxnID(), |
1059 | | - 'language' => '', |
| 1059 | + //'language' => '', |
1060 | 1060 | ); |
1061 | 1061 | $transaction += $this->getData(); |
1062 | 1062 | |