Test Failed
Pull Request — master (#2814)
by Devin
05:29
created
includes/template-functions.php 1 patch
Spacing   +89 added lines, -89 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
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @return string
22 22
  */
23 23
 function give_get_templates_dir() {
24
-	return GIVE_PLUGIN_DIR . 'templates';
24
+	return GIVE_PLUGIN_DIR.'templates';
25 25
 }
26 26
 
27 27
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @return string
32 32
  */
33 33
 function give_get_templates_url() {
34
-	return GIVE_PLUGIN_URL . 'templates';
34
+	return GIVE_PLUGIN_URL.'templates';
35 35
 }
36 36
 
37 37
 /**
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
  * @param string $template_path Template file path. Default is empty.
45 45
  * @param string $default_path  Default path. Default is empty.
46 46
  */
47
-function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
48
-	if ( ! empty( $args ) && is_array( $args ) ) {
49
-		extract( $args );
47
+function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') {
48
+	if ( ! empty($args) && is_array($args)) {
49
+		extract($args);
50 50
 	}
51 51
 
52 52
 	$template_names = "{$template_name}.php";
53 53
 
54
-	$located = give_get_locate_template( $template_names, $template_path, $default_path );
54
+	$located = give_get_locate_template($template_names, $template_path, $default_path);
55 55
 
56
-	if ( ! file_exists( $located ) ) {
56
+	if ( ! file_exists($located)) {
57 57
 		/* translators: %s: the template */
58
-		Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
58
+		Give()->notices->print_frontend_notice(sprintf(__('The %s template was not found.', 'give'), $located), true);
59 59
 
60 60
 		return;
61 61
 	}
62 62
 
63 63
 	// Allow 3rd party plugin filter template file from their plugin.
64
-	$located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path );
64
+	$located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path);
65 65
 
66 66
 	/**
67 67
 	 * Fires in give template, before the file is included.
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 * @param string $located       Template file filter by 3rd party plugin.
76 76
 	 * @param array  $args          Passed arguments.
77 77
 	 */
78
-	do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
78
+	do_action('give_before_template_part', $template_name, $template_path, $located, $args);
79 79
 
80
-	include( $located );
80
+	include($located);
81 81
 
82 82
 	/**
83 83
 	 * Fires in give template, after the file is included.
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @param string $located       Template file filter by 3rd party plugin.
92 92
 	 * @param array  $args          Passed arguments.
93 93
 	 */
94
-	do_action( 'give_after_template_part', $template_name, $template_path, $located, $args );
94
+	do_action('give_after_template_part', $template_name, $template_path, $located, $args);
95 95
 }
96 96
 
97 97
 /**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return string
109 109
  */
110
-function give_get_template_part( $slug, $name = null, $load = true ) {
110
+function give_get_template_part($slug, $name = null, $load = true) {
111 111
 
112 112
 	/**
113 113
 	 * Fires in give template part, before the template part is retrieved.
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
 	 * @param string $slug Template part file slug {slug}.php.
120 120
 	 * @param string $name Template part file name {slug}-{name}.php.
121 121
 	 */
122
-	do_action( "get_template_part_{$slug}", $slug, $name );
122
+	do_action("get_template_part_{$slug}", $slug, $name);
123 123
 
124 124
 	// Setup possible parts
125 125
 	$templates = array();
126
-	if ( isset( $name ) ) {
127
-		$templates[] = $slug . '-' . $name . '.php';
126
+	if (isset($name)) {
127
+		$templates[] = $slug.'-'.$name.'.php';
128 128
 	}
129
-	$templates[] = $slug . '.php';
129
+	$templates[] = $slug.'.php';
130 130
 
131 131
 	// Allow template parts to be filtered
132
-	$templates = apply_filters( 'give_get_template_part', $templates, $slug, $name );
132
+	$templates = apply_filters('give_get_template_part', $templates, $slug, $name);
133 133
 
134 134
 	// Return the part that is found
135
-	return give_locate_template( $templates, $load, false );
135
+	return give_locate_template($templates, $load, false);
136 136
 }
137 137
 
138 138
 /**
@@ -153,37 +153,37 @@  discard block
 block discarded – undo
153 153
  *
154 154
  * @return string The template filename if one is located.
155 155
  */
156
-function give_locate_template( $template_names, $load = false, $require_once = true ) {
156
+function give_locate_template($template_names, $load = false, $require_once = true) {
157 157
 	// No file found yet
158 158
 	$located = false;
159 159
 
160 160
 	// Try to find a template file
161
-	foreach ( (array) $template_names as $template_name ) {
161
+	foreach ((array) $template_names as $template_name) {
162 162
 
163 163
 		// Continue if template is empty
164
-		if ( empty( $template_name ) ) {
164
+		if (empty($template_name)) {
165 165
 			continue;
166 166
 		}
167 167
 
168 168
 		// Trim off any slashes from the template name
169
-		$template_name = ltrim( $template_name, '/' );
169
+		$template_name = ltrim($template_name, '/');
170 170
 
171 171
 		// try locating this template file by looping through the template paths
172
-		foreach ( give_get_theme_template_paths() as $template_path ) {
172
+		foreach (give_get_theme_template_paths() as $template_path) {
173 173
 
174
-			if ( file_exists( $template_path . $template_name ) ) {
175
-				$located = $template_path . $template_name;
174
+			if (file_exists($template_path.$template_name)) {
175
+				$located = $template_path.$template_name;
176 176
 				break;
177 177
 			}
178 178
 		}
179 179
 
180
-		if ( $located ) {
180
+		if ($located) {
181 181
 			break;
182 182
 		}
183 183
 	}
184 184
 
185
-	if ( ( true == $load ) && ! empty( $located ) ) {
186
-		load_template( $located, $require_once );
185
+	if ((true == $load) && ! empty($located)) {
186
+		load_template($located, $require_once);
187 187
 	}
188 188
 
189 189
 	return $located;
@@ -207,26 +207,26 @@  discard block
 block discarded – undo
207 207
  *
208 208
  * @return string
209 209
  */
210
-function give_get_locate_template( $template_name, $template_path = '', $default_path = '' ) {
211
-	if ( ! $template_path ) {
212
-		$template_path = give_get_theme_template_dir_name() . '/';
210
+function give_get_locate_template($template_name, $template_path = '', $default_path = '') {
211
+	if ( ! $template_path) {
212
+		$template_path = give_get_theme_template_dir_name().'/';
213 213
 	}
214 214
 
215
-	if ( ! $default_path ) {
216
-		$default_path = GIVE_PLUGIN_DIR . 'templates/';
215
+	if ( ! $default_path) {
216
+		$default_path = GIVE_PLUGIN_DIR.'templates/';
217 217
 	}
218 218
 
219 219
 	// Look within passed path within the theme - this is priority.
220 220
 	$template = locate_template(
221 221
 		array(
222
-			trailingslashit( $template_path ) . $template_name,
222
+			trailingslashit($template_path).$template_name,
223 223
 			$template_name,
224 224
 		)
225 225
 	);
226 226
 
227 227
 	// Get default template/
228
-	if ( ! $template ) {
229
-		$template = $default_path . $template_name;
228
+	if ( ! $template) {
229
+		$template = $default_path.$template_name;
230 230
 	}
231 231
 
232 232
 	/**
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 *
235 235
 	 * @since 2.0.3
236 236
 	 */
237
-	return apply_filters( 'give_get_locate_template', $template, $template_name, $template_path );
237
+	return apply_filters('give_get_locate_template', $template, $template_name, $template_path);
238 238
 }
239 239
 
240 240
 /**
@@ -248,17 +248,17 @@  discard block
 block discarded – undo
248 248
 	$template_dir = give_get_theme_template_dir_name();
249 249
 
250 250
 	$file_paths = array(
251
-		1   => trailingslashit( get_stylesheet_directory() ) . $template_dir,
252
-		10  => trailingslashit( get_template_directory() ) . $template_dir,
251
+		1   => trailingslashit(get_stylesheet_directory()).$template_dir,
252
+		10  => trailingslashit(get_template_directory()).$template_dir,
253 253
 		100 => give_get_templates_dir(),
254 254
 	);
255 255
 
256
-	$file_paths = apply_filters( 'give_template_paths', $file_paths );
256
+	$file_paths = apply_filters('give_template_paths', $file_paths);
257 257
 
258 258
 	// sort the file paths based on priority
259
-	ksort( $file_paths, SORT_NUMERIC );
259
+	ksort($file_paths, SORT_NUMERIC);
260 260
 
261
-	return array_map( 'trailingslashit', $file_paths );
261
+	return array_map('trailingslashit', $file_paths);
262 262
 }
263 263
 
264 264
 /**
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
  * @return string
271 271
  */
272 272
 function give_get_theme_template_dir_name() {
273
-	return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) );
273
+	return trailingslashit(apply_filters('give_templates_dir', 'give'));
274 274
 }
275 275
 
276 276
 /**
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
  * @return void
281 281
  */
282 282
 function give_version_in_header() {
283
-	echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n";
283
+	echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n";
284 284
 }
285 285
 
286
-add_action( 'wp_head', 'give_version_in_header' );
286
+add_action('wp_head', 'give_version_in_header');
287 287
 
288 288
 /**
289 289
  * Determines if we're currently on the Donations History page.
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
  */
294 294
 function give_is_donation_history_page() {
295 295
 
296
-	$ret = is_page( give_get_option( 'history_page' ) );
296
+	$ret = is_page(give_get_option('history_page'));
297 297
 
298
-	return apply_filters( 'give_is_donation_history_page', $ret );
298
+	return apply_filters('give_is_donation_history_page', $ret);
299 299
 }
300 300
 
301 301
 /**
@@ -307,25 +307,25 @@  discard block
 block discarded – undo
307 307
  *
308 308
  * @return array Modified array of classes
309 309
  */
310
-function give_add_body_classes( $class ) {
310
+function give_add_body_classes($class) {
311 311
 	$classes = (array) $class;
312 312
 
313
-	if ( give_is_success_page() ) {
313
+	if (give_is_success_page()) {
314 314
 		$classes[] = 'give-success';
315 315
 		$classes[] = 'give-page';
316 316
 	}
317 317
 
318
-	if ( give_is_failed_transaction_page() ) {
318
+	if (give_is_failed_transaction_page()) {
319 319
 		$classes[] = 'give-failed-transaction';
320 320
 		$classes[] = 'give-page';
321 321
 	}
322 322
 
323
-	if ( give_is_donation_history_page() ) {
323
+	if (give_is_donation_history_page()) {
324 324
 		$classes[] = 'give-donation-history';
325 325
 		$classes[] = 'give-page';
326 326
 	}
327 327
 
328
-	if ( give_is_test_mode() ) {
328
+	if (give_is_test_mode()) {
329 329
 		$classes[] = 'give-test-mode';
330 330
 		$classes[] = 'give-page';
331 331
 	}
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	/* @var WP_Theme $current_theme */
335 335
 	$current_theme = wp_get_theme();
336 336
 
337
-	switch ( $current_theme->get_template() ) {
337
+	switch ($current_theme->get_template()) {
338 338
 
339 339
 		case 'Divi':
340 340
 			$classes[] = 'give-divi';
@@ -351,10 +351,10 @@  discard block
 block discarded – undo
351 351
 
352 352
 	}
353 353
 
354
-	return array_unique( $classes );
354
+	return array_unique($classes);
355 355
 }
356 356
 
357
-add_filter( 'body_class', 'give_add_body_classes' );
357
+add_filter('body_class', 'give_add_body_classes');
358 358
 
359 359
 
360 360
 /**
@@ -370,22 +370,22 @@  discard block
 block discarded – undo
370 370
  *
371 371
  * @return array
372 372
  */
373
-function give_add_post_class( $classes, $class = '', $post_id = '' ) {
374
-	if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) {
373
+function give_add_post_class($classes, $class = '', $post_id = '') {
374
+	if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) {
375 375
 		return $classes;
376 376
 	}
377 377
 
378 378
 	//@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc).
379 379
 
380
-	if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) {
381
-		unset( $classes[ $key ] );
380
+	if (false !== ($key = array_search('hentry', $classes))) {
381
+		unset($classes[$key]);
382 382
 	}
383 383
 
384 384
 	return $classes;
385 385
 }
386 386
 
387 387
 
388
-add_filter( 'post_class', 'give_add_post_class', 20, 3 );
388
+add_filter('post_class', 'give_add_post_class', 20, 3);
389 389
 
390 390
 /**
391 391
  * Get the placeholder image URL for forms etc
@@ -395,74 +395,74 @@  discard block
 block discarded – undo
395 395
  */
396 396
 function give_get_placeholder_img_src() {
397 397
 
398
-	$placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) );
398
+	$placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give'));
399 399
 
400
-	return apply_filters( 'give_placeholder_img_src', $placeholder_url );
400
+	return apply_filters('give_placeholder_img_src', $placeholder_url);
401 401
 }
402 402
 
403 403
 
404 404
 /**
405 405
  * Global
406 406
  */
407
-if ( ! function_exists( 'give_output_content_wrapper' ) ) {
407
+if ( ! function_exists('give_output_content_wrapper')) {
408 408
 
409 409
 	/**
410 410
 	 * Output the start of the page wrapper.
411 411
 	 */
412 412
 	function give_output_content_wrapper() {
413
-		give_get_template_part( 'global/wrapper-start' );
413
+		give_get_template_part('global/wrapper-start');
414 414
 	}
415 415
 }
416
-if ( ! function_exists( 'give_output_content_wrapper_end' ) ) {
416
+if ( ! function_exists('give_output_content_wrapper_end')) {
417 417
 
418 418
 	/**
419 419
 	 * Output the end of the page wrapper.
420 420
 	 */
421 421
 	function give_output_content_wrapper_end() {
422
-		give_get_template_part( 'global/wrapper-end' );
422
+		give_get_template_part('global/wrapper-end');
423 423
 	}
424 424
 }
425 425
 
426 426
 /**
427 427
  * Single Give Form
428 428
  */
429
-if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) {
429
+if ( ! function_exists('give_left_sidebar_pre_wrap')) {
430 430
 	function give_left_sidebar_pre_wrap() {
431
-		echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' );
431
+		echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">');
432 432
 	}
433 433
 }
434 434
 
435
-if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) {
435
+if ( ! function_exists('give_left_sidebar_post_wrap')) {
436 436
 	function give_left_sidebar_post_wrap() {
437
-		echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' );
437
+		echo apply_filters('give_left_sidebar_post_wrap', '</div>');
438 438
 	}
439 439
 }
440 440
 
441
-if ( ! function_exists( 'give_get_forms_sidebar' ) ) {
441
+if ( ! function_exists('give_get_forms_sidebar')) {
442 442
 	function give_get_forms_sidebar() {
443
-		give_get_template_part( 'single-give-form/sidebar' );
443
+		give_get_template_part('single-give-form/sidebar');
444 444
 	}
445 445
 }
446 446
 
447
-if ( ! function_exists( 'give_show_form_images' ) ) {
447
+if ( ! function_exists('give_show_form_images')) {
448 448
 
449 449
 	/**
450 450
 	 * Output the donation form featured image.
451 451
 	 */
452 452
 	function give_show_form_images() {
453
-		if ( give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
454
-			give_get_template_part( 'single-give-form/featured-image' );
453
+		if (give_is_setting_enabled(give_get_option('form_featured_img'))) {
454
+			give_get_template_part('single-give-form/featured-image');
455 455
 		}
456 456
 	}
457 457
 }
458 458
 
459
-if ( ! function_exists( 'give_template_single_title' ) ) {
459
+if ( ! function_exists('give_template_single_title')) {
460 460
 
461 461
 	/**
462 462
 	 * Output the form title.
463 463
 	 */
464 464
 	function give_template_single_title() {
465
-		give_get_template_part( 'single-give-form/title' );
465
+		give_get_template_part('single-give-form/title');
466 466
 	}
467 467
 }
468 468
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
  * Conditional Functions
471 471
  */
472 472
 
473
-if ( ! function_exists( 'is_give_form' ) ) {
473
+if ( ! function_exists('is_give_form')) {
474 474
 
475 475
 	/**
476 476
 	 * is_give_form
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
 	 * @return bool
483 483
 	 */
484 484
 	function is_give_form() {
485
-		return is_singular( array( 'give_form' ) );
485
+		return is_singular(array('give_form'));
486 486
 	}
487 487
 }
488 488
 
489
-if ( ! function_exists( 'is_give_category' ) ) {
489
+if ( ! function_exists('is_give_category')) {
490 490
 
491 491
 	/**
492 492
 	 * is_give_category
@@ -501,12 +501,12 @@  discard block
 block discarded – undo
501 501
 	 *
502 502
 	 * @return bool
503 503
 	 */
504
-	function is_give_category( $term = '' ) {
505
-		return is_tax( 'give_forms_category', $term );
504
+	function is_give_category($term = '') {
505
+		return is_tax('give_forms_category', $term);
506 506
 	}
507 507
 }
508 508
 
509
-if ( ! function_exists( 'is_give_tag' ) ) {
509
+if ( ! function_exists('is_give_tag')) {
510 510
 
511 511
 	/**
512 512
 	 * is_give_tag
@@ -521,12 +521,12 @@  discard block
 block discarded – undo
521 521
 	 *
522 522
 	 * @return bool
523 523
 	 */
524
-	function is_give_tag( $term = '' ) {
525
-		return is_tax( 'give_forms_tag', $term );
524
+	function is_give_tag($term = '') {
525
+		return is_tax('give_forms_tag', $term);
526 526
 	}
527 527
 }
528 528
 
529
-if ( ! function_exists( 'is_give_taxonomy' ) ) {
529
+if ( ! function_exists('is_give_taxonomy')) {
530 530
 
531 531
 	/**
532 532
 	 * is_give_taxonomy
@@ -538,6 +538,6 @@  discard block
 block discarded – undo
538 538
 	 * @return bool
539 539
 	 */
540 540
 	function is_give_taxonomy() {
541
-		return is_tax( get_object_taxonomies( 'give_form' ) );
541
+		return is_tax(get_object_taxonomies('give_form'));
542 542
 	}
543 543
 }
Please login to merge, or discard this patch.
includes/login-register.php 1 patch
Spacing   +99 added lines, -99 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
 
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return string Login form
28 28
  */
29
-function give_login_form( $login_redirect = '', $logout_redirect = '' ) {
29
+function give_login_form($login_redirect = '', $logout_redirect = '') {
30 30
 
31
-	if ( empty( $login_redirect ) ) {
32
-		$login_redirect = add_query_arg( 'give-login-success', 'true', give_get_history_page_uri() );
31
+	if (empty($login_redirect)) {
32
+		$login_redirect = add_query_arg('give-login-success', 'true', give_get_history_page_uri());
33 33
 	}
34 34
 
35
-	if ( empty( $logout_redirect ) ) {
36
-		$logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
35
+	if (empty($logout_redirect)) {
36
+		$logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url());
37 37
 	}
38 38
 
39 39
 	// Add user_logout action to logout url.
40 40
 	$logout_redirect = add_query_arg(
41 41
 		array(
42 42
 			'give_action'          => 'user_logout',
43
-			'give_logout_nonce'    => wp_create_nonce( 'give-logout-nonce' ),
44
-			'give_logout_redirect' => urlencode( $logout_redirect ),
43
+			'give_logout_nonce'    => wp_create_nonce('give-logout-nonce'),
44
+			'give_logout_redirect' => urlencode($logout_redirect),
45 45
 		),
46
-		home_url( '/' )
46
+		home_url('/')
47 47
 	);
48 48
 
49 49
 	ob_start();
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		)
57 57
 	);
58 58
 
59
-	return apply_filters( 'give_login_form', ob_get_clean() );
59
+	return apply_filters('give_login_form', ob_get_clean());
60 60
 }
61 61
 
62 62
 /**
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
  *
70 70
  * @return string Register form
71 71
  */
72
-function give_register_form( $redirect = '' ) {
73
-	if ( empty( $redirect ) ) {
72
+function give_register_form($redirect = '') {
73
+	if (empty($redirect)) {
74 74
 		$redirect = give_get_current_page_url();
75 75
 	}
76 76
 
77 77
 	ob_start();
78 78
 
79
-	if ( ! is_user_logged_in() ) {
79
+	if ( ! is_user_logged_in()) {
80 80
 		give_get_template(
81 81
 			'shortcode-register',
82 82
 			array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		);
86 86
 	}
87 87
 
88
-	return apply_filters( 'give_register_form', ob_get_clean() );
88
+	return apply_filters('give_register_form', ob_get_clean());
89 89
 }
90 90
 
91 91
 /**
@@ -97,40 +97,40 @@  discard block
 block discarded – undo
97 97
  *
98 98
  * @return void
99 99
  */
100
-function give_process_login_form( $data ) {
101
-	if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) {
100
+function give_process_login_form($data) {
101
+	if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) {
102 102
 
103 103
 		// Set Receipt Access Session.
104
-		if ( ! empty( $_GET['payment_key'] ) ) {
105
-			Give()->session->set( 'receipt_access', true );
104
+		if ( ! empty($_GET['payment_key'])) {
105
+			Give()->session->set('receipt_access', true);
106 106
 		}
107 107
 
108
-		$user_data = get_user_by( 'login', $data['give_user_login'] );
109
-		if ( ! $user_data ) {
110
-			$user_data = get_user_by( 'email', $data['give_user_login'] );
108
+		$user_data = get_user_by('login', $data['give_user_login']);
109
+		if ( ! $user_data) {
110
+			$user_data = get_user_by('email', $data['give_user_login']);
111 111
 		}
112
-		if ( $user_data ) {
112
+		if ($user_data) {
113 113
 			$user_ID    = $user_data->ID;
114 114
 			$user_email = $user_data->user_email;
115
-			if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_ID ) ) {
116
-				give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] );
115
+			if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_ID)) {
116
+				give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']);
117 117
 			} else {
118
-				give_set_error( 'password_incorrect', __( 'The password you entered is incorrect.', 'give' ) );
118
+				give_set_error('password_incorrect', __('The password you entered is incorrect.', 'give'));
119 119
 			}
120 120
 		} else {
121
-			give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
121
+			give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
122 122
 		}
123 123
 		// Check for errors and redirect if none present
124 124
 		$errors = give_get_errors();
125
-		if ( ! $errors ) {
126
-			$redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID );
127
-			wp_redirect( $redirect );
125
+		if ( ! $errors) {
126
+			$redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID);
127
+			wp_redirect($redirect);
128 128
 			give_die();
129 129
 		}
130 130
 	}
131 131
 }
132 132
 
133
-add_action( 'give_user_login', 'give_process_login_form' );
133
+add_action('give_user_login', 'give_process_login_form');
134 134
 
135 135
 
136 136
 /**
@@ -142,18 +142,18 @@  discard block
 block discarded – undo
142 142
  *
143 143
  * @return void
144 144
  */
145
-function give_process_user_logout( $data ) {
146
-	if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
145
+function give_process_user_logout($data) {
146
+	if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) {
147 147
 
148 148
 		// Prevent occurring of any custom action on wp_logout.
149
-		remove_all_actions( 'wp_logout' );
149
+		remove_all_actions('wp_logout');
150 150
 
151 151
 		/**
152 152
 		 * Fires before processing user logout.
153 153
 		 *
154 154
 		 * @since 1.0
155 155
 		 */
156
-		do_action( 'give_before_user_logout' );
156
+		do_action('give_before_user_logout');
157 157
 
158 158
 		// Logout user.
159 159
 		wp_logout();
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 		 *
164 164
 		 * @since 1.0
165 165
 		 */
166
-		do_action( 'give_after_user_logout' );
166
+		do_action('give_after_user_logout');
167 167
 
168
-		wp_redirect( $data['give_logout_redirect'] );
168
+		wp_redirect($data['give_logout_redirect']);
169 169
 		give_die();
170 170
 	}
171 171
 }
172 172
 
173
-add_action( 'give_user_logout', 'give_process_user_logout' );
173
+add_action('give_user_logout', 'give_process_user_logout');
174 174
 
175 175
 /**
176 176
  * Log User In
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
  *
184 184
  * @return bool
185 185
  */
186
-function give_log_user_in( $user_id, $user_login, $user_pass ) {
186
+function give_log_user_in($user_id, $user_login, $user_pass) {
187 187
 
188
-	if ( $user_id < 1 ) {
188
+	if ($user_id < 1) {
189 189
 		return false;
190 190
 	}
191 191
 
192
-	wp_set_auth_cookie( $user_id );
193
-	wp_set_current_user( $user_id, $user_login );
192
+	wp_set_auth_cookie($user_id);
193
+	wp_set_current_user($user_id, $user_login);
194 194
 
195 195
 	/**
196 196
 	 * Fires after the user has successfully logged in.
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @param string $user_login Username.
201 201
 	 * @param WP_User $$user      WP_User object of the logged-in user.
202 202
 	 */
203
-	do_action( 'wp_login', $user_login, get_userdata( $user_id ) );
203
+	do_action('wp_login', $user_login, get_userdata($user_id));
204 204
 
205 205
 	/**
206 206
 	 * Fires after give user has successfully logged in.
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	 * @param string $user_login Username.
212 212
 	 * @param string $user_pass  User password.
213 213
 	 */
214
-	do_action( 'give_log_user_in', $user_id, $user_login, $user_pass );
214
+	do_action('give_log_user_in', $user_id, $user_login, $user_pass);
215 215
 }
216 216
 
217 217
 
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
  *
225 225
  * @return bool
226 226
  */
227
-function give_process_register_form( $data ) {
227
+function give_process_register_form($data) {
228 228
 
229
-	if ( is_user_logged_in() ) {
229
+	if (is_user_logged_in()) {
230 230
 		return false;
231 231
 	}
232 232
 
233
-	if ( empty( $_POST['give_register_submit'] ) ) {
233
+	if (empty($_POST['give_register_submit'])) {
234 234
 		return false;
235 235
 	}
236 236
 
@@ -239,38 +239,38 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @since 1.0
241 241
 	 */
242
-	do_action( 'give_pre_process_register_form' );
242
+	do_action('give_pre_process_register_form');
243 243
 
244
-	if ( empty( $data['give_user_login'] ) ) {
245
-		give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) );
244
+	if (empty($data['give_user_login'])) {
245
+		give_set_error('empty_username', esc_html__('Invalid username.', 'give'));
246 246
 	}
247 247
 
248
-	if ( username_exists( $data['give_user_login'] ) ) {
249
-		give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) );
248
+	if (username_exists($data['give_user_login'])) {
249
+		give_set_error('username_unavailable', esc_html__('Username already taken.', 'give'));
250 250
 	}
251 251
 
252
-	if ( ! validate_username( $data['give_user_login'] ) ) {
253
-		give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) );
252
+	if ( ! validate_username($data['give_user_login'])) {
253
+		give_set_error('username_invalid', esc_html__('Invalid username.', 'give'));
254 254
 	}
255 255
 
256
-	if ( email_exists( $data['give_user_email'] ) ) {
257
-		give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) );
256
+	if (email_exists($data['give_user_email'])) {
257
+		give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give'));
258 258
 	}
259 259
 
260
-	if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) {
261
-		give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
260
+	if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) {
261
+		give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
262 262
 	}
263 263
 
264
-	if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) {
265
-		give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) );
264
+	if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) {
265
+		give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give'));
266 266
 	}
267 267
 
268
-	if ( empty( $_POST['give_user_pass'] ) ) {
269
-		give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) );
268
+	if (empty($_POST['give_user_pass'])) {
269
+		give_set_error('empty_password', esc_html__('Please enter a password.', 'give'));
270 270
 	}
271 271
 
272
-	if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) {
273
-		give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) );
272
+	if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) {
273
+		give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give'));
274 274
 	}
275 275
 
276 276
 	/**
@@ -278,29 +278,29 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @since 1.0
280 280
 	 */
281
-	do_action( 'give_process_register_form' );
281
+	do_action('give_process_register_form');
282 282
 
283 283
 	// Check for errors and redirect if none present
284 284
 	$errors = give_get_errors();
285 285
 
286
-	if ( empty( $errors ) ) {
286
+	if (empty($errors)) {
287 287
 
288
-		$redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] );
288
+		$redirect = apply_filters('give_register_redirect', $data['give_redirect']);
289 289
 
290
-		give_register_and_login_new_user( array(
290
+		give_register_and_login_new_user(array(
291 291
 			'user_login'      => $data['give_user_login'],
292 292
 			'user_pass'       => $data['give_user_pass'],
293 293
 			'user_email'      => $data['give_user_email'],
294
-			'user_registered' => date( 'Y-m-d H:i:s' ),
295
-			'role'            => get_option( 'default_role' ),
296
-		) );
294
+			'user_registered' => date('Y-m-d H:i:s'),
295
+			'role'            => get_option('default_role'),
296
+		));
297 297
 
298
-		wp_redirect( $redirect );
298
+		wp_redirect($redirect);
299 299
 		give_die();
300 300
 	}
301 301
 }
302 302
 
303
-add_action( 'give_user_register', 'give_process_register_form' );
303
+add_action('give_user_register', 'give_process_register_form');
304 304
 
305 305
 
306 306
 /**
@@ -313,24 +313,24 @@  discard block
 block discarded – undo
313 313
 function give_email_access_login() {
314 314
 
315 315
 	// Verify nonce.
316
-	if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'give' ) ) {
316
+	if ( ! isset($_POST['_wpnonce']) || ! wp_verify_nonce($_POST['_wpnonce'], 'give')) {
317 317
 		return false;
318 318
 	}
319 319
 
320 320
 	// Need email to proceed.
321
-	$email = isset( $_POST['give_email'] ) ? give_clean( $_POST['give_email'] ) : '';
322
-	if ( empty( $email ) ) {
323
-		give_set_error( 'give_empty_email', __( 'Please enter the email address you used for your donation.', 'give' ) );
321
+	$email = isset($_POST['give_email']) ? give_clean($_POST['give_email']) : '';
322
+	if (empty($email)) {
323
+		give_set_error('give_empty_email', __('Please enter the email address you used for your donation.', 'give'));
324 324
 	}
325 325
 
326
-	$recaptcha_key    = give_get_option( 'recaptcha_key' );
327
-	$recaptcha_secret = give_get_option( 'recaptcha_secret' );
326
+	$recaptcha_key    = give_get_option('recaptcha_key');
327
+	$recaptcha_secret = give_get_option('recaptcha_secret');
328 328
 
329
-	$enable_recaptcha = ( give_is_setting_enabled( give_get_option( 'enable_recaptcha' ) ) ) && ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ? true : false;
330
-	$access_token     = ! empty( $_GET['payment_key'] ) ? $_GET['payment_key'] : '';
329
+	$enable_recaptcha = (give_is_setting_enabled(give_get_option('enable_recaptcha'))) && ! empty($recaptcha_key) && ! empty($recaptcha_secret) ? true : false;
330
+	$access_token     = ! empty($_GET['payment_key']) ? $_GET['payment_key'] : '';
331 331
 
332 332
 	// Use reCAPTCHA.
333
-	if ( $enable_recaptcha ) {
333
+	if ($enable_recaptcha) {
334 334
 
335 335
 		$args = array(
336 336
 			'secret'   => $recaptcha_secret,
@@ -338,43 +338,43 @@  discard block
 block discarded – undo
338 338
 			'remoteip' => $_POST['give_ip'],
339 339
 		);
340 340
 
341
-		if ( ! empty( $args['response'] ) ) {
342
-			$request = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array(
341
+		if ( ! empty($args['response'])) {
342
+			$request = wp_remote_post('https://www.google.com/recaptcha/api/siteverify', array(
343 343
 				'body' => $args,
344
-			) );
345
-			if ( ! is_wp_error( $request ) || 200 == wp_remote_retrieve_response_code( $request ) ) {
344
+			));
345
+			if ( ! is_wp_error($request) || 200 == wp_remote_retrieve_response_code($request)) {
346 346
 
347
-				$response = json_decode( $request['body'], true );
347
+				$response = json_decode($request['body'], true);
348 348
 
349 349
 				// reCAPTCHA fail.
350
-				if ( ! $response['success'] ) {
351
-					give_set_error( 'give_recaptcha_test_failed', apply_filters( 'give_recaptcha_test_failed_message', __( 'reCAPTCHA test failed.', 'give' ) ) );
350
+				if ( ! $response['success']) {
351
+					give_set_error('give_recaptcha_test_failed', apply_filters('give_recaptcha_test_failed_message', __('reCAPTCHA test failed.', 'give')));
352 352
 				}
353 353
 			} else {
354 354
 
355 355
 				// Connection issue.
356
-				give_set_error( 'give_recaptcha_connection_issue', apply_filters( 'give_recaptcha_connection_issue_message', __( 'Unable to connect to reCAPTCHA server.', 'give' ) ) );
356
+				give_set_error('give_recaptcha_connection_issue', apply_filters('give_recaptcha_connection_issue_message', __('Unable to connect to reCAPTCHA server.', 'give')));
357 357
 
358 358
 			}  // End if().
359 359
 		} else {
360 360
 
361
-			give_set_error( 'give_recaptcha_failed', apply_filters( 'give_recaptcha_failed_message', __( 'It looks like the reCAPTCHA test has failed.', 'give' ) ) );
361
+			give_set_error('give_recaptcha_failed', apply_filters('give_recaptcha_failed_message', __('It looks like the reCAPTCHA test has failed.', 'give')));
362 362
 
363 363
 		}  // End if().
364 364
 	}  // End if().
365 365
 
366 366
 	// If no errors or only expired token key error - then send email.
367
-	if ( ! give_get_errors() ) {
367
+	if ( ! give_get_errors()) {
368 368
 
369
-		$donor = Give()->donors->get_donor_by( 'email', $email );
369
+		$donor = Give()->donors->get_donor_by('email', $email);
370 370
 
371 371
 		Give()->email_access->init();
372 372
 
373 373
 		// Verify that donor object is present and donor is connected with its user profile or not.
374
-		if ( is_object( $donor ) ) {
374
+		if (is_object($donor)) {
375 375
 
376 376
 			// Verify that email can be sent.
377
-			if ( ! Give()->email_access->can_send_email( $donor->id ) ) {
377
+			if ( ! Give()->email_access->can_send_email($donor->id)) {
378 378
 
379 379
 				$_POST['email-access-exhausted'] = true;
380 380
 
@@ -382,10 +382,10 @@  discard block
 block discarded – undo
382 382
 
383 383
 			} else {
384 384
 				// Send the email. Requests not
385
-				$email_sent = Give()->email_access->send_email( $donor->id, $donor->email );
385
+				$email_sent = Give()->email_access->send_email($donor->id, $donor->email);
386 386
 
387
-				if ( ! $email_sent ) {
388
-					give_set_error( 'give_email_access_send_issue', __( 'Unable to send email. Please try again.', 'give' ) );
387
+				if ( ! $email_sent) {
388
+					give_set_error('give_email_access_send_issue', __('Unable to send email. Please try again.', 'give'));
389 389
 					return false;
390 390
 				}
391 391
 
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
 			}
396 396
 		} else {
397 397
 
398
-			give_set_error( 'give-no-donations', __( 'We were unable to find any donations associated with the email address provided. Please try again using another email.', 'give' ) );
398
+			give_set_error('give-no-donations', __('We were unable to find any donations associated with the email address provided. Please try again using another email.', 'give'));
399 399
 
400 400
 		}
401 401
 	} // End if().
402 402
 
403 403
 }
404 404
 
405
-add_action( 'give_email_access_form_login', 'give_email_access_login' );
405
+add_action('give_email_access_form_login', 'give_email_access_login');
Please login to merge, or discard this patch.
includes/misc-functions.php 1 patch
Spacing   +317 added lines, -317 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,9 +23,9 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function give_is_test_mode() {
25 25
 
26
-	$ret = give_is_setting_enabled( give_get_option( 'test_mode' ) );
26
+	$ret = give_is_setting_enabled(give_get_option('test_mode'));
27 27
 
28
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
28
+	return (bool) apply_filters('give_is_test_mode', $ret);
29 29
 
30 30
 }
31 31
 
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
 
40 40
 	global $wp;
41 41
 
42
-	if ( get_option( 'permalink_structure' ) ) {
43
-		$base = trailingslashit( home_url( $wp->request ) );
42
+	if (get_option('permalink_structure')) {
43
+		$base = trailingslashit(home_url($wp->request));
44 44
 	} else {
45
-		$base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) );
46
-		$base = remove_query_arg( array( 'post_type', 'name' ), $base );
45
+		$base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request)));
46
+		$base = remove_query_arg(array('post_type', 'name'), $base);
47 47
 	}
48 48
 
49 49
 	$scheme      = is_ssl() ? 'https' : 'http';
50
-	$current_uri = set_url_scheme( $base, $scheme );
50
+	$current_uri = set_url_scheme($base, $scheme);
51 51
 
52
-	if ( is_front_page() ) {
53
-		$current_uri = home_url( '/' );
52
+	if (is_front_page()) {
53
+		$current_uri = home_url('/');
54 54
 	}
55 55
 
56 56
 	/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param string $current_uri
62 62
 	 */
63
-	return apply_filters( 'give_get_current_page_url', $current_uri );
63
+	return apply_filters('give_get_current_page_url', $current_uri);
64 64
 
65 65
 }
66 66
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	$gateways = give_get_enabled_payment_gateways();
84 84
 
85
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
85
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
86 86
 		$ret = true;
87
-	} elseif ( count( $gateways ) == 1 ) {
87
+	} elseif (count($gateways) == 1) {
88 88
 		$ret = false;
89
-	} elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
89
+	} elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
90 90
 		$ret = false;
91 91
 	}
92 92
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @param bool $ret
99 99
 	 */
100
-	return (bool) apply_filters( 'give_is_cc_verify_enabled', $ret );
100
+	return (bool) apply_filters('give_is_cc_verify_enabled', $ret);
101 101
 }
102 102
 
103 103
 /**
@@ -109,26 +109,26 @@  discard block
 block discarded – undo
109 109
 function give_get_timezone_id() {
110 110
 
111 111
 	// if site timezone string exists, return it.
112
-	if ( $timezone = get_option( 'timezone_string' ) ) {
112
+	if ($timezone = get_option('timezone_string')) {
113 113
 		return $timezone;
114 114
 	}
115 115
 
116 116
 	// get UTC offset, if it isn't set return UTC.
117
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
117
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
118 118
 		return 'UTC';
119 119
 	}
120 120
 
121 121
 	// attempt to guess the timezone string from the UTC offset.
122
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
122
+	$timezone = timezone_name_from_abbr('', $utc_offset);
123 123
 
124 124
 	// last try, guess timezone string manually.
125
-	if ( $timezone === false ) {
125
+	if ($timezone === false) {
126 126
 
127
-		$is_dst = date( 'I' );
127
+		$is_dst = date('I');
128 128
 
129
-		foreach ( timezone_abbreviations_list() as $abbr ) {
130
-			foreach ( $abbr as $city ) {
131
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
129
+		foreach (timezone_abbreviations_list() as $abbr) {
130
+			foreach ($abbr as $city) {
131
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
132 132
 					return $city['timezone_id'];
133 133
 				}
134 134
 			}
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
 
153 153
 	$ip = '127.0.0.1';
154 154
 
155
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
155
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
156 156
 		// check ip from share internet
157 157
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
158
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
158
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
159 159
 		// to check ip is pass from proxy
160 160
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
161
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
161
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
162 162
 		$ip = $_SERVER['REMOTE_ADDR'];
163 163
 	}
164 164
 
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @since 1.0
169 169
 	 */
170
-	$ip = apply_filters( 'give_get_ip', $ip );
170
+	$ip = apply_filters('give_get_ip', $ip);
171 171
 
172 172
 	// Filter empty values.
173
-	if( false !== strpos( $ip, ',' ) ) {
174
-		$ip = give_clean( explode( ',', $ip ) );
175
-		$ip = array_filter( $ip );
176
-		$ip = implode( ',', $ip );
177
-	} else{
178
-		$ip = give_clean( $ip );
173
+	if (false !== strpos($ip, ',')) {
174
+		$ip = give_clean(explode(',', $ip));
175
+		$ip = array_filter($ip);
176
+		$ip = implode(',', $ip);
177
+	} else {
178
+		$ip = give_clean($ip);
179 179
 	}
180 180
 
181 181
 	return $ip;
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @uses  Give()->session->set()
195 195
  */
196
-function give_set_purchase_session( $purchase_data = array() ) {
197
-	Give()->session->set( 'give_purchase', $purchase_data );
198
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
196
+function give_set_purchase_session($purchase_data = array()) {
197
+	Give()->session->set('give_purchase', $purchase_data);
198
+	Give()->session->set('give_email', $purchase_data['user_email']);
199 199
 }
200 200
 
201 201
 /**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
  * @return mixed array | false
210 210
  */
211 211
 function give_get_purchase_session() {
212
-	return Give()->session->get( 'give_purchase' );
212
+	return Give()->session->get('give_purchase');
213 213
 }
214 214
 
215 215
 /**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
  * @return array|string
221 221
  */
222 222
 function give_get_receipt_session() {
223
-	return Give()->session->get( 'receipt_access' );
223
+	return Give()->session->get('receipt_access');
224 224
 }
225 225
 
226 226
 /**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
  * @return array|string
232 232
  */
233 233
 function give_get_history_session() {
234
-	return (bool) Give()->session->get( 'history_access' );
234
+	return (bool) Give()->session->get('history_access');
235 235
 }
236 236
 
237 237
 /**
@@ -243,17 +243,17 @@  discard block
 block discarded – undo
243 243
  *
244 244
  * @return string By default, the name of the form. Then the price level text if any is found.
245 245
  */
246
-function give_payment_gateway_item_title( $payment_data ) {
246
+function give_payment_gateway_item_title($payment_data) {
247 247
 
248
-	$form_id   = intval( $payment_data['post_data']['give-form-id'] );
249
-	$item_name = isset( $payment_data['post_data']['give-form-title'] ) ? $payment_data['post_data']['give-form-title'] : '';
250
-	$price_id  = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
248
+	$form_id   = intval($payment_data['post_data']['give-form-id']);
249
+	$item_name = isset($payment_data['post_data']['give-form-title']) ? $payment_data['post_data']['give-form-title'] : '';
250
+	$price_id  = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
251 251
 
252 252
 
253 253
 	// Verify has variable prices.
254
-	if ( give_has_variable_prices( $form_id ) && ! empty( $price_id ) ) {
254
+	if (give_has_variable_prices($form_id) && ! empty($price_id)) {
255 255
 
256
-		$item_price_level_text = give_get_price_option_name( $form_id, $price_id, 0, false );
256
+		$item_price_level_text = give_get_price_option_name($form_id, $price_id, 0, false);
257 257
 
258 258
 		/**
259 259
 		 * Output donation level text if:
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 		 */
264 264
 		if (
265 265
 			'custom' !== $price_id
266
-			&& ! empty( $item_price_level_text )
266
+			&& ! empty($item_price_level_text)
267 267
 		) {
268 268
 			// Matches a donation level - append level text.
269
-			$item_name .= ' - ' . $item_price_level_text;
269
+			$item_name .= ' - '.$item_price_level_text;
270 270
 		}
271 271
 	}
272 272
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 *
282 282
 	 * @return string
283 283
 	 */
284
-	return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data );
284
+	return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data);
285 285
 }
286 286
 
287 287
 /**
@@ -297,38 +297,38 @@  discard block
 block discarded – undo
297 297
  *
298 298
  * @return string
299 299
  */
300
-function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) {
300
+function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) {
301 301
 
302
-	$form_id  = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : '';
303
-	$price_id = isset( $donation_data['post_data']['give-price-id'] ) ? $donation_data['post_data']['give-price-id'] : '';
302
+	$form_id  = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : '';
303
+	$price_id = isset($donation_data['post_data']['give-price-id']) ? $donation_data['post_data']['give-price-id'] : '';
304 304
 
305 305
 	// Form title.
306
-	$summary = ( ! empty( $donation_data['post_data']['give-form-title'] ) ? $donation_data['post_data']['give-form-title'] : ( ! empty( $form_id ) ? wp_sprintf( __( 'Donation Form ID: %d', 'give' ), $form_id ) : __( 'Untitled donation form', 'give' ) ) );
306
+	$summary = ( ! empty($donation_data['post_data']['give-form-title']) ? $donation_data['post_data']['give-form-title'] : ( ! empty($form_id) ? wp_sprintf(__('Donation Form ID: %d', 'give'), $form_id) : __('Untitled donation form', 'give')));
307 307
 
308 308
 	// Form multilevel if applicable.
309
-	if ( ! empty( $price_id ) && 'custom' !== $price_id ) {
310
-		$summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] );
309
+	if ( ! empty($price_id) && 'custom' !== $price_id) {
310
+		$summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']);
311 311
 	}
312 312
 
313 313
 	// Add Donor's name + email if requested.
314
-	if ( $name_and_email ) {
314
+	if ($name_and_email) {
315 315
 
316 316
 		// First name
317
-		if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) {
318
-			$summary .= ' - ' . $donation_data['user_info']['first_name'];
317
+		if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) {
318
+			$summary .= ' - '.$donation_data['user_info']['first_name'];
319 319
 		}
320 320
 
321
-		if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) {
322
-			$summary .= ' ' . $donation_data['user_info']['last_name'];
321
+		if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) {
322
+			$summary .= ' '.$donation_data['user_info']['last_name'];
323 323
 		}
324 324
 
325
-		$summary .= ' (' . $donation_data['user_email'] . ')';
325
+		$summary .= ' ('.$donation_data['user_email'].')';
326 326
 	}
327 327
 
328 328
 	// Cut the length
329
-	$summary = substr( $summary, 0, $length );
329
+	$summary = substr($summary, 0, $length);
330 330
 
331
-	return apply_filters( 'give_payment_gateway_donation_summary', $summary );
331
+	return apply_filters('give_payment_gateway_donation_summary', $summary);
332 332
 }
333 333
 
334 334
 
@@ -343,31 +343,31 @@  discard block
 block discarded – undo
343 343
 function give_get_host() {
344 344
 	$host = false;
345 345
 
346
-	if ( defined( 'WPE_APIKEY' ) ) {
346
+	if (defined('WPE_APIKEY')) {
347 347
 		$host = 'WP Engine';
348
-	} elseif ( defined( 'PAGELYBIN' ) ) {
348
+	} elseif (defined('PAGELYBIN')) {
349 349
 		$host = 'Pagely';
350
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
350
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
351 351
 		$host = 'ICDSoft';
352
-	} elseif ( DB_HOST == 'mysqlv5' ) {
352
+	} elseif (DB_HOST == 'mysqlv5') {
353 353
 		$host = 'NetworkSolutions';
354
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
354
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
355 355
 		$host = 'iPage';
356
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
356
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
357 357
 		$host = 'IPower';
358
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
358
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
359 359
 		$host = 'MediaTemple Grid';
360
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
360
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
361 361
 		$host = 'pair Networks';
362
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
362
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
363 363
 		$host = 'Rackspace Cloud';
364
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
364
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
365 365
 		$host = 'SysFix.eu Power Hosting';
366
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
366
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
367 367
 		$host = 'Flywheel';
368 368
 	} else {
369 369
 		// Adding a general fallback for data gathering
370
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
370
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
371 371
 	}
372 372
 
373 373
 	return $host;
@@ -383,67 +383,67 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return bool true if host matches, false if not
385 385
  */
386
-function give_is_host( $host = false ) {
386
+function give_is_host($host = false) {
387 387
 
388 388
 	$return = false;
389 389
 
390
-	if ( $host ) {
391
-		$host = str_replace( ' ', '', strtolower( $host ) );
390
+	if ($host) {
391
+		$host = str_replace(' ', '', strtolower($host));
392 392
 
393
-		switch ( $host ) {
393
+		switch ($host) {
394 394
 			case 'wpengine':
395
-				if ( defined( 'WPE_APIKEY' ) ) {
395
+				if (defined('WPE_APIKEY')) {
396 396
 					$return = true;
397 397
 				}
398 398
 				break;
399 399
 			case 'pagely':
400
-				if ( defined( 'PAGELYBIN' ) ) {
400
+				if (defined('PAGELYBIN')) {
401 401
 					$return = true;
402 402
 				}
403 403
 				break;
404 404
 			case 'icdsoft':
405
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
405
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
406 406
 					$return = true;
407 407
 				}
408 408
 				break;
409 409
 			case 'networksolutions':
410
-				if ( DB_HOST == 'mysqlv5' ) {
410
+				if (DB_HOST == 'mysqlv5') {
411 411
 					$return = true;
412 412
 				}
413 413
 				break;
414 414
 			case 'ipage':
415
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
415
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
416 416
 					$return = true;
417 417
 				}
418 418
 				break;
419 419
 			case 'ipower':
420
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
420
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
421 421
 					$return = true;
422 422
 				}
423 423
 				break;
424 424
 			case 'mediatemplegrid':
425
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
425
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
426 426
 					$return = true;
427 427
 				}
428 428
 				break;
429 429
 			case 'pairnetworks':
430
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
430
+				if (strpos(DB_HOST, '.pair.com') !== false) {
431 431
 					$return = true;
432 432
 				}
433 433
 				break;
434 434
 			case 'rackspacecloud':
435
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
435
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
436 436
 					$return = true;
437 437
 				}
438 438
 				break;
439 439
 			case 'sysfix.eu':
440 440
 			case 'sysfix.eupowerhosting':
441
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
441
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
442 442
 					$return = true;
443 443
 				}
444 444
 				break;
445 445
 			case 'flywheel':
446
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
446
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
447 447
 					$return = true;
448 448
 				}
449 449
 				break;
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
  * @param string $replacement Optional. The function that should have been called.
477 477
  * @param array  $backtrace   Optional. Contains stack backtrace of deprecated function.
478 478
  */
479
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
479
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
480 480
 
481 481
 	/**
482 482
 	 * Fires while give deprecated function call occurs.
@@ -489,19 +489,19 @@  discard block
 block discarded – undo
489 489
 	 * @param string $replacement Optional. The function that should have been called.
490 490
 	 * @param string $version     The plugin version that deprecated the function.
491 491
 	 */
492
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
492
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
493 493
 
494
-	$show_errors = current_user_can( 'manage_options' );
494
+	$show_errors = current_user_can('manage_options');
495 495
 
496 496
 	// Allow plugin to filter the output error trigger.
497
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
498
-		if ( ! is_null( $replacement ) ) {
499
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
500
-			trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
497
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
498
+		if ( ! is_null($replacement)) {
499
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
500
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
501 501
 			// Alternatively we could dump this to a file.
502 502
 		} else {
503
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
504
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
503
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
504
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
505 505
 			// Alternatively we could dump this to a file.
506 506
 		}
507 507
 	}
@@ -515,17 +515,17 @@  discard block
 block discarded – undo
515 515
  * @return string $post_id
516 516
  */
517 517
 function give_get_admin_post_id() {
518
-	$post_id = isset( $_REQUEST['post'] )
519
-		? absint( $_REQUEST['post'] )
518
+	$post_id = isset($_REQUEST['post'])
519
+		? absint($_REQUEST['post'])
520 520
 		: null;
521 521
 
522
-	$post_id = ! empty( $post_id )
522
+	$post_id = ! empty($post_id)
523 523
 		? $post_id
524
-		: ( isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : null );
524
+		: (isset($_REQUEST['post_id']) ? absint($_REQUEST['post_id']) : null);
525 525
 
526
-	$post_id = ! empty( $post_id )
526
+	$post_id = ! empty($post_id)
527 527
 		? $post_id
528
-		: ( isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : null );
528
+		: (isset($_REQUEST['post_ID']) ? absint($_REQUEST['post_ID']) : null);
529 529
 
530 530
 	return $post_id;
531 531
 }
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
  * @return string Arg separator output
538 538
  */
539 539
 function give_get_php_arg_separator_output() {
540
-	return ini_get( 'arg_separator.output' );
540
+	return ini_get('arg_separator.output');
541 541
 }
542 542
 
543 543
 
@@ -552,10 +552,10 @@  discard block
 block discarded – undo
552 552
  *
553 553
  * @return string Short month name
554 554
  */
555
-function give_month_num_to_name( $n ) {
556
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
555
+function give_month_num_to_name($n) {
556
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
557 557
 
558
-	return date_i18n( 'M', $timestamp );
558
+	return date_i18n('M', $timestamp);
559 559
 }
560 560
 
561 561
 
@@ -568,10 +568,10 @@  discard block
 block discarded – undo
568 568
  *
569 569
  * @return bool Whether or not function is disabled.
570 570
  */
571
-function give_is_func_disabled( $function ) {
572
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
571
+function give_is_func_disabled($function) {
572
+	$disabled = explode(',', ini_get('disable_functions'));
573 573
 
574
-	return in_array( $function, $disabled );
574
+	return in_array($function, $disabled);
575 575
 }
576 576
 
577 577
 
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 function give_get_newsletter() {
584 584
 	?>
585 585
 
586
-	<p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
586
+	<p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
587 587
 
588 588
 	<div class="give-newsletter-form-wrap">
589 589
 
@@ -591,33 +591,33 @@  discard block
 block discarded – undo
591 591
 		      method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"
592 592
 		      target="_blank" novalidate>
593 593
 			<div class="give-newsletter-confirmation">
594
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
594
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
595 595
 			</div>
596 596
 
597 597
 			<table class="form-table give-newsletter-form">
598 598
 				<tr valign="middle">
599 599
 					<td>
600 600
 						<label for="mce-EMAIL"
601
-						       class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>
601
+						       class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label>
602 602
 						<input type="email" name="EMAIL" id="mce-EMAIL"
603
-						       placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>"
603
+						       placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>"
604 604
 						       class="required email" value="">
605 605
 					</td>
606 606
 					<td>
607 607
 						<label for="mce-FNAME"
608
-						       class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>
608
+						       class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label>
609 609
 						<input type="text" name="FNAME" id="mce-FNAME"
610
-						       placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="">
610
+						       placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="">
611 611
 					</td>
612 612
 					<td>
613 613
 						<label for="mce-LNAME"
614
-						       class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
614
+						       class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label>
615 615
 						<input type="text" name="LNAME" id="mce-LNAME"
616
-						       placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value="">
616
+						       placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value="">
617 617
 					</td>
618 618
 					<td>
619 619
 						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button"
620
-						       value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">
620
+						       value="<?php esc_attr_e('Subscribe', 'give'); ?>">
621 621
 					</td>
622 622
 				</tr>
623 623
 			</table>
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
  *
671 671
  * @return string
672 672
  */
673
-function give_svg_icons( $icon ) {
673
+function give_svg_icons($icon) {
674 674
 
675 675
 	// Store your SVGs in an associative array
676 676
 	$svgs = array(
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 	);
683 683
 
684 684
 	// Return the chosen icon's SVG string
685
-	return $svgs[ $icon ];
685
+	return $svgs[$icon];
686 686
 }
687 687
 
688 688
 /**
@@ -694,15 +694,15 @@  discard block
 block discarded – undo
694 694
  *
695 695
  * @return mixed
696 696
  */
697
-function modify_nav_menu_meta_box_object( $post_type ) {
698
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
699
-		$post_type->labels->name = esc_html__( 'Donation Forms', 'give' );
697
+function modify_nav_menu_meta_box_object($post_type) {
698
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
699
+		$post_type->labels->name = esc_html__('Donation Forms', 'give');
700 700
 	}
701 701
 
702 702
 	return $post_type;
703 703
 }
704 704
 
705
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
705
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
706 706
 
707 707
 /**
708 708
  * Show Donation Forms Post Type in Appearance > Menus by default on fresh install.
@@ -721,35 +721,35 @@  discard block
 block discarded – undo
721 721
 	// Proceed, if current screen is navigation menus.
722 722
 	if (
723 723
 		'nav-menus' === $screen->id &&
724
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) ) &&
725
-		! get_user_option( 'give_is_donation_forms_menu_updated' )
724
+		give_is_setting_enabled(give_get_option('forms_singular')) &&
725
+		! get_user_option('give_is_donation_forms_menu_updated')
726 726
 	) {
727 727
 
728 728
 		// Return false, if it fails to retrieve hidden meta box list and is not admin.
729 729
 		if (
730 730
 			! is_admin() ||
731
-			( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) )
731
+			( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus'))
732 732
 		) {
733 733
 			return false;
734 734
 		}
735 735
 
736 736
 		// Return false, In case, we don't find 'Donation Form' in hidden meta box list.
737
-		if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) {
737
+		if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) {
738 738
 			return false;
739 739
 		}
740 740
 
741 741
 		// Exclude 'Donation Form' value from hidden meta box's list.
742
-		$hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) );
742
+		$hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms'));
743 743
 
744 744
 		// Get current user ID.
745 745
 		$user = wp_get_current_user();
746 746
 
747
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
748
-		update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true );
747
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
748
+		update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true);
749 749
 	}
750 750
 }
751 751
 
752
-add_action( 'current_screen', 'give_donation_metabox_menu' );
752
+add_action('current_screen', 'give_donation_metabox_menu');
753 753
 
754 754
 /**
755 755
  * Array_column backup usage
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
  * @license    https://opensource.org/licenses/MIT MIT
763 763
  */
764 764
 
765
-if ( ! function_exists( 'array_column' ) ) {
765
+if ( ! function_exists('array_column')) {
766 766
 	/**
767 767
 	 * Returns the values from a single column of the input array, identified by
768 768
 	 * the $columnKey.
@@ -781,53 +781,53 @@  discard block
 block discarded – undo
781 781
 	 *
782 782
 	 * @return array
783 783
 	 */
784
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
784
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
785 785
 		// Using func_get_args() in order to check for proper number of
786 786
 		// parameters and trigger errors exactly as the built-in array_column()
787 787
 		// does in PHP 5.5.
788 788
 		$argc   = func_num_args();
789 789
 		$params = func_get_args();
790 790
 
791
-		if ( $argc < 2 ) {
792
-			trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING );
791
+		if ($argc < 2) {
792
+			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING);
793 793
 
794 794
 			return null;
795 795
 		}
796 796
 
797
-		if ( ! is_array( $params[0] ) ) {
798
-			trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING );
797
+		if ( ! is_array($params[0])) {
798
+			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING);
799 799
 
800 800
 			return null;
801 801
 		}
802 802
 
803
-		if ( ! is_int( $params[1] )
804
-		     && ! is_float( $params[1] )
805
-		     && ! is_string( $params[1] )
803
+		if ( ! is_int($params[1])
804
+		     && ! is_float($params[1])
805
+		     && ! is_string($params[1])
806 806
 		     && $params[1] !== null
807
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
807
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
808 808
 		) {
809
-			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
809
+			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING);
810 810
 
811 811
 			return false;
812 812
 		}
813 813
 
814
-		if ( isset( $params[2] )
815
-		     && ! is_int( $params[2] )
816
-		     && ! is_float( $params[2] )
817
-		     && ! is_string( $params[2] )
818
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
814
+		if (isset($params[2])
815
+		     && ! is_int($params[2])
816
+		     && ! is_float($params[2])
817
+		     && ! is_string($params[2])
818
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
819 819
 		) {
820
-			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
820
+			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING);
821 821
 
822 822
 			return false;
823 823
 		}
824 824
 
825 825
 		$paramsInput     = $params[0];
826
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
826
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
827 827
 
828 828
 		$paramsIndexKey = null;
829
-		if ( isset( $params[2] ) ) {
830
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
829
+		if (isset($params[2])) {
830
+			if (is_float($params[2]) || is_int($params[2])) {
831 831
 				$paramsIndexKey = (int) $params[2];
832 832
 			} else {
833 833
 				$paramsIndexKey = (string) $params[2];
@@ -836,26 +836,26 @@  discard block
 block discarded – undo
836 836
 
837 837
 		$resultArray = array();
838 838
 
839
-		foreach ( $paramsInput as $row ) {
839
+		foreach ($paramsInput as $row) {
840 840
 			$key    = $value = null;
841 841
 			$keySet = $valueSet = false;
842 842
 
843
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
843
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
844 844
 				$keySet = true;
845
-				$key    = (string) $row[ $paramsIndexKey ];
845
+				$key    = (string) $row[$paramsIndexKey];
846 846
 			}
847 847
 
848
-			if ( $paramsColumnKey === null ) {
848
+			if ($paramsColumnKey === null) {
849 849
 				$valueSet = true;
850 850
 				$value    = $row;
851
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
851
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
852 852
 				$valueSet = true;
853
-				$value    = $row[ $paramsColumnKey ];
853
+				$value    = $row[$paramsColumnKey];
854 854
 			}
855 855
 
856
-			if ( $valueSet ) {
857
-				if ( $keySet ) {
858
-					$resultArray[ $key ] = $value;
856
+			if ($valueSet) {
857
+				if ($keySet) {
858
+					$resultArray[$key] = $value;
859 859
 				} else {
860 860
 					$resultArray[] = $value;
861 861
 				}
@@ -875,54 +875,54 @@  discard block
 block discarded – undo
875 875
  *
876 876
  * @return bool Whether the receipt is visible or not.
877 877
  */
878
-function give_can_view_receipt( $payment_key = '' ) {
878
+function give_can_view_receipt($payment_key = '') {
879 879
 
880 880
 	$return = false;
881 881
 
882
-	if ( empty( $payment_key ) ) {
882
+	if (empty($payment_key)) {
883 883
 		return $return;
884 884
 	}
885 885
 
886 886
 	global $give_receipt_args;
887 887
 
888
-	$give_receipt_args['id'] = give_get_donation_id_by_key( $payment_key );
888
+	$give_receipt_args['id'] = give_get_donation_id_by_key($payment_key);
889 889
 
890
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
890
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
891 891
 
892
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
892
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
893 893
 
894
-	if ( is_user_logged_in() ) {
895
-		if ( $user_id === (int) get_current_user_id() ) {
894
+	if (is_user_logged_in()) {
895
+		if ($user_id === (int) get_current_user_id()) {
896 896
 			$return = true;
897
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
897
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
898 898
 			$return = true;
899
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
899
+		} elseif (current_user_can('view_give_sensitive_data')) {
900 900
 			$return = true;
901 901
 		}
902 902
 	}
903 903
 
904 904
 	// Check whether it is purchase session?
905 905
 	$purchase_session = give_get_purchase_session();
906
-	if ( ! empty( $purchase_session ) && ! is_user_logged_in() ) {
907
-		if ( $purchase_session['purchase_key'] === $payment_meta['key'] ) {
906
+	if ( ! empty($purchase_session) && ! is_user_logged_in()) {
907
+		if ($purchase_session['purchase_key'] === $payment_meta['key']) {
908 908
 			$return = true;
909 909
 		}
910 910
 	}
911 911
 
912 912
 	// Check whether it is receipt access session?
913 913
 	$receipt_session = give_get_receipt_session();
914
-	if ( ! empty( $receipt_session ) && ! is_user_logged_in() ) {
915
-		if ( $receipt_session === $payment_meta['key'] ) {
914
+	if ( ! empty($receipt_session) && ! is_user_logged_in()) {
915
+		if ($receipt_session === $payment_meta['key']) {
916 916
 			$return = true;
917 917
 		}
918 918
 	}
919 919
 
920 920
 	// Check whether it is history access session?
921
-	if ( true === give_get_history_session() ) {
921
+	if (true === give_get_history_session()) {
922 922
 		$return = true;
923 923
 	}
924 924
 
925
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
925
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
926 926
 
927 927
 }
928 928
 
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
  *
932 932
  * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
933 933
  */
934
-if ( ! function_exists( 'cal_days_in_month' ) ) {
934
+if ( ! function_exists('cal_days_in_month')) {
935 935
 	/**
936 936
 	 * cal_days_in_month
937 937
 	 *
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
 	 *
942 942
 	 * @return bool|string
943 943
 	 */
944
-	function cal_days_in_month( $calendar, $month, $year ) {
945
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
944
+	function cal_days_in_month($calendar, $month, $year) {
945
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
946 946
 	}
947 947
 }
948 948
 
@@ -961,42 +961,42 @@  discard block
 block discarded – undo
961 961
  */
962 962
 function give_get_plugins() {
963 963
 	$plugins             = get_plugins();
964
-	$active_plugin_paths = (array) get_option( 'active_plugins', array() );
964
+	$active_plugin_paths = (array) get_option('active_plugins', array());
965 965
 
966
-	if ( is_multisite() ) {
967
-		$network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
968
-		$active_plugin_paths            = array_merge( $active_plugin_paths, $network_activated_plugin_paths );
966
+	if (is_multisite()) {
967
+		$network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array()));
968
+		$active_plugin_paths            = array_merge($active_plugin_paths, $network_activated_plugin_paths);
969 969
 	}
970 970
 
971
-	foreach ( $plugins as $plugin_path => $plugin_data ) {
971
+	foreach ($plugins as $plugin_path => $plugin_data) {
972 972
 		// Is plugin active?
973
-		if ( in_array( $plugin_path, $active_plugin_paths ) ) {
974
-			$plugins[ $plugin_path ]['Status'] = 'active';
973
+		if (in_array($plugin_path, $active_plugin_paths)) {
974
+			$plugins[$plugin_path]['Status'] = 'active';
975 975
 		} else {
976
-			$plugins[ $plugin_path ]['Status'] = 'inactive';
976
+			$plugins[$plugin_path]['Status'] = 'inactive';
977 977
 		}
978 978
 
979
-		$dirname = strtolower( dirname( $plugin_path ) );
979
+		$dirname = strtolower(dirname($plugin_path));
980 980
 
981 981
 		// Is plugin a Give add-on by WordImpress?
982
-		if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) {
982
+		if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) {
983 983
 			// Plugin is a Give-addon.
984
-			$plugins[ $plugin_path ]['Type'] = 'add-on';
984
+			$plugins[$plugin_path]['Type'] = 'add-on';
985 985
 
986 986
 			// Get license info from database.
987
-			$plugin_name    = str_replace( 'Give - ', '', $plugin_data['Name'] );
988
-			$db_option      = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active';
989
-			$license_active = get_option( $db_option );
987
+			$plugin_name    = str_replace('Give - ', '', $plugin_data['Name']);
988
+			$db_option      = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active';
989
+			$license_active = get_option($db_option);
990 990
 
991 991
 			// Does a valid license exist?
992
-			if ( ! empty( $license_active ) && 'valid' === $license_active->license ) {
993
-				$plugins[ $plugin_path ]['License'] = true;
992
+			if ( ! empty($license_active) && 'valid' === $license_active->license) {
993
+				$plugins[$plugin_path]['License'] = true;
994 994
 			} else {
995
-				$plugins[ $plugin_path ]['License'] = false;
995
+				$plugins[$plugin_path]['License'] = false;
996 996
 			}
997 997
 		} else {
998 998
 			// Plugin is not a Give add-on.
999
-			$plugins[ $plugin_path ]['Type'] = 'other';
999
+			$plugins[$plugin_path]['Type'] = 'other';
1000 1000
 		}
1001 1001
 	}
1002 1002
 
@@ -1013,16 +1013,16 @@  discard block
 block discarded – undo
1013 1013
  *
1014 1014
  * @return bool
1015 1015
  */
1016
-function give_is_terms_enabled( $form_id ) {
1017
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1016
+function give_is_terms_enabled($form_id) {
1017
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1018 1018
 
1019 1019
 	if (
1020
-		give_is_setting_enabled( $form_option, 'global' )
1021
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1020
+		give_is_setting_enabled($form_option, 'global')
1021
+		&& give_is_setting_enabled(give_get_option('terms'))
1022 1022
 	) {
1023 1023
 		return true;
1024 1024
 
1025
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1025
+	} elseif (give_is_setting_enabled($form_option)) {
1026 1026
 		return true;
1027 1027
 
1028 1028
 	} else {
@@ -1047,10 +1047,10 @@  discard block
 block discarded – undo
1047 1047
  *
1048 1048
  * @return WP_Error|bool
1049 1049
  */
1050
-function give_delete_donation_stats( $date_range = '', $args = array() ) {
1050
+function give_delete_donation_stats($date_range = '', $args = array()) {
1051 1051
 
1052 1052
 	// Delete all cache.
1053
-	$status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) );
1053
+	$status = Give_Cache::delete(Give_Cache::get_options_like('give_stats'));
1054 1054
 
1055 1055
 	/**
1056 1056
 	 * Fire the action when donation stats delete.
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 	 * @param string|array $date_range
1061 1061
 	 * @param array        $args
1062 1062
 	 */
1063
-	do_action( 'give_delete_donation_stats', $status, $date_range, $args );
1063
+	do_action('give_delete_donation_stats', $status, $date_range, $args);
1064 1064
 
1065 1065
 	return $status;
1066 1066
 }
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 function give_is_add_new_form_page() {
1075 1075
 	$status = false;
1076 1076
 
1077
-	if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) {
1077
+	if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) {
1078 1078
 		$status = true;
1079 1079
 	}
1080 1080
 
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
  *
1098 1098
  * @return mixed
1099 1099
  */
1100
-function give_get_meta( $id, $meta_key = '', $single = false, $default = false ) {
1100
+function give_get_meta($id, $meta_key = '', $single = false, $default = false) {
1101 1101
 	/**
1102 1102
 	 * Filter the meta value
1103 1103
 	 *
@@ -1105,14 +1105,14 @@  discard block
 block discarded – undo
1105 1105
 	 */
1106 1106
 	$meta_value = apply_filters(
1107 1107
 		'give_get_meta',
1108
-		get_post_meta( $id, $meta_key, $single ),
1108
+		get_post_meta($id, $meta_key, $single),
1109 1109
 		$id,
1110 1110
 		$meta_key,
1111 1111
 		$default
1112 1112
 	);
1113 1113
 
1114 1114
 	if (
1115
-		( empty( $meta_key ) || empty( $meta_value ) )
1115
+		(empty($meta_key) || empty($meta_value))
1116 1116
 		&& $default
1117 1117
 	) {
1118 1118
 		$meta_value = $default;
@@ -1133,15 +1133,15 @@  discard block
 block discarded – undo
1133 1133
  *
1134 1134
  * @return mixed
1135 1135
  */
1136
-function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) {
1137
-	$status = update_post_meta( $id, $meta_key, $meta_value, $prev_value );
1136
+function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') {
1137
+	$status = update_post_meta($id, $meta_key, $meta_value, $prev_value);
1138 1138
 
1139 1139
 	/**
1140 1140
 	 * Filter the meta value update status
1141 1141
 	 *
1142 1142
 	 * @since 1.8.8
1143 1143
 	 */
1144
-	return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value );
1144
+	return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value);
1145 1145
 }
1146 1146
 
1147 1147
 /**
@@ -1155,15 +1155,15 @@  discard block
 block discarded – undo
1155 1155
  *
1156 1156
  * @return mixed
1157 1157
  */
1158
-function give_delete_meta( $id, $meta_key, $meta_value = '' ) {
1159
-	$status = delete_post_meta( $id, $meta_key, $meta_value );
1158
+function give_delete_meta($id, $meta_key, $meta_value = '') {
1159
+	$status = delete_post_meta($id, $meta_key, $meta_value);
1160 1160
 
1161 1161
 	/**
1162 1162
 	 * Filter the meta value delete status
1163 1163
 	 *
1164 1164
 	 * @since 1.8.8
1165 1165
 	 */
1166
-	return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value );
1166
+	return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value);
1167 1167
 }
1168 1168
 
1169 1169
 /**
@@ -1175,23 +1175,23 @@  discard block
 block discarded – undo
1175 1175
  *
1176 1176
  * @return bool                   If the action has been added to the completed actions array
1177 1177
  */
1178
-function give_has_upgrade_completed( $upgrade_action = '' ) {
1178
+function give_has_upgrade_completed($upgrade_action = '') {
1179 1179
 	// Bailout.
1180
-	if ( empty( $upgrade_action ) ) {
1180
+	if (empty($upgrade_action)) {
1181 1181
 		return false;
1182 1182
 	}
1183 1183
 
1184 1184
 	// Fresh install?
1185 1185
 	// If fresh install then all upgrades will be consider as completed.
1186
-	$is_fresh_install = ! get_option( 'give_version' );
1187
-	if ( $is_fresh_install ) {
1186
+	$is_fresh_install = ! get_option('give_version');
1187
+	if ($is_fresh_install) {
1188 1188
 		return true;
1189 1189
 	}
1190 1190
 
1191 1191
 
1192 1192
 	$completed_upgrades = give_get_completed_upgrades();
1193 1193
 
1194
-	return in_array( $upgrade_action, $completed_upgrades );
1194
+	return in_array($upgrade_action, $completed_upgrades);
1195 1195
 
1196 1196
 }
1197 1197
 
@@ -1203,8 +1203,8 @@  discard block
 block discarded – undo
1203 1203
  * @return mixed   When nothing to resume returns false, otherwise starts the upgrade where it left off
1204 1204
  */
1205 1205
 function give_maybe_resume_upgrade() {
1206
-	$doing_upgrade = get_option( 'give_doing_upgrade', false );
1207
-	if ( empty( $doing_upgrade ) ) {
1206
+	$doing_upgrade = get_option('give_doing_upgrade', false);
1207
+	if (empty($doing_upgrade)) {
1208 1208
 		return false;
1209 1209
 	}
1210 1210
 
@@ -1220,9 +1220,9 @@  discard block
 block discarded – undo
1220 1220
  *
1221 1221
  * @return bool                   If the function was successfully added
1222 1222
  */
1223
-function give_set_upgrade_complete( $upgrade_action = '' ) {
1223
+function give_set_upgrade_complete($upgrade_action = '') {
1224 1224
 
1225
-	if ( empty( $upgrade_action ) ) {
1225
+	if (empty($upgrade_action)) {
1226 1226
 		return false;
1227 1227
 	}
1228 1228
 
@@ -1230,16 +1230,16 @@  discard block
 block discarded – undo
1230 1230
 	$completed_upgrades[] = $upgrade_action;
1231 1231
 
1232 1232
 	// Remove any blanks, and only show uniques.
1233
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
1233
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
1234 1234
 
1235 1235
 	/**
1236 1236
 	 * Fire the action when any upgrade set to complete.
1237 1237
 	 *
1238 1238
 	 * @since 1.8.12
1239 1239
 	 */
1240
-	do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades );
1240
+	do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades);
1241 1241
 
1242
-	return update_option( 'give_completed_upgrades', $completed_upgrades, 'no' );
1242
+	return update_option('give_completed_upgrades', $completed_upgrades, 'no');
1243 1243
 }
1244 1244
 
1245 1245
 /**
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
  * @return array The array of completed upgrades
1250 1250
  */
1251 1251
 function give_get_completed_upgrades() {
1252
-	return (array) get_option( 'give_completed_upgrades' );
1252
+	return (array) get_option('give_completed_upgrades');
1253 1253
 }
1254 1254
 
1255 1255
 /**
@@ -1264,16 +1264,16 @@  discard block
 block discarded – undo
1264 1264
  *
1265 1265
  * @return null|array
1266 1266
  */
1267
-function __give_v20_bc_table_details( $type ) {
1267
+function __give_v20_bc_table_details($type) {
1268 1268
 	global $wpdb;
1269 1269
 	$table = array();
1270 1270
 
1271 1271
 	// Bailout.
1272
-	if ( empty( $type ) ) {
1272
+	if (empty($type)) {
1273 1273
 		return null;
1274 1274
 	}
1275 1275
 
1276
-	switch ( $type ) {
1276
+	switch ($type) {
1277 1277
 		case 'form':
1278 1278
 			$table['name']         = $wpdb->formmeta;
1279 1279
 			$table['column']['id'] = 'form_id';
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 	}
1287 1287
 
1288 1288
 	// Backward compatibility.
1289
-	if ( ! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) ) {
1289
+	if ( ! give_has_upgrade_completed('v20_move_metadata_into_new_table')) {
1290 1290
 		$table['name']         = $wpdb->postmeta;
1291 1291
 		$table['column']['id'] = 'post_id';
1292 1292
 	}
@@ -1302,12 +1302,12 @@  discard block
 block discarded – undo
1302 1302
  *
1303 1303
  * @param WP_Query $query
1304 1304
  */
1305
-function give_remove_pages_from_search( $query ) {
1305
+function give_remove_pages_from_search($query) {
1306 1306
 
1307
-	if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
1307
+	if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) {
1308 1308
 
1309
-		$transaction_failed = give_get_option( 'failure_page', 0 );
1310
-		$success_page       = give_get_option( 'success_page', 0 );
1309
+		$transaction_failed = give_get_option('failure_page', 0);
1310
+		$success_page       = give_get_option('success_page', 0);
1311 1311
 
1312 1312
 		$args               = apply_filters(
1313 1313
 			'give_remove_pages_from_search', array(
@@ -1315,11 +1315,11 @@  discard block
 block discarded – undo
1315 1315
 			$success_page,
1316 1316
 		), $query
1317 1317
 		);
1318
-		$query->set( 'post__not_in', $args );
1318
+		$query->set('post__not_in', $args);
1319 1319
 	}
1320 1320
 }
1321 1321
 
1322
-add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 );
1322
+add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1);
1323 1323
 
1324 1324
 /**
1325 1325
  * Inserts a new key/value before a key in the array.
@@ -1335,14 +1335,14 @@  discard block
 block discarded – undo
1335 1335
  *
1336 1336
  * @see   array_insert_before()
1337 1337
  */
1338
-function give_array_insert_before( $key, array &$array, $new_key, $new_value ) {
1339
-	if ( array_key_exists( $key, $array ) ) {
1338
+function give_array_insert_before($key, array &$array, $new_key, $new_value) {
1339
+	if (array_key_exists($key, $array)) {
1340 1340
 		$new = array();
1341
-		foreach ( $array as $k => $value ) {
1342
-			if ( $k === $key ) {
1343
-				$new[ $new_key ] = $new_value;
1341
+		foreach ($array as $k => $value) {
1342
+			if ($k === $key) {
1343
+				$new[$new_key] = $new_value;
1344 1344
 			}
1345
-			$new[ $k ] = $value;
1345
+			$new[$k] = $value;
1346 1346
 		}
1347 1347
 
1348 1348
 		return $new;
@@ -1365,13 +1365,13 @@  discard block
 block discarded – undo
1365 1365
  *
1366 1366
  * @see   array_insert_before()
1367 1367
  */
1368
-function give_array_insert_after( $key, array &$array, $new_key, $new_value ) {
1369
-	if ( array_key_exists( $key, $array ) ) {
1368
+function give_array_insert_after($key, array &$array, $new_key, $new_value) {
1369
+	if (array_key_exists($key, $array)) {
1370 1370
 		$new = array();
1371
-		foreach ( $array as $k => $value ) {
1372
-			$new[ $k ] = $value;
1373
-			if ( $k === $key ) {
1374
-				$new[ $new_key ] = $new_value;
1371
+		foreach ($array as $k => $value) {
1372
+			$new[$k] = $value;
1373
+			if ($k === $key) {
1374
+				$new[$new_key] = $new_value;
1375 1375
 			}
1376 1376
 		}
1377 1377
 
@@ -1398,21 +1398,21 @@  discard block
 block discarded – undo
1398 1398
  *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
1399 1399
  *               `$list` will be preserved in the results.
1400 1400
  */
1401
-function give_list_pluck( $list, $field, $index_key = null ) {
1401
+function give_list_pluck($list, $field, $index_key = null) {
1402 1402
 
1403
-	if ( ! $index_key ) {
1403
+	if ( ! $index_key) {
1404 1404
 		/**
1405 1405
 		 * This is simple. Could at some point wrap array_column()
1406 1406
 		 * if we knew we had an array of arrays.
1407 1407
 		 */
1408
-		foreach ( $list as $key => $value ) {
1409
-			if ( is_object( $value ) ) {
1410
-				if ( isset( $value->$field ) ) {
1411
-					$list[ $key ] = $value->$field;
1408
+		foreach ($list as $key => $value) {
1409
+			if (is_object($value)) {
1410
+				if (isset($value->$field)) {
1411
+					$list[$key] = $value->$field;
1412 1412
 				}
1413 1413
 			} else {
1414
-				if ( isset( $value[ $field ] ) ) {
1415
-					$list[ $key ] = $value[ $field ];
1414
+				if (isset($value[$field])) {
1415
+					$list[$key] = $value[$field];
1416 1416
 				}
1417 1417
 			}
1418 1418
 		}
@@ -1425,18 +1425,18 @@  discard block
 block discarded – undo
1425 1425
 	 * to the end of the stack. This is how array_column() behaves.
1426 1426
 	 */
1427 1427
 	$newlist = array();
1428
-	foreach ( $list as $value ) {
1429
-		if ( is_object( $value ) ) {
1430
-			if ( isset( $value->$index_key ) ) {
1431
-				$newlist[ $value->$index_key ] = $value->$field;
1428
+	foreach ($list as $value) {
1429
+		if (is_object($value)) {
1430
+			if (isset($value->$index_key)) {
1431
+				$newlist[$value->$index_key] = $value->$field;
1432 1432
 			} else {
1433 1433
 				$newlist[] = $value->$field;
1434 1434
 			}
1435 1435
 		} else {
1436
-			if ( isset( $value[ $index_key ] ) ) {
1437
-				$newlist[ $value[ $index_key ] ] = $value[ $field ];
1436
+			if (isset($value[$index_key])) {
1437
+				$newlist[$value[$index_key]] = $value[$field];
1438 1438
 			} else {
1439
-				$newlist[] = $value[ $field ];
1439
+				$newlist[] = $value[$field];
1440 1440
 			}
1441 1441
 		}
1442 1442
 	}
@@ -1459,8 +1459,8 @@  discard block
 block discarded – undo
1459 1459
  *
1460 1460
  * @return int|false Meta ID on success, false on failure.
1461 1461
  */
1462
-function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) {
1463
-	return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique );
1462
+function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) {
1463
+	return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique);
1464 1464
 }
1465 1465
 
1466 1466
 /**
@@ -1478,8 +1478,8 @@  discard block
 block discarded – undo
1478 1478
  *
1479 1479
  * @return bool True on success, false on failure.
1480 1480
  */
1481
-function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) {
1482
-	return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value );
1481
+function delete_donor_meta($donor_id, $meta_key, $meta_value = '') {
1482
+	return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value);
1483 1483
 }
1484 1484
 
1485 1485
 /**
@@ -1494,8 +1494,8 @@  discard block
 block discarded – undo
1494 1494
  * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
1495 1495
  *  is true.
1496 1496
  */
1497
-function get_donor_meta( $donor_id, $key = '', $single = false ) {
1498
-	return get_metadata( 'give_customer', $donor_id, $key, $single );
1497
+function get_donor_meta($donor_id, $key = '', $single = false) {
1498
+	return get_metadata('give_customer', $donor_id, $key, $single);
1499 1499
 }
1500 1500
 
1501 1501
 /**
@@ -1512,8 +1512,8 @@  discard block
 block discarded – undo
1512 1512
  *
1513 1513
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
1514 1514
  */
1515
-function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) {
1516
-	return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value );
1515
+function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') {
1516
+	return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value);
1517 1517
 }
1518 1518
 
1519 1519
 
@@ -1526,15 +1526,15 @@  discard block
 block discarded – undo
1526 1526
  *
1527 1527
  * @return void
1528 1528
  */
1529
-function give_recount_form_income_donation( $form_id = 0 ) {
1529
+function give_recount_form_income_donation($form_id = 0) {
1530 1530
 	// Check if form id is not empty.
1531
-	if ( ! empty( $form_id ) ) {
1531
+	if ( ! empty($form_id)) {
1532 1532
 		/**
1533 1533
 		 * Filter to modify payment status.
1534 1534
 		 *
1535 1535
 		 * @since 1.8.13
1536 1536
 		 */
1537
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
1537
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
1538 1538
 
1539 1539
 		/**
1540 1540
 		 * Filter to modify args of payment query before recalculating the form total
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 			'give_recount_form_stats_args', array(
1546 1546
 				'give_forms'     => $form_id,
1547 1547
 				'status'         => $accepted_statuses,
1548
-				'posts_per_page' => - 1,
1548
+				'posts_per_page' => -1,
1549 1549
 				'fields'         => 'ids',
1550 1550
 			)
1551 1551
 		);
@@ -1555,28 +1555,28 @@  discard block
 block discarded – undo
1555 1555
 			'earnings' => 0,
1556 1556
 		);
1557 1557
 
1558
-		$payments = new Give_Payments_Query( $args );
1558
+		$payments = new Give_Payments_Query($args);
1559 1559
 		$payments = $payments->get_payments();
1560 1560
 
1561
-		if ( $payments ) {
1562
-			foreach ( $payments as $payment ) {
1561
+		if ($payments) {
1562
+			foreach ($payments as $payment) {
1563 1563
 				// Ensure acceptible status only
1564
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
1564
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
1565 1565
 					continue;
1566 1566
 				}
1567 1567
 
1568 1568
 				// Ensure only payments for this form are counted
1569
-				if ( $payment->form_id != $form_id ) {
1569
+				if ($payment->form_id != $form_id) {
1570 1570
 					continue;
1571 1571
 				}
1572 1572
 
1573
-				$totals['sales'] ++;
1573
+				$totals['sales']++;
1574 1574
 				$totals['earnings'] += $payment->total;
1575 1575
 
1576 1576
 			}
1577 1577
 		}
1578
-		give_update_meta( $form_id, '_give_form_sales', $totals['sales'] );
1579
-		give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
1578
+		give_update_meta($form_id, '_give_form_sales', $totals['sales']);
1579
+		give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
1580 1580
 	}// End if().
1581 1581
 }
1582 1582
 
@@ -1590,18 +1590,18 @@  discard block
 block discarded – undo
1590 1590
  *
1591 1591
  * @return string
1592 1592
  */
1593
-function give_get_attribute_str( $attributes ) {
1593
+function give_get_attribute_str($attributes) {
1594 1594
 	$attribute_str = '';
1595 1595
 
1596
-	if ( empty( $attributes ) ) {
1596
+	if (empty($attributes)) {
1597 1597
 		return $attribute_str;
1598 1598
 	}
1599 1599
 
1600
-	foreach ( $attributes as $tag => $value ) {
1600
+	foreach ($attributes as $tag => $value) {
1601 1601
 		$attribute_str .= " {$tag}=\"{$value}\"";
1602 1602
 	}
1603 1603
 
1604
-	return trim( $attribute_str );
1604
+	return trim($attribute_str);
1605 1605
 }
1606 1606
 
1607 1607
 /**
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 function give_get_wp_upload_dir() {
1615 1615
 	$wp_upload_dir = wp_upload_dir();
1616 1616
 
1617
-	return ( ! empty( $wp_upload_dir['path'] ) ? $wp_upload_dir['path'] : false );
1617
+	return ( ! empty($wp_upload_dir['path']) ? $wp_upload_dir['path'] : false);
1618 1618
 }
1619 1619
 
1620 1620
 /**
@@ -1626,15 +1626,15 @@  discard block
 block discarded – undo
1626 1626
  *
1627 1627
  * @return string|bool $file_contents File content
1628 1628
  */
1629
-function give_get_core_settings_json( $file_name ) {
1629
+function give_get_core_settings_json($file_name) {
1630 1630
 	$upload_dir = give_get_wp_upload_dir();
1631
-	$file_path  = $upload_dir . '/' . $file_name;
1631
+	$file_path  = $upload_dir.'/'.$file_name;
1632 1632
 
1633
-	if ( is_wp_error( $file_path ) || empty( $file_path ) ) {
1634
-		Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
1633
+	if (is_wp_error($file_path) || empty($file_path)) {
1634
+		Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
1635 1635
 	}
1636 1636
 
1637
-	$file_contents = file_get_contents( $file_path );
1637
+	$file_contents = file_get_contents($file_path);
1638 1638
 
1639 1639
 	return $file_contents;
1640 1640
 }
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
  * @return int $country The two letter country code for the site's base country
1648 1648
  */
1649 1649
 function give_get_limit_display_donations() {
1650
-	return give_get_option( 'limit_display_donations', 1 );
1650
+	return give_get_option('limit_display_donations', 1);
1651 1651
 }
1652 1652
 
1653 1653
 /**
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
  * @since 1.8.17
1657 1657
  */
1658 1658
 function give_donation_history_table_end() {
1659
-	$email = Give()->session->get( 'give_email' );
1659
+	$email = Give()->session->get('give_email');
1660 1660
 	?>
1661 1661
 	<tfoot>
1662 1662
 	<tr>
@@ -1665,16 +1665,16 @@  discard block
 block discarded – undo
1665 1665
 				<div class="give-security-column give-security-description-wrap">
1666 1666
 					<?php
1667 1667
 					echo sprintf(
1668
-						__( 'For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give' ),
1668
+						__('For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give'),
1669 1669
 						$email
1670 1670
 					);
1671 1671
 					?>
1672 1672
 				</div>
1673 1673
 				<div class="give-security-column give-security-button-wrap">
1674 1674
 					<a href="#" data-email="<?php echo $email; ?>" id="give-confirm-email-btn" class="give-confirm-email-btn give-btn">
1675
-						<?php _e( 'Confirm Email', 'give' ); ?>
1675
+						<?php _e('Confirm Email', 'give'); ?>
1676 1676
 					</a>
1677
-					<span><?php _e( 'Email Sent!', 'give' ); ?></span>
1677
+					<span><?php _e('Email Sent!', 'give'); ?></span>
1678 1678
 				</div>
1679 1679
 			</div>
1680 1680
 		</td>
@@ -1694,10 +1694,10 @@  discard block
 block discarded – undo
1694 1694
  *
1695 1695
  * @return void
1696 1696
  */
1697
-function give_doing_it_wrong( $function, $message, $version ) {
1698
-	$message .= "\nBacktrace:" . wp_debug_backtrace_summary();
1697
+function give_doing_it_wrong($function, $message, $version) {
1698
+	$message .= "\nBacktrace:".wp_debug_backtrace_summary();
1699 1699
 
1700
-	_doing_it_wrong( $function, $message , $version );
1700
+	_doing_it_wrong($function, $message, $version);
1701 1701
 }
1702 1702
 
1703 1703
 
@@ -1706,11 +1706,11 @@  discard block
 block discarded – undo
1706 1706
  *
1707 1707
  * @since 1.8.18
1708 1708
  */
1709
-function give_ignore_user_abort(){
1710
-	ignore_user_abort( true );
1709
+function give_ignore_user_abort() {
1710
+	ignore_user_abort(true);
1711 1711
 
1712
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
1713
-		set_time_limit( 0 );
1712
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
1713
+		set_time_limit(0);
1714 1714
 	}
1715 1715
 }
1716 1716
 
@@ -1724,26 +1724,26 @@  discard block
 block discarded – undo
1724 1724
  *
1725 1725
  * @return int
1726 1726
  */
1727
-function give_get_total_post_type_count( $post_type = '', $args = array() ){
1727
+function give_get_total_post_type_count($post_type = '', $args = array()) {
1728 1728
 	global $wpdb;
1729 1729
 	$where = '';
1730 1730
 
1731
-	if( ! $post_type ) {
1731
+	if ( ! $post_type) {
1732 1732
 		return 0;
1733 1733
 	}
1734 1734
 
1735 1735
 	// Bulit where query
1736
-	if( ! empty( $post_type ) ) {
1737
-		$where.=' WHERE';
1736
+	if ( ! empty($post_type)) {
1737
+		$where .= ' WHERE';
1738 1738
 
1739
-		if( is_array( $post_type ) ) {
1740
-			$where .= " post_type='" . implode( "' OR post_type='", $post_type ) . "'";
1741
-		}else{
1739
+		if (is_array($post_type)) {
1740
+			$where .= " post_type='".implode("' OR post_type='", $post_type)."'";
1741
+		} else {
1742 1742
 			$where .= " post_type='{$post_type}'";
1743 1743
 		}
1744 1744
 	}
1745 1745
 
1746 1746
 	$result = $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts}{$where}");
1747 1747
 
1748
-	return absint( $result );
1748
+	return absint($result);
1749 1749
 }
1750 1750
\ No newline at end of file
Please login to merge, or discard this patch.
includes/shortcodes.php 1 patch
Spacing   +123 added lines, -123 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,41 +23,41 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string|bool
25 25
  */
26
-function give_donation_history( $atts ) {
26
+function give_donation_history($atts) {
27 27
 
28
-	$donation_history_args = shortcode_atts( array(
28
+	$donation_history_args = shortcode_atts(array(
29 29
 		'id'             => true,
30 30
 		'date'           => true,
31 31
 		'donor'          => false,
32 32
 		'amount'         => true,
33 33
 		'status'         => false,
34 34
 		'payment_method' => false,
35
-	), $atts, 'donation_history' );
35
+	), $atts, 'donation_history');
36 36
 
37 37
 	// Always show receipt link.
38 38
 	$donation_history_args['details'] = true;
39 39
 
40 40
 	// Set Donation History Shortcode Arguments in session variable.
41
-	Give()->session->set( 'give_donation_history_args', $donation_history_args );
41
+	Give()->session->set('give_donation_history_args', $donation_history_args);
42 42
 
43 43
 	// If payment_key query arg exists, return receipt instead of donation history.
44
-	if ( isset( $_GET['payment_key'] ) ) {
44
+	if (isset($_GET['payment_key'])) {
45 45
 		ob_start();
46 46
 
47
-		echo give_receipt_shortcode( array() );
47
+		echo give_receipt_shortcode(array());
48 48
 
49 49
 		// Display donation history link only if Receipt Access Session is available.
50
-		if ( give_get_receipt_session() ) {
50
+		if (give_get_receipt_session()) {
51 51
 			echo sprintf(
52 52
 				'<a href="%s">%s</a>',
53
-				esc_url( give_get_history_page_uri() ),
54
-				__( '&laquo; Return to All Donations', 'give' )
53
+				esc_url(give_get_history_page_uri()),
54
+				__('&laquo; Return to All Donations', 'give')
55 55
 			);
56 56
 		}
57 57
 		return ob_get_clean();
58 58
 	}
59 59
 
60
-	$email_access = give_get_option( 'email_access' );
60
+	$email_access = give_get_option('email_access');
61 61
 
62 62
 	/**
63 63
 	 * Determine access
@@ -68,31 +68,31 @@  discard block
 block discarded – undo
68 68
 	if (
69 69
 		is_user_logged_in() ||
70 70
 		false !== Give()->session->get_session_expiration() ||
71
-		( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists ) ||
71
+		(give_is_setting_enabled($email_access) && Give()->email_access->token_exists) ||
72 72
 		true === give_get_history_session()
73 73
 	) {
74 74
 		ob_start();
75
-		give_get_template_part( 'history', 'donations' );
75
+		give_get_template_part('history', 'donations');
76 76
 
77 77
 		return ob_get_clean();
78 78
 
79
-	} elseif ( give_is_setting_enabled( $email_access ) ) {
79
+	} elseif (give_is_setting_enabled($email_access)) {
80 80
 		// Is Email-based access enabled?
81 81
 		ob_start();
82
-		give_get_template_part( 'email', 'login-form' );
82
+		give_get_template_part('email', 'login-form');
83 83
 
84 84
 		return ob_get_clean();
85 85
 
86 86
 	} else {
87 87
 
88
-		$output = apply_filters( 'give_donation_history_nonuser_message', Give()->notices->print_frontend_notice( __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ), false ) );
89
-		$output .= do_shortcode( '[give_login]' );
88
+		$output = apply_filters('give_donation_history_nonuser_message', Give()->notices->print_frontend_notice(__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'), false));
89
+		$output .= do_shortcode('[give_login]');
90 90
 
91 91
 		return $output;
92 92
 	}
93 93
 }
94 94
 
95
-add_shortcode( 'donation_history', 'give_donation_history' );
95
+add_shortcode('donation_history', 'give_donation_history');
96 96
 
97 97
 /**
98 98
  * Donation Form Shortcode
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return string
107 107
  */
108
-function give_form_shortcode( $atts ) {
109
-	$atts = shortcode_atts( array(
108
+function give_form_shortcode($atts) {
109
+	$atts = shortcode_atts(array(
110 110
 		'id'                    => '',
111 111
 		'show_title'            => true,
112 112
 		'show_goal'             => true,
@@ -114,21 +114,21 @@  discard block
 block discarded – undo
114 114
 		'float_labels'          => '',
115 115
 		'display_style'         => '',
116 116
 		'continue_button_title' => '',
117
-	), $atts, 'give_form' );
117
+	), $atts, 'give_form');
118 118
 
119 119
 	// Convert string to bool.
120
-	$atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN );
121
-	$atts['show_goal']  = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN );
120
+	$atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN);
121
+	$atts['show_goal']  = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN);
122 122
 
123 123
 	// get the Give Form
124 124
 	ob_start();
125
-	give_get_donation_form( $atts );
125
+	give_get_donation_form($atts);
126 126
 	$final_output = ob_get_clean();
127 127
 
128
-	return apply_filters( 'give_donate_form', $final_output, $atts );
128
+	return apply_filters('give_donate_form', $final_output, $atts);
129 129
 }
130 130
 
131
-add_shortcode( 'give_form', 'give_form_shortcode' );
131
+add_shortcode('give_form', 'give_form_shortcode');
132 132
 
133 133
 /**
134 134
  * Donation Form Goal Shortcode.
@@ -141,36 +141,36 @@  discard block
 block discarded – undo
141 141
  *
142 142
  * @return string
143 143
  */
144
-function give_goal_shortcode( $atts ) {
145
-	$atts = shortcode_atts( array(
144
+function give_goal_shortcode($atts) {
145
+	$atts = shortcode_atts(array(
146 146
 		'id'        => '',
147 147
 		'show_text' => true,
148 148
 		'show_bar'  => true,
149
-	), $atts, 'give_goal' );
149
+	), $atts, 'give_goal');
150 150
 
151 151
 	// get the Give Form.
152 152
 	ob_start();
153 153
 
154 154
 	// Sanity check 1: ensure there is an ID Provided.
155
-	if ( empty( $atts['id'] ) ) {
156
-		Give()->notices->print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true );
155
+	if (empty($atts['id'])) {
156
+		Give()->notices->print_frontend_notice(__('The shortcode is missing Donation Form ID attribute.', 'give'), true);
157 157
 	}
158 158
 
159 159
 	// Sanity check 2: Check the form even has Goals enabled.
160
-	if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) {
160
+	if ( ! give_is_setting_enabled(give_get_meta($atts['id'], '_give_goal_option', true))) {
161 161
 
162
-		Give()->notices->print_frontend_notice( __( 'The form does not have Goals enabled.', 'give' ), true );
162
+		Give()->notices->print_frontend_notice(__('The form does not have Goals enabled.', 'give'), true);
163 163
 	} else {
164 164
 		// Passed all sanity checks: output Goal.
165
-		give_show_goal_progress( $atts['id'], $atts );
165
+		give_show_goal_progress($atts['id'], $atts);
166 166
 	}
167 167
 
168 168
 	$final_output = ob_get_clean();
169 169
 
170
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
170
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
171 171
 }
172 172
 
173
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
173
+add_shortcode('give_goal', 'give_goal_shortcode');
174 174
 
175 175
 
176 176
 /**
@@ -187,22 +187,22 @@  discard block
 block discarded – undo
187 187
  *
188 188
  * @return string
189 189
  */
190
-function give_login_form_shortcode( $atts ) {
190
+function give_login_form_shortcode($atts) {
191 191
 
192
-	$atts = shortcode_atts( array(
192
+	$atts = shortcode_atts(array(
193 193
 		// Add backward compatibility for redirect attribute.
194 194
 		'redirect' => '',
195 195
 		'login-redirect'  => '',
196 196
 		'logout-redirect' => '',
197
-	), $atts, 'give_login' );
197
+	), $atts, 'give_login');
198 198
 
199 199
 	// Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
200
-	$atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' );
200
+	$atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : '');
201 201
 
202
-	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
202
+	return give_login_form($atts['login-redirect'], $atts['logout-redirect']);
203 203
 }
204 204
 
205
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
205
+add_shortcode('give_login', 'give_login_form_shortcode');
206 206
 
207 207
 /**
208 208
  * Register Shortcode.
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
  *
218 218
  * @return string
219 219
  */
220
-function give_register_form_shortcode( $atts ) {
221
-	$atts = shortcode_atts( array(
220
+function give_register_form_shortcode($atts) {
221
+	$atts = shortcode_atts(array(
222 222
 		'redirect' => '',
223
-	), $atts, 'give_register' );
223
+	), $atts, 'give_register');
224 224
 
225
-	return give_register_form( $atts['redirect'] );
225
+	return give_register_form($atts['redirect']);
226 226
 }
227 227
 
228
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
228
+add_shortcode('give_register', 'give_register_form_shortcode');
229 229
 
230 230
 /**
231 231
  * Receipt Shortcode.
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
  *
239 239
  * @return string
240 240
  */
241
-function give_receipt_shortcode( $atts ) {
241
+function give_receipt_shortcode($atts) {
242 242
 
243 243
 	global $give_receipt_args;
244 244
 
245
-	$give_receipt_args = shortcode_atts( array(
246
-		'error'          => __( 'You are missing the payment key to view this donation receipt.', 'give' ),
245
+	$give_receipt_args = shortcode_atts(array(
246
+		'error'          => __('You are missing the payment key to view this donation receipt.', 'give'),
247 247
 		'price'          => true,
248 248
 		'donor'          => true,
249 249
 		'date'           => true,
@@ -252,49 +252,49 @@  discard block
 block discarded – undo
252 252
 		'payment_id'     => true,
253 253
 		'payment_status' => false,
254 254
 		'status_notice'  => true,
255
-	), $atts, 'give_receipt' );
255
+	), $atts, 'give_receipt');
256 256
 
257 257
 	// set $session var
258 258
 	$session = give_get_purchase_session();
259 259
 
260 260
 	// set payment key var
261
-	if ( isset( $_GET['payment_key'] ) ) {
262
-		$payment_key = urldecode( $_GET['payment_key'] );
263
-	} elseif ( $session ) {
261
+	if (isset($_GET['payment_key'])) {
262
+		$payment_key = urldecode($_GET['payment_key']);
263
+	} elseif ($session) {
264 264
 		$payment_key = $session['purchase_key'];
265
-	} elseif ( $give_receipt_args['payment_key'] ) {
265
+	} elseif ($give_receipt_args['payment_key']) {
266 266
 		$payment_key = $give_receipt_args['payment_key'];
267 267
 	}
268 268
 
269
-	$email_access = give_get_option( 'email_access' );
269
+	$email_access = give_get_option('email_access');
270 270
 
271 271
 	// No payment_key found & Email Access is Turned on.
272
-	if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
272
+	if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
273 273
 
274 274
 		ob_start();
275 275
 
276
-		give_get_template_part( 'email-login-form' );
276
+		give_get_template_part('email-login-form');
277 277
 
278 278
 		return ob_get_clean();
279 279
 
280
-	} elseif ( ! isset( $payment_key ) ) {
280
+	} elseif ( ! isset($payment_key)) {
281 281
 
282
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
282
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
283 283
 
284 284
 	}
285 285
 
286
-	$user_can_view = give_can_view_receipt( $payment_key );
286
+	$user_can_view = give_can_view_receipt($payment_key);
287 287
 
288 288
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt.
289
-	if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
289
+	if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
290 290
 
291 291
 		ob_start();
292 292
 
293
-		give_get_template_part( 'email-login-form' );
293
+		give_get_template_part('email-login-form');
294 294
 
295 295
 		return ob_get_clean();
296 296
 
297
-	} elseif ( ! $user_can_view ) {
297
+	} elseif ( ! $user_can_view) {
298 298
 
299 299
 		global $give_login_redirect;
300 300
 
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 
303 303
 		ob_start();
304 304
 
305
-		Give()->notices->print_frontend_notice( apply_filters( 'give_must_be_logged_in_error_message', __( 'You must be logged in to view this donation receipt.', 'give' ) ) );
305
+		Give()->notices->print_frontend_notice(apply_filters('give_must_be_logged_in_error_message', __('You must be logged in to view this donation receipt.', 'give')));
306 306
 
307
-		give_get_template_part( 'shortcode', 'login' );
307
+		give_get_template_part('shortcode', 'login');
308 308
 
309 309
 		$login_form = ob_get_clean();
310 310
 
@@ -318,20 +318,20 @@  discard block
 block discarded – undo
318 318
 	 * or if user is logged out and donation was made as a guest, the donation session is checked for
319 319
 	 * or if user is logged in and the user can view sensitive shop data.
320 320
 	 */
321
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
322
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
321
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
322
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
323 323
 	}
324 324
 
325 325
 	ob_start();
326 326
 
327
-	give_get_template_part( 'shortcode', 'receipt' );
327
+	give_get_template_part('shortcode', 'receipt');
328 328
 
329 329
 	$display = ob_get_clean();
330 330
 
331 331
 	return $display;
332 332
 }
333 333
 
334
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
334
+add_shortcode('give_receipt', 'give_receipt_shortcode');
335 335
 
336 336
 /**
337 337
  * Profile Editor Shortcode.
@@ -350,25 +350,25 @@  discard block
 block discarded – undo
350 350
  *
351 351
  * @return string Output generated from the profile editor
352 352
  */
353
-function give_profile_editor_shortcode( $atts ) {
353
+function give_profile_editor_shortcode($atts) {
354 354
 
355 355
 	ob_start();
356 356
 
357 357
 	// Restrict access to donor profile, if donor and user are disconnected.
358
-	$is_donor_disconnected = get_user_meta( get_current_user_id(), '_give_is_donor_disconnected', true );
359
-	if ( is_user_logged_in() && $is_donor_disconnected ) {
360
-		Give()->notices->print_frontend_notice( __( 'Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give' ), true, 'error' );
358
+	$is_donor_disconnected = get_user_meta(get_current_user_id(), '_give_is_donor_disconnected', true);
359
+	if (is_user_logged_in() && $is_donor_disconnected) {
360
+		Give()->notices->print_frontend_notice(__('Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give'), true, 'error');
361 361
 		return false;
362 362
 	}
363 363
 
364
-	give_get_template_part( 'shortcode', 'profile-editor' );
364
+	give_get_template_part('shortcode', 'profile-editor');
365 365
 
366 366
 	$display = ob_get_clean();
367 367
 
368 368
 	return $display;
369 369
 }
370 370
 
371
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
371
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
372 372
 
373 373
 /**
374 374
  * Process Profile Updater Form.
@@ -381,29 +381,29 @@  discard block
 block discarded – undo
381 381
  *
382 382
  * @return bool
383 383
  */
384
-function give_process_profile_editor_updates( $data ) {
384
+function give_process_profile_editor_updates($data) {
385 385
 	// Profile field change request.
386
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
386
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
387 387
 		return false;
388 388
 	}
389 389
 
390 390
 	// Nonce security.
391
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
391
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
392 392
 		return false;
393 393
 	}
394 394
 
395 395
 	$user_id       = get_current_user_id();
396
-	$old_user_data = get_userdata( $user_id );
396
+	$old_user_data = get_userdata($user_id);
397 397
 
398 398
 	/* @var Give_Donor $donor */
399
-	$donor = new Give_Donor( $user_id, true );
399
+	$donor = new Give_Donor($user_id, true);
400 400
 
401
-	$display_name     = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
402
-	$first_name       = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
403
-	$last_name        = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
404
-	$email            = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
405
-	$password         = ! empty( $data['give_new_user_pass1'] ) ? $data['give_new_user_pass1'] : '';
406
-	$confirm_password = ! empty( $data['give_new_user_pass2'] ) ? $data['give_new_user_pass2'] : '';
401
+	$display_name     = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
402
+	$first_name       = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
403
+	$last_name        = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
404
+	$email            = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
405
+	$password         = ! empty($data['give_new_user_pass1']) ? $data['give_new_user_pass1'] : '';
406
+	$confirm_password = ! empty($data['give_new_user_pass2']) ? $data['give_new_user_pass2'] : '';
407 407
 
408 408
 	$userdata = array(
409 409
 		'ID'           => $user_id,
@@ -422,58 +422,58 @@  discard block
 block discarded – undo
422 422
 	 * @param int $user_id The ID of the user.
423 423
 	 * @param array $userdata User info, including ID, first name, last name, display name and email.
424 424
 	 */
425
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
425
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
426 426
 
427 427
 	// Make sure to validate first name of existing donors.
428
-	if ( empty( $first_name ) ) {
428
+	if (empty($first_name)) {
429 429
 		// Empty First Name.
430
-		give_set_error( 'empty_first_name', __( 'Please enter your first name.', 'give' ) );
430
+		give_set_error('empty_first_name', __('Please enter your first name.', 'give'));
431 431
 	}
432 432
 
433 433
 	// Make sure to validate passwords for existing Donors.
434
-	give_validate_user_password( $password, $confirm_password );
434
+	give_validate_user_password($password, $confirm_password);
435 435
 
436
-	if ( empty( $email ) ) {
436
+	if (empty($email)) {
437 437
 		// Make sure email should not be empty.
438
-		give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) );
438
+		give_set_error('email_empty', __('The email you entered is empty.', 'give'));
439 439
 
440
-	} elseif ( ! is_email( $email ) ) {
440
+	} elseif ( ! is_email($email)) {
441 441
 		// Make sure email should be valid.
442
-		give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) );
442
+		give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give'));
443 443
 
444
-	} elseif ( $email != $old_user_data->user_email ) {
444
+	} elseif ($email != $old_user_data->user_email) {
445 445
 		// Make sure the new email doesn't belong to another user.
446
-		if ( email_exists( $email ) ) {
447
-			give_set_error( 'user_email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) );
448
-		} elseif ( Give()->donors->get_donor_by( 'email', $email ) ) {
446
+		if (email_exists($email)) {
447
+			give_set_error('user_email_exists', __('The email you entered belongs to another user. Please use another.', 'give'));
448
+		} elseif (Give()->donors->get_donor_by('email', $email)) {
449 449
 			// Make sure the new email doesn't belong to another user.
450
-			give_set_error( 'donor_email_exists', __( 'The email you entered belongs to another donor. Please use another.', 'give' ) );
450
+			give_set_error('donor_email_exists', __('The email you entered belongs to another donor. Please use another.', 'give'));
451 451
 		}
452 452
 	}
453 453
 
454 454
 	// Check for errors.
455 455
 	$errors = give_get_errors();
456 456
 
457
-	if ( $errors ) {
457
+	if ($errors) {
458 458
 		// Send back to the profile editor if there are errors.
459
-		wp_redirect( $data['give_redirect'] );
459
+		wp_redirect($data['give_redirect']);
460 460
 		give_die();
461 461
 	}
462 462
 
463 463
 	// Update Donor First Name and Last Name.
464
-	Give()->donors->update( $donor->id, array(
465
-		'name' => trim( "{$first_name} {$last_name}" ),
466
-	) );
467
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name );
468
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name );
464
+	Give()->donors->update($donor->id, array(
465
+		'name' => trim("{$first_name} {$last_name}"),
466
+	));
467
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name);
468
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name);
469 469
 
470 470
 	$current_user = wp_get_current_user();
471 471
 
472 472
 	// Compares new values with old values to detect change in values.
473
-	$email_update        = ( $email !== $current_user->user_email ) ? true : false;
474
-	$display_name_update = ( $display_name !== $current_user->display_name ) ? true : false;
475
-	$first_name_update   = ( $first_name !== $current_user->first_name ) ? true : false;
476
-	$last_name_update    = ( $last_name !== $current_user->last_name ) ? true : false;
473
+	$email_update        = ($email !== $current_user->user_email) ? true : false;
474
+	$display_name_update = ($display_name !== $current_user->display_name) ? true : false;
475
+	$first_name_update   = ($first_name !== $current_user->first_name) ? true : false;
476
+	$last_name_update    = ($last_name !== $current_user->last_name) ? true : false;
477 477
 	$update_code         = 0;
478 478
 
479 479
 	/**
@@ -481,35 +481,35 @@  discard block
 block discarded – undo
481 481
 	 *
482 482
 	 * @var boolean
483 483
 	 */
484
-	$profile_update  = ( $email_update || $display_name_update || $first_name_update || $last_name_update );
484
+	$profile_update = ($email_update || $display_name_update || $first_name_update || $last_name_update);
485 485
 
486 486
 	/**
487 487
 	 * True if password fields are filled.
488 488
 	 *
489 489
 	 * @var boolean
490 490
 	 */
491
-	$password_update = ( ! empty( $password ) && ! empty( $confirm_password ) );
491
+	$password_update = ( ! empty($password) && ! empty($confirm_password));
492 492
 
493
-	if ( $profile_update ) {
493
+	if ($profile_update) {
494 494
 
495 495
 		// If only profile fields are updated.
496 496
 		$update_code = '1';
497 497
 
498
-		if ( $password_update ) {
498
+		if ($password_update) {
499 499
 
500 500
 			// If profile fields AND password both are updated.
501 501
 			$update_code = '2';
502 502
 		}
503
-	} elseif ( $password_update ) {
503
+	} elseif ($password_update) {
504 504
 
505 505
 		// If only password is updated.
506 506
 		$update_code = '3';
507 507
 	}
508 508
 
509 509
 	// Update the user.
510
-	$updated = wp_update_user( $userdata );
510
+	$updated = wp_update_user($userdata);
511 511
 
512
-	if ( $updated ) {
512
+	if ($updated) {
513 513
 
514 514
 		/**
515 515
 		 * Fires after updating user profile.
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 		 * @param int $user_id The ID of the user.
520 520
 		 * @param array $userdata User info, including ID, first name, last name, display name and email.
521 521
 		 */
522
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
522
+		do_action('give_user_profile_updated', $user_id, $userdata);
523 523
 
524 524
 		$profile_edit_redirect_args = array(
525 525
 			'updated'     => 'true',
@@ -530,10 +530,10 @@  discard block
 block discarded – undo
530 530
 		 * Update codes '2' and '3' indicate a password change.
531 531
 		 * If the password is changed, then logout and redirect to the same page.
532 532
 		 */
533
-		if ( '2' === $update_code || '3' === $update_code ) {
534
-			wp_logout( wp_redirect( add_query_arg( $profile_edit_redirect_args, $data['give_redirect'] ) ) );
533
+		if ('2' === $update_code || '3' === $update_code) {
534
+			wp_logout(wp_redirect(add_query_arg($profile_edit_redirect_args, $data['give_redirect'])));
535 535
 		} else {
536
-			wp_redirect( add_query_arg( $profile_edit_redirect_args, $data['give_redirect'] ) );
536
+			wp_redirect(add_query_arg($profile_edit_redirect_args, $data['give_redirect']));
537 537
 		}
538 538
 
539 539
 		give_die();
@@ -542,4 +542,4 @@  discard block
 block discarded – undo
542 542
 	return false;
543 543
 }
544 544
 
545
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
545
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
Please login to merge, or discard this patch.
includes/payments/actions.php 1 patch
Spacing   +106 added lines, -110 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
 
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return void
30 30
  */
31
-function give_complete_purchase( $payment_id, $new_status, $old_status ) {
31
+function give_complete_purchase($payment_id, $new_status, $old_status) {
32 32
 
33 33
 	// Make sure that payments are only completed once.
34
-	if ( $old_status == 'publish' || $old_status == 'complete' ) {
34
+	if ($old_status == 'publish' || $old_status == 'complete') {
35 35
 		return;
36 36
 	}
37 37
 
38 38
 	// Make sure the payment completion is only processed when new status is complete.
39
-	if ( $new_status != 'publish' && $new_status != 'complete' ) {
39
+	if ($new_status != 'publish' && $new_status != 'complete') {
40 40
 		return;
41 41
 	}
42 42
 
43
-	$payment = new Give_Payment( $payment_id );
43
+	$payment = new Give_Payment($payment_id);
44 44
 
45
-	$creation_date  = get_post_field( 'post_date', $payment_id, 'raw' );
45
+	$creation_date  = get_post_field('post_date', $payment_id, 'raw');
46 46
 	$payment_meta   = $payment->payment_meta;
47 47
 	$completed_date = $payment->completed_date;
48 48
 	$user_info      = $payment->user_info;
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @param int $payment_id The ID of the payment.
60 60
 	 */
61
-	do_action( 'give_pre_complete_donation', $payment_id );
61
+	do_action('give_pre_complete_donation', $payment_id);
62 62
 
63 63
 	// Ensure these actions only run once, ever.
64
-	if ( empty( $completed_date ) ) {
64
+	if (empty($completed_date)) {
65 65
 
66
-		give_record_donation_in_log( $form_id, $payment_id, $price_id, $creation_date );
66
+		give_record_donation_in_log($form_id, $payment_id, $price_id, $creation_date);
67 67
 
68 68
 		/**
69 69
 		 * Fires after logging donation record.
@@ -74,29 +74,29 @@  discard block
 block discarded – undo
74 74
 		 * @param int   $payment_id   The ID number of the payment.
75 75
 		 * @param array $payment_meta The payment meta.
76 76
 		 */
77
-		do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta );
77
+		do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta);
78 78
 
79 79
 	}
80 80
 
81 81
 	// Increase the earnings for this form ID.
82
-	give_increase_earnings( $form_id, $amount );
83
-	give_increase_donation_count( $form_id );
82
+	give_increase_earnings($form_id, $amount);
83
+	give_increase_donation_count($form_id);
84 84
 
85 85
 	// @todo: Refresh only range related stat cache
86 86
 	give_delete_donation_stats();
87 87
 
88 88
 	// Increase the donor's donation stats.
89
-	$donor = new Give_Donor( $donor_id );
89
+	$donor = new Give_Donor($donor_id);
90 90
 	$donor->increase_purchase_count();
91
-	$donor->increase_value( $amount );
91
+	$donor->increase_value($amount);
92 92
 
93
-	give_increase_total_earnings( $amount );
93
+	give_increase_total_earnings($amount);
94 94
 
95 95
 	// Ensure this action only runs once ever.
96
-	if ( empty( $completed_date ) ) {
96
+	if (empty($completed_date)) {
97 97
 
98 98
 		// Save the completed date.
99
-		$payment->completed_date = current_time( 'mysql' );
99
+		$payment->completed_date = current_time('mysql');
100 100
 		$payment->save();
101 101
 
102 102
 		/**
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @param int $payment_id The ID of the payment.
108 108
 		 */
109
-		do_action( 'give_complete_donation', $payment_id );
109
+		do_action('give_complete_donation', $payment_id);
110 110
 	}
111 111
 
112 112
 }
113 113
 
114
-add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 );
114
+add_action('give_update_payment_status', 'give_complete_purchase', 100, 3);
115 115
 
116 116
 
117 117
 /**
@@ -125,20 +125,20 @@  discard block
 block discarded – undo
125 125
  *
126 126
  * @return void
127 127
  */
128
-function give_record_status_change( $payment_id, $new_status, $old_status ) {
128
+function give_record_status_change($payment_id, $new_status, $old_status) {
129 129
 
130 130
 	// Get the list of statuses so that status in the payment note can be translated.
131 131
 	$stati      = give_get_payment_statuses();
132
-	$old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status;
133
-	$new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status;
132
+	$old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status;
133
+	$new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status;
134 134
 
135 135
 	// translators: 1: old status 2: new status.
136
-	$status_change = sprintf( esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), $old_status, $new_status );
136
+	$status_change = sprintf(esc_html__('Status changed from %1$s to %2$s.', 'give'), $old_status, $new_status);
137 137
 
138
-	give_insert_payment_note( $payment_id, $status_change );
138
+	give_insert_payment_note($payment_id, $status_change);
139 139
 }
140 140
 
141
-add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 );
141
+add_action('give_update_payment_status', 'give_record_status_change', 100, 3);
142 142
 
143 143
 
144 144
 /**
@@ -154,25 +154,25 @@  discard block
 block discarded – undo
154 154
  *
155 155
  * @return void
156 156
  */
157
-function give_update_old_payments_with_totals( $data ) {
158
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) {
157
+function give_update_old_payments_with_totals($data) {
158
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) {
159 159
 		return;
160 160
 	}
161 161
 
162
-	if ( get_option( 'give_payment_totals_upgraded' ) ) {
162
+	if (get_option('give_payment_totals_upgraded')) {
163 163
 		return;
164 164
 	}
165 165
 
166
-	$payments = give_get_payments( array(
166
+	$payments = give_get_payments(array(
167 167
 		'offset' => 0,
168
-		'number' => - 1,
168
+		'number' => -1,
169 169
 		'mode'   => 'all',
170
-	) );
170
+	));
171 171
 
172
-	if ( $payments ) {
173
-		foreach ( $payments as $payment ) {
172
+	if ($payments) {
173
+		foreach ($payments as $payment) {
174 174
 
175
-			$payment = new Give_Payment( $payment->ID );
175
+			$payment = new Give_Payment($payment->ID);
176 176
 			$meta    = $payment->get_meta();
177 177
 
178 178
 			$payment->total = $meta['amount'];
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 		}
182 182
 	}
183 183
 
184
-	add_option( 'give_payment_totals_upgraded', 1 );
184
+	add_option('give_payment_totals_upgraded', 1);
185 185
 }
186 186
 
187
-add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' );
187
+add_action('give_upgrade_payments', 'give_update_old_payments_with_totals');
188 188
 
189 189
 /**
190 190
  * Mark Abandoned Donations
@@ -198,17 +198,17 @@  discard block
 block discarded – undo
198 198
 function give_mark_abandoned_donations() {
199 199
 	$args = array(
200 200
 		'status' => 'pending',
201
-		'number' => - 1,
201
+		'number' => -1,
202 202
 		'output' => 'give_payments',
203 203
 	);
204 204
 
205
-	add_filter( 'posts_where', 'give_filter_where_older_than_week' );
205
+	add_filter('posts_where', 'give_filter_where_older_than_week');
206 206
 
207
-	$payments = give_get_payments( $args );
207
+	$payments = give_get_payments($args);
208 208
 
209
-	remove_filter( 'posts_where', 'give_filter_where_older_than_week' );
209
+	remove_filter('posts_where', 'give_filter_where_older_than_week');
210 210
 
211
-	if ( $payments ) {
211
+	if ($payments) {
212 212
 		/**
213 213
 		 * Filter payment gateways:  Used to set payment gateways which can be skip while transferring pending payment to abandon.
214 214
 		 *
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
 		 *
217 217
 		 * @param array $skip_payment_gateways Array of payment gateways
218 218
 		 */
219
-		$skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) );
219
+		$skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline'));
220 220
 
221 221
 		/* @var Give_Payment $payment */
222
-		foreach ( $payments as $payment ) {
223
-			$gateway = give_get_payment_gateway( $payment->ID );
222
+		foreach ($payments as $payment) {
223
+			$gateway = give_get_payment_gateway($payment->ID);
224 224
 
225 225
 			// Skip payment gateways.
226
-			if ( in_array( $gateway, $skip_payment_gateways ) ) {
226
+			if (in_array($gateway, $skip_payment_gateways)) {
227 227
 				continue;
228 228
 			}
229 229
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	}
234 234
 }
235 235
 
236
-Give_Cron::add_weekly_event( 'give_mark_abandoned_donations' );
236
+Give_Cron::add_weekly_event('give_mark_abandoned_donations');
237 237
 
238 238
 
239 239
 /**
@@ -245,15 +245,15 @@  discard block
 block discarded – undo
245 245
  *
246 246
  * @return void
247 247
  */
248
-function give_refresh_thismonth_stat_transients( $payment_ID ) {
248
+function give_refresh_thismonth_stat_transients($payment_ID) {
249 249
 	// Monthly stats.
250
-	Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
250
+	Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
251 251
 
252 252
 	// @todo: Refresh only range related stat cache
253 253
 	give_delete_donation_stats();
254 254
 }
255 255
 
256
-add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' );
256
+add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients');
257 257
 
258 258
 
259 259
 /**
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return array
271 271
  */
272
-function give_bc_v20_get_payment_meta( $check, $object_id, $meta_key, $single ) {
272
+function give_bc_v20_get_payment_meta($check, $object_id, $meta_key, $single) {
273 273
 	// Bailout.
274 274
 	if (
275
-		'give_payment' !== get_post_type( $object_id ) ||
275
+		'give_payment' !== get_post_type($object_id) ||
276 276
 		'_give_payment_meta' !== $meta_key ||
277
-		! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' )
277
+		! give_has_upgrade_completed('v20_upgrades_payment_metadata')
278 278
 	) {
279 279
 		return $check;
280 280
 	}
@@ -282,73 +282,69 @@  discard block
 block discarded – undo
282 282
 	$cache_key = "_give_payment_meta_{$object_id}";
283 283
 
284 284
 	// Get already calculate payment meta from cache.
285
-	$payment_meta = Give_Cache::get_db_query( $cache_key );
285
+	$payment_meta = Give_Cache::get_db_query($cache_key);
286 286
 
287
-	if ( is_null( $payment_meta ) ) {
287
+	if (is_null($payment_meta)) {
288 288
 		// Remove filter.
289
-		remove_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999 );
289
+		remove_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999);
290 290
 
291
-		$donation = new Give_Payment( $object_id );
291
+		$donation = new Give_Payment($object_id);
292 292
 
293 293
 		// Get all payment meta.
294
-		$payment_meta = give_get_meta( $object_id );
294
+		$payment_meta = give_get_meta($object_id);
295 295
 
296 296
 		// Set default value to array.
297
-		if ( empty( $payment_meta ) ) {
297
+		if (empty($payment_meta)) {
298 298
 			return $check;
299 299
 		}
300 300
 
301 301
 		// Convert all meta key value to string instead of array
302
-		array_walk( $payment_meta, function ( &$meta, $key ) {
303
-			$meta = current( $meta );
302
+		array_walk($payment_meta, function(&$meta, $key) {
303
+			$meta = current($meta);
304 304
 		} );
305 305
 
306 306
 		/**
307 307
 		 * Add backward compatibility to old meta keys.
308 308
 		 */
309 309
 		// Donation key.
310
-		$payment_meta['key'] = ! empty( $payment_meta['_give_payment_purchase_key'] ) ? $payment_meta['_give_payment_purchase_key'] : '';
310
+		$payment_meta['key'] = ! empty($payment_meta['_give_payment_purchase_key']) ? $payment_meta['_give_payment_purchase_key'] : '';
311 311
 
312 312
 		// Donation form.
313
-		$payment_meta['form_title'] = ! empty( $payment_meta['_give_payment_form_title'] ) ? $payment_meta['_give_payment_form_title'] : '';
313
+		$payment_meta['form_title'] = ! empty($payment_meta['_give_payment_form_title']) ? $payment_meta['_give_payment_form_title'] : '';
314 314
 
315 315
 		// Donor email.
316
-		$payment_meta['email'] = ! empty( $payment_meta['_give_payment_donor_email'] ) ? $payment_meta['_give_payment_donor_email'] : '';
317
-		$payment_meta['email'] = ! empty( $payment_meta['email'] ) ?
318
-			$payment_meta['email'] :
319
-			Give()->donors->get_column( 'email', $donation->donor_id );
316
+		$payment_meta['email'] = ! empty($payment_meta['_give_payment_donor_email']) ? $payment_meta['_give_payment_donor_email'] : '';
317
+		$payment_meta['email'] = ! empty($payment_meta['email']) ?
318
+			$payment_meta['email'] : Give()->donors->get_column('email', $donation->donor_id);
320 319
 
321 320
 		// Form id.
322
-		$payment_meta['form_id'] = ! empty( $payment_meta['_give_payment_form_id'] ) ? $payment_meta['_give_payment_form_id'] : '';
321
+		$payment_meta['form_id'] = ! empty($payment_meta['_give_payment_form_id']) ? $payment_meta['_give_payment_form_id'] : '';
323 322
 
324 323
 		// Price id.
325
-		$payment_meta['price_id'] = ! empty( $payment_meta['_give_payment_price_id'] ) ? $payment_meta['_give_payment_price_id'] : '';
324
+		$payment_meta['price_id'] = ! empty($payment_meta['_give_payment_price_id']) ? $payment_meta['_give_payment_price_id'] : '';
326 325
 
327 326
 		// Date.
328
-		$payment_meta['date'] = ! empty( $payment_meta['_give_payment_date'] ) ? $payment_meta['_give_payment_date'] : '';
329
-		$payment_meta['date'] = ! empty( $payment_meta['date'] ) ?
330
-			$payment_meta['date'] :
331
-			get_post_field( 'post_date', $object_id );
327
+		$payment_meta['date'] = ! empty($payment_meta['_give_payment_date']) ? $payment_meta['_give_payment_date'] : '';
328
+		$payment_meta['date'] = ! empty($payment_meta['date']) ?
329
+			$payment_meta['date'] : get_post_field('post_date', $object_id);
332 330
 
333 331
 
334 332
 		// Currency.
335
-		$payment_meta['currency'] = ! empty( $payment_meta['_give_payment_currency'] ) ? $payment_meta['_give_payment_currency'] : '';
333
+		$payment_meta['currency'] = ! empty($payment_meta['_give_payment_currency']) ? $payment_meta['_give_payment_currency'] : '';
336 334
 
337 335
 		// Decode donor data.
338
-		$donor_id = ! empty( $payment_meta['_give_payment_donor_id'] ) ? $payment_meta['_give_payment_donor_id'] : 0;
339
-		$donor    = new Give_Donor( $donor_id );
336
+		$donor_id = ! empty($payment_meta['_give_payment_donor_id']) ? $payment_meta['_give_payment_donor_id'] : 0;
337
+		$donor    = new Give_Donor($donor_id);
340 338
 
341 339
 		// Donor first name.
342
-		$donor_data['first_name'] = ! empty( $payment_meta['_give_donor_billing_first_name'] ) ? $payment_meta['_give_donor_billing_first_name'] : '';
343
-		$donor_data['first_name'] = ! empty( $donor_data['first_name'] ) ?
344
-			$donor_data['first_name'] :
345
-			$donor->get_first_name();
340
+		$donor_data['first_name'] = ! empty($payment_meta['_give_donor_billing_first_name']) ? $payment_meta['_give_donor_billing_first_name'] : '';
341
+		$donor_data['first_name'] = ! empty($donor_data['first_name']) ?
342
+			$donor_data['first_name'] : $donor->get_first_name();
346 343
 
347 344
 		// Donor last name.
348
-		$donor_data['last_name'] = ! empty( $payment_meta['_give_donor_billing_last_name'] ) ? $payment_meta['_give_donor_billing_last_name'] : '';
349
-		$donor_data['last_name'] = ! empty( $donor_data['last_name'] ) ?
350
-			$donor_data['last_name'] :
351
-			$donor->get_last_name();
345
+		$donor_data['last_name'] = ! empty($payment_meta['_give_donor_billing_last_name']) ? $payment_meta['_give_donor_billing_last_name'] : '';
346
+		$donor_data['last_name'] = ! empty($donor_data['last_name']) ?
347
+			$donor_data['last_name'] : $donor->get_last_name();
352 348
 
353 349
 		// Donor email.
354 350
 		$donor_data['email'] = $payment_meta['email'];
@@ -359,63 +355,63 @@  discard block
 block discarded – undo
359 355
 		$donor_data['address'] = false;
360 356
 
361 357
 		// Address1.
362
-		$address1 = ! empty( $payment_meta['_give_donor_billing_address1'] ) ? $payment_meta['_give_donor_billing_address1'] : '';
363
-		if ( $address1 ) {
358
+		$address1 = ! empty($payment_meta['_give_donor_billing_address1']) ? $payment_meta['_give_donor_billing_address1'] : '';
359
+		if ($address1) {
364 360
 			$donor_data['address']['line1'] = $address1;
365 361
 		}
366 362
 
367 363
 		// Address2.
368
-		$address2 = ! empty( $payment_meta['_give_donor_billing_address2'] ) ? $payment_meta['_give_donor_billing_address2'] : '';
369
-		if ( $address2 ) {
364
+		$address2 = ! empty($payment_meta['_give_donor_billing_address2']) ? $payment_meta['_give_donor_billing_address2'] : '';
365
+		if ($address2) {
370 366
 			$donor_data['address']['line2'] = $address2;
371 367
 		}
372 368
 
373 369
 		// City.
374
-		$city = ! empty( $payment_meta['_give_donor_billing_city'] ) ? $payment_meta['_give_donor_billing_city'] : '';
375
-		if ( $city ) {
370
+		$city = ! empty($payment_meta['_give_donor_billing_city']) ? $payment_meta['_give_donor_billing_city'] : '';
371
+		if ($city) {
376 372
 			$donor_data['address']['city'] = $city;
377 373
 		}
378 374
 
379 375
 		// Zip.
380
-		$zip = ! empty( $payment_meta['_give_donor_billing_zip'] ) ? $payment_meta['_give_donor_billing_zip'] : '';
381
-		if ( $zip ) {
376
+		$zip = ! empty($payment_meta['_give_donor_billing_zip']) ? $payment_meta['_give_donor_billing_zip'] : '';
377
+		if ($zip) {
382 378
 			$donor_data['address']['zip'] = $zip;
383 379
 		}
384 380
 
385 381
 		// State.
386
-		$state = ! empty( $payment_meta['_give_donor_billing_state'] ) ? $payment_meta['_give_donor_billing_state'] : '';
387
-		if ( $state ) {
382
+		$state = ! empty($payment_meta['_give_donor_billing_state']) ? $payment_meta['_give_donor_billing_state'] : '';
383
+		if ($state) {
388 384
 			$donor_data['address']['state'] = $state;
389 385
 		}
390 386
 
391 387
 		// Country.
392
-		$country = ! empty( $payment_meta['_give_donor_billing_country'] ) ? $payment_meta['_give_donor_billing_country'] : '';
393
-		if ( $country ) {
388
+		$country = ! empty($payment_meta['_give_donor_billing_country']) ? $payment_meta['_give_donor_billing_country'] : '';
389
+		if ($country) {
394 390
 			$donor_data['address']['country'] = $country;
395 391
 		}
396 392
 
397 393
 		$payment_meta['user_info'] = $donor_data;
398 394
 
399 395
 		// Add filter
400
-		add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
396
+		add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4);
401 397
 
402 398
 		// Set custom meta key into payment meta.
403
-		if ( ! empty( $payment_meta['_give_payment_meta'] ) ) {
404
-			$payment_meta = array_merge( maybe_unserialize( $payment_meta['_give_payment_meta'] ), $payment_meta );
399
+		if ( ! empty($payment_meta['_give_payment_meta'])) {
400
+			$payment_meta = array_merge(maybe_unserialize($payment_meta['_give_payment_meta']), $payment_meta);
405 401
 		}
406 402
 
407 403
 		// Set cache.
408
-		Give_Cache::set_db_query( $cache_key, $payment_meta );
404
+		Give_Cache::set_db_query($cache_key, $payment_meta);
409 405
 	}
410 406
 
411
-	if ( $single ) {
407
+	if ($single) {
412 408
 		/**
413 409
 		 * Filter the payment meta
414 410
 		 * Add custom meta key to payment meta
415 411
 		 *
416 412
 		 * @since 2.0
417 413
 		 */
418
-		$new_payment_meta[0] = apply_filters( 'give_get_payment_meta', $payment_meta, $object_id, $meta_key );
414
+		$new_payment_meta[0] = apply_filters('give_get_payment_meta', $payment_meta, $object_id, $meta_key);
419 415
 
420 416
 		$payment_meta = $new_payment_meta;
421 417
 	}
@@ -423,7 +419,7 @@  discard block
 block discarded – undo
423 419
 	return $payment_meta;
424 420
 }
425 421
 
426
-add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
422
+add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4);
427 423
 
428 424
 /**
429 425
  * Add meta in payment that store page id and page url.
@@ -435,19 +431,19 @@  discard block
 block discarded – undo
435 431
  *
436 432
  * @param int $payment_id Payment id for which the meta value should be updated.
437 433
  */
438
-function give_payment_save_page_data( $payment_id ) {
439
-	$page_url = ( ! empty( $_REQUEST['give-current-url'] ) ? esc_url( $_REQUEST['give-current-url'] ) : false );
434
+function give_payment_save_page_data($payment_id) {
435
+	$page_url = ( ! empty($_REQUEST['give-current-url']) ? esc_url($_REQUEST['give-current-url']) : false);
440 436
 
441 437
 	// Check $page_url is not empty.
442
-	if ( $page_url ) {
443
-		update_post_meta( $payment_id, '_give_current_url', $page_url );
444
-		$page_id = url_to_postid( $page_url );
438
+	if ($page_url) {
439
+		update_post_meta($payment_id, '_give_current_url', $page_url);
440
+		$page_id = url_to_postid($page_url);
445 441
 		// Check $page_id is not empty.
446
-		if ( $page_id ) {
447
-			update_post_meta( $payment_id, '_give_current_page_id', $page_id );
442
+		if ($page_id) {
443
+			update_post_meta($payment_id, '_give_current_page_id', $page_id);
448 444
 		}
449 445
 	}
450 446
 }
451 447
 
452 448
 // Fire when payment is save.
453
-add_action( 'give_insert_payment', 'give_payment_save_page_data' );
454 449
\ No newline at end of file
450
+add_action('give_insert_payment', 'give_payment_save_page_data');
455 451
\ No newline at end of file
Please login to merge, or discard this patch.
includes/payments/functions.php 1 patch
Spacing   +381 added lines, -383 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
 
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array $payments Payments retrieved from the database
46 46
  */
47
-function give_get_payments( $args = array() ) {
47
+function give_get_payments($args = array()) {
48 48
 
49 49
 	// Fallback to post objects to ensure backwards compatibility.
50
-	if ( ! isset( $args['output'] ) ) {
50
+	if ( ! isset($args['output'])) {
51 51
 		$args['output'] = 'posts';
52 52
 	}
53 53
 
54
-	$args     = apply_filters( 'give_get_payments_args', $args );
55
-	$payments = new Give_Payments_Query( $args );
54
+	$args     = apply_filters('give_get_payments_args', $args);
55
+	$payments = new Give_Payments_Query($args);
56 56
 
57 57
 	return $payments->get_payments();
58 58
 }
@@ -67,48 +67,48 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return mixed
69 69
  */
70
-function give_get_payment_by( $field = '', $value = '' ) {
70
+function give_get_payment_by($field = '', $value = '') {
71 71
 
72
-	if ( empty( $field ) || empty( $value ) ) {
72
+	if (empty($field) || empty($value)) {
73 73
 		return false;
74 74
 	}
75 75
 
76
-	switch ( strtolower( $field ) ) {
76
+	switch (strtolower($field)) {
77 77
 
78 78
 		case 'id':
79
-			$payment = new Give_Payment( $value );
79
+			$payment = new Give_Payment($value);
80 80
 			$id      = $payment->ID;
81 81
 
82
-			if ( empty( $id ) ) {
82
+			if (empty($id)) {
83 83
 				return false;
84 84
 			}
85 85
 
86 86
 			break;
87 87
 
88 88
 		case 'key':
89
-			$payment = give_get_payments( array(
89
+			$payment = give_get_payments(array(
90 90
 				'meta_key'       => '_give_payment_purchase_key',
91 91
 				'meta_value'     => $value,
92 92
 				'posts_per_page' => 1,
93 93
 				'fields'         => 'ids',
94
-			) );
94
+			));
95 95
 
96
-			if ( $payment ) {
97
-				$payment = new Give_Payment( $payment[0] );
96
+			if ($payment) {
97
+				$payment = new Give_Payment($payment[0]);
98 98
 			}
99 99
 
100 100
 			break;
101 101
 
102 102
 		case 'payment_number':
103
-			$payment = give_get_payments( array(
103
+			$payment = give_get_payments(array(
104 104
 				'meta_key'       => '_give_payment_number',
105 105
 				'meta_value'     => $value,
106 106
 				'posts_per_page' => 1,
107 107
 				'fields'         => 'ids',
108
-			) );
108
+			));
109 109
 
110
-			if ( $payment ) {
111
-				$payment = new Give_Payment( $payment[0] );
110
+			if ($payment) {
111
+				$payment = new Give_Payment($payment[0]);
112 112
 			}
113 113
 
114 114
 			break;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			return false;
118 118
 	}// End switch().
119 119
 
120
-	if ( $payment ) {
120
+	if ($payment) {
121 121
 		return $payment;
122 122
 	}
123 123
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return int|bool Payment ID if payment is inserted, false otherwise.
135 135
  */
136
-function give_insert_payment( $payment_data = array() ) {
136
+function give_insert_payment($payment_data = array()) {
137 137
 
138
-	if ( empty( $payment_data ) ) {
138
+	if (empty($payment_data)) {
139 139
 		return false;
140 140
 	}
141 141
 
@@ -146,25 +146,25 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @param array $payment_data Arguments passed.
148 148
 	 */
149
-	$payment_data = apply_filters( 'give_pre_insert_payment', $payment_data );
149
+	$payment_data = apply_filters('give_pre_insert_payment', $payment_data);
150 150
 
151 151
 	$payment    = new Give_Payment();
152
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
153
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
154
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
155
-	$price_id   = give_get_payment_meta_price_id( $payment_data );
156
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
152
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
153
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
154
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
155
+	$price_id   = give_get_payment_meta_price_id($payment_data);
156
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
157 157
 
158 158
 	// Set properties.
159 159
 	$payment->total          = $payment_data['price'];
160
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
161
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency( $payment_data['give_form_id'], $payment_data );
160
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
161
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency($payment_data['give_form_id'], $payment_data);
162 162
 	$payment->user_info      = $payment_data['user_info'];
163 163
 	$payment->gateway        = $gateway;
164 164
 	$payment->form_title     = $form_title;
165 165
 	$payment->form_id        = $form_id;
166 166
 	$payment->price_id       = $price_id;
167
-	$payment->donor_id       = ( ! empty( $payment_data['donor_id'] ) ? $payment_data['donor_id'] : '' );
167
+	$payment->donor_id       = ( ! empty($payment_data['donor_id']) ? $payment_data['donor_id'] : '');
168 168
 	$payment->user_id        = $payment_data['user_info']['id'];
169 169
 	$payment->email          = $payment_data['user_email'];
170 170
 	$payment->first_name     = $payment_data['user_info']['first_name'];
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	$payment->email          = $payment_data['user_info']['email'];
173 173
 	$payment->ip             = give_get_ip();
174 174
 	$payment->key            = $payment_data['purchase_key'];
175
-	$payment->mode           = ( ! empty( $payment_data['mode'] ) ? (string) $payment_data['mode'] : ( give_is_test_mode() ? 'test' : 'live' ) );
176
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
175
+	$payment->mode           = ( ! empty($payment_data['mode']) ? (string) $payment_data['mode'] : (give_is_test_mode() ? 'test' : 'live'));
176
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
177 177
 
178 178
 	// Add the donation.
179 179
 	$args = array(
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 		'price_id' => $payment->price_id,
182 182
 	);
183 183
 
184
-	$payment->add_donation( $payment->form_id, $args );
184
+	$payment->add_donation($payment->form_id, $args);
185 185
 
186 186
 
187 187
 	// Set date if present.
188
-	if ( isset( $payment_data['post_date'] ) ) {
188
+	if (isset($payment_data['post_date'])) {
189 189
 		$payment->date = $payment_data['post_date'];
190 190
 	}
191 191
 
192 192
 	// Handle sequential payments.
193
-	if ( give_get_option( 'enable_sequential' ) ) {
193
+	if (give_get_option('enable_sequential')) {
194 194
 		$number          = give_get_next_payment_number();
195
-		$payment->number = give_format_payment_number( $number );
196
-		update_option( 'give_last_payment_number', $number );
195
+		$payment->number = give_format_payment_number($number);
196
+		update_option('give_last_payment_number', $number);
197 197
 	}
198 198
 
199 199
 	// Save payment.
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 	 * @param int   $payment_id   The payment ID.
208 208
 	 * @param array $payment_data Arguments passed.
209 209
 	 */
210
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
210
+	do_action('give_insert_payment', $payment->ID, $payment_data);
211 211
 
212 212
 	// Return payment ID upon success.
213
-	if ( ! empty( $payment->ID ) ) {
213
+	if ( ! empty($payment->ID)) {
214 214
 		return $payment->ID;
215 215
 	}
216 216
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * @return bool|int
228 228
  */
229
-function give_create_payment( $payment_data ) {
229
+function give_create_payment($payment_data) {
230 230
 
231
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
232
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
231
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
232
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
233 233
 
234 234
 	// Collect payment data.
235 235
 	$insert_payment_data = array(
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		'date'            => $payment_data['date'],
241 241
 		'user_email'      => $payment_data['user_email'],
242 242
 		'purchase_key'    => $payment_data['purchase_key'],
243
-		'currency'        => give_get_currency( $form_id, $payment_data ),
243
+		'currency'        => give_get_currency($form_id, $payment_data),
244 244
 		'user_info'       => $payment_data['user_info'],
245 245
 		'status'          => 'pending',
246 246
 		'gateway'         => 'paypal',
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @param array $insert_payment_data
255 255
 	 */
256
-	$insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data );
256
+	$insert_payment_data = apply_filters('give_create_payment', $insert_payment_data);
257 257
 
258 258
 	// Record the pending payment.
259
-	return give_insert_payment( $insert_payment_data );
259
+	return give_insert_payment($insert_payment_data);
260 260
 }
261 261
 
262 262
 /**
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return bool
271 271
  */
272
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
272
+function give_update_payment_status($payment_id, $new_status = 'publish') {
273 273
 
274 274
 	$updated = false;
275
-	$payment = new Give_Payment( $payment_id );
275
+	$payment = new Give_Payment($payment_id);
276 276
 
277
-	if ( $payment && $payment->ID > 0 ) {
277
+	if ($payment && $payment->ID > 0) {
278 278
 
279 279
 		$payment->status = $new_status;
280 280
 		$updated         = $payment->save();
@@ -295,45 +295,45 @@  discard block
 block discarded – undo
295 295
  *
296 296
  * @return void
297 297
  */
298
-function give_delete_donation( $payment_id = 0, $update_donor = true ) {
299
-	$payment = new Give_Payment( $payment_id );
298
+function give_delete_donation($payment_id = 0, $update_donor = true) {
299
+	$payment = new Give_Payment($payment_id);
300 300
 
301 301
 	// Bailout.
302
-	if ( ! $payment->ID ) {
302
+	if ( ! $payment->ID) {
303 303
 		return;
304 304
 	}
305 305
 
306
-	$amount   = give_donation_amount( $payment_id );
306
+	$amount   = give_donation_amount($payment_id);
307 307
 	$status   = $payment->post_status;
308
-	$donor_id = give_get_payment_donor_id( $payment_id );
309
-	$donor    = new Give_Donor( $donor_id );
308
+	$donor_id = give_get_payment_donor_id($payment_id);
309
+	$donor    = new Give_Donor($donor_id);
310 310
 
311 311
 	// Only undo donations that aren't these statuses.
312
-	$dont_undo_statuses = apply_filters( 'give_undo_donation_statuses', array(
312
+	$dont_undo_statuses = apply_filters('give_undo_donation_statuses', array(
313 313
 		'pending',
314 314
 		'cancelled',
315
-	) );
315
+	));
316 316
 
317
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
318
-		give_undo_donation( $payment_id );
317
+	if ( ! in_array($status, $dont_undo_statuses)) {
318
+		give_undo_donation($payment_id);
319 319
 	}
320 320
 
321 321
 	// Only undo donations that aren't these statuses.
322
-	$status_to_decrease_stats = apply_filters( 'give_decrease_donor_statuses', array( 'publish' ) );
322
+	$status_to_decrease_stats = apply_filters('give_decrease_donor_statuses', array('publish'));
323 323
 
324
-	if ( in_array( $status, $status_to_decrease_stats ) ) {
324
+	if (in_array($status, $status_to_decrease_stats)) {
325 325
 
326 326
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment).
327
-		give_decrease_total_earnings( $amount );
327
+		give_decrease_total_earnings($amount);
328 328
 
329 329
 		// @todo: Refresh only range related stat cache
330 330
 		give_delete_donation_stats();
331 331
 
332
-		if ( $donor->id && $update_donor ) {
332
+		if ($donor->id && $update_donor) {
333 333
 
334 334
 			// Decrement the stats for the donor.
335 335
 			$donor->decrease_donation_count();
336
-			$donor->decrease_value( $amount );
336
+			$donor->decrease_value($amount);
337 337
 
338 338
 		}
339 339
 	}
@@ -345,18 +345,18 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @since 1.0
347 347
 	 */
348
-	do_action( 'give_payment_delete', $payment_id );
348
+	do_action('give_payment_delete', $payment_id);
349 349
 
350
-	if ( $donor->id && $update_donor ) {
350
+	if ($donor->id && $update_donor) {
351 351
 		// Remove the payment ID from the donor.
352
-		$donor->remove_payment( $payment_id );
352
+		$donor->remove_payment($payment_id);
353 353
 	}
354 354
 
355 355
 	// Remove the payment.
356
-	wp_delete_post( $payment_id, true );
356
+	wp_delete_post($payment_id, true);
357 357
 
358 358
 	// Remove related sale log entries.
359
-	Give()->logs->delete_logs( $payment_id );
359
+	Give()->logs->delete_logs($payment_id);
360 360
 
361 361
 	/**
362 362
 	 * Fires after payment deleted.
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @since 1.0
367 367
 	 */
368
-	do_action( 'give_payment_deleted', $payment_id );
368
+	do_action('give_payment_deleted', $payment_id);
369 369
 }
370 370
 
371 371
 /**
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
  *
381 381
  * @return void
382 382
  */
383
-function give_undo_donation( $payment_id ) {
383
+function give_undo_donation($payment_id) {
384 384
 
385
-	$payment = new Give_Payment( $payment_id );
385
+	$payment = new Give_Payment($payment_id);
386 386
 
387
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
388
-	if ( true === $maybe_decrease_earnings ) {
387
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
388
+	if (true === $maybe_decrease_earnings) {
389 389
 		// Decrease earnings.
390
-		give_decrease_form_earnings( $payment->form_id, $payment->total );
390
+		give_decrease_form_earnings($payment->form_id, $payment->total);
391 391
 	}
392 392
 
393
-	$maybe_decrease_donations = apply_filters( 'give_decrease_donations_on_undo', true, $payment, $payment->form_id );
394
-	if ( true === $maybe_decrease_donations ) {
393
+	$maybe_decrease_donations = apply_filters('give_decrease_donations_on_undo', true, $payment, $payment->form_id);
394
+	if (true === $maybe_decrease_donations) {
395 395
 		// Decrease donation count.
396
-		give_decrease_donation_count( $payment->form_id );
396
+		give_decrease_donation_count($payment->form_id);
397 397
 	}
398 398
 
399 399
 }
@@ -410,21 +410,21 @@  discard block
 block discarded – undo
410 410
  *
411 411
  * @return object $stats Contains the number of payments per payment status.
412 412
  */
413
-function give_count_payments( $args = array() ) {
413
+function give_count_payments($args = array()) {
414 414
 	// Backward compatibility.
415
-	if ( ! empty( $args['start-date'] ) ) {
415
+	if ( ! empty($args['start-date'])) {
416 416
 		$args['start_date'] = $args['start-date'];
417
-		unset( $args['start-date'] );
417
+		unset($args['start-date']);
418 418
 	}
419 419
 
420
-	if ( ! empty( $args['end-date'] ) ) {
420
+	if ( ! empty($args['end-date'])) {
421 421
 		$args['end_date'] = $args['end-date'];
422
-		unset( $args['end-date'] );
422
+		unset($args['end-date']);
423 423
 	}
424 424
 
425
-	if ( ! empty( $args['form_id'] ) ) {
425
+	if ( ! empty($args['form_id'])) {
426 426
 		$args['give_forms'] = $args['form_id'];
427
-		unset( $args['form_id'] );
427
+		unset($args['form_id']);
428 428
 	}
429 429
 
430 430
 	// Extract all donations
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	$args['group_by']    = 'post_status';
433 433
 	$args['count']       = 'true';
434 434
 
435
-	$donations_obj   = new Give_Payments_Query( $args );
435
+	$donations_obj   = new Give_Payments_Query($args);
436 436
 	$donations_count = $donations_obj->get_payment_by_group();
437 437
 
438 438
 	/**
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 *
441 441
 	 * @since 1.0
442 442
 	 */
443
-	return (object) apply_filters( 'give_count_payments', $donations_count, $args, $donations_obj );
443
+	return (object) apply_filters('give_count_payments', $donations_count, $args, $donations_obj);
444 444
 }
445 445
 
446 446
 
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
  *
454 454
  * @return bool $exists True if payment exists, false otherwise.
455 455
  */
456
-function give_check_for_existing_payment( $payment_id ) {
456
+function give_check_for_existing_payment($payment_id) {
457 457
 	$exists  = false;
458
-	$payment = new Give_Payment( $payment_id );
458
+	$payment = new Give_Payment($payment_id);
459 459
 
460
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
460
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
461 461
 		$exists = true;
462 462
 	}
463 463
 
@@ -475,41 +475,41 @@  discard block
 block discarded – undo
475 475
  *
476 476
  * @return bool|mixed True if payment status exists, false otherwise.
477 477
  */
478
-function give_get_payment_status( $payment, $return_label = false ) {
478
+function give_get_payment_status($payment, $return_label = false) {
479 479
 
480
-	if ( is_numeric( $payment ) ) {
480
+	if (is_numeric($payment)) {
481 481
 
482
-		$payment = new Give_Payment( $payment );
482
+		$payment = new Give_Payment($payment);
483 483
 
484
-		if ( ! $payment->ID > 0 ) {
484
+		if ( ! $payment->ID > 0) {
485 485
 			return false;
486 486
 		}
487 487
 
488 488
 	}
489 489
 
490
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
490
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
491 491
 		return false;
492 492
 	}
493 493
 
494 494
 	$statuses = give_get_payment_statuses();
495 495
 
496
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
496
+	if ( ! is_array($statuses) || empty($statuses)) {
497 497
 		return false;
498 498
 	}
499 499
 
500 500
 	// Get payment object if not already given.
501
-	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment( $payment->ID );
501
+	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment($payment->ID);
502 502
 
503
-	if ( array_key_exists( $payment->status, $statuses ) ) {
504
-		if ( true === $return_label ) {
503
+	if (array_key_exists($payment->status, $statuses)) {
504
+		if (true === $return_label) {
505 505
 			// Return translated status label.
506
-			return $statuses[ $payment->status ];
506
+			return $statuses[$payment->status];
507 507
 		} else {
508 508
 			// Account that our 'publish' status is labeled 'Complete'
509 509
 			$post_status = 'publish' === $payment->status ? 'Complete' : $payment->post_status;
510 510
 
511 511
 			// Make sure we're matching cases, since they matter
512
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
512
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
513 513
 		}
514 514
 	}
515 515
 
@@ -525,18 +525,18 @@  discard block
 block discarded – undo
525 525
  */
526 526
 function give_get_payment_statuses() {
527 527
 	$payment_statuses = array(
528
-		'pending'     => __( 'Pending', 'give' ),
529
-		'publish'     => __( 'Complete', 'give' ),
530
-		'refunded'    => __( 'Refunded', 'give' ),
531
-		'failed'      => __( 'Failed', 'give' ),
532
-		'cancelled'   => __( 'Cancelled', 'give' ),
533
-		'abandoned'   => __( 'Abandoned', 'give' ),
534
-		'preapproval' => __( 'Pre-Approved', 'give' ),
535
-		'processing'  => __( 'Processing', 'give' ),
536
-		'revoked'     => __( 'Revoked', 'give' ),
528
+		'pending'     => __('Pending', 'give'),
529
+		'publish'     => __('Complete', 'give'),
530
+		'refunded'    => __('Refunded', 'give'),
531
+		'failed'      => __('Failed', 'give'),
532
+		'cancelled'   => __('Cancelled', 'give'),
533
+		'abandoned'   => __('Abandoned', 'give'),
534
+		'preapproval' => __('Pre-Approved', 'give'),
535
+		'processing'  => __('Processing', 'give'),
536
+		'revoked'     => __('Revoked', 'give'),
537 537
 	);
538 538
 
539
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
539
+	return apply_filters('give_payment_statuses', $payment_statuses);
540 540
 }
541 541
 
542 542
 /**
@@ -549,10 +549,10 @@  discard block
 block discarded – undo
549 549
  * @return array $payment_status All the available payment statuses.
550 550
  */
551 551
 function give_get_payment_status_keys() {
552
-	$statuses = array_keys( give_get_payment_statuses() );
553
-	asort( $statuses );
552
+	$statuses = array_keys(give_get_payment_statuses());
553
+	asort($statuses);
554 554
 
555
-	return array_values( $statuses );
555
+	return array_values($statuses);
556 556
 }
557 557
 
558 558
 /**
@@ -567,44 +567,44 @@  discard block
 block discarded – undo
567 567
  *
568 568
  * @return int $earnings Earnings
569 569
  */
570
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
570
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
571 571
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
572 572
 
573 573
 	global $wpdb;
574
-	$meta_table = __give_v20_bc_table_details( 'payment' );
574
+	$meta_table = __give_v20_bc_table_details('payment');
575 575
 
576 576
 	$args = array(
577 577
 		'post_type'              => 'give_payment',
578 578
 		'nopaging'               => true,
579 579
 		'year'                   => $year,
580 580
 		'monthnum'               => $month_num,
581
-		'post_status'            => array( 'publish' ),
581
+		'post_status'            => array('publish'),
582 582
 		'fields'                 => 'ids',
583 583
 		'update_post_term_cache' => false,
584 584
 	);
585
-	if ( ! empty( $day ) ) {
585
+	if ( ! empty($day)) {
586 586
 		$args['day'] = $day;
587 587
 	}
588 588
 
589
-	if ( isset( $hour ) ) {
589
+	if (isset($hour)) {
590 590
 		$args['hour'] = $hour;
591 591
 	}
592 592
 
593
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
594
-	$key  = Give_Cache::get_key( 'give_stats', $args );
593
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
594
+	$key  = Give_Cache::get_key('give_stats', $args);
595 595
 
596
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
596
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
597 597
 		$earnings = false;
598 598
 	} else {
599
-		$earnings = Give_Cache::get( $key );
599
+		$earnings = Give_Cache::get($key);
600 600
 	}
601 601
 
602
-	if ( false === $earnings ) {
603
-		$donations = get_posts( $args );
602
+	if (false === $earnings) {
603
+		$donations = get_posts($args);
604 604
 		$earnings  = 0;
605
-		if ( $donations ) {
606
-			$donations      = implode( ',', $donations );
607
-			$earning_totals = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})" );
605
+		if ($donations) {
606
+			$donations      = implode(',', $donations);
607
+			$earning_totals = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})");
608 608
 
609 609
 			/**
610 610
 			 * Filter The earnings by dates.
@@ -615,13 +615,13 @@  discard block
 block discarded – undo
615 615
 			 * @param array $donations      Donations lists.
616 616
 			 * @param array $args           Donation query args.
617 617
 			 */
618
-			$earnings = apply_filters( 'give_get_earnings_by_date', $earning_totals, $donations, $args );
618
+			$earnings = apply_filters('give_get_earnings_by_date', $earning_totals, $donations, $args);
619 619
 		}
620 620
 		// Cache the results for one hour.
621
-		Give_Cache::set( $key, $earnings, HOUR_IN_SECONDS );
621
+		Give_Cache::set($key, $earnings, HOUR_IN_SECONDS);
622 622
 	}
623 623
 
624
-	return round( $earnings, 2 );
624
+	return round($earnings, 2);
625 625
 }
626 626
 
627 627
 /**
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
  *
637 637
  * @return int $count Sales
638 638
  */
639
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
639
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
640 640
 
641 641
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead.
642 642
 	$args = array(
@@ -644,14 +644,14 @@  discard block
 block discarded – undo
644 644
 		'nopaging'               => true,
645 645
 		'year'                   => $year,
646 646
 		'fields'                 => 'ids',
647
-		'post_status'            => array( 'publish' ),
647
+		'post_status'            => array('publish'),
648 648
 		'update_post_meta_cache' => false,
649 649
 		'update_post_term_cache' => false,
650 650
 	);
651 651
 
652
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
652
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
653 653
 
654
-	if ( false === $show_free ) {
654
+	if (false === $show_free) {
655 655
 		$args['meta_query'] = array(
656 656
 			array(
657 657
 				'key'     => '_give_payment_total',
@@ -662,33 +662,33 @@  discard block
 block discarded – undo
662 662
 		);
663 663
 	}
664 664
 
665
-	if ( ! empty( $month_num ) ) {
665
+	if ( ! empty($month_num)) {
666 666
 		$args['monthnum'] = $month_num;
667 667
 	}
668 668
 
669
-	if ( ! empty( $day ) ) {
669
+	if ( ! empty($day)) {
670 670
 		$args['day'] = $day;
671 671
 	}
672 672
 
673
-	if ( isset( $hour ) ) {
673
+	if (isset($hour)) {
674 674
 		$args['hour'] = $hour;
675 675
 	}
676 676
 
677
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
677
+	$args = apply_filters('give_get_sales_by_date_args', $args);
678 678
 
679
-	$key = Give_Cache::get_key( 'give_stats', $args );
679
+	$key = Give_Cache::get_key('give_stats', $args);
680 680
 
681
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
681
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
682 682
 		$count = false;
683 683
 	} else {
684
-		$count = Give_Cache::get( $key );
684
+		$count = Give_Cache::get($key);
685 685
 	}
686 686
 
687
-	if ( false === $count ) {
688
-		$donations = new WP_Query( $args );
687
+	if (false === $count) {
688
+		$donations = new WP_Query($args);
689 689
 		$count     = (int) $donations->post_count;
690 690
 		// Cache the results for one hour.
691
-		Give_Cache::set( $key, $count, HOUR_IN_SECONDS );
691
+		Give_Cache::set($key, $count, HOUR_IN_SECONDS);
692 692
 	}
693 693
 
694 694
 	return $count;
@@ -703,19 +703,19 @@  discard block
 block discarded – undo
703 703
  *
704 704
  * @return bool $ret True if complete, false otherwise.
705 705
  */
706
-function give_is_payment_complete( $payment_id ) {
707
-	$payment = new Give_Payment( $payment_id );
706
+function give_is_payment_complete($payment_id) {
707
+	$payment = new Give_Payment($payment_id);
708 708
 
709 709
 	$ret = false;
710 710
 
711
-	if ( $payment->ID > 0 ) {
711
+	if ($payment->ID > 0) {
712 712
 
713
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
713
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
714 714
 			$ret = true;
715 715
 		}
716 716
 	}
717 717
 
718
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
718
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
719 719
 }
720 720
 
721 721
 /**
@@ -741,50 +741,50 @@  discard block
 block discarded – undo
741 741
  *
742 742
  * @return float $total Total earnings.
743 743
  */
744
-function give_get_total_earnings( $recalculate = false ) {
744
+function give_get_total_earnings($recalculate = false) {
745 745
 
746
-	$total      = get_option( 'give_earnings_total', 0 );
747
-	$meta_table = __give_v20_bc_table_details( 'payment' );
746
+	$total      = get_option('give_earnings_total', 0);
747
+	$meta_table = __give_v20_bc_table_details('payment');
748 748
 
749 749
 	// Calculate total earnings.
750
-	if ( ! $total || $recalculate ) {
750
+	if ( ! $total || $recalculate) {
751 751
 		global $wpdb;
752 752
 
753 753
 		$total = (float) 0;
754 754
 
755
-		$args = apply_filters( 'give_get_total_earnings_args', array(
755
+		$args = apply_filters('give_get_total_earnings_args', array(
756 756
 			'offset' => 0,
757
-			'number' => - 1,
758
-			'status' => array( 'publish' ),
757
+			'number' => -1,
758
+			'status' => array('publish'),
759 759
 			'fields' => 'ids',
760
-		) );
760
+		));
761 761
 
762
-		$payments = give_get_payments( $args );
763
-		if ( $payments ) {
762
+		$payments = give_get_payments($args);
763
+		if ($payments) {
764 764
 
765 765
 			/**
766 766
 			 * If performing a donation, we need to skip the very last payment in the database,
767 767
 			 * since it calls give_increase_total_earnings() on completion,
768 768
 			 * which results in duplicated earnings for the very first donation.
769 769
 			 */
770
-			if ( did_action( 'give_update_payment_status' ) ) {
771
-				array_pop( $payments );
770
+			if (did_action('give_update_payment_status')) {
771
+				array_pop($payments);
772 772
 			}
773 773
 
774
-			if ( ! empty( $payments ) ) {
775
-				$payments = implode( ',', $payments );
776
-				$total    += $wpdb->get_var( "SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})" );
774
+			if ( ! empty($payments)) {
775
+				$payments = implode(',', $payments);
776
+				$total += $wpdb->get_var("SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})");
777 777
 			}
778 778
 		}
779 779
 
780
-		update_option( 'give_earnings_total', $total, 'no' );
780
+		update_option('give_earnings_total', $total, 'no');
781 781
 	}
782 782
 
783
-	if ( $total < 0 ) {
783
+	if ($total < 0) {
784 784
 		$total = 0; // Don't ever show negative earnings.
785 785
 	}
786 786
 
787
-	return apply_filters( 'give_total_earnings', round( $total, give_get_price_decimals() ), $total );
787
+	return apply_filters('give_total_earnings', round($total, give_get_price_decimals()), $total);
788 788
 }
789 789
 
790 790
 /**
@@ -796,10 +796,10 @@  discard block
 block discarded – undo
796 796
  *
797 797
  * @return float $total Total earnings.
798 798
  */
799
-function give_increase_total_earnings( $amount = 0 ) {
799
+function give_increase_total_earnings($amount = 0) {
800 800
 	$total = give_get_total_earnings();
801 801
 	$total += $amount;
802
-	update_option( 'give_earnings_total', $total );
802
+	update_option('give_earnings_total', $total);
803 803
 
804 804
 	return $total;
805 805
 }
@@ -813,13 +813,13 @@  discard block
 block discarded – undo
813 813
  *
814 814
  * @return float $total Total earnings.
815 815
  */
816
-function give_decrease_total_earnings( $amount = 0 ) {
816
+function give_decrease_total_earnings($amount = 0) {
817 817
 	$total = give_get_total_earnings();
818 818
 	$total -= $amount;
819
-	if ( $total < 0 ) {
819
+	if ($total < 0) {
820 820
 		$total = 0;
821 821
 	}
822
-	update_option( 'give_earnings_total', $total );
822
+	update_option('give_earnings_total', $total);
823 823
 
824 824
 	return $total;
825 825
 }
@@ -835,10 +835,10 @@  discard block
 block discarded – undo
835 835
  *
836 836
  * @return mixed $meta Payment Meta.
837 837
  */
838
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
839
-	$payment = new Give_Payment( $payment_id );
838
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
839
+	$payment = new Give_Payment($payment_id);
840 840
 
841
-	return $payment->get_meta( $meta_key, $single );
841
+	return $payment->get_meta($meta_key, $single);
842 842
 }
843 843
 
844 844
 /**
@@ -851,10 +851,10 @@  discard block
 block discarded – undo
851 851
  *
852 852
  * @return mixed Meta ID if successful, false if unsuccessful.
853 853
  */
854
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
855
-	$payment = new Give_Payment( $payment_id );
854
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
855
+	$payment = new Give_Payment($payment_id);
856 856
 
857
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
857
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
858 858
 }
859 859
 
860 860
 /**
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
  *
867 867
  * @return array $user_info User Info Meta Values.
868 868
  */
869
-function give_get_payment_meta_user_info( $payment_id ) {
870
-	$payment = new Give_Payment( $payment_id );
869
+function give_get_payment_meta_user_info($payment_id) {
870
+	$payment = new Give_Payment($payment_id);
871 871
 
872 872
 	return $payment->user_info;
873 873
 }
@@ -883,8 +883,8 @@  discard block
 block discarded – undo
883 883
  *
884 884
  * @return int $form_id Form ID.
885 885
  */
886
-function give_get_payment_form_id( $payment_id ) {
887
-	$payment = new Give_Payment( $payment_id );
886
+function give_get_payment_form_id($payment_id) {
887
+	$payment = new Give_Payment($payment_id);
888 888
 
889 889
 	return $payment->form_id;
890 890
 }
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
  *
899 899
  * @return string $email User email.
900 900
  */
901
-function give_get_payment_user_email( $payment_id ) {
902
-	$payment = new Give_Payment( $payment_id );
901
+function give_get_payment_user_email($payment_id) {
902
+	$payment = new Give_Payment($payment_id);
903 903
 
904 904
 	return $payment->email;
905 905
 }
@@ -913,11 +913,11 @@  discard block
 block discarded – undo
913 913
  *
914 914
  * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true)
915 915
  */
916
-function give_is_guest_payment( $payment_id ) {
917
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
918
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
916
+function give_is_guest_payment($payment_id) {
917
+	$payment_user_id  = give_get_payment_user_id($payment_id);
918
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
919 919
 
920
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
920
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
921 921
 }
922 922
 
923 923
 /**
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
  *
930 930
  * @return int $user_id User ID.
931 931
  */
932
-function give_get_payment_user_id( $payment_id ) {
933
-	$payment = new Give_Payment( $payment_id );
932
+function give_get_payment_user_id($payment_id) {
933
+	$payment = new Give_Payment($payment_id);
934 934
 
935 935
 	return $payment->user_id;
936 936
 }
@@ -944,8 +944,8 @@  discard block
 block discarded – undo
944 944
  *
945 945
  * @return int $payment->customer_id Donor ID.
946 946
  */
947
-function give_get_payment_donor_id( $payment_id ) {
948
-	$payment = new Give_Payment( $payment_id );
947
+function give_get_payment_donor_id($payment_id) {
948
+	$payment = new Give_Payment($payment_id);
949 949
 
950 950
 	return $payment->customer_id;
951 951
 }
@@ -959,8 +959,8 @@  discard block
 block discarded – undo
959 959
  *
960 960
  * @return string $ip User IP.
961 961
  */
962
-function give_get_payment_user_ip( $payment_id ) {
963
-	$payment = new Give_Payment( $payment_id );
962
+function give_get_payment_user_ip($payment_id) {
963
+	$payment = new Give_Payment($payment_id);
964 964
 
965 965
 	return $payment->ip;
966 966
 }
@@ -974,8 +974,8 @@  discard block
 block discarded – undo
974 974
  *
975 975
  * @return string $date The date the payment was completed.
976 976
  */
977
-function give_get_payment_completed_date( $payment_id = 0 ) {
978
-	$payment = new Give_Payment( $payment_id );
977
+function give_get_payment_completed_date($payment_id = 0) {
978
+	$payment = new Give_Payment($payment_id);
979 979
 
980 980
 	return $payment->completed_date;
981 981
 }
@@ -989,8 +989,8 @@  discard block
 block discarded – undo
989 989
  *
990 990
  * @return string $gateway Gateway.
991 991
  */
992
-function give_get_payment_gateway( $payment_id ) {
993
-	$payment = new Give_Payment( $payment_id );
992
+function give_get_payment_gateway($payment_id) {
993
+	$payment = new Give_Payment($payment_id);
994 994
 
995 995
 	return $payment->gateway;
996 996
 }
@@ -1004,8 +1004,8 @@  discard block
 block discarded – undo
1004 1004
  *
1005 1005
  * @return string $currency The currency code.
1006 1006
  */
1007
-function give_get_payment_currency_code( $payment_id = 0 ) {
1008
-	$payment = new Give_Payment( $payment_id );
1007
+function give_get_payment_currency_code($payment_id = 0) {
1008
+	$payment = new Give_Payment($payment_id);
1009 1009
 
1010 1010
 	return $payment->currency;
1011 1011
 }
@@ -1019,10 +1019,10 @@  discard block
 block discarded – undo
1019 1019
  *
1020 1020
  * @return string $currency The currency name.
1021 1021
  */
1022
-function give_get_payment_currency( $payment_id = 0 ) {
1023
-	$currency = give_get_payment_currency_code( $payment_id );
1022
+function give_get_payment_currency($payment_id = 0) {
1023
+	$currency = give_get_payment_currency_code($payment_id);
1024 1024
 
1025
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1025
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1026 1026
 }
1027 1027
 
1028 1028
 /**
@@ -1034,8 +1034,8 @@  discard block
 block discarded – undo
1034 1034
  *
1035 1035
  * @return string $key Donation key.
1036 1036
  */
1037
-function give_get_payment_key( $payment_id = 0 ) {
1038
-	$payment = new Give_Payment( $payment_id );
1037
+function give_get_payment_key($payment_id = 0) {
1038
+	$payment = new Give_Payment($payment_id);
1039 1039
 
1040 1040
 	return $payment->key;
1041 1041
 }
@@ -1051,8 +1051,8 @@  discard block
 block discarded – undo
1051 1051
  *
1052 1052
  * @return string $number Payment order number.
1053 1053
  */
1054
-function give_get_payment_number( $payment_id = 0 ) {
1055
-	$payment = new Give_Payment( $payment_id );
1054
+function give_get_payment_number($payment_id = 0) {
1055
+	$payment = new Give_Payment($payment_id);
1056 1056
 
1057 1057
 	return $payment->number;
1058 1058
 }
@@ -1066,23 +1066,23 @@  discard block
 block discarded – undo
1066 1066
  *
1067 1067
  * @return string      The formatted payment number.
1068 1068
  */
1069
-function give_format_payment_number( $number ) {
1069
+function give_format_payment_number($number) {
1070 1070
 
1071
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1071
+	if ( ! give_get_option('enable_sequential')) {
1072 1072
 		return $number;
1073 1073
 	}
1074 1074
 
1075
-	if ( ! is_numeric( $number ) ) {
1075
+	if ( ! is_numeric($number)) {
1076 1076
 		return $number;
1077 1077
 	}
1078 1078
 
1079
-	$prefix  = give_get_option( 'sequential_prefix' );
1080
-	$number  = absint( $number );
1081
-	$postfix = give_get_option( 'sequential_postfix' );
1079
+	$prefix  = give_get_option('sequential_prefix');
1080
+	$number  = absint($number);
1081
+	$postfix = give_get_option('sequential_postfix');
1082 1082
 
1083
-	$formatted_number = $prefix . $number . $postfix;
1083
+	$formatted_number = $prefix.$number.$postfix;
1084 1084
 
1085
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1085
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1086 1086
 }
1087 1087
 
1088 1088
 /**
@@ -1096,17 +1096,17 @@  discard block
 block discarded – undo
1096 1096
  */
1097 1097
 function give_get_next_payment_number() {
1098 1098
 
1099
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1099
+	if ( ! give_get_option('enable_sequential')) {
1100 1100
 		return false;
1101 1101
 	}
1102 1102
 
1103
-	$number           = get_option( 'give_last_payment_number' );
1104
-	$start            = give_get_option( 'sequential_start', 1 );
1103
+	$number           = get_option('give_last_payment_number');
1104
+	$start            = give_get_option('sequential_start', 1);
1105 1105
 	$increment_number = true;
1106 1106
 
1107
-	if ( false !== $number ) {
1107
+	if (false !== $number) {
1108 1108
 
1109
-		if ( empty( $number ) ) {
1109
+		if (empty($number)) {
1110 1110
 
1111 1111
 			$number           = $start;
1112 1112
 			$increment_number = false;
@@ -1115,24 +1115,24 @@  discard block
 block discarded – undo
1115 1115
 	} else {
1116 1116
 
1117 1117
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason.
1118
-		$payments     = new Give_Payments_Query( array(
1118
+		$payments = new Give_Payments_Query(array(
1119 1119
 			'number'  => 1,
1120 1120
 			'order'   => 'DESC',
1121 1121
 			'orderby' => 'ID',
1122 1122
 			'output'  => 'posts',
1123 1123
 			'fields'  => 'ids',
1124
-		) );
1124
+		));
1125 1125
 		$last_payment = $payments->get_payments();
1126 1126
 
1127
-		if ( ! empty( $last_payment ) ) {
1127
+		if ( ! empty($last_payment)) {
1128 1128
 
1129
-			$number = give_get_payment_number( $last_payment[0] );
1129
+			$number = give_get_payment_number($last_payment[0]);
1130 1130
 
1131 1131
 		}
1132 1132
 
1133
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1133
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1134 1134
 
1135
-			$number = give_remove_payment_prefix_postfix( $number );
1135
+			$number = give_remove_payment_prefix_postfix($number);
1136 1136
 
1137 1137
 		} else {
1138 1138
 
@@ -1141,13 +1141,13 @@  discard block
 block discarded – undo
1141 1141
 		}
1142 1142
 	}// End if().
1143 1143
 
1144
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1144
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1145 1145
 
1146
-	if ( $increment_number ) {
1147
-		$number ++;
1146
+	if ($increment_number) {
1147
+		$number++;
1148 1148
 	}
1149 1149
 
1150
-	return apply_filters( 'give_get_next_payment_number', $number );
1150
+	return apply_filters('give_get_next_payment_number', $number);
1151 1151
 }
1152 1152
 
1153 1153
 /**
@@ -1159,25 +1159,25 @@  discard block
 block discarded – undo
1159 1159
  *
1160 1160
  * @return string The new Payment number without prefix and postfix.
1161 1161
  */
1162
-function give_remove_payment_prefix_postfix( $number ) {
1162
+function give_remove_payment_prefix_postfix($number) {
1163 1163
 
1164
-	$prefix  = give_get_option( 'sequential_prefix' );
1165
-	$postfix = give_get_option( 'sequential_postfix' );
1164
+	$prefix  = give_get_option('sequential_prefix');
1165
+	$postfix = give_get_option('sequential_postfix');
1166 1166
 
1167 1167
 	// Remove prefix.
1168
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1168
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1169 1169
 
1170 1170
 	// Remove the postfix.
1171
-	$length      = strlen( $number );
1172
-	$postfix_pos = strrpos( $number, $postfix );
1173
-	if ( false !== $postfix_pos ) {
1174
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1171
+	$length      = strlen($number);
1172
+	$postfix_pos = strrpos($number, $postfix);
1173
+	if (false !== $postfix_pos) {
1174
+		$number = substr_replace($number, '', $postfix_pos, $length);
1175 1175
 	}
1176 1176
 
1177 1177
 	// Ensure it's a whole number.
1178
-	$number = intval( $number );
1178
+	$number = intval($number);
1179 1179
 
1180
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1180
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1181 1181
 
1182 1182
 }
1183 1183
 
@@ -1195,16 +1195,16 @@  discard block
 block discarded – undo
1195 1195
  *
1196 1196
  * @return string $amount Fully formatted donation amount.
1197 1197
  */
1198
-function give_donation_amount( $donation, $format_args = array() ) {
1198
+function give_donation_amount($donation, $format_args = array()) {
1199 1199
 	/* @var Give_Payment $donation */
1200
-	if ( ! ( $donation instanceof Give_Payment ) ) {
1201
-		$donation = new Give_Payment( absint( $donation ) );
1200
+	if ( ! ($donation instanceof Give_Payment)) {
1201
+		$donation = new Give_Payment(absint($donation));
1202 1202
 	}
1203 1203
 
1204 1204
 	$amount           = $donation->total;
1205 1205
 	$formatted_amount = $amount;
1206 1206
 
1207
-	if ( is_bool( $format_args ) ) {
1207
+	if (is_bool($format_args)) {
1208 1208
 		$format_args = array(
1209 1209
 			'currency' => (bool) $format_args,
1210 1210
 			'amount'   => (bool) $format_args,
@@ -1227,27 +1227,25 @@  discard block
 block discarded – undo
1227 1227
 		)
1228 1228
 	);
1229 1229
 
1230
-	if ( $format_args['amount'] || $format_args['currency'] ) {
1230
+	if ($format_args['amount'] || $format_args['currency']) {
1231 1231
 
1232
-		if ( $format_args['amount'] ) {
1232
+		if ($format_args['amount']) {
1233 1233
 
1234 1234
 			$formatted_amount = give_format_amount(
1235 1235
 				$amount,
1236
-				! is_array( $format_args['amount'] ) ?
1236
+				! is_array($format_args['amount']) ?
1237 1237
 					array(
1238 1238
 						'sanitize' => false,
1239 1239
 						'currency' => $donation->currency,
1240
-					) :
1241
-					$format_args['amount']
1240
+					) : $format_args['amount']
1242 1241
 			);
1243 1242
 		}
1244 1243
 
1245
-		if ( $format_args['currency'] ) {
1244
+		if ($format_args['currency']) {
1246 1245
 			$formatted_amount = give_currency_filter(
1247 1246
 				$formatted_amount,
1248
-				! is_array( $format_args['currency'] ) ?
1249
-					array( 'currency_code' => $donation->currency ) :
1250
-					$format_args['currency']
1247
+				! is_array($format_args['currency']) ?
1248
+					array('currency_code' => $donation->currency) : $format_args['currency']
1251 1249
 			);
1252 1250
 		}
1253 1251
 	}
@@ -1262,7 +1260,7 @@  discard block
 block discarded – undo
1262 1260
 	 * @param int    $donation_id      Donation ID.
1263 1261
 	 * @param string $type             Donation amount type.
1264 1262
 	 */
1265
-	return apply_filters( 'give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args );
1263
+	return apply_filters('give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args);
1266 1264
 }
1267 1265
 
1268 1266
 /**
@@ -1279,10 +1277,10 @@  discard block
 block discarded – undo
1279 1277
  *
1280 1278
  * @return array Fully formatted payment subtotal.
1281 1279
  */
1282
-function give_payment_subtotal( $payment_id = 0 ) {
1283
-	$subtotal = give_get_payment_subtotal( $payment_id );
1280
+function give_payment_subtotal($payment_id = 0) {
1281
+	$subtotal = give_get_payment_subtotal($payment_id);
1284 1282
 
1285
-	return give_currency_filter( give_format_amount( $subtotal, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_payment_currency_code( $payment_id ) ) );
1283
+	return give_currency_filter(give_format_amount($subtotal, array('sanitize' => false)), array('currency_code' => give_get_payment_currency_code($payment_id)));
1286 1284
 }
1287 1285
 
1288 1286
 /**
@@ -1296,8 +1294,8 @@  discard block
 block discarded – undo
1296 1294
  *
1297 1295
  * @return float $subtotal Subtotal for payment (non formatted).
1298 1296
  */
1299
-function give_get_payment_subtotal( $payment_id = 0 ) {
1300
-	$payment = new Give_Payment( $payment_id );
1297
+function give_get_payment_subtotal($payment_id = 0) {
1298
+	$payment = new Give_Payment($payment_id);
1301 1299
 
1302 1300
 	return $payment->subtotal;
1303 1301
 }
@@ -1311,8 +1309,8 @@  discard block
 block discarded – undo
1311 1309
  *
1312 1310
  * @return string The donation ID.
1313 1311
  */
1314
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1315
-	$payment = new Give_Payment( $payment_id );
1312
+function give_get_payment_transaction_id($payment_id = 0) {
1313
+	$payment = new Give_Payment($payment_id);
1316 1314
 
1317 1315
 	return $payment->transaction_id;
1318 1316
 }
@@ -1327,15 +1325,15 @@  discard block
 block discarded – undo
1327 1325
  *
1328 1326
  * @return bool|mixed
1329 1327
  */
1330
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1328
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1331 1329
 
1332
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1330
+	if (empty($payment_id) || empty($transaction_id)) {
1333 1331
 		return false;
1334 1332
 	}
1335 1333
 
1336
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1334
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1337 1335
 
1338
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1336
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1339 1337
 }
1340 1338
 
1341 1339
 /**
@@ -1348,10 +1346,10 @@  discard block
 block discarded – undo
1348 1346
  *
1349 1347
  * @return int $purchase Donation ID.
1350 1348
  */
1351
-function give_get_donation_id_by_key( $key ) {
1349
+function give_get_donation_id_by_key($key) {
1352 1350
 	global $wpdb;
1353 1351
 
1354
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1352
+	$meta_table = __give_v20_bc_table_details('payment');
1355 1353
 
1356 1354
 	$purchase = $wpdb->get_var(
1357 1355
 		$wpdb->prepare(
@@ -1367,7 +1365,7 @@  discard block
 block discarded – undo
1367 1365
 		)
1368 1366
 	);
1369 1367
 
1370
-	if ( $purchase != null ) {
1368
+	if ($purchase != null) {
1371 1369
 		return $purchase;
1372 1370
 	}
1373 1371
 
@@ -1385,13 +1383,13 @@  discard block
 block discarded – undo
1385 1383
  *
1386 1384
  * @return int $purchase Donation ID.
1387 1385
  */
1388
-function give_get_purchase_id_by_transaction_id( $key ) {
1386
+function give_get_purchase_id_by_transaction_id($key) {
1389 1387
 	global $wpdb;
1390
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1388
+	$meta_table = __give_v20_bc_table_details('payment');
1391 1389
 
1392
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1390
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1393 1391
 
1394
-	if ( $purchase != null ) {
1392
+	if ($purchase != null) {
1395 1393
 		return $purchase;
1396 1394
 	}
1397 1395
 
@@ -1408,23 +1406,23 @@  discard block
 block discarded – undo
1408 1406
  *
1409 1407
  * @return array $notes Donation Notes
1410 1408
  */
1411
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1409
+function give_get_payment_notes($payment_id = 0, $search = '') {
1412 1410
 
1413
-	if ( empty( $payment_id ) && empty( $search ) ) {
1411
+	if (empty($payment_id) && empty($search)) {
1414 1412
 		return false;
1415 1413
 	}
1416 1414
 
1417
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1418
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1415
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1416
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1419 1417
 
1420
-	$notes = get_comments( array(
1418
+	$notes = get_comments(array(
1421 1419
 		'post_id' => $payment_id,
1422 1420
 		'order'   => 'ASC',
1423 1421
 		'search'  => $search,
1424
-	) );
1422
+	));
1425 1423
 
1426
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1427
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1424
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1425
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1428 1426
 
1429 1427
 	return $notes;
1430 1428
 }
@@ -1440,8 +1438,8 @@  discard block
 block discarded – undo
1440 1438
  *
1441 1439
  * @return int The new note ID
1442 1440
  */
1443
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1444
-	if ( empty( $payment_id ) ) {
1441
+function give_insert_payment_note($payment_id = 0, $note = '') {
1442
+	if (empty($payment_id)) {
1445 1443
 		return false;
1446 1444
 	}
1447 1445
 
@@ -1453,14 +1451,14 @@  discard block
 block discarded – undo
1453 1451
 	 *
1454 1452
 	 * @since 1.0
1455 1453
 	 */
1456
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1454
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1457 1455
 
1458
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1456
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1459 1457
 		'comment_post_ID'      => $payment_id,
1460 1458
 		'comment_content'      => $note,
1461 1459
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1462
-		'comment_date'         => current_time( 'mysql' ),
1463
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1460
+		'comment_date'         => current_time('mysql'),
1461
+		'comment_date_gmt'     => current_time('mysql', 1),
1464 1462
 		'comment_approved'     => 1,
1465 1463
 		'comment_parent'       => 0,
1466 1464
 		'comment_author'       => '',
@@ -1469,7 +1467,7 @@  discard block
 block discarded – undo
1469 1467
 		'comment_author_email' => '',
1470 1468
 		'comment_type'         => 'give_payment_note',
1471 1469
 
1472
-	) ) );
1470
+	)));
1473 1471
 
1474 1472
 	/**
1475 1473
 	 * Fires after payment note inserted.
@@ -1480,7 +1478,7 @@  discard block
 block discarded – undo
1480 1478
 	 *
1481 1479
 	 * @since 1.0
1482 1480
 	 */
1483
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1481
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1484 1482
 
1485 1483
 	return $note_id;
1486 1484
 }
@@ -1495,8 +1493,8 @@  discard block
 block discarded – undo
1495 1493
  *
1496 1494
  * @return bool True on success, false otherwise.
1497 1495
  */
1498
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1499
-	if ( empty( $comment_id ) ) {
1496
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1497
+	if (empty($comment_id)) {
1500 1498
 		return false;
1501 1499
 	}
1502 1500
 
@@ -1508,9 +1506,9 @@  discard block
 block discarded – undo
1508 1506
 	 *
1509 1507
 	 * @since 1.0
1510 1508
 	 */
1511
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1509
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1512 1510
 
1513
-	$ret = wp_delete_comment( $comment_id, true );
1511
+	$ret = wp_delete_comment($comment_id, true);
1514 1512
 
1515 1513
 	/**
1516 1514
 	 * Fires after donation note deleted.
@@ -1520,7 +1518,7 @@  discard block
 block discarded – undo
1520 1518
 	 *
1521 1519
 	 * @since 1.0
1522 1520
 	 */
1523
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1521
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1524 1522
 
1525 1523
 	return $ret;
1526 1524
 }
@@ -1535,32 +1533,32 @@  discard block
 block discarded – undo
1535 1533
  *
1536 1534
  * @return string
1537 1535
  */
1538
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1536
+function give_get_payment_note_html($note, $payment_id = 0) {
1539 1537
 
1540
-	if ( is_numeric( $note ) ) {
1541
-		$note = get_comment( $note );
1538
+	if (is_numeric($note)) {
1539
+		$note = get_comment($note);
1542 1540
 	}
1543 1541
 
1544
-	if ( ! empty( $note->user_id ) ) {
1545
-		$user = get_userdata( $note->user_id );
1542
+	if ( ! empty($note->user_id)) {
1543
+		$user = get_userdata($note->user_id);
1546 1544
 		$user = $user->display_name;
1547 1545
 	} else {
1548
-		$user = __( 'System', 'give' );
1546
+		$user = __('System', 'give');
1549 1547
 	}
1550 1548
 
1551
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1549
+	$date_format = give_date_format().', '.get_option('time_format');
1552 1550
 
1553
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1551
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1554 1552
 		'give-action' => 'delete_payment_note',
1555 1553
 		'note_id'     => $note->comment_ID,
1556 1554
 		'payment_id'  => $payment_id,
1557
-	) ), 'give_delete_payment_note_' . $note->comment_ID );
1555
+	)), 'give_delete_payment_note_'.$note->comment_ID);
1558 1556
 
1559
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1557
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1560 1558
 	$note_html .= '<p>';
1561
-	$note_html .= '<strong>' . $user . '</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>';
1559
+	$note_html .= '<strong>'.$user.'</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>';
1562 1560
 	$note_html .= $note->comment_content;
1563
-	$note_html .= '&nbsp;&ndash;&nbsp;<a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . __( 'Delete this donation note.', 'give' ) . '">' . __( 'Delete', 'give' ) . '</a>';
1561
+	$note_html .= '&nbsp;&ndash;&nbsp;<a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.__('Delete this donation note.', 'give').'">'.__('Delete', 'give').'</a>';
1564 1562
 	$note_html .= '</p>';
1565 1563
 	$note_html .= '</div>';
1566 1564
 
@@ -1578,18 +1576,18 @@  discard block
 block discarded – undo
1578 1576
  *
1579 1577
  * @return void
1580 1578
  */
1581
-function give_hide_payment_notes( $query ) {
1582
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) {
1583
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1584
-		if ( ! is_array( $types ) ) {
1585
-			$types = array( $types );
1579
+function give_hide_payment_notes($query) {
1580
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) {
1581
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1582
+		if ( ! is_array($types)) {
1583
+			$types = array($types);
1586 1584
 		}
1587 1585
 		$types[]                           = 'give_payment_note';
1588 1586
 		$query->query_vars['type__not_in'] = $types;
1589 1587
 	}
1590 1588
 }
1591 1589
 
1592
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1590
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1593 1591
 
1594 1592
 /**
1595 1593
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1601,15 +1599,15 @@  discard block
 block discarded – undo
1601 1599
  *
1602 1600
  * @return array $clauses Updated comment clauses.
1603 1601
  */
1604
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1605
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) {
1602
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1603
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) {
1606 1604
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1607 1605
 	}
1608 1606
 
1609 1607
 	return $clauses;
1610 1608
 }
1611 1609
 
1612
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1610
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1613 1611
 
1614 1612
 
1615 1613
 /**
@@ -1622,15 +1620,15 @@  discard block
 block discarded – undo
1622 1620
  *
1623 1621
  * @return string $where
1624 1622
  */
1625
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1623
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1626 1624
 	global $wpdb;
1627 1625
 
1628
-	$where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' );
1626
+	$where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note');
1629 1627
 
1630 1628
 	return $where;
1631 1629
 }
1632 1630
 
1633
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1631
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1634 1632
 
1635 1633
 
1636 1634
 /**
@@ -1644,32 +1642,32 @@  discard block
 block discarded – undo
1644 1642
  *
1645 1643
  * @return array|object Array of comment counts.
1646 1644
  */
1647
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1645
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1648 1646
 	global $wpdb, $pagenow;
1649 1647
 
1650
-	if ( 'index.php' != $pagenow ) {
1648
+	if ('index.php' != $pagenow) {
1651 1649
 		return $stats;
1652 1650
 	}
1653 1651
 
1654 1652
 	$post_id = (int) $post_id;
1655 1653
 
1656
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1654
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1657 1655
 		return $stats;
1658 1656
 	}
1659 1657
 
1660
-	$stats = Give_Cache::get_group( "comments-{$post_id}", 'counts' );
1658
+	$stats = Give_Cache::get_group("comments-{$post_id}", 'counts');
1661 1659
 
1662
-	if ( ! is_null( $stats ) ) {
1660
+	if ( ! is_null($stats)) {
1663 1661
 		return $stats;
1664 1662
 	}
1665 1663
 
1666 1664
 	$where = 'WHERE comment_type != "give_payment_note"';
1667 1665
 
1668
-	if ( $post_id > 0 ) {
1669
-		$where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
1666
+	if ($post_id > 0) {
1667
+		$where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id);
1670 1668
 	}
1671 1669
 
1672
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1670
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1673 1671
 
1674 1672
 	$total    = 0;
1675 1673
 	$approved = array(
@@ -1679,30 +1677,30 @@  discard block
 block discarded – undo
1679 1677
 		'trash'        => 'trash',
1680 1678
 		'post-trashed' => 'post-trashed',
1681 1679
 	);
1682
-	foreach ( (array) $count as $row ) {
1680
+	foreach ((array) $count as $row) {
1683 1681
 		// Don't count post-trashed toward totals.
1684
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1682
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1685 1683
 			$total += $row['num_comments'];
1686 1684
 		}
1687
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1688
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1685
+		if (isset($approved[$row['comment_approved']])) {
1686
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1689 1687
 		}
1690 1688
 	}
1691 1689
 
1692 1690
 	$stats['total_comments'] = $total;
1693
-	foreach ( $approved as $key ) {
1694
-		if ( empty( $stats[ $key ] ) ) {
1695
-			$stats[ $key ] = 0;
1691
+	foreach ($approved as $key) {
1692
+		if (empty($stats[$key])) {
1693
+			$stats[$key] = 0;
1696 1694
 		}
1697 1695
 	}
1698 1696
 
1699 1697
 	$stats = (object) $stats;
1700
-	Give_Cache::set_group( "comments-{$post_id}", $stats, 'counts' );
1698
+	Give_Cache::set_group("comments-{$post_id}", $stats, 'counts');
1701 1699
 
1702 1700
 	return $stats;
1703 1701
 }
1704 1702
 
1705
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1703
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1706 1704
 
1707 1705
 
1708 1706
 /**
@@ -1715,9 +1713,9 @@  discard block
 block discarded – undo
1715 1713
  *
1716 1714
  * @return string $where Modified where clause.
1717 1715
  */
1718
-function give_filter_where_older_than_week( $where = '' ) {
1716
+function give_filter_where_older_than_week($where = '') {
1719 1717
 	// Payments older than one week.
1720
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1718
+	$start = date('Y-m-d', strtotime('-7 days'));
1721 1719
 	$where .= " AND post_date <= '{$start}'";
1722 1720
 
1723 1721
 	return $where;
@@ -1737,13 +1735,13 @@  discard block
 block discarded – undo
1737 1735
  *
1738 1736
  * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title.
1739 1737
  */
1740
-function give_get_donation_form_title( $donation, $args = array() ) {
1738
+function give_get_donation_form_title($donation, $args = array()) {
1741 1739
 
1742
-	if ( ! $donation instanceof Give_Payment ) {
1743
-		$donation = new Give_Payment( $donation );
1740
+	if ( ! $donation instanceof Give_Payment) {
1741
+		$donation = new Give_Payment($donation);
1744 1742
 	}
1745 1743
 
1746
-	if( ! $donation->ID ) {
1744
+	if ( ! $donation->ID) {
1747 1745
 		return '';
1748 1746
 	}
1749 1747
 
@@ -1752,7 +1750,7 @@  discard block
 block discarded – undo
1752 1750
 		'separator'  => '',
1753 1751
 	);
1754 1752
 
1755
-	$args = wp_parse_args( $args, $defaults );
1753
+	$args = wp_parse_args($args, $defaults);
1756 1754
 
1757 1755
 	$form_id     = $donation->form_id;
1758 1756
 	$price_id    = $donation->price_id;
@@ -1773,39 +1771,39 @@  discard block
 block discarded – undo
1773 1771
 		, false
1774 1772
 	);
1775 1773
 
1776
-	$form_title_html = Give_Cache::get_db_query( $cache_key );
1774
+	$form_title_html = Give_Cache::get_db_query($cache_key);
1777 1775
 
1778
-	if ( is_null( $form_title_html ) ) {
1779
-		if ( true === $only_level ) {
1776
+	if (is_null($form_title_html)) {
1777
+		if (true === $only_level) {
1780 1778
 			$form_title = '';
1781 1779
 		}
1782 1780
 
1783 1781
 		$form_title_html = $form_title;
1784 1782
 
1785
-		if ( 'custom' === $price_id ) {
1783
+		if ('custom' === $price_id) {
1786 1784
 
1787
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
1788
-			$level_label        = ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' );
1785
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
1786
+			$level_label        = ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give');
1789 1787
 
1790 1788
 			// Show custom amount level only in backend otherwise hide it.
1791
-			if( 'set' === give_get_meta( $form_id, '_give_price_option', true ) && ! is_admin()  ) {
1789
+			if ('set' === give_get_meta($form_id, '_give_price_option', true) && ! is_admin()) {
1792 1790
 				$level_label = '';
1793 1791
 			}
1794 1792
 
1795
-		} elseif ( give_has_variable_prices( $form_id ) ) {
1796
-			$level_label = give_get_price_option_name( $form_id, $price_id, $donation->ID, false );
1793
+		} elseif (give_has_variable_prices($form_id)) {
1794
+			$level_label = give_get_price_option_name($form_id, $price_id, $donation->ID, false);
1797 1795
 		}
1798 1796
 
1799 1797
 		// Only add separator if there is a form title.
1800 1798
 		if (
1801
-			! empty( $form_title_html ) &&
1802
-			! empty( $level_label )
1799
+			! empty($form_title_html) &&
1800
+			! empty($level_label)
1803 1801
 		) {
1804 1802
 			$form_title_html .= " {$separator} ";
1805 1803
 		}
1806 1804
 
1807 1805
 		$form_title_html .= "<span class=\"donation-level-text-wrap\">{$level_label}</span>";
1808
-		Give_Cache::set_db_query( $cache_key, $form_title_html );
1806
+		Give_Cache::set_db_query($cache_key, $form_title_html);
1809 1807
 	}
1810 1808
 
1811 1809
 	/**
@@ -1813,7 +1811,7 @@  discard block
 block discarded – undo
1813 1811
 	 *
1814 1812
 	 * @since 1.0
1815 1813
 	 */
1816
-	return apply_filters( 'give_get_donation_form_title', $form_title_html, $donation->payment_meta, $donation );
1814
+	return apply_filters('give_get_donation_form_title', $form_title_html, $donation->payment_meta, $donation);
1817 1815
 }
1818 1816
 
1819 1817
 /**
@@ -1826,19 +1824,19 @@  discard block
 block discarded – undo
1826 1824
  *
1827 1825
  * @return string $price_id
1828 1826
  */
1829
-function give_get_price_id( $form_id, $price ) {
1827
+function give_get_price_id($form_id, $price) {
1830 1828
 	$price_id = null;
1831 1829
 
1832
-	if ( give_has_variable_prices( $form_id ) ) {
1830
+	if (give_has_variable_prices($form_id)) {
1833 1831
 
1834
-		$levels = give_get_meta( $form_id, '_give_donation_levels', true );
1832
+		$levels = give_get_meta($form_id, '_give_donation_levels', true);
1835 1833
 
1836
-		foreach ( $levels as $level ) {
1834
+		foreach ($levels as $level) {
1837 1835
 
1838
-			$level_amount = give_maybe_sanitize_amount( $level['_give_amount'] );
1836
+			$level_amount = give_maybe_sanitize_amount($level['_give_amount']);
1839 1837
 
1840 1838
 			// Check that this indeed the recurring price.
1841
-			if ( $level_amount == $price ) {
1839
+			if ($level_amount == $price) {
1842 1840
 
1843 1841
 				$price_id = $level['_give_id']['level_id'];
1844 1842
 				break;
@@ -1846,13 +1844,13 @@  discard block
 block discarded – undo
1846 1844
 			}
1847 1845
 		}
1848 1846
 
1849
-		if ( is_null( $price_id ) && give_is_custom_price_mode( $form_id ) ) {
1847
+		if (is_null($price_id) && give_is_custom_price_mode($form_id)) {
1850 1848
 			$price_id = 'custom';
1851 1849
 		}
1852 1850
 	}
1853 1851
 
1854 1852
 	// Price ID must be numeric or string.
1855
-	$price_id = ! is_numeric( $price_id ) && ! is_string( $price_id ) ? 0 : $price_id;
1853
+	$price_id = ! is_numeric($price_id) && ! is_string($price_id) ? 0 : $price_id;
1856 1854
 
1857 1855
 	/**
1858 1856
 	 * Filter the price id
@@ -1862,7 +1860,7 @@  discard block
 block discarded – undo
1862 1860
 	 * @param string $price_id
1863 1861
 	 * @param int    $form_id
1864 1862
 	 */
1865
-	return apply_filters( 'give_get_price_id', $price_id, $form_id );
1863
+	return apply_filters('give_get_price_id', $price_id, $form_id);
1866 1864
 }
1867 1865
 
1868 1866
 /**
@@ -1878,10 +1876,10 @@  discard block
 block discarded – undo
1878 1876
  *
1879 1877
  * @return string
1880 1878
  */
1881
-function give_get_form_dropdown( $args = array(), $echo = false ) {
1882
-	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1879
+function give_get_form_dropdown($args = array(), $echo = false) {
1880
+	$form_dropdown_html = Give()->html->forms_dropdown($args);
1883 1881
 
1884
-	if ( ! $echo ) {
1882
+	if ( ! $echo) {
1885 1883
 		return $form_dropdown_html;
1886 1884
 	}
1887 1885
 
@@ -1898,17 +1896,17 @@  discard block
 block discarded – undo
1898 1896
  *
1899 1897
  * @return string|bool
1900 1898
  */
1901
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) {
1899
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1902 1900
 
1903 1901
 	// Check for give form id.
1904
-	if ( empty( $args['id'] ) ) {
1902
+	if (empty($args['id'])) {
1905 1903
 		return false;
1906 1904
 	}
1907 1905
 
1908
-	$form = new Give_Donate_Form( $args['id'] );
1906
+	$form = new Give_Donate_Form($args['id']);
1909 1907
 
1910 1908
 	// Check if form has variable prices or not.
1911
-	if ( ! $form->ID || ! $form->has_variable_prices() ) {
1909
+	if ( ! $form->ID || ! $form->has_variable_prices()) {
1912 1910
 		return false;
1913 1911
 	}
1914 1912
 
@@ -1916,24 +1914,24 @@  discard block
 block discarded – undo
1916 1914
 	$variable_price_options = array();
1917 1915
 
1918 1916
 	// Check if multi donation form support custom donation or not.
1919
-	if ( $form->is_custom_price_mode() ) {
1920
-		$variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' );
1917
+	if ($form->is_custom_price_mode()) {
1918
+		$variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1921 1919
 	}
1922 1920
 
1923 1921
 	// Get variable price and ID from variable price array.
1924
-	foreach ( $variable_prices as $variable_price ) {
1925
-		$variable_price_options[ $variable_price['_give_id']['level_id'] ] = ! empty( $variable_price['_give_text'] ) ? $variable_price['_give_text'] : give_currency_filter( give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ) );
1922
+	foreach ($variable_prices as $variable_price) {
1923
+		$variable_price_options[$variable_price['_give_id']['level_id']] = ! empty($variable_price['_give_text']) ? $variable_price['_give_text'] : give_currency_filter(give_format_amount($variable_price['_give_amount'], array('sanitize' => false)));
1926 1924
 	}
1927 1925
 
1928 1926
 	// Update options.
1929
-	$args = array_merge( $args, array(
1927
+	$args = array_merge($args, array(
1930 1928
 		'options' => $variable_price_options,
1931
-	) );
1929
+	));
1932 1930
 
1933 1931
 	// Generate select html.
1934
-	$form_dropdown_html = Give()->html->select( $args );
1932
+	$form_dropdown_html = Give()->html->select($args);
1935 1933
 
1936
-	if ( ! $echo ) {
1934
+	if ( ! $echo) {
1937 1935
 		return $form_dropdown_html;
1938 1936
 	}
1939 1937
 
@@ -1952,14 +1950,14 @@  discard block
 block discarded – undo
1952 1950
  *
1953 1951
  * @return string
1954 1952
  */
1955
-function give_get_payment_meta_price_id( $payment_meta ) {
1953
+function give_get_payment_meta_price_id($payment_meta) {
1956 1954
 
1957
-	if ( isset( $payment_meta['give_price_id'] ) ) {
1955
+	if (isset($payment_meta['give_price_id'])) {
1958 1956
 		$price_id = $payment_meta['give_price_id'];
1959
-	} elseif ( isset( $payment_meta['price_id'] ) ) {
1957
+	} elseif (isset($payment_meta['price_id'])) {
1960 1958
 		$price_id = $payment_meta['price_id'];
1961 1959
 	} else {
1962
-		$price_id = give_get_price_id( $payment_meta['give_form_id'], $payment_meta['price'] );
1960
+		$price_id = give_get_price_id($payment_meta['give_form_id'], $payment_meta['price']);
1963 1961
 	}
1964 1962
 
1965 1963
 	/**
@@ -1970,6 +1968,6 @@  discard block
 block discarded – undo
1970 1968
 	 * @param string $price_id
1971 1969
 	 * @param array  $payment_meta
1972 1970
 	 */
1973
-	return apply_filters( 'give_get_payment_meta_price_id', $price_id, $payment_meta );
1971
+	return apply_filters('give_get_payment_meta_price_id', $price_id, $payment_meta);
1974 1972
 
1975 1973
 }
Please login to merge, or discard this patch.
includes/emails/class-give-email-tags.php 1 patch
Spacing   +284 added lines, -284 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 // Exit if accessed directly.
26
-if ( ! defined( 'ABSPATH' ) ) {
26
+if ( ! defined('ABSPATH')) {
27 27
 	exit;
28 28
 }
29 29
 
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 * @param callable $func        Hook to run when email tag is found
57 57
 	 * @param string   $context     Email tag category
58 58
 	 */
59
-	public function add( $tag, $description, $func, $context = '' ) {
60
-		if ( is_callable( $func ) ) {
61
-			$this->tags[ $tag ] = array(
59
+	public function add($tag, $description, $func, $context = '') {
60
+		if (is_callable($func)) {
61
+			$this->tags[$tag] = array(
62 62
 				'tag'         => $tag,
63 63
 				'description' => $description,
64 64
 				'func'        => $func,
65
-				'context'     => give_check_variable( $context, 'empty', 'general' ),
65
+				'context'     => give_check_variable($context, 'empty', 'general'),
66 66
 			);
67 67
 		}
68 68
 	}
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @param string $tag Email tag to remove hook from
76 76
 	 */
77
-	public function remove( $tag ) {
78
-		unset( $this->tags[ $tag ] );
77
+	public function remove($tag) {
78
+		unset($this->tags[$tag]);
79 79
 	}
80 80
 
81 81
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return bool
89 89
 	 */
90
-	public function email_tag_exists( $tag ) {
91
-		return array_key_exists( $tag, $this->tags );
90
+	public function email_tag_exists($tag) {
91
+		return array_key_exists($tag, $this->tags);
92 92
 	}
93 93
 
94 94
 	/**
@@ -102,23 +102,23 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array
104 104
 	 */
105
-	public function get_tags( $context_type = 'all', $field = '' ) {
105
+	public function get_tags($context_type = 'all', $field = '') {
106 106
 		$tags = $this->tags;
107 107
 
108
-		if ( 'all' !== $context_type ) {
108
+		if ('all' !== $context_type) {
109 109
 			$tags = array();
110 110
 
111
-			foreach ( $this->tags as $tag ) {
112
-				if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) {
111
+			foreach ($this->tags as $tag) {
112
+				if (empty($tag['context']) || $context_type !== $tag['context']) {
113 113
 					continue;
114 114
 				}
115 115
 
116
-				$tags[ $tag['tag'] ] = $tag;
116
+				$tags[$tag['tag']] = $tag;
117 117
 			}
118 118
 		}
119 119
 
120
-		if ( ! empty( $tags ) && ! empty( $field ) ) {
121
-			$tags = wp_list_pluck( $tags, $field );
120
+		if ( ! empty($tags) && ! empty($field)) {
121
+			$tags = wp_list_pluck($tags, $field);
122 122
 		}
123 123
 
124 124
 		return $tags;
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @return string Content with email tags filtered out.
138 138
 	 */
139
-	public function do_tags( $content, $tag_args ) {
139
+	public function do_tags($content, $tag_args) {
140 140
 
141 141
 		// Check if there is at least one tag added.
142
-		if ( empty( $this->tags ) || ! is_array( $this->tags ) ) {
142
+		if (empty($this->tags) || ! is_array($this->tags)) {
143 143
 			return $content;
144 144
 		}
145 145
 
146 146
 		$this->tag_args = $tag_args;
147 147
 
148
-		$new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content );
148
+		$new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content);
149 149
 
150 150
 		$this->tag_args = null;
151 151
 
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return mixed
163 163
 	 */
164
-	public function do_tag( $m ) {
164
+	public function do_tag($m) {
165 165
 
166 166
 		// Get tag
167 167
 		$tag = $m[1];
168 168
 
169 169
 		// Return tag if tag not set
170
-		if ( ! $this->email_tag_exists( $tag ) ) {
170
+		if ( ! $this->email_tag_exists($tag)) {
171 171
 			return $m[0];
172 172
 		}
173 173
 
174
-		return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag );
174
+		return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag);
175 175
 	}
176 176
 
177 177
 }
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
  * @param callable $func        Hook to run when email tag is found
187 187
  * @param string   $context     Email tag category
188 188
  */
189
-function give_add_email_tag( $tag, $description, $func, $context = '' ) {
190
-	Give()->email_tags->add( $tag, $description, $func, $context );
189
+function give_add_email_tag($tag, $description, $func, $context = '') {
190
+	Give()->email_tags->add($tag, $description, $func, $context);
191 191
 }
192 192
 
193 193
 /**
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
  *
198 198
  * @param string $tag Email tag to remove hook from
199 199
  */
200
-function give_remove_email_tag( $tag ) {
201
-	Give()->email_tags->remove( $tag );
200
+function give_remove_email_tag($tag) {
201
+	Give()->email_tags->remove($tag);
202 202
 }
203 203
 
204 204
 /**
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
  *
211 211
  * @return bool
212 212
  */
213
-function give_email_tag_exists( $tag ) {
214
-	return Give()->email_tags->email_tag_exists( $tag );
213
+function give_email_tag_exists($tag) {
214
+	return Give()->email_tags->email_tag_exists($tag);
215 215
 }
216 216
 
217 217
 /**
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 	$email_tags = give_get_email_tags();
239 239
 
240 240
 	ob_start();
241
-	if ( count( $email_tags ) > 0 ) : ?>
241
+	if (count($email_tags) > 0) : ?>
242 242
 		<div class="give-email-tags-wrap">
243
-			<?php foreach ( $email_tags as $email_tag ) : ?>
243
+			<?php foreach ($email_tags as $email_tag) : ?>
244 244
 				<span class="give_<?php echo $email_tag['tag']; ?>_tag">
245 245
 					<code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?>
246 246
 				</span>
@@ -264,14 +264,14 @@  discard block
 block discarded – undo
264 264
  *
265 265
  * @return string Content with email tags filtered out.
266 266
  */
267
-function give_do_email_tags( $content, $tag_args ) {
267
+function give_do_email_tags($content, $tag_args) {
268 268
 	// Backward compatibility < 2.0
269
-	if ( ! is_array( $tag_args ) ) {
270
-		$tag_args = array( 'payment_id' => $tag_args );
269
+	if ( ! is_array($tag_args)) {
270
+		$tag_args = array('payment_id' => $tag_args);
271 271
 	}
272 272
 
273 273
 	// Replace all tags
274
-	$content = Give()->email_tags->do_tags( $content, $tag_args );
274
+	$content = Give()->email_tags->do_tags($content, $tag_args);
275 275
 
276 276
 	/**
277 277
 	 * Filter the filtered content text.
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @since 1.0
280 280
 	 * @since 2.0 $payment_meta, $payment_id removed and $tag_args added.
281 281
 	 */
282
-	$content = apply_filters( 'give_email_template_tags', $content, $tag_args );
282
+	$content = apply_filters('give_email_template_tags', $content, $tag_args);
283 283
 
284 284
 	// Return content
285 285
 	return $content;
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 	 *
299 299
 	 * @since 1.0
300 300
 	 */
301
-	do_action( 'give_add_email_tags' );
301
+	do_action('give_add_email_tags');
302 302
 }
303 303
 
304
-add_action( 'init', 'give_load_email_tags', - 999 );
304
+add_action('init', 'give_load_email_tags', - 999);
305 305
 
306 306
 
307 307
 /**
@@ -316,67 +316,67 @@  discard block
 block discarded – undo
316 316
 		/*	Donation Payment */
317 317
 		array(
318 318
 			'tag'         => 'donation',
319
-			'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ),
319
+			'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'),
320 320
 			'function'    => 'give_email_tag_donation',
321 321
 			'context'     => 'donation',
322 322
 		),
323 323
 		array(
324 324
 			'tag'         => 'amount',
325
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
325
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
326 326
 			'function'    => 'give_email_tag_amount',
327 327
 			'context'     => 'donation',
328 328
 		),
329 329
 		array(
330 330
 			'tag'         => 'price',
331
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
331
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
332 332
 			'function'    => 'give_email_tag_price',
333 333
 			'context'     => 'donation',
334 334
 		),
335 335
 		array(
336 336
 			'tag'         => 'billing_address',
337
-			'description' => esc_html__( 'The donor\'s billing address.', 'give' ),
337
+			'description' => esc_html__('The donor\'s billing address.', 'give'),
338 338
 			'function'    => 'give_email_tag_billing_address',
339 339
 			'context'     => 'donation',
340 340
 		),
341 341
 		array(
342 342
 			'tag'         => 'date',
343
-			'description' => esc_html__( 'The date of the donation.', 'give' ),
343
+			'description' => esc_html__('The date of the donation.', 'give'),
344 344
 			'function'    => 'give_email_tag_date',
345 345
 			'context'     => 'donation',
346 346
 		),
347 347
 		array(
348 348
 			'tag'         => 'payment_id',
349
-			'description' => esc_html__( 'The unique ID number for this donation.', 'give' ),
349
+			'description' => esc_html__('The unique ID number for this donation.', 'give'),
350 350
 			'function'    => 'give_email_tag_payment_id',
351 351
 			'context'     => 'donation',
352 352
 		),
353 353
 		array(
354 354
 			'tag'         => 'payment_method',
355
-			'description' => esc_html__( 'The method of payment used for this donation.', 'give' ),
355
+			'description' => esc_html__('The method of payment used for this donation.', 'give'),
356 356
 			'function'    => 'give_email_tag_payment_method',
357 357
 			'context'     => 'donation',
358 358
 		),
359 359
 		array(
360 360
 			'tag'         => 'payment_total',
361
-			'description' => esc_html__( 'The payment total for this donation.', 'give' ),
361
+			'description' => esc_html__('The payment total for this donation.', 'give'),
362 362
 			'function'    => 'give_email_tag_payment_total',
363 363
 			'context'     => 'donation',
364 364
 		),
365 365
 		array(
366 366
 			'tag'         => 'receipt_id',
367
-			'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ),
367
+			'description' => esc_html__('The unique ID number for this donation receipt.', 'give'),
368 368
 			'function'    => 'give_email_tag_receipt_id',
369 369
 			'context'     => 'donation',
370 370
 		),
371 371
 		array(
372 372
 			'tag'         => 'receipt_link',
373
-			'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ),
373
+			'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'),
374 374
 			'function'    => 'give_email_tag_receipt_link',
375 375
 			'context'     => 'donation',
376 376
 		),
377 377
 		array(
378 378
 			'tag'         => 'receipt_link_url',
379
-			'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ),
379
+			'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'),
380 380
 			'function'    => 'give_email_tag_receipt_link_url',
381 381
 			'context'     => 'donation',
382 382
 		),
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		/* Donation Form */
385 385
 		array(
386 386
 			'tag'         => 'form_title',
387
-			'description' => esc_html__( 'The donation form name.', 'give' ),
387
+			'description' => esc_html__('The donation form name.', 'give'),
388 388
 			'function'    => 'give_email_tag_form_title',
389 389
 			'context'     => 'form',
390 390
 		),
@@ -392,31 +392,31 @@  discard block
 block discarded – undo
392 392
 		/* Donor */
393 393
 		array(
394 394
 			'tag'         => 'name',
395
-			'description' => esc_html__( 'The donor\'s first name.', 'give' ),
395
+			'description' => esc_html__('The donor\'s first name.', 'give'),
396 396
 			'function'    => 'give_email_tag_first_name',
397 397
 			'context'     => 'donor',
398 398
 		),
399 399
 		array(
400 400
 			'tag'         => 'fullname',
401
-			'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ),
401
+			'description' => esc_html__('The donor\'s full name, first and last.', 'give'),
402 402
 			'function'    => 'give_email_tag_fullname',
403 403
 			'context'     => 'donor',
404 404
 		),
405 405
 		array(
406 406
 			'tag'         => 'username',
407
-			'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ),
407
+			'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'),
408 408
 			'function'    => 'give_email_tag_username',
409 409
 			'context'     => 'donor',
410 410
 		),
411 411
 		array(
412 412
 			'tag'         => 'user_email',
413
-			'description' => esc_html__( 'The donor\'s email address.', 'give' ),
413
+			'description' => esc_html__('The donor\'s email address.', 'give'),
414 414
 			'function'    => 'give_email_tag_user_email',
415 415
 			'context'     => 'donor',
416 416
 		),
417 417
 		array(
418 418
 			'tag'         => 'email_access_link',
419
-			'description' => esc_html__( 'The donor\'s email access link.', 'give' ),
419
+			'description' => esc_html__('The donor\'s email access link.', 'give'),
420 420
 			'function'    => 'give_email_tag_email_access_link',
421 421
 			'context'     => 'donor',
422 422
 		),
@@ -424,14 +424,14 @@  discard block
 block discarded – undo
424 424
 		/* General */
425 425
 		array(
426 426
 			'tag'         => 'sitename',
427
-			'description' => esc_html__( 'The name of your site.', 'give' ),
427
+			'description' => esc_html__('The name of your site.', 'give'),
428 428
 			'function'    => 'give_email_tag_sitename',
429 429
 			'context'     => 'general',
430 430
 		),
431 431
 
432 432
 		array(
433 433
 			'tag'         => 'reset_password_link',
434
-			'description' => esc_html__( 'The reset password link for user.', 'give' ),
434
+			'description' => esc_html__('The reset password link for user.', 'give'),
435 435
 			'function'    => 'give_email_tag_reset_password_link',
436 436
 			'context'     => 'general',
437 437
 		),
@@ -439,21 +439,21 @@  discard block
 block discarded – undo
439 439
 	);
440 440
 
441 441
 	// Apply give_email_tags filter
442
-	$email_tags = apply_filters( 'give_email_tags', $email_tags );
442
+	$email_tags = apply_filters('give_email_tags', $email_tags);
443 443
 
444 444
 	// Add email tags
445
-	foreach ( $email_tags as $email_tag ) {
445
+	foreach ($email_tags as $email_tag) {
446 446
 		give_add_email_tag(
447 447
 			$email_tag['tag'],
448 448
 			$email_tag['description'],
449 449
 			$email_tag['function'],
450
-			( ! empty( $email_tag['context'] ) ? $email_tag['context'] : '' )
450
+			( ! empty($email_tag['context']) ? $email_tag['context'] : '')
451 451
 		);
452 452
 	}
453 453
 
454 454
 }
455 455
 
456
-add_action( 'give_add_email_tags', 'give_setup_email_tags' );
456
+add_action('give_add_email_tags', 'give_setup_email_tags');
457 457
 
458 458
 
459 459
 /**
@@ -465,26 +465,26 @@  discard block
 block discarded – undo
465 465
  *
466 466
  * @return string $firstname
467 467
  */
468
-function give_email_tag_first_name( $tag_args ) {
468
+function give_email_tag_first_name($tag_args) {
469 469
 	$user_info = array();
470 470
 	$firstname = '';
471 471
 
472 472
 	// Backward compatibility.
473
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
473
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
474 474
 
475
-	switch ( true ) {
476
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
477
-			$payment = new Give_Payment( $tag_args['payment_id'] );
475
+	switch (true) {
476
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
477
+			$payment = new Give_Payment($tag_args['payment_id']);
478 478
 
479 479
 			// Get firstname.
480
-			if ( ! empty( $payment->user_info ) ) {
481
-				$email_names = give_get_email_names( $payment->user_info );
480
+			if ( ! empty($payment->user_info)) {
481
+				$email_names = give_get_email_names($payment->user_info);
482 482
 				$firstname   = $email_names['name'];
483 483
 			}
484 484
 			break;
485 485
 
486
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
487
-			$donor = new Give_Donor( $tag_args['user_id'], true );
486
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
487
+			$donor = new Give_Donor($tag_args['user_id'], true);
488 488
 			$firstname = $donor->get_first_name();
489 489
 			break;
490 490
 
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 		 *
494 494
 		 * @since 2.0
495 495
 		 */
496
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
497
-			$donor = new Give_Donor( $tag_args['donor_id'] );
496
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
497
+			$donor = new Give_Donor($tag_args['donor_id']);
498 498
 			$firstname = $donor->get_first_name();
499 499
 			break;
500 500
 	}
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	 * @param string $firstname
508 508
 	 * @param array  $tag_args
509 509
 	 */
510
-	$firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args );
510
+	$firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args);
511 511
 
512 512
 	return $firstname;
513 513
 }
@@ -521,26 +521,26 @@  discard block
 block discarded – undo
521 521
  *
522 522
  * @return string $fullname
523 523
  */
524
-function give_email_tag_fullname( $tag_args ) {
524
+function give_email_tag_fullname($tag_args) {
525 525
 	$fullname = '';
526 526
 
527 527
 	// Backward compatibility.
528
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
528
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
529 529
 
530
-	switch ( true ) {
531
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
532
-			$payment = new Give_Payment( $tag_args['payment_id'] );
530
+	switch (true) {
531
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
532
+			$payment = new Give_Payment($tag_args['payment_id']);
533 533
 
534 534
 			// Get fullname.
535
-			if ( ! empty( $payment->user_info ) ) {
536
-				$email_names = give_get_email_names( $payment->user_info );
535
+			if ( ! empty($payment->user_info)) {
536
+				$email_names = give_get_email_names($payment->user_info);
537 537
 				$fullname    = $email_names['fullname'];
538 538
 			}
539 539
 			break;
540 540
 
541
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
542
-			$donor = new Give_Donor( $tag_args['user_id'], true );
543
-			$fullname  = trim( "{$donor->get_first_name()} {$donor->get_last_name()}" );
541
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
542
+			$donor = new Give_Donor($tag_args['user_id'], true);
543
+			$fullname = trim("{$donor->get_first_name()} {$donor->get_last_name()}");
544 544
 			break;
545 545
 
546 546
 		/**
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 		 *
549 549
 		 * @since 2.0
550 550
 		 */
551
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
552
-			$donor = new Give_Donor( $tag_args['donor_id'] );
551
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
552
+			$donor = new Give_Donor($tag_args['donor_id']);
553 553
 			$fullname = $donor->name;
554 554
 			break;
555 555
 	}
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	 * @param string $fullname
563 563
 	 * @param array  $tag_args
564 564
 	 */
565
-	$fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args );
565
+	$fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args);
566 566
 
567 567
 	return $fullname;
568 568
 }
@@ -576,25 +576,25 @@  discard block
 block discarded – undo
576 576
  *
577 577
  * @return string username.
578 578
  */
579
-function give_email_tag_username( $tag_args ) {
579
+function give_email_tag_username($tag_args) {
580 580
 	$username = '';
581 581
 
582 582
 	// Backward compatibility.
583
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
583
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
584 584
 
585
-	switch ( true ) {
586
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
587
-			$payment = new Give_Payment( $tag_args['payment_id'] );
585
+	switch (true) {
586
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
587
+			$payment = new Give_Payment($tag_args['payment_id']);
588 588
 
589 589
 			// Get username.
590
-			if ( ! empty( $payment->user_info ) ) {
591
-				$email_names = give_get_email_names( $payment->user_info );
590
+			if ( ! empty($payment->user_info)) {
591
+				$email_names = give_get_email_names($payment->user_info);
592 592
 				$username    = $email_names['username'];
593 593
 			}
594 594
 			break;
595 595
 
596
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
597
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
596
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
597
+			$user_info = get_user_by('id', $tag_args['user_id']);
598 598
 			$username  = $user_info->user_login;
599 599
 			break;
600 600
 
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
 		 *
604 604
 		 * @since 2.0
605 605
 		 */
606
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
607
-			$donor = new Give_Donor( $tag_args['donor_id'] );
608
-			if ( ! empty( $donor->id ) && ! empty( $donor->user_id ) ) {
609
-				$user_info = get_user_by( 'id', $donor->user_id );
606
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
607
+			$donor = new Give_Donor($tag_args['donor_id']);
608
+			if ( ! empty($donor->id) && ! empty($donor->user_id)) {
609
+				$user_info = get_user_by('id', $donor->user_id);
610 610
 				$username  = $user_info->user_login;
611 611
 			}
612 612
 			break;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 	 * @param string $username
621 621
 	 * @param array  $tag_args
622 622
 	 */
623
-	$username = apply_filters( 'give_email_tag_username', $username, $tag_args );
623
+	$username = apply_filters('give_email_tag_username', $username, $tag_args);
624 624
 
625 625
 	return $username;
626 626
 }
@@ -634,20 +634,20 @@  discard block
 block discarded – undo
634 634
  *
635 635
  * @return string user_email
636 636
  */
637
-function give_email_tag_user_email( $tag_args ) {
637
+function give_email_tag_user_email($tag_args) {
638 638
 	$email = '';
639 639
 
640 640
 	// Backward compatibility.
641
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
641
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
642 642
 
643
-	switch ( true ) {
644
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
645
-			$payment = new Give_Payment( $tag_args['payment_id'] );
643
+	switch (true) {
644
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
645
+			$payment = new Give_Payment($tag_args['payment_id']);
646 646
 			$email   = $payment->email;
647 647
 			break;
648 648
 
649
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
650
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
649
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
650
+			$user_info = get_user_by('id', $tag_args['user_id']);
651 651
 			$email     = $user_info->user_email;
652 652
 			break;
653 653
 
@@ -656,9 +656,9 @@  discard block
 block discarded – undo
656 656
 		 *
657 657
 		 * @since 2.0
658 658
 		 */
659
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
660
-			$donor = new Give_Donor( $tag_args['donor_id'] );
661
-			$email     = $donor->email;
659
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
660
+			$donor = new Give_Donor($tag_args['donor_id']);
661
+			$email = $donor->email;
662 662
 			break;
663 663
 	}
664 664
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 	 * @param string $email
671 671
 	 * @param array  $tag_args
672 672
 	 */
673
-	$email = apply_filters( 'give_email_tag_user_email', $email, $tag_args );
673
+	$email = apply_filters('give_email_tag_user_email', $email, $tag_args);
674 674
 
675 675
 	return $email;
676 676
 }
@@ -684,22 +684,22 @@  discard block
 block discarded – undo
684 684
  *
685 685
  * @return string billing_address
686 686
  */
687
-function give_email_tag_billing_address( $tag_args ) {
687
+function give_email_tag_billing_address($tag_args) {
688 688
 	$address = '';
689 689
 
690 690
 	// Backward compatibility.
691
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
691
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
692 692
 
693
-	switch ( true ) {
694
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
695
-			$donation   = new Give_Payment( $tag_args['payment_id'] );
696
-			$address = $donation->address['line1'] . "\n";
693
+	switch (true) {
694
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
695
+			$donation = new Give_Payment($tag_args['payment_id']);
696
+			$address = $donation->address['line1']."\n";
697 697
 
698
-			if ( ! empty( $donation->address['line2'] ) ) {
699
-				$address .= $donation->address['line2'] . "\n";
698
+			if ( ! empty($donation->address['line2'])) {
699
+				$address .= $donation->address['line2']."\n";
700 700
 			}
701 701
 
702
-			$address .= $donation->address['city'] . ' ' . $donation->address['zip'] . ' ' . $donation->address['state'] . "\n";
702
+			$address .= $donation->address['city'].' '.$donation->address['zip'].' '.$donation->address['state']."\n";
703 703
 			$address .= $donation->address['country'];
704 704
 			break;
705 705
 	}
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	 * @param string $address
713 713
 	 * @param array  $tag_args
714 714
 	 */
715
-	$address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args );
715
+	$address = apply_filters('give_email_tag_billing_address', $address, $tag_args);
716 716
 
717 717
 	return $address;
718 718
 }
@@ -726,16 +726,16 @@  discard block
 block discarded – undo
726 726
  *
727 727
  * @return string date
728 728
  */
729
-function give_email_tag_date( $tag_args ) {
729
+function give_email_tag_date($tag_args) {
730 730
 	$date = '';
731 731
 
732 732
 	// Backward compatibility.
733
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
733
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
734 734
 
735
-	switch ( true ) {
736
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
737
-			$payment = new Give_Payment( $tag_args['payment_id'] );
738
-			$date    = date_i18n( give_date_format(), strtotime( $payment->date ) );
735
+	switch (true) {
736
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
737
+			$payment = new Give_Payment($tag_args['payment_id']);
738
+			$date    = date_i18n(give_date_format(), strtotime($payment->date));
739 739
 			break;
740 740
 	}
741 741
 
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 	 * @param string $date
748 748
 	 * @param array  $tag_args
749 749
 	 */
750
-	$date = apply_filters( 'give_email_tag_date', $date, $tag_args );
750
+	$date = apply_filters('give_email_tag_date', $date, $tag_args);
751 751
 
752 752
 	return $date;
753 753
 }
@@ -761,17 +761,17 @@  discard block
 block discarded – undo
761 761
  *
762 762
  * @return string amount
763 763
  */
764
-function give_email_tag_amount( $tag_args ) {
764
+function give_email_tag_amount($tag_args) {
765 765
 	$amount = '';
766 766
 
767 767
 	// Backward compatibility.
768
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
768
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
769 769
 
770
-	switch ( true ) {
771
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
772
-			$payment     = new Give_Payment( $tag_args['payment_id'] );
773
-			$give_amount = give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), array( 'currency_code' => $payment->currency ) );
774
-			$amount      = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' );
770
+	switch (true) {
771
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
772
+			$payment     = new Give_Payment($tag_args['payment_id']);
773
+			$give_amount = give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), array('currency_code' => $payment->currency));
774
+			$amount      = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8');
775 775
 			break;
776 776
 	}
777 777
 
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 	 * @param string $amount
784 784
 	 * @param array  $tag_args
785 785
 	 */
786
-	$amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args );
786
+	$amount = apply_filters('give_email_tag_amount', $amount, $tag_args);
787 787
 
788 788
 	return $amount;
789 789
 }
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
  *
798 798
  * @return string price
799 799
  */
800
-function give_email_tag_price( $tag_args ) {
801
-	return give_email_tag_amount( $tag_args );
800
+function give_email_tag_price($tag_args) {
801
+	return give_email_tag_amount($tag_args);
802 802
 }
803 803
 
804 804
 /**
@@ -810,15 +810,15 @@  discard block
 block discarded – undo
810 810
  *
811 811
  * @return int payment_id
812 812
  */
813
-function give_email_tag_payment_id( $tag_args ) {
813
+function give_email_tag_payment_id($tag_args) {
814 814
 	$payment_id = '';
815 815
 
816 816
 	// Backward compatibility.
817
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
817
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
818 818
 
819
-	switch ( true ) {
820
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
821
-			$payment    = new Give_Payment( $tag_args['payment_id'] );
819
+	switch (true) {
820
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
821
+			$payment    = new Give_Payment($tag_args['payment_id']);
822 822
 			$payment_id = $payment->number;
823 823
 			break;
824 824
 	}
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 	 * @param string $payment_id
832 832
 	 * @param array  $tag_args
833 833
 	 */
834
-	return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args );
834
+	return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args);
835 835
 }
836 836
 
837 837
 /**
@@ -843,15 +843,15 @@  discard block
 block discarded – undo
843 843
  *
844 844
  * @return string receipt_id
845 845
  */
846
-function give_email_tag_receipt_id( $tag_args ) {
846
+function give_email_tag_receipt_id($tag_args) {
847 847
 	$receipt_id = '';
848 848
 
849 849
 	// Backward compatibility.
850
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
850
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
851 851
 
852
-	switch ( true ) {
853
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
854
-			$payment    = new Give_Payment( $tag_args['payment_id'] );
852
+	switch (true) {
853
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
854
+			$payment    = new Give_Payment($tag_args['payment_id']);
855 855
 			$receipt_id = $payment->key;
856 856
 			break;
857 857
 	}
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 	 * @param string $receipt_id
865 865
 	 * @param array  $tag_args
866 866
 	 */
867
-	return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args );
867
+	return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args);
868 868
 }
869 869
 
870 870
 /**
@@ -876,23 +876,23 @@  discard block
 block discarded – undo
876 876
  *
877 877
  * @return string $form_title
878 878
  */
879
-function give_email_tag_donation( $tag_args ) {
879
+function give_email_tag_donation($tag_args) {
880 880
 	$donation_form_title = '';
881 881
 
882 882
 	// Backward compatibility.
883
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
883
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
884 884
 
885
-	switch ( true ) {
886
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
887
-			$payment             = new Give_Payment( $tag_args['payment_id'] );
888
-			$level_title         = give_has_variable_prices( $payment->form_id );
885
+	switch (true) {
886
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
887
+			$payment             = new Give_Payment($tag_args['payment_id']);
888
+			$level_title         = give_has_variable_prices($payment->form_id);
889 889
 			$separator           = $level_title ? '-' : '';
890
-			$donation_form_title = strip_tags( give_check_variable( give_get_donation_form_title(
890
+			$donation_form_title = strip_tags(give_check_variable(give_get_donation_form_title(
891 891
 				$payment,
892 892
 				array(
893 893
 					'separator' => $separator,
894 894
 				)
895
-			), 'empty', '' ) );
895
+			), 'empty', ''));
896 896
 			break;
897 897
 	}
898 898
 
@@ -920,17 +920,17 @@  discard block
 block discarded – undo
920 920
  *
921 921
  * @return string $form_title
922 922
  */
923
-function give_email_tag_form_title( $tag_args ) {
923
+function give_email_tag_form_title($tag_args) {
924 924
 	$donation_form_title = '';
925 925
 
926 926
 	// Backward compatibility.
927
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
927
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
928 928
 
929
-	switch ( true ) {
930
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
931
-			$payment             = new Give_Payment( $tag_args['payment_id'] );
929
+	switch (true) {
930
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
931
+			$payment             = new Give_Payment($tag_args['payment_id']);
932 932
 			$payment_meta        = $payment->payment_meta;
933
-			$donation_form_title = strip_tags( give_check_variable( $payment_meta, 'empty', '', 'form_title' ) );
933
+			$donation_form_title = strip_tags(give_check_variable($payment_meta, 'empty', '', 'form_title'));
934 934
 			break;
935 935
 	}
936 936
 
@@ -958,19 +958,19 @@  discard block
 block discarded – undo
958 958
  *
959 959
  * @return string gateway
960 960
  */
961
-function give_email_tag_payment_method( $tag_args ) {
961
+function give_email_tag_payment_method($tag_args) {
962 962
 	$payment_method = '';
963 963
 
964 964
 	// Backward compatibility.
965
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
965
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
966 966
 
967 967
 	// Backward compatibility.
968
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
968
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
969 969
 
970
-	switch ( true ) {
971
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
972
-			$payment        = new Give_Payment( $tag_args['payment_id'] );
973
-			$payment_method = give_get_gateway_checkout_label( $payment->gateway );
970
+	switch (true) {
971
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
972
+			$payment        = new Give_Payment($tag_args['payment_id']);
973
+			$payment_method = give_get_gateway_checkout_label($payment->gateway);
974 974
 			break;
975 975
 	}
976 976
 
@@ -1001,16 +1001,16 @@  discard block
 block discarded – undo
1001 1001
  *
1002 1002
  * @return string
1003 1003
  */
1004
-function give_email_tag_payment_total( $tag_args ) {
1004
+function give_email_tag_payment_total($tag_args) {
1005 1005
 	$payment_total = '';
1006 1006
 
1007 1007
 	// Backward compatibility.
1008
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1008
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1009 1009
 
1010
-	switch ( true ) {
1011
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1012
-			$payment       = new Give_Payment( $tag_args['payment_id'] );
1013
-			$payment_total = give_currency_filter( $payment->total );
1010
+	switch (true) {
1011
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1012
+			$payment       = new Give_Payment($tag_args['payment_id']);
1013
+			$payment_total = give_currency_filter($payment->total);
1014 1014
 			break;
1015 1015
 	}
1016 1016
 
@@ -1038,11 +1038,11 @@  discard block
 block discarded – undo
1038 1038
  *
1039 1039
  * @return string
1040 1040
  */
1041
-function give_email_tag_sitename( $tag_args = array() ) {
1042
-	$sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
1041
+function give_email_tag_sitename($tag_args = array()) {
1042
+	$sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
1043 1043
 
1044 1044
 	// Backward compatibility.
1045
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1045
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1046 1046
 
1047 1047
 	/**
1048 1048
 	 * Filter the {sitename} email template tag output.
@@ -1068,26 +1068,26 @@  discard block
 block discarded – undo
1068 1068
  *
1069 1069
  * @return string receipt_link
1070 1070
  */
1071
-function give_email_tag_receipt_link( $tag_args ) {
1071
+function give_email_tag_receipt_link($tag_args) {
1072 1072
 	// Backward compatibility.
1073
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1073
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1074 1074
 
1075
-	$receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1075
+	$receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1076 1076
 
1077 1077
 	// Bailout.
1078
-	if ( give_get_option( 'email_template' ) === 'none' ) {
1078
+	if (give_get_option('email_template') === 'none') {
1079 1079
 		return $receipt_url;
1080 1080
 	}
1081 1081
 
1082 1082
 
1083
-	$receipt_url = esc_url( add_query_arg( array(
1084
-		'payment_key' => give_get_payment_key( $tag_args['payment_id'] ),
1085
-	), give_get_history_page_uri() ) );
1083
+	$receipt_url = esc_url(add_query_arg(array(
1084
+		'payment_key' => give_get_payment_key($tag_args['payment_id']),
1085
+	), give_get_history_page_uri()));
1086 1086
 
1087
-	$formatted   = sprintf(
1087
+	$formatted = sprintf(
1088 1088
 		'<a href="%1$s">%2$s</a>',
1089 1089
 		$receipt_url,
1090
-		__( 'View it in your browser &raquo;', 'give' )
1090
+		__('View it in your browser &raquo;', 'give')
1091 1091
 	);
1092 1092
 
1093 1093
 	/**
@@ -1116,11 +1116,11 @@  discard block
 block discarded – undo
1116 1116
  *
1117 1117
  * @return string receipt_url
1118 1118
  */
1119
-function give_email_tag_receipt_link_url( $tag_args ) {
1119
+function give_email_tag_receipt_link_url($tag_args) {
1120 1120
 	// Backward compatibility.
1121
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1121
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1122 1122
 
1123
-	$receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1123
+	$receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1124 1124
 
1125 1125
 	/**
1126 1126
 	 * Filter the {receipt_link_url} email template tag output.
@@ -1147,13 +1147,13 @@  discard block
 block discarded – undo
1147 1147
  *
1148 1148
  * @return string
1149 1149
  */
1150
-function give_get_receipt_url( $payment_id ) {
1150
+function give_get_receipt_url($payment_id) {
1151 1151
 	$receipt_url = '';
1152 1152
 
1153
-	if ( $payment_id ) {
1154
-		$receipt_url = esc_url( add_query_arg( array(
1155
-			'payment_key' => give_get_payment_key( $payment_id ),
1156
-		), give_get_history_page_uri() ) );
1153
+	if ($payment_id) {
1154
+		$receipt_url = esc_url(add_query_arg(array(
1155
+			'payment_key' => give_get_payment_key($payment_id),
1156
+		), give_get_history_page_uri()));
1157 1157
 	}
1158 1158
 
1159 1159
 	return $receipt_url;
@@ -1169,22 +1169,22 @@  discard block
 block discarded – undo
1169 1169
  *
1170 1170
  * @return string
1171 1171
  */
1172
-function give_email_tag_email_access_link( $tag_args ) {
1172
+function give_email_tag_email_access_link($tag_args) {
1173 1173
 	$donor_id          = 0;
1174 1174
 	$donor             = array();
1175 1175
 	$email_access_link = '';
1176 1176
 
1177 1177
 	// Backward compatibility.
1178
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1178
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1179 1179
 
1180
-	switch ( true ) {
1181
-		case ! empty( $tag_args['donor_id'] ):
1180
+	switch (true) {
1181
+		case ! empty($tag_args['donor_id']):
1182 1182
 			$donor_id = $tag_args['donor_id'];
1183
-			$donor    = Give()->donors->get_by( 'id', $tag_args['donor_id'] );
1183
+			$donor    = Give()->donors->get_by('id', $tag_args['donor_id']);
1184 1184
 			break;
1185 1185
 
1186
-		case ! empty( $tag_args['user_id'] ):
1187
-			$donor    = Give()->donors->get_by( 'user_id', $tag_args['user_id'] );
1186
+		case ! empty($tag_args['user_id']):
1187
+			$donor    = Give()->donors->get_by('user_id', $tag_args['user_id']);
1188 1188
 			$donor_id = $donor->id;
1189 1189
 			break;
1190 1190
 
@@ -1193,11 +1193,11 @@  discard block
 block discarded – undo
1193 1193
 	}
1194 1194
 
1195 1195
 	// Set email access link if donor exist.
1196
-	if ( $donor_id ) {
1197
-		$verify_key = wp_generate_password( 20, false );
1196
+	if ($donor_id) {
1197
+		$verify_key = wp_generate_password(20, false);
1198 1198
 
1199 1199
 		// Generate a new verify key
1200
-		Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key );
1200
+		Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key);
1201 1201
 
1202 1202
 		$access_url = add_query_arg(
1203 1203
 			array(
@@ -1207,28 +1207,28 @@  discard block
 block discarded – undo
1207 1207
 		);
1208 1208
 
1209 1209
 		// Add Payment Key to email access url, if it exists.
1210
-		if ( ! empty( $_GET['payment_key'] ) ) {
1210
+		if ( ! empty($_GET['payment_key'])) {
1211 1211
 			$access_url = add_query_arg(
1212 1212
 				array(
1213
-					'payment_key' => give_clean( $_GET['payment_key'] ),
1213
+					'payment_key' => give_clean($_GET['payment_key']),
1214 1214
 				),
1215 1215
 				$access_url
1216 1216
 			);
1217 1217
 		}
1218 1218
 
1219
-		if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1219
+		if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1220 1220
 			$email_access_link = sprintf(
1221 1221
 				'<a href="%1$s" target="_blank">%2$s</a>',
1222
-				esc_url( $access_url ),
1223
-				__( 'View your donation history &raquo;', 'give' )
1222
+				esc_url($access_url),
1223
+				__('View your donation history &raquo;', 'give')
1224 1224
 			);
1225 1225
 
1226 1226
 		} else {
1227 1227
 
1228 1228
 			$email_access_link = sprintf(
1229 1229
 				'%1$s: %2$s',
1230
-				__( 'View your donation history', 'give' ),
1231
-				esc_url( $access_url )
1230
+				__('View your donation history', 'give'),
1231
+				esc_url($access_url)
1232 1232
 			);
1233 1233
 		}
1234 1234
 	}
@@ -1260,23 +1260,23 @@  discard block
 block discarded – undo
1260 1260
  *
1261 1261
  * @return array
1262 1262
  */
1263
-function __give_20_bc_str_type_email_tag_param( $tag_args ) {
1264
-	if ( ! is_array( $tag_args ) ) {
1265
-		switch ( true ) {
1266
-			case ( 'give_payment' === get_post_type( $tag_args ) ):
1267
-				$tag_args = array( 'payment_id' => $tag_args );
1263
+function __give_20_bc_str_type_email_tag_param($tag_args) {
1264
+	if ( ! is_array($tag_args)) {
1265
+		switch (true) {
1266
+			case ('give_payment' === get_post_type($tag_args)):
1267
+				$tag_args = array('payment_id' => $tag_args);
1268 1268
 				break;
1269 1269
 
1270
-			case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ):
1271
-				$tag_args = array( 'user_id' => $tag_args );
1270
+			case ( ! is_wp_error(get_user_by('id', $tag_args))):
1271
+				$tag_args = array('user_id' => $tag_args);
1272 1272
 				break;
1273 1273
 
1274
-			case ( Give()->donors->get_by( 'id', $tag_args ) ):
1275
-				$tag_args = array( 'donor_id' => $tag_args );
1274
+			case (Give()->donors->get_by('id', $tag_args)):
1275
+				$tag_args = array('donor_id' => $tag_args);
1276 1276
 				break;
1277 1277
 
1278
-			case ( Give()->donors->get_by( 'user_id', $tag_args ) ):
1279
-				$tag_args = array( 'user_id' => $tag_args );
1278
+			case (Give()->donors->get_by('user_id', $tag_args)):
1279
+				$tag_args = array('user_id' => $tag_args);
1280 1280
 				break;
1281 1281
 		}
1282 1282
 	}
@@ -1294,39 +1294,39 @@  discard block
 block discarded – undo
1294 1294
  *
1295 1295
  * @return array
1296 1296
  */
1297
-function give_email_tag_reset_password_link( $tag_args, $payment_id ) {
1297
+function give_email_tag_reset_password_link($tag_args, $payment_id) {
1298 1298
 
1299 1299
 	$reset_password_url = '';
1300 1300
 
1301
-	switch ( true ) {
1302
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1303
-			$payment    = new Give_Payment( $tag_args['payment_id'] );
1301
+	switch (true) {
1302
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1303
+			$payment    = new Give_Payment($tag_args['payment_id']);
1304 1304
 			$payment_id = $payment->number;
1305 1305
 			break;
1306 1306
 
1307
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
1308
-			$reset_password_url = give_get_reset_password_url( $tag_args['user_id'] );
1307
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
1308
+			$reset_password_url = give_get_reset_password_url($tag_args['user_id']);
1309 1309
 			break;
1310 1310
 
1311
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
1311
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
1312 1312
 			/* @var Give_Donor $donor */
1313
-			$donor = new Give_Donor( $tag_args['user_id'], true );
1314
-			$reset_password_url = give_get_reset_password_url( $donor->user_id );
1313
+			$donor = new Give_Donor($tag_args['user_id'], true);
1314
+			$reset_password_url = give_get_reset_password_url($donor->user_id);
1315 1315
 			break;
1316 1316
 	}
1317 1317
 
1318
-	if( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1318
+	if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1319 1319
 		// Generate link, if Email content type is html.
1320 1320
 		$reset_password_link = sprintf(
1321 1321
 			'<a href="%1$s" target="_blank">%2$s</a>',
1322
-			esc_url( $reset_password_url ),
1323
-			__( 'Reset your password &raquo;', 'give' )
1322
+			esc_url($reset_password_url),
1323
+			__('Reset your password &raquo;', 'give')
1324 1324
 		);
1325
-	} else{
1325
+	} else {
1326 1326
 		$reset_password_link = sprintf(
1327 1327
 			'%1$s: %2$s',
1328
-			__( 'Reset your password', 'give' ),
1329
-			esc_url( $reset_password_url )
1328
+			__('Reset your password', 'give'),
1329
+			esc_url($reset_password_url)
1330 1330
 		);
1331 1331
 	}
1332 1332
 
@@ -1355,21 +1355,21 @@  discard block
 block discarded – undo
1355 1355
  *
1356 1356
  * @return mixed|string
1357 1357
  */
1358
-function give_get_reset_password_url( $user_id ) {
1358
+function give_get_reset_password_url($user_id) {
1359 1359
 	$reset_password_url = '';
1360 1360
 
1361 1361
 	// Proceed further only, if user_id exists.
1362
-	if ( $user_id ) {
1362
+	if ($user_id) {
1363 1363
 
1364 1364
 		// Get User Object Details.
1365
-		$user = get_user_by( 'ID', $user_id );
1365
+		$user = get_user_by('ID', $user_id);
1366 1366
 
1367 1367
 		// Prepare Reset Password URL.
1368
-		$reset_password_url = esc_url( add_query_arg( array(
1368
+		$reset_password_url = esc_url(add_query_arg(array(
1369 1369
 			'action' => 'rp',
1370
-			'key' => get_password_reset_key( $user ),
1370
+			'key' => get_password_reset_key($user),
1371 1371
 			'login' => $user->user_login,
1372
-		), wp_login_url() ) );
1372
+		), wp_login_url()));
1373 1373
 	}
1374 1374
 
1375 1375
 	return $reset_password_url;
@@ -1388,91 +1388,91 @@  discard block
 block discarded – undo
1388 1388
  *
1389 1389
  * @return mixed
1390 1390
  */
1391
-function __give_render_metadata_email_tag( $content, $tag_args ) {
1392
-	preg_match_all( "/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches );
1391
+function __give_render_metadata_email_tag($content, $tag_args) {
1392
+	preg_match_all("/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches);
1393 1393
 
1394
-	if ( ! empty( $matches[0] ) ) {
1394
+	if ( ! empty($matches[0])) {
1395 1395
 		$search = $replace = array();
1396
-		foreach ( $matches[0] as $index => $meta_tag ) {
1397
-			if ( in_array( $meta_tag, $search ) ) {
1396
+		foreach ($matches[0] as $index => $meta_tag) {
1397
+			if (in_array($meta_tag, $search)) {
1398 1398
 				continue;
1399 1399
 			}
1400 1400
 
1401 1401
 			$search[] = $meta_tag;
1402 1402
 
1403
-			$meta_tag     = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag );
1404
-			$meta_tag_arr = array_map( 'trim', explode( ' ', $meta_tag, 2 ) );
1405
-			$meta_tag     = current( $meta_tag_arr );
1403
+			$meta_tag     = str_replace(array('{', 'meta_', '}'), '', $meta_tag);
1404
+			$meta_tag_arr = array_map('trim', explode(' ', $meta_tag, 2));
1405
+			$meta_tag     = current($meta_tag_arr);
1406 1406
 
1407
-			$meta_tag  = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag );
1408
-			$type      = current( explode( '_', $meta_tag, 2 ) );
1409
-			$meta_name = preg_replace( "/^{$type}_/", '', $meta_tag );
1407
+			$meta_tag  = str_replace(array('{', 'meta_', '}'), '', $meta_tag);
1408
+			$type      = current(explode('_', $meta_tag, 2));
1409
+			$meta_name = preg_replace("/^{$type}_/", '', $meta_tag);
1410 1410
 
1411
-			switch ( $type ) {
1411
+			switch ($type) {
1412 1412
 				case 'donation':
1413 1413
 
1414 1414
 					//Bailout.
1415
-					if ( ! isset( $tag_args['payment_id'] ) ) {
1415
+					if ( ! isset($tag_args['payment_id'])) {
1416 1416
 						$replace[] = '';
1417 1417
 						continue;
1418 1418
 					}
1419 1419
 
1420
-					$meta_data = give_get_meta( absint( $tag_args['payment_id'] ), $meta_name, true, '' );
1420
+					$meta_data = give_get_meta(absint($tag_args['payment_id']), $meta_name, true, '');
1421 1421
 
1422
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1422
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1423 1423
 						$replace[] = $meta_data;
1424
-					} elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) {
1425
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1424
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1425
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1426 1426
 					}
1427 1427
 
1428 1428
 					break;
1429 1429
 
1430 1430
 				case 'form':
1431
-					$form_id = isset( $tag_args['form_id'] ) ? absint( $tag_args['form_id'] ) : 0;
1431
+					$form_id = isset($tag_args['form_id']) ? absint($tag_args['form_id']) : 0;
1432 1432
 
1433 1433
 					// Bailout.
1434
-					if ( ! $form_id && isset( $tag_args['payment_id'] ) ) {
1435
-						$form_id = give_get_payment_form_id( $tag_args['payment_id'] );
1434
+					if ( ! $form_id && isset($tag_args['payment_id'])) {
1435
+						$form_id = give_get_payment_form_id($tag_args['payment_id']);
1436 1436
 					}
1437 1437
 
1438
-					$meta_data = give_get_meta( $form_id, $meta_name, true, '' );
1439
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1438
+					$meta_data = give_get_meta($form_id, $meta_name, true, '');
1439
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1440 1440
 						$replace[] = $meta_data;
1441
-					} elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) {
1442
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1441
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1442
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1443 1443
 					}
1444 1444
 					break;
1445 1445
 
1446 1446
 				case 'donor':
1447
-					$donor_id = isset( $tag_args['donor_id'] ) ? absint( $tag_args['donor_id'] ) : 0;
1447
+					$donor_id = isset($tag_args['donor_id']) ? absint($tag_args['donor_id']) : 0;
1448 1448
 
1449 1449
 					// Bailout.
1450
-					if ( ! $donor_id ) {
1451
-						if ( isset( $tag_args['payment_id'] ) ) {
1452
-							$donor_id = give_get_payment_donor_id( $tag_args['payment_id'] );
1453
-						} elseif ( isset( $tag_args['user_id'] ) ) {
1454
-							$donor    = new Give_Donor( $tag_args['user_id'], true );
1450
+					if ( ! $donor_id) {
1451
+						if (isset($tag_args['payment_id'])) {
1452
+							$donor_id = give_get_payment_donor_id($tag_args['payment_id']);
1453
+						} elseif (isset($tag_args['user_id'])) {
1454
+							$donor    = new Give_Donor($tag_args['user_id'], true);
1455 1455
 							$donor_id = $donor->ID;
1456 1456
 						}
1457 1457
 					}
1458 1458
 
1459
-					$donor     = new Give_Donor( $donor_id );
1460
-					$meta_data = $donor->get_meta( $meta_name );
1461
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1459
+					$donor     = new Give_Donor($donor_id);
1460
+					$meta_data = $donor->get_meta($meta_name);
1461
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1462 1462
 						$replace[] = $meta_data;
1463
-					} elseif ( in_array( $meta_tag_arr[1], array_keys(  $meta_data ) ) ) {
1464
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1463
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1464
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1465 1465
 					}
1466 1466
 
1467 1467
 					break;
1468 1468
 
1469 1469
 				default:
1470
-					$replace[] = end( $search );
1470
+					$replace[] = end($search);
1471 1471
 			}
1472 1472
 		}
1473 1473
 
1474
-		if ( ! empty( $search ) && ! empty( $replace ) ) {
1475
-			$content = str_replace( $search, $replace, $content );
1474
+		if ( ! empty($search) && ! empty($replace)) {
1475
+			$content = str_replace($search, $replace, $content);
1476 1476
 		}
1477 1477
 	}
1478 1478
 
@@ -1480,4 +1480,4 @@  discard block
 block discarded – undo
1480 1480
 	return $content;
1481 1481
 }
1482 1482
 
1483
-add_filter( 'give_email_template_tags', '__give_render_metadata_email_tag', 10, 2 );
1483
+add_filter('give_email_template_tags', '__give_render_metadata_email_tag', 10, 2);
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +71 added lines, -71 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
 
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
30
-	$payment = new Give_Payment( $payment_id );
29
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
30
+	$payment = new Give_Payment($payment_id);
31 31
 
32 32
 	/**
33 33
 	 * Fire the action
34 34
 	 */
35
-	do_action( 'give_donation-receipt_email_notification', $payment_id );
35
+	do_action('give_donation-receipt_email_notification', $payment_id);
36 36
 
37 37
 	// If admin notifications are on, send the admin notice.
38
-	if ( $admin_notice && give_is_setting_enabled( Give_Email_Notification::get_instance('new-donation' )->get_notification_status() ) ) {
38
+	if ($admin_notice && give_is_setting_enabled(Give_Email_Notification::get_instance('new-donation')->get_notification_status())) {
39 39
 		/**
40 40
 		 * Fires in the donation email receipt.
41 41
 		 *
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		 * @param int   $payment_id   Payment id.
47 47
 		 * @param mixed $payment_data Payment meta data.
48 48
 		 */
49
-		do_action( 'give_new-donation_email_notification', $payment_id, $payment->payment_meta );
49
+		do_action('give_new-donation_email_notification', $payment_id, $payment->payment_meta);
50 50
 	}
51 51
 }
52 52
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return void
61 61
  */
62
-function give_admin_email_notice( $payment_id ) {
62
+function give_admin_email_notice($payment_id) {
63 63
 	/**
64 64
 	 * Fires in the donation email receipt.
65 65
 	 *
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 	 * @param int   $payment_id   Payment id.
71 71
 	 * @param mixed $payment_data Payment meta data.
72 72
 	 */
73
-	do_action( 'give_new-donation_email_notification', $payment_id );
73
+	do_action('give_new-donation_email_notification', $payment_id);
74 74
 }
75 75
 
76
-add_action( 'give_admin_donation_email', 'give_admin_email_notice' );
76
+add_action('give_admin_donation_email', 'give_admin_email_notice');
77 77
 
78 78
 
79 79
 /**
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function give_get_default_donation_notification_email() {
88 88
 
89
-	$default_email_body = __( 'Hi there,', 'give' ) . "\n\n";
90
-	$default_email_body .= __( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n";
91
-	$default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {name}' . "\n";
92
-	$default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
93
-	$default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
94
-	$default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n";
95
-	$default_email_body .= __( 'Thank you,', 'give' ) . "\n\n";
96
-	$default_email_body .= '{sitename}' . "\n";
89
+	$default_email_body = __('Hi there,', 'give')."\n\n";
90
+	$default_email_body .= __('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n";
91
+	$default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {name}'."\n";
92
+	$default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n";
93
+	$default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n";
94
+	$default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n";
95
+	$default_email_body .= __('Thank you,', 'give')."\n\n";
96
+	$default_email_body .= '{sitename}'."\n";
97 97
 
98
-	return apply_filters( 'give_default_donation_notification_email', $default_email_body );
98
+	return apply_filters('give_default_donation_notification_email', $default_email_body);
99 99
 }
100 100
 
101 101
 
@@ -109,21 +109,21 @@  discard block
 block discarded – undo
109 109
  */
110 110
 function give_get_default_donation_receipt_email() {
111 111
 
112
-	$default_email_body = __( 'Dear', 'give' ) . " {name},\n\n";
113
-	$default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
114
-	$default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
115
-	$default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
116
-	$default_email_body .= '<strong>' . __( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n";
117
-	$default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
118
-	$default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n";
119
-	$default_email_body .= '<strong>' . __( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n";
120
-	$default_email_body .= '<strong>' . __( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n";
121
-	$default_email_body .= '{receipt_link}' . "\n\n";
112
+	$default_email_body = __('Dear', 'give')." {name},\n\n";
113
+	$default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
114
+	$default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
115
+	$default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n";
116
+	$default_email_body .= '<strong>'.__('Donation Date:', 'give').'</strong> {date}'."\n";
117
+	$default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n";
118
+	$default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n";
119
+	$default_email_body .= '<strong>'.__('Payment ID:', 'give').'</strong> {payment_id}'."\n";
120
+	$default_email_body .= '<strong>'.__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n";
121
+	$default_email_body .= '{receipt_link}'."\n\n";
122 122
 	$default_email_body .= "\n\n";
123
-	$default_email_body .= __( 'Sincerely,', 'give' ) . "\n";
124
-	$default_email_body .= '{sitename}' . "\n";
123
+	$default_email_body .= __('Sincerely,', 'give')."\n";
124
+	$default_email_body .= '{sitename}'."\n";
125 125
 
126
-	return apply_filters( 'give_default_donation_receipt_email', $default_email_body );
126
+	return apply_filters('give_default_donation_receipt_email', $default_email_body);
127 127
 }
128 128
 
129 129
 /**
@@ -136,22 +136,22 @@  discard block
 block discarded – undo
136 136
  *
137 137
  * @return array $email_names
138 138
  */
139
-function give_get_email_names( $user_info, $payment = false ) {
139
+function give_get_email_names($user_info, $payment = false) {
140 140
 	$email_names = array();
141 141
 
142
-	if ( is_a( $payment, 'Give_Payment' ) ) {
142
+	if (is_a($payment, 'Give_Payment')) {
143 143
 
144
-		if ( $payment->user_id > 0 ) {
144
+		if ($payment->user_id > 0) {
145 145
 
146
-			$user_data               = get_userdata( $payment->user_id );
146
+			$user_data               = get_userdata($payment->user_id);
147 147
 			$email_names['name']     = $payment->first_name;
148
-			$email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name );
148
+			$email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name);
149 149
 			$email_names['username'] = $user_data->user_login;
150 150
 
151
-		} elseif ( ! empty( $payment->first_name ) ) {
151
+		} elseif ( ! empty($payment->first_name)) {
152 152
 
153 153
 			$email_names['name']     = $payment->first_name;
154
-			$email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name );
154
+			$email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name);
155 155
 			$email_names['username'] = $payment->first_name;
156 156
 
157 157
 		} else {
@@ -164,30 +164,30 @@  discard block
 block discarded – undo
164 164
 	} else {
165 165
 
166 166
 		// Support for old serialized data.
167
-		if ( is_serialized( $user_info ) ) {
167
+		if (is_serialized($user_info)) {
168 168
 
169 169
 			// Security check.
170
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
171
-			if ( ! empty( $matches ) ) {
170
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
171
+			if ( ! empty($matches)) {
172 172
 				return array(
173 173
 					'name'     => '',
174 174
 					'fullname' => '',
175 175
 					'username' => '',
176 176
 				);
177 177
 			} else {
178
-				$user_info = maybe_unserialize( $user_info );
178
+				$user_info = maybe_unserialize($user_info);
179 179
 			}
180 180
 
181 181
 		}
182 182
 
183
-		if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
184
-			$user_data               = get_userdata( $user_info['id'] );
183
+		if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
184
+			$user_data               = get_userdata($user_info['id']);
185 185
 			$email_names['name']     = $user_info['first_name'];
186
-			$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
186
+			$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
187 187
 			$email_names['username'] = $user_data->user_login;
188
-		} elseif ( isset( $user_info['first_name'] ) ) {
188
+		} elseif (isset($user_info['first_name'])) {
189 189
 			$email_names['name']     = $user_info['first_name'];
190
-			$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
190
+			$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
191 191
 			$email_names['username'] = $user_info['first_name'];
192 192
 		} else {
193 193
 			$email_names['name']     = $user_info['email'];
@@ -207,37 +207,37 @@  discard block
 block discarded – undo
207 207
  *
208 208
  * @since 1.8.14
209 209
  */
210
-function give_admin_email_user_donor_disconnection( $user_id, $donor_id ) {
210
+function give_admin_email_user_donor_disconnection($user_id, $donor_id) {
211 211
 
212
-	$user_id  = absint( $user_id );
213
-	$donor_id = absint( $donor_id );
212
+	$user_id  = absint($user_id);
213
+	$donor_id = absint($donor_id);
214 214
 
215 215
 	// Bail Out, if user id doesn't exists.
216
-	if ( empty( $user_id ) ) {
216
+	if (empty($user_id)) {
217 217
 		return;
218 218
 	}
219 219
 
220 220
 	// Bail Out, if donor id doesn't exists.
221
-	if ( empty( $donor_id ) ) {
221
+	if (empty($donor_id)) {
222 222
 		return;
223 223
 	}
224 224
 
225
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
225
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
226 226
 
227
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
227
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
228 228
 
229 229
 	/* translators: %s: payment id */
230
-	$subject = __( 'Attention: User tries to login whose Donor profile is disconnected!', 'give' );
230
+	$subject = __('Attention: User tries to login whose Donor profile is disconnected!', 'give');
231 231
 
232 232
 	/**
233 233
 	 * Filters the Donor-User Disconnection notification subject.
234 234
 	 *
235 235
 	 * @since 1.8.14
236 236
 	 */
237
-	$subject = apply_filters( 'give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags( $subject ) );
237
+	$subject = apply_filters('give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags($subject));
238 238
 
239
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
240
-	$headers .= "Reply-To: " . $from_email . "\r\n";
239
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
240
+	$headers .= "Reply-To: ".$from_email."\r\n";
241 241
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
242 242
 
243 243
 	/**
@@ -245,25 +245,25 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @since 1.8.14
247 247
 	 */
248
-	$headers = apply_filters( 'give_admin_donor_user_disconnection_notification_headers', $headers );
248
+	$headers = apply_filters('give_admin_donor_user_disconnection_notification_headers', $headers);
249 249
 
250
-	$message = __( 'Hi Admin,', 'give' ) . "\n\n";
251
-	$message .= __( 'This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give' ) . "\n\n";
252
-	$message .= __( 'Do you want to reconnect User and Donor profile again?', 'give' ) . "\n\n";
250
+	$message = __('Hi Admin,', 'give')."\n\n";
251
+	$message .= __('This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give')."\n\n";
252
+	$message .= __('Do you want to reconnect User and Donor profile again?', 'give')."\n\n";
253 253
 	$message .= sprintf(
254 254
 		'<a href="%1$s">%2$s</a>',
255
-		esc_url( admin_url() . 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&user_id=' . $user_id . '&give-message=reconnect-user' ),
256
-		__( 'Reconnect User', 'give' ) . "\n\n"
255
+		esc_url(admin_url().'edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&user_id='.$user_id.'&give-message=reconnect-user'),
256
+		__('Reconnect User', 'give')."\n\n"
257 257
 	);
258
-	$message .= __( 'Thank you,', 'give' ) . "\n\n";
259
-	$message .= '{sitename}' . "\n";
258
+	$message .= __('Thank you,', 'give')."\n\n";
259
+	$message .= '{sitename}'."\n";
260 260
 
261 261
 	$emails = Give()->emails;
262
-	$emails->__set( 'from_name', $from_name );
263
-	$emails->__set( 'from_email', $from_email );
264
-	$emails->__set( 'headers', $headers );
265
-	$emails->__set( 'heading', __( 'User - Donor Profile Disconnection', 'give' ) );
262
+	$emails->__set('from_name', $from_name);
263
+	$emails->__set('from_email', $from_email);
264
+	$emails->__set('headers', $headers);
265
+	$emails->__set('heading', __('User - Donor Profile Disconnection', 'give'));
266 266
 
267
-	$emails->send( give_get_admin_notice_emails(), $subject, give_do_email_tags( $message ) );
267
+	$emails->send(give_get_admin_notice_emails(), $subject, give_do_email_tags($message));
268 268
 
269 269
 }
Please login to merge, or discard this patch.
includes/admin/class-admin-settings.php 1 patch
Spacing   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Admin_Settings' ) ) :
16
+if ( ! class_exists('Give_Admin_Settings')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Admin_Settings Class.
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			 *
73 73
 			 * @param array $settings Array of settings class object.
74 74
 			 */
75
-			self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() );
75
+			self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array());
76 76
 
77 77
 			return self::$settings;
78 78
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		 * @return bool
87 87
 		 */
88 88
 		public static function verify_nonce() {
89
-			if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) {
89
+			if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) {
90 90
 				return false;
91 91
 			}
92 92
 
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
 		public static function save() {
103 103
 			$current_tab = give_get_current_setting_tab();
104 104
 
105
-			if ( ! self::verify_nonce() ) {
106
-				echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>';
105
+			if ( ! self::verify_nonce()) {
106
+				echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>';
107 107
 				die();
108 108
 			}
109 109
 
110 110
 			// Show error message if Akismet not configured and Admin try to save 'enabled' option.
111
-			if ( isset( $_POST['akismet_spam_protection'] )
112
-			     && give_is_setting_enabled( $_POST['akismet_spam_protection'] )
111
+			if (isset($_POST['akismet_spam_protection'])
112
+			     && give_is_setting_enabled($_POST['akismet_spam_protection'])
113 113
 			     && ! give_check_akismet_key()
114 114
 			) {
115
-				self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) );
115
+				self::add_error('give-akismet-protection', __('Please properly configure Akismet to enable SPAM protection.', 'give'));
116 116
 
117 117
 				return;
118 118
 			}
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 			 *
127 127
 			 * @since 1.8
128 128
 			 */
129
-			do_action( self::$setting_filter_prefix . '_save_' . $current_tab );
129
+			do_action(self::$setting_filter_prefix.'_save_'.$current_tab);
130 130
 
131
-			self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) );
131
+			self::add_message('give-setting-updated', __('Your settings have been saved.', 'give'));
132 132
 
133 133
 			/**
134 134
 			 * Trigger Action.
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 			 *
140 140
 			 * @since 1.8
141 141
 			 */
142
-			do_action( self::$setting_filter_prefix . '_saved' );
142
+			do_action(self::$setting_filter_prefix.'_saved');
143 143
 		}
144 144
 
145 145
 		/**
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 		 *
153 153
 		 * @return void
154 154
 		 */
155
-		public static function add_message( $code, $message ) {
156
-			self::$messages[ $code ] = $message;
155
+		public static function add_message($code, $message) {
156
+			self::$messages[$code] = $message;
157 157
 		}
158 158
 
159 159
 		/**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 		 *
167 167
 		 * @return void
168 168
 		 */
169
-		public static function add_error( $code, $message ) {
170
-			self::$errors[ $code ] = $message;
169
+		public static function add_error($code, $message) {
170
+			self::$errors[$code] = $message;
171 171
 		}
172 172
 
173 173
 		/**
@@ -180,18 +180,18 @@  discard block
 block discarded – undo
180 180
 			$notice_html = '';
181 181
 			$classes     = 'give-notice settings-error notice is-dismissible';
182 182
 
183
-			self::$errors   = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors );
184
-			self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages );
183
+			self::$errors   = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors);
184
+			self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages);
185 185
 
186
-			if ( 0 < count( self::$errors ) ) {
187
-				foreach ( self::$errors as $code => $message ) {
188
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>';
186
+			if (0 < count(self::$errors)) {
187
+				foreach (self::$errors as $code => $message) {
188
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>';
189 189
 				}
190 190
 			}
191 191
 
192
-			if ( 0 < count( self::$messages ) ) {
193
-				foreach ( self::$messages as $code => $message ) {
194
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>';
192
+			if (0 < count(self::$messages)) {
193
+				foreach (self::$messages as $code => $message) {
194
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>';
195 195
 				}
196 196
 			}
197 197
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			self::$setting_filter_prefix = give_get_current_setting_page();
212 212
 
213 213
 			// Bailout: Exit if setting page is not defined.
214
-			if ( empty( self::$setting_filter_prefix ) ) {
214
+			if (empty(self::$setting_filter_prefix)) {
215 215
 				return false;
216 216
 			}
217 217
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			 *
225 225
 			 * @since 1.8
226 226
 			 */
227
-			do_action( self::$setting_filter_prefix . '_start' );
227
+			do_action(self::$setting_filter_prefix.'_start');
228 228
 
229 229
 			$current_tab = give_get_current_setting_tab();
230 230
 
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 			/* @var object $current_setting_obj */
235 235
 			$current_setting_obj = new StdClass;
236 236
 
237
-			foreach ( $all_setting as $setting ) {
237
+			foreach ($all_setting as $setting) {
238 238
 				if (
239
-					method_exists( $setting, 'get_id' ) &&
239
+					method_exists($setting, 'get_id') &&
240 240
 					$current_tab === $setting->get_id()
241 241
 				) {
242 242
 					$current_setting_obj = $setting;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 			}
246 246
 
247 247
 			// Save settings if data has been posted.
248
-			if ( ! empty( $_POST ) ) {
248
+			if ( ! empty($_POST)) {
249 249
 				self::save();
250 250
 			}
251 251
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			 *
259 259
 			 * @since 1.8
260 260
 			 */
261
-			$tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() );
261
+			$tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array());
262 262
 
263 263
 			include 'views/html-admin-settings.php';
264 264
 
@@ -276,25 +276,25 @@  discard block
 block discarded – undo
276 276
 		 *
277 277
 		 * @return string|bool
278 278
 		 */
279
-		public static function get_option( $option_name = '', $field_id = '', $default = false ) {
279
+		public static function get_option($option_name = '', $field_id = '', $default = false) {
280 280
 			// Bailout.
281
-			if ( empty( $option_name ) && empty( $field_id ) ) {
281
+			if (empty($option_name) && empty($field_id)) {
282 282
 				return false;
283 283
 			}
284 284
 
285
-			if ( ! empty( $field_id ) && ! empty( $option_name ) ) {
285
+			if ( ! empty($field_id) && ! empty($option_name)) {
286 286
 				// Get field value if any.
287
-				$option_value = get_option( $option_name );
287
+				$option_value = get_option($option_name);
288 288
 
289
-				$option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) )
290
-					? $option_value[ $field_id ]
289
+				$option_value = (is_array($option_value) && array_key_exists($field_id, $option_value))
290
+					? $option_value[$field_id]
291 291
 					: $default;
292 292
 			} else {
293 293
 				// If option name is empty but not field name then this means, setting is direct store to option table under there field name.
294 294
 				$option_name = ! $option_name ? $field_id : $option_name;
295 295
 
296 296
 				// Get option value if any.
297
-				$option_value = get_option( $option_name, $default );
297
+				$option_value = get_option($option_name, $default);
298 298
 			}
299 299
 
300 300
 			return $option_value;
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		 *
314 314
 		 * @return void
315 315
 		 */
316
-		public static function output_fields( $options, $option_name = '' ) {
316
+		public static function output_fields($options, $option_name = '') {
317 317
 			$current_tab = give_get_current_setting_tab();
318 318
 
319 319
 			// Field Default values.
@@ -325,61 +325,61 @@  discard block
 block discarded – undo
325 325
 				'desc'             => '',
326 326
 				'table_html'       => true,
327 327
 				'repeat'           => false,
328
-				'repeat_btn_title' => __( 'Add Field', 'give' ),
328
+				'repeat_btn_title' => __('Add Field', 'give'),
329 329
 			);
330 330
 
331
-			foreach ( $options as $value ) {
332
-				if ( ! isset( $value['type'] ) ) {
331
+			foreach ($options as $value) {
332
+				if ( ! isset($value['type'])) {
333 333
 					continue;
334 334
 				}
335 335
 
336 336
 				// Set title.
337
-				$defaults['title'] = isset( $value['name'] ) ? $value['name'] : '';
337
+				$defaults['title'] = isset($value['name']) ? $value['name'] : '';
338 338
 
339 339
 				// Set default setting.
340
-				$value = wp_parse_args( $value, $defaults );
340
+				$value = wp_parse_args($value, $defaults);
341 341
 
342 342
 				// Colorpicker field.
343
-				$value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] );
344
-				$value['type']  = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] );
343
+				$value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']);
344
+				$value['type']  = ('colorpicker' === $value['type'] ? 'text' : $value['type']);
345 345
 
346 346
 
347 347
 				// Custom attribute handling.
348 348
 				$custom_attributes = array();
349 349
 
350
-				if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) {
351
-					foreach ( $value['attributes'] as $attribute => $attribute_value ) {
352
-						$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
350
+				if ( ! empty($value['attributes']) && is_array($value['attributes'])) {
351
+					foreach ($value['attributes'] as $attribute => $attribute_value) {
352
+						$custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"';
353 353
 					}
354 354
 				}
355 355
 
356 356
 				// Description handling.
357
-				$description          = self::get_field_description( $value );
357
+				$description = self::get_field_description($value);
358 358
 
359 359
 				// Switch based on type.
360
-				switch ( $value['type'] ) {
360
+				switch ($value['type']) {
361 361
 
362 362
 					// Section Titles
363 363
 					case 'title':
364
-						if ( ! empty( $value['title'] ) || ! empty( $value['desc'] ) ) {
364
+						if ( ! empty($value['title']) || ! empty($value['desc'])) {
365 365
 							?>
366 366
 							<div class="give-setting-tab-header give-setting-tab-header-<?php echo $current_tab; ?>">
367
-								<?php if ( ! empty( $value['title'] ) ) : ?>
368
-									<h2><?php echo self::get_field_title( $value ); ?></h2><hr>
367
+								<?php if ( ! empty($value['title'])) : ?>
368
+									<h2><?php echo self::get_field_title($value); ?></h2><hr>
369 369
 								<?php endif; ?>
370 370
 
371
-								<?php if ( ! empty( $value['desc'] ) ) : ?>
372
-									<?php echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); ?>
371
+								<?php if ( ! empty($value['desc'])) : ?>
372
+									<?php echo wpautop(wptexturize(wp_kses_post($value['desc']))); ?>
373 373
 								<?php endif; ?>
374 374
 							</div>
375 375
 							<?php
376 376
 						}
377 377
 
378
-						if ( $value['table_html'] ) {
379
-							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n";
378
+						if ($value['table_html']) {
379
+							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n";
380 380
 						}
381 381
 
382
-						if ( ! empty( $value['id'] ) ) {
382
+						if ( ! empty($value['id'])) {
383 383
 
384 384
 							/**
385 385
 							 * Trigger Action.
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
 							 *
389 389
 							 * @since 1.8
390 390
 							 */
391
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) );
391
+							do_action('give_settings_'.sanitize_title($value['id']));
392 392
 						}
393 393
 
394 394
 						break;
395 395
 
396 396
 					// Section Ends.
397 397
 					case 'sectionend':
398
-						if ( ! empty( $value['id'] ) ) {
398
+						if ( ! empty($value['id'])) {
399 399
 
400 400
 							/**
401 401
 							 * Trigger Action.
@@ -404,14 +404,14 @@  discard block
 block discarded – undo
404 404
 							 *
405 405
 							 * @since 1.8
406 406
 							 */
407
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' );
407
+							do_action('give_settings_'.sanitize_title($value['id']).'_end');
408 408
 						}
409 409
 
410
-						if ( $value['table_html'] ) {
410
+						if ($value['table_html']) {
411 411
 							echo '</table>';
412 412
 						}
413 413
 
414
-						if ( ! empty( $value['id'] ) ) {
414
+						if ( ! empty($value['id'])) {
415 415
 
416 416
 							/**
417 417
 							 * Trigger Action.
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 							 *
421 421
 							 * @since 1.8
422 422
 							 */
423
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' );
423
+							do_action('give_settings_'.sanitize_title($value['id']).'_after');
424 424
 						}
425 425
 
426 426
 						break;
@@ -428,48 +428,48 @@  discard block
 block discarded – undo
428 428
 					// Standard text inputs and subtypes like 'number'.
429 429
 					case 'colorpicker':
430 430
 					case 'hidden' :
431
-						$value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden';
431
+						$value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden';
432 432
 					case 'text':
433 433
 					case 'email':
434 434
 					case 'number':
435 435
 					case 'password' :
436 436
 						$type = $value['type'];
437
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
437
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
438 438
 
439 439
 						// Set default value for repeater field if not any value set yet.
440
-						if( $value['repeat'] && is_string( $option_value ) ) {
441
-							$option_value = array( $value['default'] );
440
+						if ($value['repeat'] && is_string($option_value)) {
441
+							$option_value = array($value['default']);
442 442
 						}
443 443
 						?>
444
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
444
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
445 445
 							<th scope="row" class="titledesc">
446
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
446
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
447 447
 							</th>
448
-							<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
449
-								<?php if ( $value['repeat'] ) : ?>
450
-									<?php foreach ( $option_value as $index => $field_value ) : ?>
448
+							<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
449
+								<?php if ($value['repeat']) : ?>
450
+									<?php foreach ($option_value as $index => $field_value) : ?>
451 451
 										<p>
452 452
 											<input
453
-													name="<?php echo esc_attr( $value['id'] ); ?>[]"
454
-													type="<?php echo esc_attr( $type ); ?>"
455
-													style="<?php echo esc_attr( $value['css'] ); ?>"
456
-													value="<?php echo esc_attr( $field_value ); ?>"
457
-													class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?> <?php echo esc_attr( $value['id'] ); ?>"
458
-												<?php echo implode( ' ', $custom_attributes ); ?>
453
+													name="<?php echo esc_attr($value['id']); ?>[]"
454
+													type="<?php echo esc_attr($type); ?>"
455
+													style="<?php echo esc_attr($value['css']); ?>"
456
+													value="<?php echo esc_attr($field_value); ?>"
457
+													class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?> <?php echo esc_attr($value['id']); ?>"
458
+												<?php echo implode(' ', $custom_attributes); ?>
459 459
 											/>
460
-											<span class="give-remove-setting-field" title="<?php esc_html_e( 'Remove setting field', 'give' ); ?>">-</span>
460
+											<span class="give-remove-setting-field" title="<?php esc_html_e('Remove setting field', 'give'); ?>">-</span>
461 461
 										</p>
462 462
 									<?php endforeach; ?>
463 463
 									<a href="#" data-id="<?php echo $value['id']; ?>" class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a>
464 464
 								<?php else : ?>
465 465
 									<input
466
-											name="<?php echo esc_attr( $value['id'] ); ?>"
467
-											id="<?php echo esc_attr( $value['id'] ); ?>"
468
-											type="<?php echo esc_attr( $type ); ?>"
469
-											style="<?php echo esc_attr( $value['css'] ); ?>"
470
-											value="<?php echo esc_attr( $option_value ); ?>"
471
-											class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
472
-										<?php echo implode( ' ', $custom_attributes ); ?>
466
+											name="<?php echo esc_attr($value['id']); ?>"
467
+											id="<?php echo esc_attr($value['id']); ?>"
468
+											type="<?php echo esc_attr($type); ?>"
469
+											style="<?php echo esc_attr($value['css']); ?>"
470
+											value="<?php echo esc_attr($option_value); ?>"
471
+											class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
472
+										<?php echo implode(' ', $custom_attributes); ?>
473 473
 									/>
474 474
 								<?php endif; ?>
475 475
 								<?php echo $description; ?>
@@ -480,23 +480,23 @@  discard block
 block discarded – undo
480 480
 					// Textarea.
481 481
 					case 'textarea':
482 482
 
483
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
483
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
484 484
 
485 485
 						?>
486
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
486
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
487 487
 						<th scope="row" class="titledesc">
488
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
488
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
489 489
 						</th>
490
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
490
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
491 491
 								<textarea
492
-										name="<?php echo esc_attr( $value['id'] ); ?>"
493
-										id="<?php echo esc_attr( $value['id'] ); ?>"
494
-										style="<?php echo esc_attr( $value['css'] ); ?>"
495
-										class="<?php echo esc_attr( $value['class'] ); ?>"
492
+										name="<?php echo esc_attr($value['id']); ?>"
493
+										id="<?php echo esc_attr($value['id']); ?>"
494
+										style="<?php echo esc_attr($value['css']); ?>"
495
+										class="<?php echo esc_attr($value['class']); ?>"
496 496
 										rows="10"
497 497
 										cols="60"
498
-									<?php echo implode( ' ', $custom_attributes ); ?>
499
-								><?php echo esc_textarea( $option_value ); ?></textarea>
498
+									<?php echo implode(' ', $custom_attributes); ?>
499
+								><?php echo esc_textarea($option_value); ?></textarea>
500 500
 							<?php echo $description; ?>
501 501
 						</td>
502 502
 						</tr><?php
@@ -506,35 +506,35 @@  discard block
 block discarded – undo
506 506
 					case 'select' :
507 507
 					case 'multiselect' :
508 508
 
509
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
509
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
510 510
 
511 511
 						?>
512
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
512
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
513 513
 						<th scope="row" class="titledesc">
514
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
514
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
515 515
 						</th>
516
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
516
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
517 517
 							<select
518
-									name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) {
518
+									name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') {
519 519
 										echo '[]';
520 520
 									} ?>"
521
-									id="<?php echo esc_attr( $value['id'] ); ?>"
522
-									style="<?php echo esc_attr( $value['css'] ); ?>"
523
-									class="<?php echo esc_attr( $value['class'] ); ?>"
524
-								<?php echo implode( ' ', $custom_attributes ); ?>
525
-								<?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?>
521
+									id="<?php echo esc_attr($value['id']); ?>"
522
+									style="<?php echo esc_attr($value['css']); ?>"
523
+									class="<?php echo esc_attr($value['class']); ?>"
524
+								<?php echo implode(' ', $custom_attributes); ?>
525
+								<?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?>
526 526
 							>
527 527
 
528 528
 								<?php
529
-								if ( ! empty( $value['options'] ) ) {
530
-									foreach ( $value['options'] as $key => $val ) {
529
+								if ( ! empty($value['options'])) {
530
+									foreach ($value['options'] as $key => $val) {
531 531
 										?>
532
-										<option value="<?php echo esc_attr( $key ); ?>" <?php
532
+										<option value="<?php echo esc_attr($key); ?>" <?php
533 533
 
534
-										if ( is_array( $option_value ) ) {
535
-											selected( in_array( $key, $option_value ), true );
534
+										if (is_array($option_value)) {
535
+											selected(in_array($key, $option_value), true);
536 536
 										} else {
537
-											selected( $option_value, $key );
537
+											selected($option_value, $key);
538 538
 										}
539 539
 
540 540
 										?>><?php echo $val ?></option>
@@ -550,28 +550,28 @@  discard block
 block discarded – undo
550 550
 
551 551
 					// Radio inputs.
552 552
 					case 'radio_inline' :
553
-						$value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline';
553
+						$value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline';
554 554
 					case 'radio' :
555
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
555
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
556 556
 						?>
557
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
557
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
558 558
 						<th scope="row" class="titledesc">
559
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
559
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
560 560
 						</th>
561
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
561
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
562 562
 							<fieldset>
563 563
 								<ul>
564 564
 									<?php
565
-									foreach ( $value['options'] as $key => $val ) {
565
+									foreach ($value['options'] as $key => $val) {
566 566
 										?>
567 567
 										<li>
568 568
 											<label><input
569
-														name="<?php echo esc_attr( $value['id'] ); ?>"
569
+														name="<?php echo esc_attr($value['id']); ?>"
570 570
 														value="<?php echo $key; ?>"
571 571
 														type="radio"
572
-														style="<?php echo esc_attr( $value['css'] ); ?>"
573
-													<?php echo implode( ' ', $custom_attributes ); ?>
574
-													<?php checked( $key, $option_value ); ?>
572
+														style="<?php echo esc_attr($value['css']); ?>"
573
+													<?php echo implode(' ', $custom_attributes); ?>
574
+													<?php checked($key, $option_value); ?>
575 575
 												/> <?php echo $val ?></label>
576 576
 										</li>
577 577
 										<?php
@@ -585,21 +585,21 @@  discard block
 block discarded – undo
585 585
 
586 586
 					// Checkbox input.
587 587
 					case 'checkbox' :
588
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
588
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
589 589
 						?>
590
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
590
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
591 591
 							<th scope="row" class="titledesc">
592
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
592
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
593 593
 							</th>
594 594
 							<td class="give-forminp">
595 595
 								<input
596
-										name="<?php echo esc_attr( $value['id'] ); ?>"
597
-										id="<?php echo esc_attr( $value['id'] ); ?>"
596
+										name="<?php echo esc_attr($value['id']); ?>"
597
+										id="<?php echo esc_attr($value['id']); ?>"
598 598
 										type="checkbox"
599
-										class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>"
599
+										class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>"
600 600
 										value="1"
601
-									<?php checked( $option_value, 'on' ); ?>
602
-									<?php echo implode( ' ', $custom_attributes ); ?>
601
+									<?php checked($option_value, 'on'); ?>
602
+									<?php echo implode(' ', $custom_attributes); ?>
603 603
 								/>
604 604
 								<?php echo $description; ?>
605 605
 							</td>
@@ -609,28 +609,28 @@  discard block
 block discarded – undo
609 609
 
610 610
 					// Multi Checkbox input.
611 611
 					case 'multicheck' :
612
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
613
-						$option_value = is_array( $option_value ) ? $option_value : array();
612
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
613
+						$option_value = is_array($option_value) ? $option_value : array();
614 614
 						?>
615
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
615
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
616 616
 							<th scope="row" class="titledesc">
617
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
617
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
618 618
 							</th>
619
-							<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
619
+							<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
620 620
 								<fieldset>
621 621
 									<ul>
622 622
 										<?php
623
-										foreach ( $value['options'] as $key => $val ) {
623
+										foreach ($value['options'] as $key => $val) {
624 624
 											?>
625 625
 											<li>
626 626
 												<label>
627 627
 													<input
628
-															name="<?php echo esc_attr( $value['id'] ); ?>[]"
628
+															name="<?php echo esc_attr($value['id']); ?>[]"
629 629
 															value="<?php echo $key; ?>"
630 630
 															type="checkbox"
631
-															style="<?php echo esc_attr( $value['css'] ); ?>"
632
-														<?php echo implode( ' ', $custom_attributes ); ?>
633
-														<?php if ( in_array( $key, $option_value ) ) {
631
+															style="<?php echo esc_attr($value['css']); ?>"
632
+														<?php echo implode(' ', $custom_attributes); ?>
633
+														<?php if (in_array($key, $option_value)) {
634 634
 															echo 'checked="checked"';
635 635
 														} ?>
636 636
 													/> <?php echo $val ?>
@@ -649,30 +649,30 @@  discard block
 block discarded – undo
649 649
 					// File input field.
650 650
 					case 'file' :
651 651
 					case 'media' :
652
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
653
-						$button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $value['type'] ? 'File' : 'Image' ) ), 'give' );
654
-						$fvalue       = empty( $value['fvalue'] ) ? 'url' : $value['fvalue'];
655
-
656
-						$allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' );
657
-						$preview_image_src        = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : '';
658
-						$preview_image_extension  = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : '';
659
-						$is_show_preview          = in_array( $preview_image_extension, $allow_media_preview_tags );
652
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
653
+						$button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $value['type'] ? 'File' : 'Image')), 'give');
654
+						$fvalue       = empty($value['fvalue']) ? 'url' : $value['fvalue'];
655
+
656
+						$allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico');
657
+						$preview_image_src        = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : '';
658
+						$preview_image_extension  = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : '';
659
+						$is_show_preview          = in_array($preview_image_extension, $allow_media_preview_tags);
660 660
 						?>
661
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
661
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
662 662
 							<th scope="row" class="titledesc">
663
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
663
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
664 664
 							</th>
665 665
 							<td class="give-forminp">
666 666
 								<div class="give-field-wrap">
667 667
 									<label for="<?php echo $value['id'] ?>">
668 668
 										<input
669
-												name="<?php echo esc_attr( $value['id'] ); ?>"
670
-												id="<?php echo esc_attr( $value['id'] ); ?>"
669
+												name="<?php echo esc_attr($value['id']); ?>"
670
+												id="<?php echo esc_attr($value['id']); ?>"
671 671
 												type="text"
672
-												class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>"
672
+												class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>"
673 673
 												value="<?php echo $option_value; ?>"
674
-												style="<?php echo esc_attr( $value['css'] ); ?>"
675
-											<?php echo implode( ' ', $custom_attributes ); ?>
674
+												style="<?php echo esc_attr($value['css']); ?>"
675
+											<?php echo implode(' ', $custom_attributes); ?>
676 676
 										/>&nbsp;&nbsp;&nbsp;&nbsp;<input class="give-upload-button button" type="button" data-fvalue="<?php echo $fvalue; ?>" data-field-type="<?php echo $value['type']; ?>" value="<?php echo $button_label; ?>">
677 677
 										<?php echo $description ?>
678 678
 										<div class="give-image-thumb<?php echo ! $option_value || ! $is_show_preview ? ' give-hidden' : ''; ?>">
@@ -689,17 +689,17 @@  discard block
 block discarded – undo
689 689
 					// WordPress Editor.
690 690
 					case 'wysiwyg' :
691 691
 						// Get option value.
692
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
692
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
693 693
 
694 694
 						// Get editor settings.
695
-						$editor_settings = ! empty( $value['options'] ) ? $value['options'] : array();
695
+						$editor_settings = ! empty($value['options']) ? $value['options'] : array();
696 696
 						?>
697
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
697
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
698 698
 						<th scope="row" class="titledesc">
699
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
699
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
700 700
 						</th>
701 701
 						<td class="give-forminp">
702
-							<?php wp_editor( $option_value, $value['id'], $editor_settings ); ?>
702
+							<?php wp_editor($option_value, $value['id'], $editor_settings); ?>
703 703
 							<?php echo $description; ?>
704 704
 						</td>
705 705
 						</tr><?php
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
 					// Custom: System setting field.
709 709
 					case 'system_info' :
710 710
 						?>
711
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
711
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
712 712
 						<th scope="row" class="titledesc">
713
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
713
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
714 714
 						</th>
715 715
 						<td class="give-forminp">
716 716
 							<?php give_system_info_callback(); ?>
@@ -721,14 +721,14 @@  discard block
 block discarded – undo
721 721
 
722 722
 					// Custom: Default gateways setting field.
723 723
 					case 'default_gateway' :
724
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
724
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
725 725
 						?>
726
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
726
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
727 727
 						<th scope="row" class="titledesc">
728
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
728
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
729 729
 						</th>
730 730
 						<td class="give-forminp">
731
-							<?php give_default_gateway_callback( $value, $option_value ); ?>
731
+							<?php give_default_gateway_callback($value, $option_value); ?>
732 732
 							<?php echo $description; ?>
733 733
 						</td>
734 734
 						</tr><?php
@@ -736,14 +736,14 @@  discard block
 block discarded – undo
736 736
 
737 737
 					// Custom: Enable gateways setting field.
738 738
 					case 'enabled_gateways' :
739
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
739
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
740 740
 						?>
741
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
741
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
742 742
 						<th scope="row" class="titledesc">
743
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
743
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
744 744
 						</th>
745 745
 						<td class="give-forminp">
746
-							<?php give_enabled_gateways_callback( $value, $option_value ); ?>
746
+							<?php give_enabled_gateways_callback($value, $option_value); ?>
747 747
 							<?php echo $description; ?>
748 748
 						</td>
749 749
 						</tr><?php
@@ -752,12 +752,12 @@  discard block
 block discarded – undo
752 752
 					// Custom: Email preview buttons field.
753 753
 					case 'email_preview_buttons' :
754 754
 						?>
755
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
755
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
756 756
 						<th scope="row" class="titledesc">
757
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
757
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
758 758
 						</th>
759 759
 						<td class="give-forminp">
760
-							<?php give_email_preview_buttons_callback( $value ); ?>
760
+							<?php give_email_preview_buttons_callback($value); ?>
761 761
 							<?php echo $description; ?>
762 762
 						</td>
763 763
 						</tr><?php
@@ -771,22 +771,22 @@  discard block
 block discarded – undo
771 771
 
772 772
 					// Custom: Gateway API key.
773 773
 					case 'api_key' :
774
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
775
-						$type         = ! empty( $option_value ) ? 'password' : 'text';
774
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
775
+						$type         = ! empty($option_value) ? 'password' : 'text';
776 776
 						?>
777
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
777
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
778 778
 						<th scope="row" class="titledesc">
779
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
779
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
780 780
 						</th>
781
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
781
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
782 782
 							<input
783
-									name="<?php echo esc_attr( $value['id'] ); ?>"
784
-									id="<?php echo esc_attr( $value['id'] ); ?>"
785
-									type="<?php echo esc_attr( $type ); ?>"
786
-									style="<?php echo esc_attr( $value['css'] ); ?>"
787
-									value="<?php echo esc_attr( trim( $option_value ) ); ?>"
788
-									class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
789
-								<?php echo implode( ' ', $custom_attributes ); ?>
783
+									name="<?php echo esc_attr($value['id']); ?>"
784
+									id="<?php echo esc_attr($value['id']); ?>"
785
+									type="<?php echo esc_attr($type); ?>"
786
+									style="<?php echo esc_attr($value['css']); ?>"
787
+									value="<?php echo esc_attr(trim($option_value)); ?>"
788
+									class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
789
+								<?php echo implode(' ', $custom_attributes); ?>
790 790
 							/> <?php echo $description; ?>
791 791
 						</td>
792 792
 						</tr><?php
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 						 *
804 804
 						 * @since 1.0
805 805
 						 */
806
-						do_action( "give_logs_view_{$current_section}" );
806
+						do_action("give_logs_view_{$current_section}");
807 807
 
808 808
 						echo $description;
809 809
 						break;
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 					// Custom: Data field.
812 812
 					case 'data' :
813 813
 
814
-						include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php';
814
+						include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php';
815 815
 
816 816
 						echo $description;
817 817
 						break;
@@ -819,12 +819,12 @@  discard block
 block discarded – undo
819 819
 					// Custom: Give Docs Link field type.
820 820
 					case 'give_docs_link' :
821 821
 						?>
822
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
822
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
823 823
 						<td class="give-docs-link" colspan="2">
824 824
 							<?php
825
-							echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] )
825
+							echo '<p class="give-docs-link"><a href="'.esc_url($value['url'])
826 826
 							     . '" target="_blank">'
827
-							     . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] )
827
+							     . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title'])
828 828
 							     . '<span class="dashicons dashicons-editor-help"></span></a></p>';
829 829
 							?>
830 830
 						</td>
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 					// You can add or handle your custom field action.
836 836
 					default:
837 837
 						// Get option value.
838
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
839
-						do_action( 'give_admin_field_' . $value['type'], $value, $option_value );
838
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
839
+						do_action('give_admin_field_'.$value['type'], $value, $option_value);
840 840
 						break;
841 841
 				}
842 842
 			}
@@ -852,15 +852,15 @@  discard block
 block discarded – undo
852 852
 		 *
853 853
 		 * @return string The HTML description of the field.
854 854
 		 */
855
-		public static function get_field_description( $value ) {
855
+		public static function get_field_description($value) {
856 856
 			$description = '';
857 857
 
858 858
 			// Support for both 'description' and 'desc' args.
859
-			$description_key = isset( $value['description'] ) ? 'description' : 'desc';
860
-			$value           = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : '';
859
+			$description_key = isset($value['description']) ? 'description' : 'desc';
860
+			$value           = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : '';
861 861
 
862
-			if ( ! empty( $value ) ) {
863
-				$description = '<div class="give-field-description">' . wp_kses_post( $value ) . '</div>';
862
+			if ( ! empty($value)) {
863
+				$description = '<div class="give-field-description">'.wp_kses_post($value).'</div>';
864 864
 			}
865 865
 
866 866
 			return $description;
@@ -877,11 +877,11 @@  discard block
 block discarded – undo
877 877
 		 *
878 878
 		 * @return array The description and tip as a 2 element array
879 879
 		 */
880
-		public static function get_field_title( $value ) {
881
-			$title = esc_html( $value['title'] );
880
+		public static function get_field_title($value) {
881
+			$title = esc_html($value['title']);
882 882
 
883 883
 			// If html tag detected then allow them to print.
884
-			if ( strip_tags( $title ) ) {
884
+			if (strip_tags($title)) {
885 885
 				$title = $value['title'];
886 886
 			}
887 887
 
@@ -900,8 +900,8 @@  discard block
 block discarded – undo
900 900
 		 *
901 901
 		 * @return bool
902 902
 		 */
903
-		public static function save_fields( $options, $option_name = '' ) {
904
-			if ( empty( $_POST ) ) {
903
+		public static function save_fields($options, $option_name = '') {
904
+			if (empty($_POST)) {
905 905
 				return false;
906 906
 			}
907 907
 
@@ -909,37 +909,37 @@  discard block
 block discarded – undo
909 909
 			$update_options = array();
910 910
 
911 911
 			// Loop options and get values to save.
912
-			foreach ( $options as $option ) {
913
-				if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) {
912
+			foreach ($options as $option) {
913
+				if ( ! isset($option['id']) || ! isset($option['type'])) {
914 914
 					continue;
915 915
 				}
916 916
 
917 917
 				// Get posted value.
918
-				if ( strstr( $option['id'], '[' ) ) {
919
-					parse_str( $option['id'], $option_name_array );
920
-					$field_option_name = current( array_keys( $option_name_array ) );
921
-					$setting_name      = key( $option_name_array[ $field_option_name ] );
922
-					$raw_value         = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null;
918
+				if (strstr($option['id'], '[')) {
919
+					parse_str($option['id'], $option_name_array);
920
+					$field_option_name = current(array_keys($option_name_array));
921
+					$setting_name      = key($option_name_array[$field_option_name]);
922
+					$raw_value         = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null;
923 923
 				} else {
924 924
 					$field_option_name = $option['id'];
925 925
 					$setting_name      = '';
926
-					$raw_value         = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null;
926
+					$raw_value         = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null;
927 927
 				}
928 928
 
929 929
 				// Format the value based on option type.
930
-				switch ( $option['type'] ) {
930
+				switch ($option['type']) {
931 931
 					case 'checkbox' :
932
-						$value = is_null( $raw_value ) ? '' : 'on';
932
+						$value = is_null($raw_value) ? '' : 'on';
933 933
 						break;
934 934
 					case 'wysiwyg'  :
935 935
 					case 'textarea' :
936
-						$value = wp_kses_post( trim( $raw_value ) );
936
+						$value = wp_kses_post(trim($raw_value));
937 937
 						break;
938 938
 					case 'multiselect' :
939
-						$value = array_filter( array_map( 'give_clean', (array) $raw_value ) );
939
+						$value = array_filter(array_map('give_clean', (array) $raw_value));
940 940
 						break;
941 941
 					default :
942
-						$value = give_clean( $raw_value );
942
+						$value = give_clean($raw_value);
943 943
 						break;
944 944
 				}
945 945
 
@@ -948,37 +948,37 @@  discard block
 block discarded – undo
948 948
 				 *
949 949
 				 * @since 1.8
950 950
 				 */
951
-				$value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value );
951
+				$value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value);
952 952
 
953 953
 				/**
954 954
 				 * Sanitize the value of an option by option name.
955 955
 				 *
956 956
 				 * @since 1.8
957 957
 				 */
958
-				$value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value );
958
+				$value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value);
959 959
 
960
-				if ( is_null( $value ) ) {
960
+				if (is_null($value)) {
961 961
 					continue;
962 962
 				}
963 963
 
964 964
 				// Check if option is an array and handle that differently to single values.
965
-				if ( $field_option_name && $setting_name ) {
966
-					if ( ! isset( $update_options[ $field_option_name ] ) ) {
967
-						$update_options[ $field_option_name ] = get_option( $field_option_name, array() );
965
+				if ($field_option_name && $setting_name) {
966
+					if ( ! isset($update_options[$field_option_name])) {
967
+						$update_options[$field_option_name] = get_option($field_option_name, array());
968 968
 					}
969
-					if ( ! is_array( $update_options[ $field_option_name ] ) ) {
970
-						$update_options[ $field_option_name ] = array();
969
+					if ( ! is_array($update_options[$field_option_name])) {
970
+						$update_options[$field_option_name] = array();
971 971
 					}
972
-					$update_options[ $field_option_name ][ $setting_name ] = $value;
972
+					$update_options[$field_option_name][$setting_name] = $value;
973 973
 				} else {
974
-					$update_options[ $field_option_name ] = $value;
974
+					$update_options[$field_option_name] = $value;
975 975
 				}
976 976
 			}
977 977
 
978 978
 			// Save all options in our array or there own option name i.e. option id.
979
-			if ( empty( $option_name ) ) {
980
-				foreach ( $update_options as $name => $value ) {
981
-					update_option( $name, $value );
979
+			if (empty($option_name)) {
980
+				foreach ($update_options as $name => $value) {
981
+					update_option($name, $value);
982 982
 
983 983
 					/**
984 984
 					 * Trigger action.
@@ -987,13 +987,13 @@  discard block
 block discarded – undo
987 987
 					 *
988 988
 					 * @since 1.8
989 989
 					 */
990
-					do_action( "give_save_option_{$name}", $value, $name );
990
+					do_action("give_save_option_{$name}", $value, $name);
991 991
 				}
992 992
 			} else {
993
-				$old_options    = ( $old_options = get_option( $option_name ) ) ? $old_options : array();
994
-				$update_options = array_merge( $old_options, $update_options );
993
+				$old_options    = ($old_options = get_option($option_name)) ? $old_options : array();
994
+				$update_options = array_merge($old_options, $update_options);
995 995
 
996
-				update_option( $option_name, $update_options );
996
+				update_option($option_name, $update_options);
997 997
 
998 998
 				/**
999 999
 				 * Trigger action.
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 				 *
1003 1003
 				 * @since 1.8
1004 1004
 				 */
1005
-				do_action( "give_save_settings_{$option_name}", $update_options, $option_name );
1005
+				do_action("give_save_settings_{$option_name}", $update_options, $option_name);
1006 1006
 			}
1007 1007
 
1008 1008
 			return true;
@@ -1031,17 +1031,17 @@  discard block
 block discarded – undo
1031 1031
 		 *
1032 1032
 		 * @return bool
1033 1033
 		 */
1034
-		public static function is_setting_page( $tab = '', $section = '' ) {
1034
+		public static function is_setting_page($tab = '', $section = '') {
1035 1035
 			$is_setting_page = false;
1036 1036
 
1037 1037
 			// Check fo setting tab.
1038
-			if ( ! empty( $tab ) ) {
1039
-				$is_setting_page = ( $tab === give_get_current_setting_tab() );
1038
+			if ( ! empty($tab)) {
1039
+				$is_setting_page = ($tab === give_get_current_setting_tab());
1040 1040
 			}
1041 1041
 
1042 1042
 			// Check fo setting section.
1043
-			if ( ! empty( $section ) ) {
1044
-				$is_setting_page = ( $section === give_get_current_setting_section() );
1043
+			if ( ! empty($section)) {
1044
+				$is_setting_page = ($section === give_get_current_setting_section());
1045 1045
 			}
1046 1046
 
1047 1047
 			return $is_setting_page;
Please login to merge, or discard this patch.