r106158 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106157‎ | r106158 | r106159 >
Date:01:35, 14 December 2011
Author:khorn
Status:deferred
Tags:fundraising 
Comment:
Data handling cleanup in DonationInterface, part 3 of [some].
DonationData: Added form_name and ffname to the data population, and added a setFormClass normalization routine to determine if the passed-in form name is valid there, instead of way farther downstream and then trying to pass that back to the adapter way after the fact.
GatewayForm: Removed all the logic for setting the form class name (replaced by the far less mashed-up version in DonationData).
GatewayAdapter: Added a $posted var that is a little more robust than just asking $wgRequest if we were posted, as most of the time we are more interested in knowing if we've posted back to ourselves. This will tell us that.
Collapsed all the form_class business into one get function.
Gateway_Form: In an effort to get the form data closer to the source, removed many instances of unnecessary data duplication. Removed several references to $wgRequest in favor of values we already had on-hand.
Made sure all instances of $wgOut->parse() were only ever operating on escaped values.
Various Other Form Classes: Removed and functionalized duplicated code that had anything to do with $wgRequest, or $wgOut->parse().
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/DonationData.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_common/GatewayForm.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/Form.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/OneStepTwoColumn.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/RapidHtml.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter2.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter3.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter4.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter5.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter6.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter7.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/TwoStepAmount.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter2.php
@@ -71,7 +71,7 @@
7272 }
7373
7474 protected function generateBillingFields() {
75 - global $wgScriptPath, $wgRequest;
 75+ global $wgScriptPath;
7676 $scriptPath = "$wgScriptPath/extensions/DonationInterface/gateway_forms/includes";
7777
7878 $form = '';
@@ -134,12 +134,8 @@
135135 }
136136
137137 // anonymous
138 - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true;
139 - $form .= '<tr>';
140 - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
141 - $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
142 - $form .= '</tr>';
143 -
 138+ $form .= $this->getCommentOptionField();
 139+
144140 // email agreement
145141 $form .= $this->getEmailOptField();
146142
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter3.php
@@ -71,7 +71,7 @@
7272 }
7373
7474 protected function generateBillingFields() {
75 - global $wgScriptPath, $wgRequest;
 75+ global $wgScriptPath;
7676 $scriptPath = "$wgScriptPath/extensions/DonationInterface/gateway_forms/includes";
7777
7878 $form = '';
@@ -134,11 +134,7 @@
135135 }
136136
137137 // anonymous
138 - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true;
139 - $form .= '<tr>';
140 - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
141 - $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
142 - $form .= '</tr>';
 138+ $form .= $this->getCommentOptionField();
143139
144140 // email agreement
145141 $form .= $this->getEmailOptField();
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter4.php
@@ -71,7 +71,7 @@
7272 }
7373
7474 protected function generateBillingFields() {
75 - global $wgScriptPath, $wgRequest;
 75+ global $wgScriptPath;
7676 $scriptPath = "$wgScriptPath/extensions/DonationInterface/gateway_forms/includes";
7777
7878 $form = '';
@@ -134,11 +134,7 @@
135135 }
136136
137137 // anonymous
138 - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true;
139 - $form .= '<tr>';
140 - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
141 - $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
142 - $form .= '</tr>';
 138+ $form .= $this->getCommentOptionField();
143139
144140 // email agreement
145141 $form .= $this->getEmailOptField();
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter5.php
@@ -73,7 +73,7 @@
7474 }
7575
7676 protected function generateBillingFields() {
77 - global $wgScriptPath, $wgRequest;
 77+ global $wgScriptPath;
7878 $scriptPath = "$wgScriptPath/extensions/DonationInterface/gateway_forms/includes";
7979
8080 $form = '';
@@ -115,7 +115,7 @@
116116 $form .= $this->getEmailField();
117117
118118 // email opt-in
119 - $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'email-opt' ) : true;
 119+ $email_opt_value = ( $this->gateway->posted ) ? $this->getEscapedValue( 'email-opt' ) : true;
120120 $form .= '<tr>';
121121 $form .= '<td class="label"> </td>';
122122 $form .= '<td class="check-option">' . Xml::check( 'email-opt', $email_opt_value );
@@ -126,7 +126,7 @@
127127 $form .= Xml::closeElement( 'label' );
128128 $form .= '</td>';
129129 $form .= '</tr>';
130 -
 130+
131131 $form .= '<tr>';
132132 $form .= '<td class="label">' . wfMsg( 'donate_interface-payment-type' ) . '</td>';
133133 $form .= '<td>' .
@@ -172,16 +172,6 @@
173173 // country
174174 $form .= $this->getCountryField();
175175
176 - /*
177 - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true;
178 - $form .= '<tr>';
179 - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
180 - $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
181 - $form .= '</tr>';
182 -
183 - $form .= $this->getEmailOptField();
184 - */
185 -
186176 return $form;
187177 }
188178
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter6.php
@@ -73,7 +73,7 @@
7474 }
7575
7676 protected function generateBillingFields() {
77 - global $wgScriptPath, $wgRequest;
 77+ global $wgScriptPath;
7878 $scriptPath = "$wgScriptPath/extensions/DonationInterface/gateway_forms/includes";
7979
8080 $form = '';
@@ -109,7 +109,7 @@
110110 $form .= '</tr>';
111111
112112 // email opt-in
113 - $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'email-opt' ) : true;
 113+ $email_opt_value = ( $this->gateway->posted ) ? $this->getEscapedValue( 'email-opt' ) : true;
114114 $form .= '<tr>';
115115 $form .= '<td class="label"> </td>';
116116 $form .= '<td class="check-option">' . Xml::check( 'email-opt', $email_opt_value );
@@ -180,16 +180,6 @@
181181 // country
182182 $form .= $this->getCountryField();
183183
184 - /*
185 - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true;
186 - $form .= '<tr>';
187 - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
188 - $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
189 - $form .= '</tr>';
190 -
191 - $form .= $this->getEmailOptField();
192 - */
193 -
194184 return $form;
195185 }
196186
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter7.php
@@ -135,7 +135,7 @@
136136 }
137137
138138 public function generateFormStart() {
139 - global $wgOut, $wgRequest;
 139+ global $wgOut;
140140
141141 $form = parent::generateBannerHeader();
142142
@@ -232,20 +232,6 @@
233233 '</td>';
234234 $form .= '</tr>';
235235
236 - // email opt-in
237 - /*
238 - $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'email-opt' ) : true;
239 - $form .= '<tr>';
240 - $form .= '<td class="label"> </td>';
241 - $form .= '<td class="check-option">' . Xml::check( 'email-opt', $email_opt_value );
242 - $form .= ' ';
243 - $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' ) );
244 - $form .= wfMsg( 'donate_interface-email-agreement' );
245 - $form .= Xml::closeElement( 'label' );
246 - $form .= '</td>';
247 - $form .= '</tr>';
248 - */
249 -
250236 // Payment type
251237 $form .= '<tr>';
252238 $form .= '<td class="label""><div style="padding-top:9px;">' . wfMsg( 'donate_interface-payment-type' ) . '</div></td>';
@@ -345,16 +331,6 @@
346332 '</td>';
347333 $form .= '</tr>';
348334
349 - /*
350 - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true;
351 - $form .= '<tr>';
352 - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
353 - $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
354 - $form .= '</tr>';
355 -
356 - $form .= $this->getEmailOptField();
357 - */
358 -
359335 return $form;
360336 }
361337
Index: trunk/extensions/DonationInterface/gateway_forms/Form.php
@@ -21,18 +21,13 @@
2222 *
2323 * @var string
2424 */
 25+ //TODO: Determine what this is, and either take measures to reference
 26+ //something closer to the source data via the gateway object, or get rid of
 27+ //it. If this is (as the comment suggests) also the name of the form,
 28+ //my vote goes for option 2.
2529 public $form_id = 'payment';
2630
2731 /**
28 - * The name of the form.
29 - *
30 - * This should also be the id of the form
31 - *
32 - * @var string
33 - */
34 - public $form_name = 'payment';
35 -
36 - /**
3732 * An array of form errors, passed from the payflow pro object
3833 * @var array
3934 */
@@ -49,18 +44,6 @@
5045 * @var string
5146 */
5247 protected $captcha_html;
53 -
54 - /**
55 - * The payment method
56 - * @var string
57 - */
58 - protected $payment_method = '';
59 -
60 - /**
61 - * The payment submethod
62 - * @var string
63 - */
64 - protected $payment_submethod = '';
6548
6649 /**
6750 * Tells us if we're paypal only or not.
@@ -568,12 +551,13 @@
569552
570553 // intro text
571554 if ( $wgRequest->getText( 'masthead', false ) ) {
572 - $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->getEscapedValue( 'language' ) . '}}' );
 555+ $parse = '{{' . htmlspecialchars( $wgRequest->getText( 'masthead' ), ENT_COMPAT, 'UTF-8', false ) . '/' . $this->getEscapedValue( 'language' ) . '}}';
 556+ $template = $wgOut->parse( $parse );
573557 } elseif ( $header ) {
574558 $header = str_replace( '@language', $this->getEscapedValue( 'language' ), $header );
575 - $template = $wgOut->parse( $header );
 559+ $template = $wgOut->parse( htmlspecialchars( $header, ENT_COMPAT, 'UTF-8', false ) );
576560 }
577 -
 561+
578562 // make sure that we actually have a matching template to display so we don't display the 'redlink'
579563 if ( strlen( $template ) && !preg_match( '/redlink\=1/', $template ) ) {
580564 $wgOut->addHtml( $template );
@@ -737,8 +721,7 @@
738722 }
739723
740724 protected function getCommentOptionField() {
741 - global $wgRequest;
742 - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true;
 725+ $comment_opt_value = ( $this->gateway->posted ) ? $this->getEscapedValue( 'comment-option' ) : true;
743726 $form = '<tr>';
744727 $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
745728 $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
@@ -747,8 +730,7 @@
748731 }
749732
750733 protected function getEmailOptField() {
751 - global $wgRequest;
752 - $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'email-opt' ) : true;
 734+ $email_opt_value = ( $this->gateway->posted ) ? $this->getEscapedValue( 'email-opt' ) : true;
753735 $form = '<tr>';
754736 $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value );
755737 $form .= ' ';
@@ -895,81 +877,41 @@
896878 * @return string
897879 */
898880 protected function getFormId() {
899 -
 881+ //TODO: Determine what this is, and either take measures to reference
 882+ //something closer to the source data, move it to a child class, or get rid of it.
900883 return $this->form_id;
901884 }
902885
903886 /**
904 - * Set the form id
905 - *
906 - * @param string $value The form_id value
907 - */
908 - protected function setFormId( $value = '' ) {
909 -
910 - $this->form_id = (string) $value;
911 - }
912 -
913 - /**
914887 * Get the form name
915888 *
916889 * @return string
917890 */
918891 protected function getFormName() {
919892
920 - return $this->form_name;
 893+ return $this->getEscapedValue( 'form_name' );
921894 }
922895
923896 /**
924 - * Set the form name
925 - *
926 - * @param string $value The form_name value
927 - */
928 - protected function setFormName( $value = '' ) {
929 -
930 - $this->form_name = (string) $value;
931 - }
932 -
933 - /**
934897 * Get the payment method
935898 *
936899 * @return string
937900 */
938901 protected function getPaymentMethod() {
939902
940 - return $this->payment_method;
 903+ return $this->getEscapedValue( 'payment_method' );
941904 }
942905
943906 /**
944 - * Set the payment method
945 - *
946 - * @param string $value The payment method value
947 - */
948 - protected function setPaymentMethod( $value = '' ) {
949 -
950 - $this->payment_method = (string) $value;
951 - }
952 -
953 - /**
954907 * Get the payment submethod
955908 *
956909 * @return string
957910 */
958911 protected function getPaymentSubmethod() {
959 -
960 - return $this->payment_submethod;
 912+ return $this->getEscapedValue( 'payment_submethod' );
961913 }
962914
963915 /**
964 - * Set the payment submethod
965 - *
966 - * @param string $value The payment submethod value
967 - */
968 - protected function setPaymentSubmethod( $value = '' ) {
969 -
970 - $this->payment_submethod = (string) $value;
971 - }
972 -
973 - /**
974916 * Create the Verisign logo (small size)
975917 *
976918 */
Index: trunk/extensions/DonationInterface/gateway_forms/RapidHtml.php
@@ -96,6 +96,7 @@
9797
9898 $this->loadValidateJs();
9999
 100+ //Not sure if we should be using $wgRequest here. Depends if we want the normalized one or not.
100101 $country = $wgRequest->getText( 'country', '' );
101102 // Get error passed via query string
102103 $error = $wgRequest->getText( 'error' );
@@ -406,6 +407,8 @@
407408 * Load API js if this form needs to support cacheing
408409 */
409410 public function handle_cacheability() {
 411+ //We may change this from checking one thing in $wgRequest, to a
 412+ //reference to $this->gateway->isCaching(). Little more robust.
410413 global $wgRequest;
411414 if ( $wgRequest->getText( '_cache_', false )) {
412415 $this->loadApiJs();
Index: trunk/extensions/DonationInterface/gateway_forms/OneStepTwoColumn.php
@@ -192,24 +192,6 @@
193193 return $form;
194194 }
195195
196 - protected function generateBannerHeader() {
197 - global $wgOut, $wgRequest;
198 - $template = '';
199 -
200 - // intro text
201 - if ( $wgRequest->getText( 'masthead', false ) ) {
202 - $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->getEscapedValue( 'language' ) . '}}' );
203 - } elseif ( $this->gateway->getGlobal( "Header" ) ) {
204 - $header = str_replace( '@language', $this->getEscapedValue( 'language' ), $this->gateway->getGlobal( "Header" ) );
205 - $template = $wgOut->parse( $header );
206 - }
207 -
208 - // make sure that we actually have a matching template to display so we don't display the 'redlink'
209 - if ( strlen( $template ) && !preg_match( '/redlink\=1/', $template ) ) {
210 - $wgOut->addHtml( $template );
211 - }
212 - }
213 -
214196 protected function generatePersonalContainer() {
215197 global $wgScriptPath;
216198 $form = '';
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/TwoStepAmount.php
@@ -73,9 +73,6 @@
7474 */
7575 protected function init() {
7676
77 - $this->setPaymentMethod( $this->getEscapedValue( 'payment_method' ) );
78 - $this->setPaymentSubmethod( $this->getEscapedValue( 'payment_submethod' ) );
79 -
8077 // Should process be deprecated?
8178 $this->getEscapedValue( 'process' ) = 'other';
8279
Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -168,11 +168,16 @@
169169 protected $xmlDoc;
170170 protected $dataObj;
171171 protected $transaction_results;
172 - protected $form_class;
173172 protected $validation_errors;
174173 protected $current_transaction;
175174 protected $action;
176175 public $debugarray;
 176+ /**
 177+ * A boolean that will tell us if we've posted to ourselves. A little more telling than
 178+ * $wgRequest->wasPosted(), as something else could have posted to us.
 179+ * @var boolean
 180+ */
 181+ public $posted = false;
177182 protected $batch = false;
178183
179184 //ALL OF THESE need to be redefined in the children. Much voodoo depends on the accuracy of these constants.
@@ -224,6 +229,7 @@
225230 $this->unstaged_data = $this->dataObj->getDataEscaped();
226231 $this->staged_data = $this->unstaged_data;
227232
 233+ //If we ever put numAttempt in the session, we'll probably want to re-examine which form value we want to use here.
228234 $this->posted = ( $this->dataObj->wasPosted() && ( !is_null( $wgRequest->getVal( 'numAttempt', null ) ) ) );
229235
230236 $this->setPostDefaults( $postDefaults );
@@ -1876,14 +1882,10 @@
18771883 }
18781884 }
18791885
1880 - public function setFormClass( $formClassName ) {
1881 - //I'm adding this because Captcha needs it, and we're gonna fire the hook inside. Nothing else really needs it as far as I know.
1882 - $this->form_class = $formClassName;
1883 - }
1884 -
18851886 public function getFormClass() {
1886 - if ( isset( $this->form_class ) && class_exists( $this->form_class ) ) {
1887 - return $this->form_class;
 1887+ $form_class = $this->getData_Unstaged_Escaped( 'form_class' );
 1888+ if ( ( $form_class ) && class_exists( $form_class ) ) {
 1889+ return $form_class;
18881890 } else {
18891891 return false;
18901892 }
Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php
@@ -330,11 +330,37 @@
331331 $this->setCountry();
332332 $this->handleContributionTrackingID();
333333 $this->setCurrencyCode();
 334+ $this->setFormClass();
334335 }
335336 }
336337
337338 /**
338339 * normalize helper function
 340+ * Sets the form class we will be using.
 341+ */
 342+ function setFormClass(){
 343+ //don't actually try to load the forms here... but do determine if what we've got in there will load or not.
 344+ //Elsewise, set it to the default.
 345+
 346+ if ( $this->isSomething( 'form_name' ) ){ //we're apparently going to try to load a form class. Note: That might not always be true.
 347+ $class_name = "Gateway_Form_" . $this->getVal( 'form_name' );
 348+ if ( !class_exists( $class_name ) ) {
 349+ //try the default
 350+ $class_name_orig = $class_name;
 351+ $class_name = "Gateway_Form_" . $this->getGatewayGlobal( 'DefaultForm' );
 352+ if ( class_exists( $class_name ) ) {
 353+ $this->setVal( 'form_name', $this->getGatewayGlobal( 'DefaultForm' ) );
 354+ } else {
 355+ throw new MWException( 'Could not find form ' . $class_name_orig . ', nor default form ' . $class_name );
 356+ }
 357+ }
 358+
 359+ $this->setVal( 'form_class', $class_name );
 360+ }
 361+ }
 362+
 363+ /**
 364+ * normalize helper function
339365 * Setting the country correctly.
340366 */
341367 function setCountry() {
Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php
@@ -23,14 +23,6 @@
2424 class GatewayForm extends UnlistedSpecialPage {
2525
2626 /**
27 - * A container for the form class
28 - *
29 - * Used to loard the form object to display the CC form
30 - * @var object
31 - */
32 - public $form_class;
33 -
34 - /**
3527 * An array of form errors
3628 * @var array $errors
3729 */
@@ -57,7 +49,6 @@
5850 $me = get_called_class();
5951 parent::__construct( $me );
6052 $this->errors = $this->getPossibleErrors();
61 - $this->setFormClass();
6253 }
6354
6455 /**
@@ -314,63 +305,29 @@
315306 global $wgOut;
316307
317308 $form_class = $this->getFormClass();
318 - $form_obj = new $form_class( $this->adapter, $error );
319 - $form = $form_obj->getForm();
320 - $wgOut->addHTML( $form );
321 - }
322 -
323 - /**
324 - * Set the form class to use to generate the CC form
325 - *
326 - * @param string $class_name The class name of the form to use
327 - */
328 - public function setFormClass( $class_name = NULL ) {
329 - if ( !$class_name ) {
330 - //TODO: This is the sort of thing we really ought to be handled in
331 - //DonationData instead of all the way out here.
332 - $defaultForm = $this->adapter->getGlobal( 'DefaultForm' );
333 - $form_class = $this->adapter->getData_Unstaged_Escaped( 'form_name' );
334 - if ( is_null( $form_class ) ){
335 - $form_class = $defaultForm;
336 - }
337 -
338 - // make sure our form class exists before going on, if not try loading default form class
339 - $class_name = "Gateway_Form_" . $form_class;
340 - if ( !class_exists( $class_name ) ) {
341 - $class_name_orig = $class_name;
342 - $class_name = "Gateway_Form_" . $defaultForm;
343 - if ( !class_exists( $class_name ) ) {
344 - throw new MWException( 'Could not load form ' . $class_name_orig . ' nor default form ' . $class_name );
345 - }
346 - }
 309+ if ( $form_class && class_exists( $form_class ) ){
 310+ $form_obj = new $form_class( $this->adapter, $error );
 311+ $form = $form_obj->getForm();
 312+ $wgOut->addHTML( $form );
 313+ } else {
 314+ throw new MWException( 'No valid form to load.' );
347315 }
348 - $this->form_class = $class_name;
349 -
350 - //...this is just dumb now.
351 - //TODO: Check who's using this get/set combo, and maybe nuke it all.
352 - $this->adapter->setFormClass( $class_name );
353316 }
354317
355318 /**
356319 * Get the currently set form class
357 - *
358 - * Will set the form class if the form class not already set
359 - * Using logic in setFormClass()
360 - * @return string
 320+ * @return mixed string containing the valid and enabled form class, otherwise false.
361321 */
362322 public function getFormClass() {
363 - if ( !isset( $this->form_class ) ) {
364 - $this->setFormClass();
365 - }
366 - return $this->form_class;
 323+ return $this->adapter->getFormClass();
367324 }
368325
369326 /**
370 - * Get the currently set form class
 327+ * displayResultsForDebug
371328 *
372 - * Will set the form class if the form class not already set
373 - * Using logic in setFormClass()
374 - * @return string
 329+ * Displays useful information for debugging purposes.
 330+ * Enable with $wgDonationInterfaceDisplayDebug, or the adapter equivalent.
 331+ * @return null
375332 */
376333 protected function displayResultsForDebug( $results = array() ) {
377334 global $wgOut;

Follow-up revisions

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

Status & tagging log