Index: branches/fundraising/deployment/DonationInterface/GeoIP/RebuildGeoIP.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | * @ingroup Maintenance |
21 | 21 | */ |
22 | 22 | |
23 | | -require_once( dirname(__FILE__) . '/../../maintenance/Maintenance.php' ); |
| 23 | +require_once( dirname( __FILE__ ) . '/../../maintenance/Maintenance.php' ); |
24 | 24 | |
25 | 25 | class RebuildGeoIP extends Maintenance { |
26 | 26 | public function __construct() { |
— | — | @@ -51,9 +51,9 @@ |
52 | 52 | $handle = fopen( $filename, 'r' ); |
53 | 53 | |
54 | 54 | $count = 0; |
55 | | - while( ( $data = fgetcsv( $handle, 256, ',' ) ) !== false ) { |
| 55 | + while ( ( $data = fgetcsv( $handle, 256, ',' ) ) !== false ) { |
56 | 56 | // Output a nice progress bar. |
57 | | - if( $count % 1000 == 0 ) { |
| 57 | + if ( $count % 1000 == 0 ) { |
58 | 58 | $progress = ceil( ( $count / $lines ) * 50 ); |
59 | 59 | $this->output( '[' . str_repeat( '=', $progress ) . |
60 | 60 | str_repeat( ' ', 50 - $progress ) . '] ' . |
— | — | @@ -69,10 +69,10 @@ |
70 | 70 | ); |
71 | 71 | $dbw->insert( 'geoip', $record, __METHOD__ ); |
72 | 72 | } |
73 | | - $this->output( "\n" ); |
| 73 | + $this->output( "\n" ); |
74 | 74 | |
75 | 75 | $dbw->commit(); |
76 | | - $this->output( 'Successfully loaded ' . $count . ' geographic IP ranges.' . "\n" ); |
| 76 | + $this->output( 'Successfully loaded ' . $count . ' geographic IP ranges.' . "\n" ); |
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
Index: branches/fundraising/deployment/DonationInterface/GeoIP/GeoIP.php |
— | — | @@ -21,9 +21,9 @@ |
22 | 22 | * @author David Strauss <david@fourkitchens.com> |
23 | 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
24 | 24 | */ |
25 | | - |
| 25 | + |
26 | 26 | // Alert the user that this is not a valid entry point to MediaWiki if they try to access this file directly. |
27 | | -if ( !defined ('MEDIAWIKI' ) ) { |
| 27 | +if ( !defined ( 'MEDIAWIKI' ) ) { |
28 | 28 | echo <<<EOT |
29 | 29 | To install GeoIP extension, put the following line in LocalSettings.php: |
30 | 30 | require_once( "\$IP/extensions/GeoIP/GeoIP.php" ); |
— | — | @@ -56,20 +56,18 @@ |
57 | 57 | class NotFoundGeoIP extends Exception { } |
58 | 58 | |
59 | 59 | function fnGetGeoIP( $ip_address = null ) { |
60 | | - if( !isset( $ip_address ) ) { |
| 60 | + if ( !isset( $ip_address ) ) { |
61 | 61 | $ip_address = IP::sanitizeIP( wfGetIP() ); |
62 | 62 | } |
63 | 63 | |
64 | | - if( isset( $_GET['ip'] ) ) { |
| 64 | + if ( isset( $_GET['ip'] ) ) { |
65 | 65 | $ip_address = IP::sanitizeIP( $_GET['ip'] ); |
66 | 66 | } |
67 | 67 | |
68 | | - if( !IP::isIPv4( $ip_address ) ) { |
| 68 | + if ( !IP::isIPv4( $ip_address ) ) { |
69 | 69 | throw new UnsupportedGeoIP( 'Only IPv4 addresses are supported.' ); |
70 | 70 | } |
71 | 71 | |
72 | | - $country_code = null; |
73 | | - |
74 | 72 | $dbr = wfGetDB( DB_SLAVE ); |
75 | 73 | $long_ip = IP::toUnsigned( $ip_address ); |
76 | 74 | $conditions = array( |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/api_payflowpro_gateway.php |
— | — | @@ -1,43 +1,43 @@ |
2 | | -<?php |
| 2 | +<?php |
3 | 3 | /** |
4 | 4 | * PayflowPro Gateway API extension |
5 | 5 | */ |
6 | | - |
| 6 | + |
7 | 7 | class ApiPayflowProGateway extends ApiBase { |
8 | | - |
| 8 | + |
9 | 9 | /** |
10 | 10 | * An array of valid dispatch methods |
11 | 11 | */ |
12 | 12 | public $validDispatchMethods = array( 'dispatch_get_required_dynamic_form_elements' ); |
13 | | - |
| 13 | + |
14 | 14 | /** |
15 | 15 | * API for PayflowProGateway extension |
16 | | - * |
| 16 | + * |
17 | 17 | * Parameters: |
18 | 18 | * dispatch: A string that maps to an API method. Dispatchable API methods follow the naming convention |
19 | 19 | * dispatch_<requested dispatch method> |
20 | 20 | */ |
21 | 21 | public function execute() { |
22 | 22 | // this is likely not defined because User.php hasn't been loaded, but we need it, so we define it. |
23 | | - if ( !defined( 'EDIT_TOKEN_SUFFIX' )) define( 'EDIT_TOKEN_SUFFIX', '+\\' ); |
24 | | - |
| 23 | + if ( !defined( 'EDIT_TOKEN_SUFFIX' ) ) define( 'EDIT_TOKEN_SUFFIX', '+\\' ); |
| 24 | + |
25 | 25 | // extract and validate the parameters |
26 | | - $params = $this->extractRequestParams(); |
| 26 | + $params = $this->extractRequestParams(); |
27 | 27 | $this->validateParams( $params ); |
28 | | - |
| 28 | + |
29 | 29 | // route 'dispatch' requests to the appropriate method |
30 | | - if ( strlen($params[ 'dispatch' ] )) { |
31 | | - $method = $this->getDispatchMethod( $params[ 'dispatch' ]); |
| 30 | + if ( strlen( $params[ 'dispatch' ] ) ) { |
| 31 | + $method = $this->getDispatchMethod( $params[ 'dispatch' ] ); |
32 | 32 | $this->$method( $params ); |
33 | 33 | } |
34 | 34 | } |
35 | | - |
| 35 | + |
36 | 36 | public function getDescription() { |
37 | 37 | return array( |
38 | 38 | 'Exposes API interaction with the PayflowPro Gateway extension.', |
39 | 39 | ); |
40 | 40 | } |
41 | | - |
| 41 | + |
42 | 42 | public function getAllowedParams() { |
43 | 43 | return array( |
44 | 44 | 'dispatch' => array( |
— | — | @@ -48,12 +48,12 @@ |
49 | 49 | ), |
50 | 50 | ); |
51 | 51 | } |
52 | | - |
| 52 | + |
53 | 53 | public function getParamDescription() { |
54 | 54 | return array( |
55 | 55 | 'dispatch' => 'the API method from which to return data', |
56 | 56 | 'tracking_data' => 'A JSON formatted string of data to insert into contribution_tracking', |
57 | | - ); |
| 57 | + ); |
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
— | — | @@ -61,47 +61,47 @@ |
62 | 62 | * @params array Parameters extracted from $_POST |
63 | 63 | */ |
64 | 64 | public function validateParams( $params ) { |
65 | | - |
| 65 | + |
66 | 66 | /** |
67 | 67 | * If 'dispatch' is specified in the params, make sure the requested dispatch method exists |
68 | | - * |
| 68 | + * |
69 | 69 | * A 'dispatch' method is a string that maps to an API method whose name is dispatch_<requested dispatch method> |
70 | 70 | * so we need to make sure that method actually exists. If not, die with an error. |
71 | 71 | */ |
72 | | - if ( isset( $params[ 'dispatch' ] ) && strlen( $params[ 'dispatch' ] )) { |
| 72 | + if ( isset( $params[ 'dispatch' ] ) && strlen( $params[ 'dispatch' ] ) ) { |
73 | 73 | $method = $this->getDispatchMethod( $params[ 'dispatch' ] ); |
74 | | - if ( !in_array( $method, $this->validDispatchMethods ) || !method_exists( $this, $method )) { |
| 74 | + if ( !in_array( $method, $this->validDispatchMethods ) || !method_exists( $this, $method ) ) { |
75 | 75 | $this->dieUsage( "Invalid dispatch method <<<$method>>> passed to the PayflowPro Gatweay API.", 'unknown_method' ); |
76 | 76 | } |
77 | | - |
| 77 | + |
78 | 78 | // make sure we have tracking data for get_required_dynamic_form_elements |
79 | 79 | if ( strtolower( $params[ 'dispatch' ] ) == 'get_required_dynamic_form_elements' ) { |
80 | | - if ( !isset( $params[ 'tracking_data' ] )) { |
81 | | - $this->dieUsage( "Dispatch method get_required_dynamic_form_elements requires 'tracking_data' parameter.", 'required_param' ); |
| 80 | + if ( !isset( $params[ 'tracking_data' ] ) ) { |
| 81 | + $this->dieUsage( "Dispatch method get_required_dynamic_form_elements requires 'tracking_data' parameter.", 'required_param' ); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
85 | | - |
| 85 | + |
86 | 86 | // Validate tracking data |
87 | | - if ( isset( $params[ 'tracking_data' ] )) { |
| 87 | + if ( isset( $params[ 'tracking_data' ] ) ) { |
88 | 88 | // Make sure tracking data is well formatted JSON |
89 | 89 | $tracking_data = json_decode( $params[ 'tracking_data' ], true ); |
90 | | - |
91 | | - if ( !count( $tracking_data )) { |
92 | | - $this->dieUsage( "Invalid JSON encoded tracking data", 'invalid_tracking'); |
| 90 | + |
| 91 | + if ( !count( $tracking_data ) ) { |
| 92 | + $this->dieUsage( "Invalid JSON encoded tracking data", 'invalid_tracking' ); |
93 | 93 | } |
94 | | - |
| 94 | + |
95 | 95 | // Make sure that url and pageref tracking bits are set |
96 | | - if ( !isset( $tracking_data[ 'pageref' ] ) || !isset( $tracking_data[ 'url' ] )) { |
| 96 | + if ( !isset( $tracking_data[ 'pageref' ] ) || !isset( $tracking_data[ 'url' ] ) ) { |
97 | 97 | $this->dieUsage( "Tracking data requires 'pageref' and 'url' tracking bits.", 'invalid_tracking' ); |
98 | 98 | } |
99 | 99 | } |
100 | 100 | } |
101 | | - |
| 101 | + |
102 | 102 | public function getVersion() { |
103 | | - return __CLASS__ . ': $Id$'; |
| 103 | + return __CLASS__ . ': $Id$'; |
104 | 104 | } |
105 | | - |
| 105 | + |
106 | 106 | /** |
107 | 107 | * Construct the method name for a requested 'dispatch' |
108 | 108 | * @param string The method to dispatch requested in the API call |
— | — | @@ -110,10 +110,10 @@ |
111 | 111 | private function getDispatchMethod( $method ) { |
112 | 112 | return 'dispatch_' . strtolower( $method ); |
113 | 113 | } |
114 | | - |
| 114 | + |
115 | 115 | /** |
116 | 116 | * Get the required dynamic form elements |
117 | | - * |
| 117 | + * |
118 | 118 | * The first time a PayflowProGateway credit card form is loaded, there are |
119 | 119 | * some dynamic elements that also need to be loaded, primarily for CSRF |
120 | 120 | * prevention and tracking data. This will fetch the values for those |
— | — | @@ -121,30 +121,30 @@ |
122 | 122 | */ |
123 | 123 | protected function dispatch_get_required_dynamic_form_elements( $params ) { |
124 | 124 | global $wgPayflowGatewaySalt; |
125 | | - |
| 125 | + |
126 | 126 | // fetch the order_id |
127 | 127 | require_once( 'includes/payflowUser.inc' ); |
128 | 128 | $payflow_data = payflowUser(); |
129 | 129 | $order_id = $payflow_data[ 'order_id' ]; |
130 | | - |
| 130 | + |
131 | 131 | // fetch the CSRF prevention token and set it if it's not already set |
132 | 132 | $token = PayflowProGateway::fnPayflowEditToken( $wgPayflowGatewaySalt ); |
133 | 133 | |
134 | 134 | /** |
135 | 135 | * retrieve and unpack the json encoded string of tracking data |
136 | | - * |
| 136 | + * |
137 | 137 | * it should include two bits: |
138 | 138 | * url => the full url-encoded user-requested URL |
139 | 139 | * pageref => the url-encoded referrer to the full user-requested URL |
140 | | - */ |
141 | | - $tracking_data = $this->parseTrackingData( json_decode( $params[ 'tracking_data' ], true )); |
142 | | - |
| 140 | + */ |
| 141 | + $tracking_data = $this->parseTrackingData( json_decode( $params[ 'tracking_data' ], true ) ); |
| 142 | + |
143 | 143 | // clean up tracking data to make sure everything is set correctly |
144 | 144 | $tracking_data = PayflowProGateway::cleanTrackingData( $tracking_data, true ); |
145 | 145 | |
146 | 146 | // fetch the contribution_tracking_id by inserting tracking data to contrib tracking table |
147 | 147 | $contribution_tracking_id = PayflowProGateway::insertContributionTracking( $tracking_data ); |
148 | | - |
| 148 | + |
149 | 149 | // this try/catch design pattern stolen from ClickTracking/ApiSpecialClickTracking.php |
150 | 150 | try { |
151 | 151 | // add dynamic elements to result object |
— | — | @@ -156,28 +156,28 @@ |
157 | 157 | /* no result */ |
158 | 158 | } |
159 | 159 | } |
160 | | - |
| 160 | + |
161 | 161 | /** |
162 | 162 | * Parse tracking_data param into something meaningful to PayflowPro gateway |
163 | | - * |
| 163 | + * |
164 | 164 | * @param array $tracking_data An array of tracking data - expects 'referrer' and 'url' |
165 | 165 | * @return array of cleaned up, PayflowPro Gateway-consumable tracking data |
166 | 166 | */ |
167 | 167 | protected function parseTrackingData( $unparsed_tracking_data ) { |
168 | 168 | // get the query string from the URL and turn it into an associative array |
169 | | - $url_bits = wfParseUrl( urldecode( $unparsed_tracking_data[ 'url' ] )); |
| 169 | + $url_bits = wfParseUrl( urldecode( $unparsed_tracking_data[ 'url' ] ) ); |
170 | 170 | $tracking_data = wfCgiToArray( $url_bits[ 'query' ] ); |
171 | | - |
| 171 | + |
172 | 172 | // add the referrer to the tracked_data array |
173 | 173 | $tracking_data[ 'referrer' ] = urldecode( $unparsed_tracking_data[ 'pageref' ] ); |
174 | | - |
| 174 | + |
175 | 175 | // ensure the utm_source is formatted correctly |
176 | | - $utm_source_str = ( isset( $tracking_data[ 'utm_source' ] )) ? $tracking_data[ 'utm_source' ] : null; |
177 | | - $utm_source_id = ( isset( $tracking_data[ 'utm_source_id' ] )) ? $tracking_data[ 'utm_source_id' ] : null; |
| 176 | + $utm_source_str = ( isset( $tracking_data[ 'utm_source' ] ) ) ? $tracking_data[ 'utm_source' ] : null; |
| 177 | + $utm_source_id = ( isset( $tracking_data[ 'utm_source_id' ] ) ) ? $tracking_data[ 'utm_source_id' ] : null; |
178 | 178 | $tracking_data[ 'utm_source' ] = PayflowProGateway::getUtmSource( $utm_source_str, $utm_source_id ); |
179 | | - |
| 179 | + |
180 | 180 | return $tracking_data; |
181 | 181 | } |
182 | | - |
183 | | - public function isReadMode(){ return false;} |
| 182 | + |
| 183 | + public function isReadMode() { return false; } |
184 | 184 | } |
\ No newline at end of file |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/validate_input.js |
— | — | @@ -1,14 +1,14 @@ |
2 | 2 | //<![CDATA[ |
3 | | -function addEvent(obj, evType, fn){ |
4 | | - if (obj.addEventListener){ |
5 | | - obj.addEventListener(evType, fn, false); |
6 | | - return true; |
7 | | - } else if (obj.attachEvent){ |
8 | | - var r = obj.attachEvent("on"+evType, fn); |
9 | | - return r; |
10 | | - } else { |
11 | | - return false; |
12 | | - } |
| 3 | +function addEvent(obj, evType, fn){ |
| 4 | + if (obj.addEventListener){ |
| 5 | + obj.addEventListener(evType, fn, false); |
| 6 | + return true; |
| 7 | + } else if (obj.attachEvent){ |
| 8 | + var r = obj.attachEvent("on"+evType, fn); |
| 9 | + return r; |
| 10 | + } else { |
| 11 | + return false; |
| 12 | + } |
13 | 13 | } |
14 | 14 | |
15 | 15 | function getIfSessionSet() { |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\r\n'; |
39 | 39 | } |
40 | 40 | } |
41 | | - |
| 41 | + |
42 | 42 | //set state to "outside us" |
43 | 43 | if ( document.payment.country.value != '840' ) { |
44 | 44 | document.payment.state.value = 'XX'; |
— | — | @@ -55,8 +55,8 @@ |
56 | 56 | if( output ) { |
57 | 57 | alert( output ); |
58 | 58 | return false; |
59 | | - } |
60 | | - |
| 59 | + } |
| 60 | + |
61 | 61 | return true; |
62 | 62 | } |
63 | 63 | |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | |
85 | 85 | function PopupCVV() { |
86 | 86 | cvv = window.open("", 'cvvhelp','scrollbars=yes,resizable=yes,width=600,height=400,left=200,top=100'); |
87 | | - cvv.document.write( payflowproGatewayCVVExplain ); |
| 87 | + cvv.document.write( payflowproGatewayCVVExplain ); |
88 | 88 | cvv.focus(); |
89 | 89 | } |
90 | 90 | |
— | — | @@ -94,5 +94,5 @@ |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | | -window.onfocus = CloseCVV; |
| 98 | +window.onfocus = CloseCVV; |
99 | 99 | //]]> |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class PayflowProGateway extends UnlistedSpecialPage { |
5 | | - |
| 5 | + |
6 | 6 | /** |
7 | 7 | * Defines the action to take on a PFP transaction. |
8 | 8 | * |
9 | | - * Possible values include 'process', 'challenge', |
| 9 | + * Possible values include 'process', 'challenge', |
10 | 10 | * 'review', 'reject'. These values can be set during |
11 | 11 | * data processing validation, for instance. |
12 | 12 | * |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | * @var object |
31 | 31 | */ |
32 | 32 | public $form_class; |
33 | | - |
| 33 | + |
34 | 34 | /** |
35 | 35 | * An array of form errors |
36 | 36 | * @var array |
— | — | @@ -41,8 +41,6 @@ |
42 | 42 | */ |
43 | 43 | public function __construct() { |
44 | 44 | parent::__construct( 'PayflowProGateway' ); |
45 | | - wfLoadExtensionMessages( 'PayflowProGateway' ); |
46 | | - |
47 | 45 | $this->errors = $this->getPossibleErrors(); |
48 | 46 | } |
49 | 47 | |
— | — | @@ -52,14 +50,14 @@ |
53 | 51 | * @param $par Mixed: parameter passed to the page or null |
54 | 52 | */ |
55 | 53 | public function execute( $par ) { |
56 | | - global $wgRequest, $wgOut, $wgUser, $wgScriptPath, |
57 | | - $wgPayFlowProGatewayCSSVersion, $wgPayflowGatewayPaypalURL, |
| 54 | + global $wgRequest, $wgOut, $wgScriptPath, |
| 55 | + $wgPayFlowProGatewayCSSVersion, |
58 | 56 | $wgPayflowGatewaySalt; |
59 | | - |
60 | | - $wgOut->addExtensionStyle( |
61 | | - "{$wgScriptPath}/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.css?284" . |
62 | | - $wgPayFlowProGatewayCSSVersion); |
63 | | - |
| 57 | + |
| 58 | + $wgOut->addExtensionStyle( |
| 59 | + "{$wgScriptPath}/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.css?284" . |
| 60 | + $wgPayFlowProGatewayCSSVersion ); |
| 61 | + |
64 | 62 | $scriptVars = array( |
65 | 63 | 'payflowproGatewayErrorMsgJs' => wfMsg( 'payflowpro_gateway-error-msg-js' ), |
66 | 64 | 'payflowproGatewayErrorMsgEmail' => wfMsg( 'payflowpro_gateway-error-msg-email' ), |
— | — | @@ -76,9 +74,9 @@ |
77 | 75 | 'payflowproGatewayErrorMsgCvv' => wfMsg( 'payflowpro_gateway-error-msg-cvv' ), |
78 | 76 | 'payflowproGatewayCVVExplain' => wfMsg( 'payflowpro_gateway-cvv-explain' ), |
79 | 77 | ); |
80 | | - |
| 78 | + |
81 | 79 | $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) ); |
82 | | - |
| 80 | + |
83 | 81 | // @fixme can this be moved into the form generators? |
84 | 82 | $js = <<<EOT |
85 | 83 | <script type="text/javascript"> |
— | — | @@ -88,40 +86,40 @@ |
89 | 87 | </script> |
90 | 88 | EOT; |
91 | 89 | $wgOut->addHeadItem( 'logolinkoverride', $js ); |
92 | | - |
| 90 | + |
93 | 91 | // find out if amount was a radio button or textbox, set amount |
94 | | - if( isset( $_REQUEST['amount'] ) && preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amount' ) ) ) { |
| 92 | + if ( isset( $_REQUEST['amount'] ) && preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amount' ) ) ) { |
95 | 93 | $amount = $wgRequest->getText( 'amount' ); |
96 | | - } elseif( isset( $_REQUEST['amountGiven'] ) && preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amountGiven' ) ) ) { |
| 94 | + } elseif ( isset( $_REQUEST['amountGiven'] ) && preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amountGiven' ) ) ) { |
97 | 95 | $amount = number_format( $wgRequest->getText( 'amountGiven' ), 2, '.', '' ); |
98 | | - } elseif( isset( $_REQUEST['amount'] ) ) { |
| 96 | + } elseif ( isset( $_REQUEST['amount'] ) ) { |
99 | 97 | $amount = '0.00'; |
100 | | - } elseif( $wgRequest->getText( 'amount' ) == '-1' ) { |
| 98 | + } elseif ( $wgRequest->getText( 'amount' ) == '-1' ) { |
101 | 99 | $amount = $wgRequest->getText( 'amountOther' ); |
102 | 100 | } else { |
103 | 101 | $amount = '0.00'; |
104 | 102 | } |
105 | | - |
| 103 | + |
106 | 104 | // track the number of attempts the user has made |
107 | 105 | $numAttempt = $wgRequest->getVal( 'numAttempt', 0 ); |
108 | 106 | |
109 | | - // Get array of default account values necessary for Payflow |
| 107 | + // Get array of default account values necessary for Payflow |
110 | 108 | require_once( 'includes/payflowUser.inc' ); |
111 | 109 | |
112 | 110 | $payflow_data = payflowUser(); |
113 | | - |
| 111 | + |
114 | 112 | // if _cache_ is requested by the user, do not set a session/token; dynamic data will be loaded via ajax |
115 | 113 | if ( $wgRequest->getText( '_cache_', false ) ) { |
116 | 114 | $cache = true; |
117 | 115 | $token = ''; |
118 | 116 | $token_match = false; |
119 | | - |
| 117 | + |
120 | 118 | // if we have squid caching enabled, set the maxage |
121 | 119 | global $wgUseSquid, $wgPayflowSMaxAge; |
122 | 120 | if ( $wgUseSquid ) $wgOut->setSquidMaxage( $wgPayflowSMaxAge ); |
123 | 121 | } else { |
124 | 122 | $cache = false; |
125 | | - |
| 123 | + |
126 | 124 | // establish the edit token to prevent csrf |
127 | 125 | $token = self::fnPayflowEditToken( $wgPayflowGatewaySalt ); |
128 | 126 | |
— | — | @@ -129,54 +127,54 @@ |
130 | 128 | $token_check = ( $wgRequest->getText( 'token' ) ) ? $wgRequest->getText( 'token' ) : $token; |
131 | 129 | $token_match = $this->fnPayflowMatchEditToken( $token_check, $wgPayflowGatewaySalt ); |
132 | 130 | } |
133 | | - |
| 131 | + |
134 | 132 | $this->setHeaders(); |
135 | | - |
| 133 | + |
136 | 134 | // Populate form data |
137 | 135 | $data = $this->fnGetFormData( $amount, $numAttempt, $token, $payflow_data['order_id'] ); |
138 | | - |
| 136 | + |
139 | 137 | /** |
140 | | - * handle PayPal redirection |
141 | | - * |
| 138 | + * handle PayPal redirection |
| 139 | + * |
142 | 140 | * if paypal redirection is enabled ($wgPayflowGatewayPaypalURL must be defined) |
143 | 141 | * and the PaypalRedirect form value must be true |
144 | 142 | */ |
145 | | - if ( $wgRequest->getBool( 'PaypalRedirect' )) { |
| 143 | + if ( $wgRequest->getBool( 'PaypalRedirect' ) ) { |
146 | 144 | $this->paypalRedirect( $data ); |
147 | 145 | return; |
148 | 146 | } |
149 | | - |
| 147 | + |
150 | 148 | // dispatch forms/handling |
151 | | - if( $token_match ) { |
152 | | - |
153 | | - if( $data['payment_method'] == 'processed' ) { |
154 | | - //increase the count of attempts |
| 149 | + if ( $token_match ) { |
| 150 | + |
| 151 | + if ( $data['payment_method'] == 'processed' ) { |
| 152 | + // increase the count of attempts |
155 | 153 | ++$data['numAttempt']; |
156 | | - |
| 154 | + |
157 | 155 | // Check form for errors and redisplay with messages |
158 | 156 | $form_errors = $this->fnPayflowValidateForm( $data, $this->errors ); |
159 | | - if( $form_errors ) { |
| 157 | + if ( $form_errors ) { |
160 | 158 | $this->fnPayflowDisplayForm( $data, $this->errors ); |
161 | 159 | } else { // The submitted form data is valid, so process it |
162 | | - // allow any external validators to have their way with the data |
163 | | - wfRunHooks( 'PayflowGatewayValidate', array( &$this, &$data )); |
| 160 | + // allow any external validators to have their way with the data |
| 161 | + wfRunHooks( 'PayflowGatewayValidate', array( &$this, &$data ) ); |
164 | 162 | |
165 | 163 | // if the transaction was flagged for review |
166 | 164 | if ( $this->action == 'review' ) { |
167 | 165 | // expose a hook for external handling of trxns flagged for review |
168 | | - wfRunHooks( 'PayflowGatewayReview', array( &$this, &$data )); |
| 166 | + wfRunHooks( 'PayflowGatewayReview', array( &$this, &$data ) ); |
169 | 167 | } |
170 | 168 | |
171 | 169 | // if the transaction was flagged to be 'challenged' |
172 | 170 | if ( $this->action == 'challenge' ) { |
173 | 171 | // expose a hook for external handling of trxns flagged for challenge (eg captcha) |
174 | | - wfRunHooks( 'PayflowGatewayChallenge', array( &$this, &$data )); |
| 172 | + wfRunHooks( 'PayflowGatewayChallenge', array( &$this, &$data ) ); |
175 | 173 | } |
176 | 174 | |
177 | 175 | // if the transaction was flagged for rejection |
178 | 176 | if ( $this->action == 'reject' ) { |
179 | 177 | // expose a hook for external handling of trxns flagged for rejection |
180 | | - wfRunHooks( 'PayflowGatewayReject', array( &$this, &$data )); |
| 178 | + wfRunHooks( 'PayflowGatewayReject', array( &$this, &$data ) ); |
181 | 179 | |
182 | 180 | $this->fnPayflowDisplayDeclinedResults( '' ); |
183 | 181 | $this->fnPayflowUnsetEditToken(); |
— | — | @@ -185,18 +183,18 @@ |
186 | 184 | // if the transaction was flagged for processing |
187 | 185 | if ( $this->action == 'process' ) { |
188 | 186 | // expose a hook for external handling of trxns ready for processing |
189 | | - wfRunHooks( 'PayflowGatewayProcess', array( &$this, &$data )); |
| 187 | + wfRunHooks( 'PayflowGatewayProcess', array( &$this, &$data ) ); |
190 | 188 | $this->fnPayflowProcessTransaction( $data, $payflow_data ); |
191 | 189 | } |
192 | 190 | |
193 | 191 | // expose a hook for any post processing |
194 | | - wfRunHooks( 'PayflowGatewayPostProcess', array( &$this, &$data )); |
| 192 | + wfRunHooks( 'PayflowGatewayPostProcess', array( &$this, &$data ) ); |
195 | 193 | } |
196 | 194 | } else { |
197 | | - //Display form for the first time |
| 195 | + // Display form for the first time |
198 | 196 | $this->fnPayflowDisplayForm( $data, $this->errors ); |
199 | 197 | } |
200 | | - } else { |
| 198 | + } else { |
201 | 199 | if ( !$cache ) { |
202 | 200 | // if we're not caching, there's a token mismatch |
203 | 201 | $this->errors['general']['token-mismatch'] = wfMsg( 'payflowpro_gateway-token-mismatch' ); |
— | — | @@ -214,11 +212,12 @@ |
215 | 213 | * The message at the top of the form can be edited in the payflow_gateway.i18n.php file |
216 | 214 | */ |
217 | 215 | public function fnPayflowDisplayForm( &$data, &$error ) { |
218 | | - global $wgOut, $wgRequest; |
| 216 | + global $wgOut, $wgRequest; |
219 | 217 | |
220 | 218 | // save contrib tracking id early to track abondonment |
221 | | - if ( $data[ 'numAttempt' ] == '0' && ( !$wgRequest->getText( 'utm_source_id', false ) || $wgRequest->getText( '_nocache_' ) == 'true' )) { |
222 | | - if ( !$tracked = $this->fnPayflowSaveContributionTracking( $data ) ) { |
| 219 | + if ( $data[ 'numAttempt' ] == '0' && ( !$wgRequest->getText( 'utm_source_id', false ) || $wgRequest->getText( '_nocache_' ) == 'true' ) ) { |
| 220 | + $tracked = $this->fnPayflowSaveContributionTracking( $data ); |
| 221 | + if ( !$tracked ) { |
223 | 222 | $when = time(); |
224 | 223 | wfDebugLog( 'payflowpro_gateway', 'Unable to save data to the contribution_tracking table ' . $when ); |
225 | 224 | } |
— | — | @@ -235,17 +234,17 @@ |
236 | 235 | * |
237 | 236 | * @param string $class_name The class name of the form to use |
238 | 237 | */ |
239 | | - public function setFormClass( $class_name=NULL ) { |
| 238 | + public function setFormClass( $class_name = NULL ) { |
240 | 239 | if ( !$class_name ) { |
241 | 240 | global $wgRequest, $wgPayflowGatewayDefaultForm; |
242 | 241 | $form_class = $wgRequest->getText( 'form_name', $wgPayflowGatewayDefaultForm ); |
243 | | - |
| 242 | + |
244 | 243 | // make sure our form class exists before going on, if not try loading default form class |
245 | 244 | $class_name = "PayflowProGateway_Form_" . $form_class; |
246 | | - if ( !class_exists( $class_name )) { |
| 245 | + if ( !class_exists( $class_name ) ) { |
247 | 246 | $class_name_orig = $class_name; |
248 | 247 | $class_name = "PayflowProGateway_Form_" . $wgPayflowGatewayDefaultForm; |
249 | | - if ( !class_exists( $class_name )) { |
| 248 | + if ( !class_exists( $class_name ) ) { |
250 | 249 | throw new MWException( 'Could not load form ' . $class_name_orig . ' nor default form ' . $class_name ); |
251 | 250 | } |
252 | 251 | } |
— | — | @@ -262,7 +261,7 @@ |
263 | 262 | * @return string |
264 | 263 | */ |
265 | 264 | public function getFormClass( ) { |
266 | | - if ( !isset( $this->form_class )) { |
| 265 | + if ( !isset( $this->form_class ) ) { |
267 | 266 | $this->setFormClass(); |
268 | 267 | } |
269 | 268 | return $this->form_class; |
— | — | @@ -272,14 +271,12 @@ |
273 | 272 | * Checks posted form data for errors and returns array of messages |
274 | 273 | */ |
275 | 274 | private function fnPayflowValidateForm( $data, &$error ) { |
276 | | - global $wgOut; |
277 | | - |
278 | 275 | // begin with no errors |
279 | 276 | $error_result = '0'; |
280 | 277 | |
281 | 278 | // create the human-speak message for required fields |
282 | 279 | // does not include fields that are not required |
283 | | - $msg = array( |
| 280 | + $msg = array( |
284 | 281 | 'amount' => wfMsg( 'payflowpro_gateway-error-msg-amount' ), |
285 | 282 | 'emailAdd' => wfMsg( 'payflowpro_gateway-error-msg-emailAdd' ), |
286 | 283 | 'fname' => wfMsg( 'payflowpro_gateway-error-msg-fname' ), |
— | — | @@ -293,32 +290,32 @@ |
294 | 291 | 'cvv' => wfMsg( 'payflowpro_gateway-error-msg-cvv' ), |
295 | 292 | ); |
296 | 293 | |
297 | | - // find all empty fields and create message |
298 | | - foreach( $data as $key => $value ) { |
299 | | - if( $value == '' || $data['state'] == 'YY' ) { |
| 294 | + // find all empty fields and create message |
| 295 | + foreach ( $data as $key => $value ) { |
| 296 | + if ( $value == '' || $data['state'] == 'YY' ) { |
300 | 297 | // ignore fields that are not required |
301 | | - if( isset($msg[$key]) ) { |
| 298 | + if ( isset( $msg[$key] ) ) { |
302 | 299 | $error[$key] = "**" . wfMsg( 'payflowpro_gateway-error-msg', $msg[$key] ) . "**<br />"; |
303 | 300 | $error_result = '1'; |
304 | 301 | } |
305 | 302 | } |
306 | 303 | } |
307 | | - |
308 | | - //check amount |
| 304 | + |
| 305 | + // check amount |
309 | 306 | if ( !preg_match( '/^\d+(\.(\d+)?)?$/', $data['amount'] ) || $data['amount'] == "0.00" ) { |
310 | 307 | $error['invalidamount'] = wfMsg( 'payflowpro_gateway-error-msg-invalid-amount' ); |
311 | 308 | $error_result = '1'; |
312 | 309 | } |
313 | | - |
| 310 | + |
314 | 311 | // is email address valid? |
315 | 312 | $isEmail = User::isValidEmailAddr( $data['email'] ); |
316 | 313 | |
317 | 314 | // create error message (supercedes empty field message) |
318 | | - if( !$isEmail ) { |
| 315 | + if ( !$isEmail ) { |
319 | 316 | $error['emailAdd'] = wfMsg( 'payflowpro_gateway-error-msg-email' ); |
320 | 317 | $error_result = '1'; |
321 | 318 | } |
322 | | - |
| 319 | + |
323 | 320 | // validate that credit card number entered is correct for the brand |
324 | 321 | switch( $data['card'] ) { |
325 | 322 | case 'american': |
— | — | @@ -326,7 +323,7 @@ |
327 | 324 | $pattern = '/^3[47][0-9]{13}$/'; |
328 | 325 | |
329 | 326 | // if the pattern doesn't match |
330 | | - if( !preg_match( $pattern, $data['card_num'] ) ) { |
| 327 | + if ( !preg_match( $pattern, $data['card_num'] ) ) { |
331 | 328 | $error_result = '1'; |
332 | 329 | $error['card'] = wfMsg( 'payflowpro_gateway-error-msg-amex' ); |
333 | 330 | } |
— | — | @@ -338,7 +335,7 @@ |
339 | 336 | $pattern = '/^5[1-5][0-9]{14}$/'; |
340 | 337 | |
341 | 338 | // if pattern doesn't match |
342 | | - if( !preg_match( $pattern, $data['card_num'] ) ) { |
| 339 | + if ( !preg_match( $pattern, $data['card_num'] ) ) { |
343 | 340 | $error_result = '1'; |
344 | 341 | $error['card'] = wfMsg( 'payflowpro_gateway-error-msg-mc' ); |
345 | 342 | } |
— | — | @@ -350,29 +347,29 @@ |
351 | 348 | $pattern = '/^4[0-9]{12}(?:[0-9]{3})?$/'; |
352 | 349 | |
353 | 350 | // if pattern doesn't match |
354 | | - if( !preg_match( $pattern, $data['card_num'] ) ) { |
| 351 | + if ( !preg_match( $pattern, $data['card_num'] ) ) { |
355 | 352 | $error_result = '1'; |
356 | 353 | $error['card'] = wfMsg( 'payflowpro_gateway-error-msg-visa' ); |
357 | 354 | } |
358 | 355 | |
359 | 356 | break; |
360 | | - |
| 357 | + |
361 | 358 | case 'discover': |
362 | 359 | // pattern for Discover |
363 | 360 | $pattern = '/^6(?:011|5[0-9]{2})[0-9]{12}$/'; |
364 | 361 | |
365 | 362 | // if pattern doesn't match |
366 | | - if( !preg_match( $pattern, $data['card_num'] ) ) { |
| 363 | + if ( !preg_match( $pattern, $data['card_num'] ) ) { |
367 | 364 | $error_result = '1'; |
368 | 365 | $error['card'] = wfMsg( 'payflowpro_gateway-error-msg-discover' ); |
369 | 366 | } |
370 | 367 | |
371 | 368 | break; |
372 | | - |
373 | | - |
374 | | - |
| 369 | + |
| 370 | + |
| 371 | + |
375 | 372 | } // end switch |
376 | | - |
| 373 | + |
377 | 374 | return $error_result; |
378 | 375 | } |
379 | 376 | |
— | — | @@ -388,7 +385,7 @@ |
389 | 386 | |
390 | 387 | // update contribution tracking |
391 | 388 | $this->updateContributionTracking( $data ); |
392 | | - |
| 389 | + |
393 | 390 | // create payflow query string, include string lengths |
394 | 391 | $queryArray = array( |
395 | 392 | 'TRXTYPE' => $payflow_data['trxtype'], |
— | — | @@ -411,14 +408,14 @@ |
412 | 409 | 'CUSTIP' => $payflow_data['user_ip'], |
413 | 410 | ); |
414 | 411 | |
415 | | - foreach( $queryArray as $name => $value ) { |
| 412 | + foreach ( $queryArray as $name => $value ) { |
416 | 413 | $query[] = $name . '[' . strlen( $value ) . ']=' . $value; |
417 | 414 | } |
418 | 415 | |
419 | 416 | $queryString = implode( '&', $query ); |
420 | 417 | |
421 | 418 | $payflow_query = $queryString; |
422 | | - |
| 419 | + |
423 | 420 | // assign header data necessary for the curl_setopt() function |
424 | 421 | $user_agent = Http::userAgent(); |
425 | 422 | $headers[] = 'Content-Type: text/namevalue'; |
— | — | @@ -426,7 +423,7 @@ |
427 | 424 | $headers[] = 'X-VPS-Client-Timeout: 45'; |
428 | 425 | $headers[] = 'X-VPS-Request-ID:' . $data['order_id']; |
429 | 426 | $ch = curl_init(); |
430 | | - $paypalPostTo = isset ( $wgDonationTestingMode ) ? 'testingurl' : 'paypalurl'; |
| 427 | + $paypalPostTo = isset ( $wgDonationTestingMode ) ? 'testingurl' : 'paypalurl'; |
431 | 428 | curl_setopt( $ch, CURLOPT_URL, $payflow_data[ $paypalPostTo ] ); |
432 | 429 | curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers ); |
433 | 430 | curl_setopt( $ch, CURLOPT_USERAGENT, $user_agent ); |
— | — | @@ -437,7 +434,7 @@ |
438 | 435 | curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); |
439 | 436 | curl_setopt( $ch, CURLOPT_POSTFIELDS, $payflow_query ); |
440 | 437 | curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 2 ); |
441 | | - curl_setopt( $ch, CURLOPT_FORBID_REUSE, true ); |
| 438 | + curl_setopt( $ch, CURLOPT_FORBID_REUSE, true ); |
442 | 439 | curl_setopt( $ch, CURLOPT_POST, 1 ); |
443 | 440 | |
444 | 441 | // set proxy settings if necessary |
— | — | @@ -447,21 +444,21 @@ |
448 | 445 | } |
449 | 446 | |
450 | 447 | // As suggested in the PayPal developer forum sample code, try more than once to get a response |
451 | | - // in case there is a general network issue |
| 448 | + // in case there is a general network issue |
452 | 449 | $i = 1; |
453 | 450 | |
454 | | - while( $i++ <= 3 ) { |
| 451 | + while ( $i++ <= 3 ) { |
455 | 452 | $result = curl_exec( $ch ); |
456 | 453 | $headers = curl_getinfo( $ch ); |
457 | 454 | |
458 | | - if( $headers['http_code'] != 200 && $headers['http_code'] != 403 ) { |
| 455 | + if ( $headers['http_code'] != 200 && $headers['http_code'] != 403 ) { |
459 | 456 | sleep( 5 ); |
460 | | - } elseif( $headers['http_code'] == 200 || $headers['http_code'] == 403 ) { |
| 457 | + } elseif ( $headers['http_code'] == 200 || $headers['http_code'] == 403 ) { |
461 | 458 | break; |
462 | 459 | } |
463 | 460 | } |
464 | 461 | |
465 | | - if( $headers['http_code'] != 200 ) { |
| 462 | + if ( $headers['http_code'] != 200 ) { |
466 | 463 | $wgOut->addHTML( '<h3>No response from credit card processor. Please try again later!</h3><p>' ); |
467 | 464 | $when = time(); |
468 | 465 | wfDebugLog( 'payflowpro_gateway', 'No response from credit card processor ' . $when ); |
— | — | @@ -487,14 +484,13 @@ |
488 | 485 | * Credit: code modified from payflowpro_example_EC.php posted (and supervised) on the PayPal developers message board |
489 | 486 | */ |
490 | 487 | private function fnPayflowGetResults( $data, $result ) { |
491 | | - global $wgOut; |
492 | | - // prepare NVP response for sorting and outputting |
| 488 | + // prepare NVP response for sorting and outputting |
493 | 489 | $responseArray = array(); |
494 | | - |
| 490 | + |
495 | 491 | /** |
496 | 492 | * The result response string looks like: |
497 | 493 | * RESULT=7&PNREF=E79P2C651DC2&RESPMSG=Field format error&HOSTCODE=10747&DUPLICATE=1 |
498 | | - * We want to turn this into an array of key value pairs, so explode on '&' and then |
| 494 | + * We want to turn this into an array of key value pairs, so explode on '&' and then |
499 | 495 | * split up the resulting strings into $key => $value |
500 | 496 | */ |
501 | 497 | $result_arr = explode( "&", $result ); |
— | — | @@ -502,7 +498,7 @@ |
503 | 499 | list( $key, $value ) = preg_split( "/=/", $result_pair ); |
504 | 500 | $responseArray[ $key ] = $value; |
505 | 501 | } |
506 | | - |
| 502 | + |
507 | 503 | // store the response array as an object property for easy retrival/manipulation elsewhere |
508 | 504 | $this->payflow_response = $responseArray; |
509 | 505 | |
— | — | @@ -511,33 +507,32 @@ |
512 | 508 | $resultCode = $responseArray['RESULT']; |
513 | 509 | |
514 | 510 | // initialize response message |
515 | | - $tryAgainResponse = ''; |
516 | 511 | $responseMsg = ''; |
517 | 512 | |
518 | 513 | // interpret result code, return |
519 | 514 | // approved (1), denied (2), try again (3), general error (4) |
520 | 515 | $errorCode = $this->fnPayflowGetResponseMsg( $resultCode, $responseMsg ); |
521 | 516 | // if approved, display results and send transaction to the queue |
522 | | - if( $errorCode == '1' ) { |
| 517 | + if ( $errorCode == '1' ) { |
523 | 518 | $this->fnPayflowDisplayApprovedResults( $data, $responseArray, $responseMsg ); |
524 | 519 | // give user a second chance to enter incorrect data |
525 | | - } elseif( ( $errorCode == '3' ) && ( $data['numAttempt'] < '5' ) ) { |
| 520 | + } elseif ( ( $errorCode == '3' ) && ( $data['numAttempt'] < '5' ) ) { |
526 | 521 | // pass responseMsg as an array key as required by displayForm |
527 | 522 | $this->errors['retryMsg'] = $responseMsg; |
528 | 523 | $this->fnPayflowDisplayForm( $data, $this->errors ); |
529 | 524 | // if declined or if user has already made two attempts, decline |
530 | | - } elseif( ( $errorCode == '2' ) || ( $data['numAttempt'] >= '3' ) ) { |
| 525 | + } elseif ( ( $errorCode == '2' ) || ( $data['numAttempt'] >= '3' ) ) { |
531 | 526 | $this->fnPayflowDisplayDeclinedResults( $responseMsg ); |
532 | | - } elseif( ( $errorCode == '4' ) ) { |
| 527 | + } elseif ( ( $errorCode == '4' ) ) { |
533 | 528 | $this->fnPayflowDisplayOtherResults( $responseMsg ); |
534 | | - } elseif( ( $errorCode == '5' ) ) { |
| 529 | + } elseif ( ( $errorCode == '5' ) ) { |
535 | 530 | $this->fnPayflowDisplayPending( $data, $responseArray, $responseMsg ); |
536 | 531 | } |
537 | 532 | |
538 | 533 | }// end display results |
539 | 534 | |
540 | 535 | /** |
541 | | - * Interpret response code, return |
| 536 | + * Interpret response code, return |
542 | 537 | * 1 if approved |
543 | 538 | * 2 if declined |
544 | 539 | * 3 if invalid data was submitted by user |
— | — | @@ -545,8 +540,7 @@ |
546 | 541 | */ |
547 | 542 | function fnPayflowGetResponseMsg( $resultCode, &$responseMsg ) { |
548 | 543 | $responseMsg = wfMsg( 'payflowpro_gateway-response-default' ); |
549 | | - $errorCode = '0'; |
550 | | - |
| 544 | + |
551 | 545 | switch( $resultCode ) { |
552 | 546 | case '0': |
553 | 547 | $responseMsg = wfMsg( 'payflowpro_gateway-response-0' ); |
— | — | @@ -592,9 +586,9 @@ |
593 | 587 | $responseMsg = wfMsg( 'payflowpro_gateway-response-default' ); |
594 | 588 | $errorCode = '4'; |
595 | 589 | } |
596 | | - |
| 590 | + |
597 | 591 | return $errorCode; |
598 | | - } |
| 592 | + } |
599 | 593 | |
600 | 594 | /** |
601 | 595 | * Display response message to user with submitted user-supplied data |
— | — | @@ -607,9 +601,8 @@ |
608 | 602 | |
609 | 603 | global $wgOut, $wgExternalThankYouPage; |
610 | 604 | $transaction = ''; |
611 | | - $tracked = ''; |
612 | 605 | |
613 | | - // push to ActiveMQ server |
| 606 | + // push to ActiveMQ server |
614 | 607 | // include response message |
615 | 608 | $transaction['response'] = $responseMsg; |
616 | 609 | // include date |
— | — | @@ -619,14 +612,14 @@ |
620 | 613 | $transaction['country_name'] = $countries[$data['country']]; |
621 | 614 | $transaction['country_code'] = $data['country']; |
622 | 615 | // put all data into one array |
623 | | - $optout = $this->determineOptOut($data); |
| 616 | + $optout = $this->determineOptOut( $data ); |
624 | 617 | $data[ 'anonymous' ] = $optout[ 'anonymous' ]; |
625 | 618 | $data[ 'optout' ] = $optout[ 'optout' ]; |
626 | 619 | $transaction += array_merge( $data, $responseArray ); |
627 | | - |
| 620 | + |
628 | 621 | /** |
629 | 622 | * hook to call stomp functions |
630 | | - * |
| 623 | + * |
631 | 624 | * Sends transaction to Stomp-based queueing service, |
632 | 625 | * eg ActiveMQ |
633 | 626 | */ |
— | — | @@ -638,7 +631,7 @@ |
639 | 632 | // display response message |
640 | 633 | $wgOut->addHTML( '<h3 class="response_message">' . $responseMsg . '</h3>' ); |
641 | 634 | |
642 | | - // translate country code into text |
| 635 | + // translate country code into text |
643 | 636 | $countries = countryCodes(); |
644 | 637 | |
645 | 638 | $rows = array( |
— | — | @@ -669,7 +662,7 @@ |
670 | 663 | |
671 | 664 | // display response message |
672 | 665 | $wgOut->addHTML( '<h3 class="response_message">' . $declinedDefault . ' ' . $responseMsg . '</h3>' ); |
673 | | - |
| 666 | + |
674 | 667 | // unset edit token |
675 | 668 | $this->fnPayflowUnsetEditToken(); |
676 | 669 | } |
— | — | @@ -687,17 +680,17 @@ |
688 | 681 | |
689 | 682 | // display response message |
690 | 683 | $wgOut->addHTML( '<h3 class="response_message">' . $declinedDefault . ' ' . $responseMsg . '</h3>' ); |
691 | | - |
| 684 | + |
692 | 685 | // unset edit token |
693 | 686 | $this->fnPayflowUnsetEditToken(); |
694 | 687 | } |
695 | | - |
| 688 | + |
696 | 689 | function fnPayflowDisplayPending( $data, $responseArray, $responseMsg ) { |
697 | 690 | global $wgOut; |
698 | | - |
| 691 | + |
699 | 692 | $transaction = ''; |
700 | 693 | |
701 | | - // push to ActiveMQ server |
| 694 | + // push to ActiveMQ server |
702 | 695 | // include response message |
703 | 696 | $transaction['response'] = $responseMsg; |
704 | 697 | // include date |
— | — | @@ -721,20 +714,20 @@ |
722 | 715 | // unset edit token |
723 | 716 | $this->fnPayflowUnsetEditToken(); |
724 | 717 | } |
725 | | - |
| 718 | + |
726 | 719 | /** |
727 | 720 | * Determine proper opt-out settings for contribution tracking |
728 | | - * |
| 721 | + * |
729 | 722 | * because the form elements for comment anonymization and email opt-out |
730 | 723 | * are backwards (they are really opt-in) relative to contribution_tracking |
731 | 724 | * (which is opt-out), we need to reverse the values |
732 | 725 | */ |
733 | 726 | public static function determineOptOut( $data ) { |
734 | | - $optout[ 'optout' ] = ( isset( $data[ 'email-opt' ]) && $data[ 'email-opt' ] == "1" ) ? '0' : '1'; |
735 | | - $optout[ 'anonymous' ] = ( isset( $data[ 'comment-option' ]) && $data[ 'comment-option' ] == "1" ) ? '0' : '1'; |
| 727 | + $optout[ 'optout' ] = ( isset( $data[ 'email-opt' ] ) && $data[ 'email-opt' ] == "1" ) ? '0' : '1'; |
| 728 | + $optout[ 'anonymous' ] = ( isset( $data[ 'comment-option' ] ) && $data[ 'comment-option' ] == "1" ) ? '0' : '1'; |
736 | 729 | return $optout; |
737 | 730 | } |
738 | | - |
| 731 | + |
739 | 732 | function fnPayflowSaveContributionTracking( &$data ) { |
740 | 733 | // determine opt-out settings |
741 | 734 | $optout = self::determineOptOut( $data ); |
— | — | @@ -753,87 +746,87 @@ |
754 | 747 | |
755 | 748 | // insert tracking data and get the tracking id |
756 | 749 | $data['contribution_tracking_id'] = self::insertContributionTracking( $tracked_contribution ); |
757 | | - |
758 | | - if ( !$data[ 'contribution_tracking_id' ]) { |
| 750 | + |
| 751 | + if ( !$data[ 'contribution_tracking_id' ] ) { |
759 | 752 | return false; |
760 | 753 | } |
761 | 754 | return true; |
762 | 755 | } |
763 | | - |
| 756 | + |
764 | 757 | /** |
765 | 758 | * Insert a record into the contribution_tracking table |
766 | | - * |
| 759 | + * |
767 | 760 | * @param array $tracking_data The array of tracking data to insert to contribution_tracking |
768 | 761 | * NOTE: this should probably be run thru self::cleanTrackingData to ensure data integrity |
769 | 762 | * @return mixed Contribution tracking ID or false on failure |
770 | 763 | */ |
771 | 764 | public static function insertContributionTracking( $tracking_data ) { |
772 | 765 | $db = payflowGatewayConnection(); |
773 | | - |
774 | | - if (!$db) { return false; } |
775 | 766 | |
| 767 | + if ( !$db ) { return false; } |
| 768 | + |
776 | 769 | // set the time stamp if it's not already set |
777 | | - if ( !isset( $tracking_data[ 'ts' ] ) || !strlen( $tracking_data[ 'ts' ] )) { |
| 770 | + if ( !isset( $tracking_data[ 'ts' ] ) || !strlen( $tracking_data[ 'ts' ] ) ) { |
778 | 771 | $tracking_data[ 'ts' ] = $db->timestamp(); |
779 | 772 | } |
780 | | - |
| 773 | + |
781 | 774 | // Store the contribution data |
782 | | - if ($db->insert( 'contribution_tracking', $tracking_data )) { |
| 775 | + if ( $db->insert( 'contribution_tracking', $tracking_data ) ) { |
783 | 776 | return $db->insertId(); |
784 | | - } else { |
785 | | - return false; |
786 | | - } |
| 777 | + } else { |
| 778 | + return false; |
| 779 | + } |
787 | 780 | } |
788 | | - |
| 781 | + |
789 | 782 | /** |
790 | 783 | * Clean array of tracking data to contain valid fields |
791 | | - * |
792 | | - * Compares tracking data array to list of valid tracking fields and |
| 784 | + * |
| 785 | + * Compares tracking data array to list of valid tracking fields and |
793 | 786 | * removes any extra tracking fields/data. Also sets empty values to |
794 | 787 | * 'null' values. |
795 | 788 | * @param array $tracking_data |
796 | 789 | * @param bool $clean_opouts If true, form opt-out values will be run through $this->determineOptOut |
797 | 790 | * for cleanup. |
798 | 791 | */ |
799 | | - public static function cleanTrackingData( $tracking_data, $clean_optouts=false ) { |
| 792 | + public static function cleanTrackingData( $tracking_data, $clean_optouts = false ) { |
800 | 793 | // clean up the optout values if necessary |
801 | 794 | if ( $clean_optouts ) { |
802 | 795 | $optouts = self::determineOptOut( $tracking_data ); |
803 | 796 | $tracking_data[ 'optout' ] = $optouts[ 'optout' ]; |
804 | 797 | $tracking_data[ 'anonymous' ] = $optouts[ 'anonymous' ]; |
805 | 798 | } |
806 | | - |
| 799 | + |
807 | 800 | // define valid tracking fields |
808 | | - $tracking_fields = array( |
809 | | - 'note', |
810 | | - 'referrer', |
811 | | - 'anonymous', |
812 | | - 'utm_source', |
813 | | - 'utm_medium', |
814 | | - 'utm_campaign', |
815 | | - 'optout', |
816 | | - 'language', |
| 801 | + $tracking_fields = array( |
| 802 | + 'note', |
| 803 | + 'referrer', |
| 804 | + 'anonymous', |
| 805 | + 'utm_source', |
| 806 | + 'utm_medium', |
| 807 | + 'utm_campaign', |
| 808 | + 'optout', |
| 809 | + 'language', |
817 | 810 | 'ts' |
818 | 811 | ); |
819 | | - |
| 812 | + |
820 | 813 | // loop through tracking data and clean it up |
821 | | - foreach ($tracking_data as $key => $value) { |
| 814 | + foreach ( $tracking_data as $key => $value ) { |
822 | 815 | // Make sure we only have valid fields |
823 | | - if( !in_array( $key, $tracking_fields )) { |
824 | | - unset( $tracking_data[ $key ]); |
| 816 | + if ( !in_array( $key, $tracking_fields ) ) { |
| 817 | + unset( $tracking_data[ $key ] ); |
825 | 818 | } |
826 | | - |
827 | | - // Make all empty strings NULL |
828 | | - if ( !strlen( $value )) { |
| 819 | + |
| 820 | + // Make all empty strings NULL |
| 821 | + if ( !strlen( $value ) ) { |
829 | 822 | $tracking_data[$key] = null; |
830 | 823 | } |
831 | 824 | } |
832 | | - |
| 825 | + |
833 | 826 | return $tracking_data; |
834 | 827 | } |
835 | | - |
| 828 | + |
836 | 829 | function fnPayflowReturnCurrencies() { |
837 | | - |
| 830 | + |
838 | 831 | $payflowCurrencies = array( |
839 | 832 | 'GBP' => 'GBP: British Pound', |
840 | 833 | 'EUR' => 'EUR: Euro', |
— | — | @@ -841,38 +834,38 @@ |
842 | 835 | 'AUD' => 'AUD: Australian Dollar', |
843 | 836 | 'CAD' => 'CAD: Canadian Dollar', |
844 | 837 | 'JPY' => 'JPY: Japanese Yen', |
845 | | - ); |
846 | | - |
| 838 | + ); |
| 839 | + |
847 | 840 | return $payflowCurrencies; |
848 | 841 | } |
849 | | - |
| 842 | + |
850 | 843 | /** |
851 | 844 | * Establish an 'edit' token to help prevent CSRF, etc |
852 | 845 | * |
853 | 846 | * We use this in place of $wgUser->editToken() b/c currently |
854 | | - * $wgUser->editToken() is broken (apparently by design) for |
855 | | - * anonymous users. Using $wgUser->editToken() currently exposes |
856 | | - * a security risk for non-authenticated users. Until this is |
| 847 | + * $wgUser->editToken() is broken (apparently by design) for |
| 848 | + * anonymous users. Using $wgUser->editToken() currently exposes |
| 849 | + * a security risk for non-authenticated users. Until this is |
857 | 850 | * resolved in $wgUser, we'll use our own methods for token |
858 | 851 | * handling. |
859 | 852 | * |
860 | 853 | * @var mixed $salt |
861 | 854 | * @return string |
862 | 855 | */ |
863 | | - public static function fnPayflowEditToken( $salt='' ) { |
864 | | - |
| 856 | + public static function fnPayflowEditToken( $salt = '' ) { |
| 857 | + |
865 | 858 | // make sure we have a session open for tracking a CSRF-prevention token |
866 | 859 | self::fnPayflowEnsureSession(); |
867 | | - |
868 | | - if ( !isset( $_SESSION[ 'payflowEditToken' ] )) { |
869 | | - //generate unsalted token to place in the session |
| 860 | + |
| 861 | + if ( !isset( $_SESSION[ 'payflowEditToken' ] ) ) { |
| 862 | + // generate unsalted token to place in the session |
870 | 863 | $token = self::fnPayflowGenerateToken(); |
871 | 864 | $_SESSION[ 'payflowEditToken' ] = $token; |
872 | 865 | } else { |
873 | 866 | $token = $_SESSION[ 'payflowEditToken' ]; |
874 | 867 | } |
875 | | - |
876 | | - if ( is_array( $salt )) { |
| 868 | + |
| 869 | + if ( is_array( $salt ) ) { |
877 | 870 | $salt = implode( "|", $salt ); |
878 | 871 | } |
879 | 872 | return md5( $token . $salt ) . EDIT_TOKEN_SUFFIX; |
— | — | @@ -880,11 +873,11 @@ |
881 | 874 | |
882 | 875 | /** |
883 | 876 | * Generate a token string |
884 | | - * |
| 877 | + * |
885 | 878 | * @var mixed $salt |
886 | 879 | * @return string |
887 | 880 | */ |
888 | | - public static function fnPayflowGenerateToken( $salt='' ) { |
| 881 | + public static function fnPayflowGenerateToken( $salt = '' ) { |
889 | 882 | $token = dechex( mt_rand() ) . dechex( mt_rand() ); |
890 | 883 | return md5( $token . $salt ); |
891 | 884 | } |
— | — | @@ -896,7 +889,7 @@ |
897 | 890 | * @var mixed $salt |
898 | 891 | * @return bool |
899 | 892 | */ |
900 | | - function fnPayflowMatchEditToken( $val, $salt='' ) { |
| 893 | + function fnPayflowMatchEditToken( $val, $salt = '' ) { |
901 | 894 | // fetch a salted version of the session token |
902 | 895 | $sessionToken = self::fnPayflowEditToken( $salt ); |
903 | 896 | if ( $val != $sessionToken ) { |
— | — | @@ -915,7 +908,7 @@ |
916 | 909 | /** |
917 | 910 | * Ensure that we have a session set for the current user |
918 | 911 | * |
919 | | - * If we do not have a session set for the current user, |
| 912 | + * If we do not have a session set for the current user, |
920 | 913 | * start the session. |
921 | 914 | */ |
922 | 915 | public static function fnPayflowEnsureSession() { |
— | — | @@ -934,7 +927,7 @@ |
935 | 928 | */ |
936 | 929 | public function fnGetFormData( $amount, $numAttempt, $token, $order_id ) { |
937 | 930 | global $wgPayflowGatewayTest, $wgRequest; |
938 | | - |
| 931 | + |
939 | 932 | // if we're in testing mode and an action hasn't yet be specified, prepopulate the form |
940 | 933 | if ( !$wgRequest->getText( 'action', false ) && !$numAttempt && $wgPayflowGatewayTest ) { |
941 | 934 | // define arrays of cc's and cc #s for random selection |
— | — | @@ -965,11 +958,11 @@ |
966 | 959 | 'country' => 840, |
967 | 960 | 'card' => $cards[ $card_index ], |
968 | 961 | 'card_num' => $card_nums[ $cards[ $card_index ]][ $card_num_index ], |
969 | | - 'expiration' => date( 'my', strtotime( '+1 year 1 month' )), |
| 962 | + 'expiration' => date( 'my', strtotime( '+1 year 1 month' ) ), |
970 | 963 | 'cvv' => '001', |
971 | 964 | 'currency' => 'USD', |
972 | 965 | 'payment_method' => $wgRequest->getText( 'payment_method' ), |
973 | | - 'order_id' => $order_id, |
| 966 | + 'order_id' => $order_id, |
974 | 967 | 'numAttempt' => $numAttempt, |
975 | 968 | 'referrer' => 'http://www.baz.test.com/index.php?action=foo&action=bar', |
976 | 969 | 'utm_source' => self::getUtmSource(), |
— | — | @@ -1007,16 +1000,16 @@ |
1008 | 1001 | 'payment_method' => $wgRequest->getText( 'payment_method' ), |
1009 | 1002 | 'order_id' => $order_id, |
1010 | 1003 | 'numAttempt' => $numAttempt, |
1011 | | - 'referrer' => ( $wgRequest->getVal( 'referrer' )) ? $wgRequest->getVal( 'referrer' ) : $wgRequest->getHeader( 'referer' ), |
| 1004 | + 'referrer' => ( $wgRequest->getVal( 'referrer' ) ) ? $wgRequest->getVal( 'referrer' ) : $wgRequest->getHeader( 'referer' ), |
1012 | 1005 | 'utm_source' => self::getUtmSource(), |
1013 | 1006 | 'utm_medium' => $wgRequest->getText( 'utm_medium' ), |
1014 | 1007 | 'utm_campaign' => $wgRequest->getText( 'utm_campaign' ), |
1015 | 1008 | // try to honr the user-set language (uselang), otherwise the language set in the URL (language) |
1016 | | - 'language' => $wgRequest->getText( 'uselang', $wgRequest->getText( 'language' )), |
| 1009 | + 'language' => $wgRequest->getText( 'uselang', $wgRequest->getText( 'language' ) ), |
1017 | 1010 | 'comment' => $wgRequest->getText( 'comment' ), |
1018 | 1011 | 'comment-option' => $wgRequest->getText( 'comment-option' ), |
1019 | 1012 | 'email-opt' => $wgRequest->getText( 'email-opt' ), |
1020 | | - 'test_string' => $wgRequest->getText( 'process' ), //for showing payflow string during testing |
| 1013 | + 'test_string' => $wgRequest->getText( 'process' ), // for showing payflow string during testing |
1021 | 1014 | 'token' => $token, |
1022 | 1015 | 'contribution_tracking_id' => $wgRequest->getText( 'contribution_tracking_id' ), |
1023 | 1016 | 'data_hash' => $wgRequest->getText( 'data_hash' ), |
— | — | @@ -1062,50 +1055,50 @@ |
1063 | 1056 | * we try to figure it out from the request object |
1064 | 1057 | * @return string The full utm_source |
1065 | 1058 | */ |
1066 | | - public static function getUtmSource( $utm_source=null, $utm_source_id=null ) { |
| 1059 | + public static function getUtmSource( $utm_source = null, $utm_source_id = null ) { |
1067 | 1060 | global $wgRequest; |
1068 | 1061 | |
1069 | 1062 | /** |
1070 | 1063 | * fetch whatever was passed in as the utm_source |
1071 | | - * |
| 1064 | + * |
1072 | 1065 | * if utm_source was not passed in as a param, we try to divine it from |
1073 | 1066 | * the request. if it's not set there, no big deal, we'll just be |
1074 | 1067 | * missing some tracking data. |
1075 | | - */ |
1076 | | - if ( is_null( $utm_source )) { |
| 1068 | + */ |
| 1069 | + if ( is_null( $utm_source ) ) { |
1077 | 1070 | $utm_source = $wgRequest->getText( 'utm_source' ); |
1078 | 1071 | } |
1079 | | - |
| 1072 | + |
1080 | 1073 | /** |
1081 | 1074 | * if we have a utm_source_id, then the user is on a single-step credit card form. |
1082 | | - * if that's the case, we treat the single-step credit card form as a landing page, |
| 1075 | + * if that's the case, we treat the single-step credit card form as a landing page, |
1083 | 1076 | * which we label as cc#, where # = the utm_source_id |
1084 | 1077 | */ |
1085 | | - if ( is_null( $utm_source_id )) { |
| 1078 | + if ( is_null( $utm_source_id ) ) { |
1086 | 1079 | $utm_source_id = $wgRequest->getVal( 'utm_source_id', 0 ); |
1087 | 1080 | } |
1088 | | - |
| 1081 | + |
1089 | 1082 | // this is how the CC portion of the utm_source should be defined |
1090 | 1083 | $correct_cc_source = ( $utm_source_id ) ? 'cc' . $utm_source_id . '.cc' : 'cc'; |
1091 | | - |
| 1084 | + |
1092 | 1085 | // check to see if the utm_source is already correct - if so, return |
1093 | | - if ( preg_match('/' . str_replace( ".", "\.", $correct_cc_source ) . '$/', $utm_source)) { |
| 1086 | + if ( preg_match( '/' . str_replace( ".", "\.", $correct_cc_source ) . '$/', $utm_source ) ) { |
1094 | 1087 | return $utm_source; |
1095 | 1088 | } |
1096 | | - |
| 1089 | + |
1097 | 1090 | // split the utm_source into its parts for easier manipulation |
1098 | 1091 | $source_parts = explode( ".", $utm_source ); |
1099 | | - |
| 1092 | + |
1100 | 1093 | // if there are no sourceparts element, then the banner portion of the string needs to be set. |
1101 | 1094 | // since we don't know what it is, set it to an empty string |
1102 | | - if ( !count( $source_parts )) $source_parts[0] = ''; |
1103 | | - |
1104 | | - // if the utm_source_id is set, set the landing page portion of the string to cc# |
1105 | | - $source_parts[1] = ( $utm_source_id ) ? 'cc' . $utm_source_id : ( isset( $source_parts[1] ) ? $source_parts[1] : ''); |
1106 | | - |
| 1095 | + if ( !count( $source_parts ) ) $source_parts[0] = ''; |
| 1096 | + |
| 1097 | + // if the utm_source_id is set, set the landing page portion of the string to cc# |
| 1098 | + $source_parts[1] = ( $utm_source_id ) ? 'cc' . $utm_source_id : ( isset( $source_parts[1] ) ? $source_parts[1] : '' ); |
| 1099 | + |
1107 | 1100 | // the payment instrument portion should always be 'cc' if this method is being accessed |
1108 | | - $source_parts[2] = 'cc'; |
1109 | | - |
| 1101 | + $source_parts[2] = 'cc'; |
| 1102 | + |
1110 | 1103 | // return a reconstructed string |
1111 | 1104 | return implode( ".", $source_parts ); |
1112 | 1105 | } |
— | — | @@ -1116,23 +1109,23 @@ |
1117 | 1110 | * @param array $data Form data |
1118 | 1111 | * @param bool $force If set to true, will ensure that contribution tracking is updated |
1119 | 1112 | */ |
1120 | | - public function updateContributionTracking( &$data, $force=false ) { |
1121 | | - // ony update contrib tracking if we're coming from a single-step landing page |
| 1113 | + public function updateContributionTracking( &$data, $force = false ) { |
| 1114 | + // ony update contrib tracking if we're coming from a single-step landing page |
1122 | 1115 | // which we know with cc# in utm_source or if force=true or if contribution_tracking_id is not set |
1123 | | - if ( !$force && |
1124 | | - !preg_match( "/cc[0-9]/", $data[ 'utm_source' ] ) && |
1125 | | - $data[ 'contribution_tracking_id' ] ) { |
| 1116 | + if ( !$force && |
| 1117 | + !preg_match( "/cc[0-9]/", $data[ 'utm_source' ] ) && |
| 1118 | + is_numeric( $data[ 'contribution_tracking_id' ] ) ) { |
1126 | 1119 | return; |
1127 | 1120 | } |
1128 | 1121 | |
1129 | | - |
| 1122 | + |
1130 | 1123 | // determine opt-out settings |
1131 | 1124 | $optout = self::determineOptOut( $data ); |
1132 | | - |
| 1125 | + |
1133 | 1126 | $db = payflowGatewayConnection(); |
1134 | | - |
1135 | | - if (!$db) { return true ; } |
1136 | 1127 | |
| 1128 | + if ( !$db ) { return true ; } |
| 1129 | + |
1137 | 1130 | $tracked_contribution = array( |
1138 | 1131 | 'note' => $data['comment'], |
1139 | 1132 | 'referrer' => $data['referrer'], |
— | — | @@ -1143,39 +1136,39 @@ |
1144 | 1137 | 'optout' => $optout[ 'optout' ], |
1145 | 1138 | 'language' => $data['language'], |
1146 | 1139 | ); |
1147 | | - |
| 1140 | + |
1148 | 1141 | // Make all empty strings NULL |
1149 | | - foreach ($tracked_contribution as $key => $value) { |
1150 | | - if ($value === '') { |
| 1142 | + foreach ( $tracked_contribution as $key => $value ) { |
| 1143 | + if ( $value === '' ) { |
1151 | 1144 | $tracked_contribution[$key] = null; |
1152 | 1145 | } |
1153 | 1146 | } |
1154 | | - |
| 1147 | + |
1155 | 1148 | // if contrib tracking id is not already set, we need to insert the data, otherwise update |
1156 | 1149 | if ( !$data[ 'contribution_tracking_id' ] ) { |
1157 | 1150 | $data[ 'contribution_tracking_id' ] = $this->insertContributionTracking( $tracked_contribution ); |
1158 | 1151 | } else { |
1159 | | - $db->update( 'contribution_tracking', $tracked_contribution, array( 'id' => $data[ 'contribution_tracking_id' ] )); |
| 1152 | + $db->update( 'contribution_tracking', $tracked_contribution, array( 'id' => $data[ 'contribution_tracking_id' ] ) ); |
1160 | 1153 | } |
1161 | 1154 | } |
1162 | | - |
| 1155 | + |
1163 | 1156 | /** |
1164 | 1157 | * Handle redirection of form content to PayPal |
1165 | | - * |
| 1158 | + * |
1166 | 1159 | * @fixme If we can update contrib tracking table in ContributionTracking |
1167 | 1160 | * extension, we can probably get rid of this method and just submit the form |
1168 | 1161 | * directly to the paypal URL, and have all processing handled by ContributionTracking |
1169 | 1162 | * This would make this a lot less hack-ish |
1170 | 1163 | */ |
1171 | 1164 | public function paypalRedirect( &$data ) { |
1172 | | - global $wgOut, $wgPayflowGatewayPaypalURL; |
1173 | | - |
1174 | | - // if we don't have a URL enabled throw a graceful error to the user |
1175 | | - if ( !strlen( $wgPayflowGatewayPaypalURL )) { |
| 1165 | + global $wgPayflowGatewayPaypalURL, $wgPayflowGatewayTest; |
| 1166 | + |
| 1167 | + // if we don't have a URL enabled throw a graceful error to the user |
| 1168 | + if ( !strlen( $wgPayflowGatewayPaypalURL ) ) { |
1176 | 1169 | $this->errors['general'][ 'nopaypal' ] = wfMsg( 'payflow_gateway-error-msg-nopaypal' ); |
1177 | 1170 | return; |
1178 | 1171 | } |
1179 | | - |
| 1172 | + |
1180 | 1173 | // update the utm source to set the payment instrument to pp rather than cc |
1181 | 1174 | $utm_source_parts = explode( ".", $data[ 'utm_source' ] ); |
1182 | 1175 | $utm_source_parts[2] = 'pp'; |
— | — | @@ -1185,17 +1178,24 @@ |
1186 | 1179 | * update contribution tracking |
1187 | 1180 | */ |
1188 | 1181 | $this->updateContributionTracking( $data, true ); |
1189 | | - |
| 1182 | + |
1190 | 1183 | $wgPayflowGatewayPaypalURL .= "/" . $data[ 'language' ] . "?gateway=paypal"; |
1191 | 1184 | |
1192 | | - $output = '<form method="post" name="paypalredirect" action="' . $wgPayflowGatewayPaypalURL . '">'; |
1193 | | - foreach ( $data as $key => $value ) { |
1194 | | - $output .= '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($value) . '" />'; |
| 1185 | + // submit the data to the paypal redirect URL |
| 1186 | + $ch = curl_init(); |
| 1187 | + curl_setopt( $ch, CURLOPT_URL, $wgPayflowGatewayPaypalURL ); |
| 1188 | + curl_setopt( $ch, CURLOPT_USERAGENT, 'Donation_Interface PayflowPro Gateway PayPal Redirecter 1.0' ); |
| 1189 | + curl_setopt( $ch, CURLOPT_POST, count( $data ) ); |
| 1190 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $data ) ); |
| 1191 | + if ( $wgPayflowGatewayTest ) curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false ); |
| 1192 | + $curl_result = curl_exec( $ch ); |
| 1193 | + $curl_error = ( !$curl_result ) ? curl_error( $ch ) : null; |
| 1194 | + curl_close( $ch ); |
| 1195 | + |
| 1196 | + // throw an exception if there was a curl error |
| 1197 | + if ( !is_null( $curl_error ) ) { |
| 1198 | + throw new MWException( 'There was a cURL error submitting information to ' . $wgPayflowGatewayPaypalURL . ': ' . $curl_error ); |
1195 | 1199 | } |
1196 | 1200 | |
1197 | | - $wgOut->addHTML( $output ); |
1198 | | - |
1199 | | - // Automatically post the form if the user has Javascript support |
1200 | | - $wgOut->addHTML( '<script type="text/javascript">document.paypalredirect.submit();</script>' ); |
1201 | 1201 | } |
1202 | | -} // end class |
\ No newline at end of file |
| 1202 | +} // end class |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/custom_filters.body.php |
— | — | @@ -4,14 +4,14 @@ |
5 | 5 | /** |
6 | 6 | * A value for tracking the 'riskiness' of a transaction |
7 | 7 | * |
8 | | - * The action to take based on a transaction's riskScore is determined by |
| 8 | + * The action to take based on a transaction's riskScore is determined by |
9 | 9 | * $action_ranges. This is built assuming a range of possible risk scores |
10 | 10 | * as 0-100, although you can probably bend this as needed. |
11 | 11 | * @var public int |
12 | 12 | */ |
13 | 13 | public $risk_score; |
14 | 14 | |
15 | | - /** |
| 15 | + /** |
16 | 16 | * Define the action to take for a given $risk_score |
17 | 17 | * @var public array |
18 | 18 | */ |
— | — | @@ -45,8 +45,8 @@ |
46 | 46 | |
47 | 47 | // load user action ranges and risk score |
48 | 48 | global $wgPayflowGatewayCustomFiltersActionRanges, $wgPayflowGatewayCustomFiltersRiskScore; |
49 | | - if ( isset( $wgPayflowGatewayCustomFiltersActionRanges )) $this->action_ranges = $wgPayflowGatewayCustomFiltersActionRanges; |
50 | | - if ( isset( $wgPayflowGatewayCustomFiltersRiskScore )) $this->risk_score = $wgPayflowGatewayCustomFiltersRiskScore; |
| 49 | + if ( isset( $wgPayflowGatewayCustomFiltersActionRanges ) ) $this->action_ranges = $wgPayflowGatewayCustomFiltersActionRanges; |
| 50 | + if ( isset( $wgPayflowGatewayCustomFiltersRiskScore ) ) $this->risk_score = $wgPayflowGatewayCustomFiltersRiskScore; |
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
— | — | @@ -59,8 +59,8 @@ |
60 | 60 | if ( $this->risk_score < 0 ) $this->risk_score = 0; |
61 | 61 | if ( $this->risk_score > 100 ) $this->risk_score = 100; |
62 | 62 | |
63 | | - foreach ( $this->action_ranges as $action => $range ) { |
64 | | - if ( $this->risk_score >= $range[0] && $this->risk_score <= $range[1] ) { |
| 63 | + foreach ( $this->action_ranges as $action => $range ) { |
| 64 | + if ( $this->risk_score >= $range[0] && $this->risk_score <= $range[1] ) { |
65 | 65 | return $action; |
66 | 66 | } |
67 | 67 | } |
— | — | @@ -71,10 +71,10 @@ |
72 | 72 | */ |
73 | 73 | public function validate() { |
74 | 74 | // expose a hook for custom filters |
75 | | - wfRunHooks( 'PayflowGatewayCustomFilter', array( &$this )); |
| 75 | + wfRunHooks( 'PayflowGatewayCustomFilter', array( &$this ) ); |
76 | 76 | $this->gateway_object->action = $this->determineAction(); |
77 | 77 | |
78 | | - $log_msg = '"' . $this->gateway_object->action . "\"\t\"" . $this->risk_score . "\""; |
| 78 | + $log_msg = '"' . $this->gateway_object->action . "\"\t\"" . $this->risk_score . "\""; |
79 | 79 | $this->log( $this->gateway_data['contribution_tracking_id'], 'Filtered', $log_msg ); |
80 | 80 | return TRUE; |
81 | 81 | } |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/custom_filters.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | * Provides a unified way to define and run custom filters for incoming transactions |
5 | 5 | * |
6 | 6 | * Running filters through 'custom filters' rather than directly through the validate hook in the gateway |
7 | | - * offers the advantage of simplifying the passage of relvent data between filters/validators that's |
| 7 | + * offers the advantage of simplifying the passage of relvent data between filters/validators that's |
8 | 8 | * needed to perform more complex validation/filtering of transactions. |
9 | 9 | * |
10 | 10 | * The actual filters themselves are regular MW extensions and can optional be organized in filters/ |
— | — | @@ -12,18 +12,18 @@ |
13 | 13 | * object. |
14 | 14 | */ |
15 | 15 | |
16 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
17 | | - die( "This file is part of the MinFraud for PayflowPro Gateway extension. It is not a valid entry point.\n" ); |
| 16 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 17 | + die( "This file is part of the MinFraud for PayflowPro Gateway extension. It is not a valid entry point.\n" ); |
18 | 18 | } |
19 | 19 | |
20 | 20 | $wgExtensionCredits['payflowprogateway_custom_filters'][] = array( |
21 | 21 | 'name' => 'custom filters', |
22 | | - 'author' =>'Arthur Richards', |
23 | | - 'url' => '', |
| 22 | + 'author' => 'Arthur Richards', |
| 23 | + 'url' => '', |
24 | 24 | 'description' => 'This extension provides a way to define custom filters for incoming transactions for the Payflow Pro gateway.' |
25 | 25 | ); |
26 | 26 | |
27 | | -/** |
| 27 | +/** |
28 | 28 | * Define the action to take for a given $risk_score |
29 | 29 | */ |
30 | 30 | $wgPayflowGatewayCustomFiltersActionRanges = array( |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | /** |
38 | 38 | * A value for tracking the 'riskiness' of a transaction |
39 | 39 | * |
40 | | - * The action to take based on a transaction's riskScore is determined by |
| 40 | + * The action to take based on a transaction's riskScore is determined by |
41 | 41 | * $action_ranges. This is built assuming a range of possible risk scores |
42 | 42 | * as 0-100, although you can probably bend this as needed. |
43 | 43 | */ |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/source/source.body.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | public function filter() { |
23 | 23 | // pull out the source from the filter object |
24 | 24 | $source = $this->cfo->gateway_data['utm_source']; |
25 | | - |
| 25 | + |
26 | 26 | // a very complex filtering algorithm for sources |
27 | 27 | global $wgCustomFiltersSrcRules; |
28 | 28 | foreach ( $wgCustomFiltersSrcRules as $regex => $risk_score_modifier ) { |
— | — | @@ -29,14 +29,14 @@ |
30 | 30 | * Note that regex pattern does not include delimiters. |
31 | 31 | * These will need to be included your custom regex patterns. |
32 | 32 | */ |
33 | | - if( preg_match( "$regex", $source )) { |
| 33 | + if ( preg_match( "$regex", $source ) ) { |
34 | 34 | $this->cfo->risk_score += $risk_score_modifier; |
35 | | - |
| 35 | + |
36 | 36 | // log it |
37 | | - $log_msg = "\"" . addslashes($source) . "\""; |
38 | | - $log_msg .= "\t\"" . addslashes($regex) . "\""; |
| 37 | + $log_msg = "\"" . addslashes( $source ) . "\""; |
| 38 | + $log_msg .= "\t\"" . addslashes( $regex ) . "\""; |
39 | 39 | $log_msg .= "\t\"" . $this->cfo->risk_score . "\""; |
40 | | - $this->log( |
| 40 | + $this->log( |
41 | 41 | $this->cfo->gateway_data['contribution_tracking_id'], |
42 | 42 | 'Filter: Source', |
43 | 43 | $log_msg |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/source/source.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/source/source.php" ); |
8 | 8 | */ |
9 | 9 | |
10 | | -if ( !defined( 'MEDIAWIKI' )) { |
| 10 | +if ( !defined( 'MEDIAWIKI' ) ) { |
11 | 11 | die( "This file is part of the source custom filter part of the PayflowPro Gateway extension. It is not a valid entry point\n" ); |
12 | 12 | } |
13 | 13 | |
— | — | @@ -21,9 +21,9 @@ |
22 | 22 | * An array defining source strings and their associated risk score amount |
23 | 23 | * |
24 | 24 | * The key of the array is a regular expression to run against the source and the value is |
25 | | - * the amount to add to the risk score. The regex is run through preg_match and does not |
| 25 | + * the amount to add to the risk score. The regex is run through preg_match and does not |
26 | 26 | * need to include staring/ending delimiters - be sure to escape your characters! |
27 | | - * |
| 27 | + * |
28 | 28 | * eg: |
29 | 29 | * $wgCustomFiltersSrcRules['support.cc'] = "100"; |
30 | 30 | * // increases risk score for trxns with source of 'support.cc' referrals by 100 |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/minfraud/minfraud.body.php |
— | — | @@ -15,14 +15,14 @@ |
16 | 16 | $data =& $custom_filter_object->gateway_data; |
17 | 17 | |
18 | 18 | // see if we can bypass minfraud |
19 | | - if ( $this->can_bypass_minfraud( $pfp_gateway_object, $data )) return TRUE; |
| 19 | + if ( $this->can_bypass_minfraud( $pfp_gateway_object, $data ) ) return TRUE; |
20 | 20 | |
21 | 21 | $minfraud_query = $this->build_query( $data ); |
22 | 22 | $this->query_minfraud( $minfraud_query ); |
23 | 23 | $pfp_gateway_object->action = 'Filter'; |
24 | 24 | |
25 | 25 | $custom_filter_object->risk_score += $this->minfraud_response['riskScore']; |
26 | | - |
| 26 | + |
27 | 27 | // Write the query/response to the log |
28 | 28 | // @fixme this will cause the 'action' to be logged even though it's premature here |
29 | 29 | $this->log_query( $minfraud_query, $pfp_gateway_object, $data ); |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/minfraud/minfraud.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | * Custom filter using minFraud |
5 | 5 | * |
6 | 6 | * Essentially acts as a wrapper for the minFraud extra and runs minFraud |
7 | | - * queries via custom filter paradigm. This allows us to capture the |
| 7 | + * queries via custom filter paradigm. This allows us to capture the |
8 | 8 | * riskScore from minfraud and adjust it with our own custom filters and |
9 | 9 | * risk score modifications. |
10 | 10 | * |
— | — | @@ -17,20 +17,20 @@ |
18 | 18 | |
19 | 19 | $wgExtensionCredits['payflowprogateway_extras_customfilters_minfraud'][] = array( |
20 | 20 | 'name' => 'minfraud custom filter', |
21 | | - 'author' =>'Arthur Richards', |
22 | | - 'url' => '', |
| 21 | + 'author' => 'Arthur Richards', |
| 22 | + 'url' => '', |
23 | 23 | 'description' => 'This extension uses the MaxMind minFraud service as a validator for the Payflow Pro gateway via custom filters.' |
24 | 24 | ); |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Set minFraud to NOT run in standalone mode. |
28 | 28 | * |
29 | | - * If minFraud is set to run in standalone mode, it will not be run |
30 | | - * through custom filters. If you do not know what you're doing |
| 29 | + * If minFraud is set to run in standalone mode, it will not be run |
| 30 | + * through custom filters. If you do not know what you're doing |
31 | 31 | * or otherwise have this set up incorrectly, you may have unexpected |
32 | 32 | * results. If you want minFraud to run OUTSIDE of custom filters, |
33 | | - * you will want to make sure you know whether minFraud queries are |
34 | | - * happening before or after custom filters, defined by the order of |
| 33 | + * you will want to make sure you know whether minFraud queries are |
| 34 | + * happening before or after custom filters, defined by the order of |
35 | 35 | * your require statements in LocalSettings. |
36 | 36 | */ |
37 | 37 | $wgMinFraudStandalone = FALSE; |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/referrer/referrer.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/referrer/referrer.php" ); |
8 | 8 | */ |
9 | 9 | |
10 | | -if ( !defined( 'MEDIAWIKI' )) { |
| 10 | +if ( !defined( 'MEDIAWIKI' ) ) { |
11 | 11 | die( "This file is part of the referrer custom filter part of the PayflowPro Gateway extension. It is not a valid entry point\n" ); |
12 | 12 | } |
13 | 13 | |
— | — | @@ -21,9 +21,9 @@ |
22 | 22 | * An array defining a regex to match referrer URLs and their associated risk score amount |
23 | 23 | * |
24 | 24 | * The key of the array is a regular expression to run against the referrer and the value is |
25 | | - * the amount to add to the risk score. The regex is run through preg_match and does not |
| 25 | + * the amount to add to the risk score. The regex is run through preg_match and does not |
26 | 26 | * need to include staring/ending delimiters - be sure to escape your characters! |
27 | | - * |
| 27 | + * |
28 | 28 | * eg: |
29 | 29 | * $wgCustomFiltersRefRules['fraud\.com'] = "100"; |
30 | 30 | * // increases risk score for trxns with http://fraud.com referrals by 100 |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/referrer/referrer.body.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | public function filter() { |
23 | 23 | // pull out the referrer from the filter object |
24 | 24 | $referrer = $this->cfo->gateway_data['referrer']; |
25 | | - |
| 25 | + |
26 | 26 | // a very complex filtering algorithm for referrers |
27 | 27 | global $wgCustomFiltersRefRules; |
28 | 28 | foreach ( $wgCustomFiltersRefRules as $regex => $risk_score_modifier ) { |
— | — | @@ -29,14 +29,14 @@ |
30 | 30 | * note that the regex pattern does NOT include delimiters. |
31 | 31 | * these will need to be included in your custom regex patterns. |
32 | 32 | */ |
33 | | - if( preg_match( "$regex", $referrer )) { |
| 33 | + if ( preg_match( "$regex", $referrer ) ) { |
34 | 34 | $this->cfo->risk_score += $risk_score_modifier; |
35 | | - |
| 35 | + |
36 | 36 | // log it |
37 | | - $log_msg = "\"" . addslashes($referrer) . "\""; |
38 | | - $log_msg .= "\t\"" . addslashes($regex) . "\""; |
| 37 | + $log_msg = "\"" . addslashes( $referrer ) . "\""; |
| 38 | + $log_msg .= "\t\"" . addslashes( $regex ) . "\""; |
39 | 39 | $log_msg .= "\t\"" . $this->cfo->risk_score . "\""; |
40 | | - $this->log( |
| 40 | + $this->log( |
41 | 41 | $this->cfo->gateway_data['contribution_tracking_id'], |
42 | 42 | 'Filter: Referrer', |
43 | 43 | $log_msg |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/HTTPBase.php |
— | — | @@ -19,30 +19,30 @@ |
20 | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | 21 | */ |
22 | 22 | |
23 | | -class HTTPBase{ |
24 | | - var $server; |
25 | | - var $numservers; |
26 | | - var $url; |
27 | | - var $queries; |
28 | | - var $allowed_fields; |
29 | | - var $num_allowed_fields; |
30 | | - var $outputstr; |
31 | | - var $isSecure; |
32 | | - var $timeout; |
33 | | - var $debug; |
34 | | - var $check_field; |
35 | | - var $wsIpaddrRefreshTimeout; |
36 | | - var $wsIpaddrCacheFile; |
37 | | - var $useDNS; |
38 | | - var $ipstr; |
| 23 | +class HTTPBase { |
| 24 | + var $server; |
| 25 | + var $numservers; |
| 26 | + var $url; |
| 27 | + var $queries; |
| 28 | + var $allowed_fields; |
| 29 | + var $num_allowed_fields; |
| 30 | + var $outputstr; |
| 31 | + var $isSecure; |
| 32 | + var $timeout; |
| 33 | + var $debug; |
| 34 | + var $check_field; |
| 35 | + var $wsIpaddrRefreshTimeout; |
| 36 | + var $wsIpaddrCacheFile; |
| 37 | + var $useDNS; |
| 38 | + var $ipstr; |
39 | 39 | function __construct() { |
40 | 40 | $this->isSecure = 0; |
41 | 41 | $this->debug = 0; |
42 | 42 | $this->timeout = 0; |
43 | 43 | $this->check_field = "score"; |
44 | 44 | $this->wsIpaddrRefreshTimeout = 18000; |
45 | | - $this->wsIpaddrCacheFile = $this->_getTempDir()."/maxmind.ws.cache"; |
46 | | - if ($this->debug == 1) { |
| 45 | + $this->wsIpaddrCacheFile = $this->_getTempDir() . "/maxmind.ws.cache"; |
| 46 | + if ( $this->debug == 1 ) { |
47 | 47 | print "wsIpaddrRefreshTimeout: " . $this->wsIpaddrRefreshTimeout . "\n"; |
48 | 48 | print "wsIpaddrCacheFile: " . $this->wsIpaddrCacheFile . "\n"; |
49 | 49 | print "useDNS: " . $this->useDNS . "\n"; |
— | — | @@ -50,50 +50,50 @@ |
51 | 51 | } |
52 | 52 | |
53 | 53 | // this function sets the checked field |
54 | | - function set_check_field($f) { |
55 | | - $check_field = $f; |
| 54 | + function set_check_field( $f ) { |
| 55 | + $this->check_field = $f; |
56 | 56 | } |
57 | 57 | |
58 | 58 | // this function sets the allowed fields |
59 | | - function set_allowed_fields($i) { |
| 59 | + function set_allowed_fields( $i ) { |
60 | 60 | $this->allowed_fields = $i; |
61 | | - $this->num_allowed_fields = count($i); |
| 61 | + $this->num_allowed_fields = count( $i ); |
62 | 62 | } |
63 | 63 | |
64 | | - //this function queries the servers |
| 64 | + // this function queries the servers |
65 | 65 | function query() { |
66 | | - //query every server in the list |
67 | | - if (!$this->useDNS){ |
| 66 | + // query every server in the list |
| 67 | + if ( !$this->useDNS ) { |
68 | 68 | $ipstr = $this->readIpAddressFromCache(); |
69 | | - if ($this->debug == 1){ |
| 69 | + if ( $this->debug == 1 ) { |
70 | 70 | print "using ip addresses, IPs are " . $ipstr . "\n"; |
71 | 71 | } |
72 | 72 | } |
73 | 73 | // query every server using its ip address |
74 | 74 | // if there was success reading the ip addresses |
75 | 75 | // from the web or the cache file |
76 | | - if ($ipstr) { |
77 | | - $ipaddr = explode(";",$ipstr); |
78 | | - $numipaddr = count($ipaddr); |
79 | | - for ($i = 0;$i < $numipaddr;$i++){ |
80 | | - $result = $this->querySingleServer($ipaddr[$i]); |
81 | | - if ($this->debug == 1) { |
| 76 | + if ( $ipstr ) { |
| 77 | + $ipaddr = explode( ";", $ipstr ); |
| 78 | + $numipaddr = count( $ipaddr ); |
| 79 | + for ( $i = 0; $i < $numipaddr; $i++ ) { |
| 80 | + $result = $this->querySingleServer( $ipaddr[$i] ); |
| 81 | + if ( $this->debug == 1 ) { |
82 | 82 | print "ip address: " . $ipaddr[$i] . "\n"; |
83 | 83 | print "result: " . $result . "\n"; |
84 | 84 | } |
85 | | - if ($result) { |
| 85 | + if ( $result ) { |
86 | 86 | return $result; |
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
90 | | - |
| 90 | + |
91 | 91 | // query every server using its domain name |
92 | | - for ($i = 0; $i < $this->numservers; $i++ ) { |
93 | | - $result = $this->querySingleServer($this->server[$i]); |
94 | | - if ($this->debug == 1) { |
| 92 | + for ( $i = 0; $i < $this->numservers; $i++ ) { |
| 93 | + $result = $this->querySingleServer( $this->server[$i] ); |
| 94 | + if ( $this->debug == 1 ) { |
95 | 95 | print "server: " . $this->server[$i] . "\nresult: " . $result . "\n"; |
96 | 96 | } |
97 | | - if ($result) { |
| 97 | + if ( $result ) { |
98 | 98 | return $result; |
99 | 99 | } |
100 | 100 | } |
— | — | @@ -101,15 +101,15 @@ |
102 | 102 | } |
103 | 103 | |
104 | 104 | // this function takes a input hash and stores it in the hash named queries |
105 | | - function input($vars) { |
106 | | - $numinputkeys = count($vars); // get the number of keys in the input hash |
107 | | - $inputkeys = array_keys($vars); // get a array of keys in the input hash |
108 | | - for ($i = 0; $i < $numinputkeys; $i++) { |
| 105 | + function input( $vars ) { |
| 106 | + $numinputkeys = count( $vars ); // get the number of keys in the input hash |
| 107 | + $inputkeys = array_keys( $vars ); // get a array of keys in the input hash |
| 108 | + for ( $i = 0; $i < $numinputkeys; $i++ ) { |
109 | 109 | $key = $inputkeys[$i]; |
110 | | - if ($this->allowed_fields[$key] == 1) { |
111 | | - //if key is a allowed field then store it in |
112 | | - //the hash named queries |
113 | | - $this->queries[$key] = urlencode($this->filter_field($key, $vars[$key])); |
| 110 | + if ( $this->allowed_fields[$key] == 1 ) { |
| 111 | + // if key is a allowed field then store it in |
| 112 | + // the hash named queries |
| 113 | + $this->queries[$key] = urlencode( $this->filter_field( $key, $vars[$key] ) ); |
114 | 114 | } else { |
115 | 115 | print "invalid input $key - perhaps misspelled field?"; |
116 | 116 | return 0; |
— | — | @@ -118,85 +118,85 @@ |
119 | 119 | $this->queries["clientAPI"] = $this->API_VERSION; |
120 | 120 | } |
121 | 121 | |
122 | | - //sub-class should override this if it needs to filter inputs |
123 | | - function filter_field($key, $value) { |
| 122 | + // sub-class should override this if it needs to filter inputs |
| 123 | + function filter_field( $key, $value ) { |
124 | 124 | return $value; |
125 | 125 | } |
126 | 126 | |
127 | | - //this function returns the output from the server |
| 127 | + // this function returns the output from the server |
128 | 128 | function output() { |
129 | | - return $this->outputstr; |
| 129 | + return $this->outputstr; |
130 | 130 | } |
131 | 131 | |
132 | 132 | // write the ip Addresses and the time right now to |
133 | 133 | // the cache file |
134 | | - function writeIpAddressToCache($filename,$ipstr) { |
| 134 | + function writeIpAddressToCache( $filename, $ipstr ) { |
135 | 135 | $datetime = time(); |
136 | | - $fh = fopen($this->wsIpaddrCacheFile,'w'); |
137 | | - fwrite($fh,$ipstr . "\n"); |
138 | | - fwrite($fh,$datetime . "\n"); |
139 | | - fclose($fh); |
140 | | - if ($this->debug == 1) { |
| 136 | + $fh = fopen( $this->wsIpaddrCacheFile, 'w' ); |
| 137 | + fwrite( $fh, $ipstr . "\n" ); |
| 138 | + fwrite( $fh, $datetime . "\n" ); |
| 139 | + fclose( $fh ); |
| 140 | + if ( $this->debug == 1 ) { |
141 | 141 | print "writing ip address to cache\n"; |
142 | 142 | print "ip str: " . $ipstr . "\n"; |
143 | 143 | print "date time: " . $datetime . "\n"; |
144 | 144 | } |
145 | 145 | } |
146 | | - |
| 146 | + |
147 | 147 | function readIpAddressFromCache() { |
148 | 148 | // if the cache file exists then |
149 | 149 | // read the ip addresses and the time |
150 | 150 | // IPs were cached |
151 | | - if (file_exists($this->wsIpaddrCacheFile)) { |
152 | | - $fh = fopen($this->wsIpaddrCacheFile,'r'); |
153 | | - $ipstr = fgets($fh,1024); |
154 | | - $ipstr = rtrim($ipstr); |
155 | | - $datetime = fgets($fh,1024); |
156 | | - $datetime = rtrim($datetime); |
157 | | - fclose($fh); |
| 151 | + if ( file_exists( $this->wsIpaddrCacheFile ) ) { |
| 152 | + $fh = fopen( $this->wsIpaddrCacheFile, 'r' ); |
| 153 | + $ipstr = fgets( $fh, 1024 ); |
| 154 | + $ipstr = rtrim( $ipstr ); |
| 155 | + $datetime = fgets( $fh, 1024 ); |
| 156 | + $datetime = rtrim( $datetime ); |
| 157 | + fclose( $fh ); |
158 | 158 | } |
159 | | - |
| 159 | + |
160 | 160 | // if the ip addresses expired or don't exist then |
161 | | - // get them from the web and write |
| 161 | + // get them from the web and write |
162 | 162 | // them to the cache file |
163 | | - if (((time() - $datetime) > $this->wsIpaddrRefreshTimeout) | (!$ipstr)) { |
| 163 | + if ( ( ( time() - $datetime ) > $this->wsIpaddrRefreshTimeout ) | ( !$ipstr ) ) { |
164 | 164 | $tryIpstr = $this->readIpAddressFromWeb(); |
165 | | - if ($tryIpstr) { |
| 165 | + if ( $tryIpstr ) { |
166 | 166 | $ipstr = $tryIpstr; |
167 | 167 | } else { |
168 | | - if ($this->debug == 1){ |
| 168 | + if ( $this->debug == 1 ) { |
169 | 169 | print "Warning, unable to get ws_ipaddr from www.maxmind.com\n"; |
170 | 170 | } |
171 | 171 | } |
172 | 172 | // we write to cache whether or not we were able to get $tryIpStr, since |
173 | 173 | // in case DNS goes down, we don't want to check app/ws_ipaddr over and over |
174 | | - $this->writeIpAddressToCache($this->wsIpaddrCacheFile,$ipstr); |
| 174 | + $this->writeIpAddressToCache( $this->wsIpaddrCacheFile, $ipstr ); |
175 | 175 | } |
176 | | - if ($this->debug == 1){ |
| 176 | + if ( $this->debug == 1 ) { |
177 | 177 | print "reading ip address from cache\n"; |
178 | 178 | print "ip str: " . $ipstr . "\n"; |
179 | 179 | print "date time: " . $datetime . "\n"; |
180 | 180 | } |
181 | | - //return the ip addresses |
182 | | - return $ipstr; |
| 181 | + // return the ip addresses |
| 182 | + return $ipstr; |
183 | 183 | } |
184 | 184 | |
185 | 185 | function readIpAddressFromWeb() { |
186 | | - //check if the curl module exists |
| 186 | + // check if the curl module exists |
187 | 187 | $url = "http://www.maxmind.com/app/ws_ipaddr"; |
188 | | - if (extension_loaded('curl')) { |
| 188 | + if ( extension_loaded( 'curl' ) ) { |
189 | 189 | // open curl |
190 | 190 | $ch = curl_init(); |
191 | 191 | |
192 | 192 | // set curl options |
193 | | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
194 | | - curl_setopt($ch, CURLOPT_URL, $url); |
195 | | - curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); |
| 193 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 194 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 195 | + curl_setopt( $ch, CURLOPT_TIMEOUT, $this->timeout ); |
196 | 196 | |
197 | | - //get the content |
198 | | - $content = curl_exec($ch); |
199 | | - $content = rtrim($content); |
200 | | - if ($this->debug == 1) { |
| 197 | + // get the content |
| 198 | + $content = curl_exec( $ch ); |
| 199 | + $content = rtrim( $content ); |
| 200 | + if ( $this->debug == 1 ) { |
201 | 201 | print "using curl\n"; |
202 | 202 | } |
203 | 203 | } else { |
— | — | @@ -204,101 +204,99 @@ |
205 | 205 | |
206 | 206 | // parse the url to get |
207 | 207 | // host, path and query |
208 | | - $url3 = parse_url($url); |
| 208 | + $url3 = parse_url( $url ); |
209 | 209 | $host = $url3["host"]; |
210 | 210 | $path = $url3["path"]; |
211 | 211 | |
212 | 212 | // open the connection |
213 | | - $fp = fsockopen ($host, 80, $errno, $errstr, $this->timeout); |
214 | | - if ($fp) { |
| 213 | + $fp = fsockopen ( $host, 80, $errno, $errstr, $this->timeout ); |
| 214 | + if ( $fp ) { |
215 | 215 | // send the request |
216 | | - fputs ($fp, "GET $path HTTP/1.0\nHost: " . $host . "\n\n"); |
217 | | - while (!feof($fp)) { |
218 | | - $buf .= fgets($fp, 128); |
| 216 | + fputs ( $fp, "GET $path HTTP/1.0\nHost: " . $host . "\n\n" ); |
| 217 | + while ( !feof( $fp ) ) { |
| 218 | + $buf .= fgets( $fp, 128 ); |
219 | 219 | } |
220 | | - $lines = preg_split("/\n/", $buf); |
| 220 | + $lines = preg_split( "/\n/", $buf ); |
221 | 221 | // get the content |
222 | | - $content = $lines[count($lines)-1]; |
223 | | - //close the connection |
224 | | - fclose($fp); |
| 222 | + $content = $lines[count( $lines ) -1]; |
| 223 | + // close the connection |
| 224 | + fclose( $fp ); |
225 | 225 | } |
226 | | - if ($this->debug == 1) { |
| 226 | + if ( $this->debug == 1 ) { |
227 | 227 | print "using fsockopen\n"; |
228 | 228 | } |
229 | 229 | } |
230 | | - if ($this->debug == 1) { |
| 230 | + if ( $this->debug == 1 ) { |
231 | 231 | print "readIpAddressFromWeb found ip addresses: " . $content . "\n"; |
232 | 232 | } |
233 | 233 | // TODO fix regexp so that it checks if it only has IP addresses |
234 | | - if (preg_match("/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/",$content)) { |
| 234 | + if ( preg_match( "/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/", $content ) ) { |
235 | 235 | return $content; |
236 | | - } |
| 236 | + } |
237 | 237 | return ""; |
238 | 238 | } |
239 | 239 | |
240 | 240 | // this function queries a single server |
241 | | - function querySingleServer($server) { |
| 241 | + function querySingleServer( $server ) { |
242 | 242 | global $wgPayflowGatewayUseHTTPProxy, $wgPayflowGatewayHTTPProxy; |
243 | | - |
| 243 | + |
244 | 244 | // check if we using the Secure HTTPS proctol |
245 | | - if ($this->isSecure == 1) { |
| 245 | + if ( $this->isSecure == 1 ) { |
246 | 246 | $scheme = "https://"; // Secure HTTPS proctol |
247 | 247 | } else { |
248 | 248 | $scheme = "http://"; // Regular HTTP proctol |
249 | 249 | } |
250 | 250 | |
251 | 251 | // build a query string from the hash called queries |
252 | | - $numquerieskeys = count($this->queries); // get the number of keys in the hash called queries |
253 | | - $querieskeys = array_keys($this->queries); // get a array of keys in the hash called queries |
254 | | - if ($this->debug == 1) { |
255 | | - print "number of query keys " + $numquerieskeys + "\n"; |
| 252 | + $numquerieskeys = count( $this->queries ); // get the number of keys in the hash called queries |
| 253 | + $querieskeys = array_keys( $this->queries ); // get a array of keys in the hash called queries |
| 254 | + if ( $this->debug == 1 ) { |
| 255 | + print "number of query keys " . $numquerieskeys . "\n"; |
256 | 256 | } |
257 | 257 | |
258 | 258 | $query_string = ""; |
259 | 259 | |
260 | | - for ($i = 0; $i < $numquerieskeys; $i++) { |
261 | | - //for each element in the hash called queries |
262 | | - //append the key and value of the element to the query string |
| 260 | + for ( $i = 0; $i < $numquerieskeys; $i++ ) { |
| 261 | + // for each element in the hash called queries |
| 262 | + // append the key and value of the element to the query string |
263 | 263 | $key = $querieskeys[$i]; |
264 | 264 | $value = $this->queries[$key]; |
265 | | - //encode the key and value before adding it to the string |
266 | | - //$key = urlencode($key); |
267 | | - //$value = urlencode($value); |
268 | | - if ($this->debug == 1) { |
| 265 | + // encode the key and value before adding it to the string |
| 266 | + // $key = urlencode($key); |
| 267 | + // $value = urlencode($value); |
| 268 | + if ( $this->debug == 1 ) { |
269 | 269 | print " query key " . $key . " query value " . $value . "\n"; |
270 | 270 | } |
271 | 271 | $query_string = $query_string . $key . "=" . $value; |
272 | | - if ($i < $numquerieskeys - 1) { |
| 272 | + if ( $i < $numquerieskeys - 1 ) { |
273 | 273 | $query_string = $query_string . "&"; |
274 | 274 | } |
275 | 275 | } |
276 | 276 | |
277 | | - $content = ""; |
278 | | - |
279 | | - //check if the curl module exists |
280 | | - if (extension_loaded('curl')) { |
281 | | - //use curl |
282 | | - if ($this->debug == 1) { |
| 277 | + // check if the curl module exists |
| 278 | + if ( extension_loaded( 'curl' ) ) { |
| 279 | + // use curl |
| 280 | + if ( $this->debug == 1 ) { |
283 | 281 | print "using curl\n"; |
284 | 282 | } |
285 | 283 | |
286 | | - //open curl |
| 284 | + // open curl |
287 | 285 | $ch = curl_init(); |
288 | 286 | |
289 | 287 | $url = $scheme . $server . "/" . $this->url; |
290 | 288 | |
291 | | - //set curl options |
292 | | - if ($this->debug == 1){ |
| 289 | + // set curl options |
| 290 | + if ( $this->debug == 1 ) { |
293 | 291 | print "url " . $url . "\n"; |
294 | 292 | } |
295 | | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
296 | | - curl_setopt($ch, CURLOPT_URL, $url); |
297 | | - curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); |
298 | | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0); |
| 293 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
| 294 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
| 295 | + curl_setopt( $ch, CURLOPT_TIMEOUT, $this->timeout ); |
| 296 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); |
299 | 297 | |
300 | | - //this option lets you store the result in a string |
301 | | - curl_setopt($ch, CURLOPT_POST, 1); |
302 | | - curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string); |
| 298 | + // this option lets you store the result in a string |
| 299 | + curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 300 | + curl_setopt( $ch, CURLOPT_POSTFIELDS, $query_string ); |
303 | 301 | |
304 | 302 | // set proxy settings if necessary |
305 | 303 | if ( $wgPayflowGatewayUseHTTPProxy ) { |
— | — | @@ -306,8 +304,8 @@ |
307 | 305 | curl_setopt( $ch, CURLOPT_PROXY, $wgPayflowGatewayHTTPProxy ); |
308 | 306 | } |
309 | 307 | |
310 | | - //get the content |
311 | | - $content = curl_exec($ch); |
| 308 | + // get the content |
| 309 | + $content = curl_exec( $ch ); |
312 | 310 | |
313 | 311 | // For some reason curl_errno returns an error even when function works |
314 | 312 | // Until we figure this out, will ignore curl errors - (not good i know) |
— | — | @@ -318,121 +316,121 @@ |
319 | 317 | // print "error: this version of curl does not support HTTPS try build curl with SSL or specify \$ccfs->isSecure = 0\n"; |
320 | 318 | // } |
321 | 319 | // if ($e > 0) { |
322 | | - //we get a error msg print it |
| 320 | + // we get a error msg print it |
323 | 321 | // print "Received error message $e from curl: " . curl_error($ch) . "\n"; |
324 | 322 | // return 0; |
325 | 323 | // } |
326 | | - //close curl |
327 | | - curl_close($ch); |
| 324 | + // close curl |
| 325 | + curl_close( $ch ); |
328 | 326 | } else { |
329 | | - //curl does not exist |
330 | | - //use the fsockopen function, |
331 | | - //the fgets function and the fclose function |
332 | | - if ($this->debug == 1) { |
| 327 | + // curl does not exist |
| 328 | + // use the fsockopen function, |
| 329 | + // the fgets function and the fclose function |
| 330 | + if ( $this->debug == 1 ) { |
333 | 331 | print "using fsockopen for querySingleServer\n"; |
334 | 332 | } |
335 | 333 | |
336 | 334 | $url = $scheme . $server . "/" . $this->url . "?" . $query_string; |
337 | | - if ($this->debug == 1) { |
| 335 | + if ( $this->debug == 1 ) { |
338 | 336 | print "url " . $url . " " . "\n"; |
339 | 337 | } |
340 | 338 | |
341 | | - //now check if we are using regular HTTP |
342 | | - if ($this->isSecure == 0) { |
343 | | - //we using regular HTTP |
| 339 | + // now check if we are using regular HTTP |
| 340 | + if ( $this->isSecure == 0 ) { |
| 341 | + // we using regular HTTP |
344 | 342 | |
345 | | - //parse the url to get |
346 | | - //host, path and query |
347 | | - $url3 = parse_url($url); |
| 343 | + // parse the url to get |
| 344 | + // host, path and query |
| 345 | + $url3 = parse_url( $url ); |
348 | 346 | $host = $url3["host"]; |
349 | 347 | $path = $url3["path"]; |
350 | | - $query = $url3["query"]; |
| 348 | + $query = $url3["query"]; |
351 | 349 | |
352 | | - //open the connection |
353 | | - $fp = fsockopen ($host, 80, $errno, $errstr, $this->timeout); |
354 | | - if ($fp) { |
355 | | - //send the request |
356 | | - $post = "POST $path HTTP/1.0\nHost: " . $host . "\nContent-type: application/x-www-form-urlencoded\nUser-Agent: Mozilla 4.0\nContent-length: " . strlen($query) . "\nConnection: close\n\n$query"; |
357 | | - fputs ($fp, $post); |
358 | | - while (!feof($fp)) { |
359 | | - $buf .= fgets($fp, 128); |
| 350 | + // open the connection |
| 351 | + $fp = fsockopen ( $host, 80, $errno, $errstr, $this->timeout ); |
| 352 | + if ( $fp ) { |
| 353 | + // send the request |
| 354 | + $post = "POST $path HTTP/1.0\nHost: " . $host . "\nContent-type: application/x-www-form-urlencoded\nUser-Agent: Mozilla 4.0\nContent-length: " . strlen( $query ) . "\nConnection: close\n\n$query"; |
| 355 | + fputs ( $fp, $post ); |
| 356 | + while ( !feof( $fp ) ) { |
| 357 | + $buf .= fgets( $fp, 128 ); |
360 | 358 | } |
361 | | - $lines = preg_split("/\n/", $buf); |
| 359 | + $lines = preg_split( "/\n/", $buf ); |
362 | 360 | // get the content |
363 | | - $content = $lines[count($lines)-1]; |
364 | | - //close the connection |
365 | | - fclose($fp); |
| 361 | + $content = $lines[count( $lines ) -1]; |
| 362 | + // close the connection |
| 363 | + fclose( $fp ); |
366 | 364 | } else { |
367 | 365 | return 0; |
368 | 366 | } |
369 | 367 | } else { |
370 | | - //secure HTTPS requires CURL |
| 368 | + // secure HTTPS requires CURL |
371 | 369 | print "error: you need to install curl if you want secure HTTPS or specify the variable to be $ccfs->isSecure = 0"; |
372 | 370 | return 0; |
373 | 371 | } |
374 | 372 | } |
375 | 373 | |
376 | | - if ($this->debug == 1) { |
| 374 | + if ( $this->debug == 1 ) { |
377 | 375 | print "content = " . $content . "\n"; |
378 | 376 | } |
379 | 377 | // get the keys and values from |
380 | 378 | // the string content and store them |
381 | 379 | // the hash named outputstr |
382 | 380 | |
383 | | - // split content into pairs containing both |
| 381 | + // split content into pairs containing both |
384 | 382 | // the key and the value |
385 | | - $keyvaluepairs = explode(";",$content); |
| 383 | + $keyvaluepairs = explode( ";", $content ); |
386 | 384 | |
387 | | - //get the number of key and value pairs |
388 | | - $numkeyvaluepairs = count($keyvaluepairs); |
| 385 | + // get the number of key and value pairs |
| 386 | + $numkeyvaluepairs = count( $keyvaluepairs ); |
389 | 387 | |
390 | | - //for each pair store key and value into the |
391 | | - //hash named outputstr |
| 388 | + // for each pair store key and value into the |
| 389 | + // hash named outputstr |
392 | 390 | $this->outputstr = array(); |
393 | | - for ($i = 0; $i < $numkeyvaluepairs; $i++) { |
394 | | - //split the pair into a key and a value |
395 | | - list($key,$value) = explode("=",$keyvaluepairs[$i]); |
396 | | - if ($this->debug == 1) { |
| 391 | + for ( $i = 0; $i < $numkeyvaluepairs; $i++ ) { |
| 392 | + // split the pair into a key and a value |
| 393 | + list( $key, $value ) = explode( "=", $keyvaluepairs[$i] ); |
| 394 | + if ( $this->debug == 1 ) { |
397 | 395 | print " output " . $key . " = " . $value . "\n"; |
398 | 396 | } |
399 | | - //store the key and the value into the |
400 | | - //hash named outputstr |
| 397 | + // store the key and the value into the |
| 398 | + // hash named outputstr |
401 | 399 | $this->outputstr[$key] = $value; |
402 | 400 | } |
403 | | - //check if outputstr has the score if outputstr does not have |
404 | | - //the score return 0 |
405 | | - if ($this->outputstr[$this->check_field] == "") { |
| 401 | + // check if outputstr has the score if outputstr does not have |
| 402 | + // the score return 0 |
| 403 | + if ( $this->outputstr[$this->check_field] == "" ) { |
406 | 404 | return 0; |
407 | 405 | } |
408 | | - //one other way to do it |
409 | | - //if (!array_key_exists("score",$this->outputstr)) { |
| 406 | + // one other way to do it |
| 407 | + // if (!array_key_exists("score",$this->outputstr)) { |
410 | 408 | // return 0; |
411 | | - //} |
| 409 | + // } |
412 | 410 | return 1; |
413 | 411 | } |
414 | 412 | |
415 | 413 | function _getTempDir() { |
416 | | - if (ini_get('upload_tmp_dir')) { |
417 | | - return ini_get('upload_tmp_dir'); |
| 414 | + if ( ini_get( 'upload_tmp_dir' ) ) { |
| 415 | + return ini_get( 'upload_tmp_dir' ); |
418 | 416 | } |
419 | 417 | |
420 | | - if (substr(PHP_OS, 0, 3) != 'WIN') { |
| 418 | + if ( substr( PHP_OS, 0, 3 ) != 'WIN' ) { |
421 | 419 | return '/tmp'; |
422 | 420 | } |
423 | 421 | |
424 | | - if (isset($_ENV['TMP'])) { |
| 422 | + if ( isset( $_ENV['TMP'] ) ) { |
425 | 423 | return $_ENV['TMP']; |
426 | 424 | } |
427 | 425 | |
428 | | - if (isset($_ENV['TEMP'])) { |
| 426 | + if ( isset( $_ENV['TEMP'] ) ) { |
429 | 427 | return $_ENV['TEMP']; |
430 | 428 | } |
431 | 429 | |
432 | | - if (is_dir('c:\\windows\\temp')) { |
| 430 | + if ( is_dir( 'c:\\windows\\temp' ) ) { |
433 | 431 | return 'c:\\windows\\temp'; |
434 | 432 | } |
435 | 433 | |
436 | | - if (is_dir('c:\\winnt\\temp')) { |
| 434 | + if ( is_dir( 'c:\\winnt\\temp' ) ) { |
437 | 435 | return 'c:\\winnt\\temp'; |
438 | 436 | } |
439 | 437 | |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/LocationVerification.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | 21 | */ |
22 | 22 | |
23 | | -require_once ("HTTPBase.php"); |
| 23 | +require_once ( "HTTPBase.php" ); |
24 | 24 | class LocationVerification extends HTTPBase { |
25 | 25 | var $server; |
26 | 26 | var $numservers; |
— | — | @@ -29,21 +29,21 @@ |
30 | 30 | parent::__construct(); |
31 | 31 | $this->isSecure = 1; // use HTTPS by default |
32 | 32 | |
33 | | - //set the allowed_fields hash |
| 33 | + // set the allowed_fields hash |
34 | 34 | $this->allowed_fields["i"] = 1; |
35 | 35 | $this->allowed_fields["city"] = 1; |
36 | 36 | $this->allowed_fields["region"] = 1; |
37 | 37 | $this->allowed_fields["postal"] = 1; |
38 | 38 | $this->allowed_fields["country"] = 1; |
39 | 39 | $this->allowed_fields["license_key"] = 1; |
40 | | - $this->num_allowed_fields = count($this->allowed_fields); |
| 40 | + $this->num_allowed_fields = count( $this->allowed_fields ); |
41 | 41 | |
42 | | - //set the url of the web service |
| 42 | + // set the url of the web service |
43 | 43 | $this->url = "app/locvr"; |
44 | 44 | $this->check_field = "distance"; |
45 | 45 | |
46 | | - $this->server = array("www.maxmind.com", "www2.maxmind.com"); |
47 | | - $this->numservers = count($this->server); |
| 46 | + $this->server = array( "www.maxmind.com", "www2.maxmind.com" ); |
| 47 | + $this->numservers = count( $this->server ); |
48 | 48 | $this->API_VERSION = 'PHP/1.4'; |
49 | 49 | } |
50 | 50 | } |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/CreditCardFraudDetection.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | 21 | */ |
22 | 22 | |
23 | | -require_once ("HTTPBase.php"); |
| 23 | +require_once ( "HTTPBase.php" ); |
24 | 24 | class CreditCardFraudDetection extends HTTPBase { |
25 | 25 | var $server; |
26 | 26 | var $numservers; |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | parent::__construct(); |
31 | 31 | $this->isSecure = 1; // use HTTPS by default |
32 | 32 | |
33 | | - //set the allowed_fields hash |
| 33 | + // set the allowed_fields hash |
34 | 34 | $this->allowed_fields["i"] = 1; |
35 | 35 | $this->allowed_fields["domain"] = 1; |
36 | 36 | $this->allowed_fields["city"] = 1; |
— | — | @@ -57,24 +57,24 @@ |
58 | 58 | $this->allowed_fields["accept_language"] = 1; |
59 | 59 | |
60 | 60 | |
61 | | - $this->num_allowed_fields = count($this->allowed_fields); |
| 61 | + $this->num_allowed_fields = count( $this->allowed_fields ); |
62 | 62 | |
63 | | - //set the url of the web service |
| 63 | + // set the url of the web service |
64 | 64 | $this->url = "app/ccv2r"; |
65 | 65 | $this->check_field = "score"; |
66 | | - $this->server = array("minfraud3.maxmind.com", "minfraud1.maxmind.com", "minfraud2.maxmind.com"); |
67 | | - $this->numservers = count($this->server); |
| 66 | + $this->server = array( "minfraud3.maxmind.com", "minfraud1.maxmind.com", "minfraud2.maxmind.com" ); |
| 67 | + $this->numservers = count( $this->server ); |
68 | 68 | $this->API_VERSION = 'PHP/1.49'; |
69 | 69 | } |
70 | 70 | |
71 | | - function filter_field($key, $value) { |
72 | | - if ($key == 'emailMD5'){ |
73 | | - if (preg_match('/@/',$value)){ |
74 | | - return md5(strtolower($value)); |
| 71 | + function filter_field( $key, $value ) { |
| 72 | + if ( $key == 'emailMD5' ) { |
| 73 | + if ( preg_match( '/@/', $value ) ) { |
| 74 | + return md5( strtolower( $value ) ); |
75 | 75 | } |
76 | | - } else if ($key == 'usernameMD5' || $key == 'passwordMD5') { |
77 | | - if (strlen($value) != 32) { |
78 | | - return md5(strtolower($value)); |
| 76 | + } else if ( $key == 'usernameMD5' || $key == 'passwordMD5' ) { |
| 77 | + if ( strlen( $value ) != 32 ) { |
| 78 | + return md5( strtolower( $value ) ); |
79 | 79 | } |
80 | 80 | } |
81 | 81 | return $value; |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/TelephoneVerification.php |
— | — | @@ -1,24 +1,24 @@ |
2 | 2 | <?php |
3 | | -require_once ("HTTPBase.php"); |
| 3 | +require_once ( "HTTPBase.php" ); |
4 | 4 | class TelephoneVerification extends HTTPBase { |
5 | 5 | var $server; |
6 | 6 | var $numservers; |
7 | 7 | var $API_VERSION; |
8 | | - function __construct(){ |
| 8 | + function __construct() { |
9 | 9 | parent::__construct(); |
10 | 10 | $this->isSecure = 1; // use HTTPS by default |
11 | 11 | |
12 | | - //set the allowed_fields hash |
| 12 | + // set the allowed_fields hash |
13 | 13 | $this->allowed_fields["l"] = 1; |
14 | 14 | $this->allowed_fields["phone"] = 1; |
15 | 15 | $this->allowed_fields["verify_code"] = 1; |
16 | | - $this->num_allowed_fields = count($this->allowed_fields); |
| 16 | + $this->num_allowed_fields = count( $this->allowed_fields ); |
17 | 17 | |
18 | | - //set the url of the web service |
| 18 | + // set the url of the web service |
19 | 19 | $this->url = "app/telephone_http"; |
20 | 20 | $this->check_field = "refid"; |
21 | | - $this->server = array("www.maxmind.com", "www2.maxmind.com"); |
22 | | - $this->numservers = count($this->server); |
| 21 | + $this->server = array( "www.maxmind.com", "www2.maxmind.com" ); |
| 22 | + $this->numservers = count( $this->server ); |
23 | 23 | $this->API_VERSION = 'PHP/1.4'; |
24 | 24 | $this->timeout = 30; |
25 | 25 | } |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/tests/minfraudTest.php |
— | — | @@ -8,11 +8,11 @@ |
9 | 9 | { |
10 | 10 | protected function setUp() { |
11 | 11 | $dir = dirname( __FILE__ ) . '/'; |
12 | | - require_once( $dir . '../../extras.php'); |
13 | | - require_once( $dir . '../minfraud.body.php'); |
| 12 | + require_once( $dir . '../../extras.php' ); |
| 13 | + require_once( $dir . '../minfraud.body.php' ); |
14 | 14 | require_once( $dir . "../../../includes/countryCodes.inc" ); |
15 | 15 | global $wgPayflowGatewayLog; |
16 | | - $wgPayflowGatewayLog = dirname(__FILE__) . "/test_log"; |
| 16 | + $wgPayflowGatewayLog = dirname( __FILE__ ) . "/test_log"; |
17 | 17 | $license_key = 'XBCKSF4gnHA7'; |
18 | 18 | $this->fixture = new PayflowProGateway_Extras_MinFraud( $license_key ); |
19 | 19 | } |
— | — | @@ -42,9 +42,9 @@ |
43 | 43 | $this->assertArrayHasKey( "emailMD5", $query ); |
44 | 44 | $this->assertArrayHasKey( "bin", $query ); |
45 | 45 | $this->assertArrayHasKey( "txnID", $query ); |
46 | | - $this->assertArrayNotHasKey( "foo", $query ); //make sure we're not adding extraneous info |
47 | | - $this->assertNotContains( "@", $query[ 'domain' ] ); //make sure we're only getting domains from email addresses |
48 | | - $this->assertEquals( 6, strlen( $query[ 'bin' ] )); //make sure our bin is 6 digits long |
| 46 | + $this->assertArrayNotHasKey( "foo", $query ); // make sure we're not adding extraneous info |
| 47 | + $this->assertNotContains( "@", $query[ 'domain' ] ); // make sure we're only getting domains from email addresses |
| 48 | + $this->assertEquals( 6, strlen( $query[ 'bin' ] ) ); // make sure our bin is 6 digits long |
49 | 49 | } |
50 | 50 | |
51 | 51 | public function queryDataProvider() { |
— | — | @@ -78,7 +78,7 @@ |
79 | 79 | * @dataProvider hashValidateFalseData |
80 | 80 | */ |
81 | 81 | public function testValidateMinfraudHashFalse( $data ) { |
82 | | - $this->assertFalse( $this->fixture->validate_minfraud_query( $data )); |
| 82 | + $this->assertFalse( $this->fixture->validate_minfraud_query( $data ) ); |
83 | 83 | } |
84 | 84 | |
85 | 85 | public function hashValidateFalseData() { |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | array( |
88 | 88 | array(), |
89 | 89 | array( 'license_key' => 'a' ), |
90 | | - array( |
| 90 | + array( |
91 | 91 | 'license_key' => 'a', |
92 | 92 | 'i' => 'a', |
93 | 93 | ), |
— | — | @@ -120,13 +120,13 @@ |
121 | 121 | * @dataProvider hashValidateTrueData |
122 | 122 | */ |
123 | 123 | public function testValidateMinfraudHashTrue( $data ) { |
124 | | - $this->assertTrue( $this->fixture->validate_minfraud_query( $data )); |
| 124 | + $this->assertTrue( $this->fixture->validate_minfraud_query( $data ) ); |
125 | 125 | } |
126 | 126 | |
127 | 127 | public function hashValidateTrueData() { |
128 | | - return array( |
129 | | - array( |
130 | | - array( |
| 128 | + return array( |
| 129 | + array( |
| 130 | + array( |
131 | 131 | 'license_key' => 'a', |
132 | 132 | 'i' => 'a', |
133 | 133 | 'city' => 'a', |
— | — | @@ -143,13 +143,13 @@ |
144 | 144 | */ |
145 | 145 | public function testDetermineActions( $risk_score, $action_ranges, $expected ) { |
146 | 146 | $this->fixture->action_ranges = $action_ranges; |
147 | | - $this->assertEquals( $expected, $this->fixture->determine_action( $risk_score )); |
| 147 | + $this->assertEquals( $expected, $this->fixture->determine_action( $risk_score ) ); |
148 | 148 | } |
149 | 149 | |
150 | 150 | public function determineActionsData() { |
151 | 151 | return array( |
152 | | - array( '0.1', array( 'process' => array(0, 100)), 'process'), |
153 | | - array( '75.04', array( 'process' => array(0, 50), 'reject' => array( '50.01', '100')), 'reject'), |
| 152 | + array( '0.1', array( 'process' => array( 0, 100 ) ), 'process' ), |
| 153 | + array( '75.04', array( 'process' => array( 0, 50 ), 'reject' => array( '50.01', '100' ) ), 'reject' ), |
154 | 154 | ); |
155 | 155 | } |
156 | 156 | |
— | — | @@ -157,21 +157,21 @@ |
158 | 158 | global $wgPayflowGatewayLog; |
159 | 159 | $this->fixture->log( '', '', "\"foo\"" ); |
160 | 160 | $new_fh = fopen( $wgPayflowGatewayLog, 'r' ); |
161 | | - $this->assertEquals('"'.date('c').'"'."\t\"\"\t\"\"\t\"foo\"\n", fread( $new_fh, filesize( $wgPayflowGatewayLog ) )); |
| 161 | + $this->assertEquals( '"' . date( 'c' ) . '"' . "\t\"\"\t\"\"\t\"foo\"\n", fread( $new_fh, filesize( $wgPayflowGatewayLog ) ) ); |
162 | 162 | fclose( $new_fh ); |
163 | 163 | } |
164 | 164 | |
165 | 165 | public function testGenerateHash() { |
166 | 166 | global $wgPayflowGatewaySalt; |
167 | 167 | $wgPayflowGatewaySalt = 'salt'; |
168 | | - $this->assertEquals( '5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', $this->fixture->generate_hash( 'foo' )); |
| 168 | + $this->assertEquals( '5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', $this->fixture->generate_hash( 'foo' ) ); |
169 | 169 | } |
170 | 170 | |
171 | 171 | public function testCompareHash() { |
172 | 172 | global $wgPayflowGatewaySalt; |
173 | 173 | $wgPayflowGatewaySalt = 'salt'; |
174 | | - $this->assertTrue( $this->fixture->compare_hash('5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', 'foo')); |
175 | | - $this->assertFalse( $this->fixture->compare_hash('5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', 'bar')); |
| 174 | + $this->assertTrue( $this->fixture->compare_hash( '5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', 'foo' ) ); |
| 175 | + $this->assertFalse( $this->fixture->compare_hash( '5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', 'bar' ) ); |
176 | 176 | } |
177 | 177 | |
178 | 178 | public function testBypassMinfraud() { |
— | — | @@ -183,12 +183,12 @@ |
184 | 184 | 'foo', |
185 | 185 | 'num_attempt' => 2 |
186 | 186 | ); |
187 | | - //@fixme this needs updating |
188 | | - //$this->assertTrue( $this->fixture->can_bypass_minfraud( &$this->fixture, &$data )); |
189 | | - //$this->assertEquals( 'challenge', $this->fixture->action ); |
190 | | - //$this->assertEquals( '029ef6f5c2a165215b5a92ff1a194e4a6de8c668d6193582da42713f119c1b07d8358b5cd94a3bd51c9aa50709c8533295215ce3cce8c2b61e69078d789bc3f3', $data[ 'data_hash' ]); |
| 187 | + // @fixme this needs updating |
| 188 | + // $this->assertTrue( $this->fixture->can_bypass_minfraud( &$this->fixture, &$data )); |
| 189 | + // $this->assertEquals( 'challenge', $this->fixture->action ); |
| 190 | + // $this->assertEquals( '029ef6f5c2a165215b5a92ff1a194e4a6de8c668d6193582da42713f119c1b07d8358b5cd94a3bd51c9aa50709c8533295215ce3cce8c2b61e69078d789bc3f3', $data[ 'data_hash' ]); |
191 | 191 | |
192 | 192 | $data[] = 'bar'; |
193 | | - $this->assertFalse( $this->fixture->can_bypass_minfraud( &$this->fixture, &$data )); |
| 193 | + $this->assertFalse( $this->fixture->can_bypass_minfraud( &$this->fixture, &$data ) ); |
194 | 194 | } |
195 | 195 | } |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/minfraud.body.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | |
17 | 17 | /** |
18 | 18 | * User-definable riskScore ranges for actions to take |
19 | | - * |
| 19 | + * |
20 | 20 | * Overload with $wgMinFraudActionRanges |
21 | 21 | * @var public array |
22 | 22 | */ |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | |
41 | 41 | function __construct( $license_key = NULL ) { |
42 | 42 | parent::__construct(); |
43 | | - $dir = dirname( __FILE__ ) .'/'; |
| 43 | + $dir = dirname( __FILE__ ) . '/'; |
44 | 44 | require_once( $dir . "ccfd/CreditCardFraudDetection.php" ); |
45 | 45 | require_once( $dir . "../../includes/countryCodes.inc" ); |
46 | 46 | global $wgMinFraudLicenseKey, $wgMinFraudActionRanges; |
— | — | @@ -48,9 +48,9 @@ |
49 | 49 | if ( !$license_key && !$wgMinFraudLicenseKey ) { |
50 | 50 | throw new MWException( "minFraud license key required but not present." ); |
51 | 51 | } |
52 | | - $this->minfraud_license_key = ( $license_key ) ? $license_key : $wgMinFraudLicenseKey; |
| 52 | + $this->minfraud_license_key = ( $license_key ) ? $license_key : $wgMinFraudLicenseKey; |
53 | 53 | |
54 | | - if ( isset( $wgMinFraudActionRanges )) $this->action_ranges = $wgMinFraudActionRanges; |
| 54 | + if ( isset( $wgMinFraudActionRanges ) ) $this->action_ranges = $wgMinFraudActionRanges; |
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
— | — | @@ -62,17 +62,17 @@ |
63 | 63 | */ |
64 | 64 | public function validate( &$pfp_gateway_object, &$data ) { |
65 | 65 | // see if we can bypass minfraud |
66 | | - if ( $this->can_bypass_minfraud( $pfp_gateway_object, $data )) return TRUE; |
| 66 | + if ( $this->can_bypass_minfraud( $pfp_gateway_object, $data ) ) return TRUE; |
67 | 67 | |
68 | 68 | $minfraud_query = $this->build_query( $data ); |
69 | 69 | $this->query_minfraud( $minfraud_query ); |
70 | 70 | $pfp_gateway_object->action = $this->determine_action( $this->minfraud_response[ 'riskScore' ] ); |
71 | 71 | |
72 | 72 | // reset the data hash |
73 | | - if ( isset( $data[ 'data_hash' ] )) unset( $data[ 'data_hash' ] ); |
| 73 | + if ( isset( $data[ 'data_hash' ] ) ) unset( $data[ 'data_hash' ] ); |
74 | 74 | $data[ 'action' ] = $this->generate_hash( $pfp_gateway_object->action ); |
75 | | - $data[ 'data_hash' ] = $this->generate_hash( serialize( $data )); |
76 | | - |
| 75 | + $data[ 'data_hash' ] = $this->generate_hash( serialize( $data ) ); |
| 76 | + |
77 | 77 | // Write the query/response to the log |
78 | 78 | $this->log_query( $minfraud_query, $pfp_gateway_object, $data ); |
79 | 79 | return TRUE; |
— | — | @@ -85,8 +85,8 @@ |
86 | 86 | if ( $this->log_fh ) { |
87 | 87 | $log_message = '"' . addslashes( $data[ 'comment' ] ) . '"'; |
88 | 88 | $log_message .= "\t" . '"' . addslashes( $data[ 'amount' ] . ' ' . $data[ 'currency' ] ) . '"'; |
89 | | - $log_message .= "\t" . '"' . addslashes( json_encode( $minfraud_query )) . '"'; |
90 | | - $log_message .= "\t" . '"' . addslashes( json_encode( $this->minfraud_response )) . '"'; |
| 89 | + $log_message .= "\t" . '"' . addslashes( json_encode( $minfraud_query ) ) . '"'; |
| 90 | + $log_message .= "\t" . '"' . addslashes( json_encode( $this->minfraud_response ) ) . '"'; |
91 | 91 | $log_message .= "\t" . '"' . addslashes( $pfp_gateway_object->action ) . '"'; |
92 | 92 | $log_message .= "\t" . '"' . addslashes( $data[ 'referrer' ] ) . '"'; |
93 | 93 | $this->log( $data[ 'contribution_tracking_id' ], 'minFraud query', $log_message ); |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | * The first time a user hits the submission form, a hash of the full data array plus a |
101 | 101 | * hashed action name are injected to the data. This allows us to track the transaction's |
102 | 102 | * status. If a valid hash of the data is present and a valid action is present, we can |
103 | | - * assume the transaction has already gone through the minFraud check and can be passed |
| 103 | + * assume the transaction has already gone through the minFraud check and can be passed |
104 | 104 | * on to the appropriate action. |
105 | 105 | * |
106 | 106 | * @param object $pfp_gateway_object The PayflowPro gateway object |
— | — | @@ -119,15 +119,15 @@ |
120 | 120 | // unset these values from the data aray since they are not part of the overall data hash |
121 | 121 | unset( $data[ 'data_hash' ] ); |
122 | 122 | // compare the data hash to make sure it's legit |
123 | | - if ( $this->compare_hash( $data_hash, serialize( $data ))) { |
| 123 | + if ( $this->compare_hash( $data_hash, serialize( $data ) ) ) { |
124 | 124 | $data[ 'numAttempt' ] = $num_attempt; // reset the current num attempt |
125 | | - $data[ 'data_hash' ] = $this->generate_hash( serialize( $data )); // hash the data array |
| 125 | + $data[ 'data_hash' ] = $this->generate_hash( serialize( $data ) ); // hash the data array |
126 | 126 | |
127 | 127 | // check to see if we have a valid action set for us to bypass minfraud |
128 | 128 | $actions = array( 'process', 'challenge', 'review', 'reject' ); |
129 | 129 | $action_hash = $data[ 'action' ]; // a hash of the action to take passed in by the form submission |
130 | 130 | foreach ( $actions as $action ) { |
131 | | - if ( $this->compare_hash( $action_hash, $action )) { |
| 131 | + if ( $this->compare_hash( $action_hash, $action ) ) { |
132 | 132 | // set the action that should be taken |
133 | 133 | $pfp_gateway_object->action = $action; |
134 | 134 | return TRUE; |
— | — | @@ -179,10 +179,10 @@ |
180 | 180 | |
181 | 181 | // user's user agent |
182 | 182 | global $wgRequest; |
183 | | - $minfraud_array[ "user_agent" ] = $wgRequest->getHeader('user-agent'); |
| 183 | + $minfraud_array[ "user_agent" ] = $wgRequest->getHeader( 'user-agent' ); |
184 | 184 | |
185 | 185 | // user's language |
186 | | - $minfraud_array[ 'accept_language' ] = $wgRequest->getHeader('accept-language'); |
| 186 | + $minfraud_array[ 'accept_language' ] = $wgRequest->getHeader( 'accept-language' ); |
187 | 187 | |
188 | 188 | // fetch the array of country codes |
189 | 189 | $country_codes = countryCodes(); |
— | — | @@ -225,8 +225,8 @@ |
226 | 226 | * |
227 | 227 | * This is a pretty dumb validator. It just checks to see if |
228 | 228 | * there is a value for a required field and if its length is > 0 |
229 | | - * |
230 | | - * @param array $minfraud_query which is the array you would pass to |
| 229 | + * |
| 230 | + * @param array $minfraud_query which is the array you would pass to |
231 | 231 | * minfraud in a query |
232 | 232 | * @result bool |
233 | 233 | */ |
— | — | @@ -242,7 +242,7 @@ |
243 | 243 | ); |
244 | 244 | |
245 | 245 | foreach ( $reqd_fields as $reqd_field ) { |
246 | | - if ( !isset( $minfraud_query[ $reqd_field ] ) || |
| 246 | + if ( !isset( $minfraud_query[ $reqd_field ] ) || |
247 | 247 | strlen( $minfraud_query[ $reqd_field ] ) < 1 ) { |
248 | 248 | return FALSE; |
249 | 249 | } |
— | — | @@ -254,7 +254,7 @@ |
255 | 255 | /** |
256 | 256 | * Determine the action for the processor to take |
257 | 257 | * |
258 | | - * Determined based on predefined riskScore ranges for |
| 258 | + * Determined based on predefined riskScore ranges for |
259 | 259 | * a given action. |
260 | 260 | * @param float risk score (returned from minFraud) |
261 | 261 | * @return array of actions to be taken |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/minfraud.php |
— | — | @@ -6,17 +6,17 @@ |
7 | 7 | * |
8 | 8 | * To install: |
9 | 9 | * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/minfraud/minfraud.php" ); |
10 | | - * |
| 10 | + * |
11 | 11 | */ |
12 | 12 | |
13 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
14 | | - die( "This file is part of the MinFraud for PayflowPro Gateway extension. It is not a valid entry point.\n" ); |
| 13 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 14 | + die( "This file is part of the MinFraud for PayflowPro Gateway extension. It is not a valid entry point.\n" ); |
15 | 15 | } |
16 | 16 | |
17 | 17 | $wgExtensionCredits['payflowprogateway_extras_minfraud'][] = array( |
18 | 18 | 'name' => 'minfraud', |
19 | | - 'author' =>'Arthur Richards', |
20 | | - 'url' => '', |
| 19 | + 'author' => 'Arthur Richards', |
| 20 | + 'url' => '', |
21 | 21 | 'description' => 'This extension uses the MaxMind minFraud service as a validator for the Payflow Pro gateway.' |
22 | 22 | ); |
23 | 23 | |
— | — | @@ -30,8 +30,8 @@ |
31 | 31 | * |
32 | 32 | * The keys to the array are the 'actions' to be taken (eg 'process'). |
33 | 33 | * The value for one of these keys is an array representing the lower |
34 | | - * and upper bounds for that action. For instance, |
35 | | - * $wgMinFraudActionRagnes = array( |
| 34 | + * and upper bounds for that action. For instance, |
| 35 | + * $wgMinFraudActionRagnes = array( |
36 | 36 | * 'process' => array( 0, 100) |
37 | 37 | * ... |
38 | 38 | * ); |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.body.php |
— | — | @@ -15,13 +15,13 @@ |
16 | 16 | return TRUE; |
17 | 17 | } |
18 | 18 | |
19 | | - //make sure the payflow response property has been set (signifying a transaction has been made) |
| 19 | + // make sure the payflow response property has been set (signifying a transaction has been made) |
20 | 20 | if ( !$pfp_gateway_object->payflow_response ) return FALSE; |
21 | 21 | |
22 | | - $this->log( |
23 | | - $data[ 'contribution_tracking_id' ], |
24 | | - "Payflow response: " . addslashes( $pfp_gateway_object->payflow_response[ 'RESPMSG' ] ), |
25 | | - '"' . addslashes( json_encode( $pfp_gateway_object->payflow_response )) . '"' |
| 22 | + $this->log( |
| 23 | + $data[ 'contribution_tracking_id' ], |
| 24 | + "Payflow response: " . addslashes( $pfp_gateway_object->payflow_response[ 'RESPMSG' ] ), |
| 25 | + '"' . addslashes( json_encode( $pfp_gateway_object->payflow_response ) ) . '"' |
26 | 26 | ); |
27 | 27 | return TRUE; |
28 | 28 | } |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.php |
— | — | @@ -8,14 +8,14 @@ |
9 | 9 | * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.php" |
10 | 10 | */ |
11 | 11 | |
12 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
13 | | - die( "This file is part of the Conversion Log for PayflowPro Gateway extension. It is not a valid entry point.\n"); |
| 12 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 13 | + die( "This file is part of the Conversion Log for PayflowPro Gateway extension. It is not a valid entry point.\n" ); |
14 | 14 | } |
15 | 15 | |
16 | 16 | $wgExtensionCredits['payflowprogateway_extras_conversionLog'][] = array( |
17 | 17 | 'name' => 'conversion log', |
18 | | - 'author' =>'Arthur Richards', |
19 | | - 'url' => '', |
| 18 | + 'author' => 'Arthur Richards', |
| 19 | + 'url' => '', |
20 | 20 | 'description' => "This extension handles logging for Payflow Gateway extension 'extras'" |
21 | 21 | ); |
22 | 22 | |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/extras.body.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | public function __construct() { |
15 | 15 | global $wgPayflowGatewayLog; |
16 | 16 | // prepare the log file if the user has specified one |
17 | | - if ( strlen( $wgPayflowGatewayLog) > 0 ) $this->prepare_log_file( $wgPayflowGatewayLog ); |
| 17 | + if ( strlen( $wgPayflowGatewayLog ) > 0 ) $this->prepare_log_file( $wgPayflowGatewayLog ); |
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
— | — | @@ -22,19 +22,19 @@ |
23 | 23 | * @param string path to log file |
24 | 24 | * @return resource Pointer for the log file |
25 | 25 | */ |
26 | | - protected function prepare_log_file( $log_file ){ |
| 26 | + protected function prepare_log_file( $log_file ) { |
27 | 27 | $this->log_fh = fopen( $log_file, 'a+' ); |
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Writes message to a log file |
32 | | - * |
| 32 | + * |
33 | 33 | * If a log file does not exist and could not be created, |
34 | 34 | * do nothing. |
35 | 35 | * @fixme Perhaps lack of log file can be handled better? |
36 | 36 | * @param string The message to log |
37 | 37 | */ |
38 | | - public function log( $id='', $status='', $data='' ) { |
| 38 | + public function log( $id = '', $status = '', $data = '' ) { |
39 | 39 | if ( !$this->log_fh ) { |
40 | 40 | echo "what log file?"; |
41 | 41 | return; |
— | — | @@ -63,7 +63,7 @@ |
64 | 64 | * @return bool |
65 | 65 | */ |
66 | 66 | public function compare_hash( $hash, $data ) { |
67 | | - if ( $hash == $this->generate_hash( $data )) { |
| 67 | + if ( $hash == $this->generate_hash( $data ) ) { |
68 | 68 | return TRUE; |
69 | 69 | } |
70 | 70 | |
— | — | @@ -75,5 +75,5 @@ |
76 | 76 | */ |
77 | 77 | public function __destruct() { |
78 | 78 | if ( $this->log_fh ) fclose( $this->log_fh ); |
79 | | - } |
| 79 | + } |
80 | 80 | } |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha-php/recaptchalib.php |
— | — | @@ -35,22 +35,22 @@ |
36 | 36 | /** |
37 | 37 | * The reCAPTCHA server URL's |
38 | 38 | */ |
39 | | -define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api"); |
40 | | -define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api"); |
41 | | -define("RECAPTCHA_VERIFY_SERVER", "www.google.com"); |
| 39 | +define( "RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api" ); |
| 40 | +define( "RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api" ); |
| 41 | +define( "RECAPTCHA_VERIFY_SERVER", "www.google.com" ); |
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Encodes the given data into a query string format |
45 | 45 | * @param $data - array of string elements to be encoded |
46 | 46 | * @return string - encoded request |
47 | 47 | */ |
48 | | -function _recaptcha_qsencode ($data) { |
| 48 | +function _recaptcha_qsencode ( $data ) { |
49 | 49 | $req = ""; |
50 | 50 | foreach ( $data as $key => $value ) |
51 | | - $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; |
| 51 | + $req .= $key . '=' . urlencode( stripslashes( $value ) ) . '&'; |
52 | 52 | |
53 | 53 | // Cut the last '&' |
54 | | - $req=substr($req,0,strlen($req)-1); |
| 54 | + $req = substr( $req, 0, strlen( $req ) -1 ); |
55 | 55 | return $req; |
56 | 56 | } |
57 | 57 | |
— | — | @@ -64,29 +64,29 @@ |
65 | 65 | * @param int port |
66 | 66 | * @return array response |
67 | 67 | */ |
68 | | -function _recaptcha_http_post($host, $path, $data, $port = 80) { |
| 68 | +function _recaptcha_http_post( $host, $path, $data, $port = 80 ) { |
69 | 69 | |
70 | | - $req = _recaptcha_qsencode ($data); |
| 70 | + $req = _recaptcha_qsencode ( $data ); |
71 | 71 | |
72 | 72 | $http_request = "POST $path HTTP/1.0\r\n"; |
73 | 73 | $http_request .= "Host: $host\r\n"; |
74 | 74 | $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; |
75 | | - $http_request .= "Content-Length: " . strlen($req) . "\r\n"; |
| 75 | + $http_request .= "Content-Length: " . strlen( $req ) . "\r\n"; |
76 | 76 | $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; |
77 | 77 | $http_request .= "\r\n"; |
78 | 78 | $http_request .= $req; |
79 | 79 | |
80 | 80 | $response = ''; |
81 | | - if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { |
82 | | - die ('Could not open socket'); |
| 81 | + if ( false == ( $fs = @fsockopen( $host, $port, $errno, $errstr, 10 ) ) ) { |
| 82 | + die ( 'Could not open socket' ); |
83 | 83 | } |
84 | 84 | |
85 | | - fwrite($fs, $http_request); |
| 85 | + fwrite( $fs, $http_request ); |
86 | 86 | |
87 | | - while ( !feof($fs) ) |
88 | | - $response .= fgets($fs, 1160); // One TCP-IP packet |
89 | | - fclose($fs); |
90 | | - $response = explode("\r\n\r\n", $response, 2); |
| 87 | + while ( !feof( $fs ) ) |
| 88 | + $response .= fgets( $fs, 1160 ); // One TCP-IP packet |
| 89 | + fclose( $fs ); |
| 90 | + $response = explode( "\r\n\r\n", $response, 2 ); |
91 | 91 | |
92 | 92 | return $response; |
93 | 93 | } |
— | — | @@ -103,26 +103,26 @@ |
104 | 104 | |
105 | 105 | * @return string - The HTML to be embedded in the user's form. |
106 | 106 | */ |
107 | | -function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) |
| 107 | +function recaptcha_get_html ( $pubkey, $error = null, $use_ssl = false ) |
108 | 108 | { |
109 | | - if ($pubkey == null || $pubkey == '') { |
110 | | - die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>"); |
| 109 | + if ( $pubkey == null || $pubkey == '' ) { |
| 110 | + die ( "To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>" ); |
111 | 111 | } |
112 | | - |
113 | | - if ($use_ssl) { |
| 112 | + |
| 113 | + if ( $use_ssl ) { |
114 | 114 | $server = RECAPTCHA_API_SECURE_SERVER; |
115 | 115 | } else { |
116 | 116 | $server = RECAPTCHA_API_SERVER; |
117 | 117 | } |
118 | 118 | |
119 | 119 | $errorpart = ""; |
120 | | - if ($error) { |
| 120 | + if ( $error ) { |
121 | 121 | $errorpart = "&error=" . $error; |
122 | 122 | } |
123 | | - return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script> |
| 123 | + return '<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubkey . $errorpart . '"></script> |
124 | 124 | |
125 | 125 | <noscript> |
126 | | - <iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/> |
| 126 | + <iframe src="' . $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/> |
127 | 127 | <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> |
128 | 128 | <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> |
129 | 129 | </noscript>'; |
— | — | @@ -149,27 +149,27 @@ |
150 | 150 | * @param array $extra_params an array of extra variables to post to the server |
151 | 151 | * @return ReCaptchaResponse |
152 | 152 | */ |
153 | | -function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array()) |
| 153 | +function recaptcha_check_answer ( $privkey, $remoteip, $challenge, $response, $extra_params = array() ) |
154 | 154 | { |
155 | | - if ($privkey == null || $privkey == '') { |
156 | | - die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>"); |
| 155 | + if ( $privkey == null || $privkey == '' ) { |
| 156 | + die ( "To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>" ); |
157 | 157 | } |
158 | 158 | |
159 | | - if ($remoteip == null || $remoteip == '') { |
160 | | - die ("For security reasons, you must pass the remote ip to reCAPTCHA"); |
| 159 | + if ( $remoteip == null || $remoteip == '' ) { |
| 160 | + die ( "For security reasons, you must pass the remote ip to reCAPTCHA" ); |
161 | 161 | } |
162 | 162 | |
163 | | - |
164 | | - |
165 | | - //discard spam submissions |
166 | | - if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { |
| 163 | + |
| 164 | + |
| 165 | + // discard spam submissions |
| 166 | + if ( $challenge == null || strlen( $challenge ) == 0 || $response == null || strlen( $response ) == 0 ) { |
167 | 167 | $recaptcha_response = new ReCaptchaResponse(); |
168 | 168 | $recaptcha_response->is_valid = false; |
169 | 169 | $recaptcha_response->error = 'incorrect-captcha-sol'; |
170 | 170 | return $recaptcha_response; |
171 | 171 | } |
172 | 172 | |
173 | | - $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", |
| 173 | + $response = _recaptcha_http_post ( RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", |
174 | 174 | array ( |
175 | 175 | 'privatekey' => $privkey, |
176 | 176 | 'remoteip' => $remoteip, |
— | — | @@ -178,10 +178,10 @@ |
179 | 179 | ) + $extra_params |
180 | 180 | ); |
181 | 181 | |
182 | | - $answers = explode ("\n", $response [1]); |
| 182 | + $answers = explode ( "\n", $response [1] ); |
183 | 183 | $recaptcha_response = new ReCaptchaResponse(); |
184 | 184 | |
185 | | - if (trim ($answers [0]) == 'true') { |
| 185 | + if ( trim ( $answers [0] ) == 'true' ) { |
186 | 186 | $recaptcha_response->is_valid = true; |
187 | 187 | } |
188 | 188 | else { |
— | — | @@ -199,45 +199,45 @@ |
200 | 200 | * @param string $domain The domain where the page is hosted |
201 | 201 | * @param string $appname The name of your application |
202 | 202 | */ |
203 | | -function recaptcha_get_signup_url ($domain = null, $appname = null) { |
204 | | - return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname)); |
| 203 | +function recaptcha_get_signup_url ( $domain = null, $appname = null ) { |
| 204 | + return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode ( array ( 'domains' => $domain, 'app' => $appname ) ); |
205 | 205 | } |
206 | 206 | |
207 | | -function _recaptcha_aes_pad($val) { |
| 207 | +function _recaptcha_aes_pad( $val ) { |
208 | 208 | $block_size = 16; |
209 | | - $numpad = $block_size - (strlen ($val) % $block_size); |
210 | | - return str_pad($val, strlen ($val) + $numpad, chr($numpad)); |
| 209 | + $numpad = $block_size - ( strlen ( $val ) % $block_size ); |
| 210 | + return str_pad( $val, strlen ( $val ) + $numpad, chr( $numpad ) ); |
211 | 211 | } |
212 | 212 | |
213 | 213 | /* Mailhide related code */ |
214 | 214 | |
215 | | -function _recaptcha_aes_encrypt($val,$ky) { |
216 | | - if (! function_exists ("mcrypt_encrypt")) { |
217 | | - die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed."); |
| 215 | +function _recaptcha_aes_encrypt( $val, $ky ) { |
| 216 | + if ( ! function_exists ( "mcrypt_encrypt" ) ) { |
| 217 | + die ( "To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed." ); |
218 | 218 | } |
219 | | - $mode=MCRYPT_MODE_CBC; |
220 | | - $enc=MCRYPT_RIJNDAEL_128; |
221 | | - $val=_recaptcha_aes_pad($val); |
222 | | - return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); |
| 219 | + $mode = MCRYPT_MODE_CBC; |
| 220 | + $enc = MCRYPT_RIJNDAEL_128; |
| 221 | + $val = _recaptcha_aes_pad( $val ); |
| 222 | + return mcrypt_encrypt( $enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ); |
223 | 223 | } |
224 | 224 | |
225 | 225 | |
226 | | -function _recaptcha_mailhide_urlbase64 ($x) { |
227 | | - return strtr(base64_encode ($x), '+/', '-_'); |
| 226 | +function _recaptcha_mailhide_urlbase64 ( $x ) { |
| 227 | + return strtr( base64_encode ( $x ), '+/', '-_' ); |
228 | 228 | } |
229 | 229 | |
230 | 230 | /* gets the reCAPTCHA Mailhide url for a given email, public key and private key */ |
231 | | -function recaptcha_mailhide_url($pubkey, $privkey, $email) { |
232 | | - if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) { |
233 | | - die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . |
234 | | - "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>"); |
| 231 | +function recaptcha_mailhide_url( $pubkey, $privkey, $email ) { |
| 232 | + if ( $pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null ) { |
| 233 | + die ( "To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . |
| 234 | + "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>" ); |
235 | 235 | } |
236 | | - |
237 | 236 | |
238 | | - $ky = pack('H*', $privkey); |
239 | | - $cryptmail = _recaptcha_aes_encrypt ($email, $ky); |
240 | | - |
241 | | - return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail); |
| 237 | + |
| 238 | + $ky = pack( 'H*', $privkey ); |
| 239 | + $cryptmail = _recaptcha_aes_encrypt ( $email, $ky ); |
| 240 | + |
| 241 | + return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ( $cryptmail ); |
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
— | — | @@ -245,15 +245,15 @@ |
246 | 246 | * eg, given johndoe@example,com return ["john", "example.com"]. |
247 | 247 | * the email is then displayed as john...@example.com |
248 | 248 | */ |
249 | | -function _recaptcha_mailhide_email_parts ($email) { |
250 | | - $arr = preg_split("/@/", $email ); |
| 249 | +function _recaptcha_mailhide_email_parts ( $email ) { |
| 250 | + $arr = preg_split( "/@/", $email ); |
251 | 251 | |
252 | | - if (strlen ($arr[0]) <= 4) { |
253 | | - $arr[0] = substr ($arr[0], 0, 1); |
254 | | - } else if (strlen ($arr[0]) <= 6) { |
255 | | - $arr[0] = substr ($arr[0], 0, 3); |
| 252 | + if ( strlen ( $arr[0] ) <= 4 ) { |
| 253 | + $arr[0] = substr ( $arr[0], 0, 1 ); |
| 254 | + } else if ( strlen ( $arr[0] ) <= 6 ) { |
| 255 | + $arr[0] = substr ( $arr[0], 0, 3 ); |
256 | 256 | } else { |
257 | | - $arr[0] = substr ($arr[0], 0, 4); |
| 257 | + $arr[0] = substr ( $arr[0], 0, 4 ); |
258 | 258 | } |
259 | 259 | return $arr; |
260 | 260 | } |
— | — | @@ -264,13 +264,13 @@ |
265 | 265 | * |
266 | 266 | * http://www.google.com/recaptcha/mailhide/apikey |
267 | 267 | */ |
268 | | -function recaptcha_mailhide_html($pubkey, $privkey, $email) { |
269 | | - $emailparts = _recaptcha_mailhide_email_parts ($email); |
270 | | - $url = recaptcha_mailhide_url ($pubkey, $privkey, $email); |
271 | | - |
272 | | - return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) . |
273 | | - "' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]); |
| 268 | +function recaptcha_mailhide_html( $pubkey, $privkey, $email ) { |
| 269 | + $emailparts = _recaptcha_mailhide_email_parts ( $email ); |
| 270 | + $url = recaptcha_mailhide_url ( $pubkey, $privkey, $email ); |
274 | 271 | |
| 272 | + return htmlentities( $emailparts[0] ) . "<a href='" . htmlentities ( $url ) . |
| 273 | + "' onclick=\"window.open('" . htmlentities ( $url ) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ( $emailparts [1] ); |
| 274 | + |
275 | 275 | } |
276 | 276 | |
277 | 277 | |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha.php |
— | — | @@ -6,14 +6,14 @@ |
7 | 7 | * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha.php" |
8 | 8 | */ |
9 | 9 | |
10 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
11 | | - die( "This file is part of the ReCaptcha for PayflowPro Gateway extension. It is not a valid entry point.\n"); |
| 10 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 11 | + die( "This file is part of the ReCaptcha for PayflowPro Gateway extension. It is not a valid entry point.\n" ); |
12 | 12 | } |
13 | 13 | |
14 | 14 | $wgExtensionCredits['payflowgateway_extras_recaptcha'][] = array( |
15 | 15 | 'name' => 'reCaptcha', |
16 | | - 'author' =>'Arthur Richards', |
17 | | - 'url' => '', |
| 16 | + 'author' => 'Arthur Richards', |
| 17 | + 'url' => '', |
18 | 18 | 'description' => "This extension exposes a reCpathca for 'challenged' transactions in the Payflowpro Gateway" |
19 | 19 | ); |
20 | 20 | |
— | — | @@ -30,4 +30,4 @@ |
31 | 31 | $wgAutoloadClasses['PayflowProGateway_Extras_ReCaptcha'] = $dir . "recaptcha.body.php"; |
32 | 32 | |
33 | 33 | // Set reCpatcha as plugin for 'challenge' action |
34 | | -$wgHooks["PayflowGatewayChallenge"][] = array( "PayflowProGateway_Extras_ReCaptcha::onChallenge"); |
| 34 | +$wgHooks["PayflowGatewayChallenge"][] = array( "PayflowProGateway_Extras_ReCaptcha::onChallenge" ); |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha.body.php |
— | — | @@ -28,10 +28,10 @@ |
29 | 29 | */ |
30 | 30 | public function challenge( &$pfp_gateway_object, &$data ) { |
31 | 31 | // if captcha posted, validate |
32 | | - if ( isset( $_POST[ 'recaptcha_response_field' ] )) { |
33 | | - //check the captcha response |
| 32 | + if ( isset( $_POST[ 'recaptcha_response_field' ] ) ) { |
| 33 | + // check the captcha response |
34 | 34 | $captcha_resp = $this->check_captcha(); |
35 | | - if ( $captcha_resp->is_valid ){ |
| 35 | + if ( $captcha_resp->is_valid ) { |
36 | 36 | // if validated, update the action and move on |
37 | 37 | $this->log( $data[ 'contribution_tracking_id' ], 'Captcha passed' ); |
38 | 38 | $pfp_gateway_object->action = "process"; |
— | — | @@ -51,17 +51,17 @@ |
52 | 52 | */ |
53 | 53 | public function display_captcha( &$pfp_gateway_object, &$data ) { |
54 | 54 | global $wgOut, $wgPayflowRecaptchaPublicKey, $wgProto; |
55 | | - |
| 55 | + |
56 | 56 | // log that a captcha's been triggered |
57 | 57 | $this->log( $data[ 'contribution_tracking_id' ], 'Captcha triggered' ); |
58 | | - |
| 58 | + |
59 | 59 | // check if we need to be using HTTPs to communicate with reCaptcha |
60 | 60 | $use_ssl = ( $wgProto == 'https' ) ? TRUE : FALSE; |
61 | | - |
| 61 | + |
62 | 62 | // construct the HTML used to display the captcha |
63 | | - $captcha_html = Xml::openElement( 'div', array( 'id' => 'mw-donate-captcha' )); |
| 63 | + $captcha_html = Xml::openElement( 'div', array( 'id' => 'mw-donate-captcha' ) ); |
64 | 64 | $captcha_html .= recaptcha_get_html( $wgPayflowRecaptchaPublicKey, $this->recap_err, $use_ssl ); |
65 | | - $captcha_html .= '<span class="creditcard-error-msg">' . wfMsg( 'payflowpro_gateway-error-msg-captcha-please') . '</span>'; |
| 65 | + $captcha_html .= '<span class="creditcard-error-msg">' . wfMsg( 'payflowpro_gateway-error-msg-captcha-please' ) . '</span>'; |
66 | 66 | $captcha_html .= Xml::closeElement( 'div' ); // close div#mw-donate-captcha |
67 | 67 | |
68 | 68 | // load up the form class |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | $form_obj->setCaptchaHTML( $captcha_html ); |
74 | 74 | |
75 | 75 | // output the form |
76 | | - $wgOut->addHTML( $form_obj->getForm()); |
| 76 | + $wgOut->addHTML( $form_obj->getForm() ); |
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | $resp = recaptcha_check_answer( $wgPayflowRecaptchaPrivateKey, |
85 | 85 | wfGetIP(), |
86 | 86 | $wgRequest->getText( 'recaptcha_challenge_field' ), |
87 | | - $wgRequest->getText( 'recaptcha_response_field' )); |
| 87 | + $wgRequest->getText( 'recaptcha_response_field' ) ); |
88 | 88 | |
89 | 89 | return $resp; |
90 | 90 | } |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/extras.php |
— | — | @@ -7,14 +7,14 @@ |
8 | 8 | * Note: This should be specified in LocalSettings.php BEFORE requiring any of the other 'extras' |
9 | 9 | */ |
10 | 10 | |
11 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
12 | | - die( "This file is part of PayflowPro Gateway extension. It is not a valid entry point.\n"); |
| 11 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 12 | + die( "This file is part of PayflowPro Gateway extension. It is not a valid entry point.\n" ); |
13 | 13 | } |
14 | 14 | |
15 | 15 | $wgExtensionCredits['payflowprogateway_extras'][] = array( |
16 | 16 | 'name' => 'extras', |
17 | | - 'author' =>'Arthur Richards', |
18 | | - 'url' => '', |
| 17 | + 'author' => 'Arthur Richards', |
| 18 | + 'url' => '', |
19 | 19 | 'description' => "This extension handles some of the set up required for PayflowPro Gateway extras" |
20 | 20 | ); |
21 | 21 | |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter2.php |
— | — | @@ -4,10 +4,10 @@ |
5 | 5 | public $paypal = false; // true for paypal only version |
6 | 6 | |
7 | 7 | public function __construct( &$form_data, &$form_errors ) { |
8 | | - global $wgOut, $wgScriptPath; |
| 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 | | - if ( !strlen( $this->getStylePath())) { |
| 11 | + if ( !strlen( $this->getStylePath() ) ) { |
12 | 12 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter.css' ); |
13 | 13 | } |
14 | 14 | |
— | — | @@ -20,33 +20,33 @@ |
21 | 21 | $this->paypal = $wgRequest->getBool( 'paypal', false ); |
22 | 22 | |
23 | 23 | $form = parent::generateBannerHeader(); |
24 | | - |
25 | | - $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0)); |
| 24 | + |
| 25 | + $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0 ) ); |
26 | 26 | $form .= Xml::openElement( 'tr' ); |
27 | 27 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
28 | | - |
| 28 | + |
29 | 29 | $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
30 | 30 | // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
31 | | - if ( $wgRequest->getText( 'language' )) $text_template .= '/' . $this->form_data[ 'language' ]; |
| 31 | + if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
32 | 32 | |
33 | | - $template = ( strlen( $text_template )) ? $wgOut->parse( '{{'.$text_template.'}}' ) : ''; |
| 33 | + $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
34 | 34 | // if the template doesn't exist, prevent the display of the red link |
35 | | - if ( preg_match( '/redlink\=1/', $template )) $template = NULL; |
| 35 | + if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
36 | 36 | $form .= $template; |
37 | | - |
| 37 | + |
38 | 38 | $form .= Xml::closeElement( 'td' ); |
39 | 39 | |
40 | 40 | $form .= Xml::openElement( 'td', array( 'id' => 'donate', 'valign' => 'top' ) ); |
41 | | - |
| 41 | + |
42 | 42 | // add noscript tags for javascript disabled browsers |
43 | 43 | $form .= $this->getNoScript(); |
44 | | - |
| 44 | + |
45 | 45 | // $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' )); |
46 | 46 | |
47 | 47 | // provide a place at the top of the form for displaying general messages |
48 | 48 | if ( $this->form_errors['general'] ) { |
49 | | - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' )); |
50 | | - if ( is_array( $this->form_errors['general'] )) { |
| 49 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) ); |
| 50 | + if ( is_array( $this->form_errors['general'] ) ) { |
51 | 51 | foreach ( $this->form_errors['general'] as $this->form_errors_msg ) { |
52 | 52 | $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg ); |
53 | 53 | } |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | |
74 | 74 | protected function generateBillingContainer() { |
75 | 75 | $form = ''; |
76 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' )); |
| 76 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); |
77 | 77 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
78 | 78 | $form .= $this->generateBillingFields(); |
79 | 79 | $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor |
— | — | @@ -86,12 +86,12 @@ |
87 | 87 | $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
88 | 88 | |
89 | 89 | $form = ''; |
90 | | - |
| 90 | + |
91 | 91 | if ( !$this->paypal ) { |
92 | 92 | // PayPal button |
93 | 93 | $form .= '<tr>'; |
94 | | - $form .= '<td style="text-align:center;" colspan="2"><big><b>'.wfMsg( 'payflowpro_gateway-paypal-button' ).'</b></big><br/><a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/paypal.png"/></a><br/>'. |
95 | | - '— '.wfMsg( 'payflowpro_gateway-or' ).' —<br/><big><b>'.wfMsg( 'payflowpro_gateway-donate-wikipedia' ).'</b></big></td>'; |
| 94 | + $form .= '<td style="text-align:center;" colspan="2"><big><b>' . wfMsg( 'payflowpro_gateway-paypal-button' ) . '</b></big><br/><a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="' . $scriptPath . '/paypal.png"/></a><br/>' . |
| 95 | + '— ' . wfMsg( 'payflowpro_gateway-or' ) . ' —<br/><big><b>' . wfMsg( 'payflowpro_gateway-donate-wikipedia' ) . '</b></big></td>'; |
96 | 96 | $form .= '</tr>'; |
97 | 97 | } |
98 | 98 | |
— | — | @@ -107,14 +107,14 @@ |
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( $wgPayflowGatewayPaypalURL ) ) { |
112 | 112 | $form .= '<tr>'; |
113 | 113 | $form .= '<td class="label"></td>'; |
114 | 114 | $form .= '<td>'; |
115 | | - $form .= Xml::hidden( 'PaypalRedirect', false ); |
| 115 | + $form .= Html::hidden( 'PaypalRedirect', false ); |
116 | 116 | $form .= Xml::tags( 'div', |
117 | 117 | array(), |
118 | | - Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) |
| 118 | + Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" ) ) |
119 | 119 | ); |
120 | 120 | $form .= '</td>'; |
121 | 121 | $form .= '</tr>'; |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | // country |
145 | 145 | $form .= $this->getCountryField(); |
146 | 146 | } |
147 | | - |
| 147 | + |
148 | 148 | // anonymous |
149 | 149 | $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'comment-option' ] : true; |
150 | 150 | $form .= '<tr>'; |
— | — | @@ -156,16 +156,16 @@ |
157 | 157 | |
158 | 158 | return $form; |
159 | 159 | } |
160 | | - |
| 160 | + |
161 | 161 | public function generateFormSubmit() { |
162 | 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' )); |
| 163 | + $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
| 164 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) ); |
165 | 165 | if ( $this->paypal ) { |
166 | | - $form .= Xml::hidden( 'PaypalRedirect', false ); |
167 | | - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button'), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit')); |
| 166 | + $form .= Html::hidden( 'PaypalRedirect', false ); |
| 167 | + $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button' ), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit' ) ); |
168 | 168 | } else { |
169 | | - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-donor-submit'), 'onclick' => 'submit_form( this )', 'type' => 'submit')); |
| 169 | + $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-donor-submit' ), 'onclick' => 'submit_form( this )', 'type' => 'submit' ) ); |
170 | 170 | $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button |
171 | 171 | $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
172 | 172 | wfMsg( 'payflowpro_gateway-donate-click' ); |
— | — | @@ -184,7 +184,7 @@ |
185 | 185 | // add hidden fields |
186 | 186 | $hidden_fields = $this->getHiddenFields(); |
187 | 187 | foreach ( $hidden_fields as $field => $value ) { |
188 | | - $form .= Xml::hidden( $field, $value ); |
| 188 | + $form .= Html::hidden( $field, $value ); |
189 | 189 | } |
190 | 190 | |
191 | 191 | $form .= Xml::closeElement( 'form' ); // close form 'payment' |
— | — | @@ -194,7 +194,7 @@ |
195 | 195 | $form .= Xml::closeElement( 'table' ); |
196 | 196 | return $form; |
197 | 197 | } |
198 | | - |
| 198 | + |
199 | 199 | /** |
200 | 200 | * Generates the donation footer ("There are other ways to give...") |
201 | 201 | * @returns string of HTML |
— | — | @@ -202,14 +202,14 @@ |
203 | 203 | public function generateDonationFooter() { |
204 | 204 | global $wgScriptPath; |
205 | 205 | $form = ''; |
206 | | - $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' )); |
207 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-secure-logos' )); |
208 | | - $form .= Xml::tags( 'p', array( 'class' => '' ), Xml::openElement( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/rapidssl_ssl_certificate.gif" ))); |
| 206 | + $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) ); |
| 207 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-secure-logos' ) ); |
| 208 | + $form .= Xml::tags( 'p', array( 'class' => '' ), Xml::openElement( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/rapidssl_ssl_certificate.gif" ) ) ); |
209 | 209 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info-secure-logos |
210 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' )); |
211 | | - $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-otherways-short' )); |
| 210 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' ) ); |
| 211 | + $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-otherways-short' ) ); |
212 | 212 | $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-credit-storage-processing' ) ); |
213 | | - $form .= Xml::tags( 'p', array( 'class' => ''), wfMsg( 'payflowpro_gateway-question-comment' ) ); |
| 213 | + $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-question-comment' ) ); |
214 | 214 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info-text |
215 | 215 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info |
216 | 216 | return $form; |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | class PayflowProGateway_Form_TwoStepTwoColumn extends PayflowProGateway_Form { |
5 | 5 | |
6 | 6 | public function __construct( &$form_data, &$form_errors ) { |
7 | | - global $wgOut, $wgScriptPath; |
| 7 | + global $wgOut; |
8 | 8 | |
9 | 9 | parent::__construct( $form_data, $form_errors ); |
10 | 10 | |
— | — | @@ -49,15 +49,14 @@ |
50 | 50 | } |
51 | 51 | |
52 | 52 | public function generateFormStart() { |
53 | | - global $wgPayflowGatewayHeader, $wgPayflwGatewayTest, $wgOut; |
54 | 53 | $form = $this->generateBannerHeader(); |
55 | 54 | |
56 | 55 | $form .= Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) ); |
57 | 56 | |
58 | 57 | // provide a place at the top of the form for displaying general messages |
59 | 58 | if ( $this->form_errors['general'] ) { |
60 | | - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' )); |
61 | | - if ( is_array( $this->form_errors['general'] )) { |
| 59 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) ); |
| 60 | + if ( is_array( $this->form_errors['general'] ) ) { |
62 | 61 | foreach ( $this->form_errors['general'] as $this->form_errors_msg ) { |
63 | 62 | $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg ); |
64 | 63 | } |
— | — | @@ -77,11 +76,11 @@ |
78 | 77 | $form .= "<p class='creditcard-error-msg'>" . $this->form_errors['retryMsg'] . "</p>"; |
79 | 78 | $form .= Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => $this->getNoCacheAction(), 'onsubmit' => 'return validate_form(this)', 'autocomplete' => 'off' ) ); |
80 | 79 | |
81 | | - $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section')); |
| 80 | + $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section' ) ); |
82 | 81 | $form .= $this->generatePersonalContainer(); |
83 | 82 | $form .= Xml::closeElement( 'div' ); // close div#left-column |
84 | 83 | |
85 | | - $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' )); |
| 84 | + $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' ) ); |
86 | 85 | $form .= $this->generatePaymentContainer(); |
87 | 86 | |
88 | 87 | return $form; |
— | — | @@ -89,10 +88,10 @@ |
90 | 89 | |
91 | 90 | public function generateFormSubmit() { |
92 | 91 | // submit button |
93 | | - $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit')); |
94 | | - $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' )); |
95 | | - //$form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' )); |
96 | | - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button'), 'onclick' => 'submit_form( this )', 'type' => 'submit')); |
| 92 | + $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
| 93 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) ); |
| 94 | + // $form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' )); |
| 95 | + $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button' ), 'onclick' => 'submit_form( this )', 'type' => 'submit' ) ); |
97 | 96 | $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button |
98 | 97 | $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
99 | 98 | wfMsg( 'payflowpro_gateway-donate-click' ); |
— | — | @@ -106,7 +105,7 @@ |
107 | 106 | // add hidden fields |
108 | 107 | $hidden_fields = $this->getHiddenFields(); |
109 | 108 | foreach ( $hidden_fields as $field => $value ) { |
110 | | - $form .= Xml::hidden( $field, $value ); |
| 109 | + $form .= Html::hidden( $field, $value ); |
111 | 110 | } |
112 | 111 | $form .= Xml::closeElement( 'div' ); // close div#right-column |
113 | 112 | $form .= Xml::closeElement( 'form' ); |
— | — | @@ -118,8 +117,8 @@ |
119 | 118 | |
120 | 119 | protected function generatePersonalContainer() { |
121 | 120 | $form = ''; |
122 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' )); ; |
123 | | - $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header','id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-cc-form-header-personal' )); |
| 121 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); ; |
| 122 | + $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-cc-form-header-personal' ) ); |
124 | 123 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
125 | 124 | |
126 | 125 | $form .= $this->generatePersonalFields(); |
— | — | @@ -159,8 +158,8 @@ |
160 | 159 | protected function generatePaymentContainer() { |
161 | 160 | $form = ''; |
162 | 161 | // credit card info |
163 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-payment-info' )); |
164 | | - $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-payment' ), wfMsg( 'payflowpro_gateway-cc-form-header-payment' )); |
| 162 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-payment-info' ) ); |
| 163 | + $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-payment' ), wfMsg( 'payflowpro_gateway-cc-form-header-payment' ) ); |
165 | 164 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) ); |
166 | 165 | |
167 | 166 | $form .= $this->generatePaymentFields(); |
— | — | @@ -172,16 +171,14 @@ |
173 | 172 | } |
174 | 173 | |
175 | 174 | protected function generatePaymentFields() { |
176 | | - global $wgScriptPath, $wgPayflowGatewayTest; |
| 175 | + global $wgScriptPath; |
177 | 176 | |
178 | | - $form = ''; |
179 | | - |
180 | 177 | // amount |
181 | 178 | $form = '<tr>'; |
182 | 179 | $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>'; |
183 | 180 | $form .= '</tr>'; |
184 | 181 | $form .= '<tr>'; |
185 | | - $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>'; |
| 182 | + $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount' ) . '</td>'; |
186 | 183 | $form .= '<td>' . Xml::input( 'amount', '7', $this->form_data['amount'], array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) . |
187 | 184 | ' ' . $this->generateCurrencyDropdown() . '</td>'; |
188 | 185 | $form .= '</tr>'; |
— | — | @@ -189,7 +186,7 @@ |
190 | 187 | // card logos |
191 | 188 | $form .= '<tr>'; |
192 | 189 | $form .= '<td />'; |
193 | | - $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>'; |
| 190 | + $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" ) ) . '</td>'; |
194 | 191 | $form .= '</tr>'; |
195 | 192 | |
196 | 193 | // credit card type |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter.php |
— | — | @@ -2,10 +2,10 @@ |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoStepTwoColumnLetter extends PayflowProGateway_Form_TwoStepTwoColumn { |
5 | 5 | public function __construct( &$form_data, &$form_errors ) { |
6 | | - global $wgOut, $wgScriptPath; |
| 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 | | - if ( !strlen( $this->getStylePath())) { |
| 9 | + if ( !strlen( $this->getStylePath() ) ) { |
10 | 10 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter.css' ); |
11 | 11 | } |
12 | 12 | |
— | — | @@ -17,17 +17,17 @@ |
18 | 18 | |
19 | 19 | $form = parent::generateBannerHeader(); |
20 | 20 | |
21 | | - $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0)); |
| 21 | + $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0 ) ); |
22 | 22 | $form .= Xml::openElement( 'tr' ); |
23 | 23 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
24 | 24 | |
25 | 25 | $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
26 | 26 | // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
27 | | - if ( $wgRequest->getText( 'language' )) $text_template .= '/' . $this->form_data[ 'language' ]; |
| 27 | + if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
28 | 28 | |
29 | | - $template = ( strlen( $text_template )) ? $wgOut->parse( '{{'.$text_template.'}}' ) : ''; |
| 29 | + $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
30 | 30 | // if the template doesn't exist, prevent the display of the red link |
31 | | - if ( preg_match( '/redlink\=1/', $template )) $template = NULL; |
| 31 | + if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
32 | 32 | $form .= $template; |
33 | 33 | |
34 | 34 | $form .= Xml::closeElement( 'td' ); |
— | — | @@ -37,12 +37,12 @@ |
38 | 38 | // add noscript tags for javascript disabled browsers |
39 | 39 | $form .= $this->getNoScript(); |
40 | 40 | |
41 | | - $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' )); |
| 41 | + $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' ) ); |
42 | 42 | |
43 | 43 | // provide a place at the top of the form for displaying general messages |
44 | 44 | if ( $this->form_errors['general'] ) { |
45 | | - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' )); |
46 | | - if ( is_array( $this->form_errors['general'] )) { |
| 45 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) ); |
| 46 | + if ( is_array( $this->form_errors['general'] ) ) { |
47 | 47 | foreach ( $this->form_errors['general'] as $this->form_errors_msg ) { |
48 | 48 | $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg ); |
49 | 49 | } |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | |
70 | 70 | protected function generateBillingContainer() { |
71 | 71 | $form = ''; |
72 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' )); |
| 72 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); |
73 | 73 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
74 | 74 | $form .= $this->generateBillingFields(); |
75 | 75 | $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor |
— | — | @@ -79,7 +79,6 @@ |
80 | 80 | |
81 | 81 | protected function generateBillingFields() { |
82 | 82 | global $wgScriptPath; |
83 | | - $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
84 | 83 | |
85 | 84 | $form = ''; |
86 | 85 | |
— | — | @@ -94,7 +93,7 @@ |
95 | 94 | $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>'; |
96 | 95 | $form .= '</tr>'; |
97 | 96 | $form .= '<tr>'; |
98 | | - $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>'; |
| 97 | + $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount' ) . '</td>'; |
99 | 98 | $form .= '<td>' . Xml::input( 'amount', '7', $this->form_data['amount'], array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) . |
100 | 99 | ' ' . $this->generateCurrencyDropdown() . '</td>'; |
101 | 100 | $form .= '</tr>'; |
— | — | @@ -102,7 +101,7 @@ |
103 | 102 | // card logos |
104 | 103 | $form .= '<tr>'; |
105 | 104 | $form .= '<td />'; |
106 | | - $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>'; |
| 105 | + $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" ) ) . '</td>'; |
107 | 106 | $form .= '</tr>'; |
108 | 107 | |
109 | 108 | // card number |
— | — | @@ -139,7 +138,7 @@ |
140 | 139 | // add hidden fields |
141 | 140 | $hidden_fields = $this->getHiddenFields(); |
142 | 141 | foreach ( $hidden_fields as $field => $value ) { |
143 | | - $form .= Xml::hidden( $field, $value ); |
| 142 | + $form .= Html::hidden( $field, $value ); |
144 | 143 | } |
145 | 144 | |
146 | 145 | $form .= Xml::closeElement( 'form' ); // close form 'payment' |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoColumnPayPal.php |
— | — | @@ -2,20 +2,18 @@ |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoColumnPayPal extends PayflowProGateway_Form_OneStepTwoColumn { |
5 | 5 | public function __construct( &$form_data, &$form_errors ) { |
6 | | - |
7 | 6 | parent::__construct( $form_data, $form_errors ); |
8 | 7 | } |
9 | 8 | |
10 | 9 | public function generateFormStart() { |
11 | | - global $wgPayflowGatewayHeader, $wgPayflwGatewayTest, $wgOut; |
12 | 10 | $form = $this->generateBannerHeader(); |
13 | 11 | |
14 | 12 | $form .= Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) ); |
15 | 13 | |
16 | 14 | // provide a place at the top of the form for displaying general messages |
17 | 15 | if ( $this->form_errors['general'] ) { |
18 | | - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' )); |
19 | | - if ( is_array( $this->form_errors['general'] )) { |
| 16 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) ); |
| 17 | + if ( is_array( $this->form_errors['general'] ) ) { |
20 | 18 | foreach ( $this->form_errors['general'] as $this->form_errors_msg ) { |
21 | 19 | $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg ); |
22 | 20 | } |
— | — | @@ -35,21 +33,20 @@ |
36 | 34 | $form .= "<p class='creditcard-error-msg'>" . $this->form_errors['retryMsg'] . "</p>"; |
37 | 35 | $form .= Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => $this->getNoCacheAction(), 'onsubmit' => 'return validate_form(this)', 'autocomplete' => 'off' ) ); |
38 | 36 | |
39 | | - $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section')); |
| 37 | + $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section' ) ); |
40 | 38 | $form .= $this->generatePersonalContainer(); |
41 | 39 | $form .= Xml::closeElement( 'div' ); // close div#left-column |
42 | 40 | |
43 | | - $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' )); |
| 41 | + $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' ) ); |
44 | 42 | $form .= $this->generatePaymentContainer(); |
45 | 43 | |
46 | 44 | return $form; |
47 | 45 | } |
48 | 46 | |
49 | 47 | protected function generatePersonalContainer() { |
50 | | - global $wgRequest; |
51 | 48 | $form = ''; |
52 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' )); ; |
53 | | - $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header','id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-make-your-donation' )); |
| 49 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); ; |
| 50 | + $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-make-your-donation' ) ); |
54 | 51 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
55 | 52 | |
56 | 53 | $form .= $this->generatePersonalFields(); |
— | — | @@ -70,10 +67,10 @@ |
71 | 68 | // email |
72 | 69 | $form .= $this->getEmailField(); |
73 | 70 | |
74 | | - //comment message |
| 71 | + // comment message |
75 | 72 | $form .= $this->getCommentMessageField(); |
76 | 73 | |
77 | | - //comment |
| 74 | + // comment |
78 | 75 | $form .= $this->getCommentField(); |
79 | 76 | |
80 | 77 | // anonymous |
— | — | @@ -86,7 +83,7 @@ |
87 | 84 | $form .= $this->getAmountField(); |
88 | 85 | |
89 | 86 | // PayPal button |
90 | | - if ( strlen( $wgPayflowGatewayPaypalURL )) { |
| 87 | + if ( strlen( $wgPayflowGatewayPaypalURL ) ) { |
91 | 88 | $form .= $this->getPaypalButton(); |
92 | 89 | } |
93 | 90 | |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/SingleColumn.php |
— | — | @@ -3,10 +3,10 @@ |
4 | 4 | class PayflowProGateway_Form_SingleColumn extends PayflowProGateway_Form_TwoColumnLetter { |
5 | 5 | |
6 | 6 | public function __construct( &$form_data, &$form_errors ) { |
7 | | - global $wgOut, $wgScriptPath; |
| 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 | | - if ( !strlen( $this->getStylePath())) { |
| 10 | + if ( !strlen( $this->getStylePath() ) ) { |
11 | 11 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/SingleColumn.css' ); |
12 | 12 | } |
13 | 13 | |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/Form.php |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | * using $this->setStylePath, which should be called before |
63 | 63 | * calling parent::__construct() |
64 | 64 | */ |
65 | | - if ( !strlen( $this->getStylePath())) { |
| 65 | + if ( !strlen( $this->getStylePath() ) ) { |
66 | 66 | $this->setStylePath(); |
67 | 67 | } |
68 | 68 | $wgOut->addExtensionStyle( $this->getStylePath() ); |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | * to the default css in css/Form.css |
77 | 77 | * @param string $style_path |
78 | 78 | */ |
79 | | - public function setStylePath( $style_path=null ) { |
| 79 | + public function setStylePath( $style_path = null ) { |
80 | 80 | global $wgScriptPath; |
81 | 81 | if ( !$style_path ) { |
82 | 82 | // load the default form CSS if the style path not explicitly set |
— | — | @@ -99,14 +99,14 @@ |
100 | 100 | public function generateDonationFooter() { |
101 | 101 | global $wgScriptPath; |
102 | 102 | $form = ''; |
103 | | - $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' )); |
104 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-secure-logos' )); |
105 | | - $form .= Xml::tags( 'p', array( 'class' => '' ), Xml::openElement( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/rapidssl_ssl_certificate.gif" ))); |
| 103 | + $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) ); |
| 104 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-secure-logos' ) ); |
| 105 | + $form .= Xml::tags( 'p', array( 'class' => '' ), Xml::openElement( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/rapidssl_ssl_certificate.gif" ) ) ); |
106 | 106 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info-secure-logos |
107 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' )); |
108 | | - $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-otherways' )); |
| 107 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' ) ); |
| 108 | + $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-otherways' ) ); |
109 | 109 | $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-credit-storage-processing' ) ); |
110 | | - $form .= Xml::tags( 'p', array( 'class' => ''), wfMsg( 'payflowpro_gateway-question-comment' ) ); |
| 110 | + $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-question-comment' ) ); |
111 | 111 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info-text |
112 | 112 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info |
113 | 113 | return $form; |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | 'name' => 'country', |
158 | 158 | 'id' => 'country', |
159 | 159 | 'onchange' => 'return disableStates( this )' |
160 | | - )); |
| 160 | + ) ); |
161 | 161 | $country_menu .= $country_options; |
162 | 162 | $country_menu .= Xml::closeElement( 'select' ); |
163 | 163 | |
— | — | @@ -192,7 +192,7 @@ |
193 | 193 | array( |
194 | 194 | 'name' => 'card', |
195 | 195 | 'id' => 'card' |
196 | | - )); |
| 196 | + ) ); |
197 | 197 | $card_menu .= $card_options; |
198 | 198 | $card_menu .= Xml::closeElement( 'select' ); |
199 | 199 | |
— | — | @@ -224,7 +224,7 @@ |
225 | 225 | array( |
226 | 226 | 'name' => 'mos', |
227 | 227 | 'id' => 'expiration' |
228 | | - )); |
| 228 | + ) ); |
229 | 229 | $expiry_month_menu .= $expiry_months; |
230 | 230 | $expiry_month_menu .= Xml::closeElement( 'select' ); |
231 | 231 | return $expiry_month_menu; |
— | — | @@ -251,7 +251,7 @@ |
252 | 252 | array( |
253 | 253 | 'name' => 'year', |
254 | 254 | 'id' => 'year', |
255 | | - )); |
| 255 | + ) ); |
256 | 256 | $expiry_year_menu .= $expiry_years; |
257 | 257 | $expiry_year_menu .= Xml::closeElement( 'select' ); |
258 | 258 | return $expiry_year_menu; |
— | — | @@ -281,7 +281,7 @@ |
282 | 282 | array( |
283 | 283 | 'name' => 'state', |
284 | 284 | 'id' => 'state' |
285 | | - )); |
| 285 | + ) ); |
286 | 286 | $state_menu .= $state_opts; |
287 | 287 | $state_menu .= Xml::closeElement( 'select' ); |
288 | 288 | |
— | — | @@ -319,7 +319,7 @@ |
320 | 320 | array( |
321 | 321 | 'name' => 'currency_code', |
322 | 322 | 'id' => 'input_currency_code' |
323 | | - )); |
| 323 | + ) ); |
324 | 324 | $currency_menu .= $currency_opts; |
325 | 325 | $currency_menu .= Xml::closeElement( 'select' ); |
326 | 326 | |
— | — | @@ -332,10 +332,8 @@ |
333 | 333 | * If you pass nothing in, we'll set the fields for you. |
334 | 334 | * @param array $hidden_fields |
335 | 335 | */ |
336 | | - public function setHiddenFields( $hidden_fields=NULL ) { |
| 336 | + public function setHiddenFields( $hidden_fields = NULL ) { |
337 | 337 | if ( !$hidden_fields ) { |
338 | | - global $wgRequest; |
339 | | - |
340 | 338 | $hidden_fields = array( |
341 | 339 | 'utm_source' => $this->form_data[ 'utm_source' ], |
342 | 340 | 'utm_medium' => $this->form_data[ 'utm_medium' ], |
— | — | @@ -365,7 +363,7 @@ |
366 | 364 | * @return array |
367 | 365 | */ |
368 | 366 | public function getHiddenFields() { |
369 | | - if ( !isset( $this->hidden_fields )) { |
| 367 | + if ( !isset( $this->hidden_fields ) ) { |
370 | 368 | $this->setHiddenFields(); |
371 | 369 | } |
372 | 370 | return $this->hidden_fields; |
— | — | @@ -378,7 +376,7 @@ |
379 | 377 | * @return string The HTML to display the captcha or an empty string |
380 | 378 | */ |
381 | 379 | public function getCaptchaHTML() { |
382 | | - if ( !strlen( $this->captcha_html )) { |
| 380 | + if ( !strlen( $this->captcha_html ) ) { |
383 | 381 | return ''; |
384 | 382 | } |
385 | 383 | return $this->captcha_html; |
— | — | @@ -403,7 +401,7 @@ |
404 | 402 | $template = ''; |
405 | 403 | |
406 | 404 | // intro text |
407 | | - if ( $wgRequest->getText('masthead', false)) { |
| 405 | + if ( $wgRequest->getText( 'masthead', false ) ) { |
408 | 406 | $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->form_data[ 'language' ] . '}}' ); |
409 | 407 | } elseif ( $wgPayflowGatewayHeader ) { |
410 | 408 | $header = str_replace( '@language', $this->form_data[ 'language' ], $wgPayflowGatewayHeader ); |
— | — | @@ -411,7 +409,7 @@ |
412 | 410 | } |
413 | 411 | |
414 | 412 | // make sure that we actually have a matching template to display so we don't display the 'redlink' |
415 | | - if ( strlen( $template ) && !preg_match( '/redlink\=1/', $template )) { |
| 413 | + if ( strlen( $template ) && !preg_match( '/redlink\=1/', $template ) ) { |
416 | 414 | $wgOut->addHtml( $template ); |
417 | 415 | } |
418 | 416 | } |
— | — | @@ -440,7 +438,7 @@ |
441 | 439 | $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>'; |
442 | 440 | $form .= '</tr>'; |
443 | 441 | $form .= '<tr>'; |
444 | | - $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>'; |
| 442 | + $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount' ) . '</td>'; |
445 | 443 | $form .= '<td>' . Xml::radio( 'amount', 100, $this->form_data['amount'] == 100 ) . '100 ' . |
446 | 444 | Xml::radio( 'amount', 50, $this->form_data['amount'] == 50 ) . '50 ' . |
447 | 445 | Xml::radio( 'amount', 35, $this->form_data['amount'] == 35 ) . '35 ' . |
— | — | @@ -485,7 +483,7 @@ |
486 | 484 | $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['cvv'] . '</span></td>'; |
487 | 485 | $form .= '<tr>'; |
488 | 486 | $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-security' ), 'cvv' ) . '</td>'; |
489 | | - $form .= '<td>' . Xml::input( 'cvv', '5', $cvv, array( 'type' => 'text', 'maxlength' => '10', 'id' => 'cvv', 'autocomplete' => 'off') ) . |
| 487 | + $form .= '<td>' . Xml::input( 'cvv', '5', $cvv, array( 'type' => 'text', 'maxlength' => '10', 'id' => 'cvv', 'autocomplete' => 'off' ) ) . |
490 | 488 | ' ' . '<a href="javascript:PopupCVV();">' . wfMsg( 'payflowpro_gateway-cvv-link' ) . '</a>' . |
491 | 489 | '</td>'; |
492 | 490 | $form .= '</tr>'; |
— | — | @@ -546,7 +544,7 @@ |
547 | 545 | protected function getCommentMessageField() { |
548 | 546 | $form = '<tr>'; |
549 | 547 | $form .= '<td colspan="2">'; |
550 | | - $form .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-comment-message' )); |
| 548 | + $form .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-comment-message' ) ); |
551 | 549 | $form .= '</td>'; |
552 | 550 | $form .= '</tr>'; |
553 | 551 | return $form; |
— | — | @@ -554,8 +552,8 @@ |
555 | 553 | |
556 | 554 | protected function getCommentField() { |
557 | 555 | $form = '<tr>'; |
558 | | - $form .= '<td class="label">' . Xml::label( wfMsg('payflowpro_gateway-comment'), 'comment' ) . '</td>'; |
559 | | - $form .= '<td>' . Xml::input( 'comment', '30', $this->form_data[ 'comment' ], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' )) . '</td>'; |
| 556 | + $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-comment' ), 'comment' ) . '</td>'; |
| 557 | + $form .= '<td>' . Xml::input( 'comment', '30', $this->form_data[ 'comment' ], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' ) ) . '</td>'; |
560 | 558 | $form .= '</tr>'; |
561 | 559 | return $form; |
562 | 560 | } |
— | — | @@ -577,7 +575,7 @@ |
578 | 576 | $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value ); |
579 | 577 | $form .= ' '; |
580 | 578 | // put the label inside Xml::openElement so any HTML in the msg might get rendered (right, Germany?) |
581 | | - $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' )); |
| 579 | + $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' ) ); |
582 | 580 | $form .= wfMsg( 'donate_interface-email-agreement' ); |
583 | 581 | $form .= Xml::closeElement( 'label' ); |
584 | 582 | $form .= '</td>'; |
— | — | @@ -591,10 +589,10 @@ |
592 | 590 | |
593 | 591 | $form = '<tr>'; |
594 | 592 | $form .= '<td class="paypal-button" colspan="2">'; |
595 | | - $form .= Xml::hidden( 'PaypalRedirect', false ); |
| 593 | + $form .= Html::hidden( 'PaypalRedirect', false ); |
596 | 594 | $form .= Xml::tags( 'div', |
597 | 595 | array(), |
598 | | - '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/donate_with_paypal.gif"/></a>' |
| 596 | + '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="' . $scriptPath . '/donate_with_paypal.gif"/></a>' |
599 | 597 | ); |
600 | 598 | $form .= '</td>'; |
601 | 599 | $form .= '</tr>'; |
— | — | @@ -687,15 +685,15 @@ |
688 | 686 | $url = $wgRequest->getFullRequestURL(); |
689 | 687 | $url_parts = wfParseUrl( $url ); |
690 | 688 | $query_array = wfCgiToArray( $url_parts[ 'query' ] ); |
691 | | - |
| 689 | + |
692 | 690 | // ensure that _cache_ does not get set in the URL |
693 | | - unset( $query_array[ '_cache_' ]); |
694 | | - |
| 691 | + unset( $query_array[ '_cache_' ] ); |
| 692 | + |
695 | 693 | // make sure no other data that might overwrite posted data makes it into the URL |
696 | 694 | foreach ( $this->form_data as $key => $value ) { |
697 | 695 | unset( $query_array[ $key ] ); |
698 | 696 | } |
699 | | - |
| 697 | + |
700 | 698 | // construct the submission url |
701 | 699 | return wfAppendQuery( $wgTitle->getLocalURL(), $query_array ); |
702 | 700 | } |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/OneStepTwoColumn.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | public $paypal = false; // true for paypal only version |
6 | 6 | |
7 | 7 | public function __construct( &$form_data, &$form_errors ) { |
8 | | - global $wgOut, $wgScriptPath; |
| 8 | + global $wgOut; |
9 | 9 | |
10 | 10 | parent::__construct( $form_data, $form_errors ); |
11 | 11 | |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | } |
63 | 63 | |
64 | 64 | public function generateFormStart() { |
65 | | - global $wgPayflowGatewayHeader, $wgPayflwGatewayTest, $wgOut, $wgRequest; |
| 65 | + global $wgRequest; |
66 | 66 | |
67 | 67 | $this->paypal = $wgRequest->getBool( 'paypal', false ); |
68 | 68 | |
— | — | @@ -71,8 +71,8 @@ |
72 | 72 | |
73 | 73 | // provide a place at the top of the form for displaying general messages |
74 | 74 | if ( $this->form_errors['general'] ) { |
75 | | - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' )); |
76 | | - if ( is_array( $this->form_errors['general'] )) { |
| 75 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) ); |
| 76 | + if ( is_array( $this->form_errors['general'] ) ) { |
77 | 77 | foreach ( $this->form_errors['general'] as $this->form_errors_msg ) { |
78 | 78 | $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg ); |
79 | 79 | } |
— | — | @@ -92,13 +92,13 @@ |
93 | 93 | $form .= "<p class='creditcard-error-msg'>" . $this->form_errors['retryMsg'] . "</p>"; |
94 | 94 | $form .= Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => $this->getNoCacheAction(), 'onsubmit' => 'return validate_form(this)', 'autocomplete' => 'off' ) ); |
95 | 95 | |
96 | | - $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section')); |
| 96 | + $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section' ) ); |
97 | 97 | $form .= $this->generatePersonalContainer(); |
98 | 98 | |
99 | 99 | if ( !$this->paypal ) { |
100 | 100 | $form .= Xml::closeElement( 'div' ); // close div#left-column |
101 | 101 | |
102 | | - $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' )); |
| 102 | + $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' ) ); |
103 | 103 | $form .= $this->generatePaymentContainer(); |
104 | 104 | } |
105 | 105 | |
— | — | @@ -106,13 +106,13 @@ |
107 | 107 | } |
108 | 108 | public function generateFormSubmit() { |
109 | 109 | // submit button |
110 | | - $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit')); |
111 | | - $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' )); |
| 110 | + $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
| 111 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) ); |
112 | 112 | if ( $this->paypal ) { |
113 | | - $form .= Xml::hidden( 'PaypalRedirect', false ); |
114 | | - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button'), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit')); |
| 113 | + $form .= Html::hidden( 'PaypalRedirect', false ); |
| 114 | + $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button' ), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit' ) ); |
115 | 115 | } else { |
116 | | - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button'), 'onclick' => 'submit_form( this )', 'type' => 'submit')); |
| 116 | + $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button' ), 'onclick' => 'submit_form( this )', 'type' => 'submit' ) ); |
117 | 117 | $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button |
118 | 118 | $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
119 | 119 | wfMsg( 'payflowpro_gateway-donate-click' ); |
— | — | @@ -128,7 +128,7 @@ |
129 | 129 | // add hidden fields |
130 | 130 | $hidden_fields = $this->getHiddenFields(); |
131 | 131 | foreach ( $hidden_fields as $field => $value ) { |
132 | | - $form .= Xml::hidden( $field, $value ); |
| 132 | + $form .= Html::hidden( $field, $value ); |
133 | 133 | } |
134 | 134 | $form .= Xml::closeElement( 'div' ); // close div#right-column |
135 | 135 | $form .= Xml::closeElement( 'form' ); |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | $template = ''; |
145 | 145 | |
146 | 146 | // intro text |
147 | | - if ( $wgRequest->getText('masthead', false)) { |
| 147 | + if ( $wgRequest->getText( 'masthead', false ) ) { |
148 | 148 | $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->form_data[ 'language' ] . '}}' ); |
149 | 149 | } elseif ( $wgPayflowGatewayHeader ) { |
150 | 150 | $header = str_replace( '@language', $this->form_data[ 'language' ], $wgPayflowGatewayHeader ); |
— | — | @@ -151,7 +151,7 @@ |
152 | 152 | } |
153 | 153 | |
154 | 154 | // make sure that we actually have a matching template to display so we don't display the 'redlink' |
155 | | - if ( strlen( $template ) && !preg_match( '/redlink\=1/', $template )) { |
| 155 | + if ( strlen( $template ) && !preg_match( '/redlink\=1/', $template ) ) { |
156 | 156 | $wgOut->addHtml( $template ); |
157 | 157 | } |
158 | 158 | } |
— | — | @@ -159,14 +159,14 @@ |
160 | 160 | protected function generatePersonalContainer() { |
161 | 161 | global $wgRequest, $wgScriptPath; |
162 | 162 | $form = ''; |
163 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' )); |
164 | | - $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header','id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-make-your-donation' )); |
| 163 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); |
| 164 | + $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-make-your-donation' ) ); |
165 | 165 | if ( !$this->paypal ) { |
166 | 166 | $source = $wgRequest->getText( 'utm_source' ); |
167 | 167 | $medium = $wgRequest->getText( 'utm_medium' ); |
168 | 168 | $campaign = $wgRequest->getText( 'utm_campaign' ); |
169 | 169 | $formname = $wgRequest->getText( 'form_name' ); |
170 | | - $form .= Xml::Tags( 'p', array( 'id' => 'payflowpro_gateway-cc_otherways' ), wfMsg( 'payflowpro_gateway-paypal', $wgScriptPath, $formname, $source, $medium, $campaign )); |
| 170 | + $form .= Xml::Tags( 'p', array( 'id' => 'payflowpro_gateway-cc_otherways' ), wfMsg( 'payflowpro_gateway-paypal', $wgScriptPath, $formname, $source, $medium, $campaign ) ); |
171 | 171 | } |
172 | 172 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
173 | 173 | |
— | — | @@ -187,10 +187,10 @@ |
188 | 188 | // email |
189 | 189 | $form .= $this->getEmailField(); |
190 | 190 | |
191 | | - //comment message |
| 191 | + // comment message |
192 | 192 | $form .= $this->getCommentMessageField(); |
193 | 193 | |
194 | | - //comment |
| 194 | + // comment |
195 | 195 | $form .= $this->getCommentField(); |
196 | 196 | |
197 | 197 | // anonymous |
— | — | @@ -208,7 +208,7 @@ |
209 | 209 | protected function generatePaymentContainer() { |
210 | 210 | $form = ''; |
211 | 211 | // credit card info |
212 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-payment-info' )); |
| 212 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-payment-info' ) ); |
213 | 213 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) ); |
214 | 214 | |
215 | 215 | $form .= $this->generatePaymentFields(); |
— | — | @@ -220,14 +220,14 @@ |
221 | 221 | } |
222 | 222 | |
223 | 223 | protected function generatePaymentFields() { |
224 | | - global $wgScriptPath, $wgPayflowGatewayTest; |
| 224 | + global $wgScriptPath; |
225 | 225 | |
226 | 226 | $form = ''; |
227 | 227 | |
228 | 228 | // card logos |
229 | 229 | $form .= '<tr>'; |
230 | 230 | $form .= '<td />'; |
231 | | - $form .= '<td> <br/>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>'; |
| 231 | + $form .= '<td> <br/>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" ) ) . '</td>'; |
232 | 232 | $form .= '</tr>'; |
233 | 233 | |
234 | 234 | // card number |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter.php |
— | — | @@ -4,10 +4,10 @@ |
5 | 5 | public $paypal = false; // true for paypal only version |
6 | 6 | |
7 | 7 | public function __construct( &$form_data, &$form_errors ) { |
8 | | - global $wgOut, $wgScriptPath; |
| 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 | | - if ( !strlen( $this->getStylePath())) { |
| 11 | + if ( !strlen( $this->getStylePath() ) ) { |
12 | 12 | $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter.css' ); |
13 | 13 | } |
14 | 14 | |
— | — | @@ -20,33 +20,33 @@ |
21 | 21 | $this->paypal = $wgRequest->getBool( 'paypal', false ); |
22 | 22 | |
23 | 23 | $form = parent::generateBannerHeader(); |
24 | | - |
25 | | - $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0)); |
| 24 | + |
| 25 | + $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0 ) ); |
26 | 26 | $form .= Xml::openElement( 'tr' ); |
27 | 27 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
28 | | - |
| 28 | + |
29 | 29 | $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
30 | 30 | // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
31 | | - if ( $wgRequest->getText( 'language' )) $text_template .= '/' . $this->form_data[ 'language' ]; |
| 31 | + if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
32 | 32 | |
33 | | - $template = ( strlen( $text_template )) ? $wgOut->parse( '{{'.$text_template.'}}' ) : ''; |
| 33 | + $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
34 | 34 | // if the template doesn't exist, prevent the display of the red link |
35 | | - if ( preg_match( '/redlink\=1/', $template )) $template = NULL; |
| 35 | + if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
36 | 36 | $form .= $template; |
37 | | - |
| 37 | + |
38 | 38 | $form .= Xml::closeElement( 'td' ); |
39 | 39 | |
40 | 40 | $form .= Xml::openElement( 'td', array( 'id' => 'donate', 'valign' => 'top' ) ); |
41 | | - |
| 41 | + |
42 | 42 | // add noscript tags for javascript disabled browsers |
43 | 43 | $form .= $this->getNoScript(); |
44 | | - |
45 | | - $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' )); |
46 | 44 | |
| 45 | + $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' ) ); |
| 46 | + |
47 | 47 | // provide a place at the top of the form for displaying general messages |
48 | 48 | if ( $this->form_errors['general'] ) { |
49 | | - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' )); |
50 | | - if ( is_array( $this->form_errors['general'] )) { |
| 49 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) ); |
| 50 | + if ( is_array( $this->form_errors['general'] ) ) { |
51 | 51 | foreach ( $this->form_errors['general'] as $this->form_errors_msg ) { |
52 | 52 | $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg ); |
53 | 53 | } |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | |
74 | 74 | protected function generateBillingContainer() { |
75 | 75 | $form = ''; |
76 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' )); |
| 76 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); |
77 | 77 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
78 | 78 | $form .= $this->generateBillingFields(); |
79 | 79 | $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor |
— | — | @@ -93,10 +93,10 @@ |
94 | 94 | // email |
95 | 95 | $form .= $this->getEmailField(); |
96 | 96 | |
97 | | - //comment message |
| 97 | + // comment message |
98 | 98 | $form .= $this->getCommentMessageField(); |
99 | 99 | |
100 | | - //comment |
| 100 | + // comment |
101 | 101 | $form .= $this->getCommentField(); |
102 | 102 | |
103 | 103 | // anonymous |
— | — | @@ -111,14 +111,14 @@ |
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( $wgPayflowGatewayPaypalURL ) ) { |
116 | 116 | $form .= '<tr>'; |
117 | 117 | $form .= '<td class="label"></td>'; |
118 | 118 | $form .= '<td class="paypal-button">'; |
119 | | - $form .= Xml::hidden( 'PaypalRedirect', false ); |
| 119 | + $form .= Html::hidden( 'PaypalRedirect', false ); |
120 | 120 | $form .= Xml::tags( 'div', |
121 | 121 | array(), |
122 | | - Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos2.gif" )) . ' <a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/donate_with_paypal.gif"/></a>' |
| 122 | + Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos2.gif" ) ) . ' <a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="' . $scriptPath . '/donate_with_paypal.gif"/></a>' |
123 | 123 | ); |
124 | 124 | $form .= '</td>'; |
125 | 125 | $form .= '</tr>'; |
— | — | @@ -159,7 +159,7 @@ |
160 | 160 | // add hidden fields |
161 | 161 | $hidden_fields = $this->getHiddenFields(); |
162 | 162 | foreach ( $hidden_fields as $field => $value ) { |
163 | | - $form .= Xml::hidden( $field, $value ); |
| 163 | + $form .= Html::hidden( $field, $value ); |
164 | 164 | } |
165 | 165 | |
166 | 166 | $form .= Xml::closeElement( 'form' ); // close form 'payment' |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | 'payflowpro_gateway-donor-state' => 'State', |
36 | 36 | 'payflowpro_gateway-donor-postal' => 'Postal code', |
37 | 37 | 'payflowpro_gateway-donor-country' => 'Country/Region', |
38 | | - 'payflowpro_gateway-donor-address'=> 'Address', |
| 38 | + 'payflowpro_gateway-donor-address' => 'Address', |
39 | 39 | 'payflowpro_gateway-donor-card' => 'Credit card', |
40 | 40 | 'payflowpro_gateway-donor-card-num' => 'Card number', |
41 | 41 | 'payflowpro_gateway-donor-expiration' => 'Expiration date', |
— | — | @@ -108,6 +108,7 @@ |
109 | 109 | 'payflowpro_gateway-state-in-us' => 'if inside the US', |
110 | 110 | 'payflowpro_gateway-comment' => 'Comment', |
111 | 111 | 'payflowpro_gateway-first' => 'First', |
| 112 | + 'payflowpro_gateway-middle' => 'Middle', |
112 | 113 | 'payflowpro_gateway-last' => 'Last', |
113 | 114 | 'payflowpro_gateway-other' => 'Other', |
114 | 115 | 'payflowpro_gateway-noscript-msg' => 'It appears that you do not have JavaScript enabled, or your browser does not support it. |
— | — | @@ -115,7 +116,85 @@ |
116 | 117 | 'payflowpro_gateway-noscript-redirect-msg' => 'If you cannot or do not wish to enable JavaScript, you may still contribute by visiting:', |
117 | 118 | 'payflowpro_gateway-anon-message' => 'Please list my name on the public donor list.', |
118 | 119 | 'payflowpro_gateway-donate-wikipedia' => 'Donate on Wikipedia', |
119 | | - 'payflowpro_gateway-or' => 'or' |
| 120 | + 'payflowpro_gateway-or' => 'or', |
| 121 | + 'payflowpro_gateway-your-information' => 'Your Information', |
| 122 | + 'payflowpro_gateway-mailing-address' => 'Mailing Address', |
| 123 | + 'payflowpro_gateway-billing-address' => 'Billing Address', |
| 124 | + 'payflowpro_gateway-billing-name' => 'Billing Name', |
| 125 | + 'payflowpro_gateway-title' => 'Title', |
| 126 | + 'payflowpro_gateway-suffix' => 'Suffix', |
| 127 | + 'payflowpro_gateway-company-name' => 'Company or Organization Name', |
| 128 | + 'payflowpro_gateway-address-1' => 'Address 1', |
| 129 | + 'payflowpro_gateway-address-2' => 'Address 2', |
| 130 | + 'payflowpro_gateway-address-lines' => 'Address Lines', |
| 131 | + 'payflowpro_gateway-address-line-2' => 'Address (Line 2)', |
| 132 | + 'payflowpro_gateway-street-address' => 'Street Address', |
| 133 | + 'payflowpro_gateway-street-address-line-2' => 'Street Address [line 2]', |
| 134 | + 'payflowpro_gateway-street-1' => 'Street 1', |
| 135 | + 'payflowpro_gateway-street-2' => 'Street 2', |
| 136 | + 'payflowpro_gateway-apartment-number' => 'Apt. #', |
| 137 | + 'payflowpro_gateway-city-town' => 'City/Town', |
| 138 | + 'payflowpro_gateway-town-city' => 'Town/City', |
| 139 | + 'payflowpro_gateway-state-province' => 'State/Province', |
| 140 | + 'payflowpro_gateway-zip' => 'Zip', |
| 141 | + 'payflowpro_gateway-zip-code' => 'Zip Code', |
| 142 | + 'payflowpro_gateway-zip-postal' => 'Zip/Postal', |
| 143 | + 'payflowpro_gateway-zip-postal-code' => 'Zip/Postal Code', |
| 144 | + 'payflowpro_gateway-billing-code' => 'Billing Zip', |
| 145 | + 'payflowpro_gateway-country' => 'Country', |
| 146 | + 'payflowpro_gateway-select-country' => 'Select Country', |
| 147 | + 'payflowpro_gateway-confirm-email' => 'Confirm Email', |
| 148 | + 'payflowpro_gateway-confirmation-email' => 'Confirmation Email', |
| 149 | + 'payflowpro_gateway-phone' => 'Phone', |
| 150 | + 'payflowpro_gateway-telephone' => 'Telephone', |
| 151 | + 'payflowpro_gateway-telephone-home' => 'Tel. (home)', |
| 152 | + 'payflowpro_gateway-billing-phone-number' => 'Billing Phone Number', |
| 153 | + 'payflowpro_gateway-donation-information' => 'Donation Information', |
| 154 | + 'payflowpro_gateway-cc-billing-information' => 'Credit Card Billing Information', |
| 155 | + 'payflowpro_gateway-pay-by-credit-card' => 'Pay By Credit Card', |
| 156 | + 'payflowpro_gateway-which-card' => 'Which Card Would You Like to Use', |
| 157 | + 'payflowpro_gateway-choose-donation-method' => 'Choose Donation Method', |
| 158 | + 'payflowpro_gateway-cardholders-name' => 'Cardholder’s Name', |
| 159 | + 'payflowpro_gateway-name-on-card' => 'Name on Card', |
| 160 | + 'payflowpro_gateway-type-of-card' => 'Type of Card', |
| 161 | + 'payflowpro_gateway-cards-accepted' => 'Cards Accepted', |
| 162 | + 'payflowpro_gateway-card-type' => 'Card Type', |
| 163 | + 'payflowpro_gateway-credit-card-type' => 'Credit Card Type', |
| 164 | + 'payflowpro_gateway-credit-card-number' => 'Credit Card Number', |
| 165 | + 'payflowpro_gateway-credit-card-number-abbreviated' => 'Credit Card #', |
| 166 | + 'payflowpro_gateway-credit-card-expiration' => 'Credit Card Expiration', |
| 167 | + 'payflowpro_gateway-card-expiration' => 'Card Expiration', |
| 168 | + 'payflowpro_gateway-select-month-of-expiration' => 'Select Month of Expiration', |
| 169 | + 'payflowpro_gateway-select-year-of-expiration' => 'Select Year of Expiration', |
| 170 | + 'payflowpro_gateway-expires-question' => 'Expires?', |
| 171 | + 'payflowpro_gateway-expires' => 'Expires', |
| 172 | + 'payflowpro_gateway-card-security-code' => 'Card Security Code', |
| 173 | + 'payflowpro_gateway-cvv' => 'CVV', |
| 174 | + 'payflowpro_gateway-cvv-number-abbreviated' => 'CVV #', |
| 175 | + 'payflowpro_gateway-cvv2' => 'CVV2', |
| 176 | + 'payflowpro_gateway-cvv-number' => 'CVV Number', |
| 177 | + 'payflowpro_gateway-verification-number' => 'Verification Number', |
| 178 | + 'payflowpro_gateway-what-is-this' => 'What is this?', |
| 179 | + 'payflowpro_gateway-do-not-include-dashes' => 'Please Do Not Include Dashes', |
| 180 | + 'payflowpro_gateway-please-donate-today' => 'Please Donate Today', |
| 181 | + 'payflowpro_gateway-donate-now' => 'Donate Now', |
| 182 | + 'payflowpro_gateway-please-select-gift-amount' => 'Please select a gift amount', |
| 183 | + 'payflowpro_gateway-select-gift-amount' => 'Select Gift Amount', |
| 184 | + 'payflowpro_gateway-select-amount' => 'Select Amount', |
| 185 | + 'payflowpro_gateway-amount' => 'Amount', |
| 186 | + 'payflowpro_gateway-make-a-donation' => 'Make a donation', |
| 187 | + 'payflowpro_gateway-enter-your-amount' => 'Or enter your amount in the box above', |
| 188 | + 'payflowpro_gateway-will-support-with-gift' => 'I will support with a gift of:', |
| 189 | + 'payflowpro_gateway-will-make-tax-deductible-gift' => 'I will make a tax-deductible gift of:', |
| 190 | + 'payflowpro_gateway-select-dollar-amount' => 'Select Dollar Amount', |
| 191 | + 'payflowpro_gateway-submit-my-secure-donation' => 'Submit My Secure Donation', |
| 192 | + 'payflowpro_gateway-next' => 'Next', |
| 193 | + 'payflowpro_gateway-continue' => 'Continue', |
| 194 | + 'payflowpro_gateway-cancel' => 'Cancel', |
| 195 | + |
| 196 | + // For more USA states, see payflowpro_gateway.us-states.i18n.php. |
| 197 | + 'payflowpro_gateway-state-dropdown-YY' => 'Select a State', |
| 198 | + 'payflowpro_gateway-state-dropdown-XX' => 'Outside the U.S.', |
120 | 199 | ); |
121 | 200 | |
122 | 201 | /** Message documentation (Message documentation) |
— | — | @@ -191,6 +270,12 @@ |
192 | 271 | 'payflowpro_gateway-first' => "first name (without the 'name')", |
193 | 272 | 'payflowpro_gateway-last' => "last name (without the 'name')", |
194 | 273 | 'payflowpro_gateway-other' => '{{Identical|Other}}', |
| 274 | + |
| 275 | + 'payflowpro_gateway-credit-card-number-abbreviated' => "Abbreviation of 'Credit Card Number'", |
| 276 | + 'payflowpro_gateway-cvv' => "Abbreviation of 'Card Verification Value'", |
| 277 | + 'payflowpro_gateway-cvv-number-abbreviated' => "Abbreviation of 'Card Verification Value Number'", |
| 278 | + 'payflowpro_gateway-cvv2' => "Abbreviation of 'Card Verification Value 2'", |
| 279 | + 'payflowpro_gateway-cvv-number' => "Abbreviation of 'Card Verification Value' + 'Number' (unabbreviated)" |
195 | 280 | ); |
196 | 281 | |
197 | 282 | /** Magyar (magázó) (Magyar (magázó)) |
— | — | @@ -682,6 +767,8 @@ |
683 | 768 | 'payflowpro_gateway-anon-message' => 'Калі ласка, унясіце маё імя ў публічны сьпіс ахвяравальнікаў.', |
684 | 769 | 'payflowpro_gateway-donate-wikipedia' => 'Ахвяраваць на Вікіпэдыю', |
685 | 770 | 'payflowpro_gateway-or' => 'ці', |
| 771 | + 'payflowpro_gateway-state-dropdown-YY' => 'Выбраць штат', |
| 772 | + 'payflowpro_gateway-state-dropdown-XX' => 'Не ў ЗША', |
686 | 773 | ); |
687 | 774 | |
688 | 775 | /** Bulgarian (Български) |
— | — | @@ -1015,10 +1102,13 @@ |
1016 | 1103 | 'payflowpro_gateway-anon-message' => 'Molim navedite moje ime na javnom spisku donatora.', |
1017 | 1104 | 'payflowpro_gateway-donate-wikipedia' => 'Donirajte na Wikipediji', |
1018 | 1105 | 'payflowpro_gateway-or' => 'ili', |
| 1106 | + 'payflowpro_gateway-state-dropdown-YY' => 'Odaberi Saveznu državu', |
| 1107 | + 'payflowpro_gateway-state-dropdown-XX' => 'Izvan SAD', |
1019 | 1108 | ); |
1020 | 1109 | |
1021 | 1110 | /** Catalan (Català) |
1022 | 1111 | * @author Aleator |
| 1112 | + * @author Martorell |
1023 | 1113 | * @author SMP |
1024 | 1114 | * @author Solde |
1025 | 1115 | */ |
— | — | @@ -1105,6 +1195,7 @@ |
1106 | 1196 | 'payflowpro_gateway-question-comment' => 'Preguntes o comentaris? Contacte: <a href="mailto:donate@wikimedia.org">donate@wikimedia.org</a>', |
1107 | 1197 | 'payflowpro_gateway-donate-click' => 'La vostra targeta de crèdit serà processada de manera segura.', |
1108 | 1198 | 'payflowpro_gateway-otherways' => 'Hi ha <a href="http://wikimediafoundation.org/wiki/Ways_to_Give/ca">altres maneres de fer donatius, incloent PayPal, xecs, o per correu</a>.', |
| 1199 | + 'payflowpro_gateway-otherways-short' => '<a href="http://wikimediafoundation.org/wiki/Ways_to_Give/ca">Altres maneres de donar</a>', |
1109 | 1200 | 'payflowpro_gateway-paypal' => 'Teniu un compte PayPal? <a href="$1/index.php/Special:PayflowProGateway?_cache_=true&paypal=true&masthead=none&form_name=$2&text_template=2010/JimmyAppealLong&language=ca&utm_source=$3&utm_medium=$4&utm_campaign=$5">Feu un donatiu amb PayPal</a>.', |
1110 | 1201 | 'payflowpro_gateway-credit-storage-processing' => 'Nosaltres no emmagatzemem la informació de la targeta de crèdit, i les vostres dades personals estan subjectes a la nostra <a href="http://wikimediafoundation.org/wiki/Donor_Privacy_Policy">política de privadesa</a>.', |
1111 | 1202 | 'payflowpro_gateway-token-mismatch' => "La vostra sessió ha caducat. Proveu d'omplir i enviar de nou el formulari.", |
— | — | @@ -1120,6 +1211,10 @@ |
1121 | 1212 | Per a proporcionar una experiència segura i agradable, el nostre formulari de donatius requereix JavaScript.', |
1122 | 1213 | 'payflowpro_gateway-noscript-redirect-msg' => 'Si no podeu o no voleu habilitar el JavaScript, podeu contribuir accedint a:', |
1123 | 1214 | 'payflowpro_gateway-anon-message' => 'Anoteu el meu nom a la llista pública de donants.', |
| 1215 | + 'payflowpro_gateway-donate-wikipedia' => 'Doneu a Wikipedia', |
| 1216 | + 'payflowpro_gateway-or' => 'o', |
| 1217 | + 'payflowpro_gateway-state-dropdown-YY' => 'Seleccioneu un estat', |
| 1218 | + 'payflowpro_gateway-state-dropdown-XX' => 'No sóc als EUA', |
1124 | 1219 | ); |
1125 | 1220 | |
1126 | 1221 | /** Czech (Česky) |
— | — | @@ -1229,8 +1324,22 @@ |
1230 | 1325 | 'payflowpro_gateway-anon-message' => 'Zveřejněte prosím mé jméno na seznamu dárců.', |
1231 | 1326 | 'payflowpro_gateway-donate-wikipedia' => 'Přispět na Wikipedii', |
1232 | 1327 | 'payflowpro_gateway-or' => 'nebo', |
| 1328 | + 'payflowpro_gateway-state-dropdown-YY' => 'Vyberte stát', |
| 1329 | + 'payflowpro_gateway-state-dropdown-XX' => 'Mimo USA', |
1233 | 1330 | ); |
1234 | 1331 | |
| 1332 | +/** Church Slavic (Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ) |
| 1333 | + * @author ОйЛ |
| 1334 | + */ |
| 1335 | +$messages['cu'] = array( |
| 1336 | + 'payflowpro_gateway-donor-currency-label' => 'пла́тьно срѣ́дьство', |
| 1337 | + 'payflowpro_gateway-donor-name' => 'и́мѧ', |
| 1338 | + 'payflowpro_gateway-donor-city' => 'гра́дъ', |
| 1339 | + 'payflowpro_gateway-donor-country' => 'дрьжава/страна', |
| 1340 | + 'payflowpro_gateway-error-msg-city' => 'гра́дъ', |
| 1341 | + 'payflowpro_gateway-or' => 'или', |
| 1342 | +); |
| 1343 | + |
1235 | 1344 | /** Welsh (Cymraeg) |
1236 | 1345 | * @author Arwel Parry |
1237 | 1346 | * @author Lloffiwr |
— | — | @@ -1431,6 +1540,8 @@ |
1432 | 1541 | 'payflowpro_gateway-anon-message' => 'Bitte meinen Namen in die öffentliche Spenderliste aufnehmen.', |
1433 | 1542 | 'payflowpro_gateway-donate-wikipedia' => 'Spenden auf Wikipedia', |
1434 | 1543 | 'payflowpro_gateway-or' => 'oder', |
| 1544 | + 'payflowpro_gateway-state-dropdown-YY' => 'Wähle ein Land', |
| 1545 | + 'payflowpro_gateway-state-dropdown-XX' => 'Außerhalb der Vereinigten Staaten', |
1435 | 1546 | ); |
1436 | 1547 | |
1437 | 1548 | /** German (formal address) (Deutsch (Sie-Form)) |
— | — | @@ -1440,6 +1551,7 @@ |
1441 | 1552 | $messages['de-formal'] = array( |
1442 | 1553 | 'payflowpro_gateway-form-message' => 'Verwenden Sie das untenstehende Formular, um per Kreditkarte zu spenden, oder', |
1443 | 1554 | 'payflowpro_gateway-form-message-2' => 'Um den Betrag oder die Währung zu ändern, können Sie zur <a href="https://www.mediawiki.org/index.php?title=Donate">Spendenseite</a> zurückkehren.', |
| 1555 | + 'payflow_gateway-error-msg-nopaypal' => 'Aufgrund eines technischen Problems können wir keine Verbindung zu PayPal herstellen. Bitte nutzen Sie stattdessen das Formular für Kreditkartenspenden.', |
1444 | 1556 | 'payflowpro_gateway-error-msg-email' => '** Bitte geben Sie eine gültige E-Mail-Adresse ein **', |
1445 | 1557 | 'payflowpro_gateway-error-msg-amex' => '** Bitte geben Sie eine korrekte American-Express-Kartennummer ein **', |
1446 | 1558 | 'payflowpro_gateway-error-msg-mc' => '** Bitte geben Sie eine korrekte Mastercard-Kartennummer ein **', |
— | — | @@ -1464,8 +1576,10 @@ |
1465 | 1577 | Bitte versuchen Sie es später noch einmal.', |
1466 | 1578 | 'php-response-declined' => 'Ihre Transaktion konnte nicht akzeptiert werden.', |
1467 | 1579 | 'payflowpro_gateway-thankyou' => 'Vielen Dank für Ihre Spende!', |
1468 | | - 'payflowpro_gateway-donate-click' => 'Nach dem Klick auf „{{int:payflowpro_gateway-donor-submit}}“ werden Ihre Kreditkarteninformationen verarbeitet.', |
1469 | | - 'payflowpro_gateway-credit-storage-processing' => 'Wir speichern Ihre Kreditkarteninformationen nicht, und Ihre persönlichen Daten unterliegen unseren <a href="http://wikimediafoundation.org/wiki/Donor_Privacy_Policy">Datenschutzbestimmungen</a>.', |
| 1580 | + 'payflowpro_gateway-question-comment' => 'Fragen oder Kommentare? Kontaktieren Sie uns unter: <a href="mailto:donate@wikimedia.org">donate@wikimedia.org</a>', |
| 1581 | + 'payflowpro_gateway-donate-click' => 'Ihre Kreditkarteninformationen werden gesichert verarbeitet.', |
| 1582 | + 'payflowpro_gateway-paypal' => 'Verfügen Sie über ein PayPal-Konto? <a href="$1/index.php/Special:PayflowProGateway?_cache_=true&paypal=true&masthead=none&form_name=$2&text_template=2010/JimmyAppealLong&language=en&utm_source=$3&utm_medium=$4&utm_campaign=$5">Spende per PayPal</a>.', |
| 1583 | + 'payflowpro_gateway-credit-storage-processing' => 'Wir speichern Ihre Kreditkarteninformationen nicht. Zudem unterliegen Ihre persönlichen Daten unseren <a href="http://wikimediafoundation.org/wiki/Donor_Privacy_Policy">Datenschutzbestimmungen</a>.', |
1470 | 1584 | 'payflowpro_gateway-token-mismatch' => 'Ihre Sitzung ist inzwischen abgelaufen. Bitte füllen Sie das Formular erneut aus und senden Sie es nochmals ab.', |
1471 | 1585 | ); |
1472 | 1586 | |
— | — | @@ -2166,6 +2280,7 @@ |
2167 | 2281 | ); |
2168 | 2282 | |
2169 | 2283 | /** Finnish (Suomi) |
| 2284 | + * @author Centerlink |
2170 | 2285 | * @author Crt |
2171 | 2286 | * @author Nike |
2172 | 2287 | * @author Olli |
— | — | @@ -2256,6 +2371,7 @@ |
2257 | 2372 | 'payflowpro_gateway-question-comment' => 'Kysymyksiä tai kommentteja? Ota yhteyttä: <a href="mailto:donate@wikimedia.org">donate@wikimedia.org</a>', |
2258 | 2373 | 'payflowpro_gateway-donate-click' => 'Luottokorttisi käsitellään turvallisesti.', |
2259 | 2374 | 'payflowpro_gateway-otherways' => 'On myös <a href="http://wikimediafoundation.org/wiki/Ways_to_Give/en">muita lahjoitustapoja, kuten PayPal, šekki tai posti</a>.', |
| 2375 | + 'payflowpro_gateway-otherways-short' => '<a href="http://wikimediafoundation.org/wiki/Ways_to_Give/en">Muut tavat antaa</a>', |
2260 | 2376 | 'payflowpro_gateway-paypal' => 'Onko sinulla PayPal-tili? <a href="$1/index.php/Special:PayflowProGateway?_cache_=true&paypal=true&masthead=none&form_name=$2&text_template=2010/JimmyAppealLong&language=en&utm_source=$3&utm_medium=$4&utm_campaign=$5">Lahjoita PayPalin avulla</a>.', |
2261 | 2377 | 'payflowpro_gateway-credit-storage-processing' => 'Emme tallenna luottokorttitietojasi, ja henkilökohtaisia tietojasi suojaavat <a href="http://wikimediafoundation.org/wiki/Wikimedia:Privacy_policy">tietoturvaperiaatteemme</a>.', |
2262 | 2378 | 'payflowpro_gateway-token-mismatch' => 'Istuntosi on vanhentunut. Yritä täyttämällä lomake uudestaan ja lähettämällä se.', |
— | — | @@ -2266,9 +2382,13 @@ |
2267 | 2383 | 'payflowpro_gateway-comment' => 'Kommentti', |
2268 | 2384 | 'payflowpro_gateway-first' => 'Ensimmäinen', |
2269 | 2385 | 'payflowpro_gateway-last' => 'Viimeinen', |
| 2386 | + 'payflowpro_gateway-other' => 'Muu', |
2270 | 2387 | 'payflowpro_gateway-noscript-msg' => 'Näyttää siltä, että et ole ottanut JavaScriptiä käyttöön, tai selaimesi ei tue sitä. |
2271 | 2388 | Jotta turvallinen ja miellyttävä lahjoituskokemus annettaisiin, lahjoituslomakkeemme vaatii JavaScriptin.', |
2272 | 2389 | 'payflowpro_gateway-noscript-redirect-msg' => 'Jos et voi tai et halua ottaa JavaScriptiä käyttöön, voit siltikin osallistua vierailemalla osoitteessa:', |
| 2390 | + 'payflowpro_gateway-anon-message' => 'Luettele nimeni julkisessa lahjoittajaluettelossa.', |
| 2391 | + 'payflowpro_gateway-donate-wikipedia' => 'Lahjoita Wikipediassa', |
| 2392 | + 'payflowpro_gateway-or' => 'tai', |
2273 | 2393 | ); |
2274 | 2394 | |
2275 | 2395 | /** French (Français) |
— | — | @@ -2467,6 +2587,13 @@ |
2468 | 2588 | 'payflowpro_gateway-last' => 'Dèrriér', |
2469 | 2589 | ); |
2470 | 2590 | |
| 2591 | +/** Friulian (Furlan) |
| 2592 | + * @author Klenje |
| 2593 | + */ |
| 2594 | +$messages['fur'] = array( |
| 2595 | + 'payflowpro_gateway-donor-name' => 'Non', |
| 2596 | +); |
| 2597 | + |
2471 | 2598 | /** Irish (Gaeilge) |
2472 | 2599 | * @author Kwekubo |
2473 | 2600 | */ |
— | — | @@ -3185,6 +3312,8 @@ |
3186 | 3313 | 'payflowpro_gateway-anon-message' => 'Per favor mentiona mi nomine in le lista public de donatores.', |
3187 | 3314 | 'payflowpro_gateway-donate-wikipedia' => 'Donar sur Wikipedia', |
3188 | 3315 | 'payflowpro_gateway-or' => 'o', |
| 3316 | + 'payflowpro_gateway-state-dropdown-YY' => 'Selige un stato', |
| 3317 | + 'payflowpro_gateway-state-dropdown-XX' => 'Extra le Statos Unite', |
3189 | 3318 | ); |
3190 | 3319 | |
3191 | 3320 | /** Indonesian (Bahasa Indonesia) |
— | — | @@ -3500,6 +3629,8 @@ |
3501 | 3630 | 'payflowpro_gateway-anon-message' => '寄付者の公開一覧への、自分の名前を追加を希望します。', |
3502 | 3631 | 'payflowpro_gateway-donate-wikipedia' => 'ウィキペディアに寄付', |
3503 | 3632 | 'payflowpro_gateway-or' => 'または', |
| 3633 | + 'payflowpro_gateway-state-dropdown-YY' => '州を選択', |
| 3634 | + 'payflowpro_gateway-state-dropdown-XX' => 'アメリカ合衆国以外', |
3504 | 3635 | ); |
3505 | 3636 | |
3506 | 3637 | /** Georgian (ქართული) |
— | — | @@ -3848,7 +3979,7 @@ |
3849 | 3980 | 'payflowpro_gateway-donor-name' => 'Numm:', |
3850 | 3981 | 'payflowpro_gateway-donor-fname' => 'Virnumm:', |
3851 | 3982 | 'payflowpro_gateway-donor-mname' => 'Zweete Virnumm:', |
3852 | | - 'payflowpro_gateway-donor-lname' => 'Familjennumm:', |
| 3983 | + 'payflowpro_gateway-donor-lname' => 'Familljennumm', |
3853 | 3984 | 'payflowpro_gateway-donor-street' => 'Strooss:', |
3854 | 3985 | 'payflowpro_gateway-donor-city' => 'Stad:', |
3855 | 3986 | 'payflowpro_gateway-donor-state' => 'Staat:', |
— | — | @@ -3873,7 +4004,7 @@ |
3874 | 4005 | 'payflowpro_gateway-error-msg-amount' => 'Betrag vum Don', |
3875 | 4006 | 'payflowpro_gateway-error-msg-emailAdd' => 'E-Mailadress', |
3876 | 4007 | 'payflowpro_gateway-error-msg-fname' => 'Virnumm', |
3877 | | - 'payflowpro_gateway-error-msg-lname' => 'Familjennumm', |
| 4008 | + 'payflowpro_gateway-error-msg-lname' => 'Familljennumm', |
3878 | 4009 | 'payflowpro_gateway-error-msg-street' => 'Adress', |
3879 | 4010 | 'payflowpro_gateway-error-msg-city' => 'Stad/Uertschaft', |
3880 | 4011 | 'payflowpro_gateway-error-msg-state' => 'Staat', |
— | — | @@ -3932,6 +4063,8 @@ |
3933 | 4064 | 'payflowpro_gateway-anon-message' => 'Setzt mäin Numm w.e.g. op déi ëffentlech Lëscht vun den Donateuren.', |
3934 | 4065 | 'payflowpro_gateway-donate-wikipedia' => 'Maacht en Don op Wikipedia', |
3935 | 4066 | 'payflowpro_gateway-or' => 'oder', |
| 4067 | + 'payflowpro_gateway-state-dropdown-YY' => 'Sicht e Staat eraus', |
| 4068 | + 'payflowpro_gateway-state-dropdown-XX' => 'Ausserhalb de Vereenegte Staate vun Amerika', |
3936 | 4069 | ); |
3937 | 4070 | |
3938 | 4071 | /** Limburgish (Limburgs) |
— | — | @@ -4092,6 +4225,8 @@ |
4093 | 4226 | 'payflowpro_gateway-anon-message' => 'Наведете ме во јавниот список на дарители.', |
4094 | 4227 | 'payflowpro_gateway-donate-wikipedia' => 'Донирајте на Википедија', |
4095 | 4228 | 'payflowpro_gateway-or' => 'или', |
| 4229 | + 'payflowpro_gateway-state-dropdown-YY' => 'Одберете сој. држава', |
| 4230 | + 'payflowpro_gateway-state-dropdown-XX' => 'Надвор од САД', |
4096 | 4231 | ); |
4097 | 4232 | |
4098 | 4233 | /** Malayalam (മലയാളം) |
— | — | @@ -4203,6 +4338,8 @@ |
4204 | 4339 | 'payflowpro_gateway-anon-message' => 'ദയവായി പൊതുസംഭാവകരുടെ പട്ടികയിൽ എന്റെ പേര് പ്രദർശിപ്പിക്കുക.', |
4205 | 4340 | 'payflowpro_gateway-donate-wikipedia' => 'വിക്കിപീഡിയയിൽ സംഭാവന ചെയ്യുക', |
4206 | 4341 | 'payflowpro_gateway-or' => 'അഥവാ', |
| 4342 | + 'payflowpro_gateway-state-dropdown-YY' => 'സംസ്ഥാനം തിരഞ്ഞെടുക്കുക', |
| 4343 | + 'payflowpro_gateway-state-dropdown-XX' => 'അമേരിക്കൻ ഐക്യനാടുകളല്ല', |
4207 | 4344 | ); |
4208 | 4345 | |
4209 | 4346 | /** Malay (Bahasa Melayu) |
— | — | @@ -4589,6 +4726,8 @@ |
4590 | 4727 | 'payflowpro_gateway-anon-message' => 'Mijn naam mag zichtbaar zijn op de publieke lijst met donoren.', |
4591 | 4728 | 'payflowpro_gateway-donate-wikipedia' => 'Doneren aan Wikipedia', |
4592 | 4729 | 'payflowpro_gateway-or' => 'of', |
| 4730 | + 'payflowpro_gateway-state-dropdown-YY' => 'Selecteer een staat', |
| 4731 | + 'payflowpro_gateway-state-dropdown-XX' => 'Buiten de VS', |
4593 | 4732 | ); |
4594 | 4733 | |
4595 | 4734 | /** Norwegian Nynorsk (Norsk (nynorsk)) |
— | — | @@ -4739,6 +4878,8 @@ |
4740 | 4879 | 'payflowpro_gateway-anon-message' => 'Vennligst list opp navnet mitt på den offentlige donorlisten.', |
4741 | 4880 | 'payflowpro_gateway-donate-wikipedia' => 'Doner på Wikipedia', |
4742 | 4881 | 'payflowpro_gateway-or' => 'eller', |
| 4882 | + 'payflowpro_gateway-state-dropdown-YY' => 'Velg en stat', |
| 4883 | + 'payflowpro_gateway-state-dropdown-XX' => 'Utenfor USA', |
4743 | 4884 | ); |
4744 | 4885 | |
4745 | 4886 | /** Occitan (Occitan) |
— | — | @@ -4948,6 +5089,8 @@ |
4949 | 5090 | 'payflowpro_gateway-anon-message' => 'Wyświetlaj mnie na publicznie widocznej liście darczyńców.', |
4950 | 5091 | 'payflowpro_gateway-donate-wikipedia' => 'Darowizna dla Wikipedii', |
4951 | 5092 | 'payflowpro_gateway-or' => 'lub', |
| 5093 | + 'payflowpro_gateway-state-dropdown-YY' => 'Wybierz stan', |
| 5094 | + 'payflowpro_gateway-state-dropdown-XX' => 'Poza USA', |
4952 | 5095 | ); |
4953 | 5096 | |
4954 | 5097 | /** Piedmontese (Piemontèis) |
— | — | @@ -5038,6 +5181,7 @@ |
5039 | 5182 | 'payflowpro_gateway-question-comment' => 'Chestion o coment? Contat: <a href="mailto:donate@wikimedia.org">donate@wikimedia.org</a>', |
5040 | 5183 | 'payflowpro_gateway-donate-click' => 'Soa carta ëd crédit a sarà tratà an manera sigura.', |
5041 | 5184 | 'payflowpro_gateway-otherways' => 'A-i é <a href="http://wikimediafoundation.org/wiki/Ways_to_Give/en">d\'àutre manere ëd doné, comprèis PayPal, s-cianchet, o pòsta</a>.', |
| 5185 | + 'payflowpro_gateway-otherways-short' => '<a href="http://wikimediafoundation.org/wiki/Ways_to_Give/en">Autre manere për doné</a>', |
5042 | 5186 | 'payflowpro_gateway-paypal' => 'Ha-lo un cont PayPal? <a href="$1/index.php/Special:PayflowProGateway?_cache_=true&paypal=true&masthead=none&form_name=$2&text_template=2010/JimmyAppealLong&language=en&utm_source=$3&utm_medium=$4&utm_campaign=$5">Ch\'a eufra con PayPal</a>.', |
5043 | 5187 | 'payflowpro_gateway-credit-storage-processing' => 'Noi i memorisoma pa j\'anformassion ëd soa carta ëd crédit, e ij sò dat përsonaj a son soget a nòstre <a href="http://wikimediafoundation.org/wiki/Donor_Privacy_Policy">régole ëd confidensialità</a>.', |
5044 | 5188 | 'payflowpro_gateway-token-mismatch' => "Soa session a l'é terminà. Për piasì, ch'a preuva a ampinì e a mandé torna ël formolari.", |
— | — | @@ -5052,6 +5196,10 @@ |
5053 | 5197 | 'payflowpro_gateway-noscript-msg' => "A smija ch'a l'abia nen JavaScript abilità, o sò navigador a lo manten pa. Për smon-e n'esperiensa sicura, sensa arzigh e piasosa, nòst formolari ëd donassion a ciama JavaScript.", |
5054 | 5198 | 'payflowpro_gateway-noscript-redirect-msg' => "S'a peul o a veul pa abilité JavaScript, a peul ancor contribuì an visitand:", |
5055 | 5199 | 'payflowpro_gateway-anon-message' => 'Për piasì lista mè nòm an sla lista pùblica dij donator.', |
| 5200 | + 'payflowpro_gateway-donate-wikipedia' => 'Doné dzora a Wikipedia', |
| 5201 | + 'payflowpro_gateway-or' => 'o', |
| 5202 | + 'payflowpro_gateway-state-dropdown-YY' => 'Selession-a në Stat', |
| 5203 | + 'payflowpro_gateway-state-dropdown-XX' => 'Fòra djë Stat Unì', |
5056 | 5204 | ); |
5057 | 5205 | |
5058 | 5206 | /** Pashto (پښتو) |
— | — | @@ -5203,6 +5351,8 @@ |
5204 | 5352 | 'payflowpro_gateway-anon-message' => 'Por favor, coloque o meu nome na lista pública de benfeitores.', |
5205 | 5353 | 'payflowpro_gateway-donate-wikipedia' => 'Faça um donativo na Wikipédia', |
5206 | 5354 | 'payflowpro_gateway-or' => 'ou', |
| 5355 | + 'payflowpro_gateway-state-dropdown-YY' => 'Seleccione um Estado.', |
| 5356 | + 'payflowpro_gateway-state-dropdown-XX' => 'Fora dos EUA.', |
5207 | 5357 | ); |
5208 | 5358 | |
5209 | 5359 | /** Brazilian Portuguese (Português do Brasil) |
— | — | @@ -5492,6 +5642,9 @@ |
5493 | 5643 | 'payflowpro_gateway-last' => 'Urteme', |
5494 | 5644 | 'payflowpro_gateway-other' => 'Otre', |
5495 | 5645 | 'payflowpro_gateway-anon-message' => "Se preghe de sckaffà 'u nome mèje jndr'à la liste de le donatore pubbleche.", |
| 5646 | + 'payflowpro_gateway-or' => 'o', |
| 5647 | + 'payflowpro_gateway-state-dropdown-YY' => "Scacchie 'nu State", |
| 5648 | + 'payflowpro_gateway-state-dropdown-XX' => 'Fore a le State Aunìte', |
5496 | 5649 | ); |
5497 | 5650 | |
5498 | 5651 | /** Russian (Русский) |
— | — | @@ -6048,6 +6201,8 @@ |
6049 | 6202 | 'payflowpro_gateway-anon-message' => 'Prosim, navedite moje ime na javnem seznamu donatorjev.', |
6050 | 6203 | 'payflowpro_gateway-donate-wikipedia' => 'Darujte na Wikipediji', |
6051 | 6204 | 'payflowpro_gateway-or' => 'ali', |
| 6205 | + 'payflowpro_gateway-state-dropdown-YY' => 'Izberite državo', |
| 6206 | + 'payflowpro_gateway-state-dropdown-XX' => 'Izven ZDA', |
6052 | 6207 | ); |
6053 | 6208 | |
6054 | 6209 | /** Serbian Cyrillic ekavian (Српски (ћирилица)) |
— | — | @@ -6885,6 +7040,7 @@ |
6886 | 7041 | 'payflowpro_gateway-anon-message' => "Будь ласка, включіть моє ім'я у відкритий список донорів", |
6887 | 7042 | 'payflowpro_gateway-donate-wikipedia' => 'Пожертвувати на Вікіпедію', |
6888 | 7043 | 'payflowpro_gateway-or' => 'або', |
| 7044 | + 'payflowpro_gateway-state-dropdown-XX' => 'За межами США', |
6889 | 7045 | ); |
6890 | 7046 | |
6891 | 7047 | /** Vèneto (Vèneto) |
— | — | @@ -7095,6 +7251,8 @@ |
7096 | 7252 | 'payflowpro_gateway-anon-message' => 'Xin ghi tên của tôi vào danh sách người đóng góp công cộng.', |
7097 | 7253 | 'payflowpro_gateway-donate-wikipedia' => 'Quyên góp trên Wikipedia', |
7098 | 7254 | 'payflowpro_gateway-or' => 'hoặc', |
| 7255 | + 'payflowpro_gateway-state-dropdown-YY' => 'Chọn tiểu bang', |
| 7256 | + 'payflowpro_gateway-state-dropdown-XX' => 'Bên ngoài Hoa Kỳ', |
7099 | 7257 | ); |
7100 | 7258 | |
7101 | 7259 | /** Volapük (Volapük) |
— | — | @@ -7202,6 +7360,7 @@ |
7203 | 7361 | /** Simplified Chinese (中文(简体)) |
7204 | 7362 | * @author Bencmq |
7205 | 7363 | * @author Chenxiaoqino |
| 7364 | + * @author Hydra |
7206 | 7365 | * @author Liangent |
7207 | 7366 | * @author Wilsonmess |
7208 | 7367 | */ |
— | — | @@ -7298,9 +7457,12 @@ |
7299 | 7458 | 'payflowpro_gateway-comment' => '注释', |
7300 | 7459 | 'payflowpro_gateway-first' => '首先', |
7301 | 7460 | 'payflowpro_gateway-last' => '最后', |
| 7461 | + 'payflowpro_gateway-other' => '其他', |
7302 | 7462 | 'payflowpro_gateway-noscript-msg' => '似乎你没有启用JavaScript,或者你的浏览器不支持JavaScript。 |
7303 | 7463 | 为了给你提供安全、 舒适的体验,我们的捐助表格需要使用JavaScript。', |
7304 | 7464 | 'payflowpro_gateway-noscript-redirect-msg' => '如果你不想或不能启用JavaScript, 你依然可以在以下地址完成捐助:', |
| 7465 | + 'payflowpro_gateway-or' => '或者', |
| 7466 | + 'payflowpro_gateway-state-dropdown-XX' => '不再美国内', |
7305 | 7467 | ); |
7306 | 7468 | |
7307 | 7469 | /** Traditional Chinese (中文(繁體)) |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 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' ) ) { |
| 5 | +if ( !defined( 'MEDIAWIKI' ) ) { |
6 | 6 | echo <<<EOT |
7 | 7 | To install PayflowPro Gateway extension, put the following line in LocalSettings.php: |
8 | 8 | require_once( "\$IP/extensions/payflowpro_gateway/payflowpro_gateway.php" ); |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | ); |
21 | 21 | |
22 | 22 | // Set up the new special page |
23 | | -$dir = dirname(__FILE__) . '/'; |
| 23 | +$dir = dirname( __FILE__ ) . '/'; |
24 | 24 | $wgAutoloadClasses['PayflowProGateway'] = $dir . 'payflowpro_gateway.body.php'; |
25 | 25 | $wgAutoloadClasses[ 'PayflowProGateway_Form' ] = $dir . 'forms/Form.php'; |
26 | 26 | $wgAutoloadClasses[ 'PayflowProGateway_Form_OneStepTwoColumn' ] = $dir . 'forms/OneStepTwoColumn.php'; |
— | — | @@ -43,10 +43,10 @@ |
44 | 44 | |
45 | 45 | $wgPayFlowProGatewayCSSVersion = 1; |
46 | 46 | |
47 | | -$wgPayflowProPartnerID = ''; //PayPal or original authorized reseller |
| 47 | +$wgPayflowProPartnerID = ''; // PayPal or original authorized reseller |
48 | 48 | $wgPayflowProVendorID = ''; // paypal merchant login ID |
49 | | -$wgPayflowProUserID = ''; //if one or more users are set up, authorized user ID, else same as VENDOR |
50 | | -$wgPayflowProPassword = ''; //merchant login password |
| 49 | +$wgPayflowProUserID = ''; // if one or more users are set up, authorized user ID, else same as VENDOR |
| 50 | +$wgPayflowProPassword = ''; // merchant login password |
51 | 51 | |
52 | 52 | // a boolean to determine if we're in testing mode |
53 | 53 | $wgPayflowGatewayTest = FALSE; |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | * |
77 | 77 | * This string gets run like so: $wg->addHtml( $wg->Parse( $wgpayflowGatewayHeader )) |
78 | 78 | * You can use '@language' as a placeholder token to extract the user's language. |
79 | | - * |
| 79 | + * |
80 | 80 | */ |
81 | 81 | $wgPayflowGatewayHeader = NULL; |
82 | 82 | |
— | — | @@ -86,10 +86,10 @@ |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Proxy settings |
90 | | - * |
| 90 | + * |
91 | 91 | * If you need to use an HTTP proxy for outgoing traffic, |
92 | 92 | * set wgPayflowGatweayUseHTTPProxy=TRUE and set $wgPayflowGatewayHTTPProxy |
93 | | - * to the proxy desination. |
| 93 | + * to the proxy desination. |
94 | 94 | * eg: |
95 | 95 | * $wgPayflowGatewayUseHTTPProxy=TRUE; |
96 | 96 | * $wgPayflowGatewayHTTPProxy='192.168.1.1:3128' |
— | — | @@ -104,14 +104,14 @@ |
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Set the max-age value for Squid |
108 | | - * |
| 108 | + * |
109 | 109 | * If you have Squid enabled for caching, use this variable to configure |
110 | 110 | * the s-max-age for cached requests. |
111 | 111 | * @var int Time in seconds |
112 | 112 | */ |
113 | 113 | $wgPayflowSMaxAge = 6000; |
114 | 114 | |
115 | | -/** |
| 115 | +/** |
116 | 116 | * Hooks required to interface with the donation extension (include <donate> on page) |
117 | 117 | * |
118 | 118 | * gwValue supplies the value of the form option, the name that appears on the form |
— | — | @@ -125,21 +125,21 @@ |
126 | 126 | $wgAutoloadClasses[ 'ApiPayflowProGateway' ] = $dir . 'api_payflowpro_gateway.php'; |
127 | 127 | |
128 | 128 | function payflowGatewayConnection() { |
129 | | - global $wgPayflowGatewayDBserver, $wgPayflowGatewayDBname; |
130 | | - global $wgPayflowGatewayDBuser, $wgPayflowGatewayDBpassword; |
| 129 | + global $wgPayflowGatewayDBserver, $wgPayflowGatewayDBname; |
| 130 | + global $wgPayflowGatewayDBuser, $wgPayflowGatewayDBpassword; |
131 | 131 | |
132 | | - static $db; |
| 132 | + static $db; |
133 | 133 | |
134 | | - if ( !$db ) { |
135 | | - $db = new DatabaseMysql( |
136 | | - $wgPayflowGatewayDBserver, |
137 | | - $wgPayflowGatewayDBuser, |
138 | | - $wgPayflowGatewayDBpassword, |
139 | | - $wgPayflowGatewayDBname ); |
140 | | - $db->query( "SET names utf8" ); |
141 | | - } |
| 134 | + if ( !$db ) { |
| 135 | + $db = new DatabaseMysql( |
| 136 | + $wgPayflowGatewayDBserver, |
| 137 | + $wgPayflowGatewayDBuser, |
| 138 | + $wgPayflowGatewayDBpassword, |
| 139 | + $wgPayflowGatewayDBname ); |
| 140 | + $db->query( "SET names utf8" ); |
| 141 | + } |
142 | 142 | |
143 | | - return $db; |
| 143 | + return $db; |
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
— | — | @@ -147,22 +147,21 @@ |
148 | 148 | * also supplies currencies supported by this gateway |
149 | 149 | */ |
150 | 150 | function pfpGatewayValue( &$values ) { |
| 151 | + $values['payflow'] = array( |
| 152 | + 'gateway' => 'payflow', |
| 153 | + 'display_name' => 'Credit Card', |
| 154 | + 'form_value' => 'payflow', |
| 155 | + 'currencies' => array( |
| 156 | + 'GBP' => 'GBP: British Pound', |
| 157 | + 'EUR' => 'EUR: Euro', |
| 158 | + 'USD' => 'USD: U.S. Dollar', |
| 159 | + 'AUD' => 'AUD: Australian Dollar', |
| 160 | + 'CAD' => 'CAD: Canadian Dollar', |
| 161 | + 'JPY' => 'JPY: Japanese Yen', |
| 162 | + ), |
| 163 | + ); |
151 | 164 | |
152 | | - $values['payflow'] = array( |
153 | | - 'gateway' => 'payflow', |
154 | | - 'display_name' => 'Credit Card', |
155 | | - 'form_value' => 'payflow', |
156 | | - 'currencies' => array( |
157 | | - 'GBP' => 'GBP: British Pound', |
158 | | - 'EUR' => 'EUR: Euro', |
159 | | - 'USD' => 'USD: U.S. Dollar', |
160 | | - 'AUD' => 'AUD: Australian Dollar', |
161 | | - 'CAD' => 'CAD: Canadian Dollar', |
162 | | - 'JPY' => 'JPY: Japanese Yen', |
163 | | - ), |
164 | | - ); |
165 | | - |
166 | | - return true; |
| 165 | + return true; |
167 | 166 | } |
168 | 167 | |
169 | 168 | /** |
— | — | @@ -173,15 +172,8 @@ |
174 | 173 | * the result might look like this: http://www.yourdomain.com/index.php?title=Special:PayflowPro&amount=75.00¤cy_code=USD&payment_method=payflow |
175 | 174 | */ |
176 | 175 | function pfpGatewayPage( &$url ) { |
177 | | - global $wgScript; |
| 176 | + global $wgScript; |
178 | 177 | |
179 | | - $url['payflow'] = $wgScript . "?title=Special:PayflowProGateway"; |
180 | | - return true; |
| 178 | + $url['payflow'] = $wgScript . "?title=Special:PayflowProGateway"; |
| 179 | + return true; |
181 | 180 | } |
182 | | - |
183 | | -//Add JQuery |
184 | | -$wgHooks['BeforePageDisplay'][] = 'pfpAddJQuery'; |
185 | | -function pfpAddJQuery($out, $sk){ |
186 | | - $out->includeJQuery(); |
187 | | - return true; |
188 | | -} |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/owa_get_info.js |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | //NOTE: This only works as long as sid is the last param in the OWA cookie |
8 | 8 | if(owaS_start_index >= 0){ |
9 | 9 | var owaSessionID = owa_s_val.substr(owaS_start_index + owa_s_ident.length); |
10 | | - if(document.getElementById("owa_session_id") && |
| 10 | + if(document.getElementById("owa_session_id") && |
11 | 11 | document.getElementById("owa_pageref") ){ ){ |
12 | 12 | document.getElementById("owa_session_id").value = owaSessionID; |
13 | 13 | document.getElementById("owa_pageref").value = encode(window.location); |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.us-states.i18n.php |
— | — | @@ -10,8 +10,9 @@ |
11 | 11 | |
12 | 12 | /** English */ |
13 | 13 | $messages['en'] = array( |
14 | | - 'payflowpro_gateway-state-dropdown-YY' => 'Select a State', |
15 | | - 'payflowpro_gateway-state-dropdown-XX' => 'Outside the U.S.', |
| 14 | + // Below two messages are in payflowpro_gateway.i18n.php. |
| 15 | + //'payflowpro_gateway-state-dropdown-YY' => 'Select a State', |
| 16 | + //'payflowpro_gateway-state-dropdown-XX' => 'Outside the U.S.', |
16 | 17 | 'payflowpro_gateway-state-dropdown-AK' => 'Alaska', |
17 | 18 | 'payflowpro_gateway-state-dropdown-AL' => 'Alabama', |
18 | 19 | 'payflowpro_gateway-state-dropdown-AR' => 'Arkansas', |
Index: branches/fundraising/deployment/DonationInterface/paypal_gateway/paypal_gateway.i18n.php |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | |
12 | 12 | /** English */ |
13 | 13 | $messages['en'] = array( |
14 | | - //'paypalgateway' => 'Paypal gateway', // FIXME: remove? Appears to be unused. |
| 14 | + // 'paypalgateway' => 'Paypal gateway', // FIXME: remove? Appears to be unused. |
15 | 15 | 'paypal_gateway-desc' => 'Registers PayPal as a donation mechanism', |
16 | 16 | ); |
17 | 17 | |
Index: branches/fundraising/deployment/DonationInterface/paypal_gateway/paypal_gateway.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly. |
4 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) { |
5 | 5 | echo <<<EOT |
6 | 6 | To install my extension, put the following line in LocalSettings.php: |
7 | 7 | require_once( "\$IP/extensions/DonationInterface/paypal_gateway/paypal_gateway.php" ); |
— | — | @@ -76,10 +76,10 @@ |
77 | 77 | */ |
78 | 78 | function paypalGatewayPage( &$url ) { |
79 | 79 | // Business email address set in LocalSettings.php |
80 | | - global $wgPaypalEmail, $wgPaypalUrl; |
| 80 | + global $wgPaypalUrl; |
81 | 81 | |
82 | 82 | // to go directly to Paypal, will be used for this extension in general |
83 | | - //$url['paypal'] = "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=" . urlencode( $wgPaypalEmail ) . "&lc=US&no_note=1&no_shipping=1&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"; |
| 83 | + // $url['paypal'] = "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=" . urlencode( $wgPaypalEmail ) . "&lc=US&no_note=1&no_shipping=1&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"; |
84 | 84 | |
85 | 85 | // specifically for Wikimedia, goes to processor page |
86 | 86 | $url['paypal'] = $wgPaypalUrl; |
Index: branches/fundraising/deployment/DonationInterface/donate_interface/donate_interface.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | * @link http://www.mediawiki.org/wiki/Extension:DonateInterface Documentation |
9 | 9 | */ |
10 | 10 | |
11 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 11 | +if ( !defined( 'MEDIAWIKI' ) ) { |
12 | 12 | die( "This is not a valid entry point.\n" ); |
13 | 13 | } |
14 | 14 | |
— | — | @@ -16,8 +16,8 @@ |
17 | 17 | $wgExtensionCredits['specialpage'][] = array( |
18 | 18 | 'path' => __FILE__, |
19 | 19 | 'name' => 'DonateInterface', |
20 | | - //'author' => array( 'diana' ), // FIXME: Committer does not have details in http://svn.wikimedia.org/viewvc/mediawiki/USERINFO/ |
21 | | - 'descriptionmsg' => 'donate_interface-desc', |
| 20 | + // 'author' => array( 'diana' ), // FIXME: Committer does not have details in http://svn.wikimedia.org/viewvc/mediawiki/USERINFO/ |
| 21 | + 'descriptionmsg' => 'donate_interface-desc', |
22 | 22 | 'url' => 'http://www.mediawiki.org/wiki/Extension:DonateInterface', |
23 | 23 | ); |
24 | 24 | |
— | — | @@ -32,14 +32,9 @@ |
33 | 33 | * Create <donate /> tag to include landing page donation form |
34 | 34 | */ |
35 | 35 | function efDonateSetup( &$parser ) { |
36 | | - global $wgHooks, $wgRequest; |
37 | | - |
38 | | - //load extension messages |
39 | | - wfLoadExtensionMessages( 'DonateInterface' ); |
| 36 | + $parser->setHook( 'donate', 'efDonateRender' ); |
40 | 37 | |
41 | | - $parser->setHook( 'donate', 'efDonateRender' ); |
42 | | - |
43 | | - return true; |
| 38 | + return true; |
44 | 39 | } |
45 | 40 | |
46 | 41 | |
— | — | @@ -53,26 +48,26 @@ |
54 | 49 | function efDonateRender( $input, $args, $parser ) { |
55 | 50 | global $wgOut, $wgExtensionAssetsPath; |
56 | 51 | static $formProcessed = false; |
57 | | - |
58 | | - $parser->disableCache(); |
59 | | - |
60 | | - // if chapter exists for user's country, redirect |
61 | | - //not currently in use - in place for adding it when ready |
62 | | - //$chapter = fnDonateChapterRedirect(); |
63 | | - |
64 | | - // add JavaScript validation to <head> |
65 | | - $wgOut->addScriptFile( $wgExtensionAssetsPath . '/DonationInterface/donate_interface/donate_interface_validate_donation.js' ); |
66 | | - |
67 | | - if (!$formProcessed) { |
68 | | - //process form |
69 | | - wfRunHooks( 'DonationInterface_DisplayForm' ); |
| 52 | + |
| 53 | + $parser->disableCache(); |
| 54 | + |
| 55 | + // if chapter exists for user's country, redirect |
| 56 | + // not currently in use - in place for adding it when ready |
| 57 | + // $chapter = fnDonateChapterRedirect(); |
| 58 | + |
| 59 | + // add JavaScript validation to <head> |
| 60 | + $wgOut->addScriptFile( $wgExtensionAssetsPath . '/DonationInterface/donate_interface/donate_interface_validate_donation.js' ); |
| 61 | + |
| 62 | + if ( !$formProcessed ) { |
| 63 | + // process form |
| 64 | + wfRunHooks( 'DonationInterface_DisplayForm' ); |
70 | 65 | $formProcessed = true; |
71 | 66 | } |
72 | 67 | |
73 | | - //display form to gather data from user |
74 | | - $output = fnDonateCreateOutput(); |
75 | | - |
76 | | - return $output; |
| 68 | + // display form to gather data from user |
| 69 | + $output = fnDonateCreateOutput(); |
| 70 | + |
| 71 | + return $output; |
77 | 72 | } |
78 | 73 | |
79 | 74 | /** |
— | — | @@ -82,166 +77,159 @@ |
83 | 78 | * option supplies it's value and name for the form, as well as currencies it supports. |
84 | 79 | */ |
85 | 80 | function fnDonateCreateOutput() { |
86 | | - global $wgOut, $wgRequest; |
| 81 | + global $wgRequest; |
87 | 82 | |
88 | | - // declare variable |
89 | | - $utm_source = ''; |
90 | | - $utm_medium = ''; |
91 | | - $utm_campaign = ''; |
92 | | - $referrer = ''; |
93 | | - |
94 | | - // set them equal to post data |
95 | | - $utm_source = $wgRequest->getText( 'utm_source' ); |
96 | | - $utm_medium = $wgRequest->getText( 'utm_medium' ); |
97 | | - $utm_campaign = $wgRequest->getText( 'utm_campaign' ); |
98 | | - $referrer = $wgRequest->getHeader('referer'); |
99 | | - |
100 | | - //get language from URL |
101 | | - $url = $wgRequest->getRequestURL(); |
102 | | - |
103 | | - if ($url) { |
104 | | - $getLang = explode('/', $url); |
105 | | - $language = substr($getLang[3], 0, 2); |
106 | | - } |
107 | | - |
108 | | - // error check and set "en" as default |
109 | | - if ( !preg_match( '/^[a-z-]+$/', $language ) ) { |
110 | | - $language = 'en'; |
111 | | - } |
| 83 | + // set them equal to post data |
| 84 | + $utm_source = $wgRequest->getText( 'utm_source' ); |
| 85 | + $utm_medium = $wgRequest->getText( 'utm_medium' ); |
| 86 | + $utm_campaign = $wgRequest->getText( 'utm_campaign' ); |
| 87 | + $referrer = $wgRequest->getHeader( 'referer' ); |
112 | 88 | |
113 | | - //get payment method gateway value and name from each gateway and create menu of options |
114 | | - $values = array(); |
115 | | - wfRunHooks('DonationInterface_Value', array(&$values)); |
116 | | - |
117 | | - $gatewayMenu = ''; |
118 | | - |
119 | | - foreach($values as $current) { |
120 | | - $gatewayMenu .= Xml::option($current['display_name'], $current['form_value']); |
121 | | - } |
122 | | - |
123 | | - //get available currencies |
124 | | - |
125 | | - $currencies = array( 'USD' => "USD: U.S. Dollar" ); |
126 | | - //FIXME: It uses the currencies of the last gateway to be loaded. It should probably use the union of currencies, (currencies allowed by any gateway). |
127 | | - foreach($values as $key) { |
128 | | - if (isset($key['currencies'])) { |
129 | | - $currencies = $key['currencies']; |
130 | | - } |
| 89 | + // get language from URL |
| 90 | + $url = $wgRequest->getRequestURL(); |
| 91 | + |
| 92 | + if ( $url ) { |
| 93 | + $getLang = explode( '/', $url ); |
| 94 | + $language = substr( $getLang[3], 0, 2 ); |
| 95 | + } |
| 96 | + |
| 97 | + // error check and set "en" as default |
| 98 | + if ( !preg_match( '/^[a-z-]+$/', $language ) ) { |
| 99 | + $language = 'en'; |
| 100 | + } |
| 101 | + |
| 102 | + // get payment method gateway value and name from each gateway and create menu of options |
| 103 | + $values = array(); |
| 104 | + wfRunHooks( 'DonationInterface_Value', array( &$values ) ); |
| 105 | + |
| 106 | + $gatewayMenu = ''; |
| 107 | + |
| 108 | + foreach ( $values as $current ) { |
| 109 | + $gatewayMenu .= Xml::option( $current['display_name'], $current['form_value'] ); |
| 110 | + } |
| 111 | + |
| 112 | + // get available currencies |
| 113 | + |
| 114 | + $currencies = array( 'USD' => "USD: U.S. Dollar" ); |
| 115 | + // FIXME: It uses the currencies of the last gateway to be loaded. It should probably use the union of currencies, (currencies allowed by any gateway). |
| 116 | + foreach ( $values as $key ) { |
| 117 | + if ( isset( $key['currencies'] ) ) { |
| 118 | + $currencies = $key['currencies']; |
| 119 | + } |
131 | 120 | } |
132 | 121 | |
133 | 122 | $currencyMenu = ''; |
134 | 123 | |
135 | | - foreach( $currencies as $value => $fullName ) { |
136 | | - $currencyMenu .= Xml::option( $fullName, $value ); |
137 | | - } |
138 | | - |
139 | | - $output = Xml::openElement( 'form', array( 'name' => "donate", 'method' => "post", 'action' => "", 'onsubmit' => 'return DonateValidateForm(this)' )) . |
140 | | - Xml::openElement( 'div', array('id' => 'mw-donation-intro' )) . |
141 | | - Xml::element( 'p', array( 'class' => 'mw-donation-intro-text' ), wfMsg( 'donate_interface-intro' )) . |
142 | | - Xml::closeElement( 'div' ); |
143 | | - |
144 | | - $output .= Xml::hidden( 'utm_source', $utm_source ) . |
145 | | - Xml::hidden( 'utm_medium', $utm_medium ) . |
146 | | - Xml::hidden( 'utm_campaign', $utm_campaign ) . |
147 | | - Xml::hidden( 'language', $language ) . |
148 | | - Xml::hidden( 'referrer', $referrer ) . |
149 | | - XML::hidden('process', '_yes_'); |
150 | | - |
151 | | - $amount = array( |
152 | | - Xml::radioLabel(wfMsg( 'donate_interface-big-amount-display' ), 'amount', wfMsg( 'donate_interface-big-amount-value' ), 'input_amount_3', false ), |
153 | | - Xml::radioLabel(wfMsg( 'donate_interface-medium-amount-display' ), 'amount', wfMsg( 'donate_interface-medium-amount-value' ), 'input_amount_2', false ), |
154 | | - Xml::radioLabel(wfMsg( 'donate_interface-small-amount-display' ), 'amount', wfMsg( 'donate_interface-small-amount-value' ), 'input_amount_1', false ), |
155 | | - Xml::inputLabel(wfMsg( 'donate_interface-other-amount' ), 'amountGiven', 'input_amount_other', '5'), |
156 | | - ); |
157 | | - |
158 | | - $amountFields = '<table><tr>'; |
159 | | - foreach( $amount as $value ) { |
160 | | - $amountFields .= '<td>' . $value . '</td>'; |
161 | | - } |
162 | | - $amountFields .= '</tr></table>'; |
163 | | - |
164 | | - $output .= Xml::fieldset(wfMsg( 'donate_interface-amount' ), $amountFields, array('class' => "mw-donation-amount")); |
165 | | - |
166 | | - // Build currency options |
167 | | - $default_currency = fnDonateDefaultCurrency(); |
168 | | - |
169 | | - $currency_options = ''; |
| 124 | + foreach ( $currencies as $value => $fullName ) { |
| 125 | + $currencyMenu .= Xml::option( $fullName, $value ); |
| 126 | + } |
| 127 | + |
| 128 | + $output = Xml::openElement( 'form', array( 'name' => "donate", 'method' => "post", 'action' => "", 'onsubmit' => 'return DonateValidateForm(this)' ) ) . |
| 129 | + Xml::openElement( 'div', array( 'id' => 'mw-donation-intro' ) ) . |
| 130 | + Xml::element( 'p', array( 'class' => 'mw-donation-intro-text' ), wfMsg( 'donate_interface-intro' ) ) . |
| 131 | + Xml::closeElement( 'div' ); |
| 132 | + |
| 133 | + $output .= Html::hidden( 'utm_source', $utm_source ) . |
| 134 | + Html::hidden( 'utm_medium', $utm_medium ) . |
| 135 | + Html::hidden( 'utm_campaign', $utm_campaign ) . |
| 136 | + Html::hidden( 'language', $language ) . |
| 137 | + Html::hidden( 'referrer', $referrer ) . |
| 138 | + Html::hidden( 'process', '_yes_' ); |
| 139 | + |
| 140 | + $amount = array( |
| 141 | + Xml::radioLabel( wfMsg( 'donate_interface-big-amount-display' ), 'amount', wfMsg( 'donate_interface-big-amount-value' ), 'input_amount_3', false ), |
| 142 | + Xml::radioLabel( wfMsg( 'donate_interface-medium-amount-display' ), 'amount', wfMsg( 'donate_interface-medium-amount-value' ), 'input_amount_2', false ), |
| 143 | + Xml::radioLabel( wfMsg( 'donate_interface-small-amount-display' ), 'amount', wfMsg( 'donate_interface-small-amount-value' ), 'input_amount_1', false ), |
| 144 | + Xml::inputLabel( wfMsg( 'donate_interface-other-amount' ), 'amountGiven', 'input_amount_other', '5' ), |
| 145 | + ); |
| 146 | + |
| 147 | + $amountFields = '<table><tr>'; |
| 148 | + foreach ( $amount as $value ) { |
| 149 | + $amountFields .= '<td>' . $value . '</td>'; |
| 150 | + } |
| 151 | + $amountFields .= '</tr></table>'; |
| 152 | + |
| 153 | + $output .= Xml::fieldset( wfMsg( 'donate_interface-amount' ), $amountFields, array( 'class' => "mw-donation-amount" ) ); |
| 154 | + |
| 155 | + // Build currency options |
| 156 | + $default_currency = fnDonateDefaultCurrency(); |
| 157 | + |
| 158 | + $currency_options = ''; |
170 | 159 | foreach ( $currencies as $code => $name ) { |
171 | | - $selected = ''; |
172 | | - if ( $code == $default_currency ) { |
173 | | - $selected = ' selected="selected"'; |
174 | | - } |
175 | | - $currency_options .= '<option value="' . $code . '"' . $selected . '>' . wfMsg( 'donate_interface-' . $code ) . '</option>'; |
| 160 | + $selected = ''; |
| 161 | + if ( $code == $default_currency ) { |
| 162 | + $selected = ' selected="selected"'; |
| 163 | + } |
| 164 | + $currency_options .= '<option value="' . $code . '"' . $selected . '>' . wfMsg( 'donate_interface-' . $code ) . '</option>'; |
176 | 165 | } |
177 | | - |
178 | | - $currencyFields = Xml::openElement( 'select', array( 'name' => 'currency_code', 'id' => "input_currency_code" )) . |
179 | | - $currency_options . |
| 166 | + |
| 167 | + $currencyFields = Xml::openElement( 'select', array( 'name' => 'currency_code', 'id' => "input_currency_code" ) ) . |
| 168 | + $currency_options . |
180 | 169 | Xml::closeElement( 'select' ); |
181 | | - |
182 | | - $output .= Xml::fieldset(wfMsg( 'donate_interface-currency' ), $currencyFields, array('class' => "mw-donation-currency" )); |
183 | | - |
184 | | - $gatewayFields = Xml::openElement( 'select', array('name' => 'payment_method', 'id' => 'select_payment_method')) . |
| 170 | + |
| 171 | + $output .= Xml::fieldset( wfMsg( 'donate_interface-currency' ), $currencyFields, array( 'class' => "mw-donation-currency" ) ); |
| 172 | + |
| 173 | + $gatewayFields = Xml::openElement( 'select', array( 'name' => 'payment_method', 'id' => 'select_payment_method' ) ) . |
185 | 174 | $gatewayMenu . |
186 | | - Xml::closeElement('select'); |
187 | | - |
188 | | - $output .= Xml::fieldset(wfMsg( 'donate_interface-gateway' ), $gatewayFields, array( 'class' => 'mw-donation-gateway' )); |
189 | | - |
190 | | - $publicComment = Xml::element( 'div', array( 'class' => 'mw-donation-comment-message'), wfMsg( 'donate_interface-comment-message' )) . |
191 | | - Xml::inputLabel(wfMsg( 'donate_interface-comment-label' ), 'comment', 'comment', '30', '', array( 'maxlength' => '200' )) . |
192 | | - Xml::openElement( 'div', array( 'id' => 'mw-donation-checkbox' )) . |
193 | | - Xml::checkLabel( wfMsg( 'donate_interface-anon-message' ), 'comment-option', 'input_comment-option', TRUE ) . |
| 175 | + Xml::closeElement( 'select' ); |
| 176 | + |
| 177 | + $output .= Xml::fieldset( wfMsg( 'donate_interface-gateway' ), $gatewayFields, array( 'class' => 'mw-donation-gateway' ) ); |
| 178 | + |
| 179 | + $publicComment = Xml::element( 'div', array( 'class' => 'mw-donation-comment-message' ), wfMsg( 'donate_interface-comment-message' ) ) . |
| 180 | + Xml::inputLabel( wfMsg( 'donate_interface-comment-label' ), 'comment', 'comment', '30', '', array( 'maxlength' => '200' ) ) . |
| 181 | + Xml::openElement( 'div', array( 'id' => 'mw-donation-checkbox' ) ) . |
| 182 | + Xml::checkLabel( wfMsg( 'donate_interface-anon-message' ), 'comment-option', 'input_comment-option', TRUE ) . |
194 | 183 | Xml::closeElement( 'div' ) . |
195 | | - Xml::openElement( 'div', array( 'id' => 'mw-donation-checkbox' )) . |
| 184 | + Xml::openElement( 'div', array( 'id' => 'mw-donation-checkbox' ) ) . |
196 | 185 | Xml::check( 'email-opt', TRUE ) . |
197 | | - Xml::tags( 'span', array( 'class' => 'mw-email-agreement' ), wfMsg( 'donate_interface-email-agreement' )) . |
| 186 | + Xml::tags( 'span', array( 'class' => 'mw-email-agreement' ), wfMsg( 'donate_interface-email-agreement' ) ) . |
198 | 187 | Xml::closeElement( 'div' ); |
199 | | - |
200 | | - $output .= Xml::fieldset(wfMsg( 'donate_interface-comment-title' ), $publicComment, array( 'class' => 'mw-donation-public-comment')); |
201 | | - |
202 | | - $output .= Xml::submitButton(wfMsg( 'donate_interface-submit-button' )); |
203 | | - |
204 | | - $output .= Xml::closeElement( 'form' ); |
205 | | - |
206 | | - // NOTE: For testing: show country of origin |
207 | | - //$country = fnDonateGetCountry(); |
208 | | - //$output .= Xml::element('p', array('class' => 'mw-donation-test-message'), 'Country:' . $country); |
209 | | - |
210 | | - // NOTE: for testing: show default currency |
211 | | - //$currencyTest = fnDonateDefaultCurrency(); |
212 | | - //$output .= Xml::element('p', array('class' => 'mw-donation-test-message'), wfMsg( 'donate_interface-currency' ) . $currencyTest); |
213 | | - |
214 | | - // NOTE: for testing: show IP address |
215 | | - //$referrer = $_SERVER['HTTP_REFERER']; |
216 | | - //$output .= '<p>' . 'Referrer:' . $referrer . '</p>'; |
217 | | - |
218 | | - //for testing to show language culled from URL |
219 | | - $output .= '<p>' . ' Language: ' . $language . '</p>'; |
220 | | - |
221 | | - return $output; |
| 188 | + |
| 189 | + $output .= Xml::fieldset( wfMsg( 'donate_interface-comment-title' ), $publicComment, array( 'class' => 'mw-donation-public-comment' ) ); |
| 190 | + |
| 191 | + $output .= Xml::submitButton( wfMsg( 'donate_interface-submit-button' ) ); |
| 192 | + |
| 193 | + $output .= Xml::closeElement( 'form' ); |
| 194 | + |
| 195 | + // NOTE: For testing: show country of origin |
| 196 | + // $country = fnDonateGetCountry(); |
| 197 | + // $output .= Xml::element('p', array('class' => 'mw-donation-test-message'), 'Country:' . $country); |
| 198 | + |
| 199 | + // NOTE: for testing: show default currency |
| 200 | + // $currencyTest = fnDonateDefaultCurrency(); |
| 201 | + // $output .= Xml::element('p', array('class' => 'mw-donation-test-message'), wfMsg( 'donate_interface-currency' ) . $currencyTest); |
| 202 | + |
| 203 | + // NOTE: for testing: show IP address |
| 204 | + // $referrer = $_SERVER['HTTP_REFERER']; |
| 205 | + // $output .= '<p>' . 'Referrer:' . $referrer . '</p>'; |
| 206 | + |
| 207 | + // for testing to show language culled from URL |
| 208 | + $output .= '<p>' . ' Language: ' . $language . '</p>'; |
| 209 | + |
| 210 | + return $output; |
222 | 211 | } |
223 | 212 | |
224 | 213 | /* |
225 | 214 | * Redirects user to their chosen payment processor |
226 | | -* |
| 215 | +* |
227 | 216 | * Includes the user's input passed as GET |
228 | 217 | * $url for the gateway was supplied with the gwPage hook and the key |
229 | 218 | * matches the form value (also supplied by the gateway) |
230 | 219 | */ |
231 | | -function fnDonateRedirectToProcessorPage($userInput, $url) { |
232 | | - global $wgOut,$wgPaymentGatewayHost; |
233 | | - |
234 | | - $chosenGateway = $userInput['gateway']; |
| 220 | +function fnDonateRedirectToProcessorPage( $userInput, $url ) { |
| 221 | + global $wgOut; |
235 | 222 | |
236 | | - $redirectionData = wfArrayToCGI( $userInput ); |
237 | | - |
238 | | - //$wgOut->redirect( |
239 | | - //$wgPaymentGatewayHost . $url[$chosenGateway] . $redirectionData |
240 | | - //); |
241 | | - |
| 223 | + $chosenGateway = $userInput['gateway']; |
| 224 | + |
| 225 | + $redirectionData = wfArrayToCGI( $userInput ); |
| 226 | + |
| 227 | + // $wgOut->redirect( |
| 228 | + // $wgPaymentGatewayHost . $url[$chosenGateway] . $redirectionData |
| 229 | + // ); |
| 230 | + |
242 | 231 | $wgOut->redirect( |
243 | 232 | $url[$chosenGateway] . '&' . $redirectionData |
244 | 233 | ); |
245 | | - |
246 | 234 | } |
247 | 235 | |
248 | 236 | /** |
— | — | @@ -251,7 +239,7 @@ |
252 | 240 | function fnDonateGetCountry() { |
253 | 241 | $country_code = null; |
254 | 242 | |
255 | | - if( function_exists( 'fnGetGeoIP' ) ) { |
| 243 | + if ( function_exists( 'fnGetGeoIP' ) ) { |
256 | 244 | try { |
257 | 245 | $country_code = fnGetGeoIP(); |
258 | 246 | } catch ( NotFoundGeoIP $e ) { |
— | — | @@ -272,34 +260,33 @@ |
273 | 261 | require_once( 'country2currency.inc' ); |
274 | 262 | |
275 | 263 | $country_code = null; |
276 | | - $currency = null; |
277 | 264 | |
278 | | - if( function_exists( 'fnGetCountry' ) ) { |
| 265 | + if ( function_exists( 'fnGetCountry' ) ) { |
279 | 266 | $country_code = fnGetCountry(); |
280 | 267 | } |
281 | 268 | |
282 | 269 | $currency = fnCountry2Currency( $country_code ); |
283 | 270 | |
284 | | - return $result = $currency ? $currency : 'USD'; |
| 271 | + return $currency ? $currency : 'USD'; |
285 | 272 | } |
286 | 273 | |
287 | 274 | /** |
288 | | - * Will use GeoIP extension to redirect user to |
| 275 | + * Will use GeoIP extension to redirect user to |
289 | 276 | * chapter page as dictated by IP address |
290 | 277 | * NOT CURRENTLY IN USE |
291 | 278 | */ |
292 | 279 | function fnDonateChapterRedirect() { |
293 | 280 | require_once( 'chapters.inc' ); |
294 | | - |
| 281 | + |
295 | 282 | $country_code = null; |
296 | 283 | |
297 | | - if( function_exists( 'fnGetCountry' ) ) { |
| 284 | + if ( function_exists( 'fnGetCountry' ) ) { |
298 | 285 | $country_code = fnDonateGetCountry(); |
299 | 286 | } |
300 | 287 | |
301 | 288 | $chapter = fnDonateGetChapter( $country_code ); |
302 | 289 | |
303 | | - if( $chapter ) { |
| 290 | + if ( $chapter ) { |
304 | 291 | global $wgOut; |
305 | 292 | $wgOut->redirect( 'http://' . $chapter ); |
306 | 293 | } else { |
— | — | @@ -307,27 +294,27 @@ |
308 | 295 | } |
309 | 296 | |
310 | 297 | } |
311 | | - |
| 298 | + |
312 | 299 | function fnProcessDonationForm( ) { |
313 | 300 | global $wgRequest, $wgOut; |
314 | | - |
| 301 | + |
315 | 302 | // Checking that it was posted is not enough, donate_interface-amount-error |
316 | 303 | // would be shown on previews, anon purges... (bug 22640) |
317 | | - if ( ( !$wgRequest->wasPosted() ) || ( $wgRequest->getVal('process') != "_yes_" ) ) { |
| 304 | + if ( ( !$wgRequest->wasPosted() ) || ( $wgRequest->getVal( 'process' ) != "_yes_" ) ) { |
318 | 305 | return true; |
319 | 306 | } |
320 | | - // if form has been submitted, assign data and redirect user to chosen payment gateway |
| 307 | + // if form has been submitted, assign data and redirect user to chosen payment gateway |
321 | 308 | |
322 | | - //find out which amount option was chosen for amount, redefined buttons or text box |
323 | | - if ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText('amount') ) ) { |
324 | | - $amount = number_format( $wgRequest->getText('amount'), 2 ); |
325 | | - } elseif ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText('amountGiven') ) ) { |
326 | | - $amount = number_format( $wgRequest->getText('amountGiven'), 2, '.', '' ); |
| 309 | + // find out which amount option was chosen for amount, redefined buttons or text box |
| 310 | + if ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amount' ) ) ) { |
| 311 | + $amount = number_format( $wgRequest->getText( 'amount' ), 2 ); |
| 312 | + } elseif ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amountGiven' ) ) ) { |
| 313 | + $amount = number_format( $wgRequest->getText( 'amountGiven' ), 2, '.', '' ); |
327 | 314 | } else { |
328 | 315 | $wgOut->addHTML( wfMsg( 'donate_interface-amount-error' ) ); |
329 | 316 | return true; |
330 | | - } |
331 | | - |
| 317 | + } |
| 318 | + |
332 | 319 | // create array of user input from post data |
333 | 320 | $userInput = array ( |
334 | 321 | 'currency_code' => $wgRequest->getText( 'currency_code', 'USD' ), |
— | — | @@ -345,17 +332,17 @@ |
346 | 333 | 'lname' => $wgRequest->getText( 'lname', null ), |
347 | 334 | 'email' => $wgRequest->getText( 'emailAdd', null ), |
348 | 335 | ); |
349 | | - |
| 336 | + |
350 | 337 | // ask payment processor extensions for their URL/page title |
351 | 338 | $url = ''; |
352 | | - |
353 | | - if ( wfRunHooks('DonationInterface_Page', array(&$url)) ) { |
354 | | - // send user to correct page for payment |
| 339 | + |
| 340 | + if ( wfRunHooks( 'DonationInterface_Page', array( &$url ) ) ) { |
| 341 | + // send user to correct page for payment |
355 | 342 | fnDonateRedirectToProcessorPage( $userInput, $url ); |
356 | 343 | } else { |
357 | 344 | $wgOut->addHTML( wfMsg( 'donate_interface-processing-error' ) ); |
358 | 345 | } |
359 | | - |
| 346 | + |
360 | 347 | return true; |
361 | 348 | } |
362 | 349 | |
Index: branches/fundraising/deployment/DonationInterface/donate_interface/donate_interface_validate_donation.js |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | alert( 'You must contribute at least $1'.replace('$1', minimums[currency] + ' ' + currency ) ); |
49 | 49 | error = true; |
50 | 50 | } |
51 | | - |
| 51 | + |
52 | 52 | return !error; |
53 | 53 | } |
54 | 54 | //]]> |
Index: branches/fundraising/deployment/DonationInterface/donate_interface/donate_interface.i18n.php |
— | — | @@ -413,6 +413,18 @@ |
414 | 414 | 'donate_interface-ILS' => 'ILS: Izraelský šekel', |
415 | 415 | ); |
416 | 416 | |
| 417 | +/** Church Slavic (Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ) |
| 418 | + * @author ОйЛ |
| 419 | + */ |
| 420 | +$messages['cu'] = array( |
| 421 | + 'donate_interface-currency' => 'пла́тьно срѣ́дьство', |
| 422 | + 'donate_interface-submit-button' => 'даꙗ́ниꙗ сътворѥ́ниѥ', |
| 423 | + 'donate_interface-EUR' => 'EUR: єѵрѡ́', |
| 424 | + 'donate_interface-USD' => 'USD: амєрїка́ньскъ до́ларъ', |
| 425 | + 'donate_interface-AUD' => 'AUD: аѵстралі́искъ до́ларъ', |
| 426 | + 'donate_interface-CAD' => 'CAD: канадьскъ до́ларъ', |
| 427 | +); |
| 428 | + |
417 | 429 | /** Welsh (Cymraeg) |
418 | 430 | * @author Lloffiwr |
419 | 431 | */ |
— | — | @@ -882,6 +894,14 @@ |
883 | 895 | 'donate_interface-ILS' => 'ILS : ch·équèl israèlien', |
884 | 896 | ); |
885 | 897 | |
| 898 | +/** Friulian (Furlan) |
| 899 | + * @author Klenje |
| 900 | + */ |
| 901 | +$messages['fur'] = array( |
| 902 | + 'donate_interface-comment-label' => 'Coment:', |
| 903 | + 'donate_interface-comment-title' => 'Coment public', |
| 904 | +); |
| 905 | + |
886 | 906 | /** Galician (Galego) |
887 | 907 | * @author Toliño |
888 | 908 | */ |
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/activemq_stomp.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly. |
4 | | -if (!defined('MEDIAWIKI')) { |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) { |
5 | 5 | echo <<<EOT |
6 | 6 | To install my extension, put the following line in LocalSettings.php: |
7 | 7 | require_once( "\$IP/extensions/DonationInterface/activemq_stomp/activemq_stomp.php" ); |
— | — | @@ -16,11 +16,11 @@ |
17 | 17 | 'version' => '1.0.0', |
18 | 18 | ); |
19 | 19 | |
20 | | -$dir = dirname(__FILE__) . '/'; |
| 20 | +$dir = dirname( __FILE__ ) . '/'; |
21 | 21 | |
22 | 22 | $wgAutoloadClasses['activemq_stomp'] = $dir . 'activemq_stomp.php'; # Tell MediaWiki to load the extension body. |
23 | 23 | |
24 | | -//default variables that should be set in LocalSettings |
| 24 | +// default variables that should be set in LocalSettings |
25 | 25 | $wgStompServer = ""; |
26 | 26 | |
27 | 27 | $wgHooks['ParserFirstCallInit'][] = 'efStompSetup'; |
— | — | @@ -28,26 +28,25 @@ |
29 | 29 | /* |
30 | 30 | * Create <donate /> tag to include landing page donation form |
31 | 31 | */ |
32 | | -function efStompSetup(&$parser) { |
33 | | - global $wgParser, $wgOut; |
| 32 | +function efStompSetup( &$parser ) { |
| 33 | + global $wgParser; |
34 | 34 | |
35 | | - //redundant and causes Fatal Error |
36 | | - //$parser->disableCache(); |
| 35 | + // redundant and causes Fatal Error |
| 36 | + // $parser->disableCache(); |
37 | 37 | |
38 | | - $wgParser->setHook( 'stomp', 'efStompTest' ); |
| 38 | + $wgParser->setHook( 'stomp', 'efStompTest' ); |
39 | 39 | |
40 | | - return true; |
| 40 | + return true; |
41 | 41 | } |
42 | 42 | |
43 | | -function efStompTest($input, $args, &$parser) { |
| 43 | +function efStompTest( $input, $args, &$parser ) { |
| 44 | + $parser->disableCache(); |
44 | 45 | |
45 | | - $parser->disableCache(); |
| 46 | + $output = "STOMP Test page"; |
46 | 47 | |
47 | | - $output = "STOMP Test page"; |
| 48 | + wfRunHooks( 'gwStomp', array( &$transaction ) ); |
48 | 49 | |
49 | | - wfRunHooks('gwStomp', array(&$transaction)); |
50 | | - |
51 | | - return $output; |
| 50 | + return $output; |
52 | 51 | } |
53 | 52 | |
54 | 53 | /** |
— | — | @@ -57,69 +56,66 @@ |
58 | 57 | $wgHooks['gwStomp'][] = 'sendSTOMP'; |
59 | 58 | $wgHooks['gwPendingStomp'][] = 'sendPendingSTOMP'; |
60 | 59 | |
61 | | - |
62 | 60 | /* |
63 | 61 | * Hook to send transaction information to ActiveMQ server |
64 | 62 | */ |
65 | | -function sendSTOMP($transaction) { |
66 | | - global $wgOut; |
67 | | - global $wgStompServer, $wgStompQueueName; |
| 63 | +function sendSTOMP( $transaction ) { |
| 64 | + global $wgStompServer, $wgStompQueueName; |
68 | 65 | |
69 | | - $queueName = isset ( $wgStompQueueName ) ? $wgStompQueueName : 'test'; |
| 66 | + $queueName = isset ( $wgStompQueueName ) ? $wgStompQueueName : 'test'; |
70 | 67 | |
71 | | - // include a library |
72 | | - require_once("Stomp.php"); |
| 68 | + // include a library |
| 69 | + require_once( "Stomp.php" ); |
73 | 70 | |
74 | | - $message = json_encode(createQueueMessage($transaction)); |
| 71 | + $message = json_encode( createQueueMessage( $transaction ) ); |
75 | 72 | |
76 | | - // make a connection |
77 | | - $con = new Stomp($wgStompServer); |
| 73 | + // make a connection |
| 74 | + $con = new Stomp( $wgStompServer ); |
78 | 75 | |
79 | | - // connect |
80 | | - $con->connect(); |
| 76 | + // connect |
| 77 | + $con->connect(); |
81 | 78 | |
82 | | - // send a message to the queue |
83 | | - $result = $con->send("/queue/$queueName", $message, array('persistent' => 'true')); |
| 79 | + // send a message to the queue |
| 80 | + $result = $con->send( "/queue/$queueName", $message, array( 'persistent' => 'true' ) ); |
84 | 81 | |
85 | | - if (!$result) { |
86 | | - wfDebugLog('activemq_stomp', 'Send to Q failed for this message: ' . $message); |
87 | | -} |
| 82 | + if ( !$result ) { |
| 83 | + wfDebugLog( 'activemq_stomp', 'Send to Q failed for this message: ' . $message ); |
| 84 | + } |
88 | 85 | |
89 | | - $con->disconnect(); |
| 86 | + $con->disconnect(); |
90 | 87 | |
91 | | - return true; |
| 88 | + return true; |
92 | 89 | } |
93 | 90 | |
94 | 91 | /* |
95 | 92 | * Hook to send transaction information to ActiveMQ server |
96 | 93 | */ |
97 | | -function sendPendingSTOMP($transaction) { |
98 | | - global $wgOut; |
99 | | - global $wgStompServer, $wgPendingStompQueueName; |
| 94 | +function sendPendingSTOMP( $transaction ) { |
| 95 | + global $wgStompServer, $wgPendingStompQueueName; |
100 | 96 | |
101 | | - $queueName = isset ( $wgPendingStompQueueName ) ? $wgPendingStompQueueName : 'pending'; |
| 97 | + $queueName = isset ( $wgPendingStompQueueName ) ? $wgPendingStompQueueName : 'pending'; |
102 | 98 | |
103 | | - // include a library |
104 | | - require_once("Stomp.php"); |
| 99 | + // include a library |
| 100 | + require_once( "Stomp.php" ); |
105 | 101 | |
106 | | - $message = json_encode(createQueueMessage($transaction)); |
| 102 | + $message = json_encode( createQueueMessage( $transaction ) ); |
107 | 103 | |
108 | | - // make a connection |
109 | | - $con = new Stomp($wgStompServer); |
| 104 | + // make a connection |
| 105 | + $con = new Stomp( $wgStompServer ); |
110 | 106 | |
111 | | - // connect |
112 | | - $con->connect(); |
| 107 | + // connect |
| 108 | + $con->connect(); |
113 | 109 | |
114 | | - // send a message to the queue |
115 | | - $result = $con->send("/queue/$queueName", $message, array('persistent' => 'true')); |
| 110 | + // send a message to the queue |
| 111 | + $result = $con->send( "/queue/$queueName", $message, array( 'persistent' => 'true' ) ); |
116 | 112 | |
117 | | - if (!$result) { |
118 | | - wfDebugLog('activemq_stomp', 'Send to Pending Q failed for this message: ' . $message); |
119 | | -} |
| 113 | + if ( !$result ) { |
| 114 | + wfDebugLog( 'activemq_stomp', 'Send to Pending Q failed for this message: ' . $message ); |
| 115 | + } |
120 | 116 | |
121 | | - $con->disconnect(); |
| 117 | + $con->disconnect(); |
122 | 118 | |
123 | | - return true; |
| 119 | + return true; |
124 | 120 | } |
125 | 121 | |
126 | 122 | /** |
— | — | @@ -135,46 +131,41 @@ |
136 | 132 | * Order ID (generated with transaction) is assigned to 'contribution_tracking_id'? |
137 | 133 | * Response from Payflow is assigned to 'response' |
138 | 134 | */ |
139 | | -function createQueueMessage($transaction) { |
140 | | - $message = array(); |
| 135 | +function createQueueMessage( $transaction ) { |
| 136 | + // specifically designed to match the CiviCRM API that will handle it |
| 137 | + // edit this array to include/ignore transaction data sent to the server |
| 138 | + $message = array( |
| 139 | + 'contribution_tracking_id' => $transaction['contribution_tracking_id'], |
| 140 | + 'optout' => $transaction['optout'], |
| 141 | + 'anonymous' => $transaction['anonymous'], |
| 142 | + 'comment' => $transaction['comment'], |
| 143 | + 'utm_source' => $transaction['utm_source'], |
| 144 | + 'utm_medium' => $transaction['utm_medium'], |
| 145 | + 'utm_campaign' => $transaction['utm_campaign'], |
| 146 | + 'language' => $transaction['language'], |
| 147 | + 'referrer' => $transaction['referrer'], |
| 148 | + 'email' => $transaction['email'], |
| 149 | + 'first_name' => $transaction['fname'], |
| 150 | + 'middle_name' => $transaction['mname'], |
| 151 | + 'last_name' => $transaction['lname'], |
| 152 | + 'street_address' => $transaction['street'], |
| 153 | + 'supplemental_address_1' => '', |
| 154 | + 'city' => $transaction['city'], |
| 155 | + 'state_province' => $transaction['state'], |
| 156 | + 'country' => $transaction['country_name'], |
| 157 | + 'countryID' => $transaction['country_code'], |
| 158 | + 'postal_code' => $transaction['zip'], |
| 159 | + 'gateway' => $transaction[ 'gateway' ], |
| 160 | + 'gateway_txn_id' => $transaction['PNREF'], |
| 161 | + 'response' => $transaction['RESPMSG'], |
| 162 | + 'currency' => $transaction['currency'], |
| 163 | + 'original_currency' => $transaction['currency'], |
| 164 | + 'original_gross' => $transaction['amount'], |
| 165 | + 'fee' => '0', |
| 166 | + 'gross' => $transaction['amount'], |
| 167 | + 'net' => $transaction['amount'], |
| 168 | + 'date' => $transaction['date'], |
| 169 | + ); |
141 | 170 | |
142 | | - $timestamp = strtotime($transaction['date']); |
143 | | - |
144 | | - // specifically designed to match the CiviCRM API that will handle it |
145 | | - // edit this array to include/ignore transaction data sent to the server |
146 | | - $message = array( |
147 | | - 'contribution_tracking_id' => $transaction['contribution_tracking_id'], |
148 | | - 'optout' => $transaction['optout'], |
149 | | - 'anonymous' => $transaction['anonymous'], |
150 | | - 'comment' => $transaction['comment'], |
151 | | - 'utm_source' => $transaction['utm_source'], |
152 | | - 'utm_medium' => $transaction['utm_medium'], |
153 | | - 'utm_campaign' => $transaction['utm_campaign'], |
154 | | - 'language' => $transaction['language'], |
155 | | - 'referrer' => $transaction['referrer'], |
156 | | - 'email' => $transaction['email'], |
157 | | - 'first_name' => $transaction['fname'], |
158 | | - 'middle_name' => $transaction['mname'], |
159 | | - 'last_name' => $transaction['lname'], |
160 | | - 'street_address' => $transaction['street'], |
161 | | - 'supplemental_address_1' => '', |
162 | | - 'city' => $transaction['city'], |
163 | | - 'state_province' => $transaction['state'], |
164 | | - 'country' => $transaction['country_name'], |
165 | | - 'countryID' => $transaction['country_code'], |
166 | | - 'postal_code' => $transaction['zip'], |
167 | | - 'gateway' => $transaction[ 'gateway' ], |
168 | | - 'gateway_txn_id' => $transaction['PNREF'], |
169 | | - 'response' => $transaction['RESPMSG'], |
170 | | - 'currency' => $transaction['currency'], |
171 | | - 'original_currency' => $transaction['currency'], |
172 | | - 'original_gross' => $transaction['amount'], |
173 | | - 'fee' => '0', |
174 | | - 'gross' => $transaction['amount'], |
175 | | - 'net' => $transaction['amount'], |
176 | | - 'date' => $transaction['date'], |
177 | | - |
178 | | - ); |
179 | | - |
180 | | - return $message; |
| 171 | + return $message; |
181 | 172 | } |
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Frame.php |
— | — | @@ -32,7 +32,7 @@ |
33 | 33 | public $command; |
34 | 34 | public $headers = array(); |
35 | 35 | public $body; |
36 | | - |
| 36 | + |
37 | 37 | /** |
38 | 38 | * Constructor |
39 | 39 | * |
— | — | @@ -40,25 +40,25 @@ |
41 | 41 | * @param array $headers |
42 | 42 | * @param string $body |
43 | 43 | */ |
44 | | - public function __construct ($command = null, $headers = null, $body = null) |
| 44 | + public function __construct ( $command = null, $headers = null, $body = null ) |
45 | 45 | { |
46 | | - $this->_init($command, $headers, $body); |
| 46 | + $this->_init( $command, $headers, $body ); |
47 | 47 | } |
48 | | - |
49 | | - protected function _init ($command = null, $headers = null, $body = null) |
| 48 | + |
| 49 | + protected function _init ( $command = null, $headers = null, $body = null ) |
50 | 50 | { |
51 | 51 | $this->command = $command; |
52 | | - if ($headers != null) { |
| 52 | + if ( $headers != null ) { |
53 | 53 | $this->headers = $headers; |
54 | 54 | } |
55 | 55 | $this->body = $body; |
56 | | - |
57 | | - if ($this->command == 'ERROR') { |
| 56 | + |
| 57 | + if ( $this->command == 'ERROR' ) { |
58 | 58 | require_once 'Exception.php'; |
59 | | - throw new Stomp_Exception($this->headers['message'], 0, $this->body); |
| 59 | + throw new Stomp_Exception( $this->headers['message'], 0, $this->body ); |
60 | 60 | } |
61 | 61 | } |
62 | | - |
| 62 | + |
63 | 63 | /** |
64 | 64 | * Convert frame to transportable string |
65 | 65 | * |
— | — | @@ -67,14 +67,14 @@ |
68 | 68 | public function __toString() |
69 | 69 | { |
70 | 70 | $data = $this->command . "\n"; |
71 | | - |
72 | | - foreach ($this->headers as $name => $value) { |
| 71 | + |
| 72 | + foreach ( $this->headers as $name => $value ) { |
73 | 73 | $data .= $name . ": " . $value . "\n"; |
74 | 74 | } |
75 | | - |
| 75 | + |
76 | 76 | $data .= "\n"; |
77 | 77 | $data .= $this->body; |
78 | | - return $data .= "\x00\n"; |
| 78 | + return $data . "\x00\n"; |
79 | 79 | } |
80 | 80 | } |
81 | 81 | ?> |
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Exception.php |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | class Stomp_Exception extends Exception |
31 | 31 | { |
32 | 32 | protected $_details; |
33 | | - |
| 33 | + |
34 | 34 | /** |
35 | 35 | * Constructor |
36 | 36 | * |
— | — | @@ -37,13 +37,13 @@ |
38 | 38 | * @param int $code Error code |
39 | 39 | * @param string $details Stomp server error details |
40 | 40 | */ |
41 | | - public function __construct($message = null, $code = 0, $details = '') |
| 41 | + public function __construct( $message = null, $code = 0, $details = '' ) |
42 | 42 | { |
43 | 43 | $this->_details = $details; |
44 | 44 | $message = "Stomp Error. Check host connection. Details suppressed for security."; |
45 | | - parent::__construct($message, $code); |
| 45 | + parent::__construct( $message, $code ); |
46 | 46 | } |
47 | | - |
| 47 | + |
48 | 48 | /** |
49 | 49 | * Stomp server error details |
50 | 50 | * |
— | — | @@ -52,8 +52,8 @@ |
53 | 53 | public function getDetails() |
54 | 54 | { |
55 | 55 | return $this->_details; |
56 | | - |
| 56 | + |
57 | 57 | } |
58 | | - |
| 58 | + |
59 | 59 | } |
60 | 60 | ?> |
\ No newline at end of file |
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Message/Map.php |
— | — | @@ -30,25 +30,25 @@ |
31 | 31 | class Stomp_Message_Map extends Stomp_Message |
32 | 32 | { |
33 | 33 | public $map; |
34 | | - |
| 34 | + |
35 | 35 | /** |
36 | 36 | * Constructor |
37 | 37 | * |
38 | 38 | * @param Stomp_Frame|string $msg |
39 | 39 | * @param array $headers |
40 | 40 | */ |
41 | | - function __construct ($msg, $headers = null) |
| 41 | + function __construct ( $msg, $headers = null ) |
42 | 42 | { |
43 | | - if ($msg instanceof Stomp_Frame) { |
44 | | - $this->_init($msg->command, $msg->headers, $msg->body); |
45 | | - $this->map = json_decode($msg->body); |
| 43 | + if ( $msg instanceof Stomp_Frame ) { |
| 44 | + $this->_init( $msg->command, $msg->headers, $msg->body ); |
| 45 | + $this->map = json_decode( $msg->body ); |
46 | 46 | } else { |
47 | | - $this->_init("SEND", $headers, $msg); |
48 | | - if ($this->headers == null) { |
| 47 | + $this->_init( "SEND", $headers, $msg ); |
| 48 | + if ( $this->headers == null ) { |
49 | 49 | $this->headers = array(); |
50 | 50 | } |
51 | 51 | $this->headers['amq-msg-type'] = 'MapMessage'; |
52 | | - $this->body = json_encode($msg); |
| 52 | + $this->body = json_encode( $msg ); |
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Message/Bytes.php |
— | — | @@ -35,13 +35,13 @@ |
36 | 36 | * @param string $body |
37 | 37 | * @param array $headers |
38 | 38 | */ |
39 | | - function __construct ($body, $headers = null) |
| 39 | + function __construct ( $body, $headers = null ) |
40 | 40 | { |
41 | | - $this->_init("SEND", $headers, $body); |
42 | | - if ($this->headers == null) { |
| 41 | + $this->_init( "SEND", $headers, $body ); |
| 42 | + if ( $this->headers == null ) { |
43 | 43 | $this->headers = array(); |
44 | 44 | } |
45 | | - $this->headers['content-length'] = count($body); |
| 45 | + $this->headers['content-length'] = count( $body ); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | ?> |
\ No newline at end of file |
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Message.php |
— | — | @@ -29,9 +29,9 @@ |
30 | 30 | */ |
31 | 31 | class Stomp_Message extends Stomp_Frame |
32 | 32 | { |
33 | | - public function __construct ($body, $headers = null) |
| 33 | + public function __construct ( $body, $headers = null ) |
34 | 34 | { |
35 | | - $this->_init("SEND", $headers, $body); |
| 35 | + $this->_init( "SEND", $headers, $body ); |
36 | 36 | } |
37 | 37 | } |
38 | 38 | ?> |
\ No newline at end of file |
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp.php |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | * |
28 | 28 | * @package Stomp |
29 | 29 | * @author Hiram Chirino <hiram@hiramchirino.com> |
30 | | - * @author Dejan Bosanac <dejan@nighttale.net> |
| 30 | + * @author Dejan Bosanac <dejan@nighttale.net> |
31 | 31 | * @author Michael Caplan <mcaplan@labnet.net> |
32 | 32 | * @version $Revision: 43 $ |
33 | 33 | */ |
— | — | @@ -45,14 +45,14 @@ |
46 | 46 | * @var int |
47 | 47 | */ |
48 | 48 | public $prefetchSize = 1; |
49 | | - |
| 49 | + |
50 | 50 | /** |
51 | 51 | * Client id used for durable subscriptions |
52 | 52 | * |
53 | 53 | * @var string |
54 | 54 | */ |
55 | 55 | public $clientId = null; |
56 | | - |
| 56 | + |
57 | 57 | protected $_brokerUri = null; |
58 | 58 | protected $_socket = null; |
59 | 59 | protected $_hosts = array(); |
— | — | @@ -66,14 +66,14 @@ |
67 | 67 | protected $_sessionId; |
68 | 68 | protected $_read_timeout_seconds = 60; |
69 | 69 | protected $_read_timeout_milliseconds = 0; |
70 | | - |
| 70 | + |
71 | 71 | /** |
72 | 72 | * Constructor |
73 | 73 | * |
74 | 74 | * @param string $brokerUri Broker URL |
75 | 75 | * @throws Stomp_Exception |
76 | 76 | */ |
77 | | - public function __construct ($brokerUri) |
| 77 | + public function __construct ( $brokerUri ) |
78 | 78 | { |
79 | 79 | $this->_brokerUri = $brokerUri; |
80 | 80 | $this->_init(); |
— | — | @@ -86,24 +86,24 @@ |
87 | 87 | protected function _init () |
88 | 88 | { |
89 | 89 | $pattern = "|^(([a-zA-Z]+)://)+\(*([a-zA-Z0-9\.:/i,-]+)\)*\??([a-zA-Z0-9=]*)$|i"; |
90 | | - if (preg_match($pattern, $this->_brokerUri, $regs)) { |
| 90 | + if ( preg_match( $pattern, $this->_brokerUri, $regs ) ) { |
91 | 91 | $scheme = $regs[2]; |
92 | 92 | $hosts = $regs[3]; |
93 | 93 | $params = $regs[4]; |
94 | | - if ($scheme != "failover") { |
95 | | - $this->_processUrl($this->_brokerUri); |
| 94 | + if ( $scheme != "failover" ) { |
| 95 | + $this->_processUrl( $this->_brokerUri ); |
96 | 96 | } else { |
97 | | - $urls = explode(",", $hosts); |
98 | | - foreach ($urls as $url) { |
99 | | - $this->_processUrl($url); |
| 97 | + $urls = explode( ",", $hosts ); |
| 98 | + foreach ( $urls as $url ) { |
| 99 | + $this->_processUrl( $url ); |
100 | 100 | } |
101 | 101 | } |
102 | | - if ($params != null) { |
103 | | - parse_str($params, $this->_params); |
| 102 | + if ( $params != null ) { |
| 103 | + parse_str( $params, $this->_params ); |
104 | 104 | } |
105 | 105 | } else { |
106 | 106 | require_once 'Stomp/Exception.php'; |
107 | | - throw new Stomp_Exception("Bad Broker URL {$this->_brokerUri}"); |
| 107 | + throw new Stomp_Exception( "Bad Broker URL {$this->_brokerUri}" ); |
108 | 108 | } |
109 | 109 | } |
110 | 110 | /** |
— | — | @@ -113,14 +113,14 @@ |
114 | 114 | * @throws Stomp_Exception |
115 | 115 | * @return boolean |
116 | 116 | */ |
117 | | - protected function _processUrl ($url) |
| 117 | + protected function _processUrl ( $url ) |
118 | 118 | { |
119 | | - $parsed = parse_url($url); |
120 | | - if ($parsed) { |
121 | | - array_push($this->_hosts, array($parsed['host'] , $parsed['port'] , $parsed['scheme'])); |
| 119 | + $parsed = parse_url( $url ); |
| 120 | + if ( $parsed ) { |
| 121 | + array_push( $this->_hosts, array( $parsed['host'] , $parsed['port'] , $parsed['scheme'] ) ); |
122 | 122 | } else { |
123 | 123 | require_once 'Stomp/Exception.php'; |
124 | | - throw new Stomp_Exception("Bad Broker URL $url"); |
| 124 | + throw new Stomp_Exception( "Bad Broker URL $url" ); |
125 | 125 | } |
126 | 126 | } |
127 | 127 | /** |
— | — | @@ -130,47 +130,47 @@ |
131 | 131 | */ |
132 | 132 | protected function _makeConnection () |
133 | 133 | { |
134 | | - if (count($this->_hosts) == 0) { |
| 134 | + if ( count( $this->_hosts ) == 0 ) { |
135 | 135 | require_once 'Stomp/Exception.php'; |
136 | | - throw new Stomp_Exception("No broker defined"); |
| 136 | + throw new Stomp_Exception( "No broker defined" ); |
137 | 137 | } |
138 | | - |
| 138 | + |
139 | 139 | // force disconnect, if previous established connection exists |
140 | 140 | $this->disconnect(); |
141 | | - |
| 141 | + |
142 | 142 | $i = $this->_currentHost; |
143 | 143 | $att = 0; |
144 | 144 | $connected = false; |
145 | | - while (! $connected && $att ++ < $this->_attempts) { |
146 | | - if (isset($this->_params['randomize']) && $this->_params['randomize'] == 'true') { |
147 | | - $i = rand(0, count($this->_hosts) - 1); |
| 145 | + while ( ! $connected && $att ++ < $this->_attempts ) { |
| 146 | + if ( isset( $this->_params['randomize'] ) && $this->_params['randomize'] == 'true' ) { |
| 147 | + $i = rand( 0, count( $this->_hosts ) - 1 ); |
148 | 148 | } else { |
149 | | - $i = ($i + 1) % count($this->_hosts); |
| 149 | + $i = ( $i + 1 ) % count( $this->_hosts ); |
150 | 150 | } |
151 | 151 | $broker = $this->_hosts[$i]; |
152 | 152 | $host = $broker[0]; |
153 | 153 | $port = $broker[1]; |
154 | 154 | $scheme = $broker[2]; |
155 | | - if ($port == null) { |
| 155 | + if ( $port == null ) { |
156 | 156 | $port = $this->_defaultPort; |
157 | 157 | } |
158 | | - if ($this->_socket != null) { |
159 | | - fclose($this->_socket); |
| 158 | + if ( $this->_socket != null ) { |
| 159 | + fclose( $this->_socket ); |
160 | 160 | $this->_socket = null; |
161 | 161 | } |
162 | | - $this->_socket = @fsockopen($scheme . '://' . $host, $port); |
163 | | - if (!is_resource($this->_socket) && $att >= $this->_attempts && !array_key_exists($i + 1, $this->_hosts)) { |
| 162 | + $this->_socket = @fsockopen( $scheme . '://' . $host, $port ); |
| 163 | + if ( !is_resource( $this->_socket ) && $att >= $this->_attempts && !array_key_exists( $i + 1, $this->_hosts ) ) { |
164 | 164 | require_once 'Stomp/Exception.php'; |
165 | | - throw new Stomp_Exception("Could not connect to $host:$port ($att/{$this->_attempts})"); |
166 | | - } else if (is_resource($this->_socket)) { |
| 165 | + throw new Stomp_Exception( "Could not connect to $host:$port ($att/{$this->_attempts})" ); |
| 166 | + } else if ( is_resource( $this->_socket ) ) { |
167 | 167 | $connected = true; |
168 | 168 | $this->_currentHost = $i; |
169 | 169 | break; |
170 | 170 | } |
171 | 171 | } |
172 | | - if (! $connected) { |
| 172 | + if ( ! $connected ) { |
173 | 173 | require_once 'Stomp/Exception.php'; |
174 | | - throw new Stomp_Exception("Could not connect to a broker"); |
| 174 | + throw new Stomp_Exception( "Could not connect to a broker" ); |
175 | 175 | } |
176 | 176 | } |
177 | 177 | /** |
— | — | @@ -181,35 +181,35 @@ |
182 | 182 | * @return boolean |
183 | 183 | * @throws Stomp_Exception |
184 | 184 | */ |
185 | | - public function connect ($username = '', $password = '') |
| 185 | + public function connect ( $username = '', $password = '' ) |
186 | 186 | { |
187 | 187 | $this->_makeConnection(); |
188 | | - if ($username != '') { |
| 188 | + if ( $username != '' ) { |
189 | 189 | $this->_username = $username; |
190 | 190 | } |
191 | | - if ($password != '') { |
| 191 | + if ( $password != '' ) { |
192 | 192 | $this->_password = $password; |
193 | 193 | } |
194 | | - $headers = array('login' => $this->_username , 'passcode' => $this->_password); |
195 | | - if ($this->clientId != null) { |
| 194 | + $headers = array( 'login' => $this->_username , 'passcode' => $this->_password ); |
| 195 | + if ( $this->clientId != null ) { |
196 | 196 | $headers["client-id"] = $this->clientId; |
197 | 197 | } |
198 | | - $frame = new Stomp_Frame("CONNECT", $headers); |
199 | | - $this->_writeFrame($frame); |
| 198 | + $frame = new Stomp_Frame( "CONNECT", $headers ); |
| 199 | + $this->_writeFrame( $frame ); |
200 | 200 | $frame = $this->readFrame(); |
201 | | - if ($frame instanceof Stomp_Frame && $frame->command == 'CONNECTED') { |
| 201 | + if ( $frame instanceof Stomp_Frame && $frame->command == 'CONNECTED' ) { |
202 | 202 | $this->_sessionId = $frame->headers["session"]; |
203 | 203 | return true; |
204 | 204 | } else { |
205 | 205 | require_once 'Stomp/Exception.php'; |
206 | | - if ($frame instanceof Stomp_Frame) { |
207 | | - throw new Stomp_Exception("Unexpected command: {$frame->command}", 0, $frame->body); |
| 206 | + if ( $frame instanceof Stomp_Frame ) { |
| 207 | + throw new Stomp_Exception( "Unexpected command: {$frame->command}", 0, $frame->body ); |
208 | 208 | } else { |
209 | | - throw new Stomp_Exception("Connection not acknowledged"); |
| 209 | + throw new Stomp_Exception( "Connection not acknowledged" ); |
210 | 210 | } |
211 | 211 | } |
212 | 212 | } |
213 | | - |
| 213 | + |
214 | 214 | /** |
215 | 215 | * Check if client session has ben established |
216 | 216 | * |
— | — | @@ -217,7 +217,7 @@ |
218 | 218 | */ |
219 | 219 | public function isConnected () |
220 | 220 | { |
221 | | - return !empty($this->_sessionId) && is_resource($this->_socket); |
| 221 | + return !empty( $this->_sessionId ) && is_resource( $this->_socket ); |
222 | 222 | } |
223 | 223 | /** |
224 | 224 | * Current stomp session ID |
— | — | @@ -229,7 +229,7 @@ |
230 | 230 | return $this->_sessionId; |
231 | 231 | } |
232 | 232 | /** |
233 | | - * Send a message to a destination in the messaging system |
| 233 | + * Send a message to a destination in the messaging system |
234 | 234 | * |
235 | 235 | * @param string $destination Destination queue |
236 | 236 | * @param string|Stomp_Frame $msg Message |
— | — | @@ -237,20 +237,20 @@ |
238 | 238 | * @param boolean $sync Perform request synchronously |
239 | 239 | * @return boolean |
240 | 240 | */ |
241 | | - public function send ($destination, $msg, $properties = null, $sync = null) |
| 241 | + public function send ( $destination, $msg, $properties = null, $sync = null ) |
242 | 242 | { |
243 | | - if ($msg instanceof Stomp_Frame) { |
| 243 | + if ( $msg instanceof Stomp_Frame ) { |
244 | 244 | $msg->headers['destination'] = $destination; |
245 | | - $msg->headers = array_merge($msg->headers, $properties); |
| 245 | + $msg->headers = array_merge( $msg->headers, $properties ); |
246 | 246 | $frame = $msg; |
247 | 247 | } else { |
248 | 248 | $headers = $properties; |
249 | 249 | $headers['destination'] = $destination; |
250 | | - $frame = new Stomp_Frame('SEND', $headers, $msg); |
| 250 | + $frame = new Stomp_Frame( 'SEND', $headers, $msg ); |
251 | 251 | } |
252 | | - $this->_prepareReceipt($frame, $sync); |
253 | | - $this->_writeFrame($frame); |
254 | | - return $this->_waitForReceipt($frame, $sync); |
| 252 | + $this->_prepareReceipt( $frame, $sync ); |
| 253 | + $this->_writeFrame( $frame ); |
| 254 | + return $this->_waitForReceipt( $frame, $sync ); |
255 | 255 | } |
256 | 256 | /** |
257 | 257 | * Prepair frame receipt |
— | — | @@ -258,14 +258,14 @@ |
259 | 259 | * @param Stomp_Frame $frame |
260 | 260 | * @param boolean $sync |
261 | 261 | */ |
262 | | - protected function _prepareReceipt (Stomp_Frame $frame, $sync) |
| 262 | + protected function _prepareReceipt ( Stomp_Frame $frame, $sync ) |
263 | 263 | { |
264 | 264 | $receive = $this->sync; |
265 | | - if ($sync !== null) { |
| 265 | + if ( $sync !== null ) { |
266 | 266 | $receive = $sync; |
267 | 267 | } |
268 | | - if ($receive == true) { |
269 | | - $frame->headers['receipt'] = md5(microtime()); |
| 268 | + if ( $receive == true ) { |
| 269 | + $frame->headers['receipt'] = md5( microtime() ); |
270 | 270 | } |
271 | 271 | } |
272 | 272 | /** |
— | — | @@ -276,32 +276,32 @@ |
277 | 277 | * @return boolean |
278 | 278 | * @throws Stomp_Exception |
279 | 279 | */ |
280 | | - protected function _waitForReceipt (Stomp_Frame $frame, $sync) |
| 280 | + protected function _waitForReceipt ( Stomp_Frame $frame, $sync ) |
281 | 281 | { |
282 | 282 | |
283 | 283 | $receive = $this->sync; |
284 | | - if ($sync !== null) { |
| 284 | + if ( $sync !== null ) { |
285 | 285 | $receive = $sync; |
286 | 286 | } |
287 | | - if ($receive == true) { |
288 | | - $id = (isset($frame->headers['receipt'])) ? $frame->headers['receipt'] : null; |
289 | | - if ($id == null) { |
| 287 | + if ( $receive == true ) { |
| 288 | + $id = ( isset( $frame->headers['receipt'] ) ) ? $frame->headers['receipt'] : null; |
| 289 | + if ( $id == null ) { |
290 | 290 | return true; |
291 | 291 | } |
292 | 292 | $frame = $this->readFrame(); |
293 | | - if ($frame instanceof Stomp_Frame && $frame->command == 'RECEIPT') { |
294 | | - if ($frame->headers['receipt-id'] == $id) { |
| 293 | + if ( $frame instanceof Stomp_Frame && $frame->command == 'RECEIPT' ) { |
| 294 | + if ( $frame->headers['receipt-id'] == $id ) { |
295 | 295 | return true; |
296 | 296 | } else { |
297 | 297 | require_once 'Stomp/Exception.php'; |
298 | | - throw new Stomp_Exception("Unexpected receipt id {$frame->headers['receipt-id']}", 0, $frame->body); |
| 298 | + throw new Stomp_Exception( "Unexpected receipt id {$frame->headers['receipt-id']}", 0, $frame->body ); |
299 | 299 | } |
300 | 300 | } else { |
301 | 301 | require_once 'Stomp/Exception.php'; |
302 | | - if ($frame instanceof Stomp_Frame) { |
303 | | - throw new Stomp_Exception("Unexpected command {$frame->command}", 0, $frame->body); |
| 302 | + if ( $frame instanceof Stomp_Frame ) { |
| 303 | + throw new Stomp_Exception( "Unexpected command {$frame->command}", 0, $frame->body ); |
304 | 304 | } else { |
305 | | - throw new Stomp_Exception("Receipt not received"); |
| 305 | + throw new Stomp_Exception( "Receipt not received" ); |
306 | 306 | } |
307 | 307 | } |
308 | 308 | } |
— | — | @@ -316,23 +316,23 @@ |
317 | 317 | * @return boolean |
318 | 318 | * @throws Stomp_Exception |
319 | 319 | */ |
320 | | - public function subscribe ($destination, $properties = null, $sync = null) |
| 320 | + public function subscribe ( $destination, $properties = null, $sync = null ) |
321 | 321 | { |
322 | | - $headers = array('ack' => 'client'); |
| 322 | + $headers = array( 'ack' => 'client' ); |
323 | 323 | $headers['activemq.prefetchSize'] = $this->prefetchSize; |
324 | | - if ($this->clientId != null) { |
| 324 | + if ( $this->clientId != null ) { |
325 | 325 | $headers["activemq.subcriptionName"] = $this->clientId; |
326 | 326 | } |
327 | | - if (isset($properties)) { |
328 | | - foreach ($properties as $name => $value) { |
| 327 | + if ( isset( $properties ) ) { |
| 328 | + foreach ( $properties as $name => $value ) { |
329 | 329 | $headers[$name] = $value; |
330 | 330 | } |
331 | 331 | } |
332 | 332 | $headers['destination'] = $destination; |
333 | | - $frame = new Stomp_Frame('SUBSCRIBE', $headers); |
334 | | - $this->_prepareReceipt($frame, $sync); |
335 | | - $this->_writeFrame($frame); |
336 | | - if ($this->_waitForReceipt($frame, $sync) == true) { |
| 333 | + $frame = new Stomp_Frame( 'SUBSCRIBE', $headers ); |
| 334 | + $this->_prepareReceipt( $frame, $sync ); |
| 335 | + $this->_writeFrame( $frame ); |
| 336 | + if ( $this->_waitForReceipt( $frame, $sync ) == true ) { |
337 | 337 | $this->_subscriptions[$destination] = $properties; |
338 | 338 | return true; |
339 | 339 | } else { |
— | — | @@ -348,20 +348,20 @@ |
349 | 349 | * @return boolean |
350 | 350 | * @throws Stomp_Exception |
351 | 351 | */ |
352 | | - public function unsubscribe ($destination, $properties = null, $sync = null) |
| 352 | + public function unsubscribe ( $destination, $properties = null, $sync = null ) |
353 | 353 | { |
354 | 354 | $headers = array(); |
355 | | - if (isset($properties)) { |
356 | | - foreach ($properties as $name => $value) { |
| 355 | + if ( isset( $properties ) ) { |
| 356 | + foreach ( $properties as $name => $value ) { |
357 | 357 | $headers[$name] = $value; |
358 | 358 | } |
359 | 359 | } |
360 | 360 | $headers['destination'] = $destination; |
361 | | - $frame = new Stomp_Frame('UNSUBSCRIBE', $headers); |
362 | | - $this->_prepareReceipt($frame, $sync); |
363 | | - $this->_writeFrame($frame); |
364 | | - if ($this->_waitForReceipt($frame, $sync) == true) { |
365 | | - unset($this->_subscriptions[$destination]); |
| 361 | + $frame = new Stomp_Frame( 'UNSUBSCRIBE', $headers ); |
| 362 | + $this->_prepareReceipt( $frame, $sync ); |
| 363 | + $this->_writeFrame( $frame ); |
| 364 | + if ( $this->_waitForReceipt( $frame, $sync ) == true ) { |
| 365 | + unset( $this->_subscriptions[$destination] ); |
366 | 366 | return true; |
367 | 367 | } else { |
368 | 368 | return false; |
— | — | @@ -375,16 +375,16 @@ |
376 | 376 | * @return boolean |
377 | 377 | * @throws Stomp_Exception |
378 | 378 | */ |
379 | | - public function begin ($transactionId = null, $sync = null) |
| 379 | + public function begin ( $transactionId = null, $sync = null ) |
380 | 380 | { |
381 | 381 | $headers = array(); |
382 | | - if (isset($transactionId)) { |
| 382 | + if ( isset( $transactionId ) ) { |
383 | 383 | $headers['transaction'] = $transactionId; |
384 | 384 | } |
385 | | - $frame = new Stomp_Frame('BEGIN', $headers); |
386 | | - $this->_prepareReceipt($frame, $sync); |
387 | | - $this->_writeFrame($frame); |
388 | | - return $this->_waitForReceipt($frame, $sync); |
| 385 | + $frame = new Stomp_Frame( 'BEGIN', $headers ); |
| 386 | + $this->_prepareReceipt( $frame, $sync ); |
| 387 | + $this->_writeFrame( $frame ); |
| 388 | + return $this->_waitForReceipt( $frame, $sync ); |
389 | 389 | } |
390 | 390 | /** |
391 | 391 | * Commit a transaction in progress |
— | — | @@ -394,16 +394,16 @@ |
395 | 395 | * @return boolean |
396 | 396 | * @throws Stomp_Exception |
397 | 397 | */ |
398 | | - public function commit ($transactionId = null, $sync = null) |
| 398 | + public function commit ( $transactionId = null, $sync = null ) |
399 | 399 | { |
400 | 400 | $headers = array(); |
401 | | - if (isset($transactionId)) { |
| 401 | + if ( isset( $transactionId ) ) { |
402 | 402 | $headers['transaction'] = $transactionId; |
403 | 403 | } |
404 | | - $frame = new Stomp_Frame('COMMIT', $headers); |
405 | | - $this->_prepareReceipt($frame, $sync); |
406 | | - $this->_writeFrame($frame); |
407 | | - return $this->_waitForReceipt($frame, $sync); |
| 404 | + $frame = new Stomp_Frame( 'COMMIT', $headers ); |
| 405 | + $this->_prepareReceipt( $frame, $sync ); |
| 406 | + $this->_writeFrame( $frame ); |
| 407 | + return $this->_waitForReceipt( $frame, $sync ); |
408 | 408 | } |
409 | 409 | /** |
410 | 410 | * Roll back a transaction in progress |
— | — | @@ -411,16 +411,16 @@ |
412 | 412 | * @param string $transactionId |
413 | 413 | * @param boolean $sync Perform request synchronously |
414 | 414 | */ |
415 | | - public function abort ($transactionId = null, $sync = null) |
| 415 | + public function abort ( $transactionId = null, $sync = null ) |
416 | 416 | { |
417 | 417 | $headers = array(); |
418 | | - if (isset($transactionId)) { |
| 418 | + if ( isset( $transactionId ) ) { |
419 | 419 | $headers['transaction'] = $transactionId; |
420 | 420 | } |
421 | | - $frame = new Stomp_Frame('ABORT', $headers); |
422 | | - $this->_prepareReceipt($frame, $sync); |
423 | | - $this->_writeFrame($frame); |
424 | | - return $this->_waitForReceipt($frame, $sync); |
| 421 | + $frame = new Stomp_Frame( 'ABORT', $headers ); |
| 422 | + $this->_prepareReceipt( $frame, $sync ); |
| 423 | + $this->_writeFrame( $frame ); |
| 424 | + return $this->_waitForReceipt( $frame, $sync ); |
425 | 425 | } |
426 | 426 | /** |
427 | 427 | * Acknowledge consumption of a message from a subscription |
— | — | @@ -431,20 +431,20 @@ |
432 | 432 | * @return boolean |
433 | 433 | * @throws Stomp_Exception |
434 | 434 | */ |
435 | | - public function ack ($message, $transactionId = null) |
| 435 | + public function ack ( $message, $transactionId = null ) |
436 | 436 | { |
437 | | - if ($message instanceof Stomp_Frame) { |
438 | | - $frame = new Stomp_Frame('ACK', $message->headers); |
439 | | - $this->_writeFrame($frame); |
| 437 | + if ( $message instanceof Stomp_Frame ) { |
| 438 | + $frame = new Stomp_Frame( 'ACK', $message->headers ); |
| 439 | + $this->_writeFrame( $frame ); |
440 | 440 | return true; |
441 | 441 | } else { |
442 | 442 | $headers = array(); |
443 | | - if (isset($transactionId)) { |
| 443 | + if ( isset( $transactionId ) ) { |
444 | 444 | $headers['transaction'] = $transactionId; |
445 | 445 | } |
446 | 446 | $headers['message-id'] = $message; |
447 | | - $frame = new Stomp_Frame('ACK', $headers); |
448 | | - $this->_writeFrame($frame); |
| 447 | + $frame = new Stomp_Frame( 'ACK', $headers ); |
| 448 | + $this->_writeFrame( $frame ); |
449 | 449 | return true; |
450 | 450 | } |
451 | 451 | } |
— | — | @@ -454,15 +454,13 @@ |
455 | 455 | */ |
456 | 456 | public function disconnect () |
457 | 457 | { |
458 | | - $header = array(); |
459 | | - |
460 | | - if ($this->clientId != null) { |
| 458 | + if ( $this->clientId != null ) { |
461 | 459 | $headers["client-id"] = $this->clientId; |
462 | 460 | } |
463 | 461 | |
464 | | - if (is_resource($this->_socket)) { |
465 | | - $this->_writeFrame(new Stomp_Frame('DISCONNECT', $headers)); |
466 | | - fclose($this->_socket); |
| 462 | + if ( is_resource( $this->_socket ) ) { |
| 463 | + $this->_writeFrame( new Stomp_Frame( 'DISCONNECT', $headers ) ); |
| 464 | + fclose( $this->_socket ); |
467 | 465 | } |
468 | 466 | $this->_socket = null; |
469 | 467 | $this->_sessionId = null; |
— | — | @@ -476,34 +474,34 @@ |
477 | 475 | * |
478 | 476 | * @param Stomp_Frame $stompFrame |
479 | 477 | */ |
480 | | - protected function _writeFrame (Stomp_Frame $stompFrame) |
| 478 | + protected function _writeFrame ( Stomp_Frame $stompFrame ) |
481 | 479 | { |
482 | | - if (!is_resource($this->_socket)) { |
| 480 | + if ( !is_resource( $this->_socket ) ) { |
483 | 481 | require_once 'Stomp/Exception.php'; |
484 | | - throw new Stomp_Exception('Socket connection hasn\'t been established'); |
| 482 | + throw new Stomp_Exception( 'Socket connection hasn\'t been established' ); |
485 | 483 | } |
486 | 484 | |
487 | 485 | $data = $stompFrame->__toString(); |
488 | | - |
489 | | - $r = fwrite($this->_socket, $data, strlen($data)); |
490 | | - if ($r === false || $r == 0) { |
| 486 | + |
| 487 | + $r = fwrite( $this->_socket, $data, strlen( $data ) ); |
| 488 | + if ( $r === false || $r == 0 ) { |
491 | 489 | $this->_reconnect(); |
492 | | - $this->_writeFrame($stompFrame); |
| 490 | + $this->_writeFrame( $stompFrame ); |
493 | 491 | } |
494 | 492 | } |
495 | | - |
| 493 | + |
496 | 494 | /** |
497 | 495 | * Set timeout to wait for content to read |
498 | 496 | * |
499 | 497 | * @param int $seconds_to_wait Seconds to wait for a frame |
500 | 498 | * @param int $milliseconds Milliseconds to wait for a frame |
501 | 499 | */ |
502 | | - public function setReadTimeout($seconds, $milliseconds = 0) |
| 500 | + public function setReadTimeout( $seconds, $milliseconds = 0 ) |
503 | 501 | { |
504 | 502 | $this->_read_timeout_seconds = $seconds; |
505 | 503 | $this->_read_timeout_milliseconds = $milliseconds; |
506 | 504 | } |
507 | | - |
| 505 | + |
508 | 506 | /** |
509 | 507 | * Read responce frame from server |
510 | 508 | * |
— | — | @@ -511,49 +509,49 @@ |
512 | 510 | */ |
513 | 511 | public function readFrame () |
514 | 512 | { |
515 | | - if (!$this->hasFrameToRead()) { |
| 513 | + if ( !$this->hasFrameToRead() ) { |
516 | 514 | return false; |
517 | 515 | } |
518 | | - |
519 | | - stream_set_timeout($this->_socket, 5); |
| 516 | + |
| 517 | + stream_set_timeout( $this->_socket, 5 ); |
520 | 518 | $rb = 1024; |
521 | 519 | $data = ''; |
522 | 520 | do { |
523 | | - $read = fgets($this->_socket, $rb); |
524 | | - $info = stream_get_meta_data($this->_socket); |
525 | | - if ($info['timed_out']) { |
| 521 | + $read = fgets( $this->_socket, $rb ); |
| 522 | + $info = stream_get_meta_data( $this->_socket ); |
| 523 | + if ( $info['timed_out'] ) { |
526 | 524 | return FALSE; |
527 | 525 | } |
528 | | - //if ($read === false) { |
| 526 | + // if ($read === false) { |
529 | 527 | // $this->_reconnect(); |
530 | 528 | // return $this->readFrame(); |
531 | | - //} |
| 529 | + // } |
532 | 530 | $data .= $read; |
533 | | - $len = strlen($data); |
534 | | - } while ($read && ($len < 2 || ! ($data[$len - 2] == "\x00" && $data[$len - 1] == "\n"))); |
535 | | - |
536 | | - list ($header, $body) = explode("\n\n", $data, 2); |
537 | | - $header = explode("\n", $header); |
| 531 | + $len = strlen( $data ); |
| 532 | + } while ( $read && ( $len < 2 || ! ( $data[$len - 2] == "\x00" && $data[$len - 1] == "\n" ) ) ); |
| 533 | + |
| 534 | + list ( $header, $body ) = explode( "\n\n", $data, 2 ); |
| 535 | + $header = explode( "\n", $header ); |
538 | 536 | $headers = array(); |
539 | 537 | $command = null; |
540 | | - foreach ($header as $v) { |
541 | | - if (isset($command)) { |
542 | | - list ($name, $value) = explode(':', $v, 2); |
| 538 | + foreach ( $header as $v ) { |
| 539 | + if ( isset( $command ) ) { |
| 540 | + list ( $name, $value ) = explode( ':', $v, 2 ); |
543 | 541 | $headers[$name] = $value; |
544 | 542 | } else { |
545 | 543 | $command = $v; |
546 | 544 | } |
547 | 545 | } |
548 | | - $frame = new Stomp_Frame($command, $headers, trim($body)); |
549 | | - |
550 | | - if (isset($frame->headers['amq-msg-type']) && $frame->headers['amq-msg-type'] == 'MapMessage') { |
| 546 | + $frame = new Stomp_Frame( $command, $headers, trim( $body ) ); |
| 547 | + |
| 548 | + if ( isset( $frame->headers['amq-msg-type'] ) && $frame->headers['amq-msg-type'] == 'MapMessage' ) { |
551 | 549 | require_once 'Stomp/Message/Map.php'; |
552 | | - return new Stomp_Message_Map($frame); |
| 550 | + return new Stomp_Message_Map( $frame ); |
553 | 551 | } else { |
554 | 552 | return $frame; |
555 | 553 | } |
556 | 554 | } |
557 | | - |
| 555 | + |
558 | 556 | /** |
559 | 557 | * Check if there is a frame to read |
560 | 558 | * |
— | — | @@ -561,12 +559,12 @@ |
562 | 560 | */ |
563 | 561 | public function hasFrameToRead() |
564 | 562 | { |
565 | | - return TRUE; // http://bugs.php.net/bug.php?id=46024 |
566 | | - |
567 | | - $read = array($this->_socket); |
| 563 | + return true; // http://bugs.php.net/bug.php?id=46024 |
| 564 | + |
| 565 | + /*$read = array($this->_socket); |
568 | 566 | $write = null; |
569 | 567 | $except = null; |
570 | | - |
| 568 | + |
571 | 569 | $has_frame_to_read = stream_select($read, $write, $except, $this->_read_timeout_seconds, $this->_read_timeout_milliseconds); |
572 | 570 | |
573 | 571 | if ($has_frame_to_read === false) { |
— | — | @@ -574,21 +572,21 @@ |
575 | 573 | } else if ($has_frame_to_read > 0) { |
576 | 574 | return true; |
577 | 575 | } else { |
578 | | - return false; |
579 | | - } |
| 576 | + return false; |
| 577 | + }*/ |
580 | 578 | } |
581 | | - |
| 579 | + |
582 | 580 | /** |
583 | 581 | * Reconnects and renews subscriptions (if there were any) |
584 | | - * Call this method when you detect connection problems |
| 582 | + * Call this method when you detect connection problems |
585 | 583 | */ |
586 | 584 | protected function _reconnect () |
587 | 585 | { |
588 | 586 | $subscriptions = $this->_subscriptions; |
589 | | - |
590 | | - $this->connect($this->_username, $this->_password); |
591 | | - foreach ($subscriptions as $dest => $properties) { |
592 | | - $this->subscribe($dest, $properties); |
| 587 | + |
| 588 | + $this->connect( $this->_username, $this->_password ); |
| 589 | + foreach ( $subscriptions as $dest => $properties ) { |
| 590 | + $this->subscribe( $dest, $properties ); |
593 | 591 | } |
594 | 592 | } |
595 | 593 | /** |
Property changes on: branches/fundraising/deployment/DonationInterface |
___________________________________________________________________ |
Modified: svn:mergeinfo |
596 | 594 | Merged /trunk/extensions/DonationInterface:r75665-75839 |