Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter2.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | class PayflowProGateway_Form_TwoColumnLetter2 extends PayflowProGateway_Form_OneStepTwoColumn { |
5 | 5 | public $paypal = false; // true for paypal only version |
6 | 6 | |
7 | | - public function __construct( &$form_data, &$form_errors ) { |
| 7 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
8 | 8 | global $wgScriptPath; |
9 | 9 | |
10 | 10 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter.css' ); |
13 | 13 | } |
14 | 14 | |
15 | | - parent::__construct( $form_data, $form_errors ); |
| 15 | + parent::__construct( $form_data, $form_errors, $gateway ); |
16 | 16 | } |
17 | 17 | |
18 | 18 | public function generateFormStart() { |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | } |
84 | 84 | |
85 | 85 | protected function generateBillingFields() { |
86 | | - global $wgScriptPath, $wgPayflowGatewayPaypalURL, $wgRequest; |
| 86 | + global $wgScriptPath, $wgRequest; |
87 | 87 | $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
88 | 88 | |
89 | 89 | $form = ''; |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | if ( !$this->paypal ) { |
109 | 109 | // PayPal button |
110 | 110 | // make sure we have a paypal url set to redirect the user to before displaying the button |
111 | | - if ( strlen( $wgPayflowGatewayPaypalURL ) ) { |
| 111 | + if ( strlen( $this->gateway->getGlobal( "PaypalURL" ) ) ) { |
112 | 112 | $form .= '<tr>'; |
113 | 113 | $form .= '<td class="label"></td>'; |
114 | 114 | $form .= '<td>'; |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepAmount.php |
— | — | @@ -0,0 +1,262 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Wikimedia Foundation |
| 5 | + * |
| 6 | + * LICENSE |
| 7 | + * |
| 8 | + * This program is free software; you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License as published by |
| 10 | + * the Free Software Foundation; either version 2 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU General Public License for more details. |
| 17 | + * |
| 18 | + * @since r98249 |
| 19 | + * @author Jeremy Postlethwaite <jpostlethwaite@wikimedia.org> |
| 20 | + */ |
| 21 | + |
| 22 | +/** |
| 23 | + * This form is designed for bank transfers |
| 24 | + */ |
| 25 | +class Gateway_Form_TwoStepAmount extends Gateway_Form { |
| 26 | + |
| 27 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
| 28 | + global $wgOut; |
| 29 | + |
| 30 | + $form_data['transaction_type'] = 'BANK_TRANSFER'; |
| 31 | + $form_data['process'] = 'BANK_TRANSFER'; |
| 32 | + parent::__construct( $form_data, $form_errors, $gateway ); |
| 33 | + |
| 34 | + // we only want to load this JS if the form is being rendered |
| 35 | + $this->loadValidateJs(); // validation JS |
| 36 | + |
| 37 | + $this->loadPlaceholders(); |
| 38 | + } |
| 39 | + |
| 40 | + public function loadPlaceholders() { |
| 41 | + global $wgOut; |
| 42 | + // form placeholder values |
| 43 | + $first = wfMsg( 'payflowpro_gateway-donor-fname' ); |
| 44 | + $last = wfMsg( 'payflowpro_gateway-donor-lname' ); |
| 45 | + $js = <<<EOT |
| 46 | +<script type="text/javascript"> |
| 47 | +function loadPlaceholders() { |
| 48 | + var fname = document.getElementById('fname'); |
| 49 | + var lname = document.getElementById('lname'); |
| 50 | + var amountOther = document.getElementById('amountOther'); |
| 51 | + if (fname.value == '') { |
| 52 | + fname.style.color = '#999999'; |
| 53 | + fname.value = '$first'; |
| 54 | + } |
| 55 | + if (lname.value == '') { |
| 56 | + lname.style.color = '#999999'; |
| 57 | + lname.value = '$last'; |
| 58 | + } |
| 59 | +} |
| 60 | +addEvent( window, 'load', loadPlaceholders ); |
| 61 | + |
| 62 | +function formCheck( ccform ) { |
| 63 | + var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'Zip' ]; |
| 64 | + |
| 65 | + var fields = ["emailAdd","fname","lname","street","city","zip" ], |
| 66 | + numFields = fields.length, |
| 67 | + i, |
| 68 | + output = '', |
| 69 | + currField = ''; |
| 70 | + |
| 71 | + for( i = 0; i < numFields; i++ ) { |
| 72 | + if( document.getElementById( fields[i] ).value == '' ) { |
| 73 | + currField = window['payflowproGatewayErrorMsg'+ msg[i]]; |
| 74 | + output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\\r\\n'; |
| 75 | + } |
| 76 | + } |
| 77 | + |
| 78 | + if (document.getElementById('fname').value == '$first') { |
| 79 | + output += payflowproGatewayErrorMsgJs + ' first name.\\r\\n'; |
| 80 | + } |
| 81 | + if (document.getElementById('lname').value == '$last') { |
| 82 | + output += payflowproGatewayErrorMsgJs + ' last name.\\r\\n'; |
| 83 | + } |
| 84 | + var countryField = document.getElementById( 'country' ); |
| 85 | + if( countryField.options[countryField.selectedIndex].value == '' ) { |
| 86 | + output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsgCountry'] + '.\\r\\n'; |
| 87 | + } |
| 88 | + |
| 89 | + // validate email address |
| 90 | + var apos = document.payment.emailAdd.value.indexOf("@"); |
| 91 | + var dotpos = document.payment.emailAdd.value.lastIndexOf("."); |
| 92 | + |
| 93 | + if( apos < 1 || dotpos-apos < 2 ) { |
| 94 | + output += payflowproGatewayErrorMsgEmail; |
| 95 | + } |
| 96 | + |
| 97 | + if( output ) { |
| 98 | + alert( output ); |
| 99 | + return false; |
| 100 | + } else { |
| 101 | + return true; |
| 102 | + } |
| 103 | +} |
| 104 | +</script> |
| 105 | +EOT; |
| 106 | + $wgOut->addHeadItem( 'placeholders', $js ); |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * Required method for constructing the entire form |
| 111 | + * |
| 112 | + * This can of course be overloaded by a child class. |
| 113 | + * @return string The entire form HTML |
| 114 | + */ |
| 115 | + public function getForm() { |
| 116 | + $form = $this->generateFormStart(); |
| 117 | + $form .= $this->getCaptchaHTML(); |
| 118 | + $form .= $this->generateFormEnd(); |
| 119 | + return $form; |
| 120 | + } |
| 121 | + |
| 122 | + public function generateFormStart() { |
| 123 | + $form = $this->generateBannerHeader(); |
| 124 | + |
| 125 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) ); |
| 126 | + |
| 127 | + // provide a place at the top of the form for displaying general messages |
| 128 | + if ( $this->form_errors['general'] ) { |
| 129 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) ); |
| 130 | + if ( is_array( $this->form_errors['general'] ) ) { |
| 131 | + foreach ( $this->form_errors['general'] as $this->form_errors_msg ) { |
| 132 | + $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg ); |
| 133 | + } |
| 134 | + } else { |
| 135 | + $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg ); |
| 136 | + } |
| 137 | + $form .= Xml::closeElement( 'div' ); |
| 138 | + } |
| 139 | + |
| 140 | + // add noscript tags for javascript disabled browsers |
| 141 | + $form .= $this->getNoScript(); |
| 142 | + |
| 143 | + // open form |
| 144 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-creditcard-form' ) ); |
| 145 | + |
| 146 | + // Xml::element seems to convert html to htmlentities |
| 147 | + $form .= "<p class='creditcard-error-msg'>" . $this->form_errors['retryMsg'] . "</p>"; |
| 148 | + $form .= Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => $this->getNoCacheAction(), 'onsubmit' => 'return formCheck(this)', 'autocomplete' => 'off' ) ); |
| 149 | + |
| 150 | + $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section' ) ); |
| 151 | + $form .= $this->generatePersonalContainer(); |
| 152 | + $form .= $this->generatePaymentContainer(); |
| 153 | + $form .= $this->generateFormSubmit(); |
| 154 | + $form .= Xml::closeElement( 'div' ); // close div#left-column |
| 155 | + |
| 156 | + //$form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' ) ); |
| 157 | + |
| 158 | + return $form; |
| 159 | + } |
| 160 | + |
| 161 | + public function generateFormSubmit() { |
| 162 | + // submit button |
| 163 | + $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
| 164 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) ); |
| 165 | + // $form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' )); |
| 166 | + $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button' ), 'type' => 'submit' ) ); |
| 167 | + $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button |
| 168 | + $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
| 169 | + wfMsg( 'payflowpro_gateway-donate-click' ); |
| 170 | + $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-submessage |
| 171 | + $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-form-submit |
| 172 | + return $form; |
| 173 | + } |
| 174 | + |
| 175 | + public function generateFormEnd() { |
| 176 | + $form = ''; |
| 177 | + // add hidden fields |
| 178 | + $hidden_fields = $this->getHiddenFields(); |
| 179 | + foreach ( $hidden_fields as $field => $value ) { |
| 180 | + $form .= Html::hidden( $field, $value ); |
| 181 | + } |
| 182 | + |
| 183 | + $value = 'BANK_TRANSFER'; |
| 184 | + //$form .= Html::hidden( $field, $value ); |
| 185 | + //$form .= Xml::closeElement( 'div' ); // close div#right-column |
| 186 | + $form .= Xml::closeElement( 'form' ); |
| 187 | + $form .= Xml::closeElement( 'div' ); // close div#mw-creditcard-form |
| 188 | + $form .= $this->generateDonationFooter(); |
| 189 | + $form .= Xml::closeElement( 'div' ); // div#close mw-creditcard |
| 190 | + return $form; |
| 191 | + } |
| 192 | + |
| 193 | + protected function generatePersonalContainer() { |
| 194 | + $form = ''; |
| 195 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); ; |
| 196 | + //$form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-cc-form-header-personal' ) ); |
| 197 | + $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
| 198 | + |
| 199 | + $form .= $this->generatePersonalFields(); |
| 200 | + |
| 201 | + $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor |
| 202 | + $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-personal-info |
| 203 | + |
| 204 | + return $form; |
| 205 | + } |
| 206 | + |
| 207 | + protected function generatePersonalFields() { |
| 208 | + // first name |
| 209 | + $form = $this->getNameField(); |
| 210 | + |
| 211 | + // country |
| 212 | + $form .= $this->getCountryField(); |
| 213 | + |
| 214 | + // street |
| 215 | + $form .= $this->getStreetField(); |
| 216 | + |
| 217 | + |
| 218 | + // city |
| 219 | + $form .= $this->getCityField(); |
| 220 | + |
| 221 | + // state |
| 222 | + $form .= $this->getStateField(); |
| 223 | + |
| 224 | + // zip |
| 225 | + $form .= $this->getZipField(); |
| 226 | + |
| 227 | + // email |
| 228 | + $form .= $this->getEmailField(); |
| 229 | + |
| 230 | + return $form; |
| 231 | + } |
| 232 | + |
| 233 | + protected function generatePaymentContainer() { |
| 234 | + $form = ''; |
| 235 | + // credit card info |
| 236 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-payment-info' ) ); |
| 237 | + //$form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-payment' ), wfMsg( 'payflowpro_gateway-cc-form-header-payment' ) ); |
| 238 | + $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) ); |
| 239 | + |
| 240 | + $form .= $this->generatePaymentFields(); |
| 241 | + |
| 242 | + $form .= Xml::closeElement( 'table' ); // close table#payflow-table-cc |
| 243 | + $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-payment-info |
| 244 | + |
| 245 | + return $form; |
| 246 | + } |
| 247 | + |
| 248 | + protected function generatePaymentFields() { |
| 249 | + global $wgScriptPath; |
| 250 | + |
| 251 | + // amount |
| 252 | + $form = '<tr>'; |
| 253 | + $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>'; |
| 254 | + $form .= '</tr>'; |
| 255 | + $form .= '<tr>'; |
| 256 | + $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount' ) . '</td>'; |
| 257 | + $form .= '<td>' . Xml::input( 'amount', '7', $this->form_data['amount'], array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) . |
| 258 | + ' ' . $this->generateCurrencyDropdown() . '</td>'; |
| 259 | + $form .= '</tr>'; |
| 260 | + |
| 261 | + return $form; |
| 262 | + } |
| 263 | +} |
Property changes on: trunk/extensions/DonationInterface/gateway_forms/TwoStepAmount.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
1 | 264 | Merged /trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepAmount.php:r95445-96492 |
2 | 265 | Merged /branches/fundraising/extensions/DonationInterface/gateway_forms/TwoStepAmount.php:r95724-100157 |
Added: svn:eol-style |
3 | 266 | + native |
Added: svn:mime-type |
4 | 267 | + text/plain |
Added: svn:keywords |
5 | 268 | + Author Date HeadURL Header Id Revision |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter3.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | class PayflowProGateway_Form_TwoColumnLetter3 extends PayflowProGateway_Form_OneStepTwoColumn { |
5 | 5 | public $paypal = false; // true for paypal only version |
6 | 6 | |
7 | | - public function __construct( &$form_data, &$form_errors ) { |
| 7 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
8 | 8 | global $wgScriptPath; |
9 | 9 | |
10 | 10 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter.css' ); |
13 | 13 | } |
14 | 14 | |
15 | | - parent::__construct( $form_data, $form_errors ); |
| 15 | + parent::__construct( $form_data, $form_errors, $gateway ); |
16 | 16 | } |
17 | 17 | |
18 | 18 | public function generateFormStart() { |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | } |
84 | 84 | |
85 | 85 | protected function generateBillingFields() { |
86 | | - global $wgScriptPath, $wgPayflowGatewayPaypalURL, $wgRequest; |
| 86 | + global $wgScriptPath, $wgRequest; |
87 | 87 | $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
88 | 88 | |
89 | 89 | $form = ''; |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | if ( !$this->paypal ) { |
109 | 109 | // PayPal button |
110 | 110 | // make sure we have a paypal url set to redirect the user to before displaying the button |
111 | | - if ( strlen( $wgPayflowGatewayPaypalURL ) ) { |
| 111 | + if ( strlen( $this->gateway->getGlobal( "PaypalURL" ) ) ) { |
112 | 112 | $form .= '<tr>'; |
113 | 113 | $form .= '<td class="label"></td>'; |
114 | 114 | $form .= '<td>'; |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter4.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | class PayflowProGateway_Form_TwoColumnLetter4 extends PayflowProGateway_Form_OneStepTwoColumn { |
5 | 5 | public $paypal = false; // true for paypal only version |
6 | 6 | |
7 | | - public function __construct( &$form_data, &$form_errors ) { |
| 7 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
8 | 8 | global $wgScriptPath; |
9 | 9 | |
10 | 10 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter4.css' ); |
13 | 13 | } |
14 | 14 | |
15 | | - parent::__construct( $form_data, $form_errors ); |
| 15 | + parent::__construct( $form_data, $form_errors, $gateway ); |
16 | 16 | } |
17 | 17 | |
18 | 18 | public function generateFormStart() { |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | } |
84 | 84 | |
85 | 85 | protected function generateBillingFields() { |
86 | | - global $wgScriptPath, $wgPayflowGatewayPaypalURL, $wgRequest; |
| 86 | + global $wgScriptPath, $wgRequest; |
87 | 87 | $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
88 | 88 | |
89 | 89 | $form = ''; |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | if ( !$this->paypal ) { |
109 | 109 | // PayPal button |
110 | 110 | // make sure we have a paypal url set to redirect the user to before displaying the button |
111 | | - if ( strlen( $wgPayflowGatewayPaypalURL ) ) { |
| 111 | + if ( strlen( $this->gateway->getGlobal( "PaypalURL" ) ) ) { |
112 | 112 | $form .= '<tr>'; |
113 | 113 | $form .= '<td class="label"></td>'; |
114 | 114 | $form .= '<td>'; |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter5.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoColumnLetter5 extends PayflowProGateway_Form_OneStepTwoColumn { |
5 | 5 | |
6 | | - public function __construct( &$form_data, &$form_errors ) { |
| 6 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
7 | 7 | global $wgScriptPath; |
8 | 8 | |
9 | 9 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter5.css' ); |
12 | 12 | } |
13 | 13 | |
14 | | - parent::__construct( $form_data, $form_errors ); |
| 14 | + parent::__construct( $form_data, $form_errors, $gateway ); |
15 | 15 | } |
16 | 16 | |
17 | 17 | public function generateFormStart() { |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | } |
81 | 81 | |
82 | 82 | protected function generateBillingFields() { |
83 | | - global $wgScriptPath, $wgPayflowGatewayPaypalURL, $wgRequest; |
| 83 | + global $wgScriptPath, $wgRequest; |
84 | 84 | $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
85 | 85 | |
86 | 86 | $form = ''; |
— | — | @@ -136,11 +136,11 @@ |
137 | 137 | $form .= '<tr>'; |
138 | 138 | $form .= '<td class="label">' . wfMsg( 'payflowpro_gateway-payment-type' ) . '</td>'; |
139 | 139 | $form .= '<td>' . |
140 | | - Xml::radio( 'card', 'cc1', $this->form_data['card'] == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-visa.png" ) ). '</label>' . |
141 | | - Xml::radio( 'card', 'cc2', $this->form_data['card'] == 'cc2', array( 'id' => 'cc2radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc2radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-mastercard.png" ) ). '</label>' . |
142 | | - Xml::radio( 'card', 'cc3', $this->form_data['card'] == 'cc3', array( 'id' => 'cc3radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc3radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-amex.png" ) ). '</label>' . |
143 | | - Xml::radio( 'card', 'cc4', $this->form_data['card'] == 'cc4', array( 'id' => 'cc4radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc4radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-discover.png" ) ). '</label>' . |
144 | | - Xml::radio( 'card', 'pp', $this->form_data['card'] == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-paypal.png" ) ) . '</label>' . |
| 140 | + Xml::radio( 'card_type', 'cc1', $this->form_data['card_type'] == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-visa.png" ) ). '</label>' . |
| 141 | + Xml::radio( 'card_type', 'cc2', $this->form_data['card_type'] == 'cc2', array( 'id' => 'cc2radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc2radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-mastercard.png" ) ). '</label>' . |
| 142 | + Xml::radio( 'card_type', 'cc3', $this->form_data['card_type'] == 'cc3', array( 'id' => 'cc3radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc3radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-amex.png" ) ). '</label>' . |
| 143 | + Xml::radio( 'card_type', 'cc4', $this->form_data['card_type'] == 'cc4', array( 'id' => 'cc4radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc4radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-discover.png" ) ). '</label>' . |
| 144 | + Xml::radio( 'card_type', 'pp', $this->form_data['card_type'] == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-paypal.png" ) ) . '</label>' . |
145 | 145 | '</td>'; |
146 | 146 | $form .= '</tr>'; |
147 | 147 | |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter6.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoColumnLetter6 extends PayflowProGateway_Form_OneStepTwoColumn { |
5 | 5 | |
6 | | - public function __construct( &$form_data, &$form_errors ) { |
| 6 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
7 | 7 | global $wgScriptPath; |
8 | 8 | |
9 | 9 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter6.css' ); |
12 | 12 | } |
13 | 13 | |
14 | | - parent::__construct( $form_data, $form_errors ); |
| 14 | + parent::__construct( $form_data, $form_errors, $gateway ); |
15 | 15 | } |
16 | 16 | |
17 | 17 | public function generateFormStart() { |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | } |
81 | 81 | |
82 | 82 | protected function generateBillingFields() { |
83 | | - global $wgScriptPath, $wgPayflowGatewayPaypalURL, $wgRequest; |
| 83 | + global $wgScriptPath, $wgRequest; |
84 | 84 | $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
85 | 85 | |
86 | 86 | $form = ''; |
— | — | @@ -130,17 +130,17 @@ |
131 | 131 | $form .= '<tr>'; |
132 | 132 | $form .= '<td class="label">' . wfMsg( 'payflowpro_gateway-payment-type' ) . '</td>'; |
133 | 133 | $form .= '<td>' . |
134 | | - Xml::radio( 'card', 'cc1', $this->form_data['card'] == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-visa.png" ) ). '</label>' . |
135 | | - Xml::radio( 'card', 'cc2', $this->form_data['card'] == 'cc2', array( 'id' => 'cc2radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc2radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-mastercard.png" ) ). '</label>' . |
136 | | - Xml::radio( 'card', 'cc3', $this->form_data['card'] == 'cc3', array( 'id' => 'cc3radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc3radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-amex.png" ) ). '</label>' . |
137 | | - Xml::radio( 'card', 'cc4', $this->form_data['card'] == 'cc4', array( 'id' => 'cc4radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc4radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-discover.png" ) ). '</label>' . |
138 | | - Xml::radio( 'card', 'pp', $this->form_data['card'] == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-paypal.png" ) ) . '</label>' . |
| 134 | + Xml::radio( 'card_type', 'cc1', $this->form_data['card_type'] == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-visa.png" ) ). '</label>' . |
| 135 | + Xml::radio( 'card_type', 'cc2', $this->form_data['card_type'] == 'cc2', array( 'id' => 'cc2radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc2radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-mastercard.png" ) ). '</label>' . |
| 136 | + Xml::radio( 'card_type', 'cc3', $this->form_data['card_type'] == 'cc3', array( 'id' => 'cc3radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc3radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-amex.png" ) ). '</label>' . |
| 137 | + Xml::radio( 'card_type', 'cc4', $this->form_data['card_type'] == 'cc4', array( 'id' => 'cc4radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc4radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-discover.png" ) ). '</label>' . |
| 138 | + Xml::radio( 'card_type', 'pp', $this->form_data['card_type'] == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-paypal.png" ) ) . '</label>' . |
139 | 139 | '</td>'; |
140 | 140 | $form .= '</tr>'; |
141 | 141 | |
142 | 142 | $form .= '</table>'; |
143 | 143 | |
144 | | - if ( $this->form_data['card'] == 'cc1' || $this->form_data['card'] == 'cc2' || $this->form_data['card'] == 'cc3' || $this->form_data['card'] == 'cc4' ) { |
| 144 | + if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
145 | 145 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) ); |
146 | 146 | } else { |
147 | 147 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc', 'style' => 'display: none;' ) ); |
— | — | @@ -202,7 +202,7 @@ |
203 | 203 | public function generateFormSubmit() { |
204 | 204 | |
205 | 205 | // cc submit button |
206 | | - if ( $this->form_data['card'] == 'cc1' || $this->form_data['card'] == 'cc2' || $this->form_data['card'] == 'cc3' || $this->form_data['card'] == 'cc4' ) { |
| 206 | + if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
207 | 207 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
208 | 208 | } else { |
209 | 209 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit', 'style' => 'display: none;' ) ); |
— | — | @@ -216,7 +216,7 @@ |
217 | 217 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-form-submit |
218 | 218 | |
219 | 219 | // paypal submit button |
220 | | - if ( $this->form_data['card'] == 'cc1' || $this->form_data['card'] == 'cc2' || $this->form_data['card'] == 'cc3' || $this->form_data['card'] == 'cc4' ) { |
| 220 | + if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
221 | 221 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit-paypal', 'style' => 'display: none;' ) ); |
222 | 222 | } else { |
223 | 223 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit-paypal' ) ); |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetter.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoStepTwoColumnLetter extends PayflowProGateway_Form_TwoStepTwoColumn { |
5 | | - public function __construct( &$form_data, &$form_errors ) { |
| 5 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
6 | 6 | global $wgScriptPath; |
7 | 7 | |
8 | 8 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter.css' ); |
11 | 11 | } |
12 | 12 | |
13 | | - parent::__construct( $form_data, $form_errors ); |
| 13 | + parent::__construct( $form_data, $form_errors, $gateway ); |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function generateFormStart() { |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter7.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoColumnLetter7 extends PayflowProGateway_Form_OneStepTwoColumn { |
5 | 5 | |
6 | | - public function __construct( &$form_data, &$form_errors ) { |
| 6 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
7 | 7 | global $wgScriptPath; |
8 | 8 | |
9 | 9 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter7.css' ); |
12 | 12 | } |
13 | 13 | |
14 | | - parent::__construct( $form_data, $form_errors ); |
| 14 | + parent::__construct( $form_data, $form_errors, $gateway ); |
15 | 15 | } |
16 | 16 | |
17 | 17 | public function loadPlaceholders() { |
— | — | @@ -192,7 +192,7 @@ |
193 | 193 | } |
194 | 194 | |
195 | 195 | protected function generateBillingFields() { |
196 | | - global $wgScriptPath, $wgPayflowGatewayPaypalURL, $wgRequest; |
| 196 | + global $wgScriptPath, $wgRequest; |
197 | 197 | $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
198 | 198 | |
199 | 199 | $form = ''; |
— | — | @@ -249,20 +249,20 @@ |
250 | 250 | $form .= '<td class="label""><div style="padding-top:9px;">' . wfMsg( 'payflowpro_gateway-payment-type' ) . '</div></td>'; |
251 | 251 | $form .= '<td>' . |
252 | 252 | '<p style="border: 1px solid rgb(187, 187, 187); float: left; -moz-border-radius: 5px 5px 5px 5px; margin: 0 8px 0 0; padding: 5px 5px 5px 3px; white-space: nowrap;">'. |
253 | | - Xml::radio( 'card', 'cc1', $this->form_data['card'] == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-visa.png" ) ). '</label>' . |
| 253 | + Xml::radio( 'card_type', 'cc1', $this->form_data['card_type'] == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-visa.png" ) ). '</label>' . |
254 | 254 | ' <label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-mastercard.png" ) ). '</label>' . |
255 | 255 | ' <label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-amex.png" ) ). '</label>' . |
256 | 256 | ' <label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-discover.png" ) ). '</label>' . |
257 | 257 | '</p>'. |
258 | 258 | '<p style="border: 1px solid transparent; float: left; -moz-border-radius: 5px 5px 5px 5px; margin: 0; padding: 5px 5px 5px 3px; white-space: nowrap;">'. |
259 | | - Xml::radio( 'card', 'pp', $this->form_data['card'] == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-paypal.png" ) ) . '</label>' . |
| 259 | + Xml::radio( 'card_type', 'pp', $this->form_data['card_type'] == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-paypal.png" ) ) . '</label>' . |
260 | 260 | '</p>'. |
261 | 261 | '</td>'; |
262 | 262 | $form .= '</tr>'; |
263 | 263 | |
264 | 264 | $form .= '</table>'; |
265 | 265 | |
266 | | - if ( $this->form_data['card'] == 'cc1' || $this->form_data['card'] == 'cc2' || $this->form_data['card'] == 'cc3' || $this->form_data['card'] == 'cc4' ) { |
| 266 | + if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
267 | 267 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) ); |
268 | 268 | } else { |
269 | 269 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc', 'style' => 'display: none;' ) ); |
— | — | @@ -360,7 +360,7 @@ |
361 | 361 | global $wgScriptPath; |
362 | 362 | |
363 | 363 | // cc submit button |
364 | | - if ( $this->form_data['card'] == 'cc1' || $this->form_data['card'] == 'cc2' || $this->form_data['card'] == 'cc3' || $this->form_data['card'] == 'cc4' ) { |
| 364 | + if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
365 | 365 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
366 | 366 | } else { |
367 | 367 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit', 'style' => 'display: none;' ) ); |
— | — | @@ -374,7 +374,7 @@ |
375 | 375 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-form-submit |
376 | 376 | |
377 | 377 | // paypal submit button |
378 | | - if ( $this->form_data['card'] == 'cc1' || $this->form_data['card'] == 'cc2' || $this->form_data['card'] == 'cc3' || $this->form_data['card'] == 'cc4' ) { |
| 378 | + if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
379 | 379 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit-paypal', 'style' => 'display: none;' ) ); |
380 | 380 | } else { |
381 | 381 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit-paypal' ) ); |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnPayPal.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoColumnPayPal extends PayflowProGateway_Form_OneStepTwoColumn { |
5 | | - public function __construct( &$form_data, &$form_errors ) { |
6 | | - parent::__construct( $form_data, $form_errors ); |
| 5 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
| 6 | + parent::__construct( $form_data, $form_errors, $gateway ); |
7 | 7 | } |
8 | 8 | |
9 | 9 | public function generateFormStart() { |
— | — | @@ -58,7 +58,6 @@ |
59 | 59 | } |
60 | 60 | |
61 | 61 | protected function generatePersonalFields() { |
62 | | - global $wgPayflowGatewayPaypalURL; |
63 | 62 | $form = ''; |
64 | 63 | |
65 | 64 | // name |
— | — | @@ -83,7 +82,7 @@ |
84 | 83 | $form .= $this->getAmountField(); |
85 | 84 | |
86 | 85 | // PayPal button |
87 | | - if ( strlen( $wgPayflowGatewayPaypalURL ) ) { |
| 86 | + if ( strlen( $this->gateway->getGlobal( "PaypalURL" ) ) ) { |
88 | 87 | $form .= $this->getPaypalButton(); |
89 | 88 | } |
90 | 89 | |
Index: trunk/extensions/DonationInterface/gateway_forms/SingleColumn.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_SingleColumn extends PayflowProGateway_Form_TwoColumnLetter { |
5 | 5 | |
6 | | - public function __construct( &$form_data, &$form_errors ) { |
| 6 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
7 | 7 | global $wgScriptPath; |
8 | 8 | |
9 | 9 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/SingleColumn.css' ); |
12 | 12 | } |
13 | 13 | |
14 | | - parent::__construct( $form_data, $form_errors ); |
| 14 | + parent::__construct( $form_data, $form_errors, $gateway ); |
15 | 15 | } |
16 | 16 | |
17 | 17 | public function generateFormEnd() { |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetterCA.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoStepTwoColumnLetterCA extends PayflowProGateway_Form_TwoStepTwoColumn { |
5 | | - public function __construct( &$form_data, &$form_errors ) { |
| 5 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
6 | 6 | global $wgScriptPath; |
7 | 7 | |
8 | 8 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter.css' ); |
11 | 11 | } |
12 | 12 | |
13 | | - parent::__construct( $form_data, $form_errors ); |
| 13 | + parent::__construct( $form_data, $form_errors, $gateway ); |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function generateFormStart() { |
Index: trunk/extensions/DonationInterface/gateway_forms/Form.php |
— | — | @@ -49,12 +49,13 @@ |
50 | 50 | */ |
51 | 51 | abstract function getForm(); |
52 | 52 | |
53 | | - public function __construct( &$data, &$error ) { |
54 | | - global $wgPayflowGatewayTest, $wgOut; |
| 53 | + public function __construct( &$data, &$error, &$gateway ) { |
| 54 | + global $wgOut; |
55 | 55 | |
56 | | - $this->test = $wgPayflowGatewayTest; |
57 | | - $this->form_data =& $data; |
58 | | - $this->form_errors =& $error; |
| 56 | + $this->gateway = & $gateway; |
| 57 | + $this->test = $this->gateway->getGlobal( "Test" ); |
| 58 | + $this->form_data = & $data; |
| 59 | + $this->form_errors = & $error; |
59 | 60 | |
60 | 61 | /** |
61 | 62 | * add form-specific css - the path can be set in child classes |
— | — | @@ -72,7 +73,7 @@ |
73 | 74 | * We do this here (rather than in individual forms) because if OWA is |
74 | 75 | * enabled, we ALWAYS want to make sure it gets included. |
75 | 76 | */ |
76 | | - if(defined('OWA')){ |
| 77 | + if ( defined( 'OWA' ) ) { |
77 | 78 | $this->loadOwaJs(); |
78 | 79 | } |
79 | 80 | |
— | — | @@ -100,7 +101,7 @@ |
101 | 102 | global $wgScriptPath; |
102 | 103 | if ( !$style_path ) { |
103 | 104 | // load the default form CSS if the style path not explicitly set |
104 | | - $style_path = $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/Form.css'; |
| 105 | + $style_path = $wgScriptPath . '/extensions/DonationInterface/gateway_forms/css/Form.css'; |
105 | 106 | } |
106 | 107 | $this->style_path = $style_path; |
107 | 108 | } |
— | — | @@ -134,14 +135,6 @@ |
135 | 136 | } |
136 | 137 | |
137 | 138 | /** |
138 | | - * Fetch the array of iso country codes => country names |
139 | | - * @return array |
140 | | - */ |
141 | | - public function getCountries() { |
142 | | - return PayflowProGateway::getCountries(); |
143 | | - } |
144 | | - |
145 | | - /** |
146 | 139 | * Generate the menu select of countries |
147 | 140 | * @fixme It would be great if we could default the country to the user's locale |
148 | 141 | * @fixme We should also do a locale-based asort on the country dropdown |
— | — | @@ -152,8 +145,8 @@ |
153 | 146 | $country_options = ''; |
154 | 147 | |
155 | 148 | // create a new array of countries with potentially translated country names for alphabetizing later |
156 | | - foreach ( $this->getCountries() as $iso_value => $full_name ) { |
157 | | - $countries[ $iso_value ] = wfMsg( 'payflowpro_gateway-country-dropdown-' . $iso_value ); |
| 149 | + foreach ( GatewayForm::getCountries() as $iso_value => $full_name ) { |
| 150 | + $countries[$iso_value] = wfMsg( 'payflowpro_gateway-country-dropdown-' . $iso_value ); |
158 | 151 | } |
159 | 152 | |
160 | 153 | // alphabetically sort the country names |
— | — | @@ -161,8 +154,8 @@ |
162 | 155 | |
163 | 156 | // generate a dropdown option for each country |
164 | 157 | foreach ( $countries as $iso_value => $full_name ) { |
165 | | - if ( $this->form_data[ 'country' ] ) { |
166 | | - $selected = ( $iso_value == $this->form_data[ 'country' ] ) ? true : false; |
| 158 | + if ( $this->form_data['country'] ) { |
| 159 | + $selected = ( $iso_value == $this->form_data['country'] ) ? true : false; |
167 | 160 | } else { |
168 | 161 | $selected = ( $iso_value == $defaultCountry ) ? true : false; // Select default |
169 | 162 | } |
— | — | @@ -202,7 +195,7 @@ |
203 | 196 | // generate a dropdown opt for each card |
204 | 197 | foreach ( $available_cards as $value => $card_name ) { |
205 | 198 | // only load the card value if we're in testing mode |
206 | | - $selected = ( $value == $this->form_data[ 'card' ] && $this->test ) ? true : false; |
| 199 | + $selected = ( $value == $this->form_data['card_type'] && $this->test ) ? true : false; |
207 | 200 | $card_options .= Xml::option( $card_name, $value, $selected ); |
208 | 201 | } |
209 | 202 | |
— | — | @@ -224,8 +217,8 @@ |
225 | 218 | |
226 | 219 | // derive the previously set expiry month, if set |
227 | 220 | $month = NULL; |
228 | | - if ( $this->form_data[ 'expiration' ] ) { |
229 | | - $month = substr( $this->form_data[ 'expiration' ], 0, 2 ); |
| 221 | + if ( $this->form_data['expiration'] ) { |
| 222 | + $month = substr( $this->form_data['expiration'], 0, 2 ); |
230 | 223 | } |
231 | 224 | |
232 | 225 | $expiry_months = ''; |
— | — | @@ -253,8 +246,8 @@ |
254 | 247 | public function generateExpiryYearDropdown() { |
255 | 248 | // derive the previously set expiry year, if set |
256 | 249 | $year = NULL; |
257 | | - if ( $this->form_data[ 'expiration' ] ) { |
258 | | - $year = substr( $this->form_data[ 'expiration' ], 2, 2 ); |
| 250 | + if ( $this->form_data['expiration'] ) { |
| 251 | + $year = substr( $this->form_data['expiration'], 2, 2 ); |
259 | 252 | } |
260 | 253 | |
261 | 254 | $expiry_years = ''; |
— | — | @@ -292,7 +285,7 @@ |
293 | 286 | |
294 | 287 | // generate dropdown of state opts |
295 | 288 | foreach ( $states as $value => $state_name ) { |
296 | | - $selected = ( $this->form_data[ 'state' ] == $value ) ? true : false; |
| 289 | + $selected = ( $this->form_data['state'] == $value ) ? true : false; |
297 | 290 | $state_opts .= Xml::option( wfMsg( 'payflowpro_gateway-state-dropdown-' . $value ), $value, $selected ); |
298 | 291 | } |
299 | 292 | |
— | — | @@ -330,7 +323,7 @@ |
331 | 324 | |
332 | 325 | // generate dropdown of currency opts |
333 | 326 | foreach ( $available_currencies as $value => $currency_name ) { |
334 | | - $selected = ( $this->form_data[ 'currency' ] == $value ) ? true : false; |
| 327 | + $selected = ( $this->form_data['currency'] == $value ) ? true : false; |
335 | 328 | $currency_opts .= Xml::option( wfMsg( 'donate_interface-' . $value ), $value, $selected ); |
336 | 329 | } |
337 | 330 | |
— | — | @@ -355,28 +348,29 @@ |
356 | 349 | */ |
357 | 350 | public function setHiddenFields( $hidden_fields = NULL ) { |
358 | 351 | if ( !$hidden_fields ) { |
359 | | - $hidden_fields = array( |
360 | | - 'utm_source' => $this->form_data[ 'utm_source' ], |
361 | | - 'utm_medium' => $this->form_data[ 'utm_medium' ], |
362 | | - 'utm_campaign' => $this->form_data[ 'utm_campaign' ], |
363 | | - 'language' => $this->form_data[ 'language' ], |
364 | | - 'referrer' => $this->form_data[ 'referrer' ], |
365 | | - 'comment' => $this->form_data[ 'comment' ], |
366 | | - 'comment-option' => $this->form_data[ 'comment-option' ], |
367 | | - 'email-opt' => $this->form_data[ 'email-opt' ], |
368 | | - 'size' => $this->form_data[ 'size' ], |
369 | | - 'premium_language' => $this->form_data[ 'premium_language' ], |
370 | | - 'process' => 'CreditCard', |
| 352 | + $hidden_fields = array( |
| 353 | + 'utm_source' => $this->form_data['utm_source'], |
| 354 | + 'utm_medium' => $this->form_data['utm_medium'], |
| 355 | + 'utm_campaign' => $this->form_data['utm_campaign'], |
| 356 | + 'language' => $this->form_data['language'], |
| 357 | + 'referrer' => $this->form_data['referrer'], |
| 358 | + 'comment' => $this->form_data['comment'], |
| 359 | + 'comment-option' => $this->form_data['comment-option'], |
| 360 | + 'email-opt' => $this->form_data['email-opt'], |
| 361 | + 'size' => $this->form_data['size'], |
| 362 | + 'premium_language' => $this->form_data['premium_language'], |
| 363 | + 'process' => isset( $this->form_data['process'] ) ? $this->form_data['process'] : 'CreditCard', |
371 | 364 | 'payment_method' => 'processed', |
372 | | - 'token' => $this->form_data[ 'token' ], |
373 | | - 'order_id' => $this->form_data[ 'order_id' ], |
374 | | - 'i_order_id' => $this->form_data[ 'i_order_id' ], |
375 | | - 'numAttempt' => $this->form_data[ 'numAttempt' ], |
376 | | - 'contribution_tracking_id' => $this->form_data[ 'contribution_tracking_id' ], |
377 | | - 'data_hash' => $this->form_data[ 'data_hash' ], |
378 | | - 'action' => $this->form_data[ 'action' ], |
379 | | - 'owa_session' => $this->form_data[ 'owa_session' ], |
380 | | - 'owa_ref' => $this->form_data[ 'owa_ref' ], |
| 365 | + 'token' => $this->form_data['token'], |
| 366 | + 'order_id' => $this->form_data['order_id'], |
| 367 | + 'i_order_id' => $this->form_data['i_order_id'], |
| 368 | + 'numAttempt' => $this->form_data['numAttempt'], |
| 369 | + 'contribution_tracking_id' => $this->form_data['contribution_tracking_id'], |
| 370 | + 'data_hash' => $this->form_data['data_hash'], |
| 371 | + 'action' => $this->form_data['action'], |
| 372 | + 'owa_session' => $this->form_data['owa_session'], |
| 373 | + 'owa_ref' => $this->form_data['owa_ref'], |
| 374 | + 'transaction_type' => isset( $this->form_data['transaction_type'] ) ? $this->form_data['transaction_type'] : '', |
381 | 375 | ); |
382 | 376 | } |
383 | 377 | |
— | — | @@ -422,15 +416,17 @@ |
423 | 417 | } |
424 | 418 | |
425 | 419 | protected function generateBannerHeader() { |
426 | | - global $wgPayflowGatewayHeader, $wgOut, $wgRequest; |
| 420 | + global $wgOut, $wgRequest; |
| 421 | + $g = $this->gateway; |
| 422 | + $header = $g::getGlobal( 'Header' ); |
427 | 423 | |
428 | 424 | $template = ''; |
429 | 425 | |
430 | 426 | // intro text |
431 | 427 | if ( $wgRequest->getText( 'masthead', false ) ) { |
432 | | - $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->form_data[ 'language' ] . '}}' ); |
433 | | - } elseif ( $wgPayflowGatewayHeader ) { |
434 | | - $header = str_replace( '@language', $this->form_data[ 'language' ], $wgPayflowGatewayHeader ); |
| 428 | + $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->form_data['language'] . '}}' ); |
| 429 | + } elseif ( $header ) { |
| 430 | + $header = str_replace( '@language', $this->form_data['language'], $header ); |
435 | 431 | $template = $wgOut->parse( $header ); |
436 | 432 | } |
437 | 433 | |
— | — | @@ -467,30 +463,29 @@ |
468 | 464 | $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount' ) . '</td>'; |
469 | 465 | $form .= '<td>' . Xml::radio( 'amount', 100, $this->form_data['amount'] == 100 ) . '100 ' . |
470 | 466 | Xml::radio( 'amount', 50, $this->form_data['amount'] == 50 ) . '50 ' . |
471 | | - Xml::radio( 'amount', 35, $this->form_data['amount'] == 35 ) . '35 ' . |
| 467 | + Xml::radio( 'amount', 35, $this->form_data['amount'] == 35 ) . '35 ' . |
472 | 468 | Xml::radio( 'amount', 20, $this->form_data['amount'] == 20 ) . '20 ' . |
473 | 469 | '</td>'; |
474 | 470 | $form .= '</tr>'; |
475 | 471 | $form .= '<tr>'; |
476 | 472 | $form .= '<td class="label"></td>'; |
477 | | - $form .= '<td>' . Xml::radio( 'amount', $amount, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->form_data['amountOther'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'payflowpro_gateway-other' ).'\' )', 'onblur' => 'document.getElementById("otherRadio").value = this.value;if (this.value > 0) document.getElementById("otherRadio").checked=true;', 'maxlength' => '10', 'id' => 'amountOther' ) ) . |
| 473 | + $form .= '<td>' . Xml::radio( 'amount', $amount, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->form_data['amountOther'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg( 'payflowpro_gateway-other' ) . '\' )', 'onblur' => 'document.getElementById("otherRadio").value = this.value;if (this.value > 0) document.getElementById("otherRadio").checked=true;', 'maxlength' => '10', 'id' => 'amountOther' ) ) . |
478 | 474 | ' ' . $this->generateCurrencyDropdown() . '</td>'; |
479 | 475 | $form .= '</tr>'; |
480 | 476 | return $form; |
481 | 477 | } |
482 | 478 | |
483 | 479 | protected function getCardnumberField() { |
484 | | - global $wgPayflowGatewayTest; |
485 | | - $card_num = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'card_num' ] : ''; |
| 480 | + $card_num = ( $this->gateway->getGlobal( "Test" ) ) ? $this->form_data['card_num'] : ''; |
486 | 481 | $form = ''; |
487 | 482 | if ( $this->form_errors['card_num'] ) { |
488 | 483 | $form .= '<tr>'; |
489 | 484 | $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['card_num'] . '</span></td>'; |
490 | 485 | $form .= '</tr>'; |
491 | 486 | } |
492 | | - if ( $this->form_errors['card'] ) { |
| 487 | + if ( $this->form_errors['card_type'] ) { |
493 | 488 | $form .= '<tr>'; |
494 | | - $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['card'] . '</span></td>'; |
| 489 | + $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['card_type'] . '</span></td>'; |
495 | 490 | $form .= '</tr>'; |
496 | 491 | } |
497 | 492 | $form .= '<tr>'; |
— | — | @@ -502,8 +497,7 @@ |
503 | 498 | } |
504 | 499 | |
505 | 500 | protected function getCvvField() { |
506 | | - global $wgPayflowGatewayTest; |
507 | | - $cvv = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'cvv' ] : ''; |
| 501 | + $cvv = ( $this->gateway->getGlobal( "Test" ) ) ? $this->form_data['cvv'] : ''; |
508 | 502 | |
509 | 503 | $form = '<tr>'; |
510 | 504 | $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['cvv'] . '</span></td>'; |
— | — | @@ -561,8 +555,8 @@ |
562 | 556 | $form .= '</tr>'; |
563 | 557 | $form .= '<tr>'; |
564 | 558 | $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-name' ), 'fname' ) . '</td>'; |
565 | | - $form .= '<td>' . Xml::input( 'fname', '30', $this->form_data['fname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'payflowpro_gateway-donor-fname' ).'\' )', 'maxlength' => '25', 'class' => 'required', 'id' => 'fname' ) ) . |
566 | | - Xml::input( 'lname', '30', $this->form_data['lname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'payflowpro_gateway-donor-lname' ).'\' )', 'maxlength' => '25', 'id' => 'lname' ) ) . '</td>'; |
| 559 | + $form .= '<td>' . Xml::input( 'fname', '30', $this->form_data['fname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg( 'payflowpro_gateway-donor-fname' ) . '\' )', 'maxlength' => '25', 'class' => 'required', 'id' => 'fname' ) ) . |
| 560 | + Xml::input( 'lname', '30', $this->form_data['lname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg( 'payflowpro_gateway-donor-lname' ) . '\' )', 'maxlength' => '25', 'id' => 'lname' ) ) . '</td>'; |
567 | 561 | $form .= "</tr>"; |
568 | 562 | return $form; |
569 | 563 | } |
— | — | @@ -570,7 +564,7 @@ |
571 | 565 | protected function getCommentMessageField() { |
572 | 566 | $form = '<tr>'; |
573 | 567 | $form .= '<td colspan="2">'; |
574 | | - $form .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-comment-message' ) ); |
| 568 | + $form .= Xml::tags( 'p', array( ), wfMsg( 'donate_interface-comment-message' ) ); |
575 | 569 | $form .= '</td>'; |
576 | 570 | $form .= '</tr>'; |
577 | 571 | return $form; |
— | — | @@ -579,14 +573,14 @@ |
580 | 574 | protected function getCommentField() { |
581 | 575 | $form = '<tr>'; |
582 | 576 | $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-comment' ), 'comment' ) . '</td>'; |
583 | | - $form .= '<td>' . Xml::input( 'comment', '30', $this->form_data[ 'comment' ], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' ) ) . '</td>'; |
| 577 | + $form .= '<td>' . Xml::input( 'comment', '30', $this->form_data['comment'], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' ) ) . '</td>'; |
584 | 578 | $form .= '</tr>'; |
585 | 579 | return $form; |
586 | 580 | } |
587 | 581 | |
588 | 582 | protected function getCommentOptionField() { |
589 | 583 | global $wgRequest; |
590 | | - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'comment-option' ] : true; |
| 584 | + $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data['comment-option'] : true; |
591 | 585 | $form = '<tr>'; |
592 | 586 | $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
593 | 587 | $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
— | — | @@ -596,7 +590,7 @@ |
597 | 591 | |
598 | 592 | protected function getEmailOptField() { |
599 | 593 | global $wgRequest; |
600 | | - $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'email-opt' ] : true; |
| 594 | + $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data['email-opt'] : true; |
601 | 595 | $form = '<tr>'; |
602 | 596 | $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value ); |
603 | 597 | $form .= ' '; |
— | — | @@ -616,10 +610,8 @@ |
617 | 611 | $form = '<tr>'; |
618 | 612 | $form .= '<td class="paypal-button" colspan="2">'; |
619 | 613 | $form .= Html::hidden( 'PaypalRedirect', false ); |
620 | | - $form .= Xml::tags( 'div', |
621 | | - array(), |
622 | | - '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="' . $scriptPath . '/donate_with_paypal.gif"/></a>' |
623 | | - ); |
| 614 | + $form .= Xml::tags( 'div', array( ), '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="' . $scriptPath . '/donate_with_paypal.gif"/></a>' |
| 615 | + ); |
624 | 616 | $form .= '</td>'; |
625 | 617 | $form .= '</tr>'; |
626 | 618 | return $form; |
— | — | @@ -643,13 +635,13 @@ |
644 | 636 | $form .= '<tr>'; |
645 | 637 | $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-country' ), 'country' ) . '</td>'; |
646 | 638 | $form .= '<td>' . $this->generateCountryDropdown( $defaultCountry ) . '</td>'; |
647 | | - $form .= '</tr>'; |
648 | | - return $form; |
| 639 | + $form .= '</tr>'; |
| 640 | + return $form; |
649 | 641 | } |
650 | 642 | |
651 | 643 | protected function getCreditCardTypeField() { |
652 | 644 | $form = '<tr>'; |
653 | | - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-card' ), 'card' ) . '</td>'; |
| 645 | + $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-card' ), 'card_type' ) . '</td>'; |
654 | 646 | $form .= '<td>' . $this->generateCardDropdown() . '</td>'; |
655 | 647 | $form .= '</tr>'; |
656 | 648 | return $form; |
— | — | @@ -675,32 +667,31 @@ |
676 | 668 | |
677 | 669 | protected function loadOwaJs() { |
678 | 670 | global $wgOut, $wgScriptPath; |
679 | | - $wgOut->addHeadItem('owa_tracker', '<script type="text/javascript" src="https://owa.wikimedia.org/owa/modules/base/js/owa.tracker-combined-min.js"></script>'); |
680 | | - |
| 671 | + $wgOut->addHeadItem( 'owa_tracker', '<script type="text/javascript" src="https://owa.wikimedia.org/owa/modules/base/js/owa.tracker-combined-min.js"></script>' ); |
| 672 | + |
681 | 673 | $wgOut->addHeadItem( 'owa_get_info', '<script type="text/javascript" src="' . |
682 | | - $wgScriptPath . |
683 | | - '/extensions/DonationInterface/payflowpro_gateway/owa_get_info.js?284"></script>' ); |
| 674 | + $wgScriptPath . |
| 675 | + '/extensions/DonationInterface/payflowpro_gateway/owa_get_info.js?284"></script>' ); |
684 | 676 | $wgOut->addHeadItem( 'owa_tracker_init', '<script type="text/javascript" src="' . |
685 | | - $wgScriptPath . |
686 | | - '/extensions/DonationInterface/payflowpro_gateway/owa.tracker-combined-min.js?284"></script>' ); |
687 | | - |
| 677 | + $wgScriptPath . |
| 678 | + '/extensions/DonationInterface/payflowpro_gateway/owa.tracker-combined-min.js?284"></script>' ); |
688 | 679 | } |
689 | 680 | |
690 | | - |
691 | 681 | /** |
692 | 682 | * Generate HTML for <noscript> tags |
693 | 683 | * |
694 | 684 | * For displaying when a user does not have Javascript enabled in their browser. |
695 | 685 | */ |
696 | 686 | protected function getNoScript() { |
697 | | - global $wgPayflowGatewayNoScriptRedirect; |
| 687 | + $g = $this->gateway; |
| 688 | + $noScriptRedirect = $g::getGlobal( 'NoScriptRedirect' ); |
698 | 689 | |
699 | 690 | $form = '<noscript>'; |
700 | 691 | $form .= '<div id="noscript">'; |
701 | 692 | $form .= '<p id="noscript-msg">' . wfMsg( 'payflowpro_gateway-noscript-msg' ) . '</p>'; |
702 | | - if ( $wgPayflowGatewayNoScriptRedirect ) { |
| 693 | + if ( $noScriptRedirect ) { |
703 | 694 | $form .= '<p id="noscript-redirect-msg">' . wfMsg( 'payflowpro_gateway-noscript-redirect-msg' ) . '</p>'; |
704 | | - $form .= '<p id="noscript-redirect-link"><a href="' . $wgPayflowGatewayNoScriptRedirect . '">' . $wgPayflowGatewayNoScriptRedirect . '</a></p>'; |
| 695 | + $form .= '<p id="noscript-redirect-link"><a href="' . $noScriptRedirect . '">' . $noScriptRedirect . '</a></p>'; |
705 | 696 | } |
706 | 697 | $form .= '</div>'; |
707 | 698 | $form .= '</noscript>'; |
— | — | @@ -720,21 +711,22 @@ |
721 | 712 | |
722 | 713 | $url = $wgRequest->getFullRequestURL(); |
723 | 714 | $url_parts = wfParseUrl( $url ); |
724 | | - if ( isset( $url_parts[ 'query' ] ) ) { |
725 | | - $query_array = wfCgiToArray( $url_parts[ 'query' ] ); |
| 715 | + if ( isset( $url_parts['query'] ) ) { |
| 716 | + $query_array = wfCgiToArray( $url_parts['query'] ); |
726 | 717 | } else { |
727 | | - $query_array = array(); |
| 718 | + $query_array = array( ); |
728 | 719 | } |
729 | 720 | |
730 | 721 | // ensure that _cache_ does not get set in the URL |
731 | | - unset( $query_array[ '_cache_' ] ); |
| 722 | + unset( $query_array['_cache_'] ); |
732 | 723 | |
733 | 724 | // make sure no other data that might overwrite posted data makes it into the URL |
734 | 725 | foreach ( $this->form_data as $key => $value ) { |
735 | | - unset( $query_array[ $key ] ); |
| 726 | + unset( $query_array[$key] ); |
736 | 727 | } |
737 | 728 | |
738 | 729 | // construct the submission url |
739 | 730 | return wfAppendQuery( $wgTitle->getLocalURL(), $query_array ); |
740 | 731 | } |
| 732 | + |
741 | 733 | } |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | class PayflowProGateway_Form_TwoColumnLetter extends PayflowProGateway_Form_OneStepTwoColumn { |
5 | 5 | public $paypal = false; // true for paypal only version |
6 | 6 | |
7 | | - public function __construct( &$form_data, &$form_errors ) { |
| 7 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
8 | 8 | global $wgScriptPath; |
9 | 9 | |
10 | 10 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter.css' ); |
13 | 13 | } |
14 | 14 | |
15 | | - parent::__construct( $form_data, $form_errors ); |
| 15 | + parent::__construct( $form_data, $form_errors, $gateway ); |
16 | 16 | } |
17 | 17 | |
18 | 18 | public function generateFormStart() { |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | } |
84 | 84 | |
85 | 85 | protected function generateBillingFields() { |
86 | | - global $wgScriptPath, $wgPayflowGatewayPaypalURL; |
| 86 | + global $wgScriptPath; |
87 | 87 | $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
88 | 88 | |
89 | 89 | $form = ''; |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | if ( !$this->paypal ) { |
113 | 113 | // PayPal button |
114 | 114 | // make sure we have a paypal url set to redirect the user to before displaying the button |
115 | | - if ( strlen( $wgPayflowGatewayPaypalURL ) ) { |
| 115 | + if ( strlen( $this->gateway->getGlobal( "PaypalURL" ) ) ) { |
116 | 116 | $form .= '<tr>'; |
117 | 117 | $form .= '<td class="label"></td>'; |
118 | 118 | $form .= '<td class="paypal-button">'; |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnPremium.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoStepTwoColumnPremium extends PayflowProGateway_Form_TwoStepTwoColumn { |
5 | | - public function __construct( &$form_data, &$form_errors ) { |
| 5 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
6 | 6 | global $wgScriptPath; |
7 | 7 | |
8 | 8 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnPremium.css' ); |
11 | 11 | } |
12 | 12 | |
13 | | - parent::__construct( $form_data, $form_errors ); |
| 13 | + parent::__construct( $form_data, $form_errors, $gateway ); |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function generateFormStart() { |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumn.php |
— | — | @@ -2,13 +2,12 @@ |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoStepTwoColumn extends PayflowProGateway_Form { |
5 | 5 | |
6 | | - public function __construct( &$form_data, &$form_errors ) { |
| 6 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
7 | 7 | global $wgOut; |
8 | 8 | |
| 9 | + parent::__construct( $form_data, $form_errors, $gateway ); |
9 | 10 | // load validation and placeholder JS |
10 | 11 | $this->loadPlaceholders(); |
11 | | - |
12 | | - parent::__construct( $form_data, $form_errors ); |
13 | 12 | } |
14 | 13 | |
15 | 14 | public function loadPlaceholders() { |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetter2.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoStepTwoColumnLetter2 extends PayflowProGateway_Form_TwoStepTwoColumnLetter { |
5 | | - public function __construct( &$form_data, &$form_errors ) { |
| 5 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
6 | 6 | global $wgScriptPath; |
7 | 7 | |
8 | 8 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -9,6 +9,6 @@ |
10 | 10 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter2.css' ); |
11 | 11 | } |
12 | 12 | |
13 | | - parent::__construct( $form_data, $form_errors ); |
| 13 | + parent::__construct( $form_data, $form_errors, $gateway ); |
14 | 14 | } |
15 | 15 | } |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetter3.php |
— | — | @@ -1,15 +1,15 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoStepTwoColumnLetter3 extends PayflowProGateway_Form_TwoStepTwoColumn { |
5 | | - public function __construct( &$form_data, &$form_errors ) { |
6 | | - global $wgScriptPath; |
| 5 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
| 6 | + global $wgExtensionAssetsPath; |
7 | 7 | |
8 | 8 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
9 | 9 | if ( !strlen( $this->getStylePath() ) ) { |
10 | | - $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter3.css' ); |
| 10 | + $this->setStylePath( $wgExtensionAssetsPath . '/DonationInterface/gateway_forms/css/TwoStepTwoColumnLetter3.css' ); |
11 | 11 | } |
12 | 12 | $this->loadvalidateJs(); |
13 | | - parent::__construct( $form_data, $form_errors ); |
| 13 | + parent::__construct( $form_data, $form_errors, $gateway ); |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function loadPlaceholders() { |
— | — | @@ -189,7 +189,7 @@ |
190 | 190 | } |
191 | 191 | |
192 | 192 | protected function generateBillingFields() { |
193 | | - global $wgScriptPath, $wgPayflowGatewayTest; |
| 193 | + global $wgScriptPath; |
194 | 194 | |
195 | 195 | $form = ''; |
196 | 196 | |
— | — | @@ -234,16 +234,16 @@ |
235 | 235 | $form .= '</tr>'; |
236 | 236 | |
237 | 237 | // card number |
238 | | - $card_num = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'card_num' ] : ''; |
| 238 | + $card_num = ( $this->gateway->getGlobal( "Test" ) ) ? $this->form_data[ 'card_num' ] : ''; |
239 | 239 | $form .= ''; |
240 | 240 | if ( $this->form_errors['card_num'] ) { |
241 | 241 | $form .= '<tr>'; |
242 | 242 | $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['card_num'] . '</span></td>'; |
243 | 243 | $form .= '</tr>'; |
244 | 244 | } |
245 | | - if ( $this->form_errors['card'] ) { |
| 245 | + if ( $this->form_errors['card_type'] ) { |
246 | 246 | $form .= '<tr>'; |
247 | | - $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['card'] . '</span></td>'; |
| 247 | + $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['card_type'] . '</span></td>'; |
248 | 248 | $form .= '</tr>'; |
249 | 249 | } |
250 | 250 | $form .= '<tr>'; |
— | — | @@ -355,7 +355,7 @@ |
356 | 356 | } |
357 | 357 | |
358 | 358 | public function generateStateDropdown() { |
359 | | - require_once( dirname( __FILE__ ) . '/../includes/stateAbbreviations.inc' ); |
| 359 | + require_once( dirname( __FILE__ ) . '/includes/stateAbbreviations.inc' ); |
360 | 360 | |
361 | 361 | $states = statesMenuXML(); |
362 | 362 | |
Index: trunk/extensions/DonationInterface/gateway_forms/RapidHtml.php |
— | — | @@ -1,13 +1,13 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_RapidHtml extends PayflowProGateway_Form { |
5 | | - |
| 5 | + |
6 | 6 | /** |
7 | 7 | * Full path of HTML form to load |
8 | 8 | * @var string |
9 | 9 | */ |
10 | 10 | protected $html_file_path = ''; |
11 | | - |
| 11 | + |
12 | 12 | /** |
13 | 13 | * Tokens used in HTML form for data replacement |
14 | 14 | * |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | '@zip', // => $wgRequest->getText( 'zip' ), |
30 | 30 | '@country', // => $wgRequest->getText( 'country' ), |
31 | 31 | '@card_num', // => str_replace( ' ', '', $wgRequest->getText( 'card_num' ) ), |
32 | | - '@card', // => $wgRequest->getText( 'card' ), |
| 32 | + '@card_type', // => $wgRequest->getText( 'card_type' ), |
33 | 33 | '@expiration', // => $wgRequest->getText( 'mos' ) . substr( $wgRequest->getText( 'year' ), 2, 2 ), |
34 | 34 | '@cvv', // => $wgRequest->getText( 'cvv' ), |
35 | 35 | '@currency_code', //'currency' => $wgRequest->getText( 'currency_code' ), |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | // @script_path -> maps to $wgScriptPath |
59 | 59 | // @action -> generate correct form action for this form |
60 | 60 | ); |
61 | | - |
| 61 | + |
62 | 62 | /** |
63 | 63 | * Error field names used as tokens |
64 | 64 | * @var array |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | '#retryMsg', |
69 | 69 | '#amount', |
70 | 70 | '#card_num', |
71 | | - '#card', |
| 71 | + '#card_type', |
72 | 72 | '#cvv', |
73 | 73 | '#fname', |
74 | 74 | '#lname', |
— | — | @@ -78,10 +78,10 @@ |
79 | 79 | '#zip', |
80 | 80 | '#emailAdd', |
81 | 81 | ); |
82 | | - |
83 | | - public function __construct( &$form_data, &$form_errors ) { |
| 82 | + |
| 83 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
84 | 84 | global $wgRequest; |
85 | | - parent::__construct( $form_data, $form_errors ); |
| 85 | + parent::__construct( $form_data, $form_errors, $gateway ); |
86 | 86 | |
87 | 87 | $country = $wgRequest->getText( 'country', '' ); |
88 | 88 | |
— | — | @@ -100,18 +100,18 @@ |
101 | 101 | } |
102 | 102 | |
103 | 103 | // fix general form error messages so it's not an array of msgs |
104 | | - if ( is_array( $form_errors[ 'general' ] ) && count( $form_errors[ 'general' ] )) { |
| 104 | + if ( is_array( $form_errors['general'] ) && count( $form_errors['general'] ) ) { |
105 | 105 | $general_errors = ""; |
106 | | - foreach ( $form_errors[ 'general' ] as $general_error ) { |
| 106 | + foreach ( $form_errors['general'] as $general_error ) { |
107 | 107 | $general_errors .= "<p class='creditcard'>$general_error</p>"; |
108 | 108 | } |
109 | | - $form_errors[ 'general' ] = $general_errors; |
| 109 | + $form_errors['general'] = $general_errors; |
110 | 110 | } |
111 | 111 | |
112 | 112 | // if this form needs to support squid cacheing, handle the magic |
113 | 113 | $this->handle_cacheability(); |
114 | 114 | } |
115 | | - |
| 115 | + |
116 | 116 | /** |
117 | 117 | * Return the HTML form with data added |
118 | 118 | */ |
— | — | @@ -119,7 +119,7 @@ |
120 | 120 | $html = $this->load_html(); |
121 | 121 | return $this->add_data( $html ); |
122 | 122 | } |
123 | | - |
| 123 | + |
124 | 124 | /** |
125 | 125 | * Load the HTML form from a file into a string |
126 | 126 | * @return string |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | public function load_html() { |
129 | 129 | return file_get_contents( $this->html_file_path ); |
130 | 130 | } |
131 | | - |
| 131 | + |
132 | 132 | /** |
133 | 133 | * Add data into the HTML form |
134 | 134 | * |
— | — | @@ -175,12 +175,12 @@ |
176 | 176 | |
177 | 177 | // handle captcha |
178 | 178 | $form = str_replace( "@captcha", $this->getCaptchaHtml(), $form ); |
179 | | - |
| 179 | + |
180 | 180 | // handle script path |
181 | 181 | $form = str_replace( "@script_path", $wgScriptPath, $form ); |
182 | | - |
| 182 | + |
183 | 183 | $form = $this->fix_dropdowns( $form ); |
184 | | - |
| 184 | + |
185 | 185 | return $form; |
186 | 186 | } |
187 | 187 | |
— | — | @@ -196,84 +196,78 @@ |
197 | 197 | // currency code |
198 | 198 | $start = strpos( $html, 'name="currency_code"' ); |
199 | 199 | if ( $start ) { |
200 | | - $currency_code = $this->form_data[ 'currency' ]; |
| 200 | + $currency_code = $this->form_data['currency']; |
201 | 201 | $end = strpos( $html, '</select>', $start ); |
202 | | - $str = substr( $html, $start, ( $end - $start )); |
| 202 | + $str = substr( $html, $start, ( $end - $start ) ); |
203 | 203 | $str = str_replace( 'value="' . $currency_code . '"', 'value="' . $currency_code . '" selected="selected"', $str ); |
204 | | - $html = substr_replace( $html, $str, $start, $end-$start ); |
| 204 | + $html = substr_replace( $html, $str, $start, $end - $start ); |
205 | 205 | } |
206 | | - |
| 206 | + |
207 | 207 | // mos |
208 | | - $month = substr( $this->form_data[ 'expiration' ], 0, 2 ); |
| 208 | + $month = substr( $this->form_data['expiration'], 0, 2 ); |
209 | 209 | $start = strpos( $html, 'name="mos"' ); |
210 | 210 | if ( $start ) { |
211 | 211 | $end = strpos( $html, '</select>', $start ); |
212 | | - $str = substr( $html, $start, ( $end - $start )); |
| 212 | + $str = substr( $html, $start, ( $end - $start ) ); |
213 | 213 | $str = str_replace( 'value="' . $month . '"', 'value="' . $month . '" selected="selected"', $str ); |
214 | | - $html = substr_replace( $html, $str, $start, $end-$start ); |
| 214 | + $html = substr_replace( $html, $str, $start, $end - $start ); |
215 | 215 | } |
216 | | - |
| 216 | + |
217 | 217 | // year |
218 | | - $year = substr( $this->form_data[ 'expiration' ], 2, 2 ); |
| 218 | + $year = substr( $this->form_data['expiration'], 2, 2 ); |
219 | 219 | $start = strpos( $html, 'name="year"' ); |
220 | | - if ( $start ) { |
| 220 | + if ( $start ) { |
221 | 221 | $end = strpos( $html, '</select>', $start ); |
222 | | - $str = substr( $html, $start, ( $end - $start )); |
| 222 | + $str = substr( $html, $start, ( $end - $start ) ); |
223 | 223 | // dbl extra huge hack alert! note the '20' prefix... |
224 | 224 | $str = str_replace( 'value="20' . $year . '"', 'value="20' . $year . '" selected="selected"', $str ); |
225 | | - $html = substr_replace( $html, $str, $start, $end-$start ); |
| 225 | + $html = substr_replace( $html, $str, $start, $end - $start ); |
226 | 226 | } |
227 | | - |
| 227 | + |
228 | 228 | // state |
229 | | - $state = $this->form_data[ 'state' ]; |
| 229 | + $state = $this->form_data['state']; |
230 | 230 | $start = strpos( $html, 'name="state"' ); |
231 | 231 | if ( $start ) { |
232 | 232 | $end = strpos( $html, '</select>', $start ); |
233 | | - $str = substr( $html, $start, ( $end - $start )); |
| 233 | + $str = substr( $html, $start, ( $end - $start ) ); |
234 | 234 | $str = str_replace( 'value="' . $state . '"', 'value="' . $state . '" selected="selected"', $str ); |
235 | | - $html = substr_replace( $html, $str, $start, $end-$start ); |
| 235 | + $html = substr_replace( $html, $str, $start, $end - $start ); |
236 | 236 | } |
237 | | - |
| 237 | + |
238 | 238 | //country |
239 | | - $country = $this->form_data[ 'country' ]; |
| 239 | + $country = $this->form_data['country']; |
240 | 240 | $start = strpos( $html, 'name="country"' ); |
241 | 241 | if ( $start ) { |
242 | 242 | $end = strpos( $html, '</select>', $start ); |
243 | | - $str = substr( $html, $start, ( $end - $start )); |
| 243 | + $str = substr( $html, $start, ( $end - $start ) ); |
244 | 244 | $str = str_replace( 'value="' . $country . '"', 'value="' . $country . '" selected="selected"', $str ); |
245 | | - $html = substr_replace( $html, $str, $start, $end-$start ); |
| 245 | + $html = substr_replace( $html, $str, $start, $end - $start ); |
246 | 246 | } |
247 | | - |
| 247 | + |
248 | 248 | return $html; |
249 | 249 | } |
250 | | - |
| 250 | + |
251 | 251 | /** |
252 | 252 | * Validate and set the path to the HTML file |
253 | 253 | * |
254 | 254 | * @param string $file_name |
255 | 255 | */ |
256 | 256 | public function set_html_file_path( $file_name ) { |
257 | | - global $wgPayflowHtmlFormDir, $wgPayflowAllowedHtmlForms; |
| 257 | + //This ONE TIME, this is okay, because we actually want to compare to the default HTML form dir as well. |
| 258 | + global $wgDonationInterfaceHtmlFormDir; |
258 | 259 | |
259 | | - // Get the dirname - the "/." helps ensure we get a consistent path name with no trailing slash |
260 | | - $html_dir = dirname( $wgPayflowHtmlFormDir . "/." ); |
261 | | - |
262 | | - if ( !is_dir( $html_dir )) { |
263 | | - throw new MWException( 'Requested form directory does not exist.' ); |
264 | | - } |
265 | | - |
266 | | - // make sure our file name is clean - strip extension and any other cruft like relpaths, dirs, etc |
267 | | - $file_info = pathinfo( $file_name ); |
268 | | - $file_name = $file_info[ 'filename' ]; |
269 | | - |
270 | | - $full_path = $html_dir . '/' . $file_name . '.html'; |
271 | | - |
272 | | - // ensure that the full file path is actually whitelisted and exists |
273 | | - if ( !in_array( $full_path, $wgPayflowAllowedHtmlForms ) || !file_exists( $full_path ) ) { |
| 260 | + $g = $this->gateway; |
| 261 | + $gatewayFormDir = $g::getGlobal( 'HtmlFormDir' ); |
| 262 | + $allowedForms = $g::getGlobal( 'AllowedHtmlForms' ); |
| 263 | + |
| 264 | + if ( !array_key_exists( $file_name, $allowedForms ) || |
| 265 | + ((strpos( $allowedForms[$file_name], $gatewayFormDir ) === false) && (strpos( $allowedForms[$file_name], $wgDonationInterfaceHtmlFormDir ) === false)) || |
| 266 | + (!file_exists( $allowedForms[$file_name] )) ) { |
| 267 | + |
274 | 268 | throw new MWException( 'Requested an unavailable or non-existent form.' ); |
275 | 269 | } |
276 | | - |
277 | | - $this->html_file_path = $full_path; |
| 270 | + |
| 271 | + $this->html_file_path = $allowedForms[$file_name]; |
278 | 272 | } |
279 | 273 | |
280 | 274 | /** |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnPremiumUS.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoStepTwoColumnPremiumUS extends PayflowProGateway_Form_TwoStepTwoColumn { |
5 | | - public function __construct( &$form_data, &$form_errors ) { |
| 5 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
6 | 6 | global $wgScriptPath; |
7 | 7 | |
8 | 8 | // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnPremiumUS.css' ); |
11 | 11 | } |
12 | 12 | |
13 | | - parent::__construct( $form_data, $form_errors ); |
| 13 | + parent::__construct( $form_data, $form_errors, $gateway ); |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function loadPlaceholders() { |
— | — | @@ -174,7 +174,7 @@ |
175 | 175 | } |
176 | 176 | |
177 | 177 | protected function generateBillingFields() { |
178 | | - global $wgScriptPath, $wgPayflowGatewayTest; |
| 178 | + global $wgScriptPath; |
179 | 179 | |
180 | 180 | $form = ''; |
181 | 181 | |
— | — | @@ -216,16 +216,16 @@ |
217 | 217 | $form .= '</tr>'; |
218 | 218 | |
219 | 219 | // card number |
220 | | - $card_num = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'card_num' ] : ''; |
| 220 | + $card_num = ( $this->gateway->getGlobal( "Test" ) ) ? $this->form_data[ 'card_num' ] : ''; |
221 | 221 | $form .= ''; |
222 | 222 | if ( $this->form_errors['card_num'] ) { |
223 | 223 | $form .= '<tr>'; |
224 | 224 | $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['card_num'] . '</span></td>'; |
225 | 225 | $form .= '</tr>'; |
226 | 226 | } |
227 | | - if ( $this->form_errors['card'] ) { |
| 227 | + if ( $this->form_errors['card_type'] ) { |
228 | 228 | $form .= '<tr>'; |
229 | | - $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['card'] . '</span></td>'; |
| 229 | + $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['card_type'] . '</span></td>'; |
230 | 230 | $form .= '</tr>'; |
231 | 231 | } |
232 | 232 | $form .= '<tr>'; |
Index: trunk/extensions/DonationInterface/gateway_forms/OneStepTwoColumn.php |
— | — | @@ -3,10 +3,10 @@ |
4 | 4 | class PayflowProGateway_Form_OneStepTwoColumn extends PayflowProGateway_Form { |
5 | 5 | public $paypal = false; // true for paypal only version |
6 | 6 | |
7 | | - public function __construct( &$form_data, &$form_errors ) { |
| 7 | + public function __construct( &$form_data, &$form_errors, &$gateway ) { |
8 | 8 | global $wgOut; |
9 | 9 | |
10 | | - parent::__construct( $form_data, $form_errors ); |
| 10 | + parent::__construct( $form_data, $form_errors, $gateway ); |
11 | 11 | |
12 | 12 | // update the list of hidden fields we need to use in this form. |
13 | 13 | $this->updateHiddenFields(); |
— | — | @@ -192,14 +192,14 @@ |
193 | 193 | } |
194 | 194 | |
195 | 195 | protected function generateBannerHeader() { |
196 | | - global $wgPayflowGatewayHeader, $wgOut, $wgRequest; |
| 196 | + global $wgOut, $wgRequest; |
197 | 197 | $template = ''; |
198 | 198 | |
199 | 199 | // intro text |
200 | 200 | if ( $wgRequest->getText( 'masthead', false ) ) { |
201 | 201 | $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->form_data[ 'language' ] . '}}' ); |
202 | | - } elseif ( $wgPayflowGatewayHeader ) { |
203 | | - $header = str_replace( '@language', $this->form_data[ 'language' ], $wgPayflowGatewayHeader ); |
| 202 | + } elseif ( $this->gateway->getGlobal( "Header" ) ) { |
| 203 | + $header = str_replace( '@language', $this->form_data[ 'language' ], $this->gateway->getGlobal( "Header" ) ); |
204 | 204 | $template = $wgOut->parse( $header ); |
205 | 205 | } |
206 | 206 | |
Property changes on: trunk/extensions/DonationInterface/gateway_forms |
___________________________________________________________________ |
Added: svn:mergeinfo |
207 | 207 | Merged /branches/fundraising/extensions/DonationInterface/gateway_forms:r95724-100157 |