r106493 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106492‎ | r106493 | r106494 >
Date:01:22, 17 December 2011
Author:khorn
Status:deferred
Tags:fundraising 
Comment:
followup r106158
Changed the way the setFormClass function works, so a default form class is always assigned (even if none was passed in from anything, as in an api call).
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/DonationData.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php
@@ -412,22 +412,29 @@
413413 protected function setFormClass(){
414414 //don't actually try to load the forms here... but do determine if what we've got in there will load or not.
415415 //Elsewise, set it to the default.
 416+ $default = false;
416417
417 - if ( $this->isSomething( 'form_name' ) ){ //we're apparently going to try to load a form class. Note: That might not always be true.
 418+ if ( $this->isSomething( 'form_name' ) ){
418419 $class_name = "Gateway_Form_" . $this->getVal( 'form_name' );
419 - if ( !class_exists( $class_name ) ) {
420 - //try the default
 420+ } else {
 421+ $default = true;
 422+ $class_name = "Gateway_Form_" . $this->getGatewayGlobal( 'DefaultForm' );
 423+ }
 424+
 425+ if ( !class_exists( $class_name ) ) {
 426+ if (!$default){ //try that, then.
421427 $class_name_orig = $class_name;
422428 $class_name = "Gateway_Form_" . $this->getGatewayGlobal( 'DefaultForm' );
423 - if ( class_exists( $class_name ) ) {
424 - $this->setVal( 'form_name', $this->getGatewayGlobal( 'DefaultForm' ) );
425 - } else {
426 - throw new MWException( 'Could not find form ' . $class_name_orig . ', nor default form ' . $class_name );
427 - }
428429 }
 430+
 431+ if ( class_exists( $class_name ) ) {
 432+ $this->setVal( 'form_name', $this->getGatewayGlobal( 'DefaultForm' ) );
 433+ } else {
 434+ throw new MWException( 'Could not find form ' . $class_name_orig . ', nor default form ' . $class_name );
 435+ }
 436+ }
429437
430 - $this->setVal( 'form_class', $class_name );
431 - }
 438+ $this->setVal( 'form_class', $class_name );
432439 }
433440
434441 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r112287MFT r101785, r105938, r105941, r105953, r106109, r106158, r106259, r106366, r...khorn01:29, 24 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106158Data handling cleanup in DonationInterface, part 3 of [some]....khorn01:35, 14 December 2011

Status & tagging log