Completed
Pull Request — master (#745)
by
unknown
16:19 queued 12:41
created
includes/admin/upgrades/upgrades.php 2 patches
Spacing   +17 added lines, -17 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,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_upgrades_screen() {
24
-	$action = isset( $_GET['give-upgrade'] ) ? sanitize_text_field( $_GET['give-upgrade'] ) : '';
25
-	$step   = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
26
-	$total  = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false;
27
-	$custom = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 0;
28
-	$number = isset( $_GET['number'] ) ? absint( $_GET['number'] ) : 100;
29
-	$steps  = round( ( $total / $number ), 0 );
24
+	$action = isset($_GET['give-upgrade']) ? sanitize_text_field($_GET['give-upgrade']) : '';
25
+	$step   = isset($_GET['step']) ? absint($_GET['step']) : 1;
26
+	$total  = isset($_GET['total']) ? absint($_GET['total']) : false;
27
+	$custom = isset($_GET['custom']) ? absint($_GET['custom']) : 0;
28
+	$number = isset($_GET['number']) ? absint($_GET['number']) : 100;
29
+	$steps  = round(($total / $number), 0);
30 30
 
31 31
 	$doing_upgrade_args = array(
32 32
 		'page'         => 'give-upgrades',
@@ -36,25 +36,25 @@  discard block
 block discarded – undo
36 36
 		'custom'       => $custom,
37 37
 		'steps'        => $steps
38 38
 	);
39
-	update_option( 'give_doing_upgrade', $doing_upgrade_args );
40
-	if ( $step > $steps ) {
39
+	update_option('give_doing_upgrade', $doing_upgrade_args);
40
+	if ($step > $steps) {
41 41
 		// Prevent a weird case where the estimate was off. Usually only a couple.
42 42
 		$steps = $step;
43 43
 	}
44 44
 	?>
45 45
 	<div class="wrap">
46
-		<h2><?php _e( 'Give - Upgrades', 'give' ); ?></h2>
46
+		<h2><?php _e('Give - Upgrades', 'give'); ?></h2>
47 47
 
48
-		<?php if ( ! empty( $action ) ) : ?>
48
+		<?php if ( ! empty($action)) : ?>
49 49
 
50 50
 			<div id="give-upgrade-status">
51
-				<p style="font-size: 20px;max-width: 900px;"><?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?>
52
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style="  position: relative; top: 3px; left: 6px;" />
51
+				<p style="font-size: 20px;max-width: 900px;"><?php _e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?>
52
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style="  position: relative; top: 3px; left: 6px;" />
53 53
 				</p>
54 54
 
55
-				<?php if ( ! empty( $total ) ) : ?>
55
+				<?php if ( ! empty($total)) : ?>
56 56
 					<p>
57
-						<strong><?php printf( __( 'Step %d of approximately %d running', 'give' ), $step, $steps ); ?></strong>
57
+						<strong><?php printf(__('Step %d of approximately %d running', 'give'), $step, $steps); ?></strong>
58 58
 					</p>
59 59
 				<?php endif; ?>
60 60
 			</div>
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 
69 69
 			<div id="give-upgrade-status">
70 70
 				<p style="font-size: 20px;max-width: 900px;">
71
-					<?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?>
72
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style="  position: relative; top: 3px; left: 6px;" />
71
+					<?php _e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?>
72
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style="  position: relative; top: 3px; left: 6px;" />
73 73
 				</p>
74 74
 			</div>
75 75
 			<script type="text/javascript">
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,11 +64,14 @@
 block discarded – undo
64 64
 				}, 250 );
65 65
 			</script>
66 66
 
67
-		<?php else : ?>
67
+		<?php else {
68
+	: ?>
68 69
 
69 70
 			<div id="give-upgrade-status">
70 71
 				<p style="font-size: 20px;max-width: 900px;">
71
-					<?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?>
72
+					<?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' );
73
+}
74
+?>
72 75
 					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style="  position: relative; top: 3px; left: 6px;" />
73 76
 				</p>
74 77
 			</div>
Please login to merge, or discard this patch.
includes/api/class-give-api-v1.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined('ABSPATH')) exit;
14 14
 
15 15
 /**
16 16
  * Give_API_V1 Class
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined( 'ABSPATH' ) ) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * Give_API_V1 Class
Please login to merge, or discard this patch.
includes/class-give-template-loader.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 	public function __construct() {
15 15
 
16
-		add_filter( 'template_include', array( __CLASS__, 'template_loader' ) );
16
+		add_filter('template_include', array(__CLASS__, 'template_loader'));
17 17
 
18 18
 
19 19
 		/**
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 		 * @see 3give_output_content_wrapper()
29 29
 		 * @see give_output_content_wrapper_end()
30 30
 		 */
31
-		add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 );
32
-		add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 );
31
+		add_action('give_before_main_content', 'give_output_content_wrapper', 10);
32
+		add_action('give_after_main_content', 'give_output_content_wrapper_end', 10);
33 33
 
34 34
 		/**
35 35
 		 * Entry Summary Classes
36 36
 		 */
37
-		add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) );
37
+		add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes'));
38 38
 
39 39
 
40 40
 		/**
41 41
 		 * Sidebar
42 42
 		 */
43
-		add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 );
43
+		add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1);
44 44
 
45 45
 
46 46
 		/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		 *
49 49
 		 * @see give_template_single_title()
50 50
 		 */
51
-		add_action( 'give_single_form_summary', 'give_template_single_title', 5 );
52
-		add_action( 'give_single_form_summary', 'give_get_donation_form', 10 );
51
+		add_action('give_single_form_summary', 'give_template_single_title', 5);
52
+		add_action('give_single_form_summary', 'give_get_donation_form', 10);
53 53
 
54 54
 
55 55
 	}
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string
66 66
 	 */
67
-	public function give_set_single_summary_classes( $classes ) {
67
+	public function give_set_single_summary_classes($classes) {
68 68
 
69
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
69
+		$sidebar_option = give_get_option('disable_form_sidebar');
70 70
 
71 71
 		//Add full width class when feature image is disabled AND no widgets are present
72
-		if ( $sidebar_option == 'on' ) {
72
+		if ($sidebar_option == 'on') {
73 73
 			$classes .= ' give-full-width';
74 74
 		}
75 75
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 */
88 88
 	public function give_output_sidebar_option() {
89
-		$sidebar_option = give_get_option( 'disable_form_sidebar' );
89
+		$sidebar_option = give_get_option('disable_form_sidebar');
90 90
 		//Add full width class when feature image is disabled AND no widgets are present
91
-		if ( $sidebar_option !== 'on' ) {
92
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 );
93
-			add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 );
94
-			add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 );
95
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 );
91
+		if ($sidebar_option !== 'on') {
92
+			add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5);
93
+			add_action('give_before_single_form_summary', 'give_show_form_images', 10);
94
+			add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20);
95
+			add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30);
96 96
 		}
97 97
 
98 98
 	}
@@ -114,22 +114,22 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return string
116 116
 	 */
117
-	public static function template_loader( $template ) {
118
-		$find = array( 'give.php' );
117
+	public static function template_loader($template) {
118
+		$find = array('give.php');
119 119
 		$file = '';
120 120
 
121
-		if ( is_single() && get_post_type() == 'give_forms' ) {
121
+		if (is_single() && get_post_type() == 'give_forms') {
122 122
 
123 123
 			$file   = 'single-give-form.php';
124 124
 			$find[] = $file;
125
-			$find[] = apply_filters( 'give_template_path', 'give/' ) . $file;
125
+			$find[] = apply_filters('give_template_path', 'give/').$file;
126 126
 
127 127
 		}
128 128
 
129
-		if ( $file ) {
130
-			$template = locate_template( array_unique( $find ) );
131
-			if ( ! $template ) {
132
-				$template = GIVE_PLUGIN_DIR . '/templates/' . $file;
129
+		if ($file) {
130
+			$template = locate_template(array_unique($find));
131
+			if ( ! $template) {
132
+				$template = GIVE_PLUGIN_DIR.'/templates/'.$file;
133 133
 			}
134 134
 		}
135 135
 
Please login to merge, or discard this patch.
includes/country-functions.php 1 patch
Spacing   +76 added lines, -76 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_get_country() {
25 25
 	global $give_options;
26
-	$country = isset( $give_options['base_country'] ) ? $give_options['base_country'] : 'US';
26
+	$country = isset($give_options['base_country']) ? $give_options['base_country'] : 'US';
27 27
 
28
-	return apply_filters( 'give_give_country', $country );
28
+	return apply_filters('give_give_country', $country);
29 29
 }
30 30
 
31 31
 /**
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function give_get_state() {
38 38
 	global $give_options;
39
-	$state = isset( $give_options['base_state'] ) ? $give_options['base_state'] : false;
39
+	$state = isset($give_options['base_state']) ? $give_options['base_state'] : false;
40 40
 
41
-	return apply_filters( 'give_give_state', $state );
41
+	return apply_filters('give_give_state', $state);
42 42
 }
43 43
 
44 44
 /**
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
  *
51 51
  * @return mixed|void  A list of states for the shop's base country
52 52
  */
53
-function give_get_states( $country = null ) {
53
+function give_get_states($country = null) {
54 54
 	global $give_options;
55 55
 
56
-	if ( empty( $country ) ) {
56
+	if (empty($country)) {
57 57
 		$country = give_get_country();
58 58
 	}
59 59
 
60
-	switch ( $country ) :
60
+	switch ($country) :
61 61
 
62 62
 		case 'US' :
63 63
 			$states = give_get_states_list();
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 	endswitch;
109 109
 
110
-	return apply_filters( 'give_give_states', $states );
110
+	return apply_filters('give_give_states', $states);
111 111
 }
112 112
 
113 113
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 		'ZW' => 'Zimbabwe'
367 367
 	);
368 368
 
369
-	return apply_filters( 'give_countries', $countries );
369
+	return apply_filters('give_countries', $countries);
370 370
 }
371 371
 
372 372
 /**
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 		'AP' => 'Armed Forces - Pacific'
448 448
 	);
449 449
 
450
-	return apply_filters( 'give_us_states', $states );
450
+	return apply_filters('give_us_states', $states);
451 451
 }
452 452
 
453 453
 /**
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 		'YT' => 'Yukon'
476 476
 	);
477 477
 
478
-	return apply_filters( 'give_canada_provinces', $provinces );
478
+	return apply_filters('give_canada_provinces', $provinces);
479 479
 }
480 480
 
481 481
 /**
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 		'WA'  => 'Western Australia'
498 498
 	);
499 499
 
500
-	return apply_filters( 'give_australian_states', $states );
500
+	return apply_filters('give_australian_states', $states);
501 501
 }
502 502
 
503 503
 /**
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 		'TO' => 'Tocantins'
539 539
 	);
540 540
 
541
-	return apply_filters( 'give_brazil_states', $states );
541
+	return apply_filters('give_brazil_states', $states);
542 542
 }
543 543
 
544 544
 /**
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 		'NEW TERRITORIES' => 'New Territories'
556 556
 	);
557 557
 
558
-	return apply_filters( 'give_hong_kong_states', $states );
558
+	return apply_filters('give_hong_kong_states', $states);
559 559
 }
560 560
 
561 561
 /**
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		'ZA' => 'Zala'
590 590
 	);
591 591
 
592
-	return apply_filters( 'give_hungary_states', $states );
592
+	return apply_filters('give_hungary_states', $states);
593 593
 }
594 594
 
595 595
 /**
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		'CN32' => 'Xinjiang / &#26032;&#30086;'
636 636
 	);
637 637
 
638
-	return apply_filters( 'give_chinese_states', $states );
638
+	return apply_filters('give_chinese_states', $states);
639 639
 }
640 640
 
641 641
 /**
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 		'WC' => 'West Coast'
665 665
 	);
666 666
 
667
-	return apply_filters( 'give_new_zealand_states', $states );
667
+	return apply_filters('give_new_zealand_states', $states);
668 668
 }
669 669
 
670 670
 /**
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 		'PB' => 'Papua Barat'
713 713
 	);
714 714
 
715
-	return apply_filters( 'give_indonesia_states', $states );
715
+	return apply_filters('give_indonesia_states', $states);
716 716
 }
717 717
 
718 718
 /**
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 		'PY' => 'Pondicherry (Puducherry)'
763 763
 	);
764 764
 
765
-	return apply_filters( 'give_indian_states', $states );
765
+	return apply_filters('give_indian_states', $states);
766 766
 }
767 767
 
768 768
 /**
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 		'PJY' => 'W.P. Putrajaya'
793 793
 	);
794 794
 
795
-	return apply_filters( 'give_malaysian_states', $states );
795
+	return apply_filters('give_malaysian_states', $states);
796 796
 }
797 797
 
798 798
 /**
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 		'WC'  => 'Western Cape'
816 816
 	);
817 817
 
818
-	return apply_filters( 'give_south_african_states', $states );
818
+	return apply_filters('give_south_african_states', $states);
819 819
 }
820 820
 
821 821
 /**
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
 		'TH-35' => 'Yasothon (&#3618;&#3650;&#3626;&#3608;&#3619;)'
907 907
 	);
908 908
 
909
-	return apply_filters( 'give_thailand_states', $states );
909
+	return apply_filters('give_thailand_states', $states);
910 910
 }
911 911
 
912 912
 /**
@@ -918,59 +918,59 @@  discard block
 block discarded – undo
918 918
 function give_get_spain_states_list() {
919 919
 	$states = array(
920 920
 		''   => '',
921
-		'C'  => __( 'A Coru&ntilde;a', 'give' ),
922
-		'VI' => __( 'Araba', 'give' ),
923
-		'AB' => __( 'Albacete', 'give' ),
924
-		'A'  => __( 'Alicante', 'give' ),
925
-		'AL' => __( 'Almer&iacute;a', 'give' ),
926
-		'O'  => __( 'Asturias', 'give' ),
927
-		'AV' => __( '&Aacute;vila', 'give' ),
928
-		'BA' => __( 'Badajoz', 'give' ),
929
-		'PM' => __( 'Baleares', 'give' ),
930
-		'B'  => __( 'Barcelona', 'give' ),
931
-		'BU' => __( 'Burgos', 'give' ),
932
-		'CC' => __( 'C&aacute;ceres', 'give' ),
933
-		'CA' => __( 'C&aacute;diz', 'give' ),
934
-		'S'  => __( 'Cantabria', 'give' ),
935
-		'CS' => __( 'Castell&oacute;n', 'give' ),
936
-		'CE' => __( 'Ceuta', 'give' ),
937
-		'CR' => __( 'Ciudad Real', 'give' ),
938
-		'CO' => __( 'C&oacute;rdoba', 'give' ),
939
-		'CU' => __( 'Cuenca', 'give' ),
940
-		'GI' => __( 'Girona', 'give' ),
941
-		'GR' => __( 'Granada', 'give' ),
942
-		'GU' => __( 'Guadalajara', 'give' ),
943
-		'SS' => __( 'Gipuzkoa', 'give' ),
944
-		'H'  => __( 'Huelva', 'give' ),
945
-		'HU' => __( 'Huesca', 'give' ),
946
-		'J'  => __( 'Ja&eacute;n', 'give' ),
947
-		'LO' => __( 'La Rioja', 'give' ),
948
-		'GC' => __( 'Las Palmas', 'give' ),
949
-		'LE' => __( 'Le&oacute;n', 'give' ),
950
-		'L'  => __( 'Lleida', 'give' ),
951
-		'LU' => __( 'Lugo', 'give' ),
952
-		'M'  => __( 'Madrid', 'give' ),
953
-		'MA' => __( 'M&aacute;laga', 'give' ),
954
-		'ML' => __( 'Melilla', 'give' ),
955
-		'MU' => __( 'Murcia', 'give' ),
956
-		'NA' => __( 'Navarra', 'give' ),
957
-		'OR' => __( 'Ourense', 'give' ),
958
-		'P'  => __( 'Palencia', 'give' ),
959
-		'PO' => __( 'Pontevedra', 'give' ),
960
-		'SA' => __( 'Salamanca', 'give' ),
961
-		'TF' => __( 'Santa Cruz de Tenerife', 'give' ),
962
-		'SG' => __( 'Segovia', 'give' ),
963
-		'SE' => __( 'Sevilla', 'give' ),
964
-		'SO' => __( 'Soria', 'give' ),
965
-		'T'  => __( 'Tarragona', 'give' ),
966
-		'TE' => __( 'Teruel', 'give' ),
967
-		'TO' => __( 'Toledo', 'give' ),
968
-		'V'  => __( 'Valencia', 'give' ),
969
-		'VA' => __( 'Valladolid', 'give' ),
970
-		'BI' => __( 'Bizkaia', 'give' ),
971
-		'ZA' => __( 'Zamora', 'give' ),
972
-		'Z'  => __( 'Zaragoza', 'give' )
921
+		'C'  => __('A Coru&ntilde;a', 'give'),
922
+		'VI' => __('Araba', 'give'),
923
+		'AB' => __('Albacete', 'give'),
924
+		'A'  => __('Alicante', 'give'),
925
+		'AL' => __('Almer&iacute;a', 'give'),
926
+		'O'  => __('Asturias', 'give'),
927
+		'AV' => __('&Aacute;vila', 'give'),
928
+		'BA' => __('Badajoz', 'give'),
929
+		'PM' => __('Baleares', 'give'),
930
+		'B'  => __('Barcelona', 'give'),
931
+		'BU' => __('Burgos', 'give'),
932
+		'CC' => __('C&aacute;ceres', 'give'),
933
+		'CA' => __('C&aacute;diz', 'give'),
934
+		'S'  => __('Cantabria', 'give'),
935
+		'CS' => __('Castell&oacute;n', 'give'),
936
+		'CE' => __('Ceuta', 'give'),
937
+		'CR' => __('Ciudad Real', 'give'),
938
+		'CO' => __('C&oacute;rdoba', 'give'),
939
+		'CU' => __('Cuenca', 'give'),
940
+		'GI' => __('Girona', 'give'),
941
+		'GR' => __('Granada', 'give'),
942
+		'GU' => __('Guadalajara', 'give'),
943
+		'SS' => __('Gipuzkoa', 'give'),
944
+		'H'  => __('Huelva', 'give'),
945
+		'HU' => __('Huesca', 'give'),
946
+		'J'  => __('Ja&eacute;n', 'give'),
947
+		'LO' => __('La Rioja', 'give'),
948
+		'GC' => __('Las Palmas', 'give'),
949
+		'LE' => __('Le&oacute;n', 'give'),
950
+		'L'  => __('Lleida', 'give'),
951
+		'LU' => __('Lugo', 'give'),
952
+		'M'  => __('Madrid', 'give'),
953
+		'MA' => __('M&aacute;laga', 'give'),
954
+		'ML' => __('Melilla', 'give'),
955
+		'MU' => __('Murcia', 'give'),
956
+		'NA' => __('Navarra', 'give'),
957
+		'OR' => __('Ourense', 'give'),
958
+		'P'  => __('Palencia', 'give'),
959
+		'PO' => __('Pontevedra', 'give'),
960
+		'SA' => __('Salamanca', 'give'),
961
+		'TF' => __('Santa Cruz de Tenerife', 'give'),
962
+		'SG' => __('Segovia', 'give'),
963
+		'SE' => __('Sevilla', 'give'),
964
+		'SO' => __('Soria', 'give'),
965
+		'T'  => __('Tarragona', 'give'),
966
+		'TE' => __('Teruel', 'give'),
967
+		'TO' => __('Toledo', 'give'),
968
+		'V'  => __('Valencia', 'give'),
969
+		'VA' => __('Valladolid', 'give'),
970
+		'BI' => __('Bizkaia', 'give'),
971
+		'ZA' => __('Zamora', 'give'),
972
+		'Z'  => __('Zaragoza', 'give')
973 973
 	);
974 974
 
975
-	return apply_filters( 'give_spain_states', $states );
975
+	return apply_filters('give_spain_states', $states);
976 976
 }
Please login to merge, or discard this patch.
includes/error-tracking.php 2 patches
Spacing   +30 added lines, -30 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
 
@@ -29,33 +29,33 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @return void
31 31
  */
32
-function give_print_errors( $form_id ) {
32
+function give_print_errors($form_id) {
33 33
 
34 34
 	$errors = give_get_errors();
35 35
 
36
-	$request_form_id = isset( $_REQUEST['form-id'] ) ? intval( $_REQUEST['form-id'] ) : 0;
36
+	$request_form_id = isset($_REQUEST['form-id']) ? intval($_REQUEST['form-id']) : 0;
37 37
 
38 38
 	//Sanity checks first: Ensure that gateway returned errors display on the appropriate form
39
-	if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) {
39
+	if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) {
40 40
 		return;
41 41
 	}
42 42
 
43
-	if ( $errors ) {
44
-		$classes = apply_filters( 'give_error_class', array(
43
+	if ($errors) {
44
+		$classes = apply_filters('give_error_class', array(
45 45
 			'give_errors'
46
-		) );
47
-		echo '<div class="' . implode( ' ', $classes ) . '">';
46
+		));
47
+		echo '<div class="'.implode(' ', $classes).'">';
48 48
 		// Loop error codes and display errors
49
-		foreach ( $errors as $error_id => $error ) {
50
-			echo '<div class="give_error" id="give_error_' . $error_id . '"><p><strong>' . __( 'Error', 'give' ) . '</strong>: ' . $error . '</p></div>';
49
+		foreach ($errors as $error_id => $error) {
50
+			echo '<div class="give_error" id="give_error_'.$error_id.'"><p><strong>'.__('Error', 'give').'</strong>: '.$error.'</p></div>';
51 51
 		}
52 52
 		echo '</div>';
53 53
 		give_clear_errors();
54 54
 	}
55 55
 }
56 56
 
57
-add_action( 'give_purchase_form_before_personal_info', 'give_print_errors' );
58
-add_action( 'give_ajax_checkout_errors', 'give_print_errors' );
57
+add_action('give_purchase_form_before_personal_info', 'give_print_errors');
58
+add_action('give_ajax_checkout_errors', 'give_print_errors');
59 59
 
60 60
 /**
61 61
  * Get Errors
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
  * @return mixed array if errors are present, false if none found
69 69
  */
70 70
 function give_get_errors() {
71
-	return Give()->session->get( 'give_errors' );
71
+	return Give()->session->get('give_errors');
72 72
 }
73 73
 
74 74
 /**
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
  *
85 85
  * @return void
86 86
  */
87
-function give_set_error( $error_id, $error_message ) {
87
+function give_set_error($error_id, $error_message) {
88 88
 	$errors = give_get_errors();
89
-	if ( ! $errors ) {
89
+	if ( ! $errors) {
90 90
 		$errors = array();
91 91
 	}
92
-	$errors[ $error_id ] = $error_message;
93
-	Give()->session->set( 'give_errors', $errors );
92
+	$errors[$error_id] = $error_message;
93
+	Give()->session->set('give_errors', $errors);
94 94
 }
95 95
 
96 96
 /**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
  * @return void
102 102
  */
103 103
 function give_clear_errors() {
104
-	Give()->session->set( 'give_errors', null );
104
+	Give()->session->set('give_errors', null);
105 105
 }
106 106
 
107 107
 /**
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
  *
115 115
  * @return string
116 116
  */
117
-function give_unset_error( $error_id ) {
117
+function give_unset_error($error_id) {
118 118
 	$errors = give_get_errors();
119
-	if ( $errors ) {
120
-		unset( $errors[ $error_id ] );
121
-		Give()->session->set( 'give_errors', $errors );
119
+	if ($errors) {
120
+		unset($errors[$error_id]);
121
+		Give()->session->set('give_errors', $errors);
122 122
 	}
123 123
 }
124 124
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  * @return void
130 130
  */
131 131
 function _give_die_handler() {
132
-	if ( defined( 'GIVE_UNIT_TESTS' ) ) {
132
+	if (defined('GIVE_UNIT_TESTS')) {
133 133
 		return '_give_die_handler';
134 134
 	} else {
135 135
 		die();
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
  * @since  1.0
145 145
  * @return void
146 146
  */
147
-function give_die( $message = '', $title = '', $status = 400 ) {
148
-	add_filter( 'wp_die_ajax_handler', '_give_die_handler', 10, 3 );
149
-	add_filter( 'wp_die_handler', '_give_die_handler', 10, 3 );
150
-	wp_die( $message, $title, array( 'response' => $status ) );
147
+function give_die($message = '', $title = '', $status = 400) {
148
+	add_filter('wp_die_ajax_handler', '_give_die_handler', 10, 3);
149
+	add_filter('wp_die_handler', '_give_die_handler', 10, 3);
150
+	wp_die($message, $title, array('response' => $status));
151 151
 }
152 152
 
153 153
 /**
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
  *
163 163
  * @return   string  $error
164 164
  */
165
-function give_output_error( $message, $echo = true, $error_id = 'warning' ) {
166
-	$error = '<div class="give_errors" id="give_error_' . $error_id . '"><p class="give_error  give_' . $error_id . '">' . $message . '</p></div>';
165
+function give_output_error($message, $echo = true, $error_id = 'warning') {
166
+	$error = '<div class="give_errors" id="give_error_'.$error_id.'"><p class="give_error  give_'.$error_id.'">'.$message.'</p></div>';
167 167
 
168
-	if ( $echo ) {
168
+	if ($echo) {
169 169
 		echo $error;
170 170
 	} else {
171 171
 		return $error;
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @since 1.0
67 67
  * @uses  Give_Session::get()
68
- * @return mixed array if errors are present, false if none found
68
+ * @return string array if errors are present, false if none found
69 69
  */
70 70
 function give_get_errors() {
71 71
 	return Give()->session->get( 'give_errors' );
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
  * Register die handler for give_die()
127 127
  *
128 128
  * @since  1.0
129
- * @return void
129
+ * @return string|null
130 130
  */
131 131
 function _give_die_handler() {
132 132
 	if ( defined( 'GIVE_UNIT_TESTS' ) ) {
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +47 added lines, -47 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
-defined( 'ABSPATH' ) or exit;
13
+defined('ABSPATH') or exit;
14 14
 
15 15
 /**
16 16
  * Give Form widget
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function __construct()
33 33
 	{
34
-		$this->self = get_class( $this );
34
+		$this->self = get_class($this);
35 35
 
36 36
 		parent::__construct(
37
-			strtolower( $this->self ),
38
-			__( 'Give - Donation Form', 'give' ),
37
+			strtolower($this->self),
38
+			__('Give - Donation Form', 'give'),
39 39
 			array(
40
-				'description' => __( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
40
+				'description' => __('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
41 41
 			)
42 42
 		);
43 43
 
44
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
45
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
44
+		add_action('widgets_init', array($this, 'widget_init'));
45
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return void
54 54
 	 */
55
-	public function admin_widget_scripts( $hook )
55
+	public function admin_widget_scripts($hook)
56 56
 	{
57 57
 		// Directories of assets
58
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
59
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
60
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
58
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
59
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
60
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
61 61
 
62 62
 		// Use minified libraries if SCRIPT_DEBUG is turned off
63
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
63
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
64 64
 
65 65
 		// Widget Script
66
-		if ( $hook == 'widgets.php' ) {
66
+		if ($hook == 'widgets.php') {
67 67
 
68
-			wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' );
68
+			wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css');
69 69
 
70
-			wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
70
+			wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION);
71 71
 
72
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
72
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
73 73
 		}
74 74
 	}
75 75
 
@@ -80,24 +80,24 @@  discard block
 block discarded – undo
80 80
 	 *                        before_widget, and after_widget.
81 81
 	 * @param array $instance The settings for the particular instance of the widget.
82 82
 	 */
83
-	public function widget( $args, $instance )
83
+	public function widget($args, $instance)
84 84
 	{
85
-		extract( $args );
85
+		extract($args);
86 86
 
87
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
88
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
87
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
88
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
89 89
 
90 90
 		echo $before_widget;
91 91
 
92
-		do_action( 'give_before_forms_widget' );
92
+		do_action('give_before_forms_widget');
93 93
 
94
-		echo $title ? $before_title . $title . $after_title : '';
94
+		echo $title ? $before_title.$title.$after_title : '';
95 95
 
96
-		give_get_donation_form( $instance );
96
+		give_get_donation_form($instance);
97 97
 
98 98
 		echo $after_widget;
99 99
 
100
-		do_action( 'give_after_forms_widget' );
100
+		do_action('give_after_forms_widget');
101 101
 	}
102 102
 
103 103
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return string
109 109
 	 */
110
-	public function form( $instance )
110
+	public function form($instance)
111 111
 	{
112 112
 		$defaults = array(
113 113
 			'title'        => '',
@@ -115,51 +115,51 @@  discard block
 block discarded – undo
115 115
 			'float_labels' => '',
116 116
 		);
117 117
 
118
-		$instance = wp_parse_args( (array) $instance, $defaults );
118
+		$instance = wp_parse_args((array) $instance, $defaults);
119 119
 
120
-		extract( $instance );
120
+		extract($instance);
121 121
 
122 122
 		// Query Give Forms
123 123
 
124 124
 		$args = array(
125 125
 			'post_type'      => 'give_forms',
126
-			'posts_per_page' => - 1,
126
+			'posts_per_page' => -1,
127 127
 			'post_status'    => 'publish',
128 128
 		);
129 129
 
130
-		$give_forms = get_posts( $args );
130
+		$give_forms = get_posts($args);
131 131
 
132 132
 		// Widget: Title
133 133
 
134 134
 		?><p>
135
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'give' ); ?></label>
136
-			<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>" /><br>
137
-			<small><?php _e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
135
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'give'); ?></label>
136
+			<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>" /><br>
137
+			<small><?php _e('Leave blank to hide the widget title.', 'give'); ?></small>
138 138
 		</p><?php
139 139
 
140 140
 		// Widget: Give Form
141 141
 
142 142
 		?><p>
143
-			<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php printf( __( 'Give %s:', 'give' ), give_get_forms_label_singular() ); ?></label>
144
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
145
-				<option value="current"><?php _e( '— Select —', 'give' ); ?></option>
146
-				<?php foreach ( $give_forms as $give_form ) { ?>
147
-					<option <?php selected( absint( $id ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option>
143
+			<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php printf(__('Give %s:', 'give'), give_get_forms_label_singular()); ?></label>
144
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
145
+				<option value="current"><?php _e('— Select —', 'give'); ?></option>
146
+				<?php foreach ($give_forms as $give_form) { ?>
147
+					<option <?php selected(absint($id), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option>
148 148
 				<?php } ?>
149 149
 			</select><br>
150
-			<small><?php _e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
150
+			<small><?php _e('Select a Give Form to embed in this widget.', 'give'); ?></small>
151 151
 		</p><?php
152 152
 
153 153
 		// Widget: Floating Labels
154 154
 
155 155
 		?><p>
156
-			<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php _e( 'Floating Labels (optional):', 'give' ); ?></label>
157
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>">
158
-				<option value="" <?php selected( esc_attr( $float_labels ), '' ) ?>>– <?php _e( 'Select', 'give' ); ?> –</option>
159
-				<option value="enabled" <?php selected( esc_attr( $float_labels ), 'enabled' ) ?>><?php _e( 'Enabled', 'give' ); ?></option>
160
-				<option value="disabled" <?php selected( esc_attr( $float_labels ), 'disabled' ) ?>><?php _e( 'Disabled', 'give' ); ?></option>
156
+			<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php _e('Floating Labels (optional):', 'give'); ?></label>
157
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>">
158
+				<option value="" <?php selected(esc_attr($float_labels), '') ?>>– <?php _e('Select', 'give'); ?> –</option>
159
+				<option value="enabled" <?php selected(esc_attr($float_labels), 'enabled') ?>><?php _e('Enabled', 'give'); ?></option>
160
+				<option value="disabled" <?php selected(esc_attr($float_labels), 'disabled') ?>><?php _e('Disabled', 'give'); ?></option>
161 161
 			</select><br>
162
-			<small><?php printf( __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ); ?></small>
162
+			<small><?php printf(__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")); ?></small>
163 163
 		</p><?php
164 164
 	}
165 165
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	function widget_init()
172 172
 	{
173
-		register_widget( $this->self );
173
+		register_widget($this->self);
174 174
 	}
175 175
 
176 176
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @return array
183 183
 	 */
184
-	public function update( $new_instance, $old_instance )
184
+	public function update($new_instance, $old_instance)
185 185
 	{
186 186
 		$this->flush_widget_cache();
187 187
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function flush_widget_cache()
197 197
 	{
198
-		wp_cache_delete( $this->self, 'widget' );
198
+		wp_cache_delete($this->self, 'widget');
199 199
 	}
200 200
 }
201 201
 
Please login to merge, or discard this patch.
includes/gateways/functions.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,10 +97,10 @@
 block discarded – undo
97 97
 
98 98
 	//Single Form settings varies compared to the Global default settings
99 99
 	if ( ! empty( $form_default ) &&
100
-	     $form_id !== null &&
101
-	     $default !== $form_default &&
102
-	     $form_default !== 'global' &&
103
-	     give_is_gateway_active( $form_default )
100
+		 $form_id !== null &&
101
+		 $default !== $form_default &&
102
+		 $form_default !== 'global' &&
103
+		 give_is_gateway_active( $form_default )
104 104
 	) {
105 105
 		$default = $form_default;
106 106
 	}
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,17 +24,17 @@  discard block
 block discarded – undo
24 24
 	// Default, built-in gateways
25 25
 	$gateways = array(
26 26
 		'paypal' => array(
27
-			'admin_label'    => __( 'PayPal Standard', 'give' ),
28
-			'checkout_label' => __( 'PayPal', 'give' ),
29
-			'supports'       => array( 'buy_now' )
27
+			'admin_label'    => __('PayPal Standard', 'give'),
28
+			'checkout_label' => __('PayPal', 'give'),
29
+			'supports'       => array('buy_now')
30 30
 		),
31 31
 		'manual' => array(
32
-			'admin_label'    => __( 'Test Payment', 'give' ),
33
-			'checkout_label' => __( 'Test Payment', 'give' )
32
+			'admin_label'    => __('Test Payment', 'give'),
33
+			'checkout_label' => __('Test Payment', 'give')
34 34
 		),
35 35
 	);
36 36
 
37
-	return apply_filters( 'give_payment_gateways', $gateways );
37
+	return apply_filters('give_payment_gateways', $gateways);
38 38
 
39 39
 }
40 40
 
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
 
49 49
 	$gateways = give_get_payment_gateways();
50 50
 
51
-	$enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
51
+	$enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
52 52
 
53 53
 	$gateway_list = array();
54 54
 
55
-	foreach ( $gateways as $key => $gateway ) {
56
-		if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
57
-			$gateway_list[ $key ] = $gateway;
55
+	foreach ($gateways as $key => $gateway) {
56
+		if (isset($enabled[$key]) && $enabled[$key] == 1) {
57
+			$gateway_list[$key] = $gateway;
58 58
 		}
59 59
 	}
60 60
 
61 61
 	// Set order of payment gateway in list.
62
-	$gateway_list = give_get_ordered_payment_gateways( $gateway_list );
62
+	$gateway_list = give_get_ordered_payment_gateways($gateway_list);
63 63
 
64
-	return apply_filters( 'give_enabled_payment_gateways', $gateway_list );
64
+	return apply_filters('give_enabled_payment_gateways', $gateway_list);
65 65
 }
66 66
 
67 67
 /**
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
  *
74 74
  * @return boolean true if enabled, false otherwise
75 75
  */
76
-function give_is_gateway_active( $gateway ) {
76
+function give_is_gateway_active($gateway) {
77 77
 	$gateways = give_get_enabled_payment_gateways();
78 78
 
79
-	$ret = array_key_exists( $gateway, $gateways );
79
+	$ret = array_key_exists($gateway, $gateways);
80 80
 
81
-	return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways );
81
+	return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways);
82 82
 }
83 83
 
84 84
 /**
@@ -91,24 +91,24 @@  discard block
 block discarded – undo
91 91
  *
92 92
  * @return string Gateway ID
93 93
  */
94
-function give_get_default_gateway( $form_id ) {
94
+function give_get_default_gateway($form_id) {
95 95
 
96 96
 	global $give_options;
97 97
 
98
-	$default      = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal';
99
-	$form_default = get_post_meta( $form_id, '_give_default_gateway', true );
98
+	$default      = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal';
99
+	$form_default = get_post_meta($form_id, '_give_default_gateway', true);
100 100
 
101 101
 	//Single Form settings varies compared to the Global default settings
102
-	if ( ! empty( $form_default ) &&
102
+	if ( ! empty($form_default) &&
103 103
 	     $form_id !== null &&
104 104
 	     $default !== $form_default &&
105 105
 	     $form_default !== 'global' &&
106
-	     give_is_gateway_active( $form_default )
106
+	     give_is_gateway_active($form_default)
107 107
 	) {
108 108
 		$default = $form_default;
109 109
 	}
110 110
 
111
-	return apply_filters( 'give_default_gateway', $default );
111
+	return apply_filters('give_default_gateway', $default);
112 112
 }
113 113
 
114 114
 /**
@@ -120,18 +120,18 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string Gateway admin label
122 122
  */
123
-function give_get_gateway_admin_label( $gateway ) {
123
+function give_get_gateway_admin_label($gateway) {
124 124
 	$gateways = give_get_enabled_payment_gateways();
125
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
126
-	$payment  = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false;
125
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
126
+	$payment  = isset($_GET['id']) ? absint($_GET['id']) : false;
127 127
 
128
-	if ( $gateway == 'manual' && $payment ) {
129
-		if ( give_get_payment_amount( $payment ) == 0 ) {
130
-			$label = __( 'Test Donation', 'give' );
128
+	if ($gateway == 'manual' && $payment) {
129
+		if (give_get_payment_amount($payment) == 0) {
130
+			$label = __('Test Donation', 'give');
131 131
 		}
132 132
 	}
133 133
 
134
-	return apply_filters( 'give_gateway_admin_label', $label, $gateway );
134
+	return apply_filters('give_gateway_admin_label', $label, $gateway);
135 135
 }
136 136
 
137 137
 /**
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
  *
144 144
  * @return string Checkout label for the gateway
145 145
  */
146
-function give_get_gateway_checkout_label( $gateway ) {
146
+function give_get_gateway_checkout_label($gateway) {
147 147
 	$gateways = give_get_enabled_payment_gateways();
148
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
148
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
149 149
 
150
-	if ( $gateway == 'manual' ) {
151
-		$label = __( 'Test Donation', 'give' );
150
+	if ($gateway == 'manual') {
151
+		$label = __('Test Donation', 'give');
152 152
 	}
153 153
 
154
-	return apply_filters( 'give_gateway_checkout_label', $label, $gateway );
154
+	return apply_filters('give_gateway_checkout_label', $label, $gateway);
155 155
 }
156 156
 
157 157
 /**
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return array Options the gateway supports
165 165
  */
166
-function give_get_gateway_supports( $gateway ) {
166
+function give_get_gateway_supports($gateway) {
167 167
 	$gateways = give_get_enabled_payment_gateways();
168
-	$supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
168
+	$supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
169 169
 
170
-	return apply_filters( 'give_gateway_supports', $supports, $gateway );
170
+	return apply_filters('give_gateway_supports', $supports, $gateway);
171 171
 }
172 172
 
173 173
 /**
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
  *
180 180
  * @return bool
181 181
  */
182
-function give_gateway_supports_buy_now( $gateway ) {
183
-	$supports = give_get_gateway_supports( $gateway );
184
-	$ret      = in_array( 'buy_now', $supports );
182
+function give_gateway_supports_buy_now($gateway) {
183
+	$supports = give_get_gateway_supports($gateway);
184
+	$ret      = in_array('buy_now', $supports);
185 185
 
186
-	return apply_filters( 'give_gateway_supports_buy_now', $ret, $gateway );
186
+	return apply_filters('give_gateway_supports_buy_now', $ret, $gateway);
187 187
 }
188 188
 
189 189
 /**
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
 	$gateways = give_get_enabled_payment_gateways();
197 197
 	$ret      = false;
198 198
 
199
-	if ( $gateways ) {
200
-		foreach ( $gateways as $gateway_id => $gateway ) {
201
-			if ( give_gateway_supports_buy_now( $gateway_id ) ) {
199
+	if ($gateways) {
200
+		foreach ($gateways as $gateway_id => $gateway) {
201
+			if (give_gateway_supports_buy_now($gateway_id)) {
202 202
 				$ret = true;
203 203
 				break;
204 204
 			}
205 205
 		}
206 206
 	}
207 207
 
208
-	return apply_filters( 'give_give_supports_buy_now', $ret );
208
+	return apply_filters('give_give_supports_buy_now', $ret);
209 209
 }
210 210
 
211 211
 /**
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
  *
219 219
  * @return void
220 220
  */
221
-function give_send_to_gateway( $gateway, $payment_data ) {
221
+function give_send_to_gateway($gateway, $payment_data) {
222 222
 
223
-	$payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' );
223
+	$payment_data['gateway_nonce'] = wp_create_nonce('give-gateway');
224 224
 
225 225
 	// $gateway must match the ID used when registering the gateway
226
-	do_action( 'give_gateway_' . $gateway, $payment_data );
226
+	do_action('give_gateway_'.$gateway, $payment_data);
227 227
 }
228 228
 
229 229
 
@@ -240,32 +240,32 @@  discard block
 block discarded – undo
240 240
  *
241 241
  * @return string $enabled_gateway The slug of the gateway
242 242
  */
243
-function give_get_chosen_gateway( $form_id ) {
243
+function give_get_chosen_gateway($form_id) {
244 244
 	$gateways        = give_get_enabled_payment_gateways();
245
-	$request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0;
246
-	if ( empty( $request_form_id ) ) {
247
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0;
245
+	$request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0;
246
+	if (empty($request_form_id)) {
247
+		$request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0;
248 248
 	}
249
-	$chosen          = give_get_default_gateway( $form_id );
249
+	$chosen          = give_get_default_gateway($form_id);
250 250
 	$enabled_gateway = '';
251 251
 
252 252
 	//Take into account request Form ID args
253
-	if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) {
253
+	if ( ! empty($request_form_id) && $form_id == $request_form_id) {
254 254
 		$chosen = $_REQUEST['payment-mode'];
255 255
 	}
256 256
 
257
-	if ( $chosen ) {
258
-		$enabled_gateway = urldecode( $chosen );
259
-	} else if ( count( $gateways ) >= 1 && ! $chosen ) {
260
-		foreach ( $gateways as $gateway_id => $gateway ):
257
+	if ($chosen) {
258
+		$enabled_gateway = urldecode($chosen);
259
+	} else if (count($gateways) >= 1 && ! $chosen) {
260
+		foreach ($gateways as $gateway_id => $gateway):
261 261
 			$enabled_gateway = $gateway_id;
262 262
 		endforeach;
263 263
 	} else {
264
-		$enabled_gateway = give_get_default_gateway( $form_id );
264
+		$enabled_gateway = give_get_default_gateway($form_id);
265 265
 	}
266 266
 
267 267
 
268
-	return apply_filters( 'give_chosen_gateway', $enabled_gateway );
268
+	return apply_filters('give_chosen_gateway', $enabled_gateway);
269 269
 }
270 270
 
271 271
 /**
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @return int ID of the new log entry
284 284
  */
285
-function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
286
-	return give_record_log( $title, $message, $parent, 'gateway_error' );
285
+function give_record_gateway_error($title = '', $message = '', $parent = 0) {
286
+	return give_record_log($title, $message, $parent, 'gateway_error');
287 287
 }
288 288
 
289 289
 /**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
  *
297 297
  * @return int
298 298
  */
299
-function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
299
+function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
300 300
 
301 301
 	$ret  = 0;
302 302
 	$args = array(
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
 		'fields'      => 'ids'
309 309
 	);
310 310
 
311
-	$payments = new WP_Query( $args );
311
+	$payments = new WP_Query($args);
312 312
 
313
-	if ( $payments ) {
313
+	if ($payments) {
314 314
 		$ret = $payments->post_count;
315 315
 	}
316 316
 
@@ -327,27 +327,27 @@  discard block
 block discarded – undo
327 327
  *
328 328
  * @return array $gateways All the available gateways
329 329
  */
330
-function give_get_ordered_payment_gateways( $gateways ) {
330
+function give_get_ordered_payment_gateways($gateways) {
331 331
 
332 332
 	//  Get gateways setting.
333
-	$gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
333
+	$gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
334 334
 
335 335
 	// Return from here if we do not have gateways setting.
336
-	if ( empty( $gateways_setting ) ) {
336
+	if (empty($gateways_setting)) {
337 337
 		return $gateways;
338 338
 	}
339 339
 
340 340
 	// Reverse array to order payment gateways.
341
-	$gateways_setting = array_reverse( $gateways_setting );
341
+	$gateways_setting = array_reverse($gateways_setting);
342 342
 
343 343
 	// Reorder gateways array
344
-	foreach ( $gateways_setting as $gateway_key => $value ) {
344
+	foreach ($gateways_setting as $gateway_key => $value) {
345 345
 
346
-		$new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : '';
347
-		unset( $gateways[ $gateway_key ] );
346
+		$new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : '';
347
+		unset($gateways[$gateway_key]);
348 348
 
349
-		if(!empty($new_gateway_value)) {
350
-			$gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways );
349
+		if ( ! empty($new_gateway_value)) {
350
+			$gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways);
351 351
 		}
352 352
 	}
353 353
 
@@ -358,5 +358,5 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
 	 * @param array $gateways All the available gateways
360 360
 	 */
361
-	return apply_filters( 'give_payment_gateways_order', $gateways );
361
+	return apply_filters('give_payment_gateways_order', $gateways);
362 362
 }
Please login to merge, or discard this patch.
includes/price-functions.php 1 patch
Spacing   +15 added lines, -15 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,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return string $default_price
69 69
  */
70
-function give_get_default_multilevel_amount( $form_id ) {
70
+function give_get_default_multilevel_amount($form_id) {
71 71
 	$default_price = '1.00';
72
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
72
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
73 73
 
74
-	foreach ( $prices as $price ) {
74
+	foreach ($prices as $price) {
75 75
 
76
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
76
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
77 77
 			$default_price = $price['_give_amount'];
78 78
 		}
79 79
 
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
  * @return string $default_price
95 95
  * @since      1.0
96 96
  */
97
-function give_get_default_form_amount( $form_id ) {
97
+function give_get_default_form_amount($form_id) {
98 98
 
99
-	if ( give_has_variable_prices( $form_id ) ) {
99
+	if (give_has_variable_prices($form_id)) {
100 100
 
101
-		$default_amount = give_get_default_multilevel_amount( $form_id );
101
+		$default_amount = give_get_default_multilevel_amount($form_id);
102 102
 
103 103
 	} else {
104 104
 
105
-		$default_amount = get_post_meta( $form_id, '_give_set_price', true );
105
+		$default_amount = get_post_meta($form_id, '_give_set_price', true);
106 106
 
107 107
 	}
108 108
 
Please login to merge, or discard this patch.
includes/shortcodes.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 
80 80
 		//validate display_style and float_labels value
81 81
 		if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) )
82
-		     || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) )
82
+			 || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) )
83 83
 		) {
84 84
 
85 85
 			$atts[ $key ] = '';
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,28 +25,28 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_donation_history() {
27 27
 
28
-	$email_access = give_get_option( 'email_access' );
28
+	$email_access = give_get_option('email_access');
29 29
 
30 30
 	//Is user logged in? Does a session exist? Does an email-access token exist?
31
-	if ( is_user_logged_in() || Give()->session->get_session_expiration() !== false || ( $email_access == 'on' && Give()->email_access->token_exists ) ) {
31
+	if (is_user_logged_in() || Give()->session->get_session_expiration() !== false || ($email_access == 'on' && Give()->email_access->token_exists)) {
32 32
 		ob_start();
33
-		give_get_template_part( 'history', 'donations' );
33
+		give_get_template_part('history', 'donations');
34 34
 
35 35
 		return ob_get_clean();
36 36
 	} //Is Email-based access enabled?
37
-	elseif ( $email_access == 'on' ) {
37
+	elseif ($email_access == 'on') {
38 38
 
39 39
 		ob_start();
40
-		give_get_template_part( 'email', 'login-form' );
40
+		give_get_template_part('email', 'login-form');
41 41
 
42 42
 		return ob_get_clean();
43 43
 	} else {
44
-		$message = __( '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' );
45
-		echo apply_filters( 'give_donation_history_nonuser_message', give_output_error( $message, false ), $message );
44
+		$message = __('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');
45
+		echo apply_filters('give_donation_history_nonuser_message', give_output_error($message, false), $message);
46 46
 	}
47 47
 }
48 48
 
49
-add_shortcode( 'donation_history', 'give_donation_history' );
49
+add_shortcode('donation_history', 'give_donation_history');
50 50
 
51 51
 /**
52 52
  * Donation Form Shortcode
@@ -60,53 +60,53 @@  discard block
 block discarded – undo
60 60
  *
61 61
  * @return string
62 62
  */
63
-function give_form_shortcode( $atts, $content = null ) {
64
-	$atts = shortcode_atts( array(
63
+function give_form_shortcode($atts, $content = null) {
64
+	$atts = shortcode_atts(array(
65 65
 		'id'            => '',
66 66
 		'show_title'    => true,
67 67
 		'show_goal'     => true,
68 68
 		'show_content'  => '',
69 69
 		'float_labels'  => '',
70 70
 		'display_style' => '',
71
-	), $atts, 'give_form' );
71
+	), $atts, 'give_form');
72 72
 
73
-	foreach ( $atts as $key => $value ) {
73
+	foreach ($atts as $key => $value) {
74 74
 		//convert shortcode_atts values to booleans
75
-		if ( $key == 'show_title' ) {
76
-			$atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN );
77
-		} elseif ( $key == 'show_goal' ) {
78
-			$atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN );
75
+		if ($key == 'show_title') {
76
+			$atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN);
77
+		} elseif ($key == 'show_goal') {
78
+			$atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN);
79 79
 		}
80 80
 
81 81
 		//validate show_content value
82
-		if ( $key == 'show_content' ) {
83
-			if ( ! in_array( $value, array( 'none', 'above', 'below' ) ) ) {
84
-				$atts[ $key ] = '';
85
-			} else if ( $value == 'above' ) {
86
-				$atts[ $key ] = 'give_pre_form';
87
-			} else if ( $value == 'below' ) {
88
-				$atts[ $key ] = 'give_post_form';
82
+		if ($key == 'show_content') {
83
+			if ( ! in_array($value, array('none', 'above', 'below'))) {
84
+				$atts[$key] = '';
85
+			} else if ($value == 'above') {
86
+				$atts[$key] = 'give_pre_form';
87
+			} else if ($value == 'below') {
88
+				$atts[$key] = 'give_post_form';
89 89
 			}
90 90
 		}
91 91
 
92 92
 		//validate display_style and float_labels value
93
-		if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) )
94
-		     || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) )
93
+		if (($key == 'display_style' && ! in_array($value, array('onpage', 'reveal', 'modal')))
94
+		     || ($key == 'float_labels' && ! in_array($value, array('enabled', 'disabled')))
95 95
 		) {
96 96
 
97
-			$atts[ $key ] = '';
97
+			$atts[$key] = '';
98 98
 		}
99 99
 	}
100 100
 
101 101
 	//get the Give Form
102 102
 	ob_start();
103
-	give_get_donation_form( $atts );
103
+	give_get_donation_form($atts);
104 104
 	$final_output = ob_get_clean();
105 105
 
106
-	return apply_filters( 'give_donate_form', $final_output, $atts );
106
+	return apply_filters('give_donate_form', $final_output, $atts);
107 107
 }
108 108
 
109
-add_shortcode( 'give_form', 'give_form_shortcode' );
109
+add_shortcode('give_form', 'give_form_shortcode');
110 110
 
111 111
 /**
112 112
  * Donation Form Goal Shortcode
@@ -120,37 +120,37 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string
122 122
  */
123
-function give_goal_shortcode( $atts, $content = null ) {
124
-	$atts = shortcode_atts( array(
123
+function give_goal_shortcode($atts, $content = null) {
124
+	$atts = shortcode_atts(array(
125 125
 		'id'        => '',
126 126
 		'show_text' => true,
127 127
 		'show_bar'  => true,
128
-	), $atts, 'give_goal' );
128
+	), $atts, 'give_goal');
129 129
 
130 130
 
131 131
 	//get the Give Form
132 132
 	ob_start();
133 133
 
134 134
 	//Sanity check 1: ensure there is an ID Provided
135
-	if ( empty( $atts['id'] ) ) {
136
-		give_output_error( __( 'Error: No Donation form ID for the shortcode provided.', 'give' ), true );
135
+	if (empty($atts['id'])) {
136
+		give_output_error(__('Error: No Donation form ID for the shortcode provided.', 'give'), true);
137 137
 	}
138 138
 
139 139
 	//Sanity check 2: Check that this form even has Goals enabled
140
-	$goal_option = get_post_meta( $atts['id'], '_give_goal_option', true );
141
-	if ( empty( $goal_option ) || $goal_option !== 'yes' ) {
142
-		give_output_error( __( 'Error: This form does not have Goals enabled.', 'give' ), true );
140
+	$goal_option = get_post_meta($atts['id'], '_give_goal_option', true);
141
+	if (empty($goal_option) || $goal_option !== 'yes') {
142
+		give_output_error(__('Error: This form does not have Goals enabled.', 'give'), true);
143 143
 	} else {
144 144
 		//Passed all sanity checks: output Goal
145
-		give_show_goal_progress( $atts['id'], $atts );
145
+		give_show_goal_progress($atts['id'], $atts);
146 146
 	}
147 147
 
148 148
 	$final_output = ob_get_clean();
149 149
 
150
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
150
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
151 151
 }
152 152
 
153
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
153
+add_shortcode('give_goal', 'give_goal_shortcode');
154 154
 
155 155
 
156 156
 /**
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
  * @uses  give_login_form()
168 168
  * @return string
169 169
  */
170
-function give_login_form_shortcode( $atts, $content = null ) {
171
-	$atts = shortcode_atts( array(
170
+function give_login_form_shortcode($atts, $content = null) {
171
+	$atts = shortcode_atts(array(
172 172
 		'redirect' => '',
173
-	), $atts, 'give_login' );
173
+	), $atts, 'give_login');
174 174
 
175
-	return give_login_form( $atts['redirect'] );
175
+	return give_login_form($atts['redirect']);
176 176
 }
177 177
 
178
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
178
+add_shortcode('give_login', 'give_login_form_shortcode');
179 179
 
180 180
 /**
181 181
  * Register Shortcode
@@ -190,15 +190,15 @@  discard block
 block discarded – undo
190 190
  * @uses  give_register_form()
191 191
  * @return string
192 192
  */
193
-function give_register_form_shortcode( $atts, $content = null ) {
194
-	$atts = shortcode_atts( array(
193
+function give_register_form_shortcode($atts, $content = null) {
194
+	$atts = shortcode_atts(array(
195 195
 		'redirect' => '',
196
-	), $atts, 'give_register' );
196
+	), $atts, 'give_register');
197 197
 
198
-	return give_register_form( $atts['redirect'] );
198
+	return give_register_form($atts['redirect']);
199 199
 }
200 200
 
201
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
201
+add_shortcode('give_register', 'give_register_form_shortcode');
202 202
 
203 203
 
204 204
 /**
@@ -213,61 +213,61 @@  discard block
 block discarded – undo
213 213
  *
214 214
  * @return string
215 215
  */
216
-function give_receipt_shortcode( $atts, $content = null ) {
216
+function give_receipt_shortcode($atts, $content = null) {
217 217
 
218 218
 	global $give_receipt_args, $payment;
219 219
 
220
-	$give_receipt_args = shortcode_atts( array(
221
-		'error'          => esc_html__( 'Sorry, you are missing the payment key to view this donation receipt.', 'give' ),
220
+	$give_receipt_args = shortcode_atts(array(
221
+		'error'          => esc_html__('Sorry, you are missing the payment key to view this donation receipt.', 'give'),
222 222
 		'price'          => true,
223 223
 		'date'           => true,
224 224
 		'payment_key'    => false,
225 225
 		'payment_method' => true,
226 226
 		'payment_id'     => true
227
-	), $atts, 'give_receipt' );
227
+	), $atts, 'give_receipt');
228 228
 
229 229
 	//set $session var
230 230
 	$session = give_get_purchase_session();
231 231
 
232 232
 	//set payment key var
233
-	if ( isset( $_GET['payment_key'] ) ) {
234
-		$payment_key = urldecode( $_GET['payment_key'] );
235
-	} elseif ( $session ) {
233
+	if (isset($_GET['payment_key'])) {
234
+		$payment_key = urldecode($_GET['payment_key']);
235
+	} elseif ($session) {
236 236
 		$payment_key = $session['purchase_key'];
237
-	} elseif ( $give_receipt_args['payment_key'] ) {
237
+	} elseif ($give_receipt_args['payment_key']) {
238 238
 		$payment_key = $give_receipt_args['payment_key'];
239 239
 	}
240 240
 
241
-	$email_access = give_get_option( 'email_access' );
241
+	$email_access = give_get_option('email_access');
242 242
 
243 243
 	// No payment_key found & Email Access is Turned on:
244
-	if ( ! isset( $payment_key ) && $email_access == 'on' && ! Give()->email_access->token_exists ) {
244
+	if ( ! isset($payment_key) && $email_access == 'on' && ! Give()->email_access->token_exists) {
245 245
 
246 246
 		ob_start();
247 247
 
248
-		give_get_template_part( 'email-login-form' );
248
+		give_get_template_part('email-login-form');
249 249
 
250 250
 		return ob_get_clean();
251 251
 
252
-	} elseif ( ! isset( $payment_key ) ) {
252
+	} elseif ( ! isset($payment_key)) {
253 253
 
254
-		return give_output_error( $give_receipt_args['error'], false, 'error' );
254
+		return give_output_error($give_receipt_args['error'], false, 'error');
255 255
 
256 256
 	}
257 257
 
258
-	$payment_id    = give_get_purchase_id_by_key( $payment_key );
259
-	$user_can_view = give_can_view_receipt( $payment_key );
258
+	$payment_id    = give_get_purchase_id_by_key($payment_key);
259
+	$user_can_view = give_can_view_receipt($payment_key);
260 260
 
261 261
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt
262
-	if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists ) {
262
+	if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists) {
263 263
 
264 264
 		ob_start();
265 265
 
266
-		give_get_template_part( 'email-login-form' );
266
+		give_get_template_part('email-login-form');
267 267
 
268 268
 		return ob_get_clean();
269 269
 
270
-	} elseif ( ! $user_can_view ) {
270
+	} elseif ( ! $user_can_view) {
271 271
 
272 272
 		global $give_login_redirect;
273 273
 
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 
276 276
 		ob_start();
277 277
 
278
-		give_output_error( apply_filters( 'give_must_be_logged_in_error_message', esc_html__( 'You must be logged in to view this donation payment receipt.', 'give' ) ) );
278
+		give_output_error(apply_filters('give_must_be_logged_in_error_message', esc_html__('You must be logged in to view this donation payment receipt.', 'give')));
279 279
 
280
-		give_get_template_part( 'shortcode', 'login' );
280
+		give_get_template_part('shortcode', 'login');
281 281
 
282 282
 		$login_form = ob_get_clean();
283 283
 
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
 	 * Or if user is logged in and the user can view sensitive shop data
295 295
 	 *
296 296
 	 */
297
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
298
-		return give_output_error( $give_receipt_args['error'], false, 'error' );
297
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
298
+		return give_output_error($give_receipt_args['error'], false, 'error');
299 299
 	}
300 300
 
301 301
 	ob_start();
302 302
 
303
-	give_get_template_part( 'shortcode', 'receipt' );
303
+	give_get_template_part('shortcode', 'receipt');
304 304
 
305 305
 	$display = ob_get_clean();
306 306
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
 }
311 311
 
312
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
312
+add_shortcode('give_receipt', 'give_receipt_shortcode');
313 313
 
314 314
 /**
315 315
  * Profile Editor Shortcode
@@ -329,18 +329,18 @@  discard block
 block discarded – undo
329 329
  *
330 330
  * @return string Output generated from the profile editor
331 331
  */
332
-function give_profile_editor_shortcode( $atts, $content = null ) {
332
+function give_profile_editor_shortcode($atts, $content = null) {
333 333
 
334 334
 	ob_start();
335 335
 
336
-	give_get_template_part( 'shortcode', 'profile-editor' );
336
+	give_get_template_part('shortcode', 'profile-editor');
337 337
 
338 338
 	$display = ob_get_clean();
339 339
 
340 340
 	return $display;
341 341
 }
342 342
 
343
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
343
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
344 344
 
345 345
 /**
346 346
  * Process Profile Updater Form
@@ -353,30 +353,30 @@  discard block
 block discarded – undo
353 353
  *
354 354
  * @return false
355 355
  */
356
-function give_process_profile_editor_updates( $data ) {
356
+function give_process_profile_editor_updates($data) {
357 357
 	// Profile field change request
358
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
358
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
359 359
 		return false;
360 360
 	}
361 361
 
362 362
 	// Nonce security
363
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
363
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
364 364
 		return false;
365 365
 	}
366 366
 
367 367
 	$user_id       = get_current_user_id();
368
-	$old_user_data = get_userdata( $user_id );
369
-
370
-	$display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
371
-	$first_name   = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
372
-	$last_name    = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
373
-	$email        = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
374
-	$line1        = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' );
375
-	$line2        = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' );
376
-	$city         = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' );
377
-	$state        = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' );
378
-	$zip          = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' );
379
-	$country      = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' );
368
+	$old_user_data = get_userdata($user_id);
369
+
370
+	$display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
371
+	$first_name   = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
372
+	$last_name    = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
373
+	$email        = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
374
+	$line1        = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : '');
375
+	$line2        = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : '');
376
+	$city         = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : '');
377
+	$state        = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : '');
378
+	$zip          = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : '');
379
+	$country      = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : '');
380 380
 
381 381
 	$userdata = array(
382 382
 		'ID'           => $user_id,
@@ -396,45 +396,45 @@  discard block
 block discarded – undo
396 396
 		'country' => $country
397 397
 	);
398 398
 
399
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
399
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
400 400
 
401 401
 	// New password
402
-	if ( ! empty( $data['give_new_user_pass1'] ) ) {
403
-		if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) {
404
-			give_set_error( 'password_mismatch', __( 'The passwords you entered do not match. Please try again.', 'give' ) );
402
+	if ( ! empty($data['give_new_user_pass1'])) {
403
+		if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) {
404
+			give_set_error('password_mismatch', __('The passwords you entered do not match. Please try again.', 'give'));
405 405
 		} else {
406 406
 			$userdata['user_pass'] = $data['give_new_user_pass1'];
407 407
 		}
408 408
 	}
409 409
 
410 410
 	// Make sure the new email doesn't belong to another user
411
-	if ( $email != $old_user_data->user_email ) {
412
-		if ( email_exists( $email ) ) {
413
-			give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) );
411
+	if ($email != $old_user_data->user_email) {
412
+		if (email_exists($email)) {
413
+			give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give'));
414 414
 		}
415 415
 	}
416 416
 
417 417
 	// Check for errors
418 418
 	$errors = give_get_errors();
419 419
 
420
-	if ( $errors ) {
420
+	if ($errors) {
421 421
 		// Send back to the profile editor if there are errors
422
-		wp_redirect( $data['give_redirect'] );
422
+		wp_redirect($data['give_redirect']);
423 423
 		give_die();
424 424
 	}
425 425
 
426 426
 	// Update the user
427
-	$meta    = update_user_meta( $user_id, '_give_user_address', $address );
428
-	$updated = wp_update_user( $userdata );
427
+	$meta    = update_user_meta($user_id, '_give_user_address', $address);
428
+	$updated = wp_update_user($userdata);
429 429
 
430
-	if ( $updated ) {
431
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
432
-		wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) );
430
+	if ($updated) {
431
+		do_action('give_user_profile_updated', $user_id, $userdata);
432
+		wp_redirect(add_query_arg('updated', 'true', $data['give_redirect']));
433 433
 		give_die();
434 434
 	}
435 435
 
436 436
 	return false;
437 437
 }
438 438
 
439
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
439
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
440 440
 
Please login to merge, or discard this patch.