Completed
Pull Request — master (#1248)
by Devin
17:40
created
includes/admin/reporting/export/class-batch-export-payments.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function csv_cols() {
41 41
 		$cols = array(
42
-			'id'        => esc_html__( 'ID', 'give' ), // unaltered payment ID (use for querying).
43
-			'seq_id'    => esc_html__( 'Payment Number', 'give' ), // sequential payment ID.
44
-			'email'     => esc_html__( 'Email', 'give' ),
45
-			'first'     => esc_html__( 'First Name', 'give' ),
46
-			'last'      => esc_html__( 'Last Name', 'give' ),
47
-			'address1'  => esc_html__( 'Address 1', 'give' ),
48
-			'address2'  => esc_html__( 'Address 2', 'give' ),
49
-			'city'      => esc_html__( 'City', 'give' ),
50
-			'state'     => esc_html__( 'State', 'give' ),
51
-			'country'   => esc_html__( 'Country', 'give' ),
52
-			'zip'       => esc_html__( 'Zip / Postal Code', 'give' ),
53
-			'form_id'   => esc_html__( 'Form ID', 'give' ),
54
-			'form_name' => esc_html__( 'Form Name', 'give' ),
55
-			'amount'    => esc_html__( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')',
56
-			'gateway'   => esc_html__( 'Payment Method', 'give' ),
57
-			'trans_id'  => esc_html__( 'Transaction ID', 'give' ),
58
-			'key'       => esc_html__( 'Key', 'give' ),
59
-			'date'      => esc_html__( 'Date', 'give' ),
60
-			'user'      => esc_html__( 'User', 'give' ),
61
-			'status'    => esc_html__( 'Status', 'give' )
42
+			'id'        => esc_html__('ID', 'give'), // unaltered payment ID (use for querying).
43
+			'seq_id'    => esc_html__('Payment Number', 'give'), // sequential payment ID.
44
+			'email'     => esc_html__('Email', 'give'),
45
+			'first'     => esc_html__('First Name', 'give'),
46
+			'last'      => esc_html__('Last Name', 'give'),
47
+			'address1'  => esc_html__('Address 1', 'give'),
48
+			'address2'  => esc_html__('Address 2', 'give'),
49
+			'city'      => esc_html__('City', 'give'),
50
+			'state'     => esc_html__('State', 'give'),
51
+			'country'   => esc_html__('Country', 'give'),
52
+			'zip'       => esc_html__('Zip / Postal Code', 'give'),
53
+			'form_id'   => esc_html__('Form ID', 'give'),
54
+			'form_name' => esc_html__('Form Name', 'give'),
55
+			'amount'    => esc_html__('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')',
56
+			'gateway'   => esc_html__('Payment Method', 'give'),
57
+			'trans_id'  => esc_html__('Transaction ID', 'give'),
58
+			'key'       => esc_html__('Key', 'give'),
59
+			'date'      => esc_html__('Date', 'give'),
60
+			'user'      => esc_html__('User', 'give'),
61
+			'status'    => esc_html__('Status', 'give')
62 62
 		);
63 63
 
64
-		if ( ! give_get_option( 'enable_sequential' ) ) {
65
-			unset( $cols['seq_id'] );
64
+		if ( ! give_get_option('enable_sequential')) {
65
+			unset($cols['seq_id']);
66 66
 		}
67 67
 
68 68
 		return $cols;
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 			'status' => $this->status
88 88
 		);
89 89
 
90
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
90
+		if ( ! empty($this->start) || ! empty($this->end)) {
91 91
 
92 92
 			$args['date_query'] = array(
93 93
 				array(
94
-					'after'     => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ),
95
-					'before'    => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ),
94
+					'after'     => date('Y-n-d 00:00:00', strtotime($this->start)),
95
+					'before'    => date('Y-n-d 23:59:59', strtotime($this->end)),
96 96
 					'inclusive' => true
97 97
 				)
98 98
 			);
@@ -101,52 +101,52 @@  discard block
 block discarded – undo
101 101
 
102 102
 		//echo json_encode($args ); exit;
103 103
 
104
-		$payments = give_get_payments( $args );
104
+		$payments = give_get_payments($args);
105 105
 
106
-		if ( $payments ) {
106
+		if ($payments) {
107 107
 
108
-			foreach ( $payments as $payment ) {
109
-				$payment_meta = give_get_payment_meta( $payment->ID );
110
-				$user_info    = give_get_payment_meta_user_info( $payment->ID );
111
-				$total        = give_get_payment_amount( $payment->ID );
112
-				$user_id      = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
108
+			foreach ($payments as $payment) {
109
+				$payment_meta = give_get_payment_meta($payment->ID);
110
+				$user_info    = give_get_payment_meta_user_info($payment->ID);
111
+				$total        = give_get_payment_amount($payment->ID);
112
+				$user_id      = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
113 113
 				$products     = '';
114 114
 				$skus         = '';
115 115
 
116
-				if ( is_numeric( $user_id ) ) {
117
-					$user = get_userdata( $user_id );
116
+				if (is_numeric($user_id)) {
117
+					$user = get_userdata($user_id);
118 118
 				} else {
119 119
 					$user = false;
120 120
 				}
121 121
 
122 122
 				$data[] = array(
123 123
 					'id'        => $payment->ID,
124
-					'seq_id'    => give_get_payment_number( $payment->ID ),
124
+					'seq_id'    => give_get_payment_number($payment->ID),
125 125
 					'email'     => $payment_meta['email'],
126 126
 					'first'     => $user_info['first_name'],
127 127
 					'last'      => $user_info['last_name'],
128
-					'address1'  => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '',
129
-					'address2'  => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '',
130
-					'city'      => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '',
131
-					'state'     => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '',
132
-					'country'   => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '',
133
-					'zip'       => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '',
134
-					'form_id'   => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '',
135
-					'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '',
128
+					'address1'  => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '',
129
+					'address2'  => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '',
130
+					'city'      => isset($user_info['address']['city']) ? $user_info['address']['city'] : '',
131
+					'state'     => isset($user_info['address']['state']) ? $user_info['address']['state'] : '',
132
+					'country'   => isset($user_info['address']['country']) ? $user_info['address']['country'] : '',
133
+					'zip'       => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '',
134
+					'form_id'   => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '',
135
+					'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '',
136 136
 					'skus'      => $skus,
137
-					'amount'    => html_entity_decode( give_format_amount( $total ) ),
138
-					'gateway'   => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ),
139
-					'trans_id'  => give_get_payment_transaction_id( $payment->ID ),
137
+					'amount'    => html_entity_decode(give_format_amount($total)),
138
+					'gateway'   => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)),
139
+					'trans_id'  => give_get_payment_transaction_id($payment->ID),
140 140
 					'key'       => $payment_meta['key'],
141 141
 					'date'      => $payment->post_date,
142
-					'user'      => $user ? $user->display_name : __( 'guest', 'give' ),
143
-					'status'    => give_get_payment_status( $payment, true )
142
+					'user'      => $user ? $user->display_name : __('guest', 'give'),
143
+					'status'    => give_get_payment_status($payment, true)
144 144
 				);
145 145
 
146 146
 			}
147 147
 
148
-			$data = apply_filters( 'give_export_get_data', $data );
149
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
148
+			$data = apply_filters('give_export_get_data', $data);
149
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
150 150
 
151 151
 			return $data;
152 152
 
@@ -166,27 +166,27 @@  discard block
 block discarded – undo
166 166
 
167 167
 		$status = $this->status;
168 168
 		$args   = array(
169
-			'start-date' => date( 'n/d/Y', strtotime( $this->start ) ),
170
-			'end-date'   => date( 'n/d/Y', strtotime( $this->end ) ),
169
+			'start-date' => date('n/d/Y', strtotime($this->start)),
170
+			'end-date'   => date('n/d/Y', strtotime($this->end)),
171 171
 		);
172 172
 
173
-		if ( 'any' == $status ) {
173
+		if ('any' == $status) {
174 174
 
175
-			$total = array_sum( (array) give_count_payments( $args ) );
175
+			$total = array_sum((array) give_count_payments($args));
176 176
 
177 177
 		} else {
178 178
 
179
-			$total = give_count_payments( $args )->$status;
179
+			$total = give_count_payments($args)->$status;
180 180
 
181 181
 		}
182 182
 
183 183
 		$percentage = 100;
184 184
 
185
-		if ( $total > 0 ) {
186
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
185
+		if ($total > 0) {
186
+			$percentage = ((30 * $this->step) / $total) * 100;
187 187
 		}
188 188
 
189
-		if ( $percentage > 100 ) {
189
+		if ($percentage > 100) {
190 190
 			$percentage = 100;
191 191
 		}
192 192
 
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @param array $request The Form Data passed into the batch processing.
202 202
 	 */
203
-	public function set_properties( $request ) {
204
-		$this->start  = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
205
-		$this->end    = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
206
-		$this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
203
+	public function set_properties($request) {
204
+		$this->start  = isset($request['start']) ? sanitize_text_field($request['start']) : '';
205
+		$this->end    = isset($request['end']) ? sanitize_text_field($request['end']) : '';
206
+		$this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
207 207
 	}
208 208
 }
Please login to merge, or discard this patch.
includes/admin/reporting/class-export.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return bool Whether we can export or not
38 38
 	 */
39 39
 	public function can_export() {
40
-		return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) );
40
+		return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
 	 * @return void
49 49
 	 */
50 50
 	public function headers() {
51
-		ignore_user_abort( true );
51
+		ignore_user_abort(true);
52 52
 
53
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
54
-			set_time_limit( 0 );
53
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
54
+			set_time_limit(0);
55 55
 		}
56 56
 
57 57
 		nocache_headers();
58
-		header( 'Content-Type: text/csv; charset=utf-8' );
59
-		header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' );
60
-		header( "Expires: 0" );
58
+		header('Content-Type: text/csv; charset=utf-8');
59
+		header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv');
60
+		header("Expires: 0");
61 61
 	}
62 62
 
63 63
 	/**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function csv_cols() {
71 71
 		$cols = array(
72
-			'id'   => esc_html__( 'ID', 'give' ),
73
-			'date' => esc_html__( 'Date', 'give' )
72
+			'id'   => esc_html__('ID', 'give'),
73
+			'date' => esc_html__('Date', 'give')
74 74
 		);
75 75
 
76 76
 		return $cols;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	public function get_csv_cols() {
87 87
 		$cols = $this->csv_cols();
88 88
 
89
-		return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols );
89
+		return apply_filters("give_export_csv_cols_{$this->export_type}", $cols);
90 90
 	}
91 91
 
92 92
 	/**
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	public function csv_cols_out() {
101 101
 		$cols = $this->get_csv_cols();
102 102
 		$i    = 1;
103
-		foreach ( $cols as $col_id => $column ) {
104
-			echo '"' . addslashes( $column ) . '"';
105
-			echo $i == count( $cols ) ? '' : ',';
106
-			$i ++;
103
+		foreach ($cols as $col_id => $column) {
104
+			echo '"'.addslashes($column).'"';
105
+			echo $i == count($cols) ? '' : ',';
106
+			$i++;
107 107
 		}
108 108
 		echo "\r\n";
109 109
 	}
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 		$data = array(
121 121
 			0 => array(
122 122
 				'id'   => '',
123
-				'data' => date( 'F j, Y' )
123
+				'data' => date('F j, Y')
124 124
 			),
125 125
 			1 => array(
126 126
 				'id'   => '',
127
-				'data' => date( 'F j, Y' )
127
+				'data' => date('F j, Y')
128 128
 			)
129 129
 		);
130 130
 
131
-		$data = apply_filters( 'give_export_get_data', $data );
132
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
131
+		$data = apply_filters('give_export_get_data', $data);
132
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
133 133
 
134 134
 		return $data;
135 135
 	}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 		$cols = $this->get_csv_cols();
148 148
 
149 149
 		// Output each row
150
-		foreach ( $data as $row ) {
150
+		foreach ($data as $row) {
151 151
 			$i = 1;
152
-			foreach ( $row as $col_id => $column ) {
152
+			foreach ($row as $col_id => $column) {
153 153
 				// Make sure the column is valid
154
-				if ( array_key_exists( $col_id, $cols ) ) {
155
-					echo '"' . addslashes( $column ) . '"';
156
-					echo $i == count( $cols ) ? '' : ',';
157
-					$i ++;
154
+				if (array_key_exists($col_id, $cols)) {
155
+					echo '"'.addslashes($column).'"';
156
+					echo $i == count($cols) ? '' : ',';
157
+					$i++;
158 158
 				}
159 159
 			}
160 160
 			echo "\r\n";
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @return void
174 174
 	 */
175 175
 	public function export() {
176
-		if ( ! $this->can_export() ) {
177
-			wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
176
+		if ( ! $this->can_export()) {
177
+			wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
178 178
 		}
179 179
 
180 180
 		// Set headers
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateway-error-logs-list-table.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded.
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 		// Set parent defaults.
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records.
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
50 50
 			'ajax'     => false                        // Does this table support ajax?.
51
-		) );
51
+		));
52 52
 	}
53 53
 
54 54
 	/**
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string Column Name.
64 64
 	 */
65
-	public function column_default( $item, $column_name ) {
65
+	public function column_default($item, $column_name) {
66 66
 
67
-		switch ( $column_name ) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'payment_id' :
71
-				return empty( $item->payment_id ) ? esc_html__( 'n/a', 'give' ) : $item->payment_id;
71
+				return empty($item->payment_id) ? esc_html__('n/a', 'give') : $item->payment_id;
72 72
 			case 'gateway' :
73
-				return empty( $item->gateway ) ? esc_html__( 'n/a', 'give' ) : $item->gateway;
73
+				return empty($item->gateway) ? esc_html__('n/a', 'give') : $item->gateway;
74 74
 			case 'error' :
75
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' );
75
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give');
76 76
 			default:
77
-				return $item[ $column_name ];
77
+				return $item[$column_name];
78 78
 		}
79 79
 	}
80 80
 
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return void
90 90
 	 */
91
-	public function column_message( $item ) { ?>
92
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a>
91
+	public function column_message($item) { ?>
92
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a>
93 93
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
94 94
 			<?php
95 95
 
96
-			$log_message = get_post_field( 'post_content', $item['ID'] );
96
+			$log_message = get_post_field('post_content', $item['ID']);
97 97
 
98
-			$serialized = strpos( $log_message, '{"' );
98
+			$serialized = strpos($log_message, '{"');
99 99
 
100 100
 			// Check to see if the log message contains serialized information
101
-			if ( $serialized !== false ) {
102
-				$length = strlen( $log_message ) - $serialized;
103
-				$intro  = substr( $log_message, 0, - $length );
104
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
101
+			if ($serialized !== false) {
102
+				$length = strlen($log_message) - $serialized;
103
+				$intro  = substr($log_message, 0, - $length);
104
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
105 105
 
106
-				echo wpautop( $intro );
107
-				echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' );
108
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
106
+				echo wpautop($intro);
107
+				echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>');
108
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
109 109
 			} else {
110 110
 				// No serialized data found
111
-				echo wpautop( $log_message );
111
+				echo wpautop($log_message);
112 112
 			}
113 113
 			?>
114 114
 		</div>
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function get_columns() {
126 126
 		$columns = array(
127
-			'ID'         => esc_html__( 'Log ID', 'give' ),
128
-			'error'      => esc_html__( 'Error', 'give' ),
129
-			'gateway'    => esc_html__( 'Gateway', 'give' ),
130
-			'payment_id' => esc_html__( 'Donation ID', 'give' ),
131
-			'date'       => esc_html__( 'Date', 'give' ),
132
-			'message'    => esc_html__( 'Details', 'give' )
127
+			'ID'         => esc_html__('Log ID', 'give'),
128
+			'error'      => esc_html__('Error', 'give'),
129
+			'gateway'    => esc_html__('Gateway', 'give'),
130
+			'payment_id' => esc_html__('Donation ID', 'give'),
131
+			'date'       => esc_html__('Date', 'give'),
132
+			'message'    => esc_html__('Details', 'give')
133 133
 		);
134 134
 
135 135
 		return $columns;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return int Current page number
144 144
 	 */
145 145
 	public function get_paged() {
146
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
146
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
147 147
 	}
148 148
 
149 149
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @since  1.0
154 154
 	 * @return void
155 155
 	 */
156
-	public function bulk_actions( $which = '' ) {
156
+	public function bulk_actions($which = '') {
157 157
 		give_log_views();
158 158
 	}
159 159
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 		// Prevent the queries from getting cached.
173 173
 		// Without this there are occasional memory issues for some installs.
174
-		wp_suspend_cache_addition( true );
174
+		wp_suspend_cache_addition(true);
175 175
 
176 176
 		$logs_data = array();
177 177
 		$paged     = $this->get_paged();
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 			'paged'    => $paged
181 181
 		);
182 182
 
183
-		$logs = $give_logs->get_connected_logs( $log_query );
183
+		$logs = $give_logs->get_connected_logs($log_query);
184 184
 
185
-		if ( $logs ) {
186
-			foreach ( $logs as $log ) {
185
+		if ($logs) {
186
+			foreach ($logs as $log) {
187 187
 
188 188
 				$logs_data[] = array(
189 189
 					'ID'         => $log->ID,
190
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
190
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
191 191
 					'payment_id' => $log->post_parent,
192 192
 					'error'      => 'error',
193
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
193
+					'gateway'    => give_get_payment_gateway($log->post_parent),
194 194
 					'date'       => $log->post_date
195 195
 				);
196 196
 			}
@@ -212,19 +212,19 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @param string $which
214 214
 	 */
215
-	protected function display_tablenav( $which ) {
216
-		if ( 'top' === $which ) {
217
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
215
+	protected function display_tablenav($which) {
216
+		if ('top' === $which) {
217
+			wp_nonce_field('bulk-'.$this->_args['plural']);
218 218
 		}
219 219
 		?>
220
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
220
+		<div class="tablenav <?php echo esc_attr($which); ?>">
221 221
 
222 222
 			<div class="alignleft actions bulkactions">
223
-				<?php $this->bulk_actions( $which ); ?>
223
+				<?php $this->bulk_actions($which); ?>
224 224
 			</div>
225 225
 			<?php
226
-			$this->extra_tablenav( $which );
227
-			$this->pagination( $which );
226
+			$this->extra_tablenav($which);
227
+			$this->pagination($which);
228 228
 			?>
229 229
 
230 230
 			<br class="clear"/>
@@ -251,14 +251,14 @@  discard block
 block discarded – undo
251 251
 		$columns               = $this->get_columns();
252 252
 		$hidden                = array(); // No hidden columns
253 253
 		$sortable              = $this->get_sortable_columns();
254
-		$this->_column_headers = array( $columns, $hidden, $sortable );
254
+		$this->_column_headers = array($columns, $hidden, $sortable);
255 255
 		$this->items           = $this->get_logs();
256
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
256
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
257 257
 
258
-		$this->set_pagination_args( array(
258
+		$this->set_pagination_args(array(
259 259
 				'total_items' => $total_items,
260 260
 				'per_page'    => $this->per_page,
261
-				'total_pages' => ceil( $total_items / $this->per_page )
261
+				'total_pages' => ceil($total_items / $this->per_page)
262 262
 			)
263 263
 		);
264 264
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-export-earnings.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
 	 * @return void
39 39
 	 */
40 40
 	public function headers() {
41
-		ignore_user_abort( true );
41
+		ignore_user_abort(true);
42 42
 
43
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
44
-			set_time_limit( 0 );
43
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
44
+			set_time_limit(0);
45 45
 		}
46 46
 
47 47
 		nocache_headers();
48
-		header( 'Content-Type: text/csv; charset=utf-8' );
49
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' );
50
-		header( "Expires: 0" );
48
+		header('Content-Type: text/csv; charset=utf-8');
49
+		header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv');
50
+		header("Expires: 0");
51 51
 
52 52
 	}
53 53
 
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 	public function csv_cols() {
62 62
 
63 63
 		$cols = array(
64
-			'date'      => esc_html__( 'Date', 'give' ),
65
-			'donations' => esc_html__( 'Donations', 'give' ),
64
+			'date'      => esc_html__('Date', 'give'),
65
+			'donations' => esc_html__('Donations', 'give'),
66 66
 			/* translators: %s: currency */
67
-			'earnings'  => sprintf( esc_html__( 'Income (%s)', 'give' ), html_entity_decode( give_currency_filter( '' ) ) )
67
+			'earnings'  => sprintf(esc_html__('Income (%s)', 'give'), html_entity_decode(give_currency_filter('')))
68 68
 		);
69 69
 
70 70
 		return $cols;
@@ -79,28 +79,28 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function get_data() {
81 81
 
82
-		$start_year  = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' );
83
-		$end_year    = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' );
84
-		$start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' );
85
-		$end_month   = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' );
82
+		$start_year  = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y');
83
+		$end_year    = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y');
84
+		$start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n');
85
+		$end_month   = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n');
86 86
 
87 87
 		$data  = array();
88 88
 		$year  = $start_year;
89 89
 		$stats = new Give_Payment_Stats;
90 90
 
91
-		while ( $year <= $end_year ) {
91
+		while ($year <= $end_year) {
92 92
 
93
-			if ( $year == $start_year && $year == $end_year ) {
93
+			if ($year == $start_year && $year == $end_year) {
94 94
 
95 95
 				$m1 = $start_month;
96 96
 				$m2 = $end_month;
97 97
 
98
-			} elseif ( $year == $start_year ) {
98
+			} elseif ($year == $start_year) {
99 99
 
100 100
 				$m1 = $start_month;
101 101
 				$m2 = 12;
102 102
 
103
-			} elseif ( $year == $end_year ) {
103
+			} elseif ($year == $end_year) {
104 104
 
105 105
 				$m1 = 1;
106 106
 				$m2 = $end_month;
@@ -112,28 +112,28 @@  discard block
 block discarded – undo
112 112
 
113 113
 			}
114 114
 
115
-			while ( $m1 <= $m2 ) {
115
+			while ($m1 <= $m2) {
116 116
 
117
-				$date1 = mktime( 0, 0, 0, $m1, 1, $year );
118
-				$date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year );
117
+				$date1 = mktime(0, 0, 0, $m1, 1, $year);
118
+				$date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year);
119 119
 
120 120
 				$data[] = array(
121
-					'date'      => date_i18n( 'F Y', $date1 ),
122
-					'donations' => $stats->get_sales( 0, $date1, $date2 ),
123
-					'earnings'  => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ),
121
+					'date'      => date_i18n('F Y', $date1),
122
+					'donations' => $stats->get_sales(0, $date1, $date2),
123
+					'earnings'  => give_format_amount($stats->get_earnings(0, $date1, $date2)),
124 124
 				);
125 125
 
126
-				$m1 ++;
126
+				$m1++;
127 127
 
128 128
 			}
129 129
 
130 130
 
131
-			$year ++;
131
+			$year++;
132 132
 
133 133
 		}
134 134
 
135
-		$data = apply_filters( 'give_export_get_data', $data );
136
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
135
+		$data = apply_filters('give_export_get_data', $data);
136
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
137 137
 
138 138
 		return $data;
139 139
 	}
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,51 +24,51 @@  discard block
 block discarded – undo
24 24
 function give_hide_subscription_notices() {
25 25
 
26 26
     // Hide subscription notices permanently.
27
-    if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
27
+    if ( ! empty($_GET['_give_hide_license_notices_permanently'])) {
28 28
         global $current_user;
29 29
 
30 30
         // check previously disabled notice ids.
31
-        $already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
31
+        $already_dismiss_notices = ($already_dismiss_notices = get_user_meta($current_user->ID, '_give_hide_license_notices_permanently', true))
32 32
             ? $already_dismiss_notices
33 33
             : array();
34 34
 
35 35
         // Get notice id.
36
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
36
+        $notice_id = sanitize_text_field($_GET['_give_hide_license_notices_permanently']);
37 37
 
38
-        if( ! in_array( $notice_id, $already_dismiss_notices ) ) {
38
+        if ( ! in_array($notice_id, $already_dismiss_notices)) {
39 39
             $already_dismiss_notices[] = $notice_id;
40 40
         }
41 41
 
42 42
         // Store subscription ids.
43
-        update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
43
+        update_user_meta($current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices);
44 44
 
45 45
         // Redirect user.
46
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
46
+        wp_safe_redirect(remove_query_arg('_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI']));
47 47
         exit();
48 48
     }
49 49
 
50 50
     // Hide subscription notices shortly.
51
-    if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
51
+    if ( ! empty($_GET['_give_hide_license_notices_shortly'])) {
52 52
         global $current_user;
53 53
 
54 54
         // Get notice id.
55
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
55
+        $notice_id = sanitize_text_field($_GET['_give_hide_license_notices_shortly']);
56 56
 
57 57
         // Transient key name.
58 58
         $transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
59 59
 
60
-        if( get_transient( $transient_key ) ) {
60
+        if (get_transient($transient_key)) {
61 61
             return;
62 62
         }
63 63
 
64 64
 
65 65
         // Hide notice for 24 hours.
66
-        set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
66
+        set_transient($transient_key, true, 24 * HOUR_IN_SECONDS);
67 67
 
68 68
         // Redirect user.
69
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
69
+        wp_safe_redirect(remove_query_arg('_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI']));
70 70
         exit();
71 71
     }
72 72
 }
73 73
 
74
-add_action( 'admin_init', 'give_hide_subscription_notices' );
75 74
\ No newline at end of file
75
+add_action('admin_init', 'give_hide_subscription_notices');
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,52 +23,52 @@
 block discarded – undo
23 23
  */
24 24
 function give_hide_subscription_notices() {
25 25
 
26
-    // Hide subscription notices permanently.
27
-    if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
28
-        $current_user = wp_get_current_user();
26
+	// Hide subscription notices permanently.
27
+	if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
28
+		$current_user = wp_get_current_user();
29 29
 
30
-        // check previously disabled notice ids.
31
-        $already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
32
-            ? $already_dismiss_notices
33
-            : array();
30
+		// check previously disabled notice ids.
31
+		$already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
32
+			? $already_dismiss_notices
33
+			: array();
34 34
 
35
-        // Get notice id.
36
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
35
+		// Get notice id.
36
+		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
37 37
 
38
-        if( ! in_array( $notice_id, $already_dismiss_notices ) ) {
39
-            $already_dismiss_notices[] = $notice_id;
40
-        }
38
+		if( ! in_array( $notice_id, $already_dismiss_notices ) ) {
39
+			$already_dismiss_notices[] = $notice_id;
40
+		}
41 41
 
42
-        // Store subscription ids.
43
-        update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
42
+		// Store subscription ids.
43
+		update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
44 44
 
45
-        // Redirect user.
46
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
47
-        exit();
48
-    }
45
+		// Redirect user.
46
+		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
47
+		exit();
48
+	}
49 49
 
50
-    // Hide subscription notices shortly.
51
-    if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
52
-        $current_user = wp_get_current_user();
50
+	// Hide subscription notices shortly.
51
+	if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
52
+		$current_user = wp_get_current_user();
53 53
 
54
-        // Get notice id.
55
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
54
+		// Get notice id.
55
+		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
56 56
 
57
-        // Transient key name.
58
-        $transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
57
+		// Transient key name.
58
+		$transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
59 59
 
60
-        if( get_transient( $transient_key ) ) {
61
-            return;
62
-        }
60
+		if( get_transient( $transient_key ) ) {
61
+			return;
62
+		}
63 63
 
64 64
 
65
-        // Hide notice for 24 hours.
66
-        set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
65
+		// Hide notice for 24 hours.
66
+		set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
67 67
 
68
-        // Redirect user.
69
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
70
-        exit();
71
-    }
68
+		// Redirect user.
69
+		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
70
+		exit();
71
+	}
72 72
 }
73 73
 
74 74
 add_action( 'admin_init', 'give_hide_subscription_notices' );
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/customers/customer-actions.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
  * and redirect back to the donor interface for feedback
544 544
  *
545 545
  * @since  1.7
546
- * @return void|bool
546
+ * @return false|null
547 547
  */
548 548
 function give_remove_donor_email() {
549 549
 	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
  * and redirect back to the donor interface for feedback
584 584
  *
585 585
  * @since  1.7
586
- * @return void|bool
586
+ * @return false|null
587 587
  */
588 588
 function give_set_donor_primary_email() {
589 589
 	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
Please login to merge, or discard this patch.
Spacing   +185 added lines, -185 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,15 +23,15 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array $output Response messages
25 25
  */
26
-function give_edit_customer( $args ) {
26
+function give_edit_customer($args) {
27 27
 	
28
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
28
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
29 29
 
30
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
31
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
31
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( empty( $args ) ) {
34
+	if (empty($args)) {
35 35
 		return;
36 36
 	}
37 37
 
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	$customer_id   = (int) $args['customerinfo']['id'];
40 40
 	$nonce         = $args['_wpnonce'];
41 41
 
42
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
43
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
42
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
43
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
44 44
 	}
45 45
 
46
-	$customer = new Give_Customer( $customer_id );
47
-	if ( empty( $customer->id ) ) {
46
+	$customer = new Give_Customer($customer_id);
47
+	if (empty($customer->id)) {
48 48
 		return false;
49 49
 	}
50 50
 
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
 		'user_id' => 0
54 54
 	);
55 55
 
56
-	$customer_info = wp_parse_args( $customer_info, $defaults );
56
+	$customer_info = wp_parse_args($customer_info, $defaults);
57 57
 
58
-	if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) {
58
+	if ((int) $customer_info['user_id'] != (int) $customer->user_id) {
59 59
 
60 60
 		// Make sure we don't already have this user attached to a customer
61
-		if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) {
62
-			give_set_error( 'give-invalid-customer-user_id', sprintf( esc_html__( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) );
61
+		if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) {
62
+			give_set_error('give-invalid-customer-user_id', sprintf(esc_html__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id']));
63 63
 		}
64 64
 
65 65
 		// Make sure it's actually a user
66
-		$user = get_user_by( 'id', $customer_info['user_id'] );
67
-		if ( ! empty( $customer_info['user_id'] ) && false === $user ) {
68
-			give_set_error( 'give-invalid-user_id', sprintf( esc_html__( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) );
66
+		$user = get_user_by('id', $customer_info['user_id']);
67
+		if ( ! empty($customer_info['user_id']) && false === $user) {
68
+			give_set_error('give-invalid-user_id', sprintf(esc_html__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id']));
69 69
 		}
70 70
 
71 71
 	}
@@ -73,52 +73,52 @@  discard block
 block discarded – undo
73 73
 	// Record this for later
74 74
 	$previous_user_id = $customer->user_id;
75 75
 
76
-	if ( give_get_errors() ) {
76
+	if (give_get_errors()) {
77 77
 		return;
78 78
 	}
79 79
 
80 80
 	// Setup the customer address, if present
81 81
 	$address = array();
82
-	if ( intval( $customer_info['user_id'] ) > 0 ) {
82
+	if (intval($customer_info['user_id']) > 0) {
83 83
 
84
-		$current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true );
84
+		$current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true);
85 85
 
86
-		if ( false === $current_address ) {
87
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : '';
88
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : '';
89
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : '';
90
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : '';
91
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : '';
92
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : '';
86
+		if (false === $current_address) {
87
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : '';
88
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : '';
89
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : '';
90
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : '';
91
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : '';
92
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : '';
93 93
 		} else {
94
-			$current_address    = wp_parse_args( $current_address, array(
94
+			$current_address    = wp_parse_args($current_address, array(
95 95
 				'line1',
96 96
 				'line2',
97 97
 				'city',
98 98
 				'zip',
99 99
 				'state',
100 100
 				'country'
101
-			) );
102
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1'];
103
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2'];
104
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city'];
105
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country'];
106
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip'];
107
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state'];
101
+			));
102
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1'];
103
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2'];
104
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city'];
105
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country'];
106
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip'];
107
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state'];
108 108
 		}
109 109
 
110 110
 	}
111 111
 
112 112
 	// Sanitize the inputs
113 113
 	$customer_data            = array();
114
-	$customer_data['name']    = strip_tags( stripslashes( $customer_info['name'] ) );
114
+	$customer_data['name']    = strip_tags(stripslashes($customer_info['name']));
115 115
 	$customer_data['user_id'] = $customer_info['user_id'];
116 116
 
117
-	$customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id );
118
-	$address       = apply_filters( 'give_edit_customer_address', $address, $customer_id );
117
+	$customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id);
118
+	$address       = apply_filters('give_edit_customer_address', $address, $customer_id);
119 119
 
120
-	$customer_data = array_map( 'sanitize_text_field', $customer_data );
121
-	$address       = array_map( 'sanitize_text_field', $address );
120
+	$customer_data = array_map('sanitize_text_field', $customer_data);
121
+	$address       = array_map('sanitize_text_field', $address);
122 122
 
123 123
 
124 124
 	/**
@@ -130,27 +130,27 @@  discard block
 block discarded – undo
130 130
 	 * @param array $customer_data The customer data.
131 131
 	 * @param array $address       The customer address.
132 132
 	 */
133
-	do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address );
133
+	do_action('give_pre_edit_customer', $customer_id, $customer_data, $address);
134 134
 
135
-	$output         = array();
135
+	$output = array();
136 136
 
137
-	if ( $customer->update( $customer_data ) ) {
137
+	if ($customer->update($customer_data)) {
138 138
 
139
-		if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) {
140
-			update_user_meta( $customer->user_id, '_give_user_address', $address );
139
+		if ( ! empty($customer->user_id) && $customer->user_id > 0) {
140
+			update_user_meta($customer->user_id, '_give_user_address', $address);
141 141
 		}
142 142
 
143 143
 		// Update some donation meta if we need to
144
-		$payments_array = explode( ',', $customer->payment_ids );
144
+		$payments_array = explode(',', $customer->payment_ids);
145 145
 
146
-		if ( $customer->user_id != $previous_user_id ) {
147
-			foreach ( $payments_array as $payment_id ) {
148
-				give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id );
146
+		if ($customer->user_id != $previous_user_id) {
147
+			foreach ($payments_array as $payment_id) {
148
+				give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id);
149 149
 			}
150 150
 		}
151 151
 
152 152
 		$output['success']       = true;
153
-		$customer_data           = array_merge( $customer_data, $address );
153
+		$customer_data           = array_merge($customer_data, $address);
154 154
 		$output['customer_info'] = $customer_data;
155 155
 
156 156
 	} else {
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 	 * @param int   $customer_id   The ID of the customer.
168 168
 	 * @param array $customer_data The customer data.
169 169
 	 */
170
-	do_action( 'give_post_edit_customer', $customer_id, $customer_data );
170
+	do_action('give_post_edit_customer', $customer_id, $customer_data);
171 171
 
172
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
173
-		header( 'Content-Type: application/json' );
174
-		echo json_encode( $output );
172
+	if (defined('DOING_AJAX') && DOING_AJAX) {
173
+		header('Content-Type: application/json');
174
+		echo json_encode($output);
175 175
 		wp_die();
176 176
 	}
177 177
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
 }
181 181
 
182
-add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 );
182
+add_action('give_edit-customer', 'give_edit_customer', 10, 1);
183 183
 
184 184
 /**
185 185
  * Save a customer note being added
@@ -190,36 +190,36 @@  discard block
 block discarded – undo
190 190
  *
191 191
  * @return int         The Note ID that was saved, or 0 if nothing was saved
192 192
  */
193
-function give_customer_save_note( $args ) {
193
+function give_customer_save_note($args) {
194 194
 
195
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
195
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
196 196
 
197
-	if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) {
198
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
197
+	if ( ! is_admin() || ! current_user_can($customer_view_role)) {
198
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
199 199
 	}
200 200
 
201
-	if ( empty( $args ) ) {
201
+	if (empty($args)) {
202 202
 		return;
203 203
 	}
204 204
 
205
-	$customer_note = trim( sanitize_text_field( $args['customer_note'] ) );
205
+	$customer_note = trim(sanitize_text_field($args['customer_note']));
206 206
 	$customer_id   = (int) $args['customer_id'];
207 207
 	$nonce         = $args['add_customer_note_nonce'];
208 208
 
209
-	if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) {
210
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
209
+	if ( ! wp_verify_nonce($nonce, 'add-customer-note')) {
210
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
211 211
 	}
212 212
 
213
-	if ( empty( $customer_note ) ) {
214
-		give_set_error( 'empty-customer-note', esc_html__( 'A note is required.', 'give' ) );
213
+	if (empty($customer_note)) {
214
+		give_set_error('empty-customer-note', esc_html__('A note is required.', 'give'));
215 215
 	}
216 216
 
217
-	if ( give_get_errors() ) {
217
+	if (give_get_errors()) {
218 218
 		return;
219 219
 	}
220 220
 
221
-	$customer = new Give_Customer( $customer_id );
222
-	$new_note = $customer->add_note( $customer_note );
221
+	$customer = new Give_Customer($customer_id);
222
+	$new_note = $customer->add_note($customer_note);
223 223
 
224 224
 	/**
225 225
 	 * Fires before inserting customer note.
@@ -229,22 +229,22 @@  discard block
 block discarded – undo
229 229
 	 * @param int    $customer_id The ID of the customer.
230 230
 	 * @param string $new_note    Note content.
231 231
 	 */
232
-	do_action( 'give_pre_insert_customer_note', $customer_id, $new_note );
232
+	do_action('give_pre_insert_customer_note', $customer_id, $new_note);
233 233
 
234
-	if ( ! empty( $new_note ) && ! empty( $customer->id ) ) {
234
+	if ( ! empty($new_note) && ! empty($customer->id)) {
235 235
 
236 236
 		ob_start();
237 237
 		?>
238 238
 		<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
239 239
 			<span class="note-content-wrap">
240
-				<?php echo stripslashes( $new_note ); ?>
240
+				<?php echo stripslashes($new_note); ?>
241 241
 			</span>
242 242
 		</div>
243 243
 		<?php
244 244
 		$output = ob_get_contents();
245 245
 		ob_end_clean();
246 246
 
247
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
247
+		if (defined('DOING_AJAX') && DOING_AJAX) {
248 248
 			echo $output;
249 249
 			exit;
250 250
 		}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
 }
259 259
 
260
-add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 );
260
+add_action('give_add-customer-note', 'give_customer_save_note', 10, 1);
261 261
 
262 262
 /**
263 263
  * Delete a customer
@@ -268,37 +268,37 @@  discard block
 block discarded – undo
268 268
  *
269 269
  * @return int Whether it was a successful deletion
270 270
  */
271
-function give_customer_delete( $args ) {
271
+function give_customer_delete($args) {
272 272
 
273
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
273
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
274 274
 
275
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
276
-		wp_die( esc_html__( 'You do not have permission to delete donors.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
275
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
276
+		wp_die(esc_html__('You do not have permission to delete donors.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
277 277
 	}
278 278
 
279
-	if ( empty( $args ) ) {
279
+	if (empty($args)) {
280 280
 		return;
281 281
 	}
282 282
 
283 283
 	$customer_id = (int) $args['customer_id'];
284
-	$confirm     = ! empty( $args['give-customer-delete-confirm'] ) ? true : false;
285
-	$remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false;
284
+	$confirm     = ! empty($args['give-customer-delete-confirm']) ? true : false;
285
+	$remove_data = ! empty($args['give-customer-delete-records']) ? true : false;
286 286
 	$nonce       = $args['_wpnonce'];
287 287
 
288
-	if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) {
289
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
288
+	if ( ! wp_verify_nonce($nonce, 'delete-customer')) {
289
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
290 290
 	}
291 291
 
292
-	if ( ! $confirm ) {
293
-		give_set_error( 'customer-delete-no-confirm', esc_html__( 'Please confirm you want to delete this donor.', 'give' ) );
292
+	if ( ! $confirm) {
293
+		give_set_error('customer-delete-no-confirm', esc_html__('Please confirm you want to delete this donor.', 'give'));
294 294
 	}
295 295
 
296
-	if ( give_get_errors() ) {
297
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) );
296
+	if (give_get_errors()) {
297
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id));
298 298
 		exit;
299 299
 	}
300 300
 
301
-	$customer = new Give_Customer( $customer_id );
301
+	$customer = new Give_Customer($customer_id);
302 302
 
303 303
 	/**
304 304
 	 * Fires before deleting customer.
@@ -309,53 +309,53 @@  discard block
 block discarded – undo
309 309
 	 * @param bool $confirm     Delete confirmation.
310 310
 	 * @param bool $remove_data Records delete confirmation.
311 311
 	 */
312
-	do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data );
312
+	do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data);
313 313
 	
314
-	if ( $customer->id > 0 ) {
314
+	if ($customer->id > 0) {
315 315
 
316
-		$payments_array = explode( ',', $customer->payment_ids );
317
-		$success        = Give()->customers->delete( $customer->id );
316
+		$payments_array = explode(',', $customer->payment_ids);
317
+		$success        = Give()->customers->delete($customer->id);
318 318
 
319
-		if ( $success ) {
319
+		if ($success) {
320 320
 
321
-			if ( $remove_data ) {
321
+			if ($remove_data) {
322 322
 
323 323
 				// Remove all donations, logs, etc
324
-				foreach ( $payments_array as $payment_id ) {
325
-					give_delete_purchase( $payment_id );
324
+				foreach ($payments_array as $payment_id) {
325
+					give_delete_purchase($payment_id);
326 326
 				}
327 327
 
328 328
 			} else {
329 329
 
330 330
 				// Just set the donations to customer_id of 0
331
-				foreach ( $payments_array as $payment_id ) {
332
-					give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 );
331
+				foreach ($payments_array as $payment_id) {
332
+					give_update_payment_meta($payment_id, '_give_payment_customer_id', 0);
333 333
 				}
334 334
 
335 335
 			}
336 336
 
337
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' );
337
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted');
338 338
 
339 339
 		} else {
340 340
 
341
-			give_set_error( 'give-donor-delete-failed', esc_html__( 'Error deleting donor.', 'give' ) );
342
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id );
341
+			give_set_error('give-donor-delete-failed', esc_html__('Error deleting donor.', 'give'));
342
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id);
343 343
 
344 344
 		}
345 345
 
346 346
 	} else {
347 347
 
348
-		give_set_error( 'give-customer-delete-invalid-id', esc_html__( 'Invalid Donor ID.', 'give' ) );
349
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
348
+		give_set_error('give-customer-delete-invalid-id', esc_html__('Invalid Donor ID.', 'give'));
349
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
350 350
 
351 351
 	}
352 352
 
353
-	wp_redirect( $redirect );
353
+	wp_redirect($redirect);
354 354
 	exit;
355 355
 
356 356
 }
357 357
 
358
-add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 );
358
+add_action('give_delete-customer', 'give_customer_delete', 10, 1);
359 359
 
360 360
 /**
361 361
  * Disconnect a user ID from a donor
@@ -366,27 +366,27 @@  discard block
 block discarded – undo
366 366
  *
367 367
  * @return bool        If the disconnect was successful
368 368
  */
369
-function give_disconnect_customer_user_id( $args ) {
369
+function give_disconnect_customer_user_id($args) {
370 370
 
371
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
371
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
372 372
 
373
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
374
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
373
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
374
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
375 375
 	}
376 376
 
377
-	if ( empty( $args ) ) {
377
+	if (empty($args)) {
378 378
 		return;
379 379
 	}
380 380
 
381 381
 	$customer_id = (int) $args['customer_id'];
382 382
 	$nonce       = $args['_wpnonce'];
383 383
 
384
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
385
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
384
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
385
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
386 386
 	}
387 387
 
388
-	$customer = new Give_Customer( $customer_id );
389
-	if ( empty( $customer->id ) ) {
388
+	$customer = new Give_Customer($customer_id);
389
+	if (empty($customer->id)) {
390 390
 		return false;
391 391
 	}
392 392
 
@@ -400,16 +400,16 @@  discard block
 block discarded – undo
400 400
 	 * @param int $customer_id The ID of the customer.
401 401
 	 * @param int $user_id     The ID of the user.
402 402
 	 */
403
-	do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $user_id );
403
+	do_action('give_pre_customer_disconnect_user_id', $customer_id, $user_id);
404 404
 
405 405
 	$output = array();
406
-	$customer_args = array( 'user_id' => 0 );
406
+	$customer_args = array('user_id' => 0);
407 407
 
408
-	if ( $customer->update( $customer_args ) ) {
408
+	if ($customer->update($customer_args)) {
409 409
 		global $wpdb;
410 410
 
411
-		if ( ! empty( $customer->payment_ids ) ) {
412
-			$wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" );
411
+		if ( ! empty($customer->payment_ids)) {
412
+			$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )");
413 413
 		}
414 414
 
415 415
 		$output['success'] = true;
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	} else {
418 418
 
419 419
 		$output['success'] = false;
420
-		give_set_error( 'give-disconnect-user-fail', esc_html__( 'Failed to disconnect user from donor.', 'give' ) );
420
+		give_set_error('give-disconnect-user-fail', esc_html__('Failed to disconnect user from donor.', 'give'));
421 421
 	}
422 422
 
423 423
 	/**
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
 	 *
428 428
 	 * @param int $customer_id The ID of the customer.
429 429
 	 */
430
-	do_action( 'give_post_customer_disconnect_user_id', $customer_id );
430
+	do_action('give_post_customer_disconnect_user_id', $customer_id);
431 431
 
432
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
433
-		header( 'Content-Type: application/json' );
434
-		echo json_encode( $output );
432
+	if (defined('DOING_AJAX') && DOING_AJAX) {
433
+		header('Content-Type: application/json');
434
+		echo json_encode($output);
435 435
 		wp_die();
436 436
 	}
437 437
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
 }
441 441
 
442
-add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 );
442
+add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1);
443 443
 
444 444
 /**
445 445
  * Add an email address to the donor from within the admin and log a donor note
@@ -448,81 +448,81 @@  discard block
 block discarded – undo
448 448
  * @param  array $args  Array of arguments: nonce, customer id, and email address
449 449
  * @return mixed        If DOING_AJAX echos out JSON, otherwise returns array of success (bool) and message (string)
450 450
  */
451
-function give_add_donor_email( $args ) {
452
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
451
+function give_add_donor_email($args) {
452
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
453 453
 
454
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
455
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'edit' ) );
454
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
455
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'edit'));
456 456
 	}
457 457
 
458 458
 	$output = array();
459
-	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
459
+	if (empty($args) || empty($args['email']) || empty($args['customer_id'])) {
460 460
 		$output['success'] = false;
461
-		if ( empty( $args['email'] ) ) {
462
-			$output['message'] = esc_html__( 'Email address is required.', 'give' );
463
-		} else if ( empty( $args['customer_id'] ) ) {
464
-			$output['message'] = esc_html__( 'Customer ID is required.', 'give' );
461
+		if (empty($args['email'])) {
462
+			$output['message'] = esc_html__('Email address is required.', 'give');
463
+		} else if (empty($args['customer_id'])) {
464
+			$output['message'] = esc_html__('Customer ID is required.', 'give');
465 465
 		} else {
466
-			$output['message'] = esc_html__( 'An error has occurred. Please try again.', 'give' );
466
+			$output['message'] = esc_html__('An error has occurred. Please try again.', 'give');
467 467
 		}
468
-	} else if ( ! wp_verify_nonce( $args['_wpnonce'], 'give_add_donor_email' ) ) {
468
+	} else if ( ! wp_verify_nonce($args['_wpnonce'], 'give_add_donor_email')) {
469 469
 		$output = array(
470 470
 			'success' => false,
471
-			'message' => esc_html__( 'Nonce verification failed.', 'give' ),
471
+			'message' => esc_html__('Nonce verification failed.', 'give'),
472 472
 		);
473
-	} else if ( ! is_email( $args['email'] ) ) {
473
+	} else if ( ! is_email($args['email'])) {
474 474
 		$output = array(
475 475
 			'success' => false,
476
-			'message' => esc_html__( 'Invalid email address.', 'give' ),
476
+			'message' => esc_html__('Invalid email address.', 'give'),
477 477
 		);
478 478
 	} else {
479
-		$email       = sanitize_email($args['email'] );
479
+		$email       = sanitize_email($args['email']);
480 480
 		$customer_id = (int) $args['customer_id'];
481 481
 		$primary     = 'true' === $args['primary'] ? true : false;
482
-		$customer    = new Give_Customer( $customer_id );
483
-		if ( false === $customer->add_email( $email, $primary ) ) {
484
-			if ( in_array( $email, $customer->emails ) ) {
482
+		$customer    = new Give_Customer($customer_id);
483
+		if (false === $customer->add_email($email, $primary)) {
484
+			if (in_array($email, $customer->emails)) {
485 485
 				$output = array(
486 486
 					'success'  => false,
487
-					'message'  => esc_html__( 'Email already associated with this donor.', 'give' ),
487
+					'message'  => esc_html__('Email already associated with this donor.', 'give'),
488 488
 				);
489 489
 			} else {
490 490
 				$output = array(
491 491
 					'success' => false,
492
-					'message' => esc_html__( 'Email address is already associated with another donor.', 'give' ),
492
+					'message' => esc_html__('Email address is already associated with another donor.', 'give'),
493 493
 				);
494 494
 			}
495 495
 		} else {
496
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id . '&give-message=email-added' );
496
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id.'&give-message=email-added');
497 497
 			$output = array(
498 498
 				'success'  => true,
499
-				'message'  => esc_html__( 'Email successfully added to donor.', 'give' ),
499
+				'message'  => esc_html__('Email successfully added to donor.', 'give'),
500 500
 				'redirect' => $redirect,
501 501
 			);
502 502
 
503 503
 			$user          = wp_get_current_user();
504
-			$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
505
-			$customer_note = sprintf( __( 'Email address %s added by %s', 'give' ), $email, $user_login );
506
-			$customer->add_note( $customer_note );
504
+			$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
505
+			$customer_note = sprintf(__('Email address %s added by %s', 'give'), $email, $user_login);
506
+			$customer->add_note($customer_note);
507 507
 
508
-			if ( $primary ) {
509
-				$customer_note = sprintf( __( 'Email address %s set as primary by %s', 'give' ), $email, $user_login );
510
-				$customer->add_note( $customer_note );
508
+			if ($primary) {
509
+				$customer_note = sprintf(__('Email address %s set as primary by %s', 'give'), $email, $user_login);
510
+				$customer->add_note($customer_note);
511 511
 			}
512 512
 		}
513 513
 	}
514 514
 
515
-	do_action( 'give_post_add_customer_email', $customer_id, $args );
515
+	do_action('give_post_add_customer_email', $customer_id, $args);
516 516
 
517
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
518
-		header( 'Content-Type: application/json' );
519
-		echo json_encode( $output );
517
+	if (defined('DOING_AJAX') && DOING_AJAX) {
518
+		header('Content-Type: application/json');
519
+		echo json_encode($output);
520 520
 		wp_die();
521 521
 	}
522 522
 
523 523
 	return $output;
524 524
 }
525
-add_action( 'give_add_donor_email', 'give_add_donor_email', 10, 1 );
525
+add_action('give_add_donor_email', 'give_add_donor_email', 10, 1);
526 526
 
527 527
 
528 528
 /**
@@ -533,36 +533,36 @@  discard block
 block discarded – undo
533 533
  * @return void|bool
534 534
  */
535 535
 function give_remove_donor_email() {
536
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
536
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
537 537
 		return false;
538 538
 	}
539
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
539
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
540 540
 		return false;
541 541
 	}
542
-	if ( empty( $_GET['_wpnonce'] ) ) {
542
+	if (empty($_GET['_wpnonce'])) {
543 543
 		return false;
544 544
 	}
545 545
 
546 546
 	$nonce = $_GET['_wpnonce'];
547
-	if ( ! wp_verify_nonce( $nonce, 'give-remove-donor-email' ) ) {
548
-		wp_die( esc_html__( 'Nonce verification failed', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
547
+	if ( ! wp_verify_nonce($nonce, 'give-remove-donor-email')) {
548
+		wp_die(esc_html__('Nonce verification failed', 'give'), esc_html__('Error', 'give'), array('response' => 403));
549 549
 	}
550 550
 
551
-	$customer = new Give_Customer( $_GET['id'] );
552
-	if ( $customer->remove_email( $_GET['email'] ) ) {
553
-		$url = add_query_arg( 'give-message', 'email-removed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ) );
551
+	$customer = new Give_Customer($_GET['id']);
552
+	if ($customer->remove_email($_GET['email'])) {
553
+		$url = add_query_arg('give-message', 'email-removed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id));
554 554
 		$user          = wp_get_current_user();
555
-		$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
556
-		$customer_note = sprintf( __( 'Email address %s removed by %s', 'give' ), $_GET['email'], $user_login );
557
-		$customer->add_note( $customer_note );
555
+		$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
556
+		$customer_note = sprintf(__('Email address %s removed by %s', 'give'), $_GET['email'], $user_login);
557
+		$customer->add_note($customer_note);
558 558
 	} else {
559
-		$url = add_query_arg( 'give-message', 'email-remove-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ) );
559
+		$url = add_query_arg('give-message', 'email-remove-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id));
560 560
 	}
561 561
 
562
-	wp_safe_redirect( $url );
562
+	wp_safe_redirect($url);
563 563
 	exit;
564 564
 }
565
-add_action( 'give_remove_donor_email', 'give_remove_donor_email', 10 );
565
+add_action('give_remove_donor_email', 'give_remove_donor_email', 10);
566 566
 
567 567
 
568 568
 /**
@@ -573,38 +573,38 @@  discard block
 block discarded – undo
573 573
  * @return void|bool
574 574
  */
575 575
 function give_set_donor_primary_email() {
576
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
576
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
577 577
 		return false;
578 578
 	}
579 579
 
580
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
580
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
581 581
 		return false;
582 582
 	}
583 583
 
584
-	if ( empty( $_GET['_wpnonce'] ) ) {
584
+	if (empty($_GET['_wpnonce'])) {
585 585
 		return false;
586 586
 	}
587 587
 
588 588
 	$nonce = $_GET['_wpnonce'];
589 589
 
590
-	if ( ! wp_verify_nonce( $nonce, 'give-set-donor-primary-email' ) ) {
591
-		wp_die( esc_html__( 'Nonce verification failed', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
590
+	if ( ! wp_verify_nonce($nonce, 'give-set-donor-primary-email')) {
591
+		wp_die(esc_html__('Nonce verification failed', 'give'), esc_html__('Error', 'give'), array('response' => 403));
592 592
 	}
593 593
 
594
-	$donor = new Give_Customer( $_GET['id'] );
594
+	$donor = new Give_Customer($_GET['id']);
595 595
 
596
-	if ( $donor->set_primary_email( $_GET['email'] ) ) {
597
-		$url = add_query_arg( 'give-message', 'primary-email-updated', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
596
+	if ($donor->set_primary_email($_GET['email'])) {
597
+		$url = add_query_arg('give-message', 'primary-email-updated', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
598 598
 		$user          = wp_get_current_user();
599
-		$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
600
-		$donor_note    = sprintf( __( 'Email address %s set as primary by %s', 'give' ), $_GET['email'], $user_login );
599
+		$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
600
+		$donor_note    = sprintf(__('Email address %s set as primary by %s', 'give'), $_GET['email'], $user_login);
601 601
 
602
-		$donor->add_note( $donor_note );
602
+		$donor->add_note($donor_note);
603 603
 	} else {
604
-		$url = add_query_arg( 'give-message', 'primary-email-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
604
+		$url = add_query_arg('give-message', 'primary-email-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
605 605
 	}
606 606
 
607
-	wp_safe_redirect( $url );
607
+	wp_safe_redirect($url);
608 608
 	exit;
609 609
 }
610
-add_action( 'give_set_donor_primary_email', 'give_set_donor_primary_email', 10 );
610
+add_action('give_set_donor_primary_email', 'give_set_donor_primary_email', 10);
Please login to merge, or discard this patch.
includes/class-give-customer.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 	 * @access public
891 891
 	 *
892 892
 	 * @param  string $meta_key   Metadata name. Default is empty.
893
-	 * @param  mixed  $meta_value Metadata value.
893
+	 * @param  string  $meta_value Metadata value.
894 894
 	 * @param  bool   $unique     Optional. Whether the same key should not be added. Default is false.
895 895
 	 *
896 896
 	 * @return bool               False for failure. True for success.
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 	 * @access public
923 923
 	 *
924 924
 	 * @param  string $meta_key   Metadata name. Default is empty.
925
-	 * @param  mixed  $meta_value Optional. Metadata value. Default is empty.
925
+	 * @param  string  $meta_value Optional. Metadata value. Default is empty.
926 926
 	 *
927 927
 	 * @return bool               False for failure. True for success.
928 928
 	 */
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -714,12 +714,12 @@  discard block
 block discarded – undo
714 714
 
715 715
 	/**
716 716
 	 * Decrease/Increase a customer's lifetime value.
717
-     *
718
-     * This function will update donation stat on basis of current amount and new amount donation difference.
719
-     * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat.
720
-     *
717
+	 *
718
+	 * This function will update donation stat on basis of current amount and new amount donation difference.
719
+	 * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat.
720
+	 *
721 721
 	 * @since  1.0
722
-     * @access public
722
+	 * @access public
723 723
 	 *
724 724
 	 * @param  float $curr_amount Current Donation amount.
725 725
 	 * @param  float $new_amount  New (changed) Donation amount.
@@ -727,35 +727,35 @@  discard block
 block discarded – undo
727 727
 	 * @return mixed              If successful, the new donation stat value, otherwise false.
728 728
 	 */
729 729
 	public function update_donation_value( $curr_amount, $new_amount ) {
730
-        /**
731
-         * Payment total difference value can be:
732
-         *  zero   (in case amount not change)
733
-         *  or -ve (in case amount decrease)
734
-         *  or +ve (in case amount increase)
735
-         */
736
-        $payment_total_diff = $new_amount - $curr_amount;
737
-
738
-        // We do not need to update donation stat if donation did not change.
739
-        if( ! $payment_total_diff ) {
740
-            return false;
741
-        }
742
-
743
-
744
-        if( $payment_total_diff > 0 ) {
745
-            $this->increase_value( $payment_total_diff );
746
-        } else {
747
-            // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
748
-            $this->decrease_value( -$payment_total_diff );
749
-        }
750
-
751
-        return $this->purchase_value;
730
+		/**
731
+		 * Payment total difference value can be:
732
+		 *  zero   (in case amount not change)
733
+		 *  or -ve (in case amount decrease)
734
+		 *  or +ve (in case amount increase)
735
+		 */
736
+		$payment_total_diff = $new_amount - $curr_amount;
737
+
738
+		// We do not need to update donation stat if donation did not change.
739
+		if( ! $payment_total_diff ) {
740
+			return false;
741
+		}
742
+
743
+
744
+		if( $payment_total_diff > 0 ) {
745
+			$this->increase_value( $payment_total_diff );
746
+		} else {
747
+			// Pass payment total difference as +ve value to decrease amount from user lifetime stat.
748
+			$this->decrease_value( -$payment_total_diff );
749
+		}
750
+
751
+		return $this->purchase_value;
752 752
 	}
753 753
 
754 754
 	/**
755 755
 	 * Get the parsed notes for a customer as an array.
756 756
 	 *
757 757
 	 * @since  1.0
758
-     * @access public
758
+	 * @access public
759 759
 	 *
760 760
 	 * @param  int $length The number of notes to get.
761 761
 	 * @param  int $paged  What note to start at.
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	 * Get the total number of notes we have after parsing.
781 781
 	 *
782 782
 	 * @since  1.0
783
-     * @access public
783
+	 * @access public
784 784
 	 *
785 785
 	 * @return int The number of notes for the customer.
786 786
 	 */
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	 * Add a note for the customer.
798 798
 	 *
799 799
 	 * @since  1.0
800
-     * @access public
800
+	 * @access public
801 801
 	 *
802 802
 	 * @param  string $note   The note to add. Default is empty.
803 803
 	 *
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 	 * Get the notes column for the customer
857 857
 	 *
858 858
 	 * @since  1.0
859
-     * @access private
859
+	 * @access private
860 860
 	 *
861 861
 	 * @return string The Notes for the customer, non-parsed.
862 862
 	 */
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
 	 * Sanitize the data for update/create
935 935
 	 *
936 936
 	 * @since  1.0
937
-     * @access private
937
+	 * @access private
938 938
 	 *
939 939
 	 * @param  array $data The data to sanitize.
940 940
 	 *
Please login to merge, or discard this patch.
Spacing   +169 added lines, -169 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
 
@@ -144,29 +144,29 @@  discard block
 block discarded – undo
144 144
 	 * @param  bool $_id_or_email 
145 145
 	 * @param  bool $by_user_id
146 146
 	 */
147
-	public function __construct( $_id_or_email = false, $by_user_id = false ) {
147
+	public function __construct($_id_or_email = false, $by_user_id = false) {
148 148
 
149 149
 		$this->db = new Give_DB_Customers;
150 150
 
151
-		if ( false === $_id_or_email || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) ) {
151
+		if (false === $_id_or_email || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))) {
152 152
 			return false;
153 153
 		}
154 154
 
155
-		$by_user_id = is_bool( $by_user_id ) ? $by_user_id : false;
155
+		$by_user_id = is_bool($by_user_id) ? $by_user_id : false;
156 156
 
157
-		if ( is_numeric( $_id_or_email ) ) {
157
+		if (is_numeric($_id_or_email)) {
158 158
 			$field = $by_user_id ? 'user_id' : 'id';
159 159
 		} else {
160 160
 			$field = 'email';
161 161
 		}
162 162
 
163
-		$customer = $this->db->get_customer_by( $field, $_id_or_email );
163
+		$customer = $this->db->get_customer_by($field, $_id_or_email);
164 164
 
165
-		if ( empty( $customer ) || ! is_object( $customer ) ) {
165
+		if (empty($customer) || ! is_object($customer)) {
166 166
 			return false;
167 167
 		}
168 168
 
169
-		$this->setup_customer( $customer );
169
+		$this->setup_customer($customer);
170 170
 
171 171
 	}
172 172
 
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
 	 *
183 183
 	 * @return bool             If the setup was successful or not.
184 184
 	 */
185
-	private function setup_customer( $customer ) {
185
+	private function setup_customer($customer) {
186 186
 
187
-		if ( ! is_object( $customer ) ) {
187
+		if ( ! is_object($customer)) {
188 188
 			return false;
189 189
 		}
190 190
 
191
-		foreach ( $customer as $key => $value ) {
191
+		foreach ($customer as $key => $value) {
192 192
 
193
-			switch ( $key ) {
193
+			switch ($key) {
194 194
 
195 195
 				case 'notes':
196 196
 					$this->$key = $this->get_notes();
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 		}
206 206
 
207 207
 		// Get donor's all email including primary email.
208
-		$this->emails   = (array) $this->get_meta( 'additional_email', false );
209
-		$this->emails = array( 'primary' => $this->email ) + $this->emails;
208
+		$this->emails = (array) $this->get_meta('additional_email', false);
209
+		$this->emails = array('primary' => $this->email) + $this->emails;
210 210
 
211 211
 		// Customer ID and email are the only things that are necessary, make sure they exist.
212
-		if ( ! empty( $this->id ) && ! empty( $this->email ) ) {
212
+		if ( ! empty($this->id) && ! empty($this->email)) {
213 213
 			return true;
214 214
 		}
215 215
 
@@ -223,16 +223,16 @@  discard block
 block discarded – undo
223 223
 	 * @since  1.0
224 224
 	 * @access public
225 225
 	 */
226
-	public function __get( $key ) {
226
+	public function __get($key) {
227 227
 
228
-		if ( method_exists( $this, 'get_' . $key ) ) {
228
+		if (method_exists($this, 'get_'.$key)) {
229 229
 
230
-			return call_user_func( array( $this, 'get_' . $key ) );
230
+			return call_user_func(array($this, 'get_'.$key));
231 231
 
232 232
 		} else {
233 233
 
234 234
 			/* translators: %s: property key */
235
-			return new WP_Error( 'give-customer-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
235
+			return new WP_Error('give-customer-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
236 236
 
237 237
 		}
238 238
 
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @return bool|int    False if not a valid creation, customer ID if user is found or valid creation.
250 250
 	 */
251
-	public function create( $data = array() ) {
251
+	public function create($data = array()) {
252 252
 
253
-		if ( $this->id != 0 || empty( $data ) ) {
253
+		if ($this->id != 0 || empty($data)) {
254 254
 			return false;
255 255
 		}
256 256
 
@@ -258,15 +258,15 @@  discard block
 block discarded – undo
258 258
 			'payment_ids' => ''
259 259
 		);
260 260
 
261
-		$args = wp_parse_args( $data, $defaults );
262
-		$args = $this->sanitize_columns( $args );
261
+		$args = wp_parse_args($data, $defaults);
262
+		$args = $this->sanitize_columns($args);
263 263
 
264
-		if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) {
264
+		if (empty($args['email']) || ! is_email($args['email'])) {
265 265
 			return false;
266 266
 		}
267 267
 
268
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
269
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
268
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
269
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
270 270
 		}
271 271
 
272 272
 		/**
@@ -276,18 +276,18 @@  discard block
 block discarded – undo
276 276
 		 *
277 277
 		 * @param array $args Customer attributes.
278 278
 		 */
279
-		do_action( 'give_customer_pre_create', $args );
279
+		do_action('give_customer_pre_create', $args);
280 280
 
281 281
 		$created = false;
282 282
 
283 283
 		// The DB class 'add' implies an update if the customer being asked to be created already exists
284
-		if ( $this->db->add( $data ) ) {
284
+		if ($this->db->add($data)) {
285 285
 
286 286
 			// We've successfully added/updated the customer, reset the class vars with the new data
287
-			$customer = $this->db->get_customer_by( 'email', $args['email'] );
287
+			$customer = $this->db->get_customer_by('email', $args['email']);
288 288
 
289 289
 			// Setup the customer data with the values from DB
290
-			$this->setup_customer( $customer );
290
+			$this->setup_customer($customer);
291 291
 
292 292
 			$created = $this->id;
293 293
 		}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		 *                          customer ID if user is found or valid creation.
302 302
 		 * @param array    $args    Customer attributes.
303 303
 		 */
304
-		do_action( 'give_customer_post_create', $created, $args );
304
+		do_action('give_customer_post_create', $created, $args);
305 305
 
306 306
 		return $created;
307 307
 
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @return bool        If the update was successful or not.
319 319
 	 */
320
-	public function update( $data = array() ) {
320
+	public function update($data = array()) {
321 321
 
322
-		if ( empty( $data ) ) {
322
+		if (empty($data)) {
323 323
 			return false;
324 324
 		}
325 325
 
326
-		$data = $this->sanitize_columns( $data );
326
+		$data = $this->sanitize_columns($data);
327 327
 
328 328
 		/**
329 329
 		 * Fires before updating customers.
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 		 * @param int   $customer_id Customer id.
334 334
 		 * @param array $data        Customer attributes.
335 335
 		 */
336
-		do_action( 'give_customer_pre_update', $this->id, $data );
336
+		do_action('give_customer_pre_update', $this->id, $data);
337 337
 
338 338
 		$updated = false;
339 339
 
340
-		if ( $this->db->update( $this->id, $data ) ) {
340
+		if ($this->db->update($this->id, $data)) {
341 341
 
342
-			$customer = $this->db->get_customer_by( 'id', $this->id );
343
-			$this->setup_customer( $customer );
342
+			$customer = $this->db->get_customer_by('id', $this->id);
343
+			$this->setup_customer($customer);
344 344
 
345 345
 			$updated = true;
346 346
 		}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 		 * @param int   $customer_id Customer id.
355 355
 		 * @param array $data        Customer attributes.
356 356
 		 */
357
-		do_action( 'give_customer_post_update', $updated, $this->id, $data );
357
+		do_action('give_customer_post_update', $updated, $this->id, $data);
358 358
 
359 359
 		return $updated;
360 360
 	}
@@ -372,27 +372,27 @@  discard block
 block discarded – undo
372 372
 	 *
373 373
 	 * @return bool            If the attachment was successfuly.
374 374
 	 */
375
-	public function attach_payment( $payment_id = 0, $update_stats = true ) {
375
+	public function attach_payment($payment_id = 0, $update_stats = true) {
376 376
 
377
-		if ( empty( $payment_id ) ) {
377
+		if (empty($payment_id)) {
378 378
 			return false;
379 379
 		}
380 380
 
381
-		if ( empty( $this->payment_ids ) ) {
381
+		if (empty($this->payment_ids)) {
382 382
 
383 383
 			$new_payment_ids = $payment_id;
384 384
 
385 385
 		} else {
386 386
 
387
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
387
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
388 388
 
389
-			if ( in_array( $payment_id, $payment_ids ) ) {
389
+			if (in_array($payment_id, $payment_ids)) {
390 390
 				$update_stats = false;
391 391
 			}
392 392
 
393 393
 			$payment_ids[] = $payment_id;
394 394
 
395
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
395
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
396 396
 
397 397
 		}
398 398
 
@@ -404,20 +404,20 @@  discard block
 block discarded – undo
404 404
 		 * @param int $payment_id  Payment id.
405 405
 		 * @param int $customer_id Customer id.
406 406
 		 */
407
-		do_action( 'give_customer_pre_attach_payment', $payment_id, $this->id );
407
+		do_action('give_customer_pre_attach_payment', $payment_id, $this->id);
408 408
 
409
-		$payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) );
409
+		$payment_added = $this->update(array('payment_ids' => $new_payment_ids));
410 410
 
411
-		if ( $payment_added ) {
411
+		if ($payment_added) {
412 412
 
413 413
 			$this->payment_ids = $new_payment_ids;
414 414
 
415 415
 			// We added this payment successfully, increment the stats
416
-			if ( $update_stats ) {
417
-				$payment_amount = give_get_payment_amount( $payment_id );
416
+			if ($update_stats) {
417
+				$payment_amount = give_get_payment_amount($payment_id);
418 418
 
419
-				if ( ! empty( $payment_amount ) ) {
420
-					$this->increase_value( $payment_amount );
419
+				if ( ! empty($payment_amount)) {
420
+					$this->increase_value($payment_amount);
421 421
 				}
422 422
 
423 423
 				$this->increase_purchase_count();
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		 * @param int  $payment_id    Payment id.
435 435
 		 * @param int  $customer_id   Customer id.
436 436
 		 */
437
-		do_action( 'give_customer_post_attach_payment', $payment_added, $payment_id, $this->id );
437
+		do_action('give_customer_post_attach_payment', $payment_added, $payment_id, $this->id);
438 438
 
439 439
 		return $payment_added;
440 440
 	}
@@ -452,33 +452,33 @@  discard block
 block discarded – undo
452 452
 	 *
453 453
 	 * @return boolean               If the removal was successful.
454 454
 	 */
455
-	public function remove_payment( $payment_id = 0, $update_stats = true ) {
455
+	public function remove_payment($payment_id = 0, $update_stats = true) {
456 456
 
457
-		if ( empty( $payment_id ) ) {
457
+		if (empty($payment_id)) {
458 458
 			return false;
459 459
 		}
460 460
 
461
-		$payment = new Give_Payment( $payment_id );
461
+		$payment = new Give_Payment($payment_id);
462 462
 
463
-		if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) {
463
+		if ('publish' !== $payment->status && 'revoked' !== $payment->status) {
464 464
 			$update_stats = false;
465 465
 		}
466 466
 
467 467
 		$new_payment_ids = '';
468 468
 
469
-		if ( ! empty( $this->payment_ids ) ) {
469
+		if ( ! empty($this->payment_ids)) {
470 470
 
471
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
471
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
472 472
 
473
-			$pos = array_search( $payment_id, $payment_ids );
474
-			if ( false === $pos ) {
473
+			$pos = array_search($payment_id, $payment_ids);
474
+			if (false === $pos) {
475 475
 				return false;
476 476
 			}
477 477
 
478
-			unset( $payment_ids[ $pos ] );
479
-			$payment_ids = array_filter( $payment_ids );
478
+			unset($payment_ids[$pos]);
479
+			$payment_ids = array_filter($payment_ids);
480 480
 
481
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
481
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
482 482
 
483 483
 		}
484 484
 
@@ -490,20 +490,20 @@  discard block
 block discarded – undo
490 490
 		 * @param int $payment_id  Payment id.
491 491
 		 * @param int $customer_id Customer id.
492 492
 		 */
493
-		do_action( 'give_customer_pre_remove_payment', $payment_id, $this->id );
493
+		do_action('give_customer_pre_remove_payment', $payment_id, $this->id);
494 494
 
495
-		$payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) );
495
+		$payment_removed = $this->update(array('payment_ids' => $new_payment_ids));
496 496
 
497
-		if ( $payment_removed ) {
497
+		if ($payment_removed) {
498 498
 
499 499
 			$this->payment_ids = $new_payment_ids;
500 500
 
501
-			if ( $update_stats ) {
501
+			if ($update_stats) {
502 502
 				// We removed this payment successfully, decrement the stats
503
-				$payment_amount = give_get_payment_amount( $payment_id );
503
+				$payment_amount = give_get_payment_amount($payment_id);
504 504
 
505
-				if ( ! empty( $payment_amount ) ) {
506
-					$this->decrease_value( $payment_amount );
505
+				if ( ! empty($payment_amount)) {
506
+					$this->decrease_value($payment_amount);
507 507
 				}
508 508
 
509 509
 				$this->decrease_purchase_count();
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		 * @param int  $payment_id      Payment id.
521 521
 		 * @param int  $customer_id     Customer id.
522 522
 		 */
523
-		do_action( 'give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id );
523
+		do_action('give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id);
524 524
 
525 525
 		return $payment_removed;
526 526
 
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
 	 *
537 537
 	 * @return int        The donation count.
538 538
 	 */
539
-	public function increase_purchase_count( $count = 1 ) {
539
+	public function increase_purchase_count($count = 1) {
540 540
 
541 541
 		// Make sure it's numeric and not negative.
542
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
542
+		if ( ! is_numeric($count) || $count != absint($count)) {
543 543
 			return false;
544 544
 		}
545 545
 
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
 		 * @param int $count       The number to increase by.
554 554
 		 * @param int $customer_id Customer id.
555 555
 		 */
556
-		do_action( 'give_customer_pre_increase_purchase_count', $count, $this->id );
556
+		do_action('give_customer_pre_increase_purchase_count', $count, $this->id);
557 557
 
558
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
558
+		if ($this->update(array('purchase_count' => $new_total))) {
559 559
 			$this->purchase_count = $new_total;
560 560
 		}
561 561
 
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 		 * @param int $count          The number increased by.
569 569
 		 * @param int $customer_id    Customer id.
570 570
 		 */
571
-		do_action( 'give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id );
571
+		do_action('give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id);
572 572
 
573 573
 		return $this->purchase_count;
574 574
 	}
@@ -583,16 +583,16 @@  discard block
 block discarded – undo
583 583
 	 *
584 584
 	 * @return mixed      If successful, the new count, otherwise false.
585 585
 	 */
586
-	public function decrease_purchase_count( $count = 1 ) {
586
+	public function decrease_purchase_count($count = 1) {
587 587
 
588 588
 		// Make sure it's numeric and not negative
589
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
589
+		if ( ! is_numeric($count) || $count != absint($count)) {
590 590
 			return false;
591 591
 		}
592 592
 
593 593
 		$new_total = (int) $this->purchase_count - (int) $count;
594 594
 
595
-		if ( $new_total < 0 ) {
595
+		if ($new_total < 0) {
596 596
 			$new_total = 0;
597 597
 		}
598 598
 
@@ -604,9 +604,9 @@  discard block
 block discarded – undo
604 604
 		 * @param int $count       The number to decrease by.
605 605
 		 * @param int $customer_id Customer id.
606 606
 		 */
607
-		do_action( 'give_customer_pre_decrease_purchase_count', $count, $this->id );
607
+		do_action('give_customer_pre_decrease_purchase_count', $count, $this->id);
608 608
 
609
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
609
+		if ($this->update(array('purchase_count' => $new_total))) {
610 610
 			$this->purchase_count = $new_total;
611 611
 		}
612 612
 
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 		 * @param int $count          The number decreased by.
620 620
 		 * @param int $customer_id    Customer id.
621 621
 		 */
622
-		do_action( 'give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id );
622
+		do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id);
623 623
 
624 624
 		return $this->purchase_count;
625 625
 	}
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
 	 *
635 635
 	 * @return mixed        If successful, the new value, otherwise false.
636 636
 	 */
637
-	public function increase_value( $value = 0.00 ) {
637
+	public function increase_value($value = 0.00) {
638 638
 
639
-		$new_value = floatval( $this->purchase_value ) + $value;
639
+		$new_value = floatval($this->purchase_value) + $value;
640 640
 
641 641
 		/**
642 642
 		 * Fires before increasing customer lifetime value.
@@ -646,9 +646,9 @@  discard block
 block discarded – undo
646 646
 		 * @param float $value       The value to increase by.
647 647
 		 * @param int   $customer_id Customer id.
648 648
 		 */
649
-		do_action( 'give_customer_pre_increase_value', $value, $this->id );
649
+		do_action('give_customer_pre_increase_value', $value, $this->id);
650 650
 
651
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
651
+		if ($this->update(array('purchase_value' => $new_value))) {
652 652
 			$this->purchase_value = $new_value;
653 653
 		}
654 654
 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 		 * @param float $value          The value increased by.
662 662
 		 * @param int   $customer_id    Customer id.
663 663
 		 */
664
-		do_action( 'give_customer_post_increase_value', $this->purchase_value, $value, $this->id );
664
+		do_action('give_customer_post_increase_value', $this->purchase_value, $value, $this->id);
665 665
 
666 666
 		return $this->purchase_value;
667 667
 	}
@@ -676,11 +676,11 @@  discard block
 block discarded – undo
676 676
 	 *
677 677
 	 * @return mixed        If successful, the new value, otherwise false.
678 678
 	 */
679
-	public function decrease_value( $value = 0.00 ) {
679
+	public function decrease_value($value = 0.00) {
680 680
 
681
-		$new_value = floatval( $this->purchase_value ) - $value;
681
+		$new_value = floatval($this->purchase_value) - $value;
682 682
 
683
-		if ( $new_value < 0 ) {
683
+		if ($new_value < 0) {
684 684
 			$new_value = 0.00;
685 685
 		}
686 686
 
@@ -692,9 +692,9 @@  discard block
 block discarded – undo
692 692
 		 * @param float $value       The value to decrease by.
693 693
 		 * @param int   $customer_id Customer id.
694 694
 		 */
695
-		do_action( 'give_customer_pre_decrease_value', $value, $this->id );
695
+		do_action('give_customer_pre_decrease_value', $value, $this->id);
696 696
 
697
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
697
+		if ($this->update(array('purchase_value' => $new_value))) {
698 698
 			$this->purchase_value = $new_value;
699 699
 		}
700 700
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 		 * @param float $value          The value decreased by.
708 708
 		 * @param int   $customer_id    Customer id.
709 709
 		 */
710
-		do_action( 'give_customer_post_decrease_value', $this->purchase_value, $value, $this->id );
710
+		do_action('give_customer_post_decrease_value', $this->purchase_value, $value, $this->id);
711 711
 
712 712
 		return $this->purchase_value;
713 713
 	}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 	 *
727 727
 	 * @return mixed              If successful, the new donation stat value, otherwise false.
728 728
 	 */
729
-	public function update_donation_value( $curr_amount, $new_amount ) {
729
+	public function update_donation_value($curr_amount, $new_amount) {
730 730
         /**
731 731
          * Payment total difference value can be:
732 732
          *  zero   (in case amount not change)
@@ -736,13 +736,13 @@  discard block
 block discarded – undo
736 736
         $payment_total_diff = $new_amount - $curr_amount;
737 737
 
738 738
         // We do not need to update donation stat if donation did not change.
739
-        if( ! $payment_total_diff ) {
739
+        if ( ! $payment_total_diff) {
740 740
             return false;
741 741
         }
742 742
 
743 743
 
744
-        if( $payment_total_diff > 0 ) {
745
-            $this->increase_value( $payment_total_diff );
744
+        if ($payment_total_diff > 0) {
745
+            $this->increase_value($payment_total_diff);
746 746
         } else {
747 747
             // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
748 748
             $this->decrease_value( -$payment_total_diff );
@@ -762,15 +762,15 @@  discard block
 block discarded – undo
762 762
 	 *
763 763
 	 * @return array       The notes requested.
764 764
 	 */
765
-	public function get_notes( $length = 20, $paged = 1 ) {
765
+	public function get_notes($length = 20, $paged = 1) {
766 766
 
767
-		$length = is_numeric( $length ) ? $length : 20;
768
-		$offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0;
767
+		$length = is_numeric($length) ? $length : 20;
768
+		$offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0;
769 769
 
770 770
 		$all_notes   = $this->get_raw_notes();
771
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
771
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
772 772
 
773
-		$desired_notes = array_slice( $notes_array, $offset, $length );
773
+		$desired_notes = array_slice($notes_array, $offset, $length);
774 774
 
775 775
 		return $desired_notes;
776 776
 
@@ -787,9 +787,9 @@  discard block
 block discarded – undo
787 787
 	public function get_notes_count() {
788 788
 
789 789
 		$all_notes   = $this->get_raw_notes();
790
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
790
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
791 791
 
792
-		return count( $notes_array );
792
+		return count($notes_array);
793 793
 
794 794
 	}
795 795
 
@@ -803,22 +803,22 @@  discard block
 block discarded – undo
803 803
 	 *
804 804
 	 * @return string|boolean The new note if added successfully, false otherwise.
805 805
 	 */
806
-	public function add_note( $note = '' ) {
806
+	public function add_note($note = '') {
807 807
 
808
-		$note = trim( $note );
809
-		if ( empty( $note ) ) {
808
+		$note = trim($note);
809
+		if (empty($note)) {
810 810
 			return false;
811 811
 		}
812 812
 
813 813
 		$notes = $this->get_raw_notes();
814 814
 
815
-		if ( empty( $notes ) ) {
815
+		if (empty($notes)) {
816 816
 			$notes = '';
817 817
 		}
818 818
 
819
-		$note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note;
820
-		$new_note    = apply_filters( 'give_customer_add_note_string', $note_string );
821
-		$notes .= "\n\n" . $new_note;
819
+		$note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note;
820
+		$new_note    = apply_filters('give_customer_add_note_string', $note_string);
821
+		$notes .= "\n\n".$new_note;
822 822
 
823 823
 		/**
824 824
 		 * Fires before customer note added.
@@ -828,11 +828,11 @@  discard block
 block discarded – undo
828 828
 		 * @param string $new_note    New note to add.
829 829
 		 * @param int    $customer_id Customer id.
830 830
 		 */
831
-		do_action( 'give_customer_pre_add_note', $new_note, $this->id );
831
+		do_action('give_customer_pre_add_note', $new_note, $this->id);
832 832
 
833
-		$updated = $this->update( array( 'notes' => $notes ) );
833
+		$updated = $this->update(array('notes' => $notes));
834 834
 
835
-		if ( $updated ) {
835
+		if ($updated) {
836 836
 			$this->notes = $this->get_notes();
837 837
 		}
838 838
 
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 		 * @param string $new_note       New note added.
846 846
 		 * @param int    $customer_id    Customer id.
847 847
 		 */
848
-		do_action( 'give_customer_post_add_note', $this->notes, $new_note, $this->id );
848
+		do_action('give_customer_post_add_note', $this->notes, $new_note, $this->id);
849 849
 
850 850
 		// Return the formatted note, so we can test, as well as update any displays
851 851
 		return $new_note;
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 	 */
863 863
 	private function get_raw_notes() {
864 864
 
865
-		$all_notes = $this->db->get_column( 'notes', $this->id );
865
+		$all_notes = $this->db->get_column('notes', $this->id);
866 866
 
867 867
 		return $all_notes;
868 868
 
@@ -879,8 +879,8 @@  discard block
 block discarded – undo
879 879
 	 *
880 880
 	 * @return mixed            Will be an array if $single is false. Will be value of meta data field if $single is true.
881 881
 	 */
882
-	public function get_meta( $meta_key = '', $single = true ) {
883
-		return Give()->customer_meta->get_meta( $this->id, $meta_key, $single );
882
+	public function get_meta($meta_key = '', $single = true) {
883
+		return Give()->customer_meta->get_meta($this->id, $meta_key, $single);
884 884
 	}
885 885
 
886 886
 	/**
@@ -895,8 +895,8 @@  discard block
 block discarded – undo
895 895
 	 *
896 896
 	 * @return bool               False for failure. True for success.
897 897
 	 */
898
-	public function add_meta( $meta_key = '', $meta_value, $unique = false ) {
899
-		return Give()->customer_meta->add_meta( $this->id, $meta_key, $meta_value, $unique );
898
+	public function add_meta($meta_key = '', $meta_value, $unique = false) {
899
+		return Give()->customer_meta->add_meta($this->id, $meta_key, $meta_value, $unique);
900 900
 	}
901 901
 
902 902
 	/**
@@ -911,8 +911,8 @@  discard block
 block discarded – undo
911 911
 	 *
912 912
 	 * @return bool               False on failure, true if success.
913 913
 	 */
914
-	public function update_meta( $meta_key = '', $meta_value, $prev_value = '' ) {
915
-		return Give()->customer_meta->update_meta( $this->id, $meta_key, $meta_value, $prev_value );
914
+	public function update_meta($meta_key = '', $meta_value, $prev_value = '') {
915
+		return Give()->customer_meta->update_meta($this->id, $meta_key, $meta_value, $prev_value);
916 916
 	}
917 917
 
918 918
 	/**
@@ -926,8 +926,8 @@  discard block
 block discarded – undo
926 926
 	 *
927 927
 	 * @return bool               False for failure. True for success.
928 928
 	 */
929
-	public function delete_meta( $meta_key = '', $meta_value = '' ) {
930
-		return Give()->customer_meta->delete_meta( $this->id, $meta_key, $meta_value );
929
+	public function delete_meta($meta_key = '', $meta_value = '') {
930
+		return Give()->customer_meta->delete_meta($this->id, $meta_key, $meta_value);
931 931
 	}
932 932
 
933 933
 	/**
@@ -940,51 +940,51 @@  discard block
 block discarded – undo
940 940
 	 *
941 941
 	 * @return array       The sanitized data, based off column defaults.
942 942
 	 */
943
-	private function sanitize_columns( $data ) {
943
+	private function sanitize_columns($data) {
944 944
 
945 945
 		$columns        = $this->db->get_columns();
946 946
 		$default_values = $this->db->get_column_defaults();
947 947
 
948
-		foreach ( $columns as $key => $type ) {
948
+		foreach ($columns as $key => $type) {
949 949
 
950 950
 			// Only sanitize data that we were provided
951
-			if ( ! array_key_exists( $key, $data ) ) {
951
+			if ( ! array_key_exists($key, $data)) {
952 952
 				continue;
953 953
 			}
954 954
 
955
-			switch ( $type ) {
955
+			switch ($type) {
956 956
 
957 957
 				case '%s':
958
-					if ( 'email' == $key ) {
959
-						$data[ $key ] = sanitize_email( $data[ $key ] );
960
-					} elseif ( 'notes' == $key ) {
961
-						$data[ $key ] = strip_tags( $data[ $key ] );
958
+					if ('email' == $key) {
959
+						$data[$key] = sanitize_email($data[$key]);
960
+					} elseif ('notes' == $key) {
961
+						$data[$key] = strip_tags($data[$key]);
962 962
 					} else {
963
-						$data[ $key ] = sanitize_text_field( $data[ $key ] );
963
+						$data[$key] = sanitize_text_field($data[$key]);
964 964
 					}
965 965
 					break;
966 966
 
967 967
 				case '%d':
968
-					if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) {
969
-						$data[ $key ] = $default_values[ $key ];
968
+					if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) {
969
+						$data[$key] = $default_values[$key];
970 970
 					} else {
971
-						$data[ $key ] = absint( $data[ $key ] );
971
+						$data[$key] = absint($data[$key]);
972 972
 					}
973 973
 					break;
974 974
 
975 975
 				case '%f':
976 976
 					// Convert what was given to a float
977
-					$value = floatval( $data[ $key ] );
977
+					$value = floatval($data[$key]);
978 978
 
979
-					if ( ! is_float( $value ) ) {
980
-						$data[ $key ] = $default_values[ $key ];
979
+					if ( ! is_float($value)) {
980
+						$data[$key] = $default_values[$key];
981 981
 					} else {
982
-						$data[ $key ] = $value;
982
+						$data[$key] = $value;
983 983
 					}
984 984
 					break;
985 985
 
986 986
 				default:
987
-					$data[ $key ] = sanitize_text_field( $data[ $key ] );
987
+					$data[$key] = sanitize_text_field($data[$key]);
988 988
 					break;
989 989
 
990 990
 			}
@@ -1002,33 +1002,33 @@  discard block
 block discarded – undo
1002 1002
 	 * @param  bool   $primary Allows setting the email added as the primary
1003 1003
 	 * @return bool            If the email was added successfully
1004 1004
 	 */
1005
-	public function add_email( $email = '', $primary = false ) {
1006
-		if( ! is_email( $email ) ) {
1005
+	public function add_email($email = '', $primary = false) {
1006
+		if ( ! is_email($email)) {
1007 1007
 			return false;
1008 1008
 		}
1009
-		$existing = new Give_Customer( $email );
1009
+		$existing = new Give_Customer($email);
1010 1010
 
1011
-		if( $existing->id > 0 ) {
1011
+		if ($existing->id > 0) {
1012 1012
 			// Email address already belongs to another customer
1013 1013
 			return false;
1014 1014
 		}
1015 1015
 
1016
-		if ( email_exists( $email ) ) {
1017
-			$user = get_user_by( 'email', $email );
1018
-			if ( $user->ID != $this->user_id ) {
1016
+		if (email_exists($email)) {
1017
+			$user = get_user_by('email', $email);
1018
+			if ($user->ID != $this->user_id) {
1019 1019
 				return false;
1020 1020
 			}
1021 1021
 		}
1022 1022
 
1023
-		do_action( 'give_donor_pre_add_email', $email, $this->id, $this );
1023
+		do_action('give_donor_pre_add_email', $email, $this->id, $this);
1024 1024
 
1025 1025
 		// Add is used to ensure duplicate emails are not added
1026
-		$ret = (bool) $this->add_meta( 'additional_email', $email );
1026
+		$ret = (bool) $this->add_meta('additional_email', $email);
1027 1027
 
1028
-		do_action( 'give_donor_post_add_email', $email, $this->id, $this );
1028
+		do_action('give_donor_post_add_email', $email, $this->id, $this);
1029 1029
 
1030
-		if ( $ret && true === $primary ) {
1031
-			$this->set_primary_email( $email );
1030
+		if ($ret && true === $primary) {
1031
+			$this->set_primary_email($email);
1032 1032
 		}
1033 1033
 
1034 1034
 		return $ret;
@@ -1042,16 +1042,16 @@  discard block
 block discarded – undo
1042 1042
 	 * @param  string $email The email address to remove from the customer
1043 1043
 	 * @return bool          If the email was removeed successfully
1044 1044
 	 */
1045
-	public function remove_email( $email = '' ) {
1046
-		if( ! is_email( $email ) ) {
1045
+	public function remove_email($email = '') {
1046
+		if ( ! is_email($email)) {
1047 1047
 			return false;
1048 1048
 		}
1049 1049
 
1050
-		do_action( 'give_donor_pre_remove_email', $email, $this->id, $this );
1050
+		do_action('give_donor_pre_remove_email', $email, $this->id, $this);
1051 1051
 
1052
-		$ret = (bool) $this->delete_meta( 'additional_email', $email );
1052
+		$ret = (bool) $this->delete_meta('additional_email', $email);
1053 1053
 
1054
-		do_action( 'give_donor_post_remove_email', $email, $this->id, $this );
1054
+		do_action('give_donor_post_remove_email', $email, $this->id, $this);
1055 1055
 
1056 1056
 		return $ret;
1057 1057
 	}
@@ -1065,16 +1065,16 @@  discard block
 block discarded – undo
1065 1065
 	 * @param  string $new_primary_email The email address to remove from the customer
1066 1066
 	 * @return bool                      If the email was set as primary successfully
1067 1067
 	 */
1068
-	public function set_primary_email( $new_primary_email = '' ) {
1069
-		if( ! is_email( $new_primary_email ) ) {
1068
+	public function set_primary_email($new_primary_email = '') {
1069
+		if ( ! is_email($new_primary_email)) {
1070 1070
 			return false;
1071 1071
 		}
1072 1072
 
1073
-		do_action( 'give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this );
1073
+		do_action('give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this);
1074 1074
 
1075
-		$existing = new Give_Customer( $new_primary_email );
1075
+		$existing = new Give_Customer($new_primary_email);
1076 1076
 
1077
-		if( $existing->id > 0 && (int) $existing->id !== (int) $this->id ) {
1077
+		if ($existing->id > 0 && (int) $existing->id !== (int) $this->id) {
1078 1078
 			// This email belongs to another customer
1079 1079
 			return false;
1080 1080
 		}
@@ -1082,21 +1082,21 @@  discard block
 block discarded – undo
1082 1082
 		$old_email = $this->email;
1083 1083
 
1084 1084
 		// Update customer record with new email
1085
-		$update = $this->update( array( 'email' => $new_primary_email ) );
1085
+		$update = $this->update(array('email' => $new_primary_email));
1086 1086
 
1087 1087
 		// Remove new primary from list of additional emails
1088
-		$remove = $this->remove_email( $new_primary_email );
1088
+		$remove = $this->remove_email($new_primary_email);
1089 1089
 
1090 1090
 		// Add old email to additional emails list
1091
-		$add = $this->add_email( $old_email );
1091
+		$add = $this->add_email($old_email);
1092 1092
 
1093 1093
 		$ret = $update && $remove && $add;
1094 1094
 
1095
-		if( $ret ) {
1095
+		if ($ret) {
1096 1096
 			$this->email = $new_primary_email;
1097 1097
 		}
1098 1098
 
1099
-		do_action( 'give_donor_post_set_primary_email', $new_primary_email, $this->id, $this );
1099
+		do_action('give_donor_post_set_primary_email', $new_primary_email, $this->id, $this);
1100 1100
 
1101 1101
 		return $ret;
1102 1102
 	}
Please login to merge, or discard this patch.
includes/forms/template.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param  array  $args An array of form arguments.
23 23
  *
24
- * @return string Donation form.
24
+ * @return false|null Donation form.
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
  *
1360 1360
  * @param  int  $form_id The form ID.
1361 1361
  *
1362
- * @return void|bool
1362
+ * @return false|null
1363 1363
  */
1364 1364
 function give_terms_agreement( $form_id ) {
1365 1365
 	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
  * @param  int   $form_id The form ID.
1553 1553
  * @param  array $args    An array of form arguments.
1554 1554
  *
1555
- * @return mixed
1555
+ * @return boolean
1556 1556
  */
1557 1557
 function give_show_goal_progress( $form_id, $args ) {
1558 1558
 
Please login to merge, or discard this patch.
Spacing   +393 added lines, -393 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,47 +23,47 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id,
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID.
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts.
58
-	if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) {
58
+	if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) {
59 59
 		return false;
60 60
 	}
61 61
 
62 62
 	//Get the form wrap CSS classes.
63
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
63
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
64 64
 
65 65
 	//Get the <form> tag wrap CSS classes.
66
-	$form_classes = $form->get_form_classes( $args );
66
+	$form_classes = $form->get_form_classes($args);
67 67
 
68 68
 	ob_start();
69 69
 
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
 	 * @param int   $form_id The form ID.
76 76
 	 * @param array $args    An array of form arguments.
77 77
 	 */
78
-	do_action( 'give_pre_form_output', $form->ID, $args );
78
+	do_action('give_pre_form_output', $form->ID, $args);
79 79
 
80 80
 	?>
81 81
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
82 82
 
83
-		<?php if ( $form->is_close_donation_form() ) {
83
+		<?php if ($form->is_close_donation_form()) {
84 84
 
85 85
 			//Get Goal thank you message.
86
-			$display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
87
-			$display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' );
86
+			$display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
87
+			$display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give');
88 88
 
89 89
 			//Print thank you message.
90
-			apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) );
90
+			apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success'));
91 91
 
92 92
 		} else {
93 93
 
94
-			if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
94
+			if (isset($args['show_title']) && $args['show_title'] == true) {
95 95
 
96
-				echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
96
+				echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
97 97
 
98 98
 			}
99 99
 
@@ -105,19 +105,19 @@  discard block
 block discarded – undo
105 105
 			 * @param int   $form_id The form ID.
106 106
 			 * @param array $args    An array of form arguments.
107 107
 			 */
108
-			do_action( 'give_pre_form', $form->ID, $args );
108
+			do_action('give_pre_form', $form->ID, $args);
109 109
 			?>
110 110
 
111 111
 			<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>"
112
-			      action="<?php echo esc_url_raw( $form_action ); ?>" method="post">
112
+			      action="<?php echo esc_url_raw($form_action); ?>" method="post">
113 113
 				<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
114
-				<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
114
+				<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
115 115
 				<input type="hidden" name="give-current-url"
116
-				       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
116
+				       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
117 117
 				<input type="hidden" name="give-form-url"
118
-				       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
118
+				       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
119 119
 				<input type="hidden" name="give-form-minimum"
120
-				       value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
120
+				       value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
121 121
 
122 122
 				<!-- The following field is for robots only, invisible to humans: -->
123 123
 				<span class="give-hidden" style="display: none !important;">
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 				<?php
130 130
 
131 131
 				//Price ID hidden field for variable (mult-level) donation forms.
132
-				if ( give_has_variable_prices( $form_id ) ) {
132
+				if (give_has_variable_prices($form_id)) {
133 133
 					//get default selected price ID.
134
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
134
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
135 135
 					$price_id = 0;
136 136
 					//loop through prices.
137
-					foreach ( $prices as $price ) {
138
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
137
+					foreach ($prices as $price) {
138
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
139 139
 							$price_id = $price['_give_id']['level_id'];
140 140
 						};
141 141
 					}
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 				 * @param int   $form_id The form ID.
152 152
 				 * @param array $args    An array of form arguments.
153 153
 				 */
154
-				do_action( 'give_checkout_form_top', $form->ID, $args );
154
+				do_action('give_checkout_form_top', $form->ID, $args);
155 155
 
156 156
 				/**
157 157
 				 * Fires while outputing donation form, for payment gatways fields.
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 				 * @param int   $form_id The form ID.
162 162
 				 * @param array $args    An array of form arguments.
163 163
 				 */
164
-				do_action( 'give_payment_mode_select', $form->ID, $args );
164
+				do_action('give_payment_mode_select', $form->ID, $args);
165 165
 
166 166
 				/**
167 167
 				 * Fires while outputing donation form, after all other fields.
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 				 * @param int   $form_id The form ID.
172 172
 				 * @param array $args    An array of form arguments.
173 173
 				 */
174
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
174
+				do_action('give_checkout_form_bottom', $form->ID, $args);
175 175
 
176 176
 				?>
177 177
 			</form>
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
 			 * @param int   $form_id The form ID.
186 186
 			 * @param array $args    An array of form arguments.
187 187
 			 */
188
-			do_action( 'give_post_form', $form->ID, $args );
188
+			do_action('give_post_form', $form->ID, $args);
189 189
 
190 190
 		}
191 191
 		?>
192 192
 
193
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
193
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
194 194
 	<?php
195 195
 
196 196
 	/**
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 	 * @param int   $form_id The form ID.
202 202
 	 * @param array $args    An array of form arguments.
203 203
 	 */
204
-	do_action( 'give_post_form_output', $form->ID, $args );
204
+	do_action('give_post_form_output', $form->ID, $args);
205 205
 
206 206
 	$final_output = ob_get_clean();
207 207
 
208
-	echo apply_filters( 'give_donate_form', $final_output, $args );
208
+	echo apply_filters('give_donate_form', $final_output, $args);
209 209
 }
210 210
 
211 211
 /**
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
  *
223 223
  * @return string
224 224
  */
225
-function give_show_purchase_form( $form_id ) {
225
+function give_show_purchase_form($form_id) {
226 226
 
227
-	$payment_mode = give_get_chosen_gateway( $form_id );
227
+	$payment_mode = give_get_chosen_gateway($form_id);
228 228
 
229
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
229
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
230 230
 		$form_id = $_POST['give_form_id'];
231 231
 	}
232 232
 
@@ -235,33 +235,33 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @since 1.7
237 237
 	 */
238
-	do_action( 'give_donation_form_top', $form_id );
238
+	do_action('give_donation_form_top', $form_id);
239 239
 
240
-	if ( give_can_checkout() && isset( $form_id ) ) {
240
+	if (give_can_checkout() && isset($form_id)) {
241 241
 
242 242
 		/**
243 243
 		 * Fires while displaying donation form, before registration login.
244 244
 		 *
245 245
 		 * @since 1.7
246 246
 		 */
247
-		do_action( 'give_donation_form_before_register_login', $form_id );
247
+		do_action('give_donation_form_before_register_login', $form_id);
248 248
 
249 249
 		/**
250 250
 		 * Fire when register/login form fields render.
251 251
 		 *
252 252
 		 * @since 1.7
253 253
 		 */
254
-		do_action( 'give_donation_form_register_login_fields', $form_id );
254
+		do_action('give_donation_form_register_login_fields', $form_id);
255 255
 
256 256
 		/**
257 257
 		 * Fire when credit card form fields render.
258 258
 		 *
259 259
 		 * @since 1.7
260 260
 		 */
261
-		do_action( 'give_donation_form_before_cc_form', $form_id );
261
+		do_action('give_donation_form_before_cc_form', $form_id);
262 262
 
263 263
 		// Load the credit card form and allow gateways to load their own if they wish.
264
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
264
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
265 265
 			/**
266 266
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
267 267
 			 *
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 			 *
270 270
 			 * @param int $form_id The form ID.
271 271
 			 */
272
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
272
+			do_action("give_{$payment_mode}_cc_form", $form_id);
273 273
 		} else {
274 274
 			/**
275 275
 			 * Fires while displaying donation form, credit card form fields.
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			 *
279 279
 			 * @param int $form_id The form ID.
280 280
 			 */
281
-			do_action( 'give_cc_form', $form_id );
281
+			do_action('give_cc_form', $form_id);
282 282
 		}
283 283
 
284 284
 		/**
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		 *
287 287
 		 * @since 1.7
288 288
 		 */
289
-		do_action( 'give_donation_form_after_cc_form', $form_id );
289
+		do_action('give_donation_form_after_cc_form', $form_id);
290 290
 
291 291
 	} else {
292 292
 		/**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		 *
295 295
 		 * @since 1.7
296 296
 		 */
297
-		do_action( 'give_donation_form_no_access', $form_id );
297
+		do_action('give_donation_form_no_access', $form_id);
298 298
 
299 299
 	}
300 300
 
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @since 1.7
305 305
 	 */
306
-	do_action( 'give_donation_form_bottom', $form_id );
306
+	do_action('give_donation_form_bottom', $form_id);
307 307
 }
308 308
 
309
-add_action( 'give_donation_form', 'give_show_purchase_form' );
309
+add_action('give_donation_form', 'give_show_purchase_form');
310 310
 
311 311
 /**
312 312
  * Give Show Login/Register Form Fields.
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
  *
318 318
  * @return void
319 319
  */
320
-function give_show_register_login_fields( $form_id ) {
320
+function give_show_register_login_fields($form_id) {
321 321
 
322
-	$show_register_form = give_show_login_register_option( $form_id );
322
+	$show_register_form = give_show_login_register_option($form_id);
323 323
 
324
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
324
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
325 325
 		?>
326 326
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
327 327
 			<?php
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
 			 *
331 331
 			 * @since 1.7
332 332
 			 */
333
-			do_action( 'give_donation_form_register_fields', $form_id );
333
+			do_action('give_donation_form_register_fields', $form_id);
334 334
 			?>
335 335
 		</div>
336 336
 		<?php
337
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
337
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
338 338
 		?>
339 339
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
340 340
 			<?php
@@ -343,23 +343,23 @@  discard block
 block discarded – undo
343 343
 			 *
344 344
 			 * @since 1.7
345 345
 			 */
346
-			do_action( 'give_donation_form_login_fields', $form_id );
346
+			do_action('give_donation_form_login_fields', $form_id);
347 347
 			?>
348 348
 		</div>
349 349
 		<?php
350 350
 	endif;
351 351
 
352
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
352
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
353 353
 		/**
354 354
 		 * Fire when user info render.
355 355
 		 *
356 356
 		 * @since 1.7
357 357
 		 */
358
-		do_action( 'give_donation_form_after_user_info', $form_id );
358
+		do_action('give_donation_form_after_user_info', $form_id);
359 359
 	}
360 360
 }
361 361
 
362
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
362
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
363 363
 
364 364
 /**
365 365
  * Donation Amount Field.
@@ -373,16 +373,16 @@  discard block
 block discarded – undo
373 373
  *
374 374
  * @return void
375 375
  */
376
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
376
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
377 377
 
378 378
 	$give_options        = give_get_settings();
379
-	$variable_pricing    = give_has_variable_prices( $form_id );
380
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
381
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
382
-	$symbol              = give_currency_symbol( give_get_currency() );
383
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
384
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
385
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
379
+	$variable_pricing    = give_has_variable_prices($form_id);
380
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
381
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
382
+	$symbol              = give_currency_symbol(give_get_currency());
383
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
384
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
385
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
386 386
 
387 387
 	/**
388 388
 	 * Fires while displaying donation form, before donation level fields.
@@ -392,20 +392,20 @@  discard block
 block discarded – undo
392 392
 	 * @param int   $form_id The form ID.
393 393
 	 * @param array $args    An array of form arguments.
394 394
 	 */
395
-	do_action( 'give_before_donation_levels', $form_id, $args );
395
+	do_action('give_before_donation_levels', $form_id, $args);
396 396
 
397 397
 	//Set Price, No Custom Amount Allowed means hidden price field.
398
-	if ( $allow_custom_amount == 'no' ) {
398
+	if ($allow_custom_amount == 'no') {
399 399
 		?>
400
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
400
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
401 401
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
402 402
 		       value="<?php echo $default_amount; ?>" required aria-required="true"/>
403 403
 		<div class="set-price give-donation-amount form-row-wide">
404
-			<?php if ( $currency_position == 'before' ) {
404
+			<?php if ($currency_position == 'before') {
405 405
 				echo $currency_output;
406 406
 			} ?>
407 407
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
408
-			<?php if ( $currency_position == 'after' ) {
408
+			<?php if ($currency_position == 'after') {
409 409
 				echo $currency_output;
410 410
 			} ?>
411 411
 		</div>
@@ -415,13 +415,13 @@  discard block
 block discarded – undo
415 415
 		?>
416 416
 		<div class="give-total-wrap">
417 417
 			<div class="give-donation-amount form-row-wide">
418
-				<?php if ( $currency_position == 'before' ) {
418
+				<?php if ($currency_position == 'before') {
419 419
 					echo $currency_output;
420 420
 				} ?>
421
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
421
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
422 422
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
423 423
 				       placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
424
-				<?php if ( $currency_position == 'after' ) {
424
+				<?php if ($currency_position == 'after') {
425 425
 					echo $currency_output;
426 426
 				} ?>
427 427
 			</div>
@@ -436,16 +436,16 @@  discard block
 block discarded – undo
436 436
 	 * @param int   $form_id The form ID.
437 437
 	 * @param array $args    An array of form arguments.
438 438
 	 */
439
-	do_action( 'give_after_donation_amount', $form_id, $args );
439
+	do_action('give_after_donation_amount', $form_id, $args);
440 440
 
441 441
 	//Custom Amount Text.
442
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
442
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
443 443
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
444 444
 	<?php }
445 445
 
446 446
 	//Output Variable Pricing Levels.
447
-	if ( $variable_pricing ) {
448
-		give_output_levels( $form_id );
447
+	if ($variable_pricing) {
448
+		give_output_levels($form_id);
449 449
 	}
450 450
 
451 451
 	/**
@@ -456,10 +456,10 @@  discard block
 block discarded – undo
456 456
 	 * @param int   $form_id The form ID.
457 457
 	 * @param array $args    An array of form arguments.
458 458
 	 */
459
-	do_action( 'give_after_donation_levels', $form_id, $args );
459
+	do_action('give_after_donation_levels', $form_id, $args);
460 460
 }
461 461
 
462
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
462
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
463 463
 
464 464
 /**
465 465
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -470,32 +470,32 @@  discard block
 block discarded – undo
470 470
  *
471 471
  * @return string Donation levels.
472 472
  */
473
-function give_output_levels( $form_id ) {
473
+function give_output_levels($form_id) {
474 474
 
475 475
 	//Get variable pricing.
476
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
477
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
478
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
479
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
480
-	if ( empty( $custom_amount_text ) ) {
481
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
476
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
477
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
478
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
479
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
480
+	if (empty($custom_amount_text)) {
481
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
482 482
 	}
483 483
 
484 484
 	$output  = '';
485 485
 	$counter = 0;
486 486
 
487
-	switch ( $display_style ) {
487
+	switch ($display_style) {
488 488
 		case 'buttons':
489 489
 
490 490
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
491 491
 
492
-			foreach ( $prices as $price ) {
493
-				$counter ++;
494
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
495
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
492
+			foreach ($prices as $price) {
493
+				$counter++;
494
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
495
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
496 496
 
497 497
 				$output .= '<li>';
498
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
498
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
499 499
 				$output .= $level_text;
500 500
 				$output .= '</button>';
501 501
 				$output .= '</li>';
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 			}
504 504
 
505 505
 			//Custom Amount.
506
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
506
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
507 507
 				$output .= '<li>';
508 508
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
509 509
 				$output .= $custom_amount_text;
@@ -519,23 +519,23 @@  discard block
 block discarded – undo
519 519
 
520 520
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
521 521
 
522
-			foreach ( $prices as $price ) {
523
-				$counter ++;
524
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
525
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
522
+			foreach ($prices as $price) {
523
+				$counter++;
524
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
525
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
526 526
 
527 527
 				$output .= '<li>';
528
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
529
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
528
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
529
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
530 530
 				$output .= '</li>';
531 531
 
532 532
 			}
533 533
 
534 534
 			//Custom Amount.
535
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
535
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
536 536
 				$output .= '<li>';
537 537
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
538
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
538
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
539 539
 				$output .= '</li>';
540 540
 			}
541 541
 
@@ -545,23 +545,23 @@  discard block
 block discarded – undo
545 545
 
546 546
 		case 'dropdown':
547 547
 
548
-			$output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
549
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
548
+			$output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
549
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
550 550
 
551 551
 			//first loop through prices.
552
-			foreach ( $prices as $price ) {
553
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
554
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
552
+			foreach ($prices as $price) {
553
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
554
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
555 555
 
556
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
556
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
557 557
 				$output .= $level_text;
558 558
 				$output .= '</option>';
559 559
 
560 560
 			}
561 561
 
562 562
 			//Custom Amount.
563
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
564
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
563
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
564
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
565 565
 			}
566 566
 
567 567
 			$output .= '</select>';
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 			break;
570 570
 	}
571 571
 
572
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
572
+	echo apply_filters('give_form_level_output', $output, $form_id);
573 573
 }
574 574
 
575 575
 /**
@@ -584,26 +584,26 @@  discard block
 block discarded – undo
584 584
  *
585 585
  * @return string Checkout button.
586 586
  */
587
-function give_display_checkout_button( $form_id, $args ) {
587
+function give_display_checkout_button($form_id, $args) {
588 588
 
589
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
589
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
590 590
 		? $args['display_style']
591
-		: get_post_meta( $form_id, '_give_payment_display', true );
591
+		: get_post_meta($form_id, '_give_payment_display', true);
592 592
 
593 593
 	//no btn for onpage.
594
-	if ( $display_option === 'onpage' ) {
594
+	if ($display_option === 'onpage') {
595 595
 		return;
596 596
 	}
597 597
 
598
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
599
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
598
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
599
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
600 600
 
601
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
601
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
602 602
 
603
-	echo apply_filters( 'give_display_checkout_button', $output );
603
+	echo apply_filters('give_display_checkout_button', $output);
604 604
 }
605 605
 
606
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
606
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
607 607
 
608 608
 /**
609 609
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -614,57 +614,57 @@  discard block
 block discarded – undo
614 614
  *
615 615
  * @return void
616 616
  */
617
-function give_user_info_fields( $form_id ) {
617
+function give_user_info_fields($form_id) {
618 618
 	// Get user info.
619
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
619
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
620 620
 
621 621
 	/**
622 622
 	 * Fire before user personal information fields
623 623
 	 *
624 624
 	 * @since 1.7
625 625
 	 */
626
-	do_action( 'give_donation_form_before_personal_info', $form_id );
626
+	do_action('give_donation_form_before_personal_info', $form_id);
627 627
 	?>
628 628
 	<fieldset id="give_checkout_user_info">
629
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
629
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
630 630
 		<p id="give-first-name-wrap" class="form-row form-row-first">
631 631
 			<label class="give-label" for="give-first">
632
-				<?php esc_html_e( 'First Name', 'give' ); ?>
633
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
632
+				<?php esc_html_e('First Name', 'give'); ?>
633
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
634 634
 					<span class="give-required-indicator">*</span>
635 635
 				<?php endif ?>
636 636
 				<span class="give-tooltip give-icon give-icon-question"
637
-				      data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
637
+				      data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
638 638
 			</label>
639 639
 			<input
640 640
 				class="give-input required"
641 641
 				type="text"
642 642
 				name="give_first"
643
-				placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>"
643
+				placeholder="<?php esc_attr_e('First Name', 'give'); ?>"
644 644
 				id="give-first"
645
-				value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
646
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
645
+				value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
646
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
647 647
 			/>
648 648
 		</p>
649 649
 
650 650
 		<p id="give-last-name-wrap" class="form-row form-row-last">
651 651
 			<label class="give-label" for="give-last">
652
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
653
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
652
+				<?php esc_html_e('Last Name', 'give'); ?>
653
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
654 654
 					<span class="give-required-indicator">*</span>
655 655
 				<?php endif ?>
656 656
 				<span class="give-tooltip give-icon give-icon-question"
657
-				      data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
657
+				      data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
658 658
 			</label>
659 659
 
660 660
 			<input
661
-				class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
661
+				class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
662 662
 				type="text"
663 663
 				name="give_last"
664 664
 				id="give-last"
665
-				placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>"
666
-				value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
667
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
665
+				placeholder="<?php esc_attr_e('Last Name', 'give'); ?>"
666
+				value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
667
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
668 668
 			/>
669 669
 		</p>
670 670
 
@@ -674,26 +674,26 @@  discard block
 block discarded – undo
674 674
 		 *
675 675
 		 * @since 1.7
676 676
 		 */
677
-		do_action( 'give_donation_form_before_email', $form_id );
677
+		do_action('give_donation_form_before_email', $form_id);
678 678
 		?>
679 679
 		<p id="give-email-wrap" class="form-row form-row-wide">
680 680
 			<label class="give-label" for="give-email">
681
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
682
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
681
+				<?php esc_html_e('Email Address', 'give'); ?>
682
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
683 683
 					<span class="give-required-indicator">*</span>
684 684
 				<?php } ?>
685 685
 				<span class="give-tooltip give-icon give-icon-question"
686
-				      data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span>
686
+				      data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span>
687 687
 			</label>
688 688
 
689 689
 			<input
690 690
 				class="give-input required"
691 691
 				type="email"
692 692
 				name="give_email"
693
-				placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"
693
+				placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"
694 694
 				id="give-email"
695
-				value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
696
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
695
+				value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
696
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
697 697
 			/>
698 698
 
699 699
 		</p>
@@ -703,14 +703,14 @@  discard block
 block discarded – undo
703 703
 		 *
704 704
 		 * @since 1.7
705 705
 		 */
706
-		do_action( 'give_donation_form_after_email', $form_id );
706
+		do_action('give_donation_form_after_email', $form_id);
707 707
 
708 708
 		/**
709 709
 		 * Fire after personal email field
710 710
 		 *
711 711
 		 * @since 1.7
712 712
 		 */
713
-		do_action( 'give_donation_form_user_info', $form_id );
713
+		do_action('give_donation_form_user_info', $form_id);
714 714
 		?>
715 715
 	</fieldset>
716 716
 	<?php
@@ -719,11 +719,11 @@  discard block
 block discarded – undo
719 719
 	 *
720 720
 	 * @since 1.7
721 721
 	 */
722
-	do_action( 'give_donation_form_after_personal_info', $form_id );
722
+	do_action('give_donation_form_after_personal_info', $form_id);
723 723
 }
724 724
 
725
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
726
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
725
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
726
+add_action('give_register_fields_before', 'give_user_info_fields');
727 727
 
728 728
 /**
729 729
  * Renders the credit card info form.
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
  *
735 735
  * @return void
736 736
  */
737
-function give_get_cc_form( $form_id ) {
737
+function give_get_cc_form($form_id) {
738 738
 
739 739
 	ob_start();
740 740
 
@@ -745,53 +745,53 @@  discard block
 block discarded – undo
745 745
 	 *
746 746
 	 * @param int $form_id The form ID.
747 747
 	 */
748
-	do_action( 'give_before_cc_fields', $form_id );
748
+	do_action('give_before_cc_fields', $form_id);
749 749
 	?>
750 750
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
751
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
752
-		<?php if ( is_ssl() ) : ?>
751
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
752
+		<?php if (is_ssl()) : ?>
753 753
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
754 754
 				<span class="give-icon padlock"></span>
755
-				<span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
755
+				<span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
756 756
 			</div>
757 757
 		<?php endif; ?>
758 758
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
759 759
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
760
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
760
+				<?php esc_html_e('Card Number', 'give'); ?>
761 761
 				<span class="give-required-indicator">*</span>
762 762
 				<span class="give-tooltip give-icon give-icon-question"
763
-				      data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
763
+				      data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
764 764
 				<span class="card-type"></span>
765 765
 			</label>
766 766
 
767 767
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
768
-			       class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>"
768
+			       class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>"
769 769
 			       required aria-required="true"/>
770 770
 		</p>
771 771
 
772 772
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
773 773
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
774
-				<?php esc_html_e( 'CVC', 'give' ); ?>
774
+				<?php esc_html_e('CVC', 'give'); ?>
775 775
 				<span class="give-required-indicator">*</span>
776 776
 				<span class="give-tooltip give-icon give-icon-question"
777
-				      data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
777
+				      data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
778 778
 			</label>
779 779
 
780 780
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
781
-			       class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>"
781
+			       class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>"
782 782
 			       required aria-required="true"/>
783 783
 		</p>
784 784
 
785 785
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
786 786
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
787
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
787
+				<?php esc_html_e('Name on the Card', 'give'); ?>
788 788
 				<span class="give-required-indicator">*</span>
789 789
 				<span class="give-tooltip give-icon give-icon-question"
790
-				      data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
790
+				      data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
791 791
 			</label>
792 792
 
793 793
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
794
-			       class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
794
+			       class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
795 795
 			       required aria-required="true"/>
796 796
 		</p>
797 797
 		<?php
@@ -802,14 +802,14 @@  discard block
 block discarded – undo
802 802
 		 *
803 803
 		 * @param int $form_id The form ID.
804 804
 		 */
805
-		do_action( 'give_before_cc_expiration' );
805
+		do_action('give_before_cc_expiration');
806 806
 		?>
807 807
 		<p class="card-expiration form-row form-row-one-third">
808 808
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
809
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
809
+				<?php esc_html_e('Expiration', 'give'); ?>
810 810
 				<span class="give-required-indicator">*</span>
811 811
 				<span class="give-tooltip give-icon give-icon-question"
812
-				      data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
812
+				      data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
813 813
 			</label>
814 814
 
815 815
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month"
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 			       class="card-expiry-year"/>
819 819
 
820 820
 			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>"
821
-			       class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>"
821
+			       class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>"
822 822
 			       required aria-required="true"/>
823 823
 		</p>
824 824
 		<?php
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 		 *
830 830
 		 * @param int $form_id The form ID.
831 831
 		 */
832
-		do_action( 'give_after_cc_expiration', $form_id );
832
+		do_action('give_after_cc_expiration', $form_id);
833 833
 		?>
834 834
 	</fieldset>
835 835
 	<?php
@@ -840,12 +840,12 @@  discard block
 block discarded – undo
840 840
 	 *
841 841
 	 * @param int $form_id The form ID.
842 842
 	 */
843
-	do_action( 'give_after_cc_fields', $form_id );
843
+	do_action('give_after_cc_fields', $form_id);
844 844
 
845 845
 	echo ob_get_clean();
846 846
 }
847 847
 
848
-add_action( 'give_cc_form', 'give_get_cc_form' );
848
+add_action('give_cc_form', 'give_get_cc_form');
849 849
 
850 850
 /**
851 851
  * Outputs the default credit card address fields.
@@ -856,24 +856,24 @@  discard block
 block discarded – undo
856 856
  *
857 857
  * @return void
858 858
  */
859
-function give_default_cc_address_fields( $form_id ) {
859
+function give_default_cc_address_fields($form_id) {
860 860
 	// Get user info.
861
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
861
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
862 862
 
863 863
 	$logged_in = is_user_logged_in();
864 864
 
865
-	if ( $logged_in ) {
866
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
865
+	if ($logged_in) {
866
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
867 867
 	}
868
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
869
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
870
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
871
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
868
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
869
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
870
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
871
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
872 872
 
873 873
 	ob_start();
874 874
 	?>
875 875
 	<fieldset id="give_cc_address" class="cc-address">
876
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
876
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
877 877
 		<?php
878 878
 		/**
879 879
 		 * Fires while rendering credit card billing form, before address fields.
@@ -882,79 +882,79 @@  discard block
 block discarded – undo
882 882
 		 *
883 883
 		 * @param int $form_id The form ID.
884 884
 		 */
885
-		do_action( 'give_cc_billing_top' );
885
+		do_action('give_cc_billing_top');
886 886
 		?>
887 887
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
888 888
 			<label for="card_address" class="give-label">
889
-				<?php esc_html_e( 'Address 1', 'give' ); ?>
889
+				<?php esc_html_e('Address 1', 'give'); ?>
890 890
 				<?php
891
-				if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
891
+				if (give_field_is_required('card_address', $form_id)) : ?>
892 892
 					<span class="give-required-indicator">*</span>
893 893
 				<?php endif; ?>
894 894
 				<span class="give-tooltip give-icon give-icon-question"
895
-				      data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
895
+				      data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span>
896 896
 			</label>
897 897
 
898 898
 			<input
899 899
 				type="text"
900 900
 				id="card_address"
901 901
 				name="card_address"
902
-				class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
903
-				placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>"
904
-				value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
905
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
902
+				class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
903
+				placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>"
904
+				value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
905
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
906 906
 			/>
907 907
 		</p>
908 908
 
909 909
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
910 910
 			<label for="card_address_2" class="give-label">
911
-				<?php esc_html_e( 'Address 2', 'give' ); ?>
912
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
911
+				<?php esc_html_e('Address 2', 'give'); ?>
912
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
913 913
 					<span class="give-required-indicator">*</span>
914 914
 				<?php endif; ?>
915 915
 				<span class="give-tooltip give-icon give-icon-question"
916
-				      data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
916
+				      data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
917 917
 			</label>
918 918
 
919 919
 			<input
920 920
 				type="text"
921 921
 				id="card_address_2"
922 922
 				name="card_address_2"
923
-				class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
924
-				placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>"
925
-				value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
926
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
923
+				class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
924
+				placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>"
925
+				value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
926
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
927 927
 			/>
928 928
 		</p>
929 929
 
930 930
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
931 931
 			<label for="card_city" class="give-label">
932
-				<?php esc_html_e( 'City', 'give' ); ?>
933
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
932
+				<?php esc_html_e('City', 'give'); ?>
933
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
934 934
 					<span class="give-required-indicator">*</span>
935 935
 				<?php endif; ?>
936 936
 				<span class="give-tooltip give-icon give-icon-question"
937
-				      data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span>
937
+				      data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span>
938 938
 			</label>
939 939
 			<input
940 940
 				type="text"
941 941
 				id="card_city"
942 942
 				name="card_city"
943
-				class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
944
-				placeholder="<?php esc_attr_e( 'City', 'give' ); ?>"
945
-				value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
946
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
943
+				class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
944
+				placeholder="<?php esc_attr_e('City', 'give'); ?>"
945
+				value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
946
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
947 947
 			/>
948 948
 		</p>
949 949
 
950 950
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
951 951
 			<label for="card_zip" class="give-label">
952
-				<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
953
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
952
+				<?php esc_html_e('Zip / Postal Code', 'give'); ?>
953
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
954 954
 					<span class="give-required-indicator">*</span>
955 955
 				<?php endif; ?>
956 956
 				<span class="give-tooltip give-icon give-icon-question"
957
-				      data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
957
+				      data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
958 958
 			</label>
959 959
 
960 960
 			<input
@@ -962,40 +962,40 @@  discard block
 block discarded – undo
962 962
 				size="4"
963 963
 				id="card_zip"
964 964
 				name="card_zip"
965
-				class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
966
-				placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>"
967
-				value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
968
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
965
+				class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
966
+				placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>"
967
+				value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
968
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
969 969
 			/>
970 970
 		</p>
971 971
 
972 972
 		<p id="give-card-country-wrap" class="form-row form-row-first">
973 973
 			<label for="billing_country" class="give-label">
974
-				<?php esc_html_e( 'Country', 'give' ); ?>
975
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
974
+				<?php esc_html_e('Country', 'give'); ?>
975
+				<?php if (give_field_is_required('billing_country', $form_id)) : ?>
976 976
 					<span class="give-required-indicator">*</span>
977 977
 				<?php endif; ?>
978 978
 				<span class="give-tooltip give-icon give-icon-question"
979
-				      data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
979
+				      data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
980 980
 			</label>
981 981
 
982 982
 			<select
983 983
 				name="billing_country"
984 984
 				id="billing_country"
985
-				class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
986
-				<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
985
+				class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
986
+				<?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
987 987
 			>
988 988
 				<?php
989 989
 
990 990
 				$selected_country = give_get_country();
991 991
 
992
-				if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
992
+				if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
993 993
 					$selected_country = $give_user_info['billing_country'];
994 994
 				}
995 995
 
996 996
 				$countries = give_get_country_list();
997
-				foreach ( $countries as $country_code => $country ) {
998
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
997
+				foreach ($countries as $country_code => $country) {
998
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
999 999
 				}
1000 1000
 				?>
1001 1001
 			</select>
@@ -1003,39 +1003,39 @@  discard block
 block discarded – undo
1003 1003
 
1004 1004
 		<p id="give-card-state-wrap" class="form-row form-row-last">
1005 1005
 			<label for="card_state" class="give-label">
1006
-				<?php esc_html_e( 'State / Province', 'give' ); ?>
1007
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?>
1006
+				<?php esc_html_e('State / Province', 'give'); ?>
1007
+				<?php if (give_field_is_required('card_state', $form_id)) : ?>
1008 1008
 					<span class="give-required-indicator">*</span>
1009 1009
 				<?php endif; ?>
1010 1010
 				<span class="give-tooltip give-icon give-icon-question"
1011
-				      data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span>
1011
+				      data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span>
1012 1012
 			</label>
1013 1013
 
1014 1014
 			<?php
1015 1015
 			$selected_state = give_get_state();
1016
-			$states         = give_get_states( $selected_country );
1016
+			$states         = give_get_states($selected_country);
1017 1017
 
1018
-			if ( ! empty( $give_user_info['card_state'] ) ) {
1018
+			if ( ! empty($give_user_info['card_state'])) {
1019 1019
 				$selected_state = $give_user_info['card_state'];
1020 1020
 			}
1021 1021
 
1022
-			if ( ! empty( $states ) ) : ?>
1022
+			if ( ! empty($states)) : ?>
1023 1023
 				<select
1024 1024
 					name="card_state"
1025 1025
 					id="card_state"
1026
-					class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1027
-					<?php if ( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ) {
1026
+					class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1027
+					<?php if (give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : '') {
1028 1028
 						;
1029 1029
 					} ?>>
1030 1030
 					<?php
1031
-					foreach ( $states as $state_code => $state ) {
1032
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1031
+					foreach ($states as $state_code => $state) {
1032
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1033 1033
 					}
1034 1034
 					?>
1035 1035
 				</select>
1036 1036
 			<?php else : ?>
1037 1037
 				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1038
-				       placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
1038
+				       placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/>
1039 1039
 			<?php endif; ?>
1040 1040
 		</p>
1041 1041
 		<?php
@@ -1046,14 +1046,14 @@  discard block
 block discarded – undo
1046 1046
 		 *
1047 1047
 		 * @param int $form_id The form ID.
1048 1048
 		 */
1049
-		do_action( 'give_cc_billing_bottom' );
1049
+		do_action('give_cc_billing_bottom');
1050 1050
 		?>
1051 1051
 	</fieldset>
1052 1052
 	<?php
1053 1053
 	echo ob_get_clean();
1054 1054
 }
1055 1055
 
1056
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1056
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1057 1057
 
1058 1058
 
1059 1059
 /**
@@ -1065,27 +1065,27 @@  discard block
 block discarded – undo
1065 1065
  *
1066 1066
  * @return string
1067 1067
  */
1068
-function give_get_register_fields( $form_id ) {
1068
+function give_get_register_fields($form_id) {
1069 1069
 
1070 1070
 	global $user_ID;
1071 1071
 
1072
-	if ( is_user_logged_in() ) {
1073
-		$user_data = get_userdata( $user_ID );
1072
+	if (is_user_logged_in()) {
1073
+		$user_data = get_userdata($user_ID);
1074 1074
 	}
1075 1075
 
1076
-	$show_register_form = give_show_login_register_option( $form_id );
1076
+	$show_register_form = give_show_login_register_option($form_id);
1077 1077
 
1078 1078
 	ob_start(); ?>
1079 1079
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
1080 1080
 
1081
-		<?php if ( $show_register_form == 'both' ) { ?>
1081
+		<?php if ($show_register_form == 'both') { ?>
1082 1082
 			<div class="give-login-account-wrap">
1083
-				<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1084
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1085
-					   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1083
+				<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1084
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1085
+					   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1086 1086
 				</p>
1087 1087
 				<p class="give-loading-text">
1088
-					<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p>
1088
+					<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p>
1089 1089
 			</div>
1090 1090
 		<?php } ?>
1091 1091
 
@@ -1097,15 +1097,15 @@  discard block
 block discarded – undo
1097 1097
 		 *
1098 1098
 		 * @param int $form_id The form ID.
1099 1099
 		 */
1100
-		do_action( 'give_register_fields_before', $form_id );
1100
+		do_action('give_register_fields_before', $form_id);
1101 1101
 		?>
1102 1102
 
1103 1103
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
1104 1104
 			<legend>
1105 1105
 				<?php
1106
-				echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
1107
-				if ( ! give_logged_in_only( $form_id ) ) {
1108
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1106
+				echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
1107
+				if ( ! give_logged_in_only($form_id)) {
1108
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1109 1109
 				}
1110 1110
 				?>
1111 1111
 			</legend>
@@ -1117,52 +1117,52 @@  discard block
 block discarded – undo
1117 1117
 			 *
1118 1118
 			 * @param int $form_id The form ID.
1119 1119
 			 */
1120
-			do_action( 'give_register_account_fields_before', $form_id );
1120
+			do_action('give_register_account_fields_before', $form_id);
1121 1121
 			?>
1122 1122
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
1123 1123
 				<label for="give-user-login-<?php echo $form_id; ?>">
1124
-					<?php esc_html_e( 'Username', 'give' ); ?>
1125
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1124
+					<?php esc_html_e('Username', 'give'); ?>
1125
+					<?php if (give_logged_in_only($form_id)) { ?>
1126 1126
 						<span class="give-required-indicator">*</span>
1127 1127
 					<?php } ?>
1128 1128
 					<span class="give-tooltip give-icon give-icon-question"
1129
-					      data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
1129
+					      data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span>
1130 1130
 				</label>
1131 1131
 
1132 1132
 				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input"
1133 1133
 				       type="text"
1134
-				       placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1134
+				       placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1135 1135
 			</div>
1136 1136
 
1137 1137
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
1138 1138
 				<label for="give-user-pass-<?php echo $form_id; ?>">
1139
-					<?php esc_html_e( 'Password', 'give' ); ?>
1140
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1139
+					<?php esc_html_e('Password', 'give'); ?>
1140
+					<?php if (give_logged_in_only($form_id)) { ?>
1141 1141
 						<span class="give-required-indicator">*</span>
1142 1142
 					<?php } ?>
1143 1143
 					<span class="give-tooltip give-icon give-icon-question"
1144
-					      data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span>
1144
+					      data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span>
1145 1145
 				</label>
1146 1146
 
1147 1147
 				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input"
1148
-				       placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>"
1149
-				       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1148
+				       placeholder="<?php esc_attr_e('Password', 'give'); ?>"
1149
+				       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1150 1150
 			</div>
1151 1151
 
1152 1152
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>"
1153 1153
 			     class="give-register-password form-row form-row-one-third">
1154 1154
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
1155
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
1156
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1155
+					<?php esc_html_e('Confirm PW', 'give'); ?>
1156
+					<?php if (give_logged_in_only($form_id)) { ?>
1157 1157
 						<span class="give-required-indicator">*</span>
1158 1158
 					<?php } ?>
1159 1159
 					<span class="give-tooltip give-icon give-icon-question"
1160
-					      data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
1160
+					      data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span>
1161 1161
 				</label>
1162 1162
 
1163 1163
 				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>"
1164
-				       class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>"
1165
-				       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1164
+				       class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>"
1165
+				       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1166 1166
 			</div>
1167 1167
 			<?php
1168 1168
 			/**
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
 			 *
1173 1173
 			 * @param int $form_id The form ID.
1174 1174
 			 */
1175
-			do_action( 'give_register_account_fields_after', $form_id );
1175
+			do_action('give_register_account_fields_after', $form_id);
1176 1176
 			?>
1177 1177
 		</fieldset>
1178 1178
 
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 		 *
1185 1185
 		 * @param int $form_id The form ID.
1186 1186
 		 */
1187
-		do_action( 'give_register_fields_after', $form_id );
1187
+		do_action('give_register_fields_after', $form_id);
1188 1188
 		?>
1189 1189
 
1190 1190
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 		 *
1196 1196
 		 * @since 1.7
1197 1197
 		 */
1198
-		do_action( 'give_donation_form_user_info', $form_id );
1198
+		do_action('give_donation_form_user_info', $form_id);
1199 1199
 		?>
1200 1200
 
1201 1201
 	</fieldset>
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
 	echo ob_get_clean();
1204 1204
 }
1205 1205
 
1206
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1206
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1207 1207
 
1208 1208
 /**
1209 1209
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1216,32 +1216,32 @@  discard block
 block discarded – undo
1216 1216
  *
1217 1217
  * @return string
1218 1218
  */
1219
-function give_get_login_fields( $form_id ) {
1219
+function give_get_login_fields($form_id) {
1220 1220
 
1221
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1222
-	$show_register_form = give_show_login_register_option( $form_id );
1221
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1222
+	$show_register_form = give_show_login_register_option($form_id);
1223 1223
 
1224 1224
 	ob_start();
1225 1225
 	?>
1226 1226
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1227
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
1228
-			if ( ! give_logged_in_only( $form_id ) ) {
1229
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1227
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
1228
+			if ( ! give_logged_in_only($form_id)) {
1229
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1230 1230
 			} ?>
1231 1231
 		</legend>
1232
-		<?php if ( $show_register_form == 'both' ) { ?>
1232
+		<?php if ($show_register_form == 'both') { ?>
1233 1233
 			<p class="give-new-account-link">
1234
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
1235
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1234
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
1235
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1236 1236
 				   data-action="give_checkout_register">
1237
-					<?php esc_html_e( 'Register', 'give' );
1238
-					if ( ! give_logged_in_only( $form_id ) ) {
1239
-						echo ' ' . esc_html__( 'or checkout as a guest &raquo;', 'give' );
1237
+					<?php esc_html_e('Register', 'give');
1238
+					if ( ! give_logged_in_only($form_id)) {
1239
+						echo ' '.esc_html__('or checkout as a guest &raquo;', 'give');
1240 1240
 					} ?>
1241 1241
 				</a>
1242 1242
 			</p>
1243 1243
 			<p class="give-loading-text">
1244
-				<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p>
1244
+				<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p>
1245 1245
 		<?php } ?>
1246 1246
 		<?php
1247 1247
 		/**
@@ -1251,48 +1251,48 @@  discard block
 block discarded – undo
1251 1251
 		 *
1252 1252
 		 * @param int $form_id The form ID.
1253 1253
 		 */
1254
-		do_action( 'give_checkout_login_fields_before', $form_id );
1254
+		do_action('give_checkout_login_fields_before', $form_id);
1255 1255
 		?>
1256 1256
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
1257 1257
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1258
-				<?php esc_html_e( 'Username', 'give' ); ?>
1259
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1258
+				<?php esc_html_e('Username', 'give'); ?>
1259
+				<?php if (give_logged_in_only($form_id)) { ?>
1260 1260
 					<span class="give-required-indicator">*</span>
1261 1261
 				<?php } ?>
1262 1262
 			</label>
1263 1263
 
1264
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1264
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1265 1265
 			       name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1266
-			       placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1266
+			       placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1267 1267
 		</div>
1268 1268
 
1269 1269
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
1270 1270
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1271
-				<?php esc_html_e( 'Password', 'give' ); ?>
1272
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1271
+				<?php esc_html_e('Password', 'give'); ?>
1272
+				<?php if (give_logged_in_only($form_id)) { ?>
1273 1273
 					<span class="give-required-indicator">*</span>
1274 1274
 				<?php } ?>
1275 1275
 			</label>
1276
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1276
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1277 1277
 			       type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1278
-			       placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1278
+			       placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1279 1279
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1280 1280
 		</div>
1281 1281
 
1282 1282
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1283 1283
 			 <span class="give-forgot-password ">
1284 1284
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1285
-				    target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a>
1285
+				    target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a>
1286 1286
 			 </span>
1287 1287
 		</div>
1288 1288
 
1289 1289
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1290 1290
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1291
-			       value="<?php esc_attr_e( 'Login', 'give' ); ?>"/>
1292
-			<?php if ( $show_register_form !== 'login' ) { ?>
1291
+			       value="<?php esc_attr_e('Login', 'give'); ?>"/>
1292
+			<?php if ($show_register_form !== 'login') { ?>
1293 1293
 				<input type="button" data-action="give_cancel_login"
1294 1294
 				       class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1295
-				       value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/>
1295
+				       value="<?php esc_attr_e('Cancel', 'give'); ?>"/>
1296 1296
 			<?php } ?>
1297 1297
 			<span class="give-loading-animation"></span>
1298 1298
 		</div>
@@ -1304,14 +1304,14 @@  discard block
 block discarded – undo
1304 1304
 		 *
1305 1305
 		 * @param int $form_id The form ID.
1306 1306
 		 */
1307
-		do_action( 'give_checkout_login_fields_after', $form_id );
1307
+		do_action('give_checkout_login_fields_after', $form_id);
1308 1308
 		?>
1309 1309
 	</fieldset><!--end #give-login-fields-->
1310 1310
 	<?php
1311 1311
 	echo ob_get_clean();
1312 1312
 }
1313 1313
 
1314
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1314
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1315 1315
 
1316 1316
 /**
1317 1317
  * Payment Mode Select.
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
  *
1328 1328
  * @return void
1329 1329
  */
1330
-function give_payment_mode_select( $form_id ) {
1330
+function give_payment_mode_select($form_id) {
1331 1331
 
1332 1332
 	$gateways = give_get_enabled_payment_gateways();
1333 1333
 
@@ -1338,10 +1338,10 @@  discard block
 block discarded – undo
1338 1338
 	 *
1339 1339
 	 * @param int $form_id The form ID.
1340 1340
 	 */
1341
-	do_action( 'give_payment_mode_top', $form_id );
1341
+	do_action('give_payment_mode_top', $form_id);
1342 1342
 	?>
1343 1343
 
1344
-	<fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1344
+	<fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1345 1345
 		echo 'style="display: none;"';
1346 1346
 	} ?>>
1347 1347
 		<?php
@@ -1352,14 +1352,14 @@  discard block
 block discarded – undo
1352 1352
 		 *
1353 1353
 		 * @param int $form_id The form ID.
1354 1354
 		 */
1355
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1355
+		do_action('give_payment_mode_before_gateways_wrap');
1356 1356
 		?>
1357 1357
 		<legend
1358
-			class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?></legend>
1358
+			class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?></legend>
1359 1359
 
1360 1360
 		<div id="give-payment-mode-wrap">
1361 1361
 			<span class="give-loading-text"><span
1362
-					class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span>
1362
+					class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span>
1363 1363
 
1364 1364
 			<?php
1365 1365
 			/**
@@ -1367,26 +1367,26 @@  discard block
 block discarded – undo
1367 1367
 			 *
1368 1368
 			 * @since 1.7
1369 1369
 			 */
1370
-			do_action( 'give_payment_mode_before_gateways' )
1370
+			do_action('give_payment_mode_before_gateways')
1371 1371
 			?>
1372 1372
 			<ul id="give-gateway-radio-list">
1373 1373
 				<?php
1374 1374
 				/**
1375 1375
 				 * Loop through the active payment gateways.
1376 1376
 				 */
1377
-				$selected_gateway = give_get_chosen_gateway( $form_id );
1377
+				$selected_gateway = give_get_chosen_gateway($form_id);
1378 1378
 
1379
-				foreach ( $gateways as $gateway_id => $gateway ) :
1379
+				foreach ($gateways as $gateway_id => $gateway) :
1380 1380
 					//Determine the default gateway.
1381
-					$checked       = checked( $gateway_id, $selected_gateway, false );
1381
+					$checked       = checked($gateway_id, $selected_gateway, false);
1382 1382
 					$checked_class = $checked ? ' give-gateway-option-selected' : ''; ?>
1383 1383
 					<li>
1384 1384
 						<input type="radio" name="payment-mode" class="give-gateway"
1385
-						       id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1386
-						       value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1387
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1385
+						       id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1386
+						       value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1387
+						<label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1388 1388
 						       class="give-gateway-option<?php echo $checked_class; ?>"
1389
-						       id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label>
1389
+						       id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label>
1390 1390
 					</li>
1391 1391
 					<?php
1392 1392
 				endforeach;
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
 			 *
1399 1399
 			 * @since 1.7
1400 1400
 			 */
1401
-			do_action( 'give_payment_mode_after_gateways' );
1401
+			do_action('give_payment_mode_after_gateways');
1402 1402
 			?>
1403 1403
 		</div>
1404 1404
 		<?php
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 		 *
1410 1410
 		 * @param int $form_id The form ID.
1411 1411
 		 */
1412
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1412
+		do_action('give_payment_mode_after_gateways_wrap');
1413 1413
 		?>
1414 1414
 	</fieldset>
1415 1415
 
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
 	 *
1422 1422
 	 * @param int $form_id The form ID.
1423 1423
 	 */
1424
-	do_action( 'give_payment_mode_bottom', $form_id );
1424
+	do_action('give_payment_mode_bottom', $form_id);
1425 1425
 	?>
1426 1426
 
1427 1427
 	<div id="give_purchase_form_wrap">
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
 		 *
1433 1433
 		 * @since 1.7
1434 1434
 		 */
1435
-		do_action( 'give_donation_form', $form_id );
1435
+		do_action('give_donation_form', $form_id);
1436 1436
 		?>
1437 1437
 
1438 1438
 	</div>
@@ -1443,10 +1443,10 @@  discard block
 block discarded – undo
1443 1443
 	 *
1444 1444
 	 * @since 1.7
1445 1445
 	 */
1446
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1446
+	do_action('give_donation_form_wrap_bottom', $form_id);
1447 1447
 }
1448 1448
 
1449
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1449
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1450 1450
 
1451 1451
 /**
1452 1452
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1459,25 +1459,25 @@  discard block
 block discarded – undo
1459 1459
  *
1460 1460
  * @return void|bool
1461 1461
  */
1462
-function give_terms_agreement( $form_id ) {
1463
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1462
+function give_terms_agreement($form_id) {
1463
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1464 1464
 
1465 1465
 	// Bailout if per form and global term and conditions is not setup.
1466
-	if ( 'yes' !== $form_option ) {
1466
+	if ('yes' !== $form_option) {
1467 1467
 		return false;
1468 1468
 	}
1469 1469
 
1470
-	$label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1471
-	$terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' );
1470
+	$label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1471
+	$terms = ($terms = get_post_meta($form_id, '_give_agree_text', true)) ? $terms : give_get_option('agreement_text', '');
1472 1472
 
1473 1473
 	// Set term and conditions label and text on basis of per form and global setting.
1474 1474
 	// $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1475 1475
 	// $terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' );
1476 1476
 
1477 1477
 	// Bailout: Check if term and conditions text is empty or not.
1478
-	if ( empty( $terms ) ) {
1479
-		if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
1480
-			echo sprintf( __( 'Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), admin_url( 'post.php?post=' . $form_id . '&action=edit' ) );
1478
+	if (empty($terms)) {
1479
+		if (is_user_logged_in() && current_user_can('manage_options')) {
1480
+			echo sprintf(__('Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give'), admin_url('post.php?post='.$form_id.'&action=edit'));
1481 1481
 		}
1482 1482
 
1483 1483
 		return false;
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 
1486 1486
 	?>
1487 1487
 	<fieldset id="give_terms_agreement">
1488
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1488
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1489 1489
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1490 1490
 			<?php
1491 1491
 			/**
@@ -1493,22 +1493,22 @@  discard block
 block discarded – undo
1493 1493
 			 *
1494 1494
 			 * @since 1.0
1495 1495
 			 */
1496
-			do_action( 'give_before_terms' );
1496
+			do_action('give_before_terms');
1497 1497
 
1498
-			echo wpautop( stripslashes( $terms ) );
1498
+			echo wpautop(stripslashes($terms));
1499 1499
 			/**
1500 1500
 			 * Fires while rendering terms of agreement, after the fields.
1501 1501
 			 *
1502 1502
 			 * @since 1.0
1503 1503
 			 */
1504
-			do_action( 'give_after_terms' );
1504
+			do_action('give_after_terms');
1505 1505
 			?>
1506 1506
 		</div>
1507 1507
 		<div id="give_show_terms">
1508 1508
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1509
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1509
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1510 1510
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1511
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1511
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1512 1512
 		</div>
1513 1513
 
1514 1514
 		<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms-<?php echo $form_id; ?>" value="1" required aria-required="true" />
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
 	<?php
1519 1519
 }
1520 1520
 
1521
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1521
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1522 1522
 
1523 1523
 /**
1524 1524
  * Checkout Final Total.
@@ -1531,29 +1531,29 @@  discard block
 block discarded – undo
1531 1531
  *
1532 1532
  * @return void
1533 1533
  */
1534
-function give_checkout_final_total( $form_id ) {
1534
+function give_checkout_final_total($form_id) {
1535 1535
 
1536
-	if ( isset( $_POST['give_total'] ) ) {
1537
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1536
+	if (isset($_POST['give_total'])) {
1537
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1538 1538
 	} else {
1539 1539
 		//default total.
1540
-		$total = give_get_default_form_amount( $form_id );
1540
+		$total = give_get_default_form_amount($form_id);
1541 1541
 	}
1542 1542
 	//Only proceed if give_total available.
1543
-	if ( empty( $total ) ) {
1543
+	if (empty($total)) {
1544 1544
 		return;
1545 1545
 	}
1546 1546
 	?>
1547 1547
 	<p id="give-final-total-wrap" class="form-wrap ">
1548 1548
 		<span
1549
-			class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span>
1549
+			class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span>
1550 1550
 		<span class="give-final-total-amount"
1551
-		      data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1551
+		      data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1552 1552
 	</p>
1553 1553
 	<?php
1554 1554
 }
1555 1555
 
1556
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1556
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1557 1557
 
1558 1558
 /**
1559 1559
  * Renders the Checkout Submit section.
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
  *
1565 1565
  * @return void
1566 1566
  */
1567
-function give_checkout_submit( $form_id ) {
1567
+function give_checkout_submit($form_id) {
1568 1568
 	?>
1569 1569
 	<fieldset id="give_purchase_submit">
1570 1570
 		<?php
@@ -1573,24 +1573,24 @@  discard block
 block discarded – undo
1573 1573
 		 *
1574 1574
 		 * @since 1.7
1575 1575
 		 */
1576
-		do_action( 'give_donation_form_before_submit', $form_id );
1576
+		do_action('give_donation_form_before_submit', $form_id);
1577 1577
 
1578
-		give_checkout_hidden_fields( $form_id );
1578
+		give_checkout_hidden_fields($form_id);
1579 1579
 
1580
-		echo give_checkout_button_purchase( $form_id );
1580
+		echo give_checkout_button_purchase($form_id);
1581 1581
 
1582 1582
 		/**
1583 1583
 		 * Fire after donation form submit.
1584 1584
 		 *
1585 1585
 		 * @since 1.7
1586 1586
 		 */
1587
-		do_action( 'give_donation_form_after_submit', $form_id );
1587
+		do_action('give_donation_form_after_submit', $form_id);
1588 1588
 		?>
1589 1589
 	</fieldset>
1590 1590
 	<?php
1591 1591
 }
1592 1592
 
1593
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1593
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1594 1594
 
1595 1595
 /**
1596 1596
  * Give Checkout Button.
@@ -1603,10 +1603,10 @@  discard block
 block discarded – undo
1603 1603
  *
1604 1604
  * @return string
1605 1605
  */
1606
-function give_checkout_button_purchase( $form_id ) {
1606
+function give_checkout_button_purchase($form_id) {
1607 1607
 
1608
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1609
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1608
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1609
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1610 1610
 	ob_start(); ?>
1611 1611
 	<div class="give-submit-button-wrap give-clearfix">
1612 1612
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase"
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 		<span class="give-loading-animation"></span>
1615 1615
 	</div>
1616 1616
 	<?php
1617
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1617
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1618 1618
 }
1619 1619
 
1620 1620
 /**
@@ -1628,18 +1628,18 @@  discard block
 block discarded – undo
1628 1628
  *
1629 1629
  * @return void
1630 1630
  */
1631
-function give_agree_to_terms_js( $form_id ) {
1631
+function give_agree_to_terms_js($form_id) {
1632 1632
 
1633
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1633
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1634 1634
 
1635
-	if ( $form_option === 'yes' ) {
1635
+	if ($form_option === 'yes') {
1636 1636
 		?>
1637 1637
 		<script type="text/javascript">
1638 1638
 			jQuery(document).ready(function ($) {
1639
-				$('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) {
1639
+				$('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) {
1640 1640
 					e.preventDefault();
1641
-					$('.give_terms-<?php echo $form_id;?>').slideToggle();
1642
-					$('.give_terms_links-<?php echo $form_id;?>').toggle();
1641
+					$('.give_terms-<?php echo $form_id; ?>').slideToggle();
1642
+					$('.give_terms_links-<?php echo $form_id; ?>').toggle();
1643 1643
 					return false;
1644 1644
 				});
1645 1645
 			});
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
 	}
1649 1649
 }
1650 1650
 
1651
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1651
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1652 1652
 
1653 1653
 /**
1654 1654
  * Show Give Goals.
@@ -1662,17 +1662,17 @@  discard block
 block discarded – undo
1662 1662
  *
1663 1663
  * @return mixed
1664 1664
  */
1665
-function give_show_goal_progress( $form_id, $args ) {
1665
+function give_show_goal_progress($form_id, $args) {
1666 1666
 
1667 1667
 	ob_start();
1668
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1668
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1669 1669
 
1670
-	echo apply_filters( 'give_goal_output', ob_get_clean() );
1670
+	echo apply_filters('give_goal_output', ob_get_clean());
1671 1671
 
1672 1672
 	return true;
1673 1673
 }
1674 1674
 
1675
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1675
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1676 1676
 
1677 1677
 /**
1678 1678
  * Adds Actions to Render Form Content.
@@ -1684,19 +1684,19 @@  discard block
 block discarded – undo
1684 1684
  *
1685 1685
  * @return void
1686 1686
  */
1687
-function give_form_content( $form_id, $args ) {
1687
+function give_form_content($form_id, $args) {
1688 1688
 
1689
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1689
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1690 1690
 		? $args['show_content']
1691
-		: get_post_meta( $form_id, '_give_content_option', true );
1691
+		: get_post_meta($form_id, '_give_content_option', true);
1692 1692
 
1693
-	if ( $show_content !== 'none' ) {
1693
+	if ($show_content !== 'none') {
1694 1694
 		//add action according to value.
1695
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1695
+		add_action($show_content, 'give_form_display_content', 10, 2);
1696 1696
 	}
1697 1697
 }
1698 1698
 
1699
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1699
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1700 1700
 
1701 1701
 /**
1702 1702
  * Renders Post Form Content.
@@ -1710,24 +1710,24 @@  discard block
 block discarded – undo
1710 1710
  *
1711 1711
  * @return void
1712 1712
  */
1713
-function give_form_display_content( $form_id, $args ) {
1713
+function give_form_display_content($form_id, $args) {
1714 1714
 
1715
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1716
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1715
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1716
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1717 1717
 		? $args['show_content']
1718
-		: get_post_meta( $form_id, '_give_content_option', true );
1718
+		: get_post_meta($form_id, '_give_content_option', true);
1719 1719
 
1720
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1721
-		$content = apply_filters( 'the_content', $content );
1720
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1721
+		$content = apply_filters('the_content', $content);
1722 1722
 	}
1723 1723
 
1724
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1724
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1725 1725
 
1726
-	echo apply_filters( 'give_form_content_output', $output );
1726
+	echo apply_filters('give_form_content_output', $output);
1727 1727
 
1728 1728
 	//remove action to prevent content output on addition forms on page.
1729 1729
 	//@see: https://github.com/WordImpress/Give/issues/634.
1730
-	remove_action( $show_content, 'give_form_display_content' );
1730
+	remove_action($show_content, 'give_form_display_content');
1731 1731
 }
1732 1732
 
1733 1733
 /**
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
  *
1740 1740
  * @return void
1741 1741
  */
1742
-function give_checkout_hidden_fields( $form_id ) {
1742
+function give_checkout_hidden_fields($form_id) {
1743 1743
 
1744 1744
 	/**
1745 1745
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1748,13 +1748,13 @@  discard block
 block discarded – undo
1748 1748
 	 *
1749 1749
 	 * @param int $form_id The form ID.
1750 1750
 	 */
1751
-	do_action( 'give_hidden_fields_before', $form_id );
1751
+	do_action('give_hidden_fields_before', $form_id);
1752 1752
 
1753
-	if ( is_user_logged_in() ) { ?>
1753
+	if (is_user_logged_in()) { ?>
1754 1754
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1755 1755
 	<?php } ?>
1756 1756
 	<input type="hidden" name="give_action" value="purchase"/>
1757
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1757
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1758 1758
 	<?php
1759 1759
 	/**
1760 1760
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1763,7 +1763,7 @@  discard block
 block discarded – undo
1763 1763
 	 *
1764 1764
 	 * @param int $form_id The form ID.
1765 1765
 	 */
1766
-	do_action( 'give_hidden_fields_after', $form_id );
1766
+	do_action('give_hidden_fields_after', $form_id);
1767 1767
 
1768 1768
 }
1769 1769
 
@@ -1778,20 +1778,20 @@  discard block
 block discarded – undo
1778 1778
  *
1779 1779
  * @return string $content Filtered content.
1780 1780
  */
1781
-function give_filter_success_page_content( $content ) {
1781
+function give_filter_success_page_content($content) {
1782 1782
 
1783 1783
 	$give_options = give_get_settings();
1784 1784
 
1785
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1786
-		if ( has_filter( 'give_donation_confirm_' . $_GET['payment-confirmation'] ) ) {
1787
-			$content = apply_filters( 'give_donation_confirm_' . $_GET['payment-confirmation'], $content );
1785
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1786
+		if (has_filter('give_donation_confirm_'.$_GET['payment-confirmation'])) {
1787
+			$content = apply_filters('give_donation_confirm_'.$_GET['payment-confirmation'], $content);
1788 1788
 		}
1789 1789
 	}
1790 1790
 
1791 1791
 	return $content;
1792 1792
 }
1793 1793
 
1794
-add_filter( 'the_content', 'give_filter_success_page_content' );
1794
+add_filter('the_content', 'give_filter_success_page_content');
1795 1795
 
1796 1796
 /**
1797 1797
  * Test Mode Frontend Warning.
@@ -1802,12 +1802,12 @@  discard block
 block discarded – undo
1802 1802
  */
1803 1803
 function give_test_mode_frontend_warning() {
1804 1804
 
1805
-	if ( give_is_test_mode() ) {
1806
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
1805
+	if (give_is_test_mode()) {
1806
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
1807 1807
 	}
1808 1808
 }
1809 1809
 
1810
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1810
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1811 1811
 
1812 1812
 /**
1813 1813
  * Members-only Form.
@@ -1821,21 +1821,21 @@  discard block
 block discarded – undo
1821 1821
  *
1822 1822
  * @return string
1823 1823
  */
1824
-function give_members_only_form( $final_output, $args ) {
1824
+function give_members_only_form($final_output, $args) {
1825 1825
 
1826
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1826
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1827 1827
 
1828 1828
 	//Sanity Check: Must have form_id & not be logged in.
1829
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1829
+	if (empty($form_id) || is_user_logged_in()) {
1830 1830
 		return $final_output;
1831 1831
 	}
1832 1832
 
1833 1833
 	//Logged in only and Register / Login set to none.
1834
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1834
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1835 1835
 
1836
-		$final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1836
+		$final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1837 1837
 
1838
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1838
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1839 1839
 
1840 1840
 	}
1841 1841
 
@@ -1843,4 +1843,4 @@  discard block
 block discarded – undo
1843 1843
 
1844 1844
 }
1845 1845
 
1846
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1846
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1033,9 +1033,12 @@
 block discarded – undo
1033 1033
 					}
1034 1034
 					?>
1035 1035
 				</select>
1036
-			<?php else : ?>
1036
+			<?php else {
1037
+	: ?>
1037 1038
 				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1038
-				       placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
1039
+				       placeholder="<?php esc_attr_e( 'State / Province', 'give' );
1040
+}
1041
+?>"/>
1039 1042
 			<?php endif; ?>
1040 1043
 		</p>
1041 1044
 		<?php
Please login to merge, or discard this patch.
includes/api/class-give-api-v1.php 1 patch
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' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
Please login to merge, or discard this patch.