Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php |
— | — | @@ -1,277 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -# Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly. |
5 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
6 | | - echo <<<EOT |
7 | | -To install PayflowPro Gateway extension, put the following line in LocalSettings.php: |
8 | | -require_once( "\$IP/extensions/payflowpro_gateway/payflowpro_gateway.php" ); |
9 | | -EOT; |
10 | | - exit( 1 ); |
11 | | -} |
12 | | - |
13 | | -// Extension credits that will show up on Special:Version |
14 | | -$wgExtensionCredits['specialpage'][] = array( |
15 | | - 'name' => 'PayflowPro Gateway', |
16 | | - 'author' => 'Four Kitchens', |
17 | | - 'version' => '1.0.0', |
18 | | - 'descriptionmsg' => 'payflowpro_gateway-desc', |
19 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:PayflowProGateway', |
20 | | -); |
21 | | - |
22 | | -// Set up the new special page |
23 | | -$dir = dirname( __FILE__ ) . '/'; |
24 | | -$wgAutoloadClasses['PayflowProGateway'] = $dir . 'payflowpro_gateway.body.php'; |
25 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form' ] = $dir . 'forms/Form.php'; |
26 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_OneStepTwoColumn' ] = $dir . 'forms/OneStepTwoColumn.php'; |
27 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoStepTwoColumn' ] = $dir . 'forms/TwoStepTwoColumn.php'; |
28 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnPayPal' ] = $dir . 'forms/TwoColumnPayPal.php'; |
29 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnLetter' ] = $dir . 'forms/TwoColumnLetter.php'; |
30 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnLetter2' ] = $dir . 'forms/TwoColumnLetter2.php'; |
31 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnLetter3' ] = $dir . 'forms/TwoColumnLetter3.php'; |
32 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnLetter4' ] = $dir . 'forms/TwoColumnLetter4.php'; |
33 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnLetter5' ] = $dir . 'forms/TwoColumnLetter5.php'; |
34 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnLetter6' ] = $dir . 'forms/TwoColumnLetter6.php'; |
35 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnLetter7' ] = $dir . 'forms/TwoColumnLetter7.php'; |
36 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoStepTwoColumnLetter' ] = $dir . 'forms/TwoStepTwoColumnLetter.php'; |
37 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoStepTwoColumnLetterCA' ] = $dir . 'forms/TwoStepTwoColumnLetterCA.php'; |
38 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoStepTwoColumnLetter2' ] = $dir . 'forms/TwoStepTwoColumnLetter2.php'; |
39 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoStepTwoColumnLetter3' ] = $dir . 'forms/TwoStepTwoColumnLetter3.php'; |
40 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoStepTwoColumnPremium' ] = $dir . 'forms/TwoStepTwoColumnPremium.php'; |
41 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoStepTwoColumnPremiumUS' ] = $dir . 'forms/TwoStepTwoColumnPremiumUS.php'; |
42 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_RapidHtml' ] = $dir . 'forms/RapidHtml.php'; |
43 | | -$wgAutoloadClasses[ 'PayflowProGateway_Form_SingleColumn' ] = $dir . 'forms/SingleColumn.php'; |
44 | | -$wgExtensionMessagesFiles['PayflowProGateway'] = $dir . 'payflowpro_gateway.i18n.php'; |
45 | | -$wgExtensionMessagesFiles['PayflowProGatewayCountries'] = $dir . 'payflowpro_gateway.countries.i18n.php'; |
46 | | -$wgExtensionMessagesFiles['PayflowProGatewayUSStates'] = $dir . 'payflowpro_gateway.us-states.i18n.php'; |
47 | | -$wgExtensionAliasesFiles['PayflowProGateway'] = $dir . 'payflowpro_gateway.alias.php'; |
48 | | -$wgSpecialPages['PayflowProGateway'] = 'PayflowProGateway'; |
49 | | -$wgAjaxExportList[] = "fnPayflowProofofWork"; |
50 | | - |
51 | | - |
52 | | -// set defaults, these should be assigned in LocalSettings.php |
53 | | -$wgPayflowProURL = 'https://payflowpro.paypal.com'; |
54 | | -$wgPayflowProTestingURL = 'https://pilot-payflowpro.paypal.com'; // Payflow testing URL |
55 | | - |
56 | | -$wgPayFlowProGatewayCSSVersion = 1; |
57 | | - |
58 | | -$wgPayflowProPartnerID = ''; // PayPal or original authorized reseller |
59 | | -$wgPayflowProVendorID = ''; // paypal merchant login ID |
60 | | -$wgPayflowProUserID = ''; // if one or more users are set up, authorized user ID, else same as VENDOR |
61 | | -$wgPayflowProPassword = ''; // merchant login password |
62 | | - |
63 | | -// a boolean to determine if we're in testing mode |
64 | | -$wgPayflowGatewayTest = FALSE; |
65 | | - |
66 | | -// timeout in seconds for communicating with paypal |
67 | | -$wgPayflowProTimeout = 5; |
68 | | - |
69 | | -/** |
70 | | - * The default form to use |
71 | | - */ |
72 | | -$wgPayflowGatewayDefaultForm = 'TwoStepTwoColumn'; |
73 | | - |
74 | | -/** |
75 | | - * A string or array of strings for making tokens more secure |
76 | | - * |
77 | | - * Please set this! If you do not, tokens are easy to get around, which can |
78 | | - * potentially leave you and your users vulnerable to CSRF or other forms of |
79 | | - * attack. |
80 | | - */ |
81 | | -$wgPayflowGatewaySalt = $wgSecretKey; |
82 | | - |
83 | | -$wgPayflowGatewayDBserver = $wgDBserver; |
84 | | -$wgPayflowGatewayDBname = $wgDBname; |
85 | | -$wgPayflowGatewayDBuser = $wgDBuser; |
86 | | -$wgPayflowGatewayDBpassword = $wgDBpassword; |
87 | | - |
88 | | -/** |
89 | | - * A string that can contain wikitext to display at the head of the credit card form |
90 | | - * |
91 | | - * This string gets run like so: $wg->addHtml( $wg->Parse( $wgpayflowGatewayHeader )) |
92 | | - * You can use '@language' as a placeholder token to extract the user's language. |
93 | | - * |
94 | | - */ |
95 | | -$wgPayflowGatewayHeader = NULL; |
96 | | - |
97 | | -/** |
98 | | - * A string containing full URL for Javascript-disabled credit card form redirect |
99 | | - */ |
100 | | -$wgPayflowGatewayNoScriptRedirect = null; |
101 | | - |
102 | | -/** |
103 | | - * Proxy settings |
104 | | - * |
105 | | - * If you need to use an HTTP proxy for outgoing traffic, |
106 | | - * set wgPayflowGatweayUseHTTPProxy=TRUE and set $wgPayflowGatewayHTTPProxy |
107 | | - * to the proxy desination. |
108 | | - * eg: |
109 | | - * $wgPayflowGatewayUseHTTPProxy=TRUE; |
110 | | - * $wgPayflowGatewayHTTPProxy='192.168.1.1:3128' |
111 | | - */ |
112 | | -$wgPayflowGatewayUseHTTPProxy = FALSE; |
113 | | -$wgPayflowGatewayHTTPProxy = ''; |
114 | | - |
115 | | -/** |
116 | | - * The URL to redirect a transaction to PayPal |
117 | | - */ |
118 | | -$wgPayflowGatewayPaypalURL = ''; |
119 | | - |
120 | | -/** |
121 | | - * Set the max-age value for Squid |
122 | | - * |
123 | | - * If you have Squid enabled for caching, use this variable to configure |
124 | | - * the s-max-age for cached requests. |
125 | | - * @var int Time in seconds |
126 | | - */ |
127 | | -$wgPayflowSMaxAge = 6000; |
128 | | - |
129 | | -/** |
130 | | - * Directory for HTML forms (used by RapidHtml form class) |
131 | | - * @var string |
132 | | - */ |
133 | | -$wgPayflowHtmlFormDir = dirname( __FILE__ ) . "/forms/rapidhtml/html"; |
134 | | - |
135 | | -/** |
136 | | - * An array of allowed HTML forms. |
137 | | - * |
138 | | - * Be sure to use full paths. If your HTML form is not listed here, it will |
139 | | - * /never/ be loaded by the rapid html form loader! |
140 | | - * @var string |
141 | | - */ |
142 | | -$wgPayflowAllowedHtmlForms = array( $wgPayflowHtmlFormDir . "/demo.html" ); |
143 | | - |
144 | | -/** |
145 | | - * Configure PayflowproGateway to use syslog for log messages rather than wfDebugLog |
146 | | - * |
147 | | - * @var bool |
148 | | - */ |
149 | | -$wgPayflowGatewayUseSyslog = false; |
150 | | - |
151 | | -/** |
152 | | - * Configure price cieling and floor for valid contribution amount. Values |
153 | | - * should be in USD. |
154 | | - */ |
155 | | -$wgPayflowPriceFloor = '1.00'; |
156 | | -$wgPayflowPriceCieling = '10000.00'; |
157 | | - |
158 | | -/** |
159 | | - * Hooks required to interface with the donation extension (include <donate> on page) |
160 | | - * |
161 | | - * gwValue supplies the value of the form option, the name that appears on the form |
162 | | - * and the currencies supported by the gateway in the $values array |
163 | | - */ |
164 | | -$wgHooks['DonationInterface_Value'][] = 'pfpGatewayValue'; |
165 | | -$wgHooks['DonationInterface_Page'][] = 'pfpGatewayPage'; |
166 | | - |
167 | | -// enable the API |
168 | | -$wgAPIModules[ 'pfp' ] = 'ApiPayflowProGateway'; |
169 | | -$wgAutoloadClasses[ 'ApiPayflowProGateway' ] = $dir . 'api_payflowpro_gateway.php'; |
170 | | - |
171 | | -// load any rapidhtml related resources |
172 | | -require_once( dirname( __FILE__ ) . "/forms/rapidhtml/RapidHtmlResources.php" ); |
173 | | - |
174 | | -// form validation resource |
175 | | -$wgResourceModules[ 'pfp.form.core.validate' ] = array( |
176 | | - 'scripts' => 'validate_input.js', |
177 | | - 'dependencies' => 'pfp.form.core.pfp_css', |
178 | | - 'localBasePath' => dirname( __FILE__ ), |
179 | | - 'remoteExtPath' => 'DonationInterface/payflowpro_gateway', |
180 | | -); |
181 | | - |
182 | | -// form placeholders |
183 | | -$wgResourceModules[ 'pfp.form.core.placeholders' ] = array( |
184 | | - 'scripts' => 'form_placeholders.js', |
185 | | - 'dependencies' => 'pfp.form.core.validate', |
186 | | - 'messages' => array( |
187 | | - 'payflowpro_gateway-donor-fname', |
188 | | - 'payflowpro_gateway-donor-lname' |
189 | | - ), |
190 | | - 'localBasePath' => dirname( __FILE__ ), |
191 | | - 'remoteExtPath' => 'DonationInterface/payflowpro_gateway', |
192 | | -); |
193 | | - |
194 | | -// general PFP css |
195 | | -$wgResourceModules[ 'pfp.form.core.pfp_css' ] = array( |
196 | | - 'styles' => 'payflowpro_gateway.css', |
197 | | - 'scripts' => array(), |
198 | | - 'dependencies' => array(), |
199 | | - 'localBasePath' => dirname( __FILE__ ), |
200 | | - 'remoteExtPath' => 'DonationInterface/payflowpro_gateway', |
201 | | -); |
202 | | - |
203 | | -// TowStepTwoColumnLetter3 |
204 | | -$wgResourceModules[ 'pfp.form.TwoStepTwoColumnLetter3' ] = array( |
205 | | - 'styles' => 'forms/css/TwoStepTwoColumnLetter3.css', |
206 | | - 'dependencies' => 'pfp.form.core.validate', |
207 | | - 'localBasePath' => dirname( __FILE__ ), |
208 | | - 'remoteExtPath' => 'DonationInterface/payflowpro_gateway', |
209 | | -); |
210 | | - |
211 | | -// API JS |
212 | | -$wgResourceModules[ 'pfp.form.core.api' ] = array( |
213 | | - 'scripts' => 'pfp_api_controller.js', |
214 | | - 'localBasePath' => dirname( __FILE__ ), |
215 | | - 'remoteExtPath' => 'DonationInterface/payflowpro_gateway' |
216 | | -); |
217 | | - |
218 | | -// Logo link override |
219 | | -$wgResourceModules[ 'pfp.core.logolink_override' ] = array( |
220 | | - 'scripts' => 'logolink_override.js', |
221 | | - 'localBasePath' => dirname( __FILE__ ), |
222 | | - 'remoteExtPath' => 'DonationInterface/payflowpro_gateway' |
223 | | - |
224 | | -); |
225 | | - |
226 | | -function payflowGatewayConnection() { |
227 | | - global $wgPayflowGatewayDBserver, $wgPayflowGatewayDBname; |
228 | | - global $wgPayflowGatewayDBuser, $wgPayflowGatewayDBpassword; |
229 | | - |
230 | | - static $db; |
231 | | - |
232 | | - if ( !$db ) { |
233 | | - $db = new DatabaseMysql( |
234 | | - $wgPayflowGatewayDBserver, |
235 | | - $wgPayflowGatewayDBuser, |
236 | | - $wgPayflowGatewayDBpassword, |
237 | | - $wgPayflowGatewayDBname ); |
238 | | - $db->query( "SET names utf8" ); |
239 | | - } |
240 | | - |
241 | | - return $db; |
242 | | -} |
243 | | - |
244 | | -/** |
245 | | - * Hook to register form value and display name of this gateway |
246 | | - * also supplies currencies supported by this gateway |
247 | | - */ |
248 | | -function pfpGatewayValue( &$values ) { |
249 | | - $values['payflow'] = array( |
250 | | - 'gateway' => 'payflow', |
251 | | - 'display_name' => 'Credit Card', |
252 | | - 'form_value' => 'payflow', |
253 | | - 'currencies' => array( |
254 | | - 'GBP' => 'GBP: British Pound', |
255 | | - 'EUR' => 'EUR: Euro', |
256 | | - 'USD' => 'USD: U.S. Dollar', |
257 | | - 'AUD' => 'AUD: Australian Dollar', |
258 | | - 'CAD' => 'CAD: Canadian Dollar', |
259 | | - 'JPY' => 'JPY: Japanese Yen', |
260 | | - ), |
261 | | - ); |
262 | | - |
263 | | - return true; |
264 | | -} |
265 | | - |
266 | | -/** |
267 | | - * Hook to supply the page address of the payment gateway |
268 | | - * |
269 | | - * The user will redirected here with supplied data with input data appended (GET). |
270 | | - * For example, if $url[$key] = index.php?title=Special:PayflowPro |
271 | | - * the result might look like this: http://www.yourdomain.com/index.php?title=Special:PayflowPro&amount=75.00¤cy_code=USD&payment_method=payflow |
272 | | - */ |
273 | | -function pfpGatewayPage( &$url ) { |
274 | | - global $wgScript; |
275 | | - |
276 | | - $url['payflow'] = $wgScript . "?title=Special:PayflowProGateway"; |
277 | | - return true; |
278 | | -} |