Completed
Pull Request — master (#857)
by
unknown
16:49
created
includes/gateways/functions.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,17 +24,17 @@  discard block
 block discarded – undo
24 24
 	// Default, built-in gateways
25 25
 	$gateways = array(
26 26
 		'paypal' => array(
27
-			'admin_label'    => esc_html__( 'PayPal Standard', 'give' ),
28
-			'checkout_label' => esc_html__( 'PayPal', 'give' ),
29
-			'supports'       => array( 'buy_now' )
27
+			'admin_label'    => esc_html__('PayPal Standard', 'give'),
28
+			'checkout_label' => esc_html__('PayPal', 'give'),
29
+			'supports'       => array('buy_now')
30 30
 		),
31 31
 		'manual' => array(
32
-			'admin_label'    => esc_html__( 'Test Payment', 'give' ),
33
-			'checkout_label' => esc_html__( 'Test Payment', 'give' )
32
+			'admin_label'    => esc_html__('Test Payment', 'give'),
33
+			'checkout_label' => esc_html__('Test Payment', 'give')
34 34
 		),
35 35
 	);
36 36
 
37
-	return apply_filters( 'give_payment_gateways', $gateways );
37
+	return apply_filters('give_payment_gateways', $gateways);
38 38
 
39 39
 }
40 40
 
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
 
49 49
 	$gateways = give_get_payment_gateways();
50 50
 
51
-	$enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
51
+	$enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
52 52
 
53 53
 	$gateway_list = array();
54 54
 
55
-	foreach ( $gateways as $key => $gateway ) {
56
-		if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
57
-			$gateway_list[ $key ] = $gateway;
55
+	foreach ($gateways as $key => $gateway) {
56
+		if (isset($enabled[$key]) && $enabled[$key] == 1) {
57
+			$gateway_list[$key] = $gateway;
58 58
 		}
59 59
 	}
60 60
 
61 61
 	// Set order of payment gateway in list.
62
-	$gateway_list = give_get_ordered_payment_gateways( $gateway_list );
62
+	$gateway_list = give_get_ordered_payment_gateways($gateway_list);
63 63
 
64
-	return apply_filters( 'give_enabled_payment_gateways', $gateway_list );
64
+	return apply_filters('give_enabled_payment_gateways', $gateway_list);
65 65
 }
66 66
 
67 67
 /**
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
  *
74 74
  * @return boolean true if enabled, false otherwise
75 75
  */
76
-function give_is_gateway_active( $gateway ) {
76
+function give_is_gateway_active($gateway) {
77 77
 	$gateways = give_get_enabled_payment_gateways();
78 78
 
79
-	$ret = array_key_exists( $gateway, $gateways );
79
+	$ret = array_key_exists($gateway, $gateways);
80 80
 
81
-	return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways );
81
+	return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways);
82 82
 }
83 83
 
84 84
 /**
@@ -91,24 +91,24 @@  discard block
 block discarded – undo
91 91
  *
92 92
  * @return string Gateway ID
93 93
  */
94
-function give_get_default_gateway( $form_id ) {
94
+function give_get_default_gateway($form_id) {
95 95
 
96 96
 	global $give_options;
97 97
 
98
-	$default      = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal';
99
-	$form_default = get_post_meta( $form_id, '_give_default_gateway', true );
98
+	$default      = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal';
99
+	$form_default = get_post_meta($form_id, '_give_default_gateway', true);
100 100
 
101 101
 	//Single Form settings varies compared to the Global default settings
102
-	if ( ! empty( $form_default ) &&
102
+	if ( ! empty($form_default) &&
103 103
 	     $form_id !== null &&
104 104
 	     $default !== $form_default &&
105 105
 	     $form_default !== 'global' &&
106
-	     give_is_gateway_active( $form_default )
106
+	     give_is_gateway_active($form_default)
107 107
 	) {
108 108
 		$default = $form_default;
109 109
 	}
110 110
 
111
-	return apply_filters( 'give_default_gateway', $default );
111
+	return apply_filters('give_default_gateway', $default);
112 112
 }
113 113
 
114 114
 /**
@@ -120,18 +120,18 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string Gateway admin label
122 122
  */
123
-function give_get_gateway_admin_label( $gateway ) {
123
+function give_get_gateway_admin_label($gateway) {
124 124
 	$gateways = give_get_enabled_payment_gateways();
125
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
126
-	$payment  = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false;
125
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
126
+	$payment  = isset($_GET['id']) ? absint($_GET['id']) : false;
127 127
 
128
-	if ( $gateway == 'manual' && $payment ) {
129
-		if ( give_get_payment_amount( $payment ) == 0 ) {
130
-			$label = esc_html__( 'Test Donation', 'give' );
128
+	if ($gateway == 'manual' && $payment) {
129
+		if (give_get_payment_amount($payment) == 0) {
130
+			$label = esc_html__('Test Donation', 'give');
131 131
 		}
132 132
 	}
133 133
 
134
-	return apply_filters( 'give_gateway_admin_label', $label, $gateway );
134
+	return apply_filters('give_gateway_admin_label', $label, $gateway);
135 135
 }
136 136
 
137 137
 /**
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
  *
144 144
  * @return string Checkout label for the gateway
145 145
  */
146
-function give_get_gateway_checkout_label( $gateway ) {
146
+function give_get_gateway_checkout_label($gateway) {
147 147
 	$gateways = give_get_enabled_payment_gateways();
148
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
148
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
149 149
 
150
-	if ( $gateway == 'manual' ) {
151
-		$label = esc_html__( 'Test Donation', 'give' );
150
+	if ($gateway == 'manual') {
151
+		$label = esc_html__('Test Donation', 'give');
152 152
 	}
153 153
 
154
-	return apply_filters( 'give_gateway_checkout_label', $label, $gateway );
154
+	return apply_filters('give_gateway_checkout_label', $label, $gateway);
155 155
 }
156 156
 
157 157
 /**
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return array Options the gateway supports
165 165
  */
166
-function give_get_gateway_supports( $gateway ) {
166
+function give_get_gateway_supports($gateway) {
167 167
 	$gateways = give_get_enabled_payment_gateways();
168
-	$supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
168
+	$supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
169 169
 
170
-	return apply_filters( 'give_gateway_supports', $supports, $gateway );
170
+	return apply_filters('give_gateway_supports', $supports, $gateway);
171 171
 }
172 172
 
173 173
 /**
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
  *
180 180
  * @return bool
181 181
  */
182
-function give_gateway_supports_buy_now( $gateway ) {
183
-	$supports = give_get_gateway_supports( $gateway );
184
-	$ret      = in_array( 'buy_now', $supports );
182
+function give_gateway_supports_buy_now($gateway) {
183
+	$supports = give_get_gateway_supports($gateway);
184
+	$ret      = in_array('buy_now', $supports);
185 185
 
186
-	return apply_filters( 'give_gateway_supports_buy_now', $ret, $gateway );
186
+	return apply_filters('give_gateway_supports_buy_now', $ret, $gateway);
187 187
 }
188 188
 
189 189
 /**
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
 	$gateways = give_get_enabled_payment_gateways();
197 197
 	$ret      = false;
198 198
 
199
-	if ( $gateways ) {
200
-		foreach ( $gateways as $gateway_id => $gateway ) {
201
-			if ( give_gateway_supports_buy_now( $gateway_id ) ) {
199
+	if ($gateways) {
200
+		foreach ($gateways as $gateway_id => $gateway) {
201
+			if (give_gateway_supports_buy_now($gateway_id)) {
202 202
 				$ret = true;
203 203
 				break;
204 204
 			}
205 205
 		}
206 206
 	}
207 207
 
208
-	return apply_filters( 'give_give_supports_buy_now', $ret );
208
+	return apply_filters('give_give_supports_buy_now', $ret);
209 209
 }
210 210
 
211 211
 /**
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
  *
219 219
  * @return void
220 220
  */
221
-function give_send_to_gateway( $gateway, $payment_data ) {
221
+function give_send_to_gateway($gateway, $payment_data) {
222 222
 
223
-	$payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' );
223
+	$payment_data['gateway_nonce'] = wp_create_nonce('give-gateway');
224 224
 
225 225
 	// $gateway must match the ID used when registering the gateway
226
-	do_action( 'give_gateway_' . $gateway, $payment_data );
226
+	do_action('give_gateway_'.$gateway, $payment_data);
227 227
 }
228 228
 
229 229
 
@@ -240,32 +240,32 @@  discard block
 block discarded – undo
240 240
  *
241 241
  * @return string $enabled_gateway The slug of the gateway
242 242
  */
243
-function give_get_chosen_gateway( $form_id ) {
243
+function give_get_chosen_gateway($form_id) {
244 244
 	$gateways        = give_get_enabled_payment_gateways();
245
-	$request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0;
246
-	if ( empty( $request_form_id ) ) {
247
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0;
245
+	$request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0;
246
+	if (empty($request_form_id)) {
247
+		$request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0;
248 248
 	}
249
-	$chosen          = give_get_default_gateway( $form_id );
249
+	$chosen          = give_get_default_gateway($form_id);
250 250
 	$enabled_gateway = '';
251 251
 
252 252
 	//Take into account request Form ID args
253
-	if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) {
253
+	if ( ! empty($request_form_id) && $form_id == $request_form_id) {
254 254
 		$chosen = $_REQUEST['payment-mode'];
255 255
 	}
256 256
 
257
-	if ( $chosen ) {
258
-		$enabled_gateway = urldecode( $chosen );
259
-	} else if ( count( $gateways ) >= 1 && ! $chosen ) {
260
-		foreach ( $gateways as $gateway_id => $gateway ):
257
+	if ($chosen) {
258
+		$enabled_gateway = urldecode($chosen);
259
+	} else if (count($gateways) >= 1 && ! $chosen) {
260
+		foreach ($gateways as $gateway_id => $gateway):
261 261
 			$enabled_gateway = $gateway_id;
262 262
 		endforeach;
263 263
 	} else {
264
-		$enabled_gateway = give_get_default_gateway( $form_id );
264
+		$enabled_gateway = give_get_default_gateway($form_id);
265 265
 	}
266 266
 
267 267
 
268
-	return apply_filters( 'give_chosen_gateway', $enabled_gateway );
268
+	return apply_filters('give_chosen_gateway', $enabled_gateway);
269 269
 }
270 270
 
271 271
 /**
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @return int ID of the new log entry
284 284
  */
285
-function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
286
-	return give_record_log( $title, $message, $parent, 'gateway_error' );
285
+function give_record_gateway_error($title = '', $message = '', $parent = 0) {
286
+	return give_record_log($title, $message, $parent, 'gateway_error');
287 287
 }
288 288
 
289 289
 /**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
  *
297 297
  * @return int
298 298
  */
299
-function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
299
+function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
300 300
 
301 301
 	$ret  = 0;
302 302
 	$args = array(
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
 		'fields'      => 'ids'
309 309
 	);
310 310
 
311
-	$payments = new WP_Query( $args );
311
+	$payments = new WP_Query($args);
312 312
 
313
-	if ( $payments ) {
313
+	if ($payments) {
314 314
 		$ret = $payments->post_count;
315 315
 	}
316 316
 
@@ -327,27 +327,27 @@  discard block
 block discarded – undo
327 327
  *
328 328
  * @return array $gateways All the available gateways
329 329
  */
330
-function give_get_ordered_payment_gateways( $gateways ) {
330
+function give_get_ordered_payment_gateways($gateways) {
331 331
 
332 332
 	//  Get gateways setting.
333
-	$gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
333
+	$gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
334 334
 
335 335
 	// Return from here if we do not have gateways setting.
336
-	if ( empty( $gateways_setting ) ) {
336
+	if (empty($gateways_setting)) {
337 337
 		return $gateways;
338 338
 	}
339 339
 
340 340
 	// Reverse array to order payment gateways.
341
-	$gateways_setting = array_reverse( $gateways_setting );
341
+	$gateways_setting = array_reverse($gateways_setting);
342 342
 
343 343
 	// Reorder gateways array
344
-	foreach ( $gateways_setting as $gateway_key => $value ) {
344
+	foreach ($gateways_setting as $gateway_key => $value) {
345 345
 
346
-		$new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : '';
347
-		unset( $gateways[ $gateway_key ] );
346
+		$new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : '';
347
+		unset($gateways[$gateway_key]);
348 348
 
349
-		if(!empty($new_gateway_value)) {
350
-			$gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways );
349
+		if ( ! empty($new_gateway_value)) {
350
+			$gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways);
351 351
 		}
352 352
 	}
353 353
 
@@ -358,5 +358,5 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
 	 * @param array $gateways All the available gateways
360 360
 	 */
361
-	return apply_filters( 'give_payment_gateways_order', $gateways );
361
+	return apply_filters('give_payment_gateways_order', $gateways);
362 362
 }
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 1 patch
Spacing   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @access private
22 22
  * @since  1.0
23 23
  */
24
-add_action( 'give_paypal_cc_form', '__return_false' );
24
+add_action('give_paypal_cc_form', '__return_false');
25 25
 
26 26
 /**
27 27
  * Process PayPal Purchase
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_process_paypal_purchase( $purchase_data ) {
35
+function give_process_paypal_purchase($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41
-	$form_id = intval( $purchase_data['post_data']['give-form-id'] );
41
+	$form_id = intval($purchase_data['post_data']['give-form-id']);
42 42
 	$price_id = isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '';
43 43
 	
44 44
 	// Collect payment data
@@ -57,67 +57,67 @@  discard block
 block discarded – undo
57 57
 	);
58 58
 
59 59
 	// Record the pending payment
60
-	$payment = give_insert_payment( $payment_data );
60
+	$payment = give_insert_payment($payment_data);
61 61
 
62 62
 	// Check payment
63
-	if ( ! $payment ) {
63
+	if ( ! $payment) {
64 64
 		// Record the error
65 65
 		give_record_gateway_error(
66
-			esc_html__( 'Payment Error', 'give' ),
66
+			esc_html__('Payment Error', 'give'),
67 67
 			sprintf(
68 68
 				/* translators: %s: payment data */
69
-				esc_html__( 'Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give' ),
70
-				json_encode( $payment_data )
69
+				esc_html__('Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give'),
70
+				json_encode($payment_data)
71 71
 			),
72 72
 			$payment
73 73
 		);
74 74
 		// Problems? send back
75
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
75
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
76 76
 	} else {
77 77
 		// Only send to PayPal if the pending payment is created successfully
78
-		$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
78
+		$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
79 79
 
80 80
 		// Get the success url
81
-		$return_url = add_query_arg( array(
81
+		$return_url = add_query_arg(array(
82 82
 			'payment-confirmation' => 'paypal',
83 83
 			'payment-id'           => $payment
84 84
 
85
-		), get_permalink( give_get_option( 'success_page' ) ) );
85
+		), get_permalink(give_get_option('success_page')));
86 86
 
87 87
 		// Get the PayPal redirect uri
88
-		$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
88
+		$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
89 89
 
90 90
 		//Item name - pass level name if variable priced
91 91
 		$item_name = $purchase_data['post_data']['give-form-title'];
92 92
 
93 93
 		//Verify has variable prices
94
-		if ( give_has_variable_prices( $form_id ) && isset( $purchase_data['post_data']['give-price-id'] ) ) {
94
+		if (give_has_variable_prices($form_id) && isset($purchase_data['post_data']['give-price-id'])) {
95 95
 
96
-			$item_price_level_text = give_get_price_option_name( $form_id, $purchase_data['post_data']['give-price-id'] );
96
+			$item_price_level_text = give_get_price_option_name($form_id, $purchase_data['post_data']['give-price-id']);
97 97
 
98
-			$price_level_amount = give_get_price_option_amount( $form_id, $purchase_data['post_data']['give-price-id'] );
98
+			$price_level_amount = give_get_price_option_amount($form_id, $purchase_data['post_data']['give-price-id']);
99 99
 
100 100
 			//Donation given doesn't match selected level (must be a custom amount)
101
-			if ( $price_level_amount != give_sanitize_amount( $purchase_data['price'] ) ) {
102
-				$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
101
+			if ($price_level_amount != give_sanitize_amount($purchase_data['price'])) {
102
+				$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
103 103
 				//user custom amount text if any, fallback to default if not
104
-				$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
104
+				$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
105 105
 
106 106
 			} //Is there any donation level text?
107
-			elseif ( ! empty( $item_price_level_text ) ) {
108
-				$item_name .= ' - ' . $item_price_level_text;
107
+			elseif ( ! empty($item_price_level_text)) {
108
+				$item_name .= ' - '.$item_price_level_text;
109 109
 			}
110 110
 
111 111
 		} //Single donation: Custom Amount
112
-		elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $purchase_data['price'] ) ) {
113
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
112
+		elseif (give_get_form_price($form_id) !== give_sanitize_amount($purchase_data['price'])) {
113
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
114 114
 			//user custom amount text if any, fallback to default if not
115
-			$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
115
+			$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
116 116
 		}
117 117
 
118 118
 		// Setup PayPal arguments
119 119
 		$paypal_args = array(
120
-			'business'      => give_get_option( 'paypal_email', false ),
120
+			'business'      => give_get_option('paypal_email', false),
121 121
 			'email'         => $purchase_data['user_email'],
122 122
 			'invoice'       => $purchase_data['purchase_key'],
123 123
 			'amount'        => $purchase_data['price'],
@@ -128,25 +128,25 @@  discard block
 block discarded – undo
128 128
 			'shipping'      => '0',
129 129
 			'no_note'       => '1',
130 130
 			'currency_code' => give_get_currency(),
131
-			'charset'       => get_bloginfo( 'charset' ),
131
+			'charset'       => get_bloginfo('charset'),
132 132
 			'custom'        => $payment,
133 133
 			'rm'            => '2',
134 134
 			'return'        => $return_url,
135
-			'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment ),
135
+			'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment),
136 136
 			'notify_url'    => $listener_url,
137 137
 			'page_style'    => give_get_paypal_page_style(),
138
-			'cbt'           => get_bloginfo( 'name' ),
138
+			'cbt'           => get_bloginfo('name'),
139 139
 			'bn'            => 'givewp_SP'
140 140
 		);
141 141
 
142
-		if ( ! empty( $purchase_data['user_info']['address'] ) ) {
142
+		if ( ! empty($purchase_data['user_info']['address'])) {
143 143
 			$paypal_args['address1'] = $purchase_data['user_info']['address']['line1'];
144 144
 			$paypal_args['address2'] = $purchase_data['user_info']['address']['line2'];
145 145
 			$paypal_args['city']     = $purchase_data['user_info']['address']['city'];
146 146
 			$paypal_args['country']  = $purchase_data['user_info']['address']['country'];
147 147
 		}
148 148
 
149
-		if ( give_get_option( 'paypal_button_type' ) === 'standard' ) {
149
+		if (give_get_option('paypal_button_type') === 'standard') {
150 150
 			$paypal_extra_args = array(
151 151
 				'cmd' => '_xclick',
152 152
 			);
@@ -156,23 +156,23 @@  discard block
 block discarded – undo
156 156
 			);
157 157
 		}
158 158
 
159
-		$paypal_args = array_merge( $paypal_extra_args, $paypal_args );
160
-		$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $purchase_data );
159
+		$paypal_args = array_merge($paypal_extra_args, $paypal_args);
160
+		$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $purchase_data);
161 161
 
162 162
 		// Build query
163
-		$paypal_redirect .= http_build_query( $paypal_args );
163
+		$paypal_redirect .= http_build_query($paypal_args);
164 164
 
165 165
 		// Fix for some sites that encode the entities
166
-		$paypal_redirect = str_replace( '&', '&', $paypal_redirect );
166
+		$paypal_redirect = str_replace('&', '&', $paypal_redirect);
167 167
 
168 168
 		// Redirect to PayPal
169
-		wp_redirect( $paypal_redirect );
169
+		wp_redirect($paypal_redirect);
170 170
 		exit;
171 171
 	}
172 172
 
173 173
 }
174 174
 
175
-add_action( 'give_gateway_paypal', 'give_process_paypal_purchase' );
175
+add_action('give_gateway_paypal', 'give_process_paypal_purchase');
176 176
 
177 177
 /**
178 178
  * Listens for a PayPal IPN requests and then sends to the processing function
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
  */
183 183
 function give_listen_for_paypal_ipn() {
184 184
 	// Regular PayPal IPN
185
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
186
-		do_action( 'give_verify_paypal_ipn' );
185
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
186
+		do_action('give_verify_paypal_ipn');
187 187
 	}
188 188
 }
189 189
 
190
-add_action( 'init', 'give_listen_for_paypal_ipn' );
190
+add_action('init', 'give_listen_for_paypal_ipn');
191 191
 
192 192
 /**
193 193
  * Process PayPal IPN
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 function give_process_paypal_ipn() {
199 199
 
200 200
 	// Check the request method is POST
201
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
201
+	if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
202 202
 		return;
203 203
 	}
204 204
 
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	$post_data = '';
207 207
 
208 208
 	// Fallback just in case post_max_size is lower than needed
209
-	if ( ini_get( 'allow_url_fopen' ) ) {
210
-		$post_data = file_get_contents( 'php://input' );
209
+	if (ini_get('allow_url_fopen')) {
210
+		$post_data = file_get_contents('php://input');
211 211
 	} else {
212 212
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough
213
-		ini_set( 'post_max_size', '12M' );
213
+		ini_set('post_max_size', '12M');
214 214
 	}
215 215
 	// Start the encoded data collection with notification command
216 216
 	$encoded_data = 'cmd=_notify-validate';
@@ -219,40 +219,40 @@  discard block
 block discarded – undo
219 219
 	$arg_separator = give_get_php_arg_separator_output();
220 220
 
221 221
 	// Verify there is a post_data
222
-	if ( $post_data || strlen( $post_data ) > 0 ) {
222
+	if ($post_data || strlen($post_data) > 0) {
223 223
 		// Append the data
224
-		$encoded_data .= $arg_separator . $post_data;
224
+		$encoded_data .= $arg_separator.$post_data;
225 225
 	} else {
226 226
 		// Check if POST is empty
227
-		if ( empty( $_POST ) ) {
227
+		if (empty($_POST)) {
228 228
 			// Nothing to do
229 229
 			return;
230 230
 		} else {
231 231
 			// Loop through each POST
232
-			foreach ( $_POST as $key => $value ) {
232
+			foreach ($_POST as $key => $value) {
233 233
 				// Encode the value and append the data
234
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
234
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
235 235
 			}
236 236
 		}
237 237
 	}
238 238
 
239 239
 	// Convert collected post data to an array
240
-	parse_str( $encoded_data, $encoded_data_array );
240
+	parse_str($encoded_data, $encoded_data_array);
241 241
 
242
-	foreach ( $encoded_data_array as $key => $value ) {
242
+	foreach ($encoded_data_array as $key => $value) {
243 243
 
244
-		if ( false !== strpos( $key, 'amp;' ) ) {
245
-			$new_key = str_replace( '&', '&', $key );
246
-			$new_key = str_replace( 'amp;', '&' , $new_key );
244
+		if (false !== strpos($key, 'amp;')) {
245
+			$new_key = str_replace('&', '&', $key);
246
+			$new_key = str_replace('amp;', '&', $new_key);
247 247
 
248
-			unset( $encoded_data_array[ $key ] );
249
-			$encoded_data_array[ $new_key ] = $value;
248
+			unset($encoded_data_array[$key]);
249
+			$encoded_data_array[$new_key] = $value;
250 250
 		}
251 251
 
252 252
 	}
253 253
 	
254 254
 	//Validate IPN request w/ PayPal if user hasn't disabled this security measure
255
-	if ( ! give_get_option( 'disable_paypal_verification' ) ) {
255
+	if ( ! give_get_option('disable_paypal_verification')) {
256 256
 
257 257
 		$remote_post_vars = array(
258 258
 			'method'      => 'POST',
@@ -272,27 +272,27 @@  discard block
 block discarded – undo
272 272
 		);
273 273
 
274 274
 		// Validate the IPN
275
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
275
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
276 276
 
277
-		if ( is_wp_error( $api_response ) ) {
277
+		if (is_wp_error($api_response)) {
278 278
 			give_record_gateway_error(
279
-				esc_html__( 'IPN Error', 'give' ),
279
+				esc_html__('IPN Error', 'give'),
280 280
 				sprintf(
281 281
 					/* translators: %s: Paypal IPN response */
282
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
283
-					json_encode( $api_response )
282
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
283
+					json_encode($api_response)
284 284
 				)
285 285
 			);
286 286
 			return; // Something went wrong
287 287
 		}
288 288
 
289
-		if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) {
289
+		if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) {
290 290
 			give_record_gateway_error(
291
-				esc_html__( 'IPN Error', 'give' ),
291
+				esc_html__('IPN Error', 'give'),
292 292
 				sprintf(
293 293
 					/* translators: %s: Paypal IPN response */
294
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
295
-					json_encode( $api_response )
294
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
295
+					json_encode($api_response)
296 296
 				)
297 297
 			);
298 298
 			return; // Response not okay
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	}
302 302
 
303 303
 	// Check if $post_data_array has been populated
304
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
304
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
305 305
 		return;
306 306
 	}
307 307
 
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
 		'payment_status' => ''
311 311
 	);
312 312
 
313
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
313
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
314 314
 
315
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
315
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
316 316
 
317
-	if ( has_action( 'give_paypal_' . $encoded_data_array['txn_type'] ) ) {
317
+	if (has_action('give_paypal_'.$encoded_data_array['txn_type'])) {
318 318
 		// Allow PayPal IPN types to be processed separately
319
-		do_action( 'give_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $payment_id );
319
+		do_action('give_paypal_'.$encoded_data_array['txn_type'], $encoded_data_array, $payment_id);
320 320
 	} else {
321 321
 		// Fallback to web accept just in case the txn_type isn't present
322
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
322
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
323 323
 	}
324 324
 	exit;
325 325
 }
326 326
 
327
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
327
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
328 328
 
329 329
 /**
330 330
  * Process web accept (one time) payment IPNs
@@ -335,224 +335,224 @@  discard block
 block discarded – undo
335 335
  *
336 336
  * @return void
337 337
  */
338
-function give_process_paypal_web_accept_and_cart( $data, $payment_id ) {
338
+function give_process_paypal_web_accept_and_cart($data, $payment_id) {
339 339
 
340
-	if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded' ) {
340
+	if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') {
341 341
 		return;
342 342
 	}
343 343
 
344
-	if ( empty( $payment_id ) ) {
344
+	if (empty($payment_id)) {
345 345
 		return;
346 346
 	}
347 347
 
348 348
 	// Collect payment details
349
-	$purchase_key   = isset( $data['invoice'] ) ? $data['invoice'] : $data['item_number'];
349
+	$purchase_key   = isset($data['invoice']) ? $data['invoice'] : $data['item_number'];
350 350
 	$paypal_amount  = $data['mc_gross'];
351
-	$payment_status = strtolower( $data['payment_status'] );
352
-	$currency_code  = strtolower( $data['mc_currency'] );
353
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
354
-	$payment_meta   = give_get_payment_meta( $payment_id );
351
+	$payment_status = strtolower($data['payment_status']);
352
+	$currency_code  = strtolower($data['mc_currency']);
353
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
354
+	$payment_meta   = give_get_payment_meta($payment_id);
355 355
 
356 356
 
357
-	if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) {
357
+	if (give_get_payment_gateway($payment_id) != 'paypal') {
358 358
 		return; // this isn't a PayPal standard IPN
359 359
 	}
360 360
 
361 361
 	// Verify payment recipient
362
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) {
362
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
363 363
 
364 364
 		give_record_gateway_error(
365
-			esc_html__( 'IPN Error', 'give' ),
365
+			esc_html__('IPN Error', 'give'),
366 366
 			sprintf(
367 367
 				/* translators: %s: Paypal IPN response */
368
-				esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ),
369
-				json_encode( $data )
368
+				esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'),
369
+				json_encode($data)
370 370
 			),
371 371
 			$payment_id
372 372
 		);
373
-		give_update_payment_status( $payment_id, 'failed' );
374
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) );
373
+		give_update_payment_status($payment_id, 'failed');
374
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give'));
375 375
 
376 376
 		return;
377 377
 	}
378 378
 
379 379
 	// Verify payment currency
380
-	if ( $currency_code != strtolower( $payment_meta['currency'] ) ) {
380
+	if ($currency_code != strtolower($payment_meta['currency'])) {
381 381
 
382 382
 		give_record_gateway_error(
383
-			esc_html__( 'IPN Error', 'give' ),
383
+			esc_html__('IPN Error', 'give'),
384 384
 			sprintf(
385 385
 				/* translators: %s: Paypal IPN response */
386
-				esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ),
387
-				json_encode( $data )
386
+				esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'),
387
+				json_encode($data)
388 388
 			),
389 389
 			$payment_id
390 390
 		);
391
-		give_update_payment_status( $payment_id, 'failed' );
392
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
391
+		give_update_payment_status($payment_id, 'failed');
392
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give'));
393 393
 
394 394
 		return;
395 395
 	}
396 396
 
397
-	if ( ! give_get_payment_user_email( $payment_id ) ) {
397
+	if ( ! give_get_payment_user_email($payment_id)) {
398 398
 
399 399
 		// No email associated with purchase, so store from PayPal
400
-		give_update_payment_meta( $payment_id, '_give_payment_user_email', $data['payer_email'] );
400
+		give_update_payment_meta($payment_id, '_give_payment_user_email', $data['payer_email']);
401 401
 
402 402
 		// Setup and store the donors's details
403 403
 		$address            = array();
404
-		$address['line1']   = ! empty( $data['address_street'] ) ? sanitize_text_field( $data['address_street'] ) : false;
405
-		$address['city']    = ! empty( $data['address_city'] ) ? sanitize_text_field( $data['address_city'] ) : false;
406
-		$address['state']   = ! empty( $data['address_state'] ) ? sanitize_text_field( $data['address_state'] ) : false;
407
-		$address['country'] = ! empty( $data['address_country_code'] ) ? sanitize_text_field( $data['address_country_code'] ) : false;
408
-		$address['zip']     = ! empty( $data['address_zip'] ) ? sanitize_text_field( $data['address_zip'] ) : false;
404
+		$address['line1']   = ! empty($data['address_street']) ? sanitize_text_field($data['address_street']) : false;
405
+		$address['city']    = ! empty($data['address_city']) ? sanitize_text_field($data['address_city']) : false;
406
+		$address['state']   = ! empty($data['address_state']) ? sanitize_text_field($data['address_state']) : false;
407
+		$address['country'] = ! empty($data['address_country_code']) ? sanitize_text_field($data['address_country_code']) : false;
408
+		$address['zip']     = ! empty($data['address_zip']) ? sanitize_text_field($data['address_zip']) : false;
409 409
 
410 410
 		$user_info = array(
411 411
 			'id'         => '-1',
412
-			'email'      => sanitize_text_field( $data['payer_email'] ),
413
-			'first_name' => sanitize_text_field( $data['first_name'] ),
414
-			'last_name'  => sanitize_text_field( $data['last_name'] ),
412
+			'email'      => sanitize_text_field($data['payer_email']),
413
+			'first_name' => sanitize_text_field($data['first_name']),
414
+			'last_name'  => sanitize_text_field($data['last_name']),
415 415
 			'discount'   => '',
416 416
 			'address'    => $address
417 417
 		);
418 418
 
419 419
 		$payment_meta['user_info'] = $user_info;
420
-		give_update_payment_meta( $payment_id, '_give_payment_meta', $payment_meta );
420
+		give_update_payment_meta($payment_id, '_give_payment_meta', $payment_meta);
421 421
 	}
422 422
 
423
-	if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) {
423
+	if ($payment_status == 'refunded' || $payment_status == 'reversed') {
424 424
 
425 425
 		// Process a refund
426
-		give_process_paypal_refund( $data, $payment_id );
426
+		give_process_paypal_refund($data, $payment_id);
427 427
 
428 428
 	} else {
429 429
 
430
-		if ( get_post_status( $payment_id ) == 'publish' ) {
430
+		if (get_post_status($payment_id) == 'publish') {
431 431
 			return; // Only complete payments once
432 432
 		}
433 433
 
434 434
 		// Retrieve the total purchase amount (before PayPal)
435
-		$payment_amount = give_get_payment_amount( $payment_id );
435
+		$payment_amount = give_get_payment_amount($payment_id);
436 436
 
437
-		if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
437
+		if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
438 438
 			// The prices don't match
439 439
 			give_record_gateway_error(
440
-				esc_html__( 'IPN Error', 'give' ),
440
+				esc_html__('IPN Error', 'give'),
441 441
 				sprintf(
442 442
 					/* translators: %s: Paypal IPN response */
443
-					esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ),
444
-					json_encode( $data )
443
+					esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'),
444
+					json_encode($data)
445 445
 				),
446 446
 				$payment_id
447 447
 			);
448
-			give_update_payment_status( $payment_id, 'failed' );
449
-			give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
448
+			give_update_payment_status($payment_id, 'failed');
449
+			give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give'));
450 450
 
451 451
 			return;
452 452
 		}
453
-		if ( $purchase_key != give_get_payment_key( $payment_id ) ) {
453
+		if ($purchase_key != give_get_payment_key($payment_id)) {
454 454
 			// Purchase keys don't match
455 455
 			give_record_gateway_error(
456
-				esc_html__( 'IPN Error', 'give' ),
456
+				esc_html__('IPN Error', 'give'),
457 457
 				sprintf(
458 458
 					/* translators: %s: Paypal IPN response */
459
-					esc_html__( 'Invalid purchase key in IPN response. IPN data: %s', 'give' ),
460
-					json_encode( $data )
459
+					esc_html__('Invalid purchase key in IPN response. IPN data: %s', 'give'),
460
+					json_encode($data)
461 461
 				),
462 462
 				$payment_id
463 463
 			);
464
-			give_update_payment_status( $payment_id, 'failed' );
465
-			give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid purchase key in PayPal IPN.', 'give' ) );
464
+			give_update_payment_status($payment_id, 'failed');
465
+			give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid purchase key in PayPal IPN.', 'give'));
466 466
 
467 467
 			return;
468 468
 		}
469 469
 
470
-		if ( $payment_status == 'completed' || give_is_test_mode() ) {
470
+		if ($payment_status == 'completed' || give_is_test_mode()) {
471 471
 			give_insert_payment_note(
472 472
 				$payment_id,
473 473
 				sprintf(
474 474
 					/* translators: %s: Paypal transaction ID */
475
-					esc_html__( 'PayPal Transaction ID: %s', 'give' ),
475
+					esc_html__('PayPal Transaction ID: %s', 'give'),
476 476
 					$data['txn_id']
477 477
 				)
478 478
 			);
479
-			give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
480
-			give_update_payment_status( $payment_id, 'publish' );
481
-		} else if ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) {
479
+			give_set_payment_transaction_id($payment_id, $data['txn_id']);
480
+			give_update_payment_status($payment_id, 'publish');
481
+		} else if ('pending' == $payment_status && isset($data['pending_reason'])) {
482 482
 
483 483
 			// Look for possible pending reasons, such as an echeck
484 484
 
485 485
 			$note = '';
486 486
 
487
-			switch ( strtolower( $data['pending_reason'] ) ) {
487
+			switch (strtolower($data['pending_reason'])) {
488 488
 
489 489
 				case 'echeck' :
490 490
 
491
-					$note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
491
+					$note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
492 492
 
493 493
 					break;
494 494
 
495 495
 				case 'address' :
496 496
 
497
-					$note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
497
+					$note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
498 498
 
499 499
 					break;
500 500
 
501 501
 				case 'intl' :
502 502
 
503
-					$note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
503
+					$note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
504 504
 
505 505
 					break;
506 506
 
507 507
 				case 'multi-currency' :
508 508
 
509
-					$note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
509
+					$note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
510 510
 
511 511
 					break;
512 512
 
513 513
 				case 'paymentreview' :
514 514
 				case 'regulatory_review' :
515 515
 
516
-					$note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
516
+					$note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
517 517
 
518 518
 					break;
519 519
 
520 520
 				case 'unilateral' :
521 521
 
522
-					$note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
522
+					$note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give');
523 523
 
524 524
 					break;
525 525
 
526 526
 				case 'upgrade' :
527 527
 
528
-					$note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
528
+					$note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give');
529 529
 
530 530
 					break;
531 531
 
532 532
 				case 'verify' :
533 533
 
534
-					$note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this payment.', 'give' );
534
+					$note = esc_html__('PayPal account is not verified. Verify account in order to accept this payment.', 'give');
535 535
 
536 536
 					break;
537 537
 
538 538
 				case 'other' :
539 539
 
540
-					$note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
540
+					$note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
541 541
 
542 542
 					break;
543 543
 
544 544
 			}
545 545
 
546
-			if ( ! empty( $note ) ) {
546
+			if ( ! empty($note)) {
547 547
 
548
-				give_insert_payment_note( $payment_id, $note );
548
+				give_insert_payment_note($payment_id, $note);
549 549
 
550 550
 			}
551 551
 		}
552 552
 	}
553 553
 }
554 554
 
555
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 );
555
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2);
556 556
 
557 557
 /**
558 558
  * Process PayPal IPN Refunds
@@ -563,28 +563,28 @@  discard block
 block discarded – undo
563 563
  *
564 564
  * @return void
565 565
  */
566
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
566
+function give_process_paypal_refund($data, $payment_id = 0) {
567 567
 
568 568
 	// Collect payment details
569 569
 
570
-	if ( empty( $payment_id ) ) {
570
+	if (empty($payment_id)) {
571 571
 		return;
572 572
 	}
573 573
 
574
-	if ( get_post_status( $payment_id ) == 'refunded' ) {
574
+	if (get_post_status($payment_id) == 'refunded') {
575 575
 		return; // Only refund payments once
576 576
 	}
577 577
 
578
-	$payment_amount = give_get_payment_amount( $payment_id );
578
+	$payment_amount = give_get_payment_amount($payment_id);
579 579
 	$refund_amount  = $data['payment_gross'] * - 1;
580 580
 
581
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
581
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
582 582
 
583 583
 		give_insert_payment_note(
584 584
 			$payment_id,
585 585
 			sprintf(
586 586
 				/* translators: %s: Paypal parent transaction ID */
587
-				esc_html__( 'Partial PayPal refund processed: %s', 'give' ),
587
+				esc_html__('Partial PayPal refund processed: %s', 'give'),
588 588
 				$data['parent_txn_id']
589 589
 			)
590 590
 		);
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		$payment_id,
598 598
 		sprintf(
599 599
 			/* translators: %s: Paypal parent transaction ID */
600
-			esc_html__( 'PayPal Payment #%s Refunded for reason: %s', 'give' ),
600
+			esc_html__('PayPal Payment #%s Refunded for reason: %s', 'give'),
601 601
 			$data['parent_txn_id'], $data['reason_code']
602 602
 		)
603 603
 	);
@@ -605,11 +605,11 @@  discard block
 block discarded – undo
605 605
 		$payment_id,
606 606
 		sprintf(
607 607
 			/* translators: %s: Paypal transaction ID */
608
-			esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ),
608
+			esc_html__('PayPal Refund Transaction ID: %s', 'give'),
609 609
 			$data['txn_id']
610 610
 		)
611 611
 	);
612
-	give_update_payment_status( $payment_id, 'refunded' );
612
+	give_update_payment_status($payment_id, 'refunded');
613 613
 }
614 614
 
615 615
 /**
@@ -621,24 +621,24 @@  discard block
 block discarded – undo
621 621
  *
622 622
  * @return string
623 623
  */
624
-function give_get_paypal_redirect( $ssl_check = false ) {
624
+function give_get_paypal_redirect($ssl_check = false) {
625 625
 
626
-	if ( is_ssl() || ! $ssl_check ) {
626
+	if (is_ssl() || ! $ssl_check) {
627 627
 		$protocal = 'https://';
628 628
 	} else {
629 629
 		$protocal = 'http://';
630 630
 	}
631 631
 
632 632
 	// Check the current payment mode
633
-	if ( give_is_test_mode() ) {
633
+	if (give_is_test_mode()) {
634 634
 		// Test mode
635
-		$paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr';
635
+		$paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr';
636 636
 	} else {
637 637
 		// Live mode
638
-		$paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr';
638
+		$paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr';
639 639
 	}
640 640
 
641
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
641
+	return apply_filters('give_paypal_uri', $paypal_uri);
642 642
 }
643 643
 
644 644
 /**
@@ -648,8 +648,8 @@  discard block
 block discarded – undo
648 648
  * @return string
649 649
  */
650 650
 function give_get_paypal_page_style() {
651
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
652
-	return apply_filters( 'give_paypal_page_style', $page_style );
651
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
652
+	return apply_filters('give_paypal_page_style', $page_style);
653 653
 }
654 654
 
655 655
 /**
@@ -664,27 +664,27 @@  discard block
 block discarded – undo
664 664
  * @return string
665 665
  *
666 666
  */
667
-function give_paypal_success_page_content( $content ) {
667
+function give_paypal_success_page_content($content) {
668 668
 
669
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
669
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
670 670
 		return $content;
671 671
 	}
672 672
 
673
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
673
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
674 674
 
675
-	if ( ! $payment_id ) {
675
+	if ( ! $payment_id) {
676 676
 		$session    = give_get_purchase_session();
677
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
677
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
678 678
 	}
679 679
 
680
-	$payment = get_post( $payment_id );
680
+	$payment = get_post($payment_id);
681 681
 
682
-	if ( $payment && 'pending' == $payment->post_status ) {
682
+	if ($payment && 'pending' == $payment->post_status) {
683 683
 
684 684
 		// Payment is still pending so show processing indicator to fix the Race Condition
685 685
 		ob_start();
686 686
 
687
-		give_get_template_part( 'payment', 'processing' );
687
+		give_get_template_part('payment', 'processing');
688 688
 
689 689
 		$content = ob_get_clean();
690 690
 
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 
695 695
 }
696 696
 
697
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
697
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
698 698
 
699 699
 /**
700 700
  * Given a Payment ID, extract the transaction ID
@@ -705,22 +705,22 @@  discard block
 block discarded – undo
705 705
  *
706 706
  * @return string                   Transaction ID
707 707
  */
708
-function give_paypal_get_payment_transaction_id( $payment_id ) {
708
+function give_paypal_get_payment_transaction_id($payment_id) {
709 709
 
710 710
 	$transaction_id = '';
711
-	$notes          = give_get_payment_notes( $payment_id );
711
+	$notes          = give_get_payment_notes($payment_id);
712 712
 
713
-	foreach ( $notes as $note ) {
714
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
713
+	foreach ($notes as $note) {
714
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
715 715
 			$transaction_id = $match[1];
716 716
 			continue;
717 717
 		}
718 718
 	}
719 719
 
720
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
720
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
721 721
 }
722 722
 
723
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
723
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
724 724
 
725 725
 /**
726 726
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -732,13 +732,13 @@  discard block
 block discarded – undo
732 732
  *
733 733
  * @return string                 A link to the PayPal transaction details
734 734
  */
735
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
735
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
736 736
 
737 737
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
738
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
738
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
739 739
 
740
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
740
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
741 741
 
742 742
 }
743 743
 
744
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
744
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
Please login to merge, or discard this patch.
includes/gateways/manual.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-add_action( 'give_manual_cc_form', '__return_false' );
23
+add_action('give_manual_cc_form', '__return_false');
24 24
 
25 25
 /**
26 26
  * Processes the purchase data and uses the Manual Payment gateway to record
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_manual_payment( $purchase_data ) {
35
+function give_manual_payment($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification has failed', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification has failed', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 	
41 41
 	//Create payment_data array
42 42
 	$payment_data = array(
43 43
 		'price'           => $purchase_data['price'],
44 44
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
45
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
45
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
46 46
 		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
47 47
 		'date'            => $purchase_data['date'],
48 48
 		'user_email'      => $purchase_data['user_email'],
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 		'status'          => 'pending'
53 53
 	);
54 54
 	// Record the pending payment
55
-	$payment = give_insert_payment( $payment_data );
55
+	$payment = give_insert_payment($payment_data);
56 56
 
57
-	if ( $payment ) {
58
-		give_update_payment_status( $payment, 'publish' );
57
+	if ($payment) {
58
+		give_update_payment_status($payment, 'publish');
59 59
 		give_send_to_success_page();
60 60
 	} else {
61 61
 		give_record_gateway_error(
62
-			esc_html__( 'Payment Error', 'give' ),
62
+			esc_html__('Payment Error', 'give'),
63 63
 			sprintf(
64 64
 				/* translators: %s: payment data */
65
-				esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ),
66
-				json_encode( $payment_data )
65
+				esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'),
66
+				json_encode($payment_data)
67 67
 			),
68 68
 			$payment
69 69
 		);
70 70
 		// If errors are present, send the user back to the purchase page so they can be corrected
71
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
71
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
72 72
 	}
73 73
 }
74 74
 
75
-add_action( 'give_gateway_manual', 'give_manual_payment' );
75
+add_action('give_gateway_manual', 'give_manual_payment');
Please login to merge, or discard this patch.
includes/misc-functions.php 2 patches
Spacing   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 function give_is_test_mode() {
25 25
 	global $give_options;
26 26
 
27
-	$ret = ! empty( $give_options['test_mode'] );
27
+	$ret = ! empty($give_options['test_mode']);
28 28
 
29
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
29
+	return (bool) apply_filters('give_is_test_mode', $ret);
30 30
 }
31 31
 
32 32
 /**
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function give_get_currency() {
39 39
 	global $give_options;
40
-	$currency = isset( $give_options['currency'] ) ? $give_options['currency'] : 'USD';
40
+	$currency = isset($give_options['currency']) ? $give_options['currency'] : 'USD';
41 41
 
42
-	return apply_filters( 'give_currency', $currency );
42
+	return apply_filters('give_currency', $currency);
43 43
 }
44 44
 
45 45
 /**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function give_get_currency_position() {
53 53
 	global $give_options;
54
-	$currency_pos = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
54
+	$currency_pos = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
55 55
 
56
-	return apply_filters( 'give_currency_position', $currency_pos );
56
+	return apply_filters('give_currency_position', $currency_pos);
57 57
 }
58 58
 
59 59
 
@@ -66,39 +66,39 @@  discard block
 block discarded – undo
66 66
 
67 67
 function give_get_currencies() {
68 68
 	$currencies = array(
69
-		'USD'  => esc_html__( 'US Dollars ($)', 'give' ),
70
-		'EUR'  => esc_html__( 'Euros (€)', 'give' ),
71
-		'GBP'  => esc_html__( 'Pounds Sterling (£)', 'give' ),
72
-		'AUD'  => esc_html__( 'Australian Dollars ($)', 'give' ),
73
-		'BRL'  => esc_html__( 'Brazilian Real (R$)', 'give' ),
74
-		'CAD'  => esc_html__( 'Canadian Dollars ($)', 'give' ),
75
-		'CZK'  => esc_html__( 'Czech Koruna (Kč)', 'give' ),
76
-		'DKK'  => esc_html__( 'Danish Krone (kr)', 'give' ),
77
-		'HKD'  => esc_html__( 'Hong Kong Dollar ($)', 'give' ),
78
-		'HUF'  => esc_html__( 'Hungarian Forint (Ft)', 'give' ),
79
-		'ILS'  => esc_html__( 'Israeli Shekel (₪)', 'give' ),
80
-		'JPY'  => esc_html__( 'Japanese Yen (¥)', 'give' ),
81
-		'MYR'  => esc_html__( 'Malaysian Ringgits (RM)', 'give' ),
82
-		'MXN'  => esc_html__( 'Mexican Peso ($)', 'give' ),
83
-		'MAD'  => esc_html__( 'Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give' ),
84
-		'NZD'  => esc_html__( 'New Zealand Dollar ($)', 'give' ),
85
-		'NOK'  => esc_html__( 'Norwegian Krone (Kr.)', 'give' ),
86
-		'PHP'  => esc_html__( 'Philippine Pesos (₱)', 'give' ),
87
-		'PLN'  => esc_html__( 'Polish Zloty (zł)', 'give' ),
88
-		'SGD'  => esc_html__( 'Singapore Dollar ($)', 'give' ),
89
-		'KRW'  => esc_html__( 'South Korean Won (₩)', 'give' ),
90
-		'ZAR'  => esc_html__( 'South African Rand (R)', 'give' ),
91
-		'SEK'  => esc_html__( 'Swedish Krona (kr)', 'give' ),
92
-		'CHF'  => esc_html__( 'Swiss Franc (CHF)', 'give' ),
93
-		'TWD'  => esc_html__( 'Taiwan New Dollars (NT$)', 'give' ),
94
-		'THB'  => esc_html__( 'Thai Baht (฿)', 'give' ),
95
-		'INR'  => esc_html__( 'Indian Rupee (₹)', 'give' ),
96
-		'TRY'  => esc_html__( 'Turkish Lira (₺)', 'give' ),
97
-		'RIAL' => esc_html__( 'Iranian Rial (﷼)', 'give' ),
98
-		'RUB'  => esc_html__( 'Russian Rubles (руб)', 'give' )
69
+		'USD'  => esc_html__('US Dollars ($)', 'give'),
70
+		'EUR'  => esc_html__('Euros (€)', 'give'),
71
+		'GBP'  => esc_html__('Pounds Sterling (£)', 'give'),
72
+		'AUD'  => esc_html__('Australian Dollars ($)', 'give'),
73
+		'BRL'  => esc_html__('Brazilian Real (R$)', 'give'),
74
+		'CAD'  => esc_html__('Canadian Dollars ($)', 'give'),
75
+		'CZK'  => esc_html__('Czech Koruna (Kč)', 'give'),
76
+		'DKK'  => esc_html__('Danish Krone (kr)', 'give'),
77
+		'HKD'  => esc_html__('Hong Kong Dollar ($)', 'give'),
78
+		'HUF'  => esc_html__('Hungarian Forint (Ft)', 'give'),
79
+		'ILS'  => esc_html__('Israeli Shekel (₪)', 'give'),
80
+		'JPY'  => esc_html__('Japanese Yen (¥)', 'give'),
81
+		'MYR'  => esc_html__('Malaysian Ringgits (RM)', 'give'),
82
+		'MXN'  => esc_html__('Mexican Peso ($)', 'give'),
83
+		'MAD'  => esc_html__('Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give'),
84
+		'NZD'  => esc_html__('New Zealand Dollar ($)', 'give'),
85
+		'NOK'  => esc_html__('Norwegian Krone (Kr.)', 'give'),
86
+		'PHP'  => esc_html__('Philippine Pesos (₱)', 'give'),
87
+		'PLN'  => esc_html__('Polish Zloty (zł)', 'give'),
88
+		'SGD'  => esc_html__('Singapore Dollar ($)', 'give'),
89
+		'KRW'  => esc_html__('South Korean Won (₩)', 'give'),
90
+		'ZAR'  => esc_html__('South African Rand (R)', 'give'),
91
+		'SEK'  => esc_html__('Swedish Krona (kr)', 'give'),
92
+		'CHF'  => esc_html__('Swiss Franc (CHF)', 'give'),
93
+		'TWD'  => esc_html__('Taiwan New Dollars (NT$)', 'give'),
94
+		'THB'  => esc_html__('Thai Baht (฿)', 'give'),
95
+		'INR'  => esc_html__('Indian Rupee (₹)', 'give'),
96
+		'TRY'  => esc_html__('Turkish Lira (₺)', 'give'),
97
+		'RIAL' => esc_html__('Iranian Rial (﷼)', 'give'),
98
+		'RUB'  => esc_html__('Russian Rubles (руб)', 'give')
99 99
 	);
100 100
 
101
-	return apply_filters( 'give_currencies', $currencies );
101
+	return apply_filters('give_currencies', $currencies);
102 102
 }
103 103
 
104 104
 
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string           The symbol to use for the currency
115 115
  */
116
-function give_currency_symbol( $currency = '' ) {
116
+function give_currency_symbol($currency = '') {
117 117
 
118
-	if ( empty( $currency ) ) {
118
+	if (empty($currency)) {
119 119
 		$currency = give_get_currency();
120 120
 	}
121
-	switch ( $currency ) :
121
+	switch ($currency) :
122 122
 		case 'GBP' :
123 123
 			$symbol = '£';
124 124
 			break;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	endswitch;
198 198
 
199 199
 
200
-	return apply_filters( 'give_currency_symbol', $symbol, $currency );
200
+	return apply_filters('give_currency_symbol', $symbol, $currency);
201 201
 }
202 202
 
203 203
 
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function give_get_current_page_url() {
211 211
 
212
-	if ( is_front_page() ) {
213
-		$current_url = home_url( '/' );
212
+	if (is_front_page()) {
213
+		$current_url = home_url('/');
214 214
 	} else {
215
-		$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . untrailingslashit( $_SERVER['REQUEST_URI'] ) );
215
+		$current_url = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].untrailingslashit($_SERVER['REQUEST_URI']));
216 216
 	}
217 217
 
218
-	return apply_filters( 'give_get_current_page_url', esc_url( $current_url ) );
218
+	return apply_filters('give_get_current_page_url', esc_url($current_url));
219 219
 }
220 220
 
221 221
 
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	$gateways = give_get_enabled_payment_gateways();
238 238
 
239
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
239
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
240 240
 		$ret = true;
241
-	} else if ( count( $gateways ) == 1 ) {
241
+	} else if (count($gateways) == 1) {
242 242
 		$ret = false;
243
-	} else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
243
+	} else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
244 244
 		$ret = false;
245 245
 	}
246 246
 
247
-	return (bool) apply_filters( 'give_verify_credit_cards', $ret );
247
+	return (bool) apply_filters('give_verify_credit_cards', $ret);
248 248
 }
249 249
 
250 250
 /**
@@ -256,26 +256,26 @@  discard block
 block discarded – undo
256 256
 function give_get_timezone_id() {
257 257
 
258 258
 	// if site timezone string exists, return it
259
-	if ( $timezone = get_option( 'timezone_string' ) ) {
259
+	if ($timezone = get_option('timezone_string')) {
260 260
 		return $timezone;
261 261
 	}
262 262
 
263 263
 	// get UTC offset, if it isn't set return UTC
264
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
264
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
265 265
 		return 'UTC';
266 266
 	}
267 267
 
268 268
 	// attempt to guess the timezone string from the UTC offset
269
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
269
+	$timezone = timezone_name_from_abbr('', $utc_offset);
270 270
 
271 271
 	// last try, guess timezone string manually
272
-	if ( $timezone === false ) {
272
+	if ($timezone === false) {
273 273
 
274
-		$is_dst = date( 'I' );
274
+		$is_dst = date('I');
275 275
 
276
-		foreach ( timezone_abbreviations_list() as $abbr ) {
277
-			foreach ( $abbr as $city ) {
278
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
276
+		foreach (timezone_abbreviations_list() as $abbr) {
277
+			foreach ($abbr as $city) {
278
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
279 279
 					return $city['timezone_id'];
280 280
 				}
281 281
 			}
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
 
300 300
 	$ip = '127.0.0.1';
301 301
 
302
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
302
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
303 303
 		//check ip from share internet
304 304
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
305
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
305
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
306 306
 		//to check ip is pass from proxy
307 307
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
308
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
308
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
309 309
 		$ip = $_SERVER['REMOTE_ADDR'];
310 310
 	}
311 311
 
312
-	return apply_filters( 'give_get_ip', $ip );
312
+	return apply_filters('give_get_ip', $ip);
313 313
 }
314 314
 
315 315
 
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
  *
325 325
  * @uses  Give()->session->set()
326 326
  */
327
-function give_set_purchase_session( $purchase_data = array() ) {
328
-	Give()->session->set( 'give_purchase', $purchase_data );
329
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
327
+function give_set_purchase_session($purchase_data = array()) {
328
+	Give()->session->set('give_purchase', $purchase_data);
329
+	Give()->session->set('give_email', $purchase_data['user_email']);
330 330
 }
331 331
 
332 332
 /**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
  * @return mixed array | false
341 341
  */
342 342
 function give_get_purchase_session() {
343
-	return Give()->session->get( 'give_purchase' );
343
+	return Give()->session->get('give_purchase');
344 344
 }
345 345
 
346 346
 /**
@@ -355,14 +355,14 @@  discard block
 block discarded – undo
355 355
  *
356 356
  * @return string
357 357
  */
358
-function give_get_purchase_summary( $purchase_data, $email = true ) {
358
+function give_get_purchase_summary($purchase_data, $email = true) {
359 359
 	$summary = '';
360 360
 
361
-	if ( $email ) {
362
-		$summary .= $purchase_data['user_email'] . ' - ';
361
+	if ($email) {
362
+		$summary .= $purchase_data['user_email'].' - ';
363 363
 	}
364 364
 
365
-	$summary .= get_the_title( $purchase_data['post_data']['give-form-id'] );
365
+	$summary .= get_the_title($purchase_data['post_data']['give-form-id']);
366 366
 
367 367
 	return $summary;
368 368
 }
@@ -379,31 +379,31 @@  discard block
 block discarded – undo
379 379
 function give_get_host() {
380 380
 	$host = false;
381 381
 
382
-	if ( defined( 'WPE_APIKEY' ) ) {
382
+	if (defined('WPE_APIKEY')) {
383 383
 		$host = 'WP Engine';
384
-	} elseif ( defined( 'PAGELYBIN' ) ) {
384
+	} elseif (defined('PAGELYBIN')) {
385 385
 		$host = 'Pagely';
386
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
386
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
387 387
 		$host = 'ICDSoft';
388
-	} elseif ( DB_HOST == 'mysqlv5' ) {
388
+	} elseif (DB_HOST == 'mysqlv5') {
389 389
 		$host = 'NetworkSolutions';
390
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
390
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
391 391
 		$host = 'iPage';
392
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
392
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
393 393
 		$host = 'IPower';
394
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
394
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
395 395
 		$host = 'MediaTemple Grid';
396
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
396
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
397 397
 		$host = 'pair Networks';
398
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
398
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
399 399
 		$host = 'Rackspace Cloud';
400
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
400
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
401 401
 		$host = 'SysFix.eu Power Hosting';
402
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
402
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
403 403
 		$host = 'Flywheel';
404 404
 	} else {
405 405
 		// Adding a general fallback for data gathering
406
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
406
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
407 407
 	}
408 408
 
409 409
 	return $host;
@@ -419,67 +419,67 @@  discard block
 block discarded – undo
419 419
  *
420 420
  * @return bool true if host matches, false if not
421 421
  */
422
-function give_is_host( $host = false ) {
422
+function give_is_host($host = false) {
423 423
 
424 424
 	$return = false;
425 425
 
426
-	if ( $host ) {
427
-		$host = str_replace( ' ', '', strtolower( $host ) );
426
+	if ($host) {
427
+		$host = str_replace(' ', '', strtolower($host));
428 428
 
429
-		switch ( $host ) {
429
+		switch ($host) {
430 430
 			case 'wpengine':
431
-				if ( defined( 'WPE_APIKEY' ) ) {
431
+				if (defined('WPE_APIKEY')) {
432 432
 					$return = true;
433 433
 				}
434 434
 				break;
435 435
 			case 'pagely':
436
-				if ( defined( 'PAGELYBIN' ) ) {
436
+				if (defined('PAGELYBIN')) {
437 437
 					$return = true;
438 438
 				}
439 439
 				break;
440 440
 			case 'icdsoft':
441
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
441
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
442 442
 					$return = true;
443 443
 				}
444 444
 				break;
445 445
 			case 'networksolutions':
446
-				if ( DB_HOST == 'mysqlv5' ) {
446
+				if (DB_HOST == 'mysqlv5') {
447 447
 					$return = true;
448 448
 				}
449 449
 				break;
450 450
 			case 'ipage':
451
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
451
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
452 452
 					$return = true;
453 453
 				}
454 454
 				break;
455 455
 			case 'ipower':
456
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
456
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
457 457
 					$return = true;
458 458
 				}
459 459
 				break;
460 460
 			case 'mediatemplegrid':
461
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
461
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
462 462
 					$return = true;
463 463
 				}
464 464
 				break;
465 465
 			case 'pairnetworks':
466
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
466
+				if (strpos(DB_HOST, '.pair.com') !== false) {
467 467
 					$return = true;
468 468
 				}
469 469
 				break;
470 470
 			case 'rackspacecloud':
471
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
471
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
472 472
 					$return = true;
473 473
 				}
474 474
 				break;
475 475
 			case 'sysfix.eu':
476 476
 			case 'sysfix.eupowerhosting':
477
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
477
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
478 478
 					$return = true;
479 479
 				}
480 480
 				break;
481 481
 			case 'flywheel':
482
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
482
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
483 483
 					$return = true;
484 484
 				}
485 485
 				break;
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
  * @param string $replacement Optional. The function that should have been called
513 513
  * @param array $backtrace Optional. Contains stack backtrace of deprecated function
514 514
  */
515
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
516
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
515
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
516
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
517 517
 
518
-	$show_errors = current_user_can( 'manage_options' );
518
+	$show_errors = current_user_can('manage_options');
519 519
 
520 520
 	// Allow plugin to filter the output error trigger
521
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
522
-		if ( ! is_null( $replacement ) ) {
523
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
524
-			trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
521
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
522
+		if ( ! is_null($replacement)) {
523
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
524
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
525 525
 			// Alternatively we could dump this to a file.
526 526
 		} else {
527
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
528
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
527
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
528
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
529 529
 			// Alternatively we could dump this to a file.
530 530
 		}
531 531
 	}
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
  * @return string $post_id
540 540
  */
541 541
 function give_get_admin_post_id() {
542
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
543
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
542
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
543
+	if ( ! $post_id && isset($_POST['post_id'])) {
544 544
 		$post_id = $_POST['post_id'];
545 545
 	}
546 546
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
  * @return string Arg separator output
555 555
  */
556 556
 function give_get_php_arg_separator_output() {
557
-	return ini_get( 'arg_separator.output' );
557
+	return ini_get('arg_separator.output');
558 558
 }
559 559
 
560 560
 
@@ -569,10 +569,10 @@  discard block
 block discarded – undo
569 569
  *
570 570
  * @return string Short month name
571 571
  */
572
-function give_month_num_to_name( $n ) {
573
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
572
+function give_month_num_to_name($n) {
573
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
574 574
 
575
-	return date_i18n( "M", $timestamp );
575
+	return date_i18n("M", $timestamp);
576 576
 }
577 577
 
578 578
 
@@ -585,10 +585,10 @@  discard block
 block discarded – undo
585 585
  *
586 586
  * @return bool Whether or not function is disabled.
587 587
  */
588
-function give_is_func_disabled( $function ) {
589
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
588
+function give_is_func_disabled($function) {
589
+	$disabled = explode(',', ini_get('disable_functions'));
590 590
 
591
-	return in_array( $function, $disabled );
591
+	return in_array($function, $disabled);
592 592
 }
593 593
 
594 594
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 
604 604
 		<form action="//givewp.us3.list-manage.com/subscribe/post?u=3ccb75d68bda4381e2f45794c&amp;id=12a081aa13" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
605 605
 			<div class="give-newsletter-confirmation">
606
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
606
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
607 607
 			</div>
608 608
 
609 609
 			<table class="form-table give-newsletter-form">
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
  *
700 700
  * @return mixed
701 701
  */
702
-function give_svg_icons( $icon ) {
702
+function give_svg_icons($icon) {
703 703
 
704 704
 	// Store your SVGs in an associative array
705 705
 	$svgs = array(
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	);
712 712
 
713 713
 	// Return the chosen icon's SVG string
714
-	return $svgs[ $icon ];
714
+	return $svgs[$icon];
715 715
 }
716 716
 
717 717
 /**
@@ -723,15 +723,15 @@  discard block
 block discarded – undo
723 723
  *
724 724
  * @return mixed
725 725
  */
726
-function modify_nav_menu_meta_box_object( $post_type ) {
727
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
726
+function modify_nav_menu_meta_box_object($post_type) {
727
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
728 728
 		$post_type->labels->name = 'Donation Forms';
729 729
 	}
730 730
 
731 731
 	return $post_type;
732 732
 }
733 733
 
734
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
734
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
735 735
 
736 736
 
737 737
 /**
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
  * @license    http://opensource.org/licenses/MIT MIT
745 745
  */
746 746
 
747
-if ( ! function_exists( 'array_column' ) ) {
747
+if ( ! function_exists('array_column')) {
748 748
 	/**
749 749
 	 * Returns the values from a single column of the input array, identified by
750 750
 	 * the $columnKey.
@@ -763,56 +763,56 @@  discard block
 block discarded – undo
763 763
 	 *
764 764
 	 * @return array
765 765
 	 */
766
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
766
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
767 767
 		// Using func_get_args() in order to check for proper number of
768 768
 		// parameters and trigger errors exactly as the built-in array_column()
769 769
 		// does in PHP 5.5.
770 770
 		$argc   = func_num_args();
771 771
 		$params = func_get_args();
772 772
 
773
-		if ( $argc < 2 ) {
774
-			trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING );
773
+		if ($argc < 2) {
774
+			trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING);
775 775
 
776 776
 			return null;
777 777
 		}
778 778
 
779
-		if ( ! is_array( $params[0] ) ) {
779
+		if ( ! is_array($params[0])) {
780 780
 			trigger_error(
781
-				'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given',
781
+				'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given',
782 782
 				E_USER_WARNING
783 783
 			);
784 784
 
785 785
 			return null;
786 786
 		}
787 787
 
788
-		if ( ! is_int( $params[1] )
789
-		     && ! is_float( $params[1] )
790
-		     && ! is_string( $params[1] )
788
+		if ( ! is_int($params[1])
789
+		     && ! is_float($params[1])
790
+		     && ! is_string($params[1])
791 791
 		     && $params[1] !== null
792
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
792
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
793 793
 		) {
794
-			trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING );
794
+			trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING);
795 795
 
796 796
 			return false;
797 797
 		}
798 798
 
799
-		if ( isset( $params[2] )
800
-		     && ! is_int( $params[2] )
801
-		     && ! is_float( $params[2] )
802
-		     && ! is_string( $params[2] )
803
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
799
+		if (isset($params[2])
800
+		     && ! is_int($params[2])
801
+		     && ! is_float($params[2])
802
+		     && ! is_string($params[2])
803
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
804 804
 		) {
805
-			trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING );
805
+			trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING);
806 806
 
807 807
 			return false;
808 808
 		}
809 809
 
810 810
 		$paramsInput     = $params[0];
811
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
811
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
812 812
 
813 813
 		$paramsIndexKey = null;
814
-		if ( isset( $params[2] ) ) {
815
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
814
+		if (isset($params[2])) {
815
+			if (is_float($params[2]) || is_int($params[2])) {
816 816
 				$paramsIndexKey = (int) $params[2];
817 817
 			} else {
818 818
 				$paramsIndexKey = (string) $params[2];
@@ -821,26 +821,26 @@  discard block
 block discarded – undo
821 821
 
822 822
 		$resultArray = array();
823 823
 
824
-		foreach ( $paramsInput as $row ) {
824
+		foreach ($paramsInput as $row) {
825 825
 			$key    = $value = null;
826 826
 			$keySet = $valueSet = false;
827 827
 
828
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
828
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
829 829
 				$keySet = true;
830
-				$key    = (string) $row[ $paramsIndexKey ];
830
+				$key    = (string) $row[$paramsIndexKey];
831 831
 			}
832 832
 
833
-			if ( $paramsColumnKey === null ) {
833
+			if ($paramsColumnKey === null) {
834 834
 				$valueSet = true;
835 835
 				$value    = $row;
836
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
836
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
837 837
 				$valueSet = true;
838
-				$value    = $row[ $paramsColumnKey ];
838
+				$value    = $row[$paramsColumnKey];
839 839
 			}
840 840
 
841
-			if ( $valueSet ) {
842
-				if ( $keySet ) {
843
-					$resultArray[ $key ] = $value;
841
+			if ($valueSet) {
842
+				if ($keySet) {
843
+					$resultArray[$key] = $value;
844 844
 				} else {
845 845
 					$resultArray[] = $value;
846 846
 				}
@@ -862,40 +862,40 @@  discard block
 block discarded – undo
862 862
  *
863 863
  * @return bool Whether the receipt is visible or not.
864 864
  */
865
-function give_can_view_receipt( $payment_key = '' ) {
865
+function give_can_view_receipt($payment_key = '') {
866 866
 
867 867
 	$return = false;
868 868
 
869
-	if ( empty( $payment_key ) ) {
869
+	if (empty($payment_key)) {
870 870
 		return $return;
871 871
 	}
872 872
 
873 873
 	global $give_receipt_args;
874 874
 
875
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
875
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
876 876
 
877
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
877
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
878 878
 
879
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
879
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
880 880
 
881
-	if ( is_user_logged_in() ) {
882
-		if ( $user_id === (int) get_current_user_id() ) {
881
+	if (is_user_logged_in()) {
882
+		if ($user_id === (int) get_current_user_id()) {
883 883
 			$return = true;
884
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
884
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
885 885
 			$return = true;
886
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
886
+		} elseif (current_user_can('view_give_sensitive_data')) {
887 887
 			$return = true;
888 888
 		}
889 889
 	}
890 890
 
891 891
 	$session = give_get_purchase_session();
892
-	if ( ! empty( $session ) && ! is_user_logged_in() ) {
893
-		if ( $session['purchase_key'] === $payment_meta['key'] ) {
892
+	if ( ! empty($session) && ! is_user_logged_in()) {
893
+		if ($session['purchase_key'] === $payment_meta['key']) {
894 894
 			$return = true;
895 895
 		}
896 896
 	}
897 897
 
898
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
898
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
899 899
 
900 900
 }
901 901
 
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
  *
905 905
  * @description: Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
906 906
  */
907
-if ( ! function_exists( 'cal_days_in_month' ) ) {
907
+if ( ! function_exists('cal_days_in_month')) {
908 908
 	/**
909 909
 	 * cal_days_in_month
910 910
 	 *
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 	 *
915 915
 	 * @return bool|string
916 916
 	 */
917
-	function cal_days_in_month( $calendar, $month, $year ) {
918
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
917
+	function cal_days_in_month($calendar, $month, $year) {
918
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
919 919
 	}
920 920
 }
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
  *
338 338
  * @since 1.0
339 339
  * @uses  Give()->session->get()
340
- * @return mixed array | false
340
+ * @return string array | false
341 341
  */
342 342
 function give_get_purchase_session() {
343 343
 	return Give()->session->get( 'give_purchase' );
@@ -695,9 +695,9 @@  discard block
 block discarded – undo
695 695
 /**
696 696
  * Create SVG library function
697 697
  *
698
- * @param $icon
698
+ * @param string $icon
699 699
  *
700
- * @return mixed
700
+ * @return string
701 701
  */
702 702
 function give_svg_icons( $icon ) {
703 703
 
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 	 *
755 755
 	 * @param array $input A multi-dimensional array (record set) from which to pull
756 756
 	 *                         a column of values.
757
-	 * @param mixed $columnKey The column of values to return. This value may be the
757
+	 * @param string $columnKey The column of values to return. This value may be the
758 758
 	 *                         integer key of the column you wish to retrieve, or it
759 759
 	 *                         may be the string key name for an associative array.
760 760
 	 * @param mixed $indexKey (Optional.) The column to use as the index/keys for
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 	/**
909 909
 	 * cal_days_in_month
910 910
 	 *
911
-	 * @param $calendar
911
+	 * @param integer $calendar
912 912
 	 * @param $month
913 913
 	 * @param $year
914 914
 	 *
Please login to merge, or discard this patch.
includes/admin/shortcodes/class-shortcode-button.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @since       1.3.0
12 12
  */
13 13
 
14
-defined( 'ABSPATH' ) or exit;
14
+defined('ABSPATH') or exit;
15 15
 
16 16
 /**
17 17
  * Class Give_Shortcode_Button
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public function __construct() {
32 32
 
33
-		if ( is_admin() ) {
34
-			add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 );
33
+		if (is_admin()) {
34
+			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15);
35 35
 
36
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
37
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 );
38
-			add_action( 'media_buttons', array( $this, 'shortcode_button' ) );
36
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets'));
37
+			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13);
38
+			add_action('media_buttons', array($this, 'shortcode_button'));
39 39
 		}
40 40
 
41
-		add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) );
42
-		add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) );
41
+		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax'));
42
+		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax'));
43 43
 	}
44 44
 
45 45
 	/**
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @since 1.0
53 53
 	 */
54
-	public function mce_external_plugins( $plugin_array ) {
54
+	public function mce_external_plugins($plugin_array) {
55 55
 
56
-		if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) {
56
+		if (current_user_can('edit_posts') && current_user_can('edit_pages')) {
57 57
 
58
-			$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
58
+			$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
59 59
 
60
-			$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js';
60
+			$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js';
61 61
 		}
62 62
 
63 63
 		return $plugin_array;
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function admin_enqueue_assets() {
74 74
 
75
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
75
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
76 76
 
77 77
 		wp_enqueue_script(
78 78
 			'give_shortcode',
79
-			GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js',
80
-			array( 'jquery' ),
79
+			GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js',
80
+			array('jquery'),
81 81
 			GIVE_VERSION,
82 82
 			true
83 83
 		);
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function admin_localize_scripts() {
94 94
 
95
-		if ( ! empty( self::$shortcodes ) ) {
95
+		if ( ! empty(self::$shortcodes)) {
96 96
 
97 97
 			$variables = array();
98 98
 
99
-			foreach ( self::$shortcodes as $shortcode => $values ) {
100
-				if ( ! empty( $values['required'] ) ) {
101
-					$variables[ $shortcode ] = $values['required'];
99
+			foreach (self::$shortcodes as $shortcode => $values) {
100
+				if ( ! empty($values['required'])) {
101
+					$variables[$shortcode] = $values['required'];
102 102
 				}
103 103
 			}
104 104
 
105
-			wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );
105
+			wp_localize_script('give_shortcode', 'scShortcodes', $variables);
106 106
 		}
107 107
 	}
108 108
 
@@ -117,24 +117,24 @@  discard block
 block discarded – undo
117 117
 
118 118
 		global $pagenow, $wp_version;
119 119
 
120
-		$shortcode_button_pages = array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' );
120
+		$shortcode_button_pages = array('post.php', 'page.php', 'post-new.php', 'post-edit.php');
121 121
 		// Only run in admin post/page creation and edit screens
122
-		if ( in_array( $pagenow, $shortcode_button_pages )
123
-		     && apply_filters( 'give_shortcode_button_condition', true )
124
-		     && ! empty( self::$shortcodes )
122
+		if (in_array($pagenow, $shortcode_button_pages)
123
+		     && apply_filters('give_shortcode_button_condition', true)
124
+		     && ! empty(self::$shortcodes)
125 125
 		) {
126 126
 
127 127
 			$shortcodes = array();
128 128
 
129
-			foreach ( self::$shortcodes as $shortcode => $values ) {
129
+			foreach (self::$shortcodes as $shortcode => $values) {
130 130
 				/**
131 131
 				 * Filters the condition for including the current shortcode
132 132
 				 *
133 133
 				 * @since 1.0
134 134
 				 */
135
-				if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) {
135
+				if (apply_filters(sanitize_title($shortcode).'_condition', true)) {
136 136
 
137
-					$shortcodes[ $shortcode ] = sprintf(
137
+					$shortcodes[$shortcode] = sprintf(
138 138
 						'<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>',
139 139
 						$shortcode,
140 140
 						$values['label'],
@@ -143,37 +143,37 @@  discard block
 block discarded – undo
143 143
 				}
144 144
 			}
145 145
 
146
-			if ( ! empty( $shortcodes ) ) {
146
+			if ( ! empty($shortcodes)) {
147 147
 
148 148
 				// check current WP version
149
-				$img = ( version_compare( $wp_version, '3.5', '<' ) )
150
-					? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />'
151
-					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>';
149
+				$img = (version_compare($wp_version, '3.5', '<'))
150
+					? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />'
151
+					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>';
152 152
 
153
-				reset( $shortcodes );
153
+				reset($shortcodes);
154 154
 
155
-				if ( count( $shortcodes ) == 1 ) {
155
+				if (count($shortcodes) == 1) {
156 156
 
157
-					$shortcode = key( $shortcodes );
157
+					$shortcode = key($shortcodes);
158 158
 
159 159
 					printf(
160 160
 						'<button class="button sc-shortcode" data-shortcode="%s">%s</button>',
161 161
 						$shortcode,
162
-						sprintf( '%s %s %s',
162
+						sprintf('%s %s %s',
163 163
 							$img,
164
-							esc_html__( 'Insert', 'give' ),
165
-							self::$shortcodes[ $shortcode ]['label']
164
+							esc_html__('Insert', 'give'),
165
+							self::$shortcodes[$shortcode]['label']
166 166
 						)
167 167
 					);
168 168
 				} else {
169 169
 					printf(
170
-						'<div class="sc-wrap">' .
171
-						'<button class="button sc-button">%s %s</button>' .
172
-						'<div class="sc-menu mce-menu">%s</div>' .
170
+						'<div class="sc-wrap">'.
171
+						'<button class="button sc-button">%s %s</button>'.
172
+						'<div class="sc-menu mce-menu">%s</div>'.
173 173
 						'</div>',
174 174
 						$img,
175
-						esc_html__( 'Give Shortcodes', 'give' ),
176
-						implode( '', array_values( $shortcodes ) )
175
+						esc_html__('Give Shortcodes', 'give'),
176
+						implode('', array_values($shortcodes))
177 177
 					);
178 178
 				}
179 179
 			}
@@ -189,15 +189,15 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function shortcode_ajax() {
191 191
 
192
-		$shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;
192
+		$shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;
193 193
 		$response  = false;
194 194
 
195
-		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) {
195
+		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) {
196 196
 
197
-			$data = self::$shortcodes[ $shortcode ];
197
+			$data = self::$shortcodes[$shortcode];
198 198
 
199
-			if ( ! empty( $data['errors'] ) ) {
200
-				$data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) );
199
+			if ( ! empty($data['errors'])) {
200
+				$data['btn_okay'] = array(esc_html__('Okay', 'give'));
201 201
 			}
202 202
 
203 203
 			$response = array(
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 			);
210 210
 		} else {
211 211
 			// todo: handle error
212
-			error_log( print_r( 'AJAX error!', 1 ) );
212
+			error_log(print_r('AJAX error!', 1));
213 213
 		}
214 214
 
215
-		wp_send_json( $response );
215
+		wp_send_json($response);
216 216
 	}
217 217
 }
218 218
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-profile-editor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Profile_Editor extends Give_Shortcode_Generator {
15 15
 
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' );
21
+		$this->shortcode['label'] = esc_html__('Profile Editor', 'give');
22 22
 
23
-		parent::__construct( 'give_profile_editor' );
23
+		parent::__construct('give_profile_editor');
24 24
 	}
25 25
 }
26 26
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-receipt.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' );
22
-		$this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' );
21
+		$this->shortcode['title'] = esc_html__('Donation Receipt', 'give');
22
+		$this->shortcode['label'] = esc_html__('Donation Receipt', 'give');
23 23
 
24
-		parent::__construct( 'give_receipt' );
24
+		parent::__construct('give_receipt');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,60 +34,60 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
37
+				'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'    => 'listbox',
41 41
 				'name'    => 'price',
42
-				'label'   => esc_html__( 'Show Donation Amount:', 'give' ),
42
+				'label'   => esc_html__('Show Donation Amount:', 'give'),
43 43
 				'options' => array(
44
-					'true'  => esc_html__( 'Show', 'give' ),
45
-					'false' => esc_html__( 'Hide', 'give' ),
44
+					'true'  => esc_html__('Show', 'give'),
45
+					'false' => esc_html__('Hide', 'give'),
46 46
 				),
47 47
 			),
48 48
 			array(
49 49
 				'type'    => 'listbox',
50 50
 				'name'    => 'donor',
51
-				'label'   => esc_html__( 'Show Donor Name:', 'give' ),
51
+				'label'   => esc_html__('Show Donor Name:', 'give'),
52 52
 				'options' => array(
53
-					'true'  => esc_html__( 'Show', 'give' ),
54
-					'false' => esc_html__( 'Hide', 'give' ),
53
+					'true'  => esc_html__('Show', 'give'),
54
+					'false' => esc_html__('Hide', 'give'),
55 55
 				),
56 56
 			),
57 57
 			array(
58 58
 				'type'    => 'listbox',
59 59
 				'name'    => 'date',
60
-				'label'   => esc_html__( 'Show Date:', 'give' ),
60
+				'label'   => esc_html__('Show Date:', 'give'),
61 61
 				'options' => array(
62
-					'true'  => esc_html__( 'Show', 'give' ),
63
-					'false' => esc_html__( 'Hide', 'give' ),
62
+					'true'  => esc_html__('Show', 'give'),
63
+					'false' => esc_html__('Hide', 'give'),
64 64
 				),
65 65
 			),
66 66
 			array(
67 67
 				'type'    => 'listbox',
68 68
 				'name'    => 'payment_key',
69
-				'label'   => esc_html__( 'Show Payment Key:', 'give' ),
69
+				'label'   => esc_html__('Show Payment Key:', 'give'),
70 70
 				'options' => array(
71
-					'true'  => esc_html__( 'Show', 'give' ),
72
-					'false' => esc_html__( 'Hide', 'give' ),
71
+					'true'  => esc_html__('Show', 'give'),
72
+					'false' => esc_html__('Hide', 'give'),
73 73
 				),
74 74
 			),
75 75
 			array(
76 76
 				'type'    => 'listbox',
77 77
 				'name'    => 'payment_method',
78
-				'label'   => esc_html__( 'Show Payment Method:', 'give' ),
78
+				'label'   => esc_html__('Show Payment Method:', 'give'),
79 79
 				'options' => array(
80
-					'true'  => esc_html__( 'Show', 'give' ),
81
-					'false' => esc_html__( 'Hide', 'give' ),
80
+					'true'  => esc_html__('Show', 'give'),
81
+					'false' => esc_html__('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 			array(
85 85
 				'type'    => 'listbox',
86 86
 				'name'    => 'payment_id',
87
-				'label'   => esc_html__( 'Show Payment ID:', 'give' ),
87
+				'label'   => esc_html__('Show Payment ID:', 'give'),
88 88
 				'options' => array(
89
-					'true'  => esc_html__( 'Show', 'give' ),
90
-					'false' => esc_html__( 'Hide', 'give' ),
89
+					'true'  => esc_html__('Show', 'give'),
90
+					'false' => esc_html__('Hide', 'give'),
91 91
 				),
92 92
 			),
93 93
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-history.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Donation_History extends Give_Shortcode_Generator {
15 15
 
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['label'] = esc_html__( 'Donation History', 'give' );
21
+		$this->shortcode['label'] = esc_html__('Donation History', 'give');
22 22
 
23
-		parent::__construct( 'donation_history' );
23
+		parent::__construct('donation_history');
24 24
 	}
25 25
 }
26 26
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-register.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Register extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = esc_html__( 'Register', 'give' );
22
-		$this->shortcode['label'] = esc_html__( 'Register', 'give' );
21
+		$this->shortcode['title'] = esc_html__('Register', 'give');
22
+		$this->shortcode['label'] = esc_html__('Register', 'give');
23 23
 
24
-		parent::__construct( 'give_register' );
24
+		parent::__construct('give_register');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ),
37
+				'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'     => 'textbox',
41 41
 				'name'     => 'redirect',
42 42
 				'minWidth' => 320,
43
-				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ),
43
+				'tooltip'  => esc_attr__('Enter an URL here to redirect to after registering.', 'give'),
44 44
 			),
45 45
 		);
46 46
 	}
Please login to merge, or discard this patch.