r103775 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103774‎ | r103775 | r103776 >
Date:19:06, 20 November 2011
Author:reedy
Status:ok
Tags:
Comment:
Fix missing $wgScript

Fix a load of whitespace
Modified paths:
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
@@ -27,7 +27,7 @@
2828 */
2929 public function __construct() {
3030 $this->adapter = new GlobalCollectAdapter();
31 - parent::__construct(); //the next layer up will know who we are.
 31+ parent::__construct(); //the next layer up will know who we are.
3232 }
3333
3434 /**
@@ -79,20 +79,20 @@
8080 $this->paypalRedirect();
8181 return;
8282 }
83 -
8483
 84+
8585 // dispatch forms/handling
86 - if ( $this->adapter->checkTokens() ) {
 86+ if ( $this->adapter->checkTokens() ) {
8787
8888 if ( $this->adapter->posted ) {
89 -
 89+
9090 // The form was submitted and the payment method has been set
9191 $payment_method = $this->adapter->getPaymentMethod();
9292 $payment_submethod = $this->adapter->getPaymentSubmethod();
9393
9494 // Check form for errors
9595 $form_errors = $this->validateForm( $this->errors, $this->adapter->getPaymentSubmethodFormValidation() );
96 -
 96+
9797 // If there were errors, redisplay form, otherwise proceed to next step
9898 if ( $form_errors ) {
9999
@@ -104,25 +104,23 @@
105105 if ( $payment_method == 'cc' ) {
106106
107107 $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
108 -
 108+
109109 // Display an iframe for credit cards
110110 if ( $this->executeIframeForCreditCard() ) {
111111 $this->displayResultsForDebug();
112112 // Nothing left to process
113113 return;
114114 }
115 - }
116 - elseif ( $payment_method == 'bt' ) {
 115+ } elseif ( $payment_method == 'bt' ) {
117116
118117 $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
119118
120119 if ( in_array( $this->adapter->getTransactionWMFStatus(), $this->adapter->getGoToThankYouOn() ) ) {
121 -
 120+
122121 return $this->displayBankTransferInformation();
123122 }
124123
125 - }
126 - elseif ( $payment_method == 'dd' ) {
 124+ } elseif ( $payment_method == 'dd' ) {
127125
128126 $this->adapter->do_transaction( 'DO_BANKVALIDATION' );
129127
@@ -136,51 +134,47 @@
137135 // Attach the error messages to the form
138136 $this->adapter->setBankValidationErrors();
139137 }
140 - }
141 - elseif ( $payment_method == 'ew' ) {
 138+ } elseif ( $payment_method == 'ew' ) {
142139
143140 $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
144141
145142 $formAction = $this->adapter->getTransactionDataFormAction();
146 -
 143+
147144 // Redirect to the bank
148145 if ( !empty( $formAction ) ) {
149146 return $wgOut->redirect( $formAction );
150147 }
151148
152 - }
153 - elseif ( $payment_method == 'obt' ) {
 149+ } elseif ( $payment_method == 'obt' ) {
154150
155151 $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
156152
157153 if ( in_array( $this->adapter->getTransactionWMFStatus(), $this->adapter->getGoToThankYouOn() ) ) {
158 -
 154+
159155 return $this->displayOnlineBankTransferInformation();
160156 }
161157
162 - }
163 - elseif ( $payment_method == 'rtbt' ) {
 158+ } elseif ( $payment_method == 'rtbt' ) {
164159
165160 $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
166161
167162 $formAction = $this->adapter->getTransactionDataFormAction();
168 -
 163+
169164 // Redirect to the bank
170165 if ( !empty( $formAction ) ) {
171166 return $wgOut->redirect( $formAction );
172167 }
173168
174 - }
175 - else {
 169+ } else {
176170 $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
177171 }
178 -
 172+
179173 return $this->resultHandler();
180174
181175 }
182176 } else {
183177 // Display form
184 -
 178+
185179 // See GlobalCollectAdapter::stage_returnto()
186180 $oid = $wgRequest->getText( 'order_id' );
187181 if ( $oid ) {
@@ -188,15 +182,15 @@
189183 $this->displayResultsForDebug();
190184 }
191185
192 - //TODO: Get rid of $data out here completely, by putting this logic inside the adapter somewhere.
193 - //All we seem to be doing with it now, is internal adapter logic outside of the adapter.
 186+ //TODO: Get rid of $data out here completely, by putting this logic inside the adapter somewhere.
 187+ //All we seem to be doing with it now, is internal adapter logic outside of the adapter.
194188 $data = $this->adapter->getData_Raw();
195 -
 189+
196190 // If the result of the previous transaction was failure, set the retry message.
197191 if ( $data && array_key_exists( 'response', $data ) && $data['response'] == 'failure' ) {
198192 $this->errors['retryMsg'] = wfMsg( 'php-response-declined' );
199193 }
200 -
 194+
201195 $this->displayForm( $this->errors );
202196 }
203197 } else { //token mismatch
@@ -215,7 +209,7 @@
216210 global $wgOut;
217211
218212 $formAction = $this->adapter->getTransactionDataFormAction();
219 -
 213+
220214 if ( $formAction ) {
221215
222216 $paymentFrame = Xml::openElement( 'iframe', array(
@@ -231,7 +225,7 @@
232226 $paymentFrame .= Xml::closeElement( 'iframe' );
233227
234228 $wgOut->addHTML( $paymentFrame );
235 -
 229+
236230 return true;
237231 }
238232
@@ -259,23 +253,23 @@
260254 'SWIFTCODE' => array('translation' => 'donate_interface-bt-swift_code', ),
261255 'SPECIALID' => array('translation' => 'donate_interface-bt-special_id', ),
262256 );
263 -
 257+
264258 $id = 'bank_transfer_information';
265 -
 259+
266260 $return .= Xml::openElement( 'div', array( 'id' => $id ) ); // $id
267261
268262 $return .= Xml::tags( 'h2', array(), wfMsg( 'donate_interface-bt-information' ) );
269 -
 263+
270264 $return .= Xml::openElement( 'table', array( 'id' => $id . '_table' ) );
271265
272266 foreach ( $fields as $field => $meta ) {
273 -
 267+
274268 if ( isset( $results['data'][ $field ] ) ) {
275269 $return .= Xml::openElement( 'tr', array() );
276 -
 270+
277271 $return .= Xml::tags( 'th', array(), wfMsg( $meta['translation'] ) );
278272 $return .= Xml::tags( 'td', array(), $results['data'][ $field ] );
279 -
 273+
280274 $return .= Xml::closeElement( 'tr' );
281275 }
282276 }
@@ -287,13 +281,13 @@
288282 $queryString = '?payment_method=' . $this->adapter->getPaymentMethod() . '&payment_submethod=' . $this->adapter->getPaymentSubmethod();
289283
290284 $url = $this->adapter->getThankYouPage() . $queryString;
291 -
 285+
292286 $link = HTML::input('MyButton', 'finished', 'button', array( 'onclick' => "window.location = '$url'" ) );
293 -
 287+
294288 $return .= Xml::tags( 'p', array(), $link );
295 -
 289+
296290 $return .= Xml::closeElement( 'div' ); // $id
297 -
 291+
298292 return $wgOut->addHTML( $return );
299293 }
300294
@@ -302,7 +296,7 @@
303297 */
304298 protected function displayOnlineBankTransferInformation() {
305299
306 - global $wgOut;
 300+ global $wgOut, $wgScriptPath;
307301
308302 $results = $this->adapter->getTransactionAllResults();
309303
@@ -311,23 +305,23 @@
312306 'CUSTOMERPAYMENTREFERENCE' => array('translation' => 'donate_interface-obt-customer_payment_reference', ),
313307 'BILLERID' => array('translation' => 'donate_interface-obt-biller_id', ),
314308 );
315 -
 309+
316310 $id = 'bank_transfer_information';
317 -
 311+
318312 $return .= Xml::openElement( 'div', array( 'id' => $id ) ); // $id
319313
320314 $return .= Xml::tags( 'h2', array(), wfMsg( 'donate_interface-obt-information' ) );
321 -
 315+
322316 $return .= Xml::openElement( 'table', array( 'id' => $id . '_table' ) );
323317
324318 foreach ( $fields as $field => $meta ) {
325 -
 319+
326320 if ( isset( $results['data'][ $field ] ) ) {
327321 $return .= Xml::openElement( 'tr', array() );
328 -
 322+
329323 $return .= Xml::tags( 'th', array(), wfMsg( $meta['translation'] ) );
330324 $return .= Xml::tags( 'td', array(), $results['data'][ $field ] );
331 -
 325+
332326 $return .= Xml::closeElement( 'tr' );
333327 }
334328 }
@@ -379,11 +373,11 @@
380374 $url = $this->adapter->getThankYouPage() . $queryString;
381375
382376 $link = HTML::input('MyButton', 'finished', 'button', array( 'onclick' => "window.location = '$url'" ) );
383 -
 377+
384378 $return .= Xml::tags( 'p', array(), $link );
385 -
 379+
386380 $return .= Xml::closeElement( 'div' ); // $id
387 -
 381+
388382 return $wgOut->addHTML( $return );
389383 }
390384

Follow-up revisions

RevisionCommit summaryAuthorDate
r103847MFT r102338, r102681, r102685, r102810, r102828, r102829, r102832, r102836, r...khorn22:30, 21 November 2011
r103848MFT r102338, r102681, r102685, r102810, r102828, r102829, r102832, r102836, r...khorn22:31, 21 November 2011

Status & tagging log