r59235 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59234‎ | r59235 | r59236 >
Date:04:11, 19 November 2009
Author:tomasz
Status:ok
Tags:
Comment:
Adding uniform input fields, styling and removing debugging info
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -16,11 +16,17 @@
1717 * @param $par Mixed: parameter passed to the page or null
1818 */
1919 public function execute( $par ) {
20 - global $wgRequest, $wgOut, $wgUser, $wgScriptPath;
 20+ global $wgRequest, $wgOut, $wgUser, $wgScriptPath, $wgPayFlowProGatewayCSSVersion;
2121
2222 $this->setHeaders();
2323
24 - $wgOut->addHeadItem( 'validatescript', '<script type="text/javascript" language="javascript" src="' . $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/validate_input.js"></script>' );
 24+ $wgOut->addHeadItem( 'validatescript', '<script type="text/javascript" language="javascript" src="' .
 25+ $wgScriptPath .
 26+ '/extensions/DonationInterface/payflowpro_gateway/validate_input.js"></script>' );
 27+
 28+ $wgOut->addExtensionStyle(
 29+ "{$wgScriptPath}/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.css?" .
 30+ $wgPayFlowProGatewayCSSVersion);
2531
2632 $scriptVars = array(
2733 'payflowproGatewayErrorMsgJs' => wfMsg( 'payflowpro_gateway-error-msg-js' ),
@@ -246,7 +252,6 @@
247253 $form = Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) ) .
248254 Xml::openElement( 'div', array( 'id' => 'mw-creditcard-intro' ) ) .
249255 Xml::tags( 'p', array( 'class' => 'mw-creditcard-intro-msg' ), wfMsg( 'payflowpro_gateway-form-message' ) ) .
250 - Xml::tags( 'p', array( 'class' => 'mw-creditcard-intro-msg' ), wfMsg( 'payflowpro_gateway-form-message-2' ) ) .
251256 Xml::closeElement( 'div' );
252257
253258 // open form
@@ -254,12 +259,12 @@
255260 Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => '', 'onsubmit' => 'return validate_form(this)' ) );
256261
257262 // donor amount and name
258 - $form .= Xml::openElement( 'table', array( 'id' => 'payflow_table' ) ).
 263+ $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ).
259264 '<tr><td style="text-align:right;">' .
260265 Xml::label(wfMsg( 'payflowpro_gateway-amount-legend' ), 'amount', array( 'maxlength' => '10' ) ) .
261266 $endCell .
262267 Xml::input( 'amount', '7', $data['amount'], array( 'id' => 'amount' ) ) .
263 - '<span class="creditcard_error_msg">' . ' ' . $error['invalidamount'] . '</span>' .
 268+ '<span class="creditcard-error-msg">' . ' ' . $error['invalidamount'] . '</span>' .
264269 $endRow .
265270 Xml::label( wfMsg( 'payflowpro_gateway-donor-currency-label' ), 'currency_code' ) .
266271 $endCell .
@@ -270,21 +275,21 @@
271276 Xml::label( wfMsg( 'payflowpro_gateway-donor-email' ), 'emailAdd' ) .
272277 $endCell .
273278 Xml::input( 'emailAdd', '30', $data['email'], array( 'maxlength' => '64', 'id' => 'emailAdd' ) ) .
274 - '<span class="creditcard_error_msg">' . ' ' . $error['emailAdd'] . '</span>' .
 279+ '<span class="creditcard-error-msg">' . ' ' . $error['emailAdd'] . '</span>' .
275280 $endRow .
276281 Xml::label( wfMsg( 'payflowpro_gateway-donor-fname' ), 'fname' ) .
277282 $endCell .
278 - Xml::input( 'fname', '20', $data['fname'], array( 'maxlength' => '15', 'class' => 'required', 'id' => 'fname' ) ) .
279 - '<span class="creditcard_error_msg">' . ' ' . $error['fname'] . '</span>' .
 283+ Xml::input( 'fname', '30', $data['fname'], array( 'maxlength' => '15', 'class' => 'required', 'id' => 'fname' ) ) .
 284+ '<span class="creditcard-error-msg">' . ' ' . $error['fname'] . '</span>' .
280285 $endRow .
281286 Xml::label( wfMsg( 'payflowpro_gateway-donor-mname' ), 'mname' ) .
282287 $endCell .
283 - Xml::input( 'mname', '20', $data['mname'], array( 'maxlength' => '15', 'id' => 'mname' ) ) .
 288+ Xml::input( 'mname', '30', $data['mname'], array( 'maxlength' => '15', 'id' => 'mname' ) ) .
284289 $endRow .
285290 Xml::label( wfMsg( 'payflowpro_gateway-donor-lname' ), 'lname' ) .
286291 $endCell .
287 - Xml::input( 'lname', '20', $data['lname'], array( 'maxlength' => '15', 'id' => 'lname' ) ) .
288 - '<span class="creditcard_error_msg">' . ' ' . $error['lname'] . '</span>' .
 292+ Xml::input( 'lname', '30', $data['lname'], array( 'maxlength' => '15', 'id' => 'lname' ) ) .
 293+ '<span class="creditcard-error-msg">' . ' ' . $error['lname'] . '</span>' .
289294 $endRow;
290295
291296 //donor address
@@ -293,35 +298,35 @@
294299 Xml::openElement( 'select', array( 'name' => 'country', 'id' => 'country', 'onchange' => 'return disableStates( this )' ) ) .
295300 $countryMenu .
296301 Xml::closeElement( 'select' ) .
297 - '<span class="creditcard_error_msg">' . ' ' . $error['country'] . '</span>' .
 302+ '<span class="creditcard-error-msg">' . ' ' . $error['country'] . '</span>' .
298303 $endRow .
299304 Xml::label( wfMsg( 'payflowpro_gateway-donor-street' ), 'street' ) .
300305 $endCell .
301306 Xml::input( 'street', '30', $data['street'], array( 'maxlength' => '30', 'id' => 'street' ) ) .
302 - '<span class="creditcard_error_msg">' . ' ' . $error['street'] . '</span>' .
 307+ '<span class="creditcard-error-msg">' . ' ' . $error['street'] . '</span>' .
303308 $endRow .
304309 Xml::label( wfMsg( 'payflowpro_gateway-donor-city' ), 'city' ) .
305310 $endCell .
306 - Xml::input( 'city', '20', $data['city'], array( 'maxlength' => '20', 'id' => 'city' ) ) .
307 - '<span class="creditcard_error_msg">' . ' ' . $error['city'] . '</span>' .
 311+ Xml::input( 'city', '30', $data['city'], array( 'maxlength' => '20', 'id' => 'city' ) ) .
 312+ '<span class="creditcard-error-msg">' . ' ' . $error['city'] . '</span>' .
308313 $endRow .
309314 Xml::label( wfMsg( 'payflowpro_gateway-donor-state' ), 'state' ) .
310315 $endCell .
311316 Xml::openElement( 'select', array( 'name' => 'state', 'id' => 'state' ) ) .
312317 $stateMenu .
313318 Xml::closeElement( 'select' ) .
314 - '<span class="creditcard_error_msg">' . ' ' . $error['state'] . '</span>' .
 319+ '<span class="creditcard-error-msg">' . ' ' . $error['state'] . '</span>' .
315320 $endRow .
316321 Xml::label( wfMsg( 'payflowpro_gateway-donor-postal' ), 'zip' ) .
317322 $endCell .
318 - Xml::input( 'zip', '15', $data['zip'], array( 'maxlength' => '9', 'id' => 'zip' ) ) .
319 - '<span class="creditcard_error_msg">' . ' ' . $error['zip'] . '</span>' .
 323+ Xml::input( 'zip', '30', $data['zip'], array( 'maxlength' => '9', 'id' => 'zip' ) ) .
 324+ '<span class="creditcard-error-msg">' . ' ' . $error['zip'] . '</span>' .
320325 '</td></tr>' .
321326 Xml::closeElement( 'table' ) .
322327 '<br />';
323328
324329 // credit card info
325 - $form .= Xml::openElement( 'table', array( 'id' => 'payflow_table' ) ).
 330+ $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) ).
326331 '<tr><td style="text-align:right;">' .
327332 Xml::label( wfMsg( 'payflowpro_gateway-donor-card' ), 'card' ) .
328333 $endCell .
@@ -332,9 +337,9 @@
333338 Xml::label( wfMsg( 'payflowpro_gateway-donor-card-num' ), 'card_num' ) .
334339 $endCell .
335340 Xml::input( 'card_num', '30', '', array( 'maxlength' => '100', 'id' => 'card_num' ) ) .
336 - '<span class="creditcard_error_msg">' . ' ' . $error['card_num'] . '</span>' .
 341+ '<span class="creditcard-error-msg">' . ' ' . $error['card_num'] . '</span>' .
337342 '</tr><tr><td></td><td>' .
338 - '<span class="creditcard_error_msg">' . ' ' . $error['card'] . '</span>' .
 343+ '<span class="creditcard-error-msg">' . ' ' . $error['card'] . '</span>' .
339344 $endRow .
340345 Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) .
341346 $endCell .
@@ -349,7 +354,7 @@
350355 $endCell .
351356 Xml::input( 'cvv', '5', '', array( 'maxlength' => '10', 'id' => 'cvv' ) ) .
352357 '<a href="javascript:PopupCVV();">' . wfMsg( 'word-separator' ) . wfMsg( 'payflowpro_gateway-cvv-link' ) . '</a>' .
353 - '<span class="creditcard_error_msg">' . ' ' . $error['cvv'] . '</span>' .
 358+ '<span class="creditcard-error-msg">' . ' ' . $error['cvv'] . '</span>' .
354359 '</td></tr>' .
355360 Xml::closeElement( 'table' );
356361
@@ -370,13 +375,19 @@
371376 Xml::hidden( 'numAttempt', $data['numAttempt'] );
372377
373378 // submit button and close form
374 - $form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' ) ) .
 379+ $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage' ) ) .
 380+ wfMsg( 'payflowpro_gatewa-donate-click' ) .
 381+ Xml::tags( 'div', array( 'id' => 'mw-donate-submit-button' ),
 382+ Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' ) ) ) .
 383+ Xml::tags( 'p', array( 'class' => '' ),
 384+ wfMsg( 'payflowpro_gateway-credit-storage-processing' ) ) .
 385+ Xml::tags( 'p', array( 'class' => ''),
 386+ wfMsg( 'payflowpro_gateway-question-comment' ) ) .
375387 Xml::closeElement( 'form' ) .
 388+ Xml::closeElement( 'div' ) .
376389 Xml::closeElement( 'div' );
377390
378 - $form .= Xml::closeElement( 'div' ) .
379 - Xml::Element( 'p', array( 'class' => 'mw-creditcard-submessage' ),
380 - wfMsg( 'payflowpro_gateway-donor-currency-msg', $data['currency'] ) );
 391+ $form .= Xml::closeElement( 'div' );
381392
382393 // Theming
383394 global $wgDonationInterfaceTomasSkin;
@@ -568,8 +579,7 @@
569580 $headers[] = 'X-VPS-Request-ID:' . $payflow_data['order_id'];
570581 $ch = curl_init();
571582 $paypalPostTo = isset ( $wgDonationTestingMode ) ? 'testingurl' : 'paypalurl';
572 - //curl_setopt( $ch, CURLOPT_URL, $payflow_data[ $paypalPostTo ] );
573 - curl_setopt($ch, CURLOPT_URL, $payflow_data['testingurl']);
 583+ curl_setopt( $ch, CURLOPT_URL, $payflow_data[ $paypalPostTo ] );
574584 curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
575585 curl_setopt( $ch, CURLOPT_USERAGENT, $user_agent );
576586 curl_setopt( $ch, CURLOPT_HEADER, 1 );
@@ -780,9 +790,8 @@
781791 //enable if we need this to get the Civi data to display correctly
782792 $transaction['optout'] = ($transaction['optout'] == "1") ? '0' : '1';
783793 $transaction['anonymous'] = ($transaction['anonymous'] == "1") ? '0' : '1';
784 - var_dump($transaction);
785794 // hook to call stomp functions
786 - //wfRunHooks( 'gwStomp', array( &$transaction ) );
 795+ wfRunHooks( 'gwStomp', array( &$transaction ) );
787796 }
788797
789798 /**
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php
@@ -88,6 +88,9 @@
8989 <h4>American Express</h4>
9090 <p>The code is ALWAYS located ABOVE the embossed (raised) account number on the face of the card.
9191 In some instances, the code is located on the left side of the card, but is always above the account number.</p><br />',
 92+ 'payflowpro_gateway-question-comment' => 'Wikipedia is a project of the Wikimedia Foundation. Questions or comments? Contact the Wikimedia Foundation: <a href="mailto:donate@wikimedia.org">donate@wikimedia.org</a>',
 93+ 'payflowpro_gatewa-donate-click' => 'After clicking "Donate", your credit card information will be processed.',
 94+ 'payflowpro_gateway-credit-storage-processing' => 'We do not store your credit card information, and your personal data is subject to our <a href="http://wikimediafoundation.org/wiki/Wikimedia:Privacy_policy">privacy policy</a>',
9295 'donate_interface-GBP' => 'GBP: British Pound',
9396 'donate_interface-EUR' => 'EUR: Euro',
9497 'donate_interface-USD' => 'USD: U.S. Dollar',
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php
@@ -30,6 +30,8 @@
3131 $wgPayflowProURL = 'https://payflowpro.paypal.com';
3232 $wgPayflowProTestingURL = 'https://pilot-payflowpro.paypal.com'; // Payflow testing URL
3333
 34+$wgPayFlowProGatewayCSSVersion = 1;
 35+
3436 $wgPayflowProPartnerID = ''; //PayPal or original authorized reseller
3537 $wgPayflowProVendorID = ''; // paypal merchant login ID
3638 $wgPayflowProUserID = ''; //if one or more users are set up, authorized user ID, else same as VENDOR

Status & tagging log