Test Failed
Pull Request — master (#1978)
by Devin
04:26
created
includes/admin/admin-actions.php 1 patch
Spacing   +107 added lines, -108 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,19 +20,19 @@  discard block
 block discarded – undo
20 20
  * @since 1.8
21 21
  */
22 22
 function give_load_wp_editor() {
23
-	if ( ! isset( $_POST['wp_editor'] ) ) {
23
+	if ( ! isset($_POST['wp_editor'])) {
24 24
 		die();
25 25
 	}
26 26
 
27
-	$wp_editor                     = json_decode( base64_decode( $_POST['wp_editor'] ), true );
27
+	$wp_editor                     = json_decode(base64_decode($_POST['wp_editor']), true);
28 28
 	$wp_editor[2]['textarea_name'] = $_POST['textarea_name'];
29 29
 
30
-	wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] );
30
+	wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]);
31 31
 
32 32
 	die();
33 33
 }
34 34
 
35
-add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' );
35
+add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor');
36 36
 
37 37
 
38 38
 /**
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	);
53 53
 
54 54
 	// Get current page.
55
-	$current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : '';
55
+	$current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : '';
56 56
 
57 57
 	// Bailout.
58 58
 	if (
59
-		empty( $current_page )
60
-		|| empty( $_GET['_wp_http_referer'] )
61
-		|| ! in_array( $current_page, $give_pages )
59
+		empty($current_page)
60
+		|| empty($_GET['_wp_http_referer'])
61
+		|| ! in_array($current_page, $give_pages)
62 62
 	) {
63 63
 		return false;
64 64
 	}
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @since 1.8
70 70
 	 */
71
-	$redirect = apply_filters( "give_validate_{$current_page}", true );
71
+	$redirect = apply_filters("give_validate_{$current_page}", true);
72 72
 
73
-	if ( $redirect ) {
73
+	if ($redirect) {
74 74
 		// Redirect.
75 75
 		wp_redirect(
76 76
 			remove_query_arg(
77
-				array( '_wp_http_referer', '_wpnonce' ),
78
-				wp_unslash( $_SERVER['REQUEST_URI'] )
77
+				array('_wp_http_referer', '_wpnonce'),
78
+				wp_unslash($_SERVER['REQUEST_URI'])
79 79
 			)
80 80
 		);
81 81
 		exit;
82 82
 	}
83 83
 }
84 84
 
85
-add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' );
85
+add_action('admin_init', 'give_redirect_to_clean_url_admin_pages');
86 86
 
87 87
 
88 88
 /**
@@ -96,25 +96,25 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function give_hide_outdated_php_notice() {
98 98
 
99
-	if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) {
99
+	if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) {
100 100
 		give_die();
101 101
 	}
102 102
 
103 103
 	// Transient key name.
104 104
 	$transient_key = "_give_hide_outdated_php_notices_shortly";
105 105
 
106
-	if ( Give_Cache::get( $transient_key, true ) ) {
106
+	if (Give_Cache::get($transient_key, true)) {
107 107
 		return;
108 108
 	}
109 109
 
110 110
 	// Hide notice for 24 hours.
111
-	Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
111
+	Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true);
112 112
 
113 113
 	give_die();
114 114
 
115 115
 }
116 116
 
117
-add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' );
117
+add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice');
118 118
 
119 119
 /**
120 120
  * Register admin notices.
@@ -123,23 +123,23 @@  discard block
 block discarded – undo
123 123
  */
124 124
 function _give_register_admin_notices() {
125 125
 	// Bailout.
126
-	if( ! is_admin() ) {
126
+	if ( ! is_admin()) {
127 127
 		return;
128 128
 	}
129 129
 
130 130
 	// Add payment bulk notice.
131 131
 	if (
132
-		current_user_can( 'edit_give_payments' )
133
-		&& isset( $_GET['action'] )
134
-		&& ! empty( $_GET['action'] )
135
-		&& isset( $_GET['payment'] )
136
-		&& ! empty( $_GET['payment'] )
132
+		current_user_can('edit_give_payments')
133
+		&& isset($_GET['action'])
134
+		&& ! empty($_GET['action'])
135
+		&& isset($_GET['payment'])
136
+		&& ! empty($_GET['payment'])
137 137
 	) {
138
-		$payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0;
138
+		$payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0;
139 139
 
140
-		switch ( $_GET['action'] ) {
140
+		switch ($_GET['action']) {
141 141
 			case 'delete':
142
-				Give()->notices->register_notice( array(
142
+				Give()->notices->register_notice(array(
143 143
 					'id'          => 'bulk_action_delete',
144 144
 					'type'        => 'updated',
145 145
 					'description' => sprintf(
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 						),
152 152
 						$payment_count ),
153 153
 					'show'        => true,
154
-				) );
154
+				));
155 155
 
156 156
 				break;
157 157
 
158 158
 			case 'resend-receipt':
159
-				Give()->notices->register_notice( array(
159
+				Give()->notices->register_notice(array(
160 160
 					'id'          => 'bulk_action_resend_receipt',
161 161
 					'type'        => 'updated',
162 162
 					'description' => sprintf(
@@ -169,196 +169,196 @@  discard block
 block discarded – undo
169 169
 						$payment_count
170 170
 					),
171 171
 					'show'        => true,
172
-				) );
172
+				));
173 173
 				break;
174 174
 		}
175 175
 	}
176 176
 
177 177
 	// Add give message notices.
178
-	if ( ! empty( $_GET['give-message'] ) ) {
178
+	if ( ! empty($_GET['give-message'])) {
179 179
 		// Donation reports errors.
180
-		if ( current_user_can( 'view_give_reports' ) ) {
181
-			switch ( $_GET['give-message'] ) {
180
+		if (current_user_can('view_give_reports')) {
181
+			switch ($_GET['give-message']) {
182 182
 				case 'donation_deleted' :
183
-					Give()->notices->register_notice( array(
183
+					Give()->notices->register_notice(array(
184 184
 						'id'          => 'give-donation-deleted',
185 185
 						'type'        => 'updated',
186
-						'description' => __( 'The donation has been deleted.', 'give' ),
186
+						'description' => __('The donation has been deleted.', 'give'),
187 187
 						'show'        => true,
188
-					) );
188
+					));
189 189
 					break;
190 190
 				case 'email_sent' :
191
-					Give()->notices->register_notice( array(
191
+					Give()->notices->register_notice(array(
192 192
 						'id'          => 'give-payment-sent',
193 193
 						'type'        => 'updated',
194
-						'description' => __( 'The donation receipt has been resent.', 'give' ),
194
+						'description' => __('The donation receipt has been resent.', 'give'),
195 195
 						'show'        => true,
196
-					) );
196
+					));
197 197
 					break;
198 198
 				case 'refreshed-reports' :
199
-					Give()->notices->register_notice( array(
199
+					Give()->notices->register_notice(array(
200 200
 						'id'          => 'give-refreshed-reports',
201 201
 						'type'        => 'updated',
202
-						'description' => __( 'The reports cache has been cleared.', 'give' ),
202
+						'description' => __('The reports cache has been cleared.', 'give'),
203 203
 						'show'        => true,
204
-					) );
204
+					));
205 205
 					break;
206 206
 				case 'donation-note-deleted' :
207
-					Give()->notices->register_notice( array(
207
+					Give()->notices->register_notice(array(
208 208
 						'id'          => 'give-donation-note-deleted',
209 209
 						'type'        => 'updated',
210
-						'description' => __( 'The donation note has been deleted.', 'give' ),
210
+						'description' => __('The donation note has been deleted.', 'give'),
211 211
 						'show'        => true,
212
-					) );
212
+					));
213 213
 					break;
214 214
 			}
215 215
 		}
216 216
 
217 217
 		// Give settings notices and errors.
218
-		if ( current_user_can( 'manage_give_settings' ) ) {
219
-			switch ( $_GET['give-message'] ) {
218
+		if (current_user_can('manage_give_settings')) {
219
+			switch ($_GET['give-message']) {
220 220
 				case 'settings-imported' :
221
-					Give()->notices->register_notice( array(
221
+					Give()->notices->register_notice(array(
222 222
 						'id'          => 'give-settings-imported',
223 223
 						'type'        => 'updated',
224
-						'description' => __( 'The settings have been imported.', 'give' ),
224
+						'description' => __('The settings have been imported.', 'give'),
225 225
 						'show'        => true,
226
-					) );
226
+					));
227 227
 					break;
228 228
 				case 'api-key-generated' :
229
-					Give()->notices->register_notice( array(
229
+					Give()->notices->register_notice(array(
230 230
 						'id'          => 'give-api-key-generated',
231 231
 						'type'        => 'updated',
232
-						'description' => __( 'API keys have been generated.', 'give' ),
232
+						'description' => __('API keys have been generated.', 'give'),
233 233
 						'show'        => true,
234
-					) );
234
+					));
235 235
 					break;
236 236
 				case 'api-key-exists' :
237
-					Give()->notices->register_notice( array(
237
+					Give()->notices->register_notice(array(
238 238
 						'id'          => 'give-api-key-exists',
239 239
 						'type'        => 'updated',
240
-						'description' => __( 'The specified user already has API keys.', 'give' ),
240
+						'description' => __('The specified user already has API keys.', 'give'),
241 241
 						'show'        => true,
242
-					) );
242
+					));
243 243
 					break;
244 244
 				case 'api-key-regenerated' :
245
-					Give()->notices->register_notice( array(
245
+					Give()->notices->register_notice(array(
246 246
 						'id'          => 'give-api-key-regenerated',
247 247
 						'type'        => 'updated',
248
-						'description' => __( 'API keys have been regenerated.', 'give' ),
248
+						'description' => __('API keys have been regenerated.', 'give'),
249 249
 						'show'        => true,
250
-					) );
250
+					));
251 251
 					break;
252 252
 				case 'api-key-revoked' :
253
-					Give()->notices->register_notice( array(
253
+					Give()->notices->register_notice(array(
254 254
 						'id'          => 'give-api-key-revoked',
255 255
 						'type'        => 'updated',
256
-						'description' => __( 'API keys have been revoked.', 'give' ),
256
+						'description' => __('API keys have been revoked.', 'give'),
257 257
 						'show'        => true,
258
-					) );
258
+					));
259 259
 					break;
260 260
 				case 'sent-test-email' :
261
-					Give()->notices->register_notice( array(
261
+					Give()->notices->register_notice(array(
262 262
 						'id'          => 'give-sent-test-email',
263 263
 						'type'        => 'updated',
264
-						'description' => __( 'The test email has been sent.', 'give' ),
264
+						'description' => __('The test email has been sent.', 'give'),
265 265
 						'show'        => true,
266
-					) );
266
+					));
267 267
 					break;
268 268
 				case 'matched-success-failure-page':
269
-					Give()->notices->register_notice( array(
269
+					Give()->notices->register_notice(array(
270 270
 						'id'          => 'give-matched-success-failure-page',
271 271
 						'type'        => 'updated',
272
-						'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ),
272
+						'description' => __('You cannot set the success and failed pages to the same page', 'give'),
273 273
 						'show'        => true,
274
-					) );
274
+					));
275 275
 					break;
276 276
 			}
277 277
 		}
278 278
 		// Payments errors.
279
-		if ( current_user_can( 'edit_give_payments' ) ) {
280
-			switch ( $_GET['give-message'] ) {
279
+		if (current_user_can('edit_give_payments')) {
280
+			switch ($_GET['give-message']) {
281 281
 				case 'note-added' :
282
-					Give()->notices->register_notice( array(
282
+					Give()->notices->register_notice(array(
283 283
 						'id'          => 'give-note-added',
284 284
 						'type'        => 'updated',
285
-						'description' => __( 'The donation note has been added.', 'give' ),
285
+						'description' => __('The donation note has been added.', 'give'),
286 286
 						'show'        => true,
287
-					) );
287
+					));
288 288
 					break;
289 289
 				case 'payment-updated' :
290
-					Give()->notices->register_notice( array(
290
+					Give()->notices->register_notice(array(
291 291
 						'id'          => 'give-payment-updated',
292 292
 						'type'        => 'updated',
293
-						'description' => __( 'The donation has been updated.', 'give' ),
293
+						'description' => __('The donation has been updated.', 'give'),
294 294
 						'show'        => true,
295
-					) );
295
+					));
296 296
 					break;
297 297
 			}
298 298
 		}
299 299
 
300 300
 		// Donor Notices.
301
-		if ( current_user_can( 'edit_give_payments' ) ) {
302
-			switch ( $_GET['give-message'] ) {
301
+		if (current_user_can('edit_give_payments')) {
302
+			switch ($_GET['give-message']) {
303 303
 				case 'donor-deleted' :
304
-					Give()->notices->register_notice( array(
304
+					Give()->notices->register_notice(array(
305 305
 						'id'          => 'give-donor-deleted',
306 306
 						'type'        => 'updated',
307
-						'description' => __( 'The donor has been deleted.', 'give' ),
307
+						'description' => __('The donor has been deleted.', 'give'),
308 308
 						'show'        => true,
309
-					) );
309
+					));
310 310
 					break;
311 311
 
312 312
 				case 'email-added' :
313
-					Give()->notices->register_notice( array(
313
+					Give()->notices->register_notice(array(
314 314
 						'id'          => 'give-donor-email-added',
315 315
 						'type'        => 'updated',
316
-						'description' => __( 'Donor email added.', 'give' ),
316
+						'description' => __('Donor email added.', 'give'),
317 317
 						'show'        => true,
318
-					) );
318
+					));
319 319
 					break;
320 320
 
321 321
 				case 'email-removed' :
322
-					Give()->notices->register_notice( array(
322
+					Give()->notices->register_notice(array(
323 323
 						'id'          => 'give-donor-email-removed',
324 324
 						'type'        => 'updated',
325
-						'description' => __( 'Donor email removed.', 'give' ),
325
+						'description' => __('Donor email removed.', 'give'),
326 326
 						'show'        => true,
327
-					) );
327
+					));
328 328
 					break;
329 329
 
330 330
 				case 'email-remove-failed' :
331
-					Give()->notices->register_notice( array(
331
+					Give()->notices->register_notice(array(
332 332
 						'id'          => 'give-donor-email-remove-failed',
333 333
 						'type'        => 'updated',
334
-						'description' => __( 'Failed to remove donor email.', 'give' ),
334
+						'description' => __('Failed to remove donor email.', 'give'),
335 335
 						'show'        => true,
336
-					) );
336
+					));
337 337
 					break;
338 338
 
339 339
 				case 'primary-email-updated' :
340
-					Give()->notices->register_notice( array(
340
+					Give()->notices->register_notice(array(
341 341
 						'id'          => 'give-donor-primary-email-updated',
342 342
 						'type'        => 'updated',
343
-						'description' => __( 'Primary email updated for donor.', 'give' ),
343
+						'description' => __('Primary email updated for donor.', 'give'),
344 344
 						'show'        => true,
345
-					) );
345
+					));
346 346
 					break;
347 347
 
348 348
 				case 'primary-email-failed' :
349
-					Give()->notices->register_notice( array(
349
+					Give()->notices->register_notice(array(
350 350
 						'id'          => 'give-donor-primary-email-failed',
351 351
 						'type'        => 'updated',
352
-						'description' => __( 'Failed to set primary email.', 'give' ),
352
+						'description' => __('Failed to set primary email.', 'give'),
353 353
 						'show'        => true,
354
-					) );
354
+					));
355 355
 					break;
356 356
 			}
357 357
 		}
358 358
 	}
359 359
 }
360 360
 
361
-add_action( 'admin_notices', '_give_register_admin_notices', - 1 );
361
+add_action('admin_notices', '_give_register_admin_notices', - 1);
362 362
 
363 363
 
364 364
 /**
@@ -368,27 +368,26 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return bool
370 370
  */
371
-function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) {
372
-	$is_test_mode = ! empty( $_POST['test_mode'] ) ?
373
-		give_is_setting_enabled( $_POST['test_mode'] ) :
374
-		give_is_test_mode();
371
+function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) {
372
+	$is_test_mode = ! empty($_POST['test_mode']) ?
373
+		give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode();
375 374
 
376 375
 	if (
377
-		! current_user_can( 'view_give_reports' ) ||
376
+		! current_user_can('view_give_reports') ||
378 377
 		! $is_test_mode
379 378
 	) {
380 379
 		return false;
381 380
 	}
382 381
 
383 382
 	// Add the main siteadmin menu item.
384
-	$wp_admin_bar->add_menu( array(
383
+	$wp_admin_bar->add_menu(array(
385 384
 		'id'     => 'give-test-notice',
386
-		'href'   => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ),
385
+		'href'   => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'),
387 386
 		'parent' => 'top-secondary',
388
-		'title'  => esc_html__( 'Give Test Mode Active', 'give' ),
389
-		'meta'   => array( 'class' => 'give-test-mode-active' ),
390
-	) );
387
+		'title'  => esc_html__('Give Test Mode Active', 'give'),
388
+		'meta'   => array('class' => 'give-test-mode-active'),
389
+	));
391 390
 
392 391
 	return true;
393 392
 }
394
-add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 );
395 393
\ No newline at end of file
394
+add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1);
396 395
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-delete-test-transactions.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -55,22 +55,22 @@  discard block
 block discarded – undo
55 55
 	public function get_data() {
56 56
 		global $wpdb;
57 57
 
58
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids' );
58
+		$items = $this->get_stored_data('give_temp_delete_test_ids');
59 59
 
60
-		if ( ! is_array( $items ) ) {
60
+		if ( ! is_array($items)) {
61 61
 			return false;
62 62
 		}
63 63
 
64
-		$offset     = ( $this->step - 1 ) * $this->per_step;
65
-		$step_items = array_slice( $items, $offset, $this->per_step );
64
+		$offset     = ($this->step - 1) * $this->per_step;
65
+		$step_items = array_slice($items, $offset, $this->per_step);
66 66
 
67
-		if ( $step_items ) {
67
+		if ($step_items) {
68 68
 
69 69
 			$step_ids = array(
70 70
 				'other' => array(),
71 71
 			);
72 72
 
73
-			foreach ( $step_items as $item ) {
73
+			foreach ($step_items as $item) {
74 74
 
75 75
 				$step_ids['other'][] = $item['id'];
76 76
 
@@ -78,31 +78,31 @@  discard block
 block discarded – undo
78 78
 
79 79
 			$sql = array();
80 80
 
81
-			foreach ( $step_ids as $type => $ids ) {
81
+			foreach ($step_ids as $type => $ids) {
82 82
 
83
-				if ( empty( $ids ) ) {
83
+				if (empty($ids)) {
84 84
 					continue;
85 85
 				}
86 86
 
87 87
 				$parent_query = '';
88 88
 
89
-				switch ( $type ) {
89
+				switch ($type) {
90 90
 					case 'other':
91 91
 
92
-						$temp_ids = implode( ',', $ids );
92
+						$temp_ids = implode(',', $ids);
93 93
 
94 94
 						// Get all the test logs of the donations ids.
95 95
 						$parent_query = "SELECT DISTINCT post_id as id FROM $wpdb->postmeta WHERE meta_key = '_give_log_payment_id' AND meta_value IN ( $temp_ids )";
96
-						$parent_ids = $wpdb->get_results( $parent_query, 'ARRAY_A' );
96
+						$parent_ids = $wpdb->get_results($parent_query, 'ARRAY_A');
97 97
 
98 98
 						// List of all test logs.
99
-						if ( $parent_ids ) {
100
-							foreach ( $parent_ids as $parent_id ) {
99
+						if ($parent_ids) {
100
+							foreach ($parent_ids as $parent_id) {
101 101
 								// Adding all the test log in post ids that are going to get deleted.
102 102
 								$ids[] = $parent_id['id'];
103 103
 							}
104 104
 						}
105
-						$ids = implode( ',', $ids );
105
+						$ids = implode(',', $ids);
106 106
 
107 107
 						$sql[] = "DELETE FROM $wpdb->posts WHERE id IN ($ids)";
108 108
 						$sql[] = "DELETE FROM $wpdb->postmeta WHERE post_id IN ($ids)";
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 
114 114
 			}
115 115
 
116
-			if ( ! empty( $sql ) ) {
117
-				foreach ( $sql as $query ) {
118
-					$wpdb->query( $query );
116
+			if ( ! empty($sql)) {
117
+				foreach ($sql as $query) {
118
+					$wpdb->query($query);
119 119
 				}
120
-				do_action( 'give_delete_log_cache' );
120
+				do_action('give_delete_log_cache');
121 121
 			}
122 122
 			return true;
123 123
 		}
@@ -132,16 +132,16 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function get_percentage_complete() {
134 134
 
135
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids', false );
136
-		$total = count( $items );
135
+		$items = $this->get_stored_data('give_temp_delete_test_ids', false);
136
+		$total = count($items);
137 137
 
138 138
 		$percentage = 100;
139 139
 
140
-		if ( $total > 0 ) {
141
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
140
+		if ($total > 0) {
141
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
142 142
 		}
143 143
 
144
-		if ( $percentage > 100 ) {
144
+		if ($percentage > 100) {
145 145
 			$percentage = 100;
146 146
 		}
147 147
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @param array $request The Form Data passed into the batch processing
157 157
 	 */
158
-	public function set_properties( $request ) {
158
+	public function set_properties($request) {
159 159
 	}
160 160
 
161 161
 	/**
@@ -166,29 +166,29 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	public function process_step() {
168 168
 
169
-		if ( ! $this->can_export() ) {
170
-			wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
169
+		if ( ! $this->can_export()) {
170
+			wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403));
171 171
 		}
172 172
 
173 173
 		$had_data = $this->get_data();
174 174
 
175
-		if ( $had_data ) {
175
+		if ($had_data) {
176 176
 			$this->done = false;
177 177
 
178 178
 			return true;
179 179
 		} else {
180
-			update_option( 'give_earnings_total', give_get_total_earnings( true ) );
181
-			Give_Cache::delete( Give_Cache::get_key('give_estimated_monthly_stats' ) );
180
+			update_option('give_earnings_total', give_get_total_earnings(true));
181
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
182 182
 
183
-			$this->delete_data( 'give_temp_delete_test_ids' );
183
+			$this->delete_data('give_temp_delete_test_ids');
184 184
 
185 185
 			// Reset the sequential order numbers
186
-			if ( give_get_option( 'enable_sequential' ) ) {
187
-				delete_option( 'give_last_payment_number' );
186
+			if (give_get_option('enable_sequential')) {
187
+				delete_option('give_last_payment_number');
188 188
 			}
189 189
 
190 190
 			$this->done    = true;
191
-			$this->message = __( 'Test transactions successfully deleted.', 'give' );
191
+			$this->message = __('Test transactions successfully deleted.', 'give');
192 192
 
193 193
 			return false;
194 194
 		}
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
 	 * Headers
199 199
 	 */
200 200
 	public function headers() {
201
-		ignore_user_abort( true );
201
+		ignore_user_abort(true);
202 202
 
203
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
204
-			set_time_limit( 0 );
203
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
204
+			set_time_limit(0);
205 205
 		}
206 206
 	}
207 207
 
@@ -225,26 +225,26 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public function pre_fetch() {
227 227
 
228
-		if ( $this->step == 1 ) {
229
-			$this->delete_data( 'give_temp_delete_test_ids' );
228
+		if ($this->step == 1) {
229
+			$this->delete_data('give_temp_delete_test_ids');
230 230
 		}
231 231
 
232
-		$items = get_option( 'give_temp_delete_test_ids', false );
232
+		$items = get_option('give_temp_delete_test_ids', false);
233 233
 
234
-		if ( false === $items ) {
234
+		if (false === $items) {
235 235
 			$items = array();
236 236
 
237
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
237
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
238 238
 				'post_type'      => 'give_payment',
239 239
 				'post_status'    => 'any',
240
-				'posts_per_page' => - 1,
240
+				'posts_per_page' => -1,
241 241
 				// ONLY TEST MODE TRANSACTIONS!!!
242 242
 				'meta_key'   => '_give_payment_mode',
243 243
 				'meta_value' => 'test'
244
-			) );
244
+			));
245 245
 
246
-			$posts = get_posts( $args );
247
-			foreach ( $posts as $post ) {
246
+			$posts = get_posts($args);
247
+			foreach ($posts as $post) {
248 248
 				$items[] = array(
249 249
 					'id'   => (int) $post->ID,
250 250
 					'type' => $post->post_type,
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 
254 254
 			// Allow filtering of items to remove with an unassociative array for each item.
255 255
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method.
256
-			$items = apply_filters( 'give_delete_test_items', $items );
256
+			$items = apply_filters('give_delete_test_items', $items);
257 257
 
258
-			$this->store_data( 'give_temp_delete_test_ids', $items );
258
+			$this->store_data('give_temp_delete_test_ids', $items);
259 259
 		}
260 260
 
261 261
 	}
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return mixed       Returns the data from the database
271 271
 	 */
272
-	private function get_stored_data( $key ) {
272
+	private function get_stored_data($key) {
273 273
 		global $wpdb;
274
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
274
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
275 275
 
276
-		return empty( $value ) ? false : maybe_unserialize( $value );
276
+		return empty($value) ? false : maybe_unserialize($value);
277 277
 	}
278 278
 
279 279
 	/**
@@ -286,10 +286,10 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @return void
288 288
 	 */
289
-	private function store_data( $key, $value ) {
289
+	private function store_data($key, $value) {
290 290
 		global $wpdb;
291 291
 
292
-		$value = maybe_serialize( $value );
292
+		$value = maybe_serialize($value);
293 293
 
294 294
 		$data = array(
295 295
 			'option_name'  => $key,
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 			'%s',
304 304
 		);
305 305
 
306
-		$wpdb->replace( $wpdb->options, $data, $formats );
306
+		$wpdb->replace($wpdb->options, $data, $formats);
307 307
 	}
308 308
 
309 309
 	/**
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @return void
317 317
 	 */
318
-	private function delete_data( $key ) {
318
+	private function delete_data($key) {
319 319
 		global $wpdb;
320
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
320
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
321 321
 	}
322 322
 
323 323
 }
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-data.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
  * Admin View: Exports
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
10
-if ( ! current_user_can( 'manage_give_settings' ) ) {
10
+if ( ! current_user_can('manage_give_settings')) {
11 11
 	return;
12 12
 }
13 13
 
@@ -16,28 +16,28 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @since 1.5
18 18
  */
19
-do_action( 'give_tools_recount_stats_before' );
19
+do_action('give_tools_recount_stats_before');
20 20
 ?>
21 21
 	<div id="poststuff">
22 22
 		<div class="postbox">
23 23
 
24
-			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2>
24
+			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2>
25 25
 
26 26
 			<div class="inside recount-stats-controls">
27
-				<p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p>
27
+				<p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p>
28 28
 				<form method="post" id="give-tools-recount-form" class="give-export-form">
29 29
 
30
-					<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
30
+					<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
31 31
 
32 32
 					<select name="give-export-class" id="recount-stats-type">
33
-						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option>
34
-						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option>
35
-						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option>
36
-						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option>
37
-						<option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option>
38
-						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option>
39
-						<option data-type="delete-test-donors"   value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option>
40
-						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option>
33
+						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option>
34
+						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option>
35
+						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option>
36
+						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option>
37
+						<option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option>
38
+						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option>
39
+						<option data-type="delete-test-donors"   value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option>
40
+						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option>
41 41
 						<?php
42 42
 						/**
43 43
 						 * Fires in the recount stats selectbox.
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 						 *
47 47
 						 * @since 1.5
48 48
 						 */
49
-						do_action( 'give_recount_tool_options' );
49
+						do_action('give_recount_tool_options');
50 50
 						?>
51 51
 					</select>
52 52
 
@@ -54,22 +54,22 @@  discard block
 block discarded – undo
54 54
 						<?php
55 55
 						$args = array(
56 56
 							'name'   => 'form_id',
57
-							'number' => - 1,
57
+							'number' => -1,
58 58
 							'chosen' => true,
59 59
 						);
60
-						echo Give()->html->forms_dropdown( $args );
60
+						echo Give()->html->forms_dropdown($args);
61 61
 						?>
62 62
 					</span>
63 63
 
64
-					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/>
64
+					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/>
65 65
 
66 66
 					<br/>
67 67
 
68 68
 					<span class="give-recount-stats-descriptions">
69
-						<span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span>
70
-						<span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span>
71
-						<span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span>
72
-						<span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span>
69
+						<span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span>
70
+						<span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span>
71
+						<span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span>
72
+						<span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span>
73 73
 						<?php
74 74
 						/**
75 75
 						 * Fires in the recount stats description area.
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 						 *
79 79
 						 * @since 1.5
80 80
 						 */
81
-						do_action( 'give_recount_tool_descriptions' );
81
+						do_action('give_recount_tool_descriptions');
82 82
 						?>
83
-						<span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span>
84
-						<span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span>
83
+						<span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span>
84
+						<span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span>
85 85
 					</span>
86 86
 
87 87
 					<span class="spinner"></span>
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 				 *
96 96
 				 * @since 1.5
97 97
 				 */
98
-				do_action( 'give_tools_recount_forms' );
98
+				do_action('give_tools_recount_forms');
99 99
 				?>
100 100
 			</div><!-- .inside -->
101 101
 		</div><!-- .postbox -->
@@ -106,4 +106,4 @@  discard block
 block discarded – undo
106 106
  *
107 107
  * @since 1.5
108 108
  */
109
-do_action( 'give_tools_recount_stats_after' );
109
+do_action('give_tools_recount_stats_after');
Please login to merge, or discard this patch.
includes/process-donation.php 1 patch
Spacing   +248 added lines, -249 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
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @since 1.0
32 32
 	 */
33
-	do_action( 'give_pre_process_donation' );
33
+	do_action('give_pre_process_donation');
34 34
 
35 35
 	// Validate the form $_POST data
36 36
 	$valid_data = give_donation_form_validate_fields();
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
 	 * @param bool|array $valid_data Validate fields.
46 46
 	 * @param array $_POST Array of variables passed via the HTTP POST.
47 47
 	 */
48
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
48
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
49 49
 
50
-	$is_ajax = isset( $_POST['give_ajax'] );
50
+	$is_ajax = isset($_POST['give_ajax']);
51 51
 
52 52
 	// Process the login form
53
-	if ( isset( $_POST['give_login_submit'] ) ) {
53
+	if (isset($_POST['give_login_submit'])) {
54 54
 		give_process_form_login();
55 55
 	}
56 56
 
57 57
 	// Validate the user
58
-	$user = give_get_donation_form_user( $valid_data );
58
+	$user = give_get_donation_form_user($valid_data);
59 59
 
60
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
61
-		if ( $is_ajax ) {
60
+	if (false === $valid_data || give_get_errors() || ! $user) {
61
+		if ($is_ajax) {
62 62
 			/**
63 63
 			 * Fires when AJAX sends back errors from the donation form.
64 64
 			 *
65 65
 			 * @since 1.0
66 66
 			 */
67
-			do_action( 'give_ajax_donation_errors' );
67
+			do_action('give_ajax_donation_errors');
68 68
 			give_die();
69 69
 		} else {
70 70
 			return false;
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	// If AJAX send back success to proceed with form submission
75
-	if ( $is_ajax ) {
75
+	if ($is_ajax) {
76 76
 		echo 'success';
77 77
 		give_die();
78 78
 	}
79 79
 
80 80
 	// After AJAX: Setup session if not using php_sessions
81
-	if ( ! Give()->session->use_php_sessions() ) {
81
+	if ( ! Give()->session->use_php_sessions()) {
82 82
 		// Double-check that set_cookie is publicly accessible;
83 83
 		// we're using a slightly modified class-wp-sessions.php
84
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
85
-		if ( $session_reflection->isPublic() ) {
84
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
85
+		if ($session_reflection->isPublic()) {
86 86
 			// Manually set the cookie.
87 87
 			Give()->session->init()->set_cookie();
88 88
 		}
@@ -97,20 +97,19 @@  discard block
 block discarded – undo
97 97
 		'address'    => $user['address'],
98 98
 	);
99 99
 
100
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
100
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
101 101
 
102
-	$price        = isset( $_POST['give-amount'] ) ?
103
-		(float) apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give-amount'] ) ) :
104
-		'0.00';
105
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
102
+	$price        = isset($_POST['give-amount']) ?
103
+		(float) apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give-amount'])) : '0.00';
104
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
106 105
 
107 106
 	// Setup donation information
108 107
 	$donation_data = array(
109 108
 		'price'        => $price,
110 109
 		'purchase_key' => $purchase_key,
111 110
 		'user_email'   => $user['user_email'],
112
-		'date'         => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
113
-		'user_info'    => stripslashes_deep( $user_info ),
111
+		'date'         => date('Y-m-d H:i:s', current_time('timestamp')),
112
+		'user_info'    => stripslashes_deep($user_info),
114 113
 		'post_data'    => $_POST,
115 114
 		'gateway'      => $valid_data['gateway'],
116 115
 		'card_info'    => $valid_data['cc_info'],
@@ -130,10 +129,10 @@  discard block
 block discarded – undo
130 129
 	 * @param array $user_info Array containing basic user information.
131 130
 	 * @param bool|array $valid_data Validate fields.
132 131
 	 */
133
-	do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data );
132
+	do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data);
134 133
 
135 134
 	// Sanity check for price
136
-	if ( ! $donation_data['price'] ) {
135
+	if ( ! $donation_data['price']) {
137 136
 		// Revert to manual
138 137
 		$donation_data['gateway'] = 'manual';
139 138
 		$_POST['give-gateway']    = 'manual';
@@ -144,27 +143,27 @@  discard block
 block discarded – undo
144 143
 	 *
145 144
 	 * @since 1.7
146 145
 	 */
147
-	$donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data );
146
+	$donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data);
148 147
 
149 148
 	// Setup the data we're storing in the donation session
150 149
 	$session_data = $donation_data;
151 150
 
152 151
 	// Make sure credit card numbers are never stored in sessions
153
-	unset( $session_data['card_info']['card_number'] );
154
-	unset( $session_data['post_data']['card_number'] );
152
+	unset($session_data['card_info']['card_number']);
153
+	unset($session_data['post_data']['card_number']);
155 154
 
156 155
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
157
-	give_set_purchase_session( $session_data );
156
+	give_set_purchase_session($session_data);
158 157
 
159 158
 	// Send info to the gateway for payment processing
160
-	give_send_to_gateway( $donation_data['gateway'], $donation_data );
159
+	give_send_to_gateway($donation_data['gateway'], $donation_data);
161 160
 	give_die();
162 161
 
163 162
 }
164 163
 
165
-add_action( 'give_purchase', 'give_process_donation_form' );
166
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
167
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
164
+add_action('give_purchase', 'give_process_donation_form');
165
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
166
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
168 167
 
169 168
 
170 169
 /**
@@ -177,29 +176,29 @@  discard block
 block discarded – undo
177 176
  *
178 177
  * @return void
179 178
  */
180
-function give_check_logged_in_user_for_existing_email( $valid_data, $post ) {
179
+function give_check_logged_in_user_for_existing_email($valid_data, $post) {
181 180
 
182 181
 	// Verify that the email address belongs to this customer.
183
-	if ( is_user_logged_in() ) {
182
+	if (is_user_logged_in()) {
184 183
 
185
-		$submitted_email    = $valid_data['logged_in_user']['user_email'];
186
-		$donor = new Give_Donor( get_current_user_id(), true );
184
+		$submitted_email = $valid_data['logged_in_user']['user_email'];
185
+		$donor = new Give_Donor(get_current_user_id(), true);
187 186
 
188 187
 		// If this email address is not registered with this customer, see if it belongs to any other customer
189 188
 		if (
190 189
 			$submitted_email !== $donor->email
191
-			&& ( is_array( $donor->emails ) && ! in_array( $submitted_email, $donor->emails ) )
190
+			&& (is_array($donor->emails) && ! in_array($submitted_email, $donor->emails))
192 191
 		) {
193
-			$found_donor = new Give_Donor( $submitted_email );
192
+			$found_donor = new Give_Donor($submitted_email);
194 193
 
195
-			if ( $found_donor->id > 0 ) {
196
-				give_set_error( 'give-customer-email-exists', sprintf( __( 'You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.' ,'give' ), $donor->email, $submitted_email ) );
194
+			if ($found_donor->id > 0) {
195
+				give_set_error('give-customer-email-exists', sprintf(__('You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give'), $donor->email, $submitted_email));
197 196
 			}
198 197
 		}
199 198
 	}
200 199
 }
201 200
 
202
-add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2 );
201
+add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2);
203 202
 
204 203
 /**
205 204
  * Process the checkout login form
@@ -209,49 +208,49 @@  discard block
 block discarded – undo
209 208
  * @return      void
210 209
  */
211 210
 function give_process_form_login() {
212
-	$is_ajax = isset( $_POST['give_ajax'] );
211
+	$is_ajax = isset($_POST['give_ajax']);
213 212
 
214 213
 	$user_data = give_donation_form_validate_user_login();
215 214
 
216
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
217
-		if ( $is_ajax ) {
215
+	if (give_get_errors() || $user_data['user_id'] < 1) {
216
+		if ($is_ajax) {
218 217
 			/**
219 218
 			 * Fires when AJAX sends back errors from the donation form.
220 219
 			 *
221 220
 			 * @since 1.0
222 221
 			 */
223 222
 			ob_start();
224
-				do_action( 'give_ajax_donation_errors' );
223
+				do_action('give_ajax_donation_errors');
225 224
 				$message = ob_get_contents();
226 225
 			ob_end_clean();
227
-			wp_send_json_error( $message );
226
+			wp_send_json_error($message);
228 227
 		} else {
229
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
228
+			wp_redirect($_SERVER['HTTP_REFERER']);
230 229
 			exit;
231 230
 		}
232 231
 	}
233 232
 
234
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
233
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
235 234
 
236
-	if ( $is_ajax ) {
235
+	if ($is_ajax) {
237 236
 		$message = Give()->notices->print_frontend_notice(
238 237
 			sprintf(
239 238
 				/* translators: %s: user first name */
240
-				esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ),
241
-				( ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login']
239
+				esc_html__('Welcome %s! You have successfully logged into your account.', 'give'),
240
+				( ! empty($user_data['user_first'])) ? $user_data['user_first'] : $user_data['user_login']
242 241
 			),
243 242
 			false,
244 243
 			'success'
245 244
 		);
246 245
 
247
-		wp_send_json_success( $message );
246
+		wp_send_json_success($message);
248 247
 	} else {
249
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
248
+		wp_redirect($_SERVER['HTTP_REFERER']);
250 249
 	}
251 250
 }
252 251
 
253
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
254
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
252
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
253
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
255 254
 
256 255
 /**
257 256
  * Donation Form Validate Fields.
@@ -263,55 +262,55 @@  discard block
 block discarded – undo
263 262
 function give_donation_form_validate_fields() {
264 263
 
265 264
 	// Check if there is $_POST
266
-	if ( empty( $_POST ) ) {
265
+	if (empty($_POST)) {
267 266
 		return false;
268 267
 	}
269 268
 
270
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
269
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
271 270
 
272 271
 	// Start an array to collect valid data
273 272
 	$valid_data = array(
274 273
 		'gateway'          => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here)
275
-		'need_new_user'    => false,     // New user flag
276
-		'need_user_login'  => false,     // Login user flag
277
-		'logged_user_data' => array(),   // Logged user collected data
278
-		'new_user_data'    => array(),   // New user collected data
279
-		'login_user_data'  => array(),   // Login user collected data
280
-		'guest_user_data'  => array(),   // Guest user collected data
281
-		'cc_info'          => give_donation_form_validate_cc(),// Credit card info
274
+		'need_new_user'    => false, // New user flag
275
+		'need_user_login'  => false, // Login user flag
276
+		'logged_user_data' => array(), // Logged user collected data
277
+		'new_user_data'    => array(), // New user collected data
278
+		'login_user_data'  => array(), // Login user collected data
279
+		'guest_user_data'  => array(), // Guest user collected data
280
+		'cc_info'          => give_donation_form_validate_cc(), // Credit card info
282 281
 	);
283 282
 
284 283
 	// Validate Honeypot First
285
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
286
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
284
+	if ( ! empty($_POST['give-honeypot'])) {
285
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
287 286
 	}
288 287
 
289 288
 	// Validate agree to terms
290
-	if ( give_is_terms_enabled( $form_id ) ) {
289
+	if (give_is_terms_enabled($form_id)) {
291 290
 		give_donation_form_validate_agree_to_terms();
292 291
 	}
293 292
 
294 293
 	// Stop processing donor registration, if donor registration is optional and donor can do guest checkout.
295 294
 	// If registration form username field is empty that means donor do not want to registration instead want guest checkout.
296 295
 	if (
297
-		! give_logged_in_only( $form_id )
298
-		&& isset( $_POST['give-purchase-var'] )
296
+		! give_logged_in_only($form_id)
297
+		&& isset($_POST['give-purchase-var'])
299 298
 		&& $_POST['give-purchase-var'] == 'needs-to-register'
300
-		&& empty( $_POST['give_user_login'] )
299
+		&& empty($_POST['give_user_login'])
301 300
 	) {
302
-		unset( $_POST['give-purchase-var'] );
301
+		unset($_POST['give-purchase-var']);
303 302
 	}
304 303
 
305
-	if ( is_user_logged_in() ) {
304
+	if (is_user_logged_in()) {
306 305
 		// Collect logged in user data.
307 306
 		$valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user();
308
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) {
307
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') {
309 308
 		// Set new user registration as required.
310 309
 		$valid_data['need_new_user'] = true;
311 310
 		// Validate new user data.
312 311
 		$valid_data['new_user_data'] = give_donation_form_validate_new_user();
313 312
 		// Check if login validation is needed.
314
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
313
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
315 314
 		// Set user login as required.
316 315
 		$valid_data['need_user_login'] = true;
317 316
 		// Validate users login info.
@@ -336,41 +335,41 @@  discard block
 block discarded – undo
336 335
  */
337 336
 function give_donation_form_validate_gateway() {
338 337
 
339
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
340
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_maybe_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
341
-	$gateway = give_get_default_gateway( $form_id );
338
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
339
+	$amount  = isset($_REQUEST['give-amount']) ? give_maybe_sanitize_amount($_REQUEST['give-amount']) : 0;
340
+	$gateway = give_get_default_gateway($form_id);
342 341
 
343 342
 	// Check if a gateway value is present.
344
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
343
+	if ( ! empty($_REQUEST['give-gateway'])) {
345 344
 
346
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
345
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
347 346
 
348 347
 		// Is amount being donated in LIVE mode 0.00? If so, error:
349
-		if ( $amount == 0 && ! give_is_test_mode() ) {
348
+		if ($amount == 0 && ! give_is_test_mode()) {
350 349
 
351
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
350
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
352 351
 
353 352
 		} // End if().
354
-		elseif ( ! give_verify_minimum_price() ) {
353
+		elseif ( ! give_verify_minimum_price()) {
355 354
 			// translators: %s: minimum donation amount.
356 355
 			give_set_error(
357 356
 				'invalid_donation_minimum',
358 357
 				sprintf(
359 358
 					/* translators: %s: minimum donation amount */
360
-					__( 'This form has a minimum donation amount of %s.', 'give' ),
361
-					give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ), array( 'sanitize' => false ) ) )
359
+					__('This form has a minimum donation amount of %s.', 'give'),
360
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id), array('sanitize' => false)))
362 361
 				)
363 362
 			);
364 363
 
365 364
 		} //Is this test mode zero donation? Let it through but set to manual gateway.
366
-		elseif ( $amount == 0 && give_is_test_mode() ) {
365
+		elseif ($amount == 0 && give_is_test_mode()) {
367 366
 
368 367
 			$gateway = 'manual';
369 368
 
370 369
 		} //Check if this gateway is active.
371
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
370
+		elseif ( ! give_is_gateway_active($gateway)) {
372 371
 
373
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
372
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
374 373
 
375 374
 		}
376 375
 	}
@@ -388,21 +387,21 @@  discard block
 block discarded – undo
388 387
  */
389 388
 function give_verify_minimum_price() {
390 389
 
391
-	$amount          = give_maybe_sanitize_amount( $_REQUEST['give-amount'] );
392
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
393
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : null;
394
-	$variable_prices = give_has_variable_prices( $form_id );
390
+	$amount          = give_maybe_sanitize_amount($_REQUEST['give-amount']);
391
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
392
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : null;
393
+	$variable_prices = give_has_variable_prices($form_id);
395 394
 
396
-	if ( $variable_prices && in_array( $price_id, give_get_variable_price_ids( $form_id ) ) ) {
395
+	if ($variable_prices && in_array($price_id, give_get_variable_price_ids($form_id))) {
397 396
 
398
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
397
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
399 398
 
400
-		if ( $price_level_amount == $amount ) {
399
+		if ($price_level_amount == $amount) {
401 400
 			return true;
402 401
 		}
403 402
 	}
404 403
 
405
-	if ( give_get_form_minimum_price( $form_id ) > $amount ) {
404
+	if (give_get_form_minimum_price($form_id) > $amount) {
406 405
 		return false;
407 406
 	}
408 407
 
@@ -418,9 +417,9 @@  discard block
 block discarded – undo
418 417
  */
419 418
 function give_donation_form_validate_agree_to_terms() {
420 419
 	// Validate agree to terms.
421
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
420
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
422 421
 		// User did not agree.
423
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) );
422
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give')));
424 423
 	}
425 424
 }
426 425
 
@@ -434,59 +433,59 @@  discard block
 block discarded – undo
434 433
  *
435 434
  * @return      array
436 435
  */
437
-function give_get_required_fields( $form_id ) {
436
+function give_get_required_fields($form_id) {
438 437
 
439
-	$payment_mode = give_get_chosen_gateway( $form_id );
438
+	$payment_mode = give_get_chosen_gateway($form_id);
440 439
 
441 440
 	$required_fields = array(
442 441
 		'give_email' => array(
443 442
 			'error_id'      => 'invalid_email',
444
-			'error_message' => __( 'Please enter a valid email address.', 'give' ),
443
+			'error_message' => __('Please enter a valid email address.', 'give'),
445 444
 		),
446 445
 		'give_first' => array(
447 446
 			'error_id'      => 'invalid_first_name',
448
-			'error_message' => __( 'Please enter your first name.', 'give' ),
447
+			'error_message' => __('Please enter your first name.', 'give'),
449 448
 		),
450 449
 	);
451 450
 
452
-	$require_address = give_require_billing_address( $payment_mode );
451
+	$require_address = give_require_billing_address($payment_mode);
453 452
 
454
-	if ( $require_address ) {
455
-		$required_fields['card_address']    = array(
453
+	if ($require_address) {
454
+		$required_fields['card_address'] = array(
456 455
 			'error_id'      => 'invalid_card_address',
457
-			'error_message' => __( 'Please enter your primary billing address.', 'give' ),
456
+			'error_message' => __('Please enter your primary billing address.', 'give'),
458 457
 		);
459
-		$required_fields['card_zip']        = array(
458
+		$required_fields['card_zip'] = array(
460 459
 			'error_id'      => 'invalid_zip_code',
461
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' ),
460
+			'error_message' => __('Please enter your zip / postal code.', 'give'),
462 461
 		);
463
-		$required_fields['card_city']       = array(
462
+		$required_fields['card_city'] = array(
464 463
 			'error_id'      => 'invalid_city',
465
-			'error_message' => __( 'Please enter your billing city.', 'give' ),
464
+			'error_message' => __('Please enter your billing city.', 'give'),
466 465
 		);
467 466
 		$required_fields['billing_country'] = array(
468 467
 			'error_id'      => 'invalid_country',
469
-			'error_message' => __( 'Please select your billing country.', 'give' ),
468
+			'error_message' => __('Please select your billing country.', 'give'),
470 469
 		);
471 470
 
472 471
 
473
-		$required_fields['card_state']      = array(
472
+		$required_fields['card_state'] = array(
474 473
 			'error_id'      => 'invalid_state',
475
-			'error_message' => __( 'Please enter billing state / province / County.', 'give' ),
474
+			'error_message' => __('Please enter billing state / province / County.', 'give'),
476 475
 		);
477 476
 
478 477
 		// Check if billing country alredy exists.
479
-		if ( ! empty( $_POST['billing_country'] ) ) {
478
+		if ( ! empty($_POST['billing_country'])) {
480 479
 			// Get the value from $_POST.
481
-			$country = sanitize_text_field( $_POST['billing_country'] );
480
+			$country = sanitize_text_field($_POST['billing_country']);
482 481
 
483 482
 			// Get the country list that does not required any states init.
484 483
 			$states_country = give_states_not_required_country_list();
485 484
 
486 485
 			// Check if states is empty or not.
487
-			if ( array_key_exists( $country, $states_country ) ) {
486
+			if (array_key_exists($country, $states_country)) {
488 487
 				// If states is empty remove the required feilds of state in billing cart.
489
-				unset( $required_fields['card_state'] );
488
+				unset($required_fields['card_state']);
490 489
 			}
491 490
 		}
492 491
 	}
@@ -496,7 +495,7 @@  discard block
 block discarded – undo
496 495
 	 *
497 496
 	 * @since 1.7
498 497
 	 */
499
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
498
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
500 499
 
501 500
 	return $required_fields;
502 501
 
@@ -511,16 +510,16 @@  discard block
 block discarded – undo
511 510
  *
512 511
  * @return bool
513 512
  */
514
-function give_require_billing_address( $payment_mode ) {
513
+function give_require_billing_address($payment_mode) {
515 514
 
516 515
 	$return = false;
517 516
 
518
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
517
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
519 518
 		$return = true;
520 519
 	}
521 520
 
522 521
 	// Let payment gateways and other extensions determine if address fields should be required.
523
-	return apply_filters( 'give_require_billing_address', $return );
522
+	return apply_filters('give_require_billing_address', $return);
524 523
 
525 524
 }
526 525
 
@@ -534,42 +533,42 @@  discard block
 block discarded – undo
534 533
 function give_donation_form_validate_logged_in_user() {
535 534
 	global $user_ID;
536 535
 
537
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
536
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
538 537
 
539 538
 	// Start empty array to collect valid user data.
540 539
 	$valid_user_data = array(
541 540
 		// Assume there will be errors.
542
-		'user_id' => - 1,
541
+		'user_id' => -1,
543 542
 	);
544 543
 
545 544
 	// Verify there is a user_ID.
546
-	if ( $user_ID > 0 ) {
545
+	if ($user_ID > 0) {
547 546
 		// Get the logged in user data.
548
-		$user_data = get_userdata( $user_ID );
547
+		$user_data = get_userdata($user_ID);
549 548
 
550 549
 		// Loop through required fields and show error messages.
551
-		foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
552
-			if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
553
-				give_set_error( $value['error_id'], $value['error_message'] );
550
+		foreach (give_get_required_fields($form_id) as $field_name => $value) {
551
+			if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
552
+				give_set_error($value['error_id'], $value['error_message']);
554 553
 			}
555 554
 		}
556 555
 
557 556
 		// Verify data.
558
-		if ( $user_data ) {
557
+		if ($user_data) {
559 558
 			// Collected logged in user data.
560 559
 			$valid_user_data = array(
561 560
 				'user_id'    => $user_ID,
562
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
563
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
564
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
561
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
562
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
563
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
565 564
 			);
566 565
 
567
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
568
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
566
+			if ( ! is_email($valid_user_data['user_email'])) {
567
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
569 568
 			}
570 569
 		} else {
571 570
 			// Set invalid user error.
572
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
571
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
573 572
 		}
574 573
 	}
575 574
 
@@ -588,7 +587,7 @@  discard block
 block discarded – undo
588 587
 	// Default user data.
589 588
 	$default_user_data = array(
590 589
 		'give-form-id'           => '',
591
-		'user_id'                => - 1, // Assume there will be errors.
590
+		'user_id'                => -1, // Assume there will be errors.
592 591
 		'user_first'             => '',
593 592
 		'user_last'              => '',
594 593
 		'give_user_login'        => false,
@@ -598,14 +597,14 @@  discard block
 block discarded – undo
598 597
 	);
599 598
 
600 599
 	// Get user data.
601
-	$user_data            = wp_parse_args( array_map( 'trim', give_clean( $_POST ) ), $default_user_data );
600
+	$user_data            = wp_parse_args(array_map('trim', give_clean($_POST)), $default_user_data);
602 601
 	$registering_new_user = false;
603
-	$form_id              = absint( $user_data['give-form-id'] );
602
+	$form_id              = absint($user_data['give-form-id']);
604 603
 
605 604
 	// Start an empty array to collect valid user data.
606 605
 	$valid_user_data = array(
607 606
 		// Assume there will be errors.
608
-		'user_id'    => - 1,
607
+		'user_id'    => -1,
609 608
 
610 609
 		// Get first name.
611 610
 		'user_first' => $user_data['give_first'],
@@ -615,25 +614,25 @@  discard block
 block discarded – undo
615 614
 	);
616 615
 
617 616
 	// Loop through required fields and show error messages.
618
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
619
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
620
-			give_set_error( $value['error_id'], $value['error_message'] );
617
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
618
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
619
+			give_set_error($value['error_id'], $value['error_message']);
621 620
 		}
622 621
 	}
623 622
 
624 623
 	// Check if we have an username to register.
625
-	if ( give_validate_username( $user_data['give_user_login'] ) ) {
624
+	if (give_validate_username($user_data['give_user_login'])) {
626 625
 		$registering_new_user          = true;
627 626
 		$valid_user_data['user_login'] = $user_data['give_user_login'];
628 627
 	}
629 628
 
630 629
 	// Check if we have an email to verify.
631
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
630
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
632 631
 		$valid_user_data['user_email'] = $user_data['give_email'];
633 632
 	}
634 633
 
635 634
 	// Check password.
636
-	if ( give_validate_user_password( $user_data['give_user_pass'], $user_data['give_user_pass_confirm'], $registering_new_user ) ) {
635
+	if (give_validate_user_password($user_data['give_user_pass'], $user_data['give_user_pass_confirm'], $registering_new_user)) {
637 636
 		// All is good to go.
638 637
 		$valid_user_data['user_pass'] = $user_data['give_user_pass'];
639 638
 	}
@@ -653,36 +652,36 @@  discard block
 block discarded – undo
653 652
 	// Start an array to collect valid user data.
654 653
 	$valid_user_data = array(
655 654
 		// Assume there will be errors.
656
-		'user_id' => - 1,
655
+		'user_id' => -1,
657 656
 	);
658 657
 
659 658
 	// Username.
660
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
661
-		give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) );
659
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
660
+		give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give'));
662 661
 
663 662
 		return $valid_user_data;
664 663
 	}
665 664
 
666 665
 	// Get the user by login.
667
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
666
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
668 667
 
669 668
 	// Check if user exists.
670
-	if ( $user_data ) {
669
+	if ($user_data) {
671 670
 		// Get password.
672
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
671
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
673 672
 
674 673
 		// Check user_pass.
675
-		if ( $user_pass ) {
674
+		if ($user_pass) {
676 675
 			// Check if password is valid.
677
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
676
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
678 677
 				// Incorrect password.
679 678
 				give_set_error(
680 679
 					'password_incorrect',
681 680
 					sprintf(
682 681
 						'%1$s <a href="%2$s">%3$s</a>',
683
-						__( 'The password you entered is incorrect.', 'give' ),
684
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
685
-						__( 'Reset Password', 'give' )
682
+						__('The password you entered is incorrect.', 'give'),
683
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
684
+						__('Reset Password', 'give')
686 685
 					)
687 686
 				);
688 687
 				// All is correct.
@@ -699,11 +698,11 @@  discard block
 block discarded – undo
699 698
 			}
700 699
 		} else {
701 700
 			// Empty password.
702
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
701
+			give_set_error('password_empty', __('Enter a password.', 'give'));
703 702
 		}
704 703
 	} else {
705 704
 		// No username.
706
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
705
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
707 706
 	}// End if().
708 707
 
709 708
 	return $valid_user_data;
@@ -718,7 +717,7 @@  discard block
 block discarded – undo
718 717
  */
719 718
 function give_donation_form_validate_guest_user() {
720 719
 
721
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
720
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
722 721
 
723 722
 	// Start an array to collect valid user data.
724 723
 	$valid_user_data = array(
@@ -727,38 +726,38 @@  discard block
 block discarded – undo
727 726
 	);
728 727
 
729 728
 	// Show error message if user must be logged in.
730
-	if ( give_logged_in_only( $form_id ) ) {
731
-		give_set_error( 'logged_in_only', __( 'You must be logged in to donate.', 'give' ) );
729
+	if (give_logged_in_only($form_id)) {
730
+		give_set_error('logged_in_only', __('You must be logged in to donate.', 'give'));
732 731
 	}
733 732
 
734 733
 	// Get the guest email.
735
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
734
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
736 735
 
737 736
 	// Check email.
738
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
737
+	if ($guest_email && strlen($guest_email) > 0) {
739 738
 		// Validate email.
740
-		if ( ! is_email( $guest_email ) ) {
739
+		if ( ! is_email($guest_email)) {
741 740
 			// Invalid email.
742
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
741
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
743 742
 		} else {
744 743
 			// All is good to go.
745 744
 			$valid_user_data['user_email'] = $guest_email;
746 745
 
747 746
 			// Get user_id from donor if exist.
748
-			$donor = new Give_Donor( $guest_email );
749
-			if ( $donor->id && $donor->user_id ) {
747
+			$donor = new Give_Donor($guest_email);
748
+			if ($donor->id && $donor->user_id) {
750 749
 				$valid_user_data['user_id'] = $donor->user_id;
751 750
 			}
752 751
 		}
753 752
 	} else {
754 753
 		// No email.
755
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
754
+		give_set_error('email_empty', __('Enter an email.', 'give'));
756 755
 	}
757 756
 
758 757
 	// Loop through required fields and show error messages.
759
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
760
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
761
-			give_set_error( $value['error_id'], $value['error_message'] );
758
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
759
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
760
+			give_set_error($value['error_id'], $value['error_message']);
762 761
 		}
763 762
 	}
764 763
 
@@ -774,36 +773,36 @@  discard block
 block discarded – undo
774 773
  * @since   1.0
775 774
  * @return  integer
776 775
  */
777
-function give_register_and_login_new_user( $user_data = array() ) {
776
+function give_register_and_login_new_user($user_data = array()) {
778 777
 	// Verify the array.
779
-	if ( empty( $user_data ) ) {
780
-		return - 1;
778
+	if (empty($user_data)) {
779
+		return -1;
781 780
 	}
782 781
 
783
-	if ( give_get_errors() ) {
784
-		return - 1;
782
+	if (give_get_errors()) {
783
+		return -1;
785 784
 	}
786 785
 
787
-	$user_args = apply_filters( 'give_insert_user_args', array(
788
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
789
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
790
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
791
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
792
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
793
-		'user_registered' => date( 'Y-m-d H:i:s' ),
794
-		'role'            => get_option( 'default_role' ),
795
-	), $user_data );
786
+	$user_args = apply_filters('give_insert_user_args', array(
787
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
788
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
789
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
790
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
791
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
792
+		'user_registered' => date('Y-m-d H:i:s'),
793
+		'role'            => get_option('default_role'),
794
+	), $user_data);
796 795
 
797 796
 	// Insert new user.
798
-	$user_id = wp_insert_user( $user_args );
797
+	$user_id = wp_insert_user($user_args);
799 798
 
800 799
 	// Validate inserted user.
801
-	if ( is_wp_error( $user_id ) ) {
802
-		return - 1;
800
+	if (is_wp_error($user_id)) {
801
+		return -1;
803 802
 	}
804 803
 
805 804
 	// Allow themes and plugins to filter the user data.
806
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
805
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
807 806
 
808 807
 	/**
809 808
 	 * Fires after inserting user.
@@ -813,10 +812,10 @@  discard block
 block discarded – undo
813 812
 	 * @param int $user_id User id.
814 813
 	 * @param array $user_data Array containing user data.
815 814
 	 */
816
-	do_action( 'give_insert_user', $user_id, $user_data );
815
+	do_action('give_insert_user', $user_id, $user_data);
817 816
 
818 817
 	// Login new user.
819
-	give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
818
+	give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
820 819
 
821 820
 	// Return user id.
822 821
 	return $user_id;
@@ -831,27 +830,27 @@  discard block
 block discarded – undo
831 830
  * @since   1.0
832 831
  * @return  array|bool
833 832
  */
834
-function give_get_donation_form_user( $valid_data = array() ) {
833
+function give_get_donation_form_user($valid_data = array()) {
835 834
 
836 835
 	// Initialize user.
837 836
 	$user    = false;
838
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
837
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
839 838
 
840
-	if ( $is_ajax ) {
839
+	if ($is_ajax) {
841 840
 		// Do not create or login the user during the ajax submission (check for errors only).
842 841
 		return true;
843
-	} elseif ( is_user_logged_in() ) {
842
+	} elseif (is_user_logged_in()) {
844 843
 		// Set the valid user as the logged in collected data.
845 844
 		$user = $valid_data['logged_in_user'];
846
-	} elseif ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
845
+	} elseif ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
847 846
 		// New user registration.
848
-		if ( $valid_data['need_new_user'] === true ) {
847
+		if ($valid_data['need_new_user'] === true) {
849 848
 			// Set user.
850 849
 			$user = $valid_data['new_user_data'];
851 850
 			// Register and login new user.
852
-			$user['user_id'] = give_register_and_login_new_user( $user );
851
+			$user['user_id'] = give_register_and_login_new_user($user);
853 852
 			// User login
854
-		} elseif ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
853
+		} elseif ($valid_data['need_user_login'] === true && ! $is_ajax) {
855 854
 
856 855
 			/**
857 856
 			 * The login form is now processed in the give_process_donation_login() function.
@@ -863,48 +862,48 @@  discard block
 block discarded – undo
863 862
 			// Set user.
864 863
 			$user = $valid_data['login_user_data'];
865 864
 			// Login user.
866
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
865
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
867 866
 		}
868 867
 	}
869 868
 
870 869
 	// Check guest checkout.
871
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
870
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
872 871
 		// Set user
873 872
 		$user = $valid_data['guest_user_data'];
874 873
 	}
875 874
 
876 875
 	// Verify we have an user.
877
-	if ( false === $user || empty( $user ) ) {
876
+	if (false === $user || empty($user)) {
878 877
 		// Return false.
879 878
 		return false;
880 879
 	}
881 880
 
882 881
 	// Get user first name.
883
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
884
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
882
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
883
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
885 884
 	}
886 885
 
887 886
 	// Get user last name.
888
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
889
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
887
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
888
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
890 889
 	}
891 890
 
892 891
 	// Get the user's billing address details.
893 892
 	$user['address']            = array();
894
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false;
895
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false;
896
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false;
897
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false;
898
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false;
899
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false;
900
-
901
-	if ( empty( $user['address']['country'] ) ) {
893
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false;
894
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false;
895
+	$user['address']['city']    = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false;
896
+	$user['address']['state']   = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false;
897
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false;
898
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false;
899
+
900
+	if (empty($user['address']['country'])) {
902 901
 		$user['address'] = false;
903 902
 	} // End if().
904 903
 
905
-	if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) {
904
+	if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) {
906 905
 		// Store the address in the user's meta so the donation form can be pre-populated with it on return donation.
907
-		update_user_meta( $user['user_id'], '_give_user_address', $user['address'] );
906
+		update_user_meta($user['user_id'], '_give_user_address', $user['address']);
908 907
 	}
909 908
 
910 909
 	// Return valid user.
@@ -923,16 +922,16 @@  discard block
 block discarded – undo
923 922
 	$card_data = give_get_donation_cc_info();
924 923
 
925 924
 	// Validate the card zip.
926
-	if ( ! empty( $card_data['card_zip'] ) ) {
927
-		if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
928
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
925
+	if ( ! empty($card_data['card_zip'])) {
926
+		if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
927
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
929 928
 		}
930 929
 	}
931 930
 
932 931
 	// Ensure no spaces.
933
-	if ( ! empty( $card_data['card_number'] ) ) {
934
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs
935
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
932
+	if ( ! empty($card_data['card_number'])) {
933
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs
934
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
936 935
 	}
937 936
 
938 937
 	// This should validate card numbers at some point too.
@@ -949,17 +948,17 @@  discard block
 block discarded – undo
949 948
 function give_get_donation_cc_info() {
950 949
 
951 950
 	$cc_info                   = array();
952
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
953
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
954
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
955
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
956
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
957
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
958
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
959
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
960
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
961
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
962
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
951
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
952
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
953
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
954
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
955
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
956
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
957
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
958
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
959
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
960
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
961
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
963 962
 
964 963
 	// Return cc info.
965 964
 	return $cc_info;
@@ -975,14 +974,14 @@  discard block
 block discarded – undo
975 974
  *
976 975
  * @return bool|mixed
977 976
  */
978
-function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
977
+function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') {
979 978
 	$ret = false;
980 979
 
981
-	if ( empty( $zip ) || empty( $country_code ) ) {
980
+	if (empty($zip) || empty($country_code)) {
982 981
 		return $ret;
983 982
 	}
984 983
 
985
-	$country_code = strtoupper( $country_code );
984
+	$country_code = strtoupper($country_code);
986 985
 
987 986
 	$zip_regex = array(
988 987
 		'AD' => 'AD\d{3}',
@@ -1142,11 +1141,11 @@  discard block
 block discarded – undo
1142 1141
 		'ZM' => '\d{5}',
1143 1142
 	);
1144 1143
 
1145
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1144
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1146 1145
 		$ret = true;
1147 1146
 	}
1148 1147
 
1149
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1148
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1150 1149
 }
1151 1150
 
1152 1151
 
@@ -1160,33 +1159,33 @@  discard block
 block discarded – undo
1160 1159
  *
1161 1160
  * @return bool
1162 1161
  */
1163
-function give_validate_multi_donation_form_level( $valid_data, $data ) {
1162
+function give_validate_multi_donation_form_level($valid_data, $data) {
1164 1163
 	/* @var Give_Donate_Form $form */
1165
-	$form = new Give_Donate_Form( $data['give-form-id'] );
1164
+	$form = new Give_Donate_Form($data['give-form-id']);
1166 1165
 
1167 1166
 	$donation_level_matched = false;
1168 1167
 
1169
-	if ( $form->is_multi_type_donation_form() ) {
1168
+	if ($form->is_multi_type_donation_form()) {
1170 1169
 
1171 1170
 		// Bailout.
1172
-		if ( ! ( $variable_prices = $form->get_prices() ) ) {
1171
+		if ( ! ($variable_prices = $form->get_prices())) {
1173 1172
 			return false;
1174 1173
 		}
1175 1174
 
1176 1175
 		// Sanitize donation amount.
1177
-		$data['give-amount'] = give_maybe_sanitize_amount( $data['give-amount'] );
1176
+		$data['give-amount'] = give_maybe_sanitize_amount($data['give-amount']);
1178 1177
 
1179
-		if ( $data['give-amount'] === give_maybe_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ) ) ) {
1178
+		if ($data['give-amount'] === give_maybe_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']))) {
1180 1179
 			return true;
1181 1180
 		}
1182 1181
 
1183 1182
 		// Find correct donation level from all donation levels.
1184
-		foreach ( $variable_prices as $variable_price ) {
1183
+		foreach ($variable_prices as $variable_price) {
1185 1184
 			// Sanitize level amount.
1186
-			$variable_price['_give_amount'] = give_maybe_sanitize_amount( $variable_price['_give_amount'] );
1185
+			$variable_price['_give_amount'] = give_maybe_sanitize_amount($variable_price['_give_amount']);
1187 1186
 
1188 1187
 			// Set first match donation level ID.
1189
-			if ( $data['give-amount'] === $variable_price['_give_amount'] ) {
1188
+			if ($data['give-amount'] === $variable_price['_give_amount']) {
1190 1189
 				$_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1191 1190
 				$donation_level_matched = true;
1192 1191
 				break;
@@ -1197,19 +1196,19 @@  discard block
 block discarded – undo
1197 1196
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1198 1197
 		if (
1199 1198
 			! $donation_level_matched
1200
-			&& ( give_is_setting_enabled( give_get_meta( $data['give-form-id'], '_give_custom_amount', true ) ) )
1199
+			&& (give_is_setting_enabled(give_get_meta($data['give-form-id'], '_give_custom_amount', true)))
1201 1200
 		) {
1202 1201
 			// Sanitize custom minimum amount.
1203
-			$custom_minimum_amount = give_maybe_sanitize_amount( give_get_meta( $data['give-form-id'], '_give_custom_amount_minimum', true ) );
1202
+			$custom_minimum_amount = give_maybe_sanitize_amount(give_get_meta($data['give-form-id'], '_give_custom_amount_minimum', true));
1204 1203
 
1205
-			if ( $data['give-amount'] >= $custom_minimum_amount ) {
1204
+			if ($data['give-amount'] >= $custom_minimum_amount) {
1206 1205
 				$_POST['give-price-id'] = 'custom';
1207 1206
 				$donation_level_matched = true;
1208 1207
 			}
1209 1208
 		}
1210 1209
 	}// End if().
1211 1210
 
1212
-	return ( $donation_level_matched ? true : false );
1211
+	return ($donation_level_matched ? true : false);
1213 1212
 }
1214 1213
 
1215
-add_action( 'give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2 );
1214
+add_action('give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2);
Please login to merge, or discard this patch.
includes/class-give-session.php 1 patch
Spacing   +63 added lines, -63 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
 
@@ -74,57 +74,57 @@  discard block
 block discarded – undo
74 74
 	public function __construct() {
75 75
 
76 76
 		$this->use_php_sessions = $this->use_php_sessions();
77
-		$this->exp_option       = give_get_option( 'session_lifetime' );
77
+		$this->exp_option       = give_get_option('session_lifetime');
78 78
 
79 79
 		// PHP Sessions.
80
-		if ( $this->use_php_sessions ) {
80
+		if ($this->use_php_sessions) {
81 81
 
82
-			if ( is_multisite() ) {
82
+			if (is_multisite()) {
83 83
 
84
-				$this->prefix = '_' . get_current_blog_id();
84
+				$this->prefix = '_'.get_current_blog_id();
85 85
 
86 86
 			}
87 87
 
88
-			add_action( 'init', array( $this, 'maybe_start_session' ), - 2 );
88
+			add_action('init', array($this, 'maybe_start_session'), - 2);
89 89
 
90 90
 		} else {
91 91
 
92
-			if ( ! $this->should_start_session() ) {
92
+			if ( ! $this->should_start_session()) {
93 93
 				return;
94 94
 			}
95 95
 
96 96
 			// Use WP_Session.
97
-			if ( ! defined( 'WP_SESSION_COOKIE' ) ) {
98
-				define( 'WP_SESSION_COOKIE', 'give_wp_session' );
97
+			if ( ! defined('WP_SESSION_COOKIE')) {
98
+				define('WP_SESSION_COOKIE', 'give_wp_session');
99 99
 			}
100 100
 
101
-			if ( ! class_exists( 'Recursive_ArrayAccess' ) ) {
102
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-recursive-arrayaccess.php';
101
+			if ( ! class_exists('Recursive_ArrayAccess')) {
102
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-recursive-arrayaccess.php';
103 103
 			}
104 104
 
105 105
 			// Include utilities class
106
-			if ( ! class_exists( 'WP_Session_Utils' ) ) {
107
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session-utils.php';
106
+			if ( ! class_exists('WP_Session_Utils')) {
107
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session-utils.php';
108 108
 			}
109
-			if ( ! class_exists( 'WP_Session' ) ) {
110
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session.php';
111
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/wp-session.php';
109
+			if ( ! class_exists('WP_Session')) {
110
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session.php';
111
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/wp-session.php';
112 112
 			}
113 113
 
114
-			add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );
115
-			add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );
114
+			add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999);
115
+			add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999);
116 116
 
117 117
 		}
118 118
 
119 119
 		// Init Session.
120
-		if ( empty( $this->session ) && ! $this->use_php_sessions ) {
121
-			add_action( 'plugins_loaded', array( $this, 'init' ), 9999 );
120
+		if (empty($this->session) && ! $this->use_php_sessions) {
121
+			add_action('plugins_loaded', array($this, 'init'), 9999);
122 122
 		} else {
123
-			add_action( 'init', array( $this, 'init' ), - 1 );
123
+			add_action('init', array($this, 'init'), - 1);
124 124
 		}
125 125
 
126 126
 		// Set cookie on Donation Completion page.
127
-		add_action( 'give_pre_process_donation', array( $this, 'set_session_cookies' ) );
127
+		add_action('give_pre_process_donation', array($this, 'set_session_cookies'));
128 128
 
129 129
 	}
130 130
 
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function init() {
142 142
 
143
-		if ( $this->use_php_sessions ) {
144
-			$this->session = isset( $_SESSION[ 'give' . $this->prefix ] ) && is_array( $_SESSION[ 'give' . $this->prefix ] ) ? $_SESSION[ 'give' . $this->prefix ] : array();
143
+		if ($this->use_php_sessions) {
144
+			$this->session = isset($_SESSION['give'.$this->prefix]) && is_array($_SESSION['give'.$this->prefix]) ? $_SESSION['give'.$this->prefix] : array();
145 145
 		} else {
146 146
 			$this->session = WP_Session::get_instance();
147 147
 		}
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return string|array      Session variable.
178 178
 	 */
179
-	public function get( $key ) {
180
-		$key = sanitize_key( $key );
179
+	public function get($key) {
180
+		$key = sanitize_key($key);
181 181
 
182
-		return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false;
182
+		return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false;
183 183
 
184 184
 	}
185 185
 
@@ -196,21 +196,21 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @return string        Session variable.
198 198
 	 */
199
-	public function set( $key, $value ) {
199
+	public function set($key, $value) {
200 200
 
201
-		$key = sanitize_key( $key );
201
+		$key = sanitize_key($key);
202 202
 
203
-		if ( is_array( $value ) ) {
204
-			$this->session[ $key ] = serialize( $value );
203
+		if (is_array($value)) {
204
+			$this->session[$key] = serialize($value);
205 205
 		} else {
206
-			$this->session[ $key ] = $value;
206
+			$this->session[$key] = $value;
207 207
 		}
208 208
 
209
-		if ( $this->use_php_sessions ) {
210
-			$_SESSION[ 'give' . $this->prefix ] = $this->session;
209
+		if ($this->use_php_sessions) {
210
+			$_SESSION['give'.$this->prefix] = $this->session;
211 211
 		}
212 212
 
213
-		return $this->session[ $key ];
213
+		return $this->session[$key];
214 214
 	}
215 215
 
216 216
 	/**
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
 	 * @hook
225 225
 	 */
226 226
 	public function set_session_cookies() {
227
-		if ( ! headers_sent() ) {
228
-			$lifetime = current_time( 'timestamp' ) + $this->set_expiration_time();
229
-			@setcookie( session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
230
-			@setcookie( session_name() . '_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
227
+		if ( ! headers_sent()) {
228
+			$lifetime = current_time('timestamp') + $this->set_expiration_time();
229
+			@setcookie(session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
230
+			@setcookie(session_name().'_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
231 231
 		}
232 232
 	}
233 233
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	public function set_expiration_variant_time() {
245 245
 
246
-		return ( ! empty( $this->exp_option ) ? ( intval( $this->exp_option ) - 3600 ) : 30 * 60 * 23 );
246
+		return ( ! empty($this->exp_option) ? (intval($this->exp_option) - 3600) : 30 * 60 * 23);
247 247
 	}
248 248
 
249 249
 	/**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function set_expiration_time() {
260 260
 
261
-		return ( ! empty( $this->exp_option ) ? intval( $this->exp_option ) : 30 * 60 * 24 );
261
+		return ( ! empty($this->exp_option) ? intval($this->exp_option) : 30 * 60 * 24);
262 262
 	}
263 263
 
264 264
 	/**
@@ -276,21 +276,21 @@  discard block
 block discarded – undo
276 276
 		$ret = false;
277 277
 
278 278
 		// If the database variable is already set, no need to run auto detection.
279
-		$give_use_php_sessions = (bool) get_option( 'give_use_php_sessions' );
279
+		$give_use_php_sessions = (bool) get_option('give_use_php_sessions');
280 280
 
281
-		if ( ! $give_use_php_sessions ) {
281
+		if ( ! $give_use_php_sessions) {
282 282
 
283 283
 			// Attempt to detect if the server supports PHP sessions.
284
-			if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) {
284
+			if (function_exists('session_start') && ! ini_get('safe_mode')) {
285 285
 
286
-				$this->set( 'give_use_php_sessions', 1 );
286
+				$this->set('give_use_php_sessions', 1);
287 287
 
288
-				if ( $this->get( 'give_use_php_sessions' ) ) {
288
+				if ($this->get('give_use_php_sessions')) {
289 289
 
290 290
 					$ret = true;
291 291
 
292 292
 					// Set the database option.
293
-					update_option( 'give_use_php_sessions', true );
293
+					update_option('give_use_php_sessions', true);
294 294
 
295 295
 				}
296 296
 			}
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 		}
301 301
 
302 302
 		// Enable or disable PHP Sessions based on the GIVE_USE_PHP_SESSIONS constant.
303
-		if ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ) {
303
+		if (defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS) {
304 304
 			$ret = true;
305
-		} elseif ( defined( 'GIVE_USE_PHP_SESSIONS' ) && ! GIVE_USE_PHP_SESSIONS ) {
305
+		} elseif (defined('GIVE_USE_PHP_SESSIONS') && ! GIVE_USE_PHP_SESSIONS) {
306 306
 			$ret = false;
307 307
 		}
308 308
 
309
-		return (bool) apply_filters( 'give_use_php_sessions', $ret );
309
+		return (bool) apply_filters('give_use_php_sessions', $ret);
310 310
 	}
311 311
 
312 312
 	/**
@@ -323,9 +323,9 @@  discard block
 block discarded – undo
323 323
 
324 324
 		$start_session = true;
325 325
 
326
-		if ( ! empty( $_SERVER['REQUEST_URI'] ) ) {
326
+		if ( ! empty($_SERVER['REQUEST_URI'])) {
327 327
 
328
-			$blacklist = apply_filters( 'give_session_start_uri_blacklist', array(
328
+			$blacklist = apply_filters('give_session_start_uri_blacklist', array(
329 329
 				'feed',
330 330
 				'feed',
331 331
 				'feed/rss',
@@ -333,21 +333,21 @@  discard block
 block discarded – undo
333 333
 				'feed/rdf',
334 334
 				'feed/atom',
335 335
 				'comments/feed/',
336
-			) );
337
-			$uri       = ltrim( $_SERVER['REQUEST_URI'], '/' );
338
-			$uri       = untrailingslashit( $uri );
339
-			if ( in_array( $uri, $blacklist ) ) {
336
+			));
337
+			$uri       = ltrim($_SERVER['REQUEST_URI'], '/');
338
+			$uri       = untrailingslashit($uri);
339
+			if (in_array($uri, $blacklist)) {
340 340
 				$start_session = false;
341 341
 			}
342
-			if ( false !== strpos( $uri, 'feed=' ) ) {
342
+			if (false !== strpos($uri, 'feed=')) {
343 343
 				$start_session = false;
344 344
 			}
345
-			if ( is_admin() ) {
345
+			if (is_admin()) {
346 346
 				$start_session = false;
347 347
 			}
348 348
 		}
349 349
 
350
-		return apply_filters( 'give_start_session', $start_session );
350
+		return apply_filters('give_start_session', $start_session);
351 351
 	}
352 352
 
353 353
 	/**
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
 	 */
364 364
 	public function maybe_start_session() {
365 365
 
366
-		if ( ! $this->should_start_session() ) {
366
+		if ( ! $this->should_start_session()) {
367 367
 			return;
368 368
 		}
369 369
 
370
-		if ( ! session_id() && ! headers_sent() ) {
370
+		if ( ! session_id() && ! headers_sent()) {
371 371
 			session_start();
372 372
 		}
373 373
 
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 
387 387
 		$expiration = false;
388 388
 
389
-		if ( session_id() && isset( $_COOKIE[ session_name() . '_expiration' ] ) ) {
389
+		if (session_id() && isset($_COOKIE[session_name().'_expiration'])) {
390 390
 
391
-			$expiration = date( 'D, d M Y h:i:s', intval( $_COOKIE[ session_name() . '_expiration' ] ) );
391
+			$expiration = date('D, d M Y h:i:s', intval($_COOKIE[session_name().'_expiration']));
392 392
 
393 393
 		}
394 394
 
Please login to merge, or discard this patch.
includes/plugin-compatibility.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
39 39
 	}
40 40
 
41 41
 	if ( ( is_plugin_active( 'wordpress-seo/wp-seo.php' )
42
-	       || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) )
43
-	     && class_exists( 'WPSEO_Sitemaps_Cache' )
42
+		   || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) )
43
+		 && class_exists( 'WPSEO_Sitemaps_Cache' )
44 44
 	) {
45 45
 
46 46
 		$forms_singular_option = give_get_option( 'forms_singular' );
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
  * @return void
20 20
  */
21 21
 function give_disable_mandrill_nl2br() {
22
-	add_filter( 'mandrill_nl2br', '__return_false' );
22
+	add_filter('mandrill_nl2br', '__return_false');
23 23
 }
24 24
 
25
-add_action( 'give_email_send_before', 'give_disable_mandrill_nl2br' );
25
+add_action('give_email_send_before', 'give_disable_mandrill_nl2br');
26 26
 
27 27
 
28 28
 /**
@@ -34,30 +34,30 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function give_clear_seo_sitemap_cache_on_settings_change() {
36 36
 	// Load required file if the fn 'is_plugin_active' doesn't exists.
37
-	if ( ! function_exists( 'is_plugin_active' ) ) {
38
-		require_once ABSPATH . 'wp-admin/includes/plugin.php';
37
+	if ( ! function_exists('is_plugin_active')) {
38
+		require_once ABSPATH.'wp-admin/includes/plugin.php';
39 39
 	}
40 40
 
41
-	if ( ( is_plugin_active( 'wordpress-seo/wp-seo.php' )
42
-	       || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) )
43
-	     && class_exists( 'WPSEO_Sitemaps_Cache' )
41
+	if ((is_plugin_active('wordpress-seo/wp-seo.php')
42
+	       || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php'))
43
+	     && class_exists('WPSEO_Sitemaps_Cache')
44 44
 	) {
45 45
 
46
-		$forms_singular_option = give_get_option( 'forms_singular' );
47
-		$forms_archive_option  = give_get_option( 'forms_singular' );
46
+		$forms_singular_option = give_get_option('forms_singular');
47
+		$forms_archive_option  = give_get_option('forms_singular');
48 48
 
49 49
 		// If there is change detected for Single Form View and Form Archives options then proceed.
50 50
 		if (
51
-			( isset( $_POST['forms_singular'] ) && $_POST['forms_singular'] !== $forms_singular_option ) ||
52
-			( isset( $_POST['forms_archives'] ) && $_POST['forms_archives'] !== $forms_archive_option )
51
+			(isset($_POST['forms_singular']) && $_POST['forms_singular'] !== $forms_singular_option) ||
52
+			(isset($_POST['forms_archives']) && $_POST['forms_archives'] !== $forms_archive_option)
53 53
 		) {
54 54
 			// If Yoast SEO or Yoast SEO Premium plugin exists, then update seo sitemap cache.
55 55
 			$yoast_sitemaps_cache = new WPSEO_Sitemaps_Cache();
56
-			if ( method_exists( $yoast_sitemaps_cache, 'clear' ) ) {
56
+			if (method_exists($yoast_sitemaps_cache, 'clear')) {
57 57
 				WPSEO_Sitemaps_Cache::clear();
58 58
 			}
59 59
 		}
60 60
 	}
61 61
 }
62 62
 
63
-add_action( 'give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change' );
63
+add_action('give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change');
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 1 patch
Spacing   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17 17
 // Load WP_List_Table if not loaded.
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -134,15 +134,15 @@  discard block
 block discarded – undo
134 134
 	public function __construct() {
135 135
 
136 136
 		// Set parent defaults.
137
-		parent::__construct( array(
138
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
139
-			'plural'   => give_get_forms_label_plural(),      // Plural name of the listed records.
140
-			'ajax'     => false,                              // Does this table support ajax?
141
-		) );
137
+		parent::__construct(array(
138
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
139
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
140
+			'ajax'     => false, // Does this table support ajax?
141
+		));
142 142
 
143 143
 		$this->process_bulk_action();
144 144
 		$this->get_payment_counts();
145
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
145
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
146 146
 	}
147 147
 
148 148
 	/**
@@ -151,55 +151,55 @@  discard block
 block discarded – undo
151 151
 	 * @return void
152 152
 	 */
153 153
 	public function advanced_filters() {
154
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
155
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
156
-		$status     = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : '';
157
-		$donor      = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : '';
158
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
159
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
154
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
155
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
156
+		$status     = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : '';
157
+		$donor      = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : '';
158
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : '';
159
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0;
160 160
 		?>
161 161
 		<div id="give-payment-filters" class="give-filters">
162
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
162
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
163 163
 			<div id="give-payment-date-filters">
164 164
 				<div class="give-filter give-filter-half">
165 165
 					<label for="start-date"
166
-					       class="give-start-date-label"><?php esc_html_e( 'Start Date', 'give' ); ?></label>
166
+					       class="give-start-date-label"><?php esc_html_e('Start Date', 'give'); ?></label>
167 167
 					<input type="text" id="start-date" name="start-date" class="give_datepicker"
168 168
 					       value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" />
169 169
 				</div>
170 170
 				<div class="give-filter give-filter-half">
171
-					<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date', 'give' ); ?></label>
171
+					<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date', 'give'); ?></label>
172 172
 					<input type="text" id="end-date" name="end-date" class="give_datepicker"
173 173
 					       value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" />
174 174
 				</div>
175 175
 			</div>
176 176
 			<div id="give-payment-form-filter" class="give-filter">
177 177
 				<label for="give-donation-forms-filter"
178
-				       class="give-donation-forms-filter-label"><?php esc_html_e( 'Form', 'give' ); ?></label>
178
+				       class="give-donation-forms-filter-label"><?php esc_html_e('Form', 'give'); ?></label>
179 179
 				<?php
180 180
 				// Filter Donations by Donation Forms.
181
-				echo Give()->html->forms_dropdown( array(
181
+				echo Give()->html->forms_dropdown(array(
182 182
 					'name'     => 'form_id',
183 183
 					'id'       => 'give-donation-forms-filter',
184 184
 					'class'    => 'give-donation-forms-filter',
185 185
 					'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection.
186 186
 					'chosen'   => true,
187
-					'number'   => - 1,
188
-				) );
187
+					'number'   => -1,
188
+				));
189 189
 				?>
190 190
 			</div>
191 191
 
192
-			<?php if ( ! empty( $status ) ) : ?>
193
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" />
192
+			<?php if ( ! empty($status)) : ?>
193
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" />
194 194
 			<?php endif; ?>
195 195
 
196 196
 			<div class="give-filter">
197
-				<?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?>
197
+				<?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?>
198 198
 				<?php
199 199
 				// Clear active filters button.
200
-				if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) : ?>
201
-					<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"
202
-					   class="button give-clear-filters-button"><?php esc_html_e( 'Clear Filters', 'give' ); ?></a>
200
+				if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) : ?>
201
+					<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"
202
+					   class="button give-clear-filters-button"><?php esc_html_e('Clear Filters', 'give'); ?></a>
203 203
 				<?php endif; ?>
204 204
 			</div>
205 205
 		</div>
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return void
220 220
 	 */
221
-	public function search_box( $text, $input_id ) {
222
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
221
+	public function search_box($text, $input_id) {
222
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
223 223
 			return;
224 224
 		}
225 225
 
226
-		$input_id = $input_id . '-search-input';
226
+		$input_id = $input_id.'-search-input';
227 227
 
228
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
229
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
228
+		if ( ! empty($_REQUEST['orderby'])) {
229
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
230 230
 		}
231
-		if ( ! empty( $_REQUEST['order'] ) ) {
232
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
231
+		if ( ! empty($_REQUEST['order'])) {
232
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
233 233
 		}
234 234
 		?>
235 235
 		<div class="give-filter give-filter-search" role="search">
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 			 *
242 242
 			 * @since 1.7
243 243
 			 */
244
-			do_action( 'give_payment_history_search' );
244
+			do_action('give_payment_history_search');
245 245
 			?>
246 246
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
247 247
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
248
-			<?php submit_button( $text, 'button', false, false, array(
248
+			<?php submit_button($text, 'button', false, false, array(
249 249
 				'ID' => 'search-submit',
250
-			) ); ?><br />
250
+			)); ?><br />
251 251
 		</div>
252 252
 		<?php
253 253
 	}
@@ -261,52 +261,52 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function get_views() {
263 263
 
264
-		$current = isset( $_GET['status'] ) ? $_GET['status'] : '';
264
+		$current = isset($_GET['status']) ? $_GET['status'] : '';
265 265
 		$views   = array();
266 266
 		$tabs    = array(
267 267
 			'all'        => array(
268 268
 				'total_count',
269
-				esc_html__( 'All', 'give' ),
269
+				esc_html__('All', 'give'),
270 270
 			),
271 271
 			'publish'    => array(
272 272
 				'complete_count',
273
-				esc_html__( 'Completed', 'give' ),
273
+				esc_html__('Completed', 'give'),
274 274
 			),
275 275
 			'pending'    => array(
276 276
 				'pending_count',
277
-				esc_html__( 'Pending', 'give' ),
277
+				esc_html__('Pending', 'give'),
278 278
 			),
279 279
 			'processing' => array(
280 280
 				'processing_count',
281
-				esc_html__( 'Processing', 'give' ),
281
+				esc_html__('Processing', 'give'),
282 282
 			),
283 283
 			'refunded'   => array(
284 284
 				'refunded_count',
285
-				esc_html__( 'Refunded', 'give' ),
285
+				esc_html__('Refunded', 'give'),
286 286
 			),
287 287
 			'revoked'    => array(
288 288
 				'revoked_count',
289
-				esc_html__( 'Revoked', 'give' ),
289
+				esc_html__('Revoked', 'give'),
290 290
 			),
291 291
 			'failed'     => array(
292 292
 				'failed_count',
293
-				esc_html__( 'Failed', 'give' ),
293
+				esc_html__('Failed', 'give'),
294 294
 			),
295 295
 			'cancelled'  => array(
296 296
 				'cancelled_count',
297
-				esc_html__( 'Cancelled', 'give' ),
297
+				esc_html__('Cancelled', 'give'),
298 298
 			),
299 299
 			'abandoned'  => array(
300 300
 				'abandoned_count',
301
-				esc_html__( 'Abandoned', 'give' ),
301
+				esc_html__('Abandoned', 'give'),
302 302
 			),
303 303
 			'preapproval'  => array(
304 304
 				'preapproval_count',
305
-				esc_html__( 'Preapproval Pending', 'give' ),
305
+				esc_html__('Preapproval Pending', 'give'),
306 306
 			),
307 307
 		);
308 308
 
309
-		foreach ( $tabs as $key => $tab ) {
309
+		foreach ($tabs as $key => $tab) {
310 310
 			$count_key = $tab[0];
311 311
 			$name      = $tab[1];
312 312
 			$count     = $this->$count_key;
@@ -321,19 +321,19 @@  discard block
 block discarded – undo
321 321
 			 * @param string $key   Current view tab value.
322 322
 			 * @param int    $count Number of donation inside the tab.
323 323
 			 */
324
-			if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) {
324
+			if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) {
325 325
 
326
-				$views[ $key ] = sprintf(
326
+				$views[$key] = sprintf(
327 327
 					'<a href="%s" %s >%s&nbsp;<span class="count">(%s)</span></a>',
328
-					esc_url( ( 'all' === (string) $key ) ? remove_query_arg( array( 'status', 'paged' ) ) : add_query_arg( array( 'status' => $key, 'paged' => false ) ) ),
329
-					( ( 'all' === $key && empty( $current ) ) ) ? 'class="current"' : ( $current == $key ) ? 'class="current"' : '',
328
+					esc_url(('all' === (string) $key) ? remove_query_arg(array('status', 'paged')) : add_query_arg(array('status' => $key, 'paged' => false))),
329
+					(('all' === $key && empty($current))) ? 'class="current"' : ($current == $key) ? 'class="current"' : '',
330 330
 					$name,
331 331
 					$count
332 332
 				);
333 333
 			}
334 334
 		}
335 335
 
336
-		return apply_filters( 'give_payments_table_views', $views );
336
+		return apply_filters('give_payments_table_views', $views);
337 337
 	}
338 338
 
339 339
 	/**
@@ -346,15 +346,15 @@  discard block
 block discarded – undo
346 346
 	public function get_columns() {
347 347
 		$columns = array(
348 348
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
349
-			'donation'      => esc_html__( 'Donation', 'give' ),
350
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
351
-			'status'        => esc_html__( 'Status', 'give' ),
352
-			'date'          => esc_html__( 'Date', 'give' ),
353
-			'amount'        => esc_html__( 'Amount', 'give' ),
354
-			'details'       => esc_html__( 'Details', 'give' ),
349
+			'donation'      => esc_html__('Donation', 'give'),
350
+			'donation_form' => esc_html__('Donation Form', 'give'),
351
+			'status'        => esc_html__('Status', 'give'),
352
+			'date'          => esc_html__('Date', 'give'),
353
+			'amount'        => esc_html__('Amount', 'give'),
354
+			'details'       => esc_html__('Details', 'give'),
355 355
 		);
356 356
 
357
-		return apply_filters( 'give_payments_table_columns', $columns );
357
+		return apply_filters('give_payments_table_columns', $columns);
358 358
 	}
359 359
 
360 360
 	/**
@@ -366,14 +366,14 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	public function get_sortable_columns() {
368 368
 		$columns = array(
369
-			'donation'      => array( 'ID', true ),
370
-			'donation_form' => array( 'donation_form', false ),
371
-			'status'        => array( 'status', false ),
372
-			'amount'        => array( 'amount', false ),
373
-			'date'          => array( 'date', false ),
369
+			'donation'      => array('ID', true),
370
+			'donation_form' => array('donation_form', false),
371
+			'status'        => array('status', false),
372
+			'amount'        => array('amount', false),
373
+			'date'          => array('date', false),
374 374
 		);
375 375
 
376
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
376
+		return apply_filters('give_payments_table_sortable_columns', $columns);
377 377
 	}
378 378
 
379 379
 	/**
@@ -399,55 +399,55 @@  discard block
 block discarded – undo
399 399
 	 *
400 400
 	 * @return string Column Name
401 401
 	 */
402
-	public function column_default( $payment, $column_name ) {
402
+	public function column_default($payment, $column_name) {
403 403
 
404
-		$single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) );
405
-		$row_actions         = $this->get_row_actions( $payment );
404
+		$single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details')));
405
+		$row_actions         = $this->get_row_actions($payment);
406 406
 
407
-		switch ( $column_name ) {
407
+		switch ($column_name) {
408 408
 			case 'donation' :
409
-				$value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, esc_html__( 'by', 'give' ), $this->get_donor( $payment ) );
410
-				$value .= $this->get_donor_email( $payment );
411
-				$value .= $this->row_actions( $row_actions );
409
+				$value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), $payment->ID, esc_html__('by', 'give'), $this->get_donor($payment));
410
+				$value .= $this->get_donor_email($payment);
411
+				$value .= $this->row_actions($row_actions);
412 412
 				break;
413 413
 
414 414
 			case 'amount' :
415
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
416
-				$value  = give_currency_filter( give_format_amount( $amount, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) );
417
-				$value  .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) );
415
+				$amount = ! empty($payment->total) ? $payment->total : 0;
416
+				$value  = give_currency_filter(give_format_amount($amount, array('sanitize' => false)), give_get_payment_currency_code($payment->ID));
417
+				$value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway));
418 418
 				break;
419 419
 
420 420
 			case 'donation_form' :
421
-				$form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title;
422
-				$value      = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>';
423
-				$level      = give_get_payment_form_title( $payment->meta, true );
421
+				$form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title;
422
+				$value      = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>';
423
+				$level      = give_get_payment_form_title($payment->meta, true);
424 424
 
425
-				if ( ! empty( $level ) ) {
425
+				if ( ! empty($level)) {
426 426
 					$value .= $level;
427 427
 				}
428 428
 
429 429
 				break;
430 430
 
431 431
 			case 'date' :
432
-				$date  = strtotime( $payment->date );
433
-				$value = date_i18n( give_date_format(), $date );
432
+				$date  = strtotime($payment->date);
433
+				$value = date_i18n(give_date_format(), $date);
434 434
 				break;
435 435
 
436 436
 			case 'status' :
437
-				$value = $this->get_payment_status( $payment );
437
+				$value = $this->get_payment_status($payment);
438 438
 				break;
439 439
 
440 440
 			case 'details' :
441
-				$value = sprintf( '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) );
441
+				$value = sprintf('<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID));
442 442
 				break;
443 443
 
444 444
 			default:
445
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
445
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
446 446
 				break;
447 447
 
448 448
 		}// End switch().
449 449
 
450
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
450
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
451 451
 	}
452 452
 
453 453
 	/**
@@ -460,17 +460,17 @@  discard block
 block discarded – undo
460 460
 	 *
461 461
 	 * @return string                Data shown in the Email column
462 462
 	 */
463
-	public function get_donor_email( $payment ) {
463
+	public function get_donor_email($payment) {
464 464
 
465
-		$email = give_get_payment_user_email( $payment->ID );
465
+		$email = give_get_payment_user_email($payment->ID);
466 466
 
467
-		if ( empty( $email ) ) {
468
-			$email = esc_html__( '(unknown)', 'give' );
467
+		if (empty($email)) {
468
+			$email = esc_html__('(unknown)', 'give');
469 469
 		}
470 470
 
471
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>';
471
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>';
472 472
 
473
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
473
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
474 474
 	}
475 475
 
476 476
 	/**
@@ -482,32 +482,32 @@  discard block
 block discarded – undo
482 482
 	 *
483 483
 	 * @return array $actions
484 484
 	 */
485
-	function get_row_actions( $payment ) {
485
+	function get_row_actions($payment) {
486 486
 
487 487
 		$actions = array();
488
-		$email   = give_get_payment_user_email( $payment->ID );
488
+		$email   = give_get_payment_user_email($payment->ID);
489 489
 
490 490
 		// Add search term string back to base URL.
491
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
492
-		if ( ! empty( $search_terms ) ) {
493
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
491
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
492
+		if ( ! empty($search_terms)) {
493
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
494 494
 		}
495 495
 
496
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
496
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
497 497
 
498
-			$actions['email_links'] = sprintf( '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array(
498
+			$actions['email_links'] = sprintf('<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array(
499 499
 				'give-action' => 'email_links',
500 500
 				'purchase_id' => $payment->ID,
501
-			), $this->base_url ), 'give_payment_nonce' ), sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), esc_html__( 'Resend Receipt', 'give' ) );
501
+			), $this->base_url), 'give_payment_nonce'), sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), esc_html__('Resend Receipt', 'give'));
502 502
 
503 503
 		}
504 504
 
505
-		$actions['delete'] = sprintf( '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array(
505
+		$actions['delete'] = sprintf('<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array(
506 506
 			'give-action' => 'delete_payment',
507 507
 			'purchase_id' => $payment->ID,
508
-		), $this->base_url ), 'give_donation_nonce' ), sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), esc_html__( 'Delete', 'give' ) );
508
+		), $this->base_url), 'give_donation_nonce'), sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), esc_html__('Delete', 'give'));
509 509
 
510
-		return apply_filters( 'give_payment_row_actions', $actions, $payment );
510
+		return apply_filters('give_payment_row_actions', $actions, $payment);
511 511
 	}
512 512
 
513 513
 
@@ -521,10 +521,10 @@  discard block
 block discarded – undo
521 521
 	 *
522 522
 	 * @return string                Data shown in the Email column
523 523
 	 */
524
-	function get_payment_status( $payment ) {
525
-		$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
526
-		if ( $payment->mode == 'test' ) {
527
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
524
+	function get_payment_status($payment) {
525
+		$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
526
+		if ($payment->mode == 'test') {
527
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
528 528
 		}
529 529
 
530 530
 		return $value;
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
 	 *
541 541
 	 * @return string Displays a checkbox.
542 542
 	 */
543
-	public function column_cb( $payment ) {
544
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID );
543
+	public function column_cb($payment) {
544
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID);
545 545
 	}
546 546
 
547 547
 	/**
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 	 *
555 555
 	 * @return string Displays a checkbox.
556 556
 	 */
557
-	public function get_payment_id( $payment ) {
558
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
557
+	public function get_payment_id($payment) {
558
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
559 559
 	}
560 560
 
561 561
 	/**
@@ -568,32 +568,32 @@  discard block
 block discarded – undo
568 568
 	 *
569 569
 	 * @return string Data shown in the User column
570 570
 	 */
571
-	public function get_donor( $payment ) {
571
+	public function get_donor($payment) {
572 572
 
573
-		$donor_id           = give_get_payment_donor_id( $payment->ID );
574
-		$donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' );
575
-		$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
573
+		$donor_id           = give_get_payment_donor_id($payment->ID);
574
+		$donor_billing_name = give_get_donor_name_by($payment->ID, 'donation');
575
+		$donor_name         = give_get_donor_name_by($donor_id, 'donor');
576 576
 
577 577
 		$value = '';
578
-		if ( ! empty( $donor_id ) ) {
578
+		if ( ! empty($donor_id)) {
579 579
 
580 580
 			// Check whether the donor name and WP_User name is same or not.
581
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
582
-				$value .= $donor_billing_name . ' (';
581
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
582
+				$value .= $donor_billing_name.' (';
583 583
 			}
584 584
 
585
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>';
585
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>';
586 586
 
587 587
 			// Check whether the donor name and WP_User name is same or not.
588
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
588
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
589 589
 				$value .= ')';
590 590
 			}
591 591
 		} else {
592
-			$email = give_get_payment_user_email( $payment->ID );
593
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
592
+			$email = give_get_payment_user_email($payment->ID);
593
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>';
594 594
 		}
595 595
 
596
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
596
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
597 597
 	}
598 598
 
599 599
 	/**
@@ -605,20 +605,20 @@  discard block
 block discarded – undo
605 605
 	 */
606 606
 	public function get_bulk_actions() {
607 607
 		$actions = array(
608
-			'delete'                 => __( 'Delete', 'give' ),
609
-			'set-status-publish'     => __( 'Set To Completed', 'give' ),
610
-			'set-status-pending'     => __( 'Set To Pending', 'give' ),
611
-			'set-status-processing'  => __( 'Set To Processing', 'give' ),
612
-			'set-status-refunded'    => __( 'Set To Refunded', 'give' ),
613
-			'set-status-revoked'     => __( 'Set To Revoked', 'give' ),
614
-			'set-status-failed'      => __( 'Set To Failed', 'give' ),
615
-			'set-status-cancelled'   => __( 'Set To Cancelled', 'give' ),
616
-			'set-status-abandoned'   => __( 'Set To Abandoned', 'give' ),
617
-			'set-status-preapproval' => __( 'Set To Preapproval', 'give' ),
618
-			'resend-receipt'         => __( 'Resend Email Receipts', 'give' ),
608
+			'delete'                 => __('Delete', 'give'),
609
+			'set-status-publish'     => __('Set To Completed', 'give'),
610
+			'set-status-pending'     => __('Set To Pending', 'give'),
611
+			'set-status-processing'  => __('Set To Processing', 'give'),
612
+			'set-status-refunded'    => __('Set To Refunded', 'give'),
613
+			'set-status-revoked'     => __('Set To Revoked', 'give'),
614
+			'set-status-failed'      => __('Set To Failed', 'give'),
615
+			'set-status-cancelled'   => __('Set To Cancelled', 'give'),
616
+			'set-status-abandoned'   => __('Set To Abandoned', 'give'),
617
+			'set-status-preapproval' => __('Set To Preapproval', 'give'),
618
+			'resend-receipt'         => __('Resend Email Receipts', 'give'),
619 619
 		);
620 620
 
621
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
621
+		return apply_filters('give_payments_table_bulk_actions', $actions);
622 622
 	}
623 623
 
624 624
 	/**
@@ -629,63 +629,63 @@  discard block
 block discarded – undo
629 629
 	 * @return void
630 630
 	 */
631 631
 	public function process_bulk_action() {
632
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
632
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
633 633
 		$action = $this->current_action();
634 634
 
635
-		if ( ! is_array( $ids ) ) {
636
-			$ids = array( $ids );
635
+		if ( ! is_array($ids)) {
636
+			$ids = array($ids);
637 637
 		}
638 638
 
639
-		if ( empty( $action ) ) {
639
+		if (empty($action)) {
640 640
 			return;
641 641
 		}
642 642
 
643
-		foreach ( $ids as $id ) {
643
+		foreach ($ids as $id) {
644 644
 
645 645
 			// Detect when a bulk action is being triggered.
646
-			switch ( $this->current_action() ) {
646
+			switch ($this->current_action()) {
647 647
 
648 648
 				case'delete':
649
-					give_delete_donation( $id );
649
+					give_delete_donation($id);
650 650
 					break;
651 651
 
652 652
 				case 'set-status-publish':
653
-					give_update_payment_status( $id, 'publish' );
653
+					give_update_payment_status($id, 'publish');
654 654
 					break;
655 655
 
656 656
 				case 'set-status-pending':
657
-					give_update_payment_status( $id, 'pending' );
657
+					give_update_payment_status($id, 'pending');
658 658
 					break;
659 659
 
660 660
 				case 'set-status-processing':
661
-					give_update_payment_status( $id, 'processing' );
661
+					give_update_payment_status($id, 'processing');
662 662
 					break;
663 663
 
664 664
 				case 'set-status-refunded':
665
-					give_update_payment_status( $id, 'refunded' );
665
+					give_update_payment_status($id, 'refunded');
666 666
 					break;
667 667
 				case 'set-status-revoked':
668
-					give_update_payment_status( $id, 'revoked' );
668
+					give_update_payment_status($id, 'revoked');
669 669
 					break;
670 670
 
671 671
 				case 'set-status-failed':
672
-					give_update_payment_status( $id, 'failed' );
672
+					give_update_payment_status($id, 'failed');
673 673
 					break;
674 674
 
675 675
 				case 'set-status-cancelled':
676
-					give_update_payment_status( $id, 'cancelled' );
676
+					give_update_payment_status($id, 'cancelled');
677 677
 					break;
678 678
 
679 679
 				case 'set-status-abandoned':
680
-					give_update_payment_status( $id, 'abandoned' );
680
+					give_update_payment_status($id, 'abandoned');
681 681
 					break;
682 682
 
683 683
 				case 'set-status-preapproval':
684
-					give_update_payment_status( $id, 'preapproval' );
684
+					give_update_payment_status($id, 'preapproval');
685 685
 					break;
686 686
 
687 687
 				case 'resend-receipt':
688
-					give_email_donation_receipt( $id, false );
688
+					give_email_donation_receipt($id, false);
689 689
 					break;
690 690
 			}// End switch().
691 691
 
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 			 * @param int    $id             The ID of the payment.
698 698
 			 * @param string $current_action The action that is being triggered.
699 699
 			 */
700
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
700
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
701 701
 		}// End foreach().
702 702
 
703 703
 	}
@@ -713,31 +713,31 @@  discard block
 block discarded – undo
713 713
 
714 714
 		$args = array();
715 715
 
716
-		if ( isset( $_GET['user'] ) ) {
717
-			$args['user'] = urldecode( $_GET['user'] );
718
-		} elseif ( isset( $_GET['donor'] ) ) {
719
-			$args['donor'] = absint( $_GET['donor'] );
720
-		} elseif ( isset( $_GET['s'] ) ) {
721
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
722
-			if ( $is_user ) {
723
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
724
-				unset( $args['s'] );
716
+		if (isset($_GET['user'])) {
717
+			$args['user'] = urldecode($_GET['user']);
718
+		} elseif (isset($_GET['donor'])) {
719
+			$args['donor'] = absint($_GET['donor']);
720
+		} elseif (isset($_GET['s'])) {
721
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
722
+			if ($is_user) {
723
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
724
+				unset($args['s']);
725 725
 			} else {
726
-				$args['s'] = sanitize_text_field( $_GET['s'] );
726
+				$args['s'] = sanitize_text_field($_GET['s']);
727 727
 			}
728 728
 		}
729 729
 
730
-		if ( ! empty( $_GET['start-date'] ) ) {
731
-			$args['start-date'] = urldecode( $_GET['start-date'] );
730
+		if ( ! empty($_GET['start-date'])) {
731
+			$args['start-date'] = urldecode($_GET['start-date']);
732 732
 		}
733 733
 
734
-		if ( ! empty( $_GET['end-date'] ) ) {
735
-			$args['end-date'] = urldecode( $_GET['end-date'] );
734
+		if ( ! empty($_GET['end-date'])) {
735
+			$args['end-date'] = urldecode($_GET['end-date']);
736 736
 		}
737 737
 
738
-		$args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
738
+		$args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
739 739
 
740
-		$payment_count           = give_count_payments( $args );
740
+		$payment_count           = give_count_payments($args);
741 741
 		$this->complete_count    = $payment_count->publish;
742 742
 		$this->pending_count     = $payment_count->pending;
743 743
 		$this->processing_count  = $payment_count->processing;
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 		$this->abandoned_count   = $payment_count->abandoned;
749 749
 		$this->preapproval_count = $payment_count->preapproval;
750 750
 
751
-		foreach ( $payment_count as $count ) {
751
+		foreach ($payment_count as $count) {
752 752
 			$this->total_count += $count;
753 753
 		}
754 754
 	}
@@ -763,28 +763,28 @@  discard block
 block discarded – undo
763 763
 	public function payments_data() {
764 764
 
765 765
 		$per_page   = $this->per_page;
766
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
767
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
768
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
769
-		$donor      = isset( $_GET['donor'] ) ? $_GET['donor'] : null;
770
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
771
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
772
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
773
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
774
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
775
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
776
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
777
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
778
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
779
-
780
-		if ( ! empty( $search ) ) {
766
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
767
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
768
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
769
+		$donor      = isset($_GET['donor']) ? $_GET['donor'] : null;
770
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
771
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
772
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
773
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
774
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
775
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
776
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
777
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
778
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
779
+
780
+		if ( ! empty($search)) {
781 781
 			$status = 'any'; // Force all payment statuses when searching.
782 782
 		}
783 783
 
784 784
 		$args = array(
785 785
 			'output'     => 'payments',
786 786
 			'number'     => $per_page,
787
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
787
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
788 788
 			'orderby'    => $orderby,
789 789
 			'order'      => $order,
790 790
 			'user'       => $user,
@@ -800,12 +800,12 @@  discard block
 block discarded – undo
800 800
 			'give_forms' => $form_id,
801 801
 		);
802 802
 
803
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
803
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
804 804
 			$args['search_in_notes'] = true;
805
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
805
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
806 806
 		}
807 807
 
808
-		$p_query = new Give_Payments_Query( $args );
808
+		$p_query = new Give_Payments_Query($args);
809 809
 
810 810
 		return $p_query->get_payments();
811 811
 
@@ -825,17 +825,17 @@  discard block
 block discarded – undo
825 825
 	 */
826 826
 	public function prepare_items() {
827 827
 
828
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
828
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
829 829
 
830 830
 		$columns  = $this->get_columns();
831 831
 		$hidden   = array(); // No hidden columns.
832 832
 		$sortable = $this->get_sortable_columns();
833 833
 		$data     = $this->payments_data();
834
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
834
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
835 835
 
836
-		$this->_column_headers = array( $columns, $hidden, $sortable );
836
+		$this->_column_headers = array($columns, $hidden, $sortable);
837 837
 
838
-		switch ( $status ) {
838
+		switch ($status) {
839 839
 			case 'publish':
840 840
 				$total_items = $this->complete_count;
841 841
 				break;
@@ -868,20 +868,20 @@  discard block
 block discarded – undo
868 868
 				break;
869 869
 			default:
870 870
 				// Retrieve the count of the non-default-Give status.
871
-				$count       = wp_count_posts( 'give_payment' );
872
-				$total_items = isset( $count->{$status} ) ? $count->{$status} : 0;
871
+				$count       = wp_count_posts('give_payment');
872
+				$total_items = isset($count->{$status} ) ? $count->{$status} : 0;
873 873
 				break;
874 874
 		}
875 875
 
876 876
 		$this->items = $data;
877 877
 
878
-		$this->set_pagination_args( array(
878
+		$this->set_pagination_args(array(
879 879
 			'total_items' => $total_items,
880 880
 			// We have to calculate the total number of items.
881 881
 			'per_page'    => $this->per_page,
882 882
 			// We have to determine how many items to show on a page.
883
-			'total_pages' => ceil( $total_items / $this->per_page ),
883
+			'total_pages' => ceil($total_items / $this->per_page),
884 884
 			// We have to calculate the total number of pages.
885
-		) );
885
+		));
886 886
 	}
887 887
 }
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +148 added lines, -148 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
 
@@ -23,36 +23,36 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	// Give Forms single post and archive options.
26
-	$give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) );
27
-	$give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) );
26
+	$give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular'));
27
+	$give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives'));
28 28
 
29
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
29
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
30 30
 	// Support for old 'GIVE_FORMS_SLUG' constant
31
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
31
+	if (defined('GIVE_FORMS_SLUG')) {
32 32
 		$give_forms_slug = GIVE_FORMS_SLUG;
33 33
 	}
34 34
 
35
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
35
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36 36
 		'slug'       => $give_forms_slug,
37 37
 		'with_front' => false,
38 38
 	);
39 39
 
40
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
41
-		'name'               => __( 'Donation Forms', 'give' ),
42
-		'singular_name'      => __( 'Form', 'give' ),
43
-		'add_new'            => __( 'Add Form', 'give' ),
44
-		'add_new_item'       => __( 'Add New Donation Form', 'give' ),
45
-		'edit_item'          => __( 'Edit Donation Form', 'give' ),
46
-		'new_item'           => __( 'New Form', 'give' ),
47
-		'all_items'          => __( 'All Forms', 'give' ),
48
-		'view_item'          => __( 'View Form', 'give' ),
49
-		'search_items'       => __( 'Search Forms', 'give' ),
50
-		'not_found'          => __( 'No forms found.', 'give' ),
51
-		'not_found_in_trash' => __( 'No forms found in Trash.', 'give' ),
40
+	$give_forms_labels = apply_filters('give_forms_labels', array(
41
+		'name'               => __('Donation Forms', 'give'),
42
+		'singular_name'      => __('Form', 'give'),
43
+		'add_new'            => __('Add Form', 'give'),
44
+		'add_new_item'       => __('Add New Donation Form', 'give'),
45
+		'edit_item'          => __('Edit Donation Form', 'give'),
46
+		'new_item'           => __('New Form', 'give'),
47
+		'all_items'          => __('All Forms', 'give'),
48
+		'view_item'          => __('View Form', 'give'),
49
+		'search_items'       => __('Search Forms', 'give'),
50
+		'not_found'          => __('No forms found.', 'give'),
51
+		'not_found_in_trash' => __('No forms found in Trash.', 'give'),
52 52
 		'parent_item_colon'  => '',
53
-		'menu_name'          => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ),
54
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ),
55
-	) );
53
+		'menu_name'          => apply_filters('give_menu_name', __('Donations', 'give')),
54
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')),
55
+	));
56 56
 
57 57
 	// Default give_forms supports.
58 58
 	$give_form_supports = array(
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 	);
65 65
 
66 66
 	// Has the user disabled the excerpt?
67
-	if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) {
68
-		unset( $give_form_supports[2] );
67
+	if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) {
68
+		unset($give_form_supports[2]);
69 69
 	}
70 70
 
71 71
 	// Has user disabled the featured image?
72
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
73
-		unset( $give_form_supports[1] );
74
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
72
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
73
+		unset($give_form_supports[1]);
74
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
75 75
 	}
76 76
 
77 77
 	$give_forms_args = array(
@@ -86,42 +86,42 @@  discard block
 block discarded – undo
86 86
 		'has_archive'        => $give_forms_archives,
87 87
 		'menu_icon'          => 'dashicons-give',
88 88
 		'hierarchical'       => false,
89
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
89
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
90 90
 	);
91
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
91
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
92 92
 
93 93
 	/** Donation Post Type */
94 94
 	$payment_labels = array(
95
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
96
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
97
-		'add_new'            => __( 'Add New', 'give' ),
98
-		'add_new_item'       => __( 'Add New Donation', 'give' ),
99
-		'edit_item'          => __( 'Edit Donation', 'give' ),
100
-		'new_item'           => __( 'New Donation', 'give' ),
101
-		'all_items'          => __( 'All Donations', 'give' ),
102
-		'view_item'          => __( 'View Donation', 'give' ),
103
-		'search_items'       => __( 'Search Donations', 'give' ),
104
-		'not_found'          => __( 'No donations found.', 'give' ),
105
-		'not_found_in_trash' => __( 'No donations found in Trash.', 'give' ),
95
+		'name'               => _x('Donations', 'post type general name', 'give'),
96
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
97
+		'add_new'            => __('Add New', 'give'),
98
+		'add_new_item'       => __('Add New Donation', 'give'),
99
+		'edit_item'          => __('Edit Donation', 'give'),
100
+		'new_item'           => __('New Donation', 'give'),
101
+		'all_items'          => __('All Donations', 'give'),
102
+		'view_item'          => __('View Donation', 'give'),
103
+		'search_items'       => __('Search Donations', 'give'),
104
+		'not_found'          => __('No donations found.', 'give'),
105
+		'not_found_in_trash' => __('No donations found in Trash.', 'give'),
106 106
 		'parent_item_colon'  => '',
107
-		'menu_name'          => __( 'Donations', 'give' ),
107
+		'menu_name'          => __('Donations', 'give'),
108 108
 	);
109 109
 
110 110
 	$payment_args = array(
111
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
111
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
112 112
 		'public'          => false,
113 113
 		'query_var'       => false,
114 114
 		'rewrite'         => false,
115 115
 		'map_meta_cap'    => true,
116 116
 		'capability_type' => 'give_payment',
117
-		'supports'        => array( 'title' ),
117
+		'supports'        => array('title'),
118 118
 		'can_export'      => true,
119 119
 	);
120
-	register_post_type( 'give_payment', $payment_args );
120
+	register_post_type('give_payment', $payment_args);
121 121
 
122 122
 }
123 123
 
124
-add_action( 'init', 'give_setup_post_types', 1 );
124
+add_action('init', 'give_setup_post_types', 1);
125 125
 
126 126
 
127 127
 /**
@@ -134,30 +134,30 @@  discard block
 block discarded – undo
134 134
  */
135 135
 function give_setup_taxonomies() {
136 136
 
137
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
137
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
138 138
 
139 139
 	/** Categories */
140 140
 	$category_labels = array(
141
-		'name'              => _x( 'Form Categories', 'taxonomy general name', 'give' ),
142
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
143
-		'search_items'      => __( 'Search Categories', 'give' ),
144
-		'all_items'         => __( 'All Categories', 'give' ),
145
-		'parent_item'       => __( 'Parent Category', 'give' ),
146
-		'parent_item_colon' => __( 'Parent Category:', 'give' ),
147
-		'edit_item'         => __( 'Edit Category', 'give' ),
148
-		'update_item'       => __( 'Update Category', 'give' ),
149
-		'add_new_item'      => __( 'Add New Category', 'give' ),
150
-		'new_item_name'     => __( 'New Category Name', 'give' ),
151
-		'menu_name'         => __( 'Categories', 'give' ),
141
+		'name'              => _x('Form Categories', 'taxonomy general name', 'give'),
142
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
143
+		'search_items'      => __('Search Categories', 'give'),
144
+		'all_items'         => __('All Categories', 'give'),
145
+		'parent_item'       => __('Parent Category', 'give'),
146
+		'parent_item_colon' => __('Parent Category:', 'give'),
147
+		'edit_item'         => __('Edit Category', 'give'),
148
+		'update_item'       => __('Update Category', 'give'),
149
+		'add_new_item'      => __('Add New Category', 'give'),
150
+		'new_item_name'     => __('New Category Name', 'give'),
151
+		'menu_name'         => __('Categories', 'give'),
152 152
 	);
153 153
 
154
-	$category_args = apply_filters( 'give_forms_category_args', array(
154
+	$category_args = apply_filters('give_forms_category_args', array(
155 155
 			'hierarchical' => true,
156
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
156
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
157 157
 			'show_ui'      => true,
158 158
 			'query_var'    => 'give_forms_category',
159 159
 			'rewrite'      => array(
160
-				'slug'         => $slug . '/category',
160
+				'slug'         => $slug.'/category',
161 161
 				'with_front'   => false,
162 162
 				'hierarchical' => true,
163 163
 			),
@@ -171,33 +171,33 @@  discard block
 block discarded – undo
171 171
 	);
172 172
 
173 173
 	// Does the user want categories?
174
-	if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
175
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
176
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
174
+	if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
175
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
176
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
177 177
 	}
178 178
 
179 179
 	/** Tags */
180 180
 	$tag_labels = array(
181
-		'name'                  => _x( 'Form Tags', 'taxonomy general name', 'give' ),
182
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
183
-		'search_items'          => __( 'Search Tags', 'give' ),
184
-		'all_items'             => __( 'All Tags', 'give' ),
185
-		'parent_item'           => __( 'Parent Tag', 'give' ),
186
-		'parent_item_colon'     => __( 'Parent Tag:', 'give' ),
187
-		'edit_item'             => __( 'Edit Tag', 'give' ),
188
-		'update_item'           => __( 'Update Tag', 'give' ),
189
-		'add_new_item'          => __( 'Add New Tag', 'give' ),
190
-		'new_item_name'         => __( 'New Tag Name', 'give' ),
191
-		'menu_name'             => __( 'Tags', 'give' ),
192
-		'choose_from_most_used' => __( 'Choose from most used tags.', 'give' ),
181
+		'name'                  => _x('Form Tags', 'taxonomy general name', 'give'),
182
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
183
+		'search_items'          => __('Search Tags', 'give'),
184
+		'all_items'             => __('All Tags', 'give'),
185
+		'parent_item'           => __('Parent Tag', 'give'),
186
+		'parent_item_colon'     => __('Parent Tag:', 'give'),
187
+		'edit_item'             => __('Edit Tag', 'give'),
188
+		'update_item'           => __('Update Tag', 'give'),
189
+		'add_new_item'          => __('Add New Tag', 'give'),
190
+		'new_item_name'         => __('New Tag Name', 'give'),
191
+		'menu_name'             => __('Tags', 'give'),
192
+		'choose_from_most_used' => __('Choose from most used tags.', 'give'),
193 193
 	);
194 194
 
195
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
195
+	$tag_args = apply_filters('give_forms_tag_args', array(
196 196
 			'hierarchical' => false,
197
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
197
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
198 198
 			'show_ui'      => true,
199 199
 			'query_var'    => 'give_forms_tag',
200
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
200
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
201 201
 			'capabilities' => array(
202 202
 				'manage_terms' => 'manage_give_form_terms',
203 203
 				'edit_terms'   => 'edit_give_form_terms',
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
 		)
208 208
 	);
209 209
 
210
-	if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
211
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
212
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
210
+	if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
211
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
212
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
213 213
 	}
214 214
 
215 215
 }
216 216
 
217
-add_action( 'init', 'give_setup_taxonomies', 0 );
217
+add_action('init', 'give_setup_taxonomies', 0);
218 218
 
219 219
 
220 220
 /**
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
  */
226 226
 function give_get_default_form_labels() {
227 227
 	$defaults = array(
228
-		'singular' => __( 'Form', 'give' ),
229
-		'plural'   => __( 'Forms', 'give' ),
228
+		'singular' => __('Form', 'give'),
229
+		'plural'   => __('Forms', 'give'),
230 230
 	);
231 231
 
232
-	return apply_filters( 'give_default_form_name', $defaults );
232
+	return apply_filters('give_default_form_name', $defaults);
233 233
 }
234 234
 
235 235
 /**
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
  *
242 242
  * @return string $defaults['singular'] Singular label
243 243
  */
244
-function give_get_forms_label_singular( $lowercase = false ) {
244
+function give_get_forms_label_singular($lowercase = false) {
245 245
 	$defaults = give_get_default_form_labels();
246 246
 
247
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
247
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
248 248
 }
249 249
 
250 250
 /**
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
  * @since 1.0
254 254
  * @return string $defaults['plural'] Plural label
255 255
  */
256
-function give_get_forms_label_plural( $lowercase = false ) {
256
+function give_get_forms_label_plural($lowercase = false) {
257 257
 	$defaults = give_get_default_form_labels();
258 258
 
259
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
259
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
260 260
 }
261 261
 
262 262
 /**
@@ -268,24 +268,24 @@  discard block
 block discarded – undo
268 268
  *
269 269
  * @return string $title New placeholder text
270 270
  */
271
-function give_change_default_title( $title ) {
271
+function give_change_default_title($title) {
272 272
 	// If a frontend plugin uses this filter (check extensions before changing this function)
273
-	if ( ! is_admin() ) {
274
-		$title = __( 'Enter form title here', 'give' );
273
+	if ( ! is_admin()) {
274
+		$title = __('Enter form title here', 'give');
275 275
 
276 276
 		return $title;
277 277
 	}
278 278
 
279 279
 	$screen = get_current_screen();
280 280
 
281
-	if ( 'give_forms' == $screen->post_type ) {
282
-		$title = __( 'Enter form title here', 'give' );
281
+	if ('give_forms' == $screen->post_type) {
282
+		$title = __('Enter form title here', 'give');
283 283
 	}
284 284
 
285 285
 	return $title;
286 286
 }
287 287
 
288
-add_filter( 'enter_title_here', 'give_change_default_title' );
288
+add_filter('enter_title_here', 'give_change_default_title');
289 289
 
290 290
 /**
291 291
  * Registers Custom Post Statuses which are used by the Payments
@@ -295,67 +295,67 @@  discard block
 block discarded – undo
295 295
  */
296 296
 function give_register_post_type_statuses() {
297 297
 	// Payment Statuses
298
-	register_post_status( 'refunded', array(
299
-		'label'                     => __( 'Refunded', 'give' ),
298
+	register_post_status('refunded', array(
299
+		'label'                     => __('Refunded', 'give'),
300 300
 		'public'                    => true,
301 301
 		'exclude_from_search'       => false,
302 302
 		'show_in_admin_all_list'    => true,
303 303
 		'show_in_admin_status_list' => true,
304
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ),
305
-	) );
306
-	register_post_status( 'failed', array(
307
-		'label'                     => __( 'Failed', 'give' ),
304
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'),
305
+	));
306
+	register_post_status('failed', array(
307
+		'label'                     => __('Failed', 'give'),
308 308
 		'public'                    => true,
309 309
 		'exclude_from_search'       => false,
310 310
 		'show_in_admin_all_list'    => true,
311 311
 		'show_in_admin_status_list' => true,
312
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ),
313
-	) );
314
-	register_post_status( 'revoked', array(
315
-		'label'                     => __( 'Revoked', 'give' ),
312
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'),
313
+	));
314
+	register_post_status('revoked', array(
315
+		'label'                     => __('Revoked', 'give'),
316 316
 		'public'                    => true,
317 317
 		'exclude_from_search'       => false,
318 318
 		'show_in_admin_all_list'    => true,
319 319
 		'show_in_admin_status_list' => true,
320
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ),
321
-	) );
322
-	register_post_status( 'cancelled', array(
323
-		'label'                     => __( 'Cancelled', 'give' ),
320
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'),
321
+	));
322
+	register_post_status('cancelled', array(
323
+		'label'                     => __('Cancelled', 'give'),
324 324
 		'public'                    => true,
325 325
 		'exclude_from_search'       => false,
326 326
 		'show_in_admin_all_list'    => true,
327 327
 		'show_in_admin_status_list' => true,
328
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ),
329
-	) );
330
-	register_post_status( 'abandoned', array(
331
-		'label'                     => __( 'Abandoned', 'give' ),
328
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'),
329
+	));
330
+	register_post_status('abandoned', array(
331
+		'label'                     => __('Abandoned', 'give'),
332 332
 		'public'                    => true,
333 333
 		'exclude_from_search'       => false,
334 334
 		'show_in_admin_all_list'    => true,
335 335
 		'show_in_admin_status_list' => true,
336
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ),
337
-	) );
338
-	register_post_status( 'processing', array(
339
-		'label'                     => _x( 'Processing', 'Processing payment status', 'give' ),
336
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'),
337
+	));
338
+	register_post_status('processing', array(
339
+		'label'                     => _x('Processing', 'Processing payment status', 'give'),
340 340
 		'public'                    => true,
341 341
 		'exclude_from_search'       => false,
342 342
 		'show_in_admin_all_list'    => true,
343 343
 		'show_in_admin_status_list' => true,
344
-		'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give' )
345
-	)  );
344
+		'label_count'               => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give')
345
+	));
346 346
 
347
-	register_post_status( 'preapproval', array(
348
-		'label'                     => _x( 'Preapproval', 'Preapproval payment status', 'give' ),
347
+	register_post_status('preapproval', array(
348
+		'label'                     => _x('Preapproval', 'Preapproval payment status', 'give'),
349 349
 		'public'                    => true,
350 350
 		'exclude_from_search'       => false,
351 351
 		'show_in_admin_all_list'    => true,
352 352
 		'show_in_admin_status_list' => true,
353
-		'label_count'               => _n_noop( 'Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give' ),
354
-	) );
353
+		'label_count'               => _n_noop('Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give'),
354
+	));
355 355
 
356 356
 }
357 357
 
358
-add_action( 'init', 'give_register_post_type_statuses' );
358
+add_action('init', 'give_register_post_type_statuses');
359 359
 
360 360
 /**
361 361
  * Updated Messages
@@ -368,27 +368,27 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return array $messages New post updated messages
370 370
  */
371
-function give_updated_messages( $messages ) {
371
+function give_updated_messages($messages) {
372 372
 	global $post, $post_ID;
373 373
 
374
-	if ( ! give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) {
374
+	if ( ! give_is_setting_enabled(give_get_option('forms_singular'))) {
375 375
 
376 376
 		$messages['give_forms'] = array(
377
-			1 => __( 'Form updated.', 'give' ),
378
-			4 => __( 'Form updated.', 'give' ),
379
-			6 => __( 'Form published.', 'give' ),
380
-			7 => __( 'Form saved.', 'give' ),
381
-			8 => __( 'Form submitted.', 'give' ),
377
+			1 => __('Form updated.', 'give'),
378
+			4 => __('Form updated.', 'give'),
379
+			6 => __('Form published.', 'give'),
380
+			7 => __('Form saved.', 'give'),
381
+			8 => __('Form submitted.', 'give'),
382 382
 		);
383 383
 
384 384
 	} else {
385 385
 
386 386
 		$messages['give_forms'] = array(
387
-			1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
388
-			4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
389
-			6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form published.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
390
-			7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form saved.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
391
-			8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form submitted.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
387
+			1 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
388
+			4 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
389
+			6 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form published.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
390
+			7 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form saved.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
391
+			8 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form submitted.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
392 392
 		);
393 393
 
394 394
 	}
@@ -396,27 +396,27 @@  discard block
 block discarded – undo
396 396
 	return $messages;
397 397
 }
398 398
 
399
-add_filter( 'post_updated_messages', 'give_updated_messages' );
399
+add_filter('post_updated_messages', 'give_updated_messages');
400 400
 
401 401
 
402 402
 /**
403 403
  * Setup Post Type Images
404 404
  */
405
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
405
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
406 406
 
407 407
 /**
408 408
  * Ensure post thumbnail support is turned on
409 409
  */
410 410
 function give_add_thumbnail_support() {
411
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
411
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
412 412
 		return;
413 413
 	}
414 414
 
415
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
416
-		add_theme_support( 'post-thumbnails' );
415
+	if ( ! current_theme_supports('post-thumbnails')) {
416
+		add_theme_support('post-thumbnails');
417 417
 	}
418 418
 
419
-	add_post_type_support( 'give_forms', 'thumbnail' );
419
+	add_post_type_support('give_forms', 'thumbnail');
420 420
 }
421 421
 
422 422
 /**
@@ -428,21 +428,21 @@  discard block
 block discarded – undo
428 428
 
429 429
 	// Single Give Forms (disabled if single turned off in settings)
430 430
 	if (
431
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) )
432
-		&& give_is_setting_enabled( give_get_option( 'form_sidebar' ) )
431
+		give_is_setting_enabled(give_get_option('forms_singular'))
432
+		&& give_is_setting_enabled(give_get_option('form_sidebar'))
433 433
 	) {
434 434
 
435
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
436
-			'name'          => __( 'Give Single Form Sidebar', 'give' ),
435
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
436
+			'name'          => __('Give Single Form Sidebar', 'give'),
437 437
 			'id'            => 'give-forms-sidebar',
438
-			'description'   => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
438
+			'description'   => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
439 439
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
440 440
 			'after_widget'  => '</div>',
441 441
 			'before_title'  => '<h3 class="widgettitle widget-title">',
442 442
 			'after_title'   => '</h3>',
443
-		) ) );
443
+		)));
444 444
 
445 445
 	}
446 446
 }
447 447
 
448
-add_action( 'widgets_init', 'give_widgets_init', 999 );
448
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.