Completed
Branch FET-5580-registration-cancella... (d3ffee)
by
unknown
795:49 queued 782:35
created
payment_methods/Paypal_Standard/EEG_Paypal_Standard.gateway.php 2 patches
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		parent::set_settings($settings_array);
78 78
 		if($this->_debug_mode){
79 79
 			$this->_gateway_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
80
-		}else{
80
+		} else{
81 81
 			$this->_gateway_url = 'https://www.paypal.com/cgi-bin/webscr';
82 82
 		}
83 83
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			if( ! $this->_paypal_taxes ){
127 127
 				$redirect_args['tax_cart'] = $total_line_item->get_total_tax();
128 128
 			}
129
-		}else{
129
+		} else{
130 130
 			//this is a partial payment, so we can't really show all the line items
131 131
 			$redirect_args['item_name_' . $item_num] = substr( sprintf(__('Payment of %1$s for  %2$s', "event_espresso"),$payment->amount(), $primary_registrant->reg_code()), 0, 127 );
132 132
 			$redirect_args['amount_' . $item_num] = $payment->amount();
@@ -306,8 +306,9 @@  discard block
 block discarded – undo
306 306
 		$update_info = array();
307 307
 		foreach ( $raw_post_array as $keyval ) {
308 308
 			$keyval = explode( '=', $keyval );
309
-			if ( count( $keyval ) == 2 )
310
-				$update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] );
309
+			if ( count( $keyval ) == 2 ) {
310
+							$update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] );
311
+			}
311 312
 		}
312 313
 		// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
313 314
 		$req = 'cmd=_notify-validate';
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return EEG_Paypal_Standard
64 64
 	 */
65 65
 	public function __construct() {
66
-		$this->set_uses_separate_IPN_request( true ) ;
66
+		$this->set_uses_separate_IPN_request(true);
67 67
 		parent::__construct();
68 68
 	}
69 69
 
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 	 * Also sets the gateway url class variable based on whether debug mode is enabled or not
74 74
 	 * @param array $settings_array
75 75
 	 */
76
-	public function set_settings($settings_array){
76
+	public function set_settings($settings_array) {
77 77
 		parent::set_settings($settings_array);
78
-		if($this->_debug_mode){
78
+		if ($this->_debug_mode) {
79 79
 			$this->_gateway_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
80
-		}else{
80
+		} else {
81 81
 			$this->_gateway_url = 'https://www.paypal.com/cgi-bin/webscr';
82 82
 		}
83 83
 	}
@@ -92,48 +92,48 @@  discard block
 block discarded – undo
92 92
 	 * @param string      $cancel_url   URL to send the user to after a cancelled payment attempt on teh payment provider's website
93 93
 	 * @return EEI_Payment
94 94
 	 */
95
-	public function set_redirection_info( $payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL ){
95
+	public function set_redirection_info($payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL) {
96 96
 		$redirect_args = array();
97 97
 		$transaction = $payment->transaction();
98 98
 		$primary_registrant = $transaction->primary_registration();
99 99
 		$item_num = 1;
100 100
 		$total_line_item = $transaction->total_line_item();
101
-		if( $this->_can_easily_itemize_transaction_for( $payment ) ){
101
+		if ($this->_can_easily_itemize_transaction_for($payment)) {
102 102
 			//this payment is for the entire transaction,
103 103
 			//so let's show all the line items
104
-			foreach($total_line_item->get_items() as $line_item){
105
-				if ( $line_item instanceof EE_Line_Item ) {
104
+			foreach ($total_line_item->get_items() as $line_item) {
105
+				if ($line_item instanceof EE_Line_Item) {
106 106
 					//if this is a re-attempt at paying, don't re-add PayPal's shipping
107 107
 					//and ignore line items with a quantity of 0
108
-					if ( $line_item->code() == 'paypal_shipping' || $line_item->quantity() == 0 ) {
108
+					if ($line_item->code() == 'paypal_shipping' || $line_item->quantity() == 0) {
109 109
 						continue;
110 110
 					}
111
-					$redirect_args[ 'item_name_' . $item_num ] = substr(
112
-						sprintf( __( '%1$s for %2$s', 'event_espresso' ), $line_item->name(), $line_item->ticket_event_name() ), 0, 127 );
113
-					$redirect_args[ 'amount_' . $item_num ] = $line_item->unit_price();
114
-					$redirect_args[ 'quantity_' . $item_num ] = $line_item->quantity();
115
-					if ( ! $line_item->is_taxable() ) {
116
-						$redirect_args[ 'tax_' . $item_num ] = 0;
111
+					$redirect_args['item_name_'.$item_num] = substr(
112
+						sprintf(__('%1$s for %2$s', 'event_espresso'), $line_item->name(), $line_item->ticket_event_name()), 0, 127 );
113
+					$redirect_args['amount_'.$item_num] = $line_item->unit_price();
114
+					$redirect_args['quantity_'.$item_num] = $line_item->quantity();
115
+					if ( ! $line_item->is_taxable()) {
116
+						$redirect_args['tax_'.$item_num] = 0;
117 117
 					}
118 118
 					//if we're not letting PayPal calculate shipping, tell them its 0
119
-					if ( ! $this->_paypal_shipping ) {
120
-						$redirect_args[ 'shipping_' . $item_num ] = '0';
121
-						$redirect_args[ 'shipping2_' . $item_num ] = '0';
119
+					if ( ! $this->_paypal_shipping) {
120
+						$redirect_args['shipping_'.$item_num] = '0';
121
+						$redirect_args['shipping2_'.$item_num] = '0';
122 122
 					}
123 123
 					$item_num++;
124 124
 				}
125 125
 			}
126 126
 			//add our taxes to the order if we're NOT using PayPal's
127
-			if( ! $this->_paypal_taxes ){
127
+			if ( ! $this->_paypal_taxes) {
128 128
 				$redirect_args['tax_cart'] = $total_line_item->get_total_tax();
129 129
 			}
130
-		}else{
130
+		} else {
131 131
 			//this is a partial payment, so we can't really show all the line items
132
-			$redirect_args['item_name_' . $item_num] = substr( sprintf(__('Payment of %1$s for  %2$s', "event_espresso"),$payment->amount(), $primary_registrant->reg_code()), 0, 127 );
133
-			$redirect_args['amount_' . $item_num] = $payment->amount();
132
+			$redirect_args['item_name_'.$item_num] = substr(sprintf(__('Payment of %1$s for  %2$s', "event_espresso"), $payment->amount(), $primary_registrant->reg_code()), 0, 127);
133
+			$redirect_args['amount_'.$item_num] = $payment->amount();
134 134
 			//if we aren't allowing PayPal to calculate shipping, set it to 0
135
-			$redirect_args['shipping_' . $item_num ] = '0';
136
-			$redirect_args['shipping2_' . $item_num ] = '0';
135
+			$redirect_args['shipping_'.$item_num] = '0';
136
+			$redirect_args['shipping2_'.$item_num] = '0';
137 137
 			//PayPal can't calculate taxes because we don't know what parts of it are taxable
138 138
 			$redirect_args['tax_cart'] = '0';
139 139
 
@@ -142,16 +142,16 @@  discard block
 block discarded – undo
142 142
 
143 143
 
144 144
 		}
145
-		if($this->_debug_mode){
146
-			$redirect_args['item_name_' . $item_num] = 'DEBUG INFO (this item only added in sandbox mode';
147
-			$redirect_args['amount_' . $item_num] = 0;
145
+		if ($this->_debug_mode) {
146
+			$redirect_args['item_name_'.$item_num] = 'DEBUG INFO (this item only added in sandbox mode';
147
+			$redirect_args['amount_'.$item_num] = 0;
148 148
 			$redirect_args['on0_'.$item_num] = 'NOTIFY URL';
149
-			$redirect_args['os0_' . $item_num] = $notify_url;
149
+			$redirect_args['os0_'.$item_num] = $notify_url;
150 150
 			$redirect_args['on1_'.$item_num] = 'RETURN URL';
151
-			$redirect_args['os1_' . $item_num] = $return_url;
151
+			$redirect_args['os1_'.$item_num] = $return_url;
152 152
 //			$redirect_args['option_index_' . $item_num] = 1; // <-- dunno if this is needed ?
153
-			$redirect_args['shipping_' . $item_num ] = '0';
154
-			$redirect_args['shipping2_' . $item_num ] = '0';
153
+			$redirect_args['shipping_'.$item_num] = '0';
154
+			$redirect_args['shipping2_'.$item_num] = '0';
155 155
 		}
156 156
 
157 157
 		$redirect_args['business'] = $this->_paypal_id;
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
 		$redirect_args['cmd'] = '_cart';
162 162
 		$redirect_args['upload'] = 1;
163 163
 		$redirect_args['currency_code'] = $payment->currency_code();
164
-		$redirect_args['rm'] = 2;//makes the user return with method=POST
165
-		if($this->_image_url){
164
+		$redirect_args['rm'] = 2; //makes the user return with method=POST
165
+		if ($this->_image_url) {
166 166
 			$redirect_args['image_url'] = $this->_image_url;
167 167
 		}
168 168
 		$redirect_args['no_shipping'] = $this->_shipping_details;
169
-		$redirect_args['bn'] = 'EventEspresso_SP';//EE will blow up if you change this
169
+		$redirect_args['bn'] = 'EventEspresso_SP'; //EE will blow up if you change this
170 170
 
171
-		$redirect_args = apply_filters( "FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args );
171
+		$redirect_args = apply_filters("FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args);
172 172
 
173 173
 		$payment->set_redirect_url($this->_gateway_url);
174 174
 		$payment->set_redirect_args($redirect_args);
@@ -186,55 +186,55 @@  discard block
 block discarded – undo
186 186
 	 * @return \EEI_Payment updated
187 187
 	 * @throws \EE_Error
188 188
 	 */
189
-	public function handle_payment_update( $update_info, $transaction ){
189
+	public function handle_payment_update($update_info, $transaction) {
190 190
 		//verify there's payment data that's been sent
191
-		if ( empty( $update_info[ 'payment_status' ] ) || empty( $update_info[ 'txn_id' ] ) ) {
191
+		if (empty($update_info['payment_status']) || empty($update_info['txn_id'])) {
192 192
 			// waaaait... is this a PDT request? (see https://developer.paypal.com/docs/classic/products/payment-data-transfer/)
193 193
 			// indicated by the "tx" argument? If so, we don't need it. We'll just use the IPN data when it comes
194
-			if ( isset( $update_info[ 'tx' ] ) ) {
194
+			if (isset($update_info['tx'])) {
195 195
 				return $transaction->last_payment();
196 196
 			} else {
197 197
 				return null;
198 198
 			}
199 199
 		}
200
-		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
201
-		if ( ! $payment instanceof EEI_Payment ) {
200
+		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['txn_id']);
201
+		if ( ! $payment instanceof EEI_Payment) {
202 202
 			$payment = $transaction->last_payment();
203 203
 		}
204 204
 		// ok, then validate the IPN. Even if we've already processed this payment,
205 205
 		// let PayPal know we don't want to hear from them anymore!
206
-		if ( ! $this->validate_ipn( $update_info, $payment ) ) {
206
+		if ( ! $this->validate_ipn($update_info, $payment)) {
207 207
 			return $payment;
208 208
 		}
209 209
 		//ok, well let's process this payment then!
210
-		switch ( $update_info[ 'payment_status' ] ) {
210
+		switch ($update_info['payment_status']) {
211 211
 
212 212
 			case 'Completed' :
213 213
 				$status = $this->_pay_model->approved_status();
214
-				$gateway_response = __( 'The payment is approved.', 'event_espresso' );
214
+				$gateway_response = __('The payment is approved.', 'event_espresso');
215 215
 				break;
216 216
 
217 217
 			case 'Pending' :
218 218
 				$status = $this->_pay_model->pending_status();
219
-				$gateway_response = __( 'The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso' );
219
+				$gateway_response = __('The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso');
220 220
 				break;
221 221
 
222 222
 			case 'Denied' :
223 223
 				$status = $this->_pay_model->declined_status();
224
-				$gateway_response = __( 'The payment has been declined.', 'event_espresso' );
224
+				$gateway_response = __('The payment has been declined.', 'event_espresso');
225 225
 				break;
226 226
 
227 227
 			case 'Expired' :
228 228
 			case 'Failed' :
229 229
 				$status = $this->_pay_model->failed_status();
230
-				$gateway_response = __( 'The payment failed for technical reasons or expired.', 'event_espresso' );
230
+				$gateway_response = __('The payment failed for technical reasons or expired.', 'event_espresso');
231 231
 				break;
232 232
 
233 233
 			case 'Refunded' :
234 234
 			case 'Partially_Refunded' :
235 235
 				// even though it's a refund, we consider the payment as approved, it just has a negative value
236 236
 				$status = $this->_pay_model->approved_status();
237
-				$gateway_response = __( 'The payment has been refunded. Please update registrations accordingly.', 'event_espresso' );
237
+				$gateway_response = __('The payment has been refunded. Please update registrations accordingly.', 'event_espresso');
238 238
 				break;
239 239
 
240 240
 			case 'Voided' :
@@ -242,25 +242,25 @@  discard block
 block discarded – undo
242 242
 			case 'Canceled_Reversal' :
243 243
 			default :
244 244
 				$status = $this->_pay_model->cancelled_status();
245
-				$gateway_response = __( 'The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso' );
245
+				$gateway_response = __('The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso');
246 246
 				break;
247 247
 
248 248
 		}
249 249
 
250 250
 		//check if we've already processed this payment
251
-		if ( $payment instanceof EEI_Payment ) {
251
+		if ($payment instanceof EEI_Payment) {
252 252
 			//payment exists. if this has the exact same status and amount, don't bother updating. just return
253
-			if ( $payment->status() == $status && $payment->amount() == $update_info[ 'mc_gross' ] ) {
253
+			if ($payment->status() == $status && $payment->amount() == $update_info['mc_gross']) {
254 254
 				// DUPLICATED IPN! dont bother updating transaction foo!;
255
-				$message_log = sprintf( __( 'It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso' ), $payment->ID() );
255
+				$message_log = sprintf(__('It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso'), $payment->ID());
256 256
 			} else {
257 257
 				// new payment yippee !!!
258
-				$payment->set_status( $status );
259
-				$payment->set_amount( floatval( $update_info[ 'mc_gross' ] ) );
260
-				$payment->set_gateway_response( $gateway_response );
261
-				$payment->set_details( $update_info );
262
-				$payment->set_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
263
-				$message_log = sprintf( __( 'Updated payment either from IPN or as part of POST from PayPal', 'event_espresso' ) );
258
+				$payment->set_status($status);
259
+				$payment->set_amount(floatval($update_info['mc_gross']));
260
+				$payment->set_gateway_response($gateway_response);
261
+				$payment->set_details($update_info);
262
+				$payment->set_txn_id_chq_nmbr($update_info['txn_id']);
263
+				$message_log = sprintf(__('Updated payment either from IPN or as part of POST from PayPal', 'event_espresso'));
264 264
 			}
265 265
 			$this->log(
266 266
 				array(
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 				$payment
273 273
 			);
274 274
 		}
275
-		do_action( 'FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this );
275
+		do_action('FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this);
276 276
 		// kill request here if this is a refund
277
-		if ( $update_info[ 'payment_status' ] == 'Refunded' || $update_info[ 'payment_status' ] == 'Partially_Refunded'   ) {
278
-			if ( apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true ) ) {
279
-				status_header( 200 );
277
+		if ($update_info['payment_status'] == 'Refunded' || $update_info['payment_status'] == 'Partially_Refunded') {
278
+			if (apply_filters('FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true)) {
279
+				status_header(200);
280 280
 				exit();
281 281
 			}
282 282
 		}
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 	 * @param EE_Payment|EEI_Payment $payment
293 293
 	 * @return boolean
294 294
 	 */
295
-	public function validate_ipn( $update_info, $payment ) {
295
+	public function validate_ipn($update_info, $payment) {
296 296
 		//allow us to skip validating IPNs with PayPal (useful for testing)
297
-		if ( apply_filters( 'FHEE__EEG_Paypal_Standard__validate_ipn__skip', false ) ) {
297
+		if (apply_filters('FHEE__EEG_Paypal_Standard__validate_ipn__skip', false)) {
298 298
 			return true;
299 299
 		}
300 300
 		//...otherwise, we actually don't care what the $update_info is, we need to look
@@ -302,22 +302,22 @@  discard block
 block discarded – undo
302 302
 		// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
303 303
 		// Instead, read raw POST data from the input stream.
304 304
 		// @see https://gist.github.com/xcommerce-gists/3440401
305
-		$raw_post_data = file_get_contents( 'php://input' );
306
-		$raw_post_array = explode( '&', $raw_post_data );
305
+		$raw_post_data = file_get_contents('php://input');
306
+		$raw_post_array = explode('&', $raw_post_data);
307 307
 		$update_info = array();
308
-		foreach ( $raw_post_array as $keyval ) {
309
-			$keyval = explode( '=', $keyval );
310
-			if ( count( $keyval ) == 2 )
311
-				$update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] );
308
+		foreach ($raw_post_array as $keyval) {
309
+			$keyval = explode('=', $keyval);
310
+			if (count($keyval) == 2)
311
+				$update_info[$keyval[0]] = urldecode($keyval[1]);
312 312
 		}
313 313
 		// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
314 314
 		$req = 'cmd=_notify-validate';
315
-		$get_magic_quotes_exists = function_exists( 'get_magic_quotes_gpc' ) ? true : false;
316
-		foreach ( $update_info as $key => $value ) {
317
-			if ( $get_magic_quotes_exists && get_magic_quotes_gpc() == 1 ) {
318
-				$value = urlencode( stripslashes( $value ) );
315
+		$get_magic_quotes_exists = function_exists('get_magic_quotes_gpc') ? true : false;
316
+		foreach ($update_info as $key => $value) {
317
+			if ($get_magic_quotes_exists && get_magic_quotes_gpc() == 1) {
318
+				$value = urlencode(stripslashes($value));
319 319
 			} else {
320
-				$value = urlencode( $value );
320
+				$value = urlencode($value);
321 321
 			}
322 322
 			$req .= "&$key=$value";
323 323
 		}
@@ -327,21 +327,21 @@  discard block
 block discarded – undo
327 327
 			array(
328 328
 				'body' 				=> $req,
329 329
 				'sslverify' 		=> false,
330
-				'timeout' 		=> 60 ,
330
+				'timeout' 		=> 60,
331 331
 				// make sure to set a site specific unique "user-agent" string since the WordPres default gets declined by PayPal
332 332
 				// plz see: https://github.com/websharks/s2member/issues/610
333
-				'user-agent' 	=> 'Event Espresso v' . EVENT_ESPRESSO_VERSION . '; ' . home_url(),
333
+				'user-agent' 	=> 'Event Espresso v'.EVENT_ESPRESSO_VERSION.'; '.home_url(),
334 334
 			)
335 335
 		);
336 336
 		// then check the response
337
-		if ( ! is_wp_error( $response ) && array_key_exists( 'body', $response ) && strcmp( $response[ 'body' ], "VERIFIED" ) == 0 ) {
337
+		if ( ! is_wp_error($response) && array_key_exists('body', $response) && strcmp($response['body'], "VERIFIED") == 0) {
338 338
 			return true;
339 339
 		} else {
340 340
 			// huh, something's wack... the IPN didn't validate. We must have replied to the IPN incorrectly,
341 341
 			// or their API must have changed: http://www.paypalobjects.com/en_US/ebook/PP_OrderManagement_IntegrationGuide/ipn.html
342
-			$payment->set_gateway_response( sprintf( __( "IPN Validation failed! Paypal responded with '%s'", "event_espresso" ), $response[ 'body' ] ) );
343
-			$payment->set_details( array( 'REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response ) );
344
-			$payment->set_status( EEM_Payment::status_id_failed );
342
+			$payment->set_gateway_response(sprintf(__("IPN Validation failed! Paypal responded with '%s'", "event_espresso"), $response['body']));
343
+			$payment->set_details(array('REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response));
344
+			$payment->set_status(EEM_Payment::status_id_failed);
345 345
 			// log the results
346 346
 			$this->log(
347 347
 				array(
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
 	 */
364 364
 	protected function _process_response_url() {
365 365
 		EE_Registry::instance()->load_helper('URL');
366
-		if ( isset( $_SERVER[ 'HTTP_HOST' ], $_SERVER[ 'REQUEST_URI' ] ) ) {
366
+		if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) {
367 367
 			$url = is_ssl() ? 'https://' : 'http://';
368
-			$url .= EEH_URL::filter_input_server_url( 'HTTP_HOST' );
368
+			$url .= EEH_URL::filter_input_server_url('HTTP_HOST');
369 369
 			$url .= EEH_URL::filter_input_server_url();
370 370
 		} else {
371 371
 			$url = 'unknown';
@@ -381,19 +381,19 @@  discard block
 block discarded – undo
381 381
 	 * like the taxes or shipping
382 382
 	 * @param EEI_Payment $payment
383 383
 	 */
384
-	public function update_txn_based_on_payment( $payment ) {
384
+	public function update_txn_based_on_payment($payment) {
385 385
 		$update_info = $payment->details();
386 386
 		$redirect_args = $payment->redirect_args();
387 387
 		$transaction = $payment->transaction();
388
-		if( ! $transaction ){
389
-			$this->log( __( 'Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly', 'event_espresso' ), $payment );
388
+		if ( ! $transaction) {
389
+			$this->log(__('Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly', 'event_espresso'), $payment);
390 390
 			return;
391 391
 		}
392
-		if( ! is_array( $update_info ) || ! isset( $update_info[ 'mc_shipping' ] ) || ! isset( $update_info[ 'tax' ] ) ) {
392
+		if ( ! is_array($update_info) || ! isset($update_info['mc_shipping']) || ! isset($update_info['tax'])) {
393 393
 			$this->log(
394 394
 				array(
395 395
 					'url' 				=> $this->_process_response_url(),
396
-					'message' 	=> __( 'Could not update transaction based on payment because the payment details have not yet been put on the payment. This normally happens during the IPN or returning from PayPal', 'event_espresso' ),
396
+					'message' 	=> __('Could not update transaction based on payment because the payment details have not yet been put on the payment. This normally happens during the IPN or returning from PayPal', 'event_espresso'),
397 397
 					'payment' 	=> $payment->model_field_array()
398 398
 				),
399 399
 				$payment
@@ -409,24 +409,24 @@  discard block
 block discarded – undo
409 409
 		$grand_total_needs_resaving = FALSE;
410 410
 
411 411
 		//might PayPal have added shipping?
412
-		if( $this->_paypal_shipping && floatval( $update_info[ 'mc_shipping' ] ) != 0 ){
413
-			$this->_line_item->add_unrelated_item( $transaction->total_line_item(), __('Shipping', 'event_espresso'), floatval( $update_info[ 'mc_shipping' ] ), __('Shipping charges calculated by Paypal', 'event_espresso'), 1, FALSE,  'paypal_shipping' );
412
+		if ($this->_paypal_shipping && floatval($update_info['mc_shipping']) != 0) {
413
+			$this->_line_item->add_unrelated_item($transaction->total_line_item(), __('Shipping', 'event_espresso'), floatval($update_info['mc_shipping']), __('Shipping charges calculated by Paypal', 'event_espresso'), 1, FALSE, 'paypal_shipping');
414 414
 			$grand_total_needs_resaving = TRUE;
415 415
 
416 416
 		}
417 417
 		//might PayPal have changed the taxes?
418
-		if( $this->_paypal_taxes && floatval( $update_info[ 'tax' ] ) != $redirect_args[ 'tax_cart' ] ){
419
-			$this->_line_item->set_total_tax_to( $transaction->total_line_item(), floatval( $update_info['tax'] ), __( 'Taxes', 'event_espresso' ), __( 'Calculated by Paypal', 'event_espresso' ) );
418
+		if ($this->_paypal_taxes && floatval($update_info['tax']) != $redirect_args['tax_cart']) {
419
+			$this->_line_item->set_total_tax_to($transaction->total_line_item(), floatval($update_info['tax']), __('Taxes', 'event_espresso'), __('Calculated by Paypal', 'event_espresso'));
420 420
 			$grand_total_needs_resaving = TRUE;
421 421
 		}
422 422
 
423
-		if( $grand_total_needs_resaving ){
424
-			$transaction->total_line_item()->save_this_and_descendants_to_txn( $transaction->ID() );
423
+		if ($grand_total_needs_resaving) {
424
+			$transaction->total_line_item()->save_this_and_descendants_to_txn($transaction->ID());
425 425
 		}
426 426
 		$this->log(
427 427
 			array(
428 428
 				'url' 													=> $this->_process_response_url(),
429
-				'message' 										=> __( 'Updated transaction related to payment', 'event_espresso' ),
429
+				'message' 										=> __('Updated transaction related to payment', 'event_espresso'),
430 430
 				'transaction (updated)' 					=> $transaction->model_field_array(),
431 431
 				'payment (updated)' 						=> $payment->model_field_array(),
432 432
 				'use_paypal_shipping' 					=> $this->_paypal_shipping,
Please login to merge, or discard this patch.
payment_methods/Paypal_Standard/EE_PMT_Paypal_Standard.pm.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @since 				$VID:$
11 11
  *
12 12
  */
13
-class EE_PMT_Paypal_Standard extends EE_PMT_Base{
13
+class EE_PMT_Paypal_Standard extends EE_PMT_Base {
14 14
 
15 15
 	const shipping_info_none = 1;
16 16
 	const shipping_info_optional = 0;
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		require_once($this->file_folder().'EEG_Paypal_Standard.gateway.php');
27 27
 		$this->_gateway = new EEG_Paypal_Standard();
28 28
 		$this->_pretty_name = __("Paypal Standard", 'event_espresso');
29
-		$this->_default_description = sprintf( __( 'Upon submitting this form, you will be forwarded to PayPal to make your payment. %1$sMake sure you return to this site in order to properly finalize your registration.%2$s', 'event_espresso' ), '<strong>', '</strong>' );
29
+		$this->_default_description = sprintf(__('Upon submitting this form, you will be forwarded to PayPal to make your payment. %1$sMake sure you return to this site in order to properly finalize your registration.%2$s', 'event_espresso'), '<strong>', '</strong>');
30 30
 		parent::__construct($pm_instance);
31 31
 		$this->_default_button_url = $this->file_url().'lib'.DS.'paypal-logo.png';
32 32
 	}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @param \EE_Transaction $transaction
39 39
 	 * @return NULL
40 40
 	 */
41
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
41
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
42 42
 		return NULL;
43 43
 	}
44 44
 
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 	 * @return EE_Payment_Method_Form
50 50
 	 */
51 51
 	public function generate_new_settings_form() {
52
-		require_once( $this->file_folder() . 'EE_Paypal_Standard_Form.form.php' );
53
-		$form =  new EE_Paypal_Standard_Form( $this );
54
-		$form->get_input('PMD_debug_mode')->set_html_label_text(sprintf(__("Use Paypal Sandbox %s", 'event_espresso'),  $this->get_help_tab_link()));
55
-		$form->get_input('shipping_details')->set_html_label_text(sprintf(__("Shipping Address Options %s", "event_espresso"),  $this->get_help_tab_link()));
52
+		require_once($this->file_folder().'EE_Paypal_Standard_Form.form.php');
53
+		$form = new EE_Paypal_Standard_Form($this);
54
+		$form->get_input('PMD_debug_mode')->set_html_label_text(sprintf(__("Use Paypal Sandbox %s", 'event_espresso'), $this->get_help_tab_link()));
55
+		$form->get_input('shipping_details')->set_html_label_text(sprintf(__("Shipping Address Options %s", "event_espresso"), $this->get_help_tab_link()));
56 56
 		return $form;
57 57
 	}
58 58
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @see EE_PMT_Base::help_tabs_config()
64 64
 	 * @return array
65 65
 	 */
66
-	public function help_tabs_config(){
66
+	public function help_tabs_config() {
67 67
 		return array(
68 68
 			$this->get_help_tab_name() => array(
69 69
 				'title'=>  __("Paypal Standard Settings", 'event_espresso'),
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	 * @param EE_Transaction $transaction
85 85
 	 * @return EE_Payment
86 86
 	 */
87
-	public function finalize_payment_for($transaction){
87
+	public function finalize_payment_for($transaction) {
88 88
 		//paypal standard actually sends teh IPN info along with the user
89 89
 		//when they return to our site
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91
-		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92
-			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
94
-			return parent::finalize_payment_for( $transaction );
91
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
92
+			return $this->handle_ipn($_POST, $transaction);
93
+		} else {
94
+			return parent::finalize_payment_for($transaction);
95 95
 		}
96 96
 	}
97 97
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91 91
 		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92 92
 			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
93
+		} else{
94 94
 			return parent::finalize_payment_for( $transaction );
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
payment_methods/Paypal_Standard/EE_Paypal_Standard_Form.form.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
  *
16 16
  */
17 17
 class EE_Paypal_Standard_Form extends EE_Payment_Method_Form {
18
-	protected function _normalize( $req_data ) {
19
-		parent::_normalize( $req_data );
18
+	protected function _normalize($req_data) {
19
+		parent::_normalize($req_data);
20 20
 	}
21 21
 
22 22
 	/**
23 23
 	 *
24 24
 	 * @param EE_PMT_Paypal_Standard $payment_method_type
25 25
 	 */
26
-	public function __construct( $payment_method_type ){
26
+	public function __construct($payment_method_type) {
27 27
 		$options_array = array(
28 28
 			'payment_method_type' => $payment_method_type,
29 29
 			'extra_meta_inputs'=>array(
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 				)),
35 35
 				'image_url'=>new EE_Admin_File_Uploader_Input(array(
36 36
 					'html_help_text'=>  __("Used for your business/personal logo on the PayPal page", 'event_espresso'),
37
-					'html_label_text' => __( 'Image URL', 'event_espresso' )
37
+					'html_label_text' => __('Image URL', 'event_espresso')
38 38
 				)),
39 39
 				'shipping_details'=>new EE_Select_Input(array(
40 40
 					EE_PMT_Paypal_Standard::shipping_info_none => __("Do not prompt for an address", 'event_espresso'),
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 			'before_form_content_template'=>$payment_method_type->file_folder().DS.'templates'.DS.'paypal_standard_settings_before_form.template.php',
46 46
 			);
47 47
 
48
-		parent::__construct( $options_array );
48
+		parent::__construct($options_array);
49 49
 	}
50 50
 }
51 51
 
Please login to merge, or discard this patch.
help_tabs/payment_methods_overview_paypalstandard.help_tab.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 <?php _e('Adjust the settings for the PayPal Standard payment gateway.', 'event_espresso'); ?>
4 4
 </p>
5 5
 <p>
6
-<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso' ), "<a href='https://www.paypal.com/multicurrency' target='_blank'>","</a>" ); ?>
6
+<?php printf(__('See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso'), "<a href='https://www.paypal.com/multicurrency' target='_blank'>", "</a>"); ?>
7 7
 </p>
8 8
 <h3><?php _e('PayPal Standard Settings', 'event_espresso'); ?></h3>
9 9
 <ul>
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
 </li>
22 22
 <li>
23 23
 <strong><?php _e('PayPal Calculates Taxes', 'event_espresso'); ?></strong><br />
24
-<?php printf( __('If set to "Yes", we will indicate to PayPal that it ought to calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>' ); ?><br/>
25
-<?php _e( 'Important Note: PayPal calculates its taxes ONLY ON TAXABLE tickets. So if you mark an Event Espresso ticket as being non-taxable, PayPal will also respect that setting and those items will NOT be taxed.', 'event_espresso' );?>
24
+<?php printf(__('If set to "Yes", we will indicate to PayPal that it ought to calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>'); ?><br/>
25
+<?php _e('Important Note: PayPal calculates its taxes ONLY ON TAXABLE tickets. So if you mark an Event Espresso ticket as being non-taxable, PayPal will also respect that setting and those items will NOT be taxed.', 'event_espresso'); ?>
26 26
 </li>
27 27
 <li>
28 28
 <strong><?php _e('PayPal Calculates Shipping', 'event_espresso'); ?></strong><br />
29 29
 <?php _e('Similar to the "PayPal Calculates Taxes" setting, if this is set to "Yes", we will indicate to PayPal that it ought to calculate the shipping on the order and it.', 'event_espresso'); ?><br/>
30
-<?php _e( 'Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso' );?>
30
+<?php _e('Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso'); ?>
31 31
 <li>
32
-<strong><?php _e( 'Notes Regarding Paypal Taxes and Shipping', 'event_espresso' );?></strong><br/>
33
-<?php _e( 'If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso' );?><br/>
34
-<?php _e( 'However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso' );?>
32
+<strong><?php _e('Notes Regarding Paypal Taxes and Shipping', 'event_espresso'); ?></strong><br/>
33
+<?php _e('If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso'); ?><br/>
34
+<?php _e('However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso'); ?>
35 35
 </li>
36 36
 <li>
37 37
 <strong><?php _e('Shipping Address Options', 'event_espresso'); ?></strong><br />
Please login to merge, or discard this patch.
Paypal_Standard/templates/paypal_standard_settings_before_form.template.php 3 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -3,27 +3,27 @@
 block discarded – undo
3 3
 if (!defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 /**
6
- * Event Espresso
7
- *
8
- * Event Registration and Management Plugin for WordPress
9
- *
10
- * @ package			Event Espresso
11
- * @ author			Seth Shoultes
12
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
13
- * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
14
- * @ link					http://www.eventespresso.com
15
- * @ version		 	4.3
16
- *
17
- * ------------------------------------------------------------------------
18
- *
19
- * paypal_standard_settings_before_form
20
- *
21
- * @package			Event Espresso
22
- * @subpackage		
23
- * @author				Mike Nelson
24
- *
25
- * ------------------------------------------------------------------------
26
- */
6
+	 * Event Espresso
7
+	 *
8
+	 * Event Registration and Management Plugin for WordPress
9
+	 *
10
+	 * @ package			Event Espresso
11
+	 * @ author			Seth Shoultes
12
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
13
+	 * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
14
+	 * @ link					http://www.eventespresso.com
15
+	 * @ version		 	4.3
16
+	 *
17
+	 * ------------------------------------------------------------------------
18
+	 *
19
+	 * paypal_standard_settings_before_form
20
+	 *
21
+	 * @package			Event Espresso
22
+	 * @subpackage		
23
+	 * @author				Mike Nelson
24
+	 *
25
+	 * ------------------------------------------------------------------------
26
+	 */
27 27
 ?>
28 28
 <strong style="color:#F00"><?php _e('Please Note:','event_espresso')?></strong> <?php		_e("You will need a PayPal Premier or Business account for the PayPal IPN to work correctly.	", 'event_espresso');	
29 29
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 /**
6 6
  * Event Espresso
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * ------------------------------------------------------------------------
26 26
  */
27 27
 ?>
28
-<strong style="color:#F00"><?php _e('Please Note:','event_espresso')?></strong> <?php		_e("You will need a PayPal Premier or Business account for the PayPal IPN to work correctly.	", 'event_espresso');	
28
+<strong style="color:#F00"><?php _e('Please Note:', 'event_espresso')?></strong> <?php		_e("You will need a PayPal Premier or Business account for the PayPal IPN to work correctly.	", 'event_espresso');	
29 29
 
30 30
 
31 31
 // End of file paypal_standard_settings_before_form.template.php
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 /**
6 7
  * Event Espresso
7 8
  *
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/archive-espresso_events.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@
 block discarded – undo
16 16
 
17 17
 	<section id="primary" class="content-area">
18 18
 		<div id="content" class="site-content" role="main">
19
-			<?php espresso_get_template_part( 'loop', 'espresso_events' ); ?>			
19
+			<?php espresso_get_template_part('loop', 'espresso_events'); ?>			
20 20
 		</div><!-- #content -->
21 21
 	</section><!-- #primary -->
22 22
 
23 23
 <?php
24
-get_sidebar( 'content' );
24
+get_sidebar('content');
25 25
 get_sidebar();
26 26
 get_footer();
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/archive-espresso_venues.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 18
 
19 19
 	<section id="primary" class="content-area">
20 20
 		<div id="content" class="site-content" role="main">
21
-			<?php espresso_get_template_part( 'loop', 'espresso_venues' ); ?>			
21
+			<?php espresso_get_template_part('loop', 'espresso_venues'); ?>			
22 22
 		</div><!-- #content -->
23 23
 	</section><!-- #primary -->
24 24
 
25 25
 <?php
26
-get_sidebar( 'content' );
26
+get_sidebar('content');
27 27
 get_sidebar();
28 28
 get_footer();
29 29
\ No newline at end of file
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_event_attendees.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@
 block discarded – undo
11 11
  * @type EE_Attendee $contact
12 12
  * @type bool       $show_gravatar  whether to show gravatar or not.
13 13
  */
14
-if ( $show_gravatar ) {
15
-	$gravatar = get_avatar( $contact->email(),
16
-		(int) apply_filters( 'FHEE__loop-espresso_attendees-shortcode__template__avatar_size', 32 )
14
+if ($show_gravatar) {
15
+	$gravatar = get_avatar($contact->email(),
16
+		(int) apply_filters('FHEE__loop-espresso_attendees-shortcode__template__avatar_size', 32)
17 17
 		);
18 18
 } else {
19 19
 	$gravatar = '';
20 20
 }
21 21
 ?>
22
-<?php do_action( 'AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar ); ?>
23
-<li><?php echo $gravatar . '&nbsp;' .  $contact->full_name(); ?></li>
24
-<?php do_action( 'AHEE__content-espresso_event_attendees__after', $contact, $show_gravatar ); ?>
25 22
\ No newline at end of file
23
+<?php do_action('AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar); ?>
24
+<li><?php echo $gravatar.'&nbsp;'.$contact->full_name(); ?></li>
25
+<?php do_action('AHEE__content-espresso_event_attendees__after', $contact, $show_gravatar); ?>
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_events-datetimes.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' &nbsp; <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>';
3 3
 
4
-if ( is_single() || is_archive() && espresso_display_datetimes_in_event_list() ) :
4
+if (is_single() || is_archive() && espresso_display_datetimes_in_event_list()) :
5 5
 global $post;
6
-do_action( 'AHEE_event_details_before_event_date', $post );
6
+do_action('AHEE_event_details_before_event_date', $post);
7 7
 ?>
8 8
 	<div class="event-datetimes">
9
-		<?php espresso_list_of_event_dates( $post->ID );?>
9
+		<?php espresso_list_of_event_dates($post->ID); ?>
10 10
 	</div>
11 11
 	<!-- .event-datetimes -->
12 12
 <?php
13
-do_action( 'AHEE_event_details_after_event_date', $post );
13
+do_action('AHEE_event_details_after_event_date', $post);
14 14
 endif;
15 15
 ?>
16 16
\ No newline at end of file
Please login to merge, or discard this patch.