Completed
Pull Request — master (#1055)
by Rami
19:01
created
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/payments/class-payments-table.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -118,37 +118,37 @@  discard block
 block discarded – undo
118 118
 	public function __construct() {
119 119
 
120 120
 		// Set parent defaults
121
-		parent::__construct( array(
122
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
123
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
121
+		parent::__construct(array(
122
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
123
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
124 124
 			'ajax'     => false                        // Does this table support ajax?
125
-		) );
125
+		));
126 126
 
127 127
 		$this->get_payment_counts();
128 128
 		$this->process_bulk_action();
129
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
129
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
130 130
 	}
131 131
 
132 132
 	public function advanced_filters() {
133
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
134
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
135
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : '';
133
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
134
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
135
+		$status     = isset($_GET['status']) ? $_GET['status'] : '';
136 136
 		?>
137 137
 		<div id="give-payment-filters">
138 138
 			<span id="give-payment-date-filters">
139
-				<label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label>
139
+				<label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label>
140 140
 				<input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/>
141
-				<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label>
141
+				<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label>
142 142
 				<input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/>
143
-				<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/>
143
+				<input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/>
144 144
 			</span>
145
-			<?php if ( ! empty( $status ) ) : ?>
146
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/>
145
+			<?php if ( ! empty($status)) : ?>
146
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/>
147 147
 			<?php endif; ?>
148
-			<?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?>
149
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a>
148
+			<?php if ( ! empty($start_date) || ! empty($end_date)) : ?>
149
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a>
150 150
 			<?php endif; ?>
151
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
151
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
152 152
 		</div>
153 153
 
154 154
 		<?php
@@ -165,18 +165,18 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return void
167 167
 	 */
168
-	public function search_box( $text, $input_id ) {
169
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
168
+	public function search_box($text, $input_id) {
169
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
170 170
 			return;
171 171
 		}
172 172
 
173
-		$input_id = $input_id . '-search-input';
173
+		$input_id = $input_id.'-search-input';
174 174
 
175
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
176
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
175
+		if ( ! empty($_REQUEST['orderby'])) {
176
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
177 177
 		}
178
-		if ( ! empty( $_REQUEST['order'] ) ) {
179
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
178
+		if ( ! empty($_REQUEST['order'])) {
179
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
180 180
 		}
181 181
 		?>
182 182
 		<p class="search-box" role="search">
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 			 *
189 189
 			 * @since 1.7
190 190
 			 */
191
-			do_action( 'give_donation_history_search' );
191
+			do_action('give_donation_history_search');
192 192
 			?>
193 193
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
194 194
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
195
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/>
195
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/>
196 196
 		</p>
197 197
 		<?php
198 198
 	}
@@ -206,52 +206,52 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function get_views() {
208 208
 
209
-		$current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
210
-		$total_count     = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
211
-		$complete_count  = '&nbsp;<span class="count">(' . $this->complete_count . ')</span>';
212
-		$cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count . ')</span>';
213
-		$pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
214
-		$refunded_count  = '&nbsp;<span class="count">(' . $this->refunded_count . ')</span>';
215
-		$failed_count    = '&nbsp;<span class="count">(' . $this->failed_count . ')</span>';
216
-		$abandoned_count = '&nbsp;<span class="count">(' . $this->abandoned_count . ')</span>';
217
-		$revoked_count   = '&nbsp;<span class="count">(' . $this->revoked_count . ')</span>';
209
+		$current         = isset($_GET['status']) ? $_GET['status'] : '';
210
+		$total_count     = '&nbsp;<span class="count">('.$this->total_count.')</span>';
211
+		$complete_count  = '&nbsp;<span class="count">('.$this->complete_count.')</span>';
212
+		$cancelled_count = '&nbsp;<span class="count">('.$this->cancelled_count.')</span>';
213
+		$pending_count   = '&nbsp;<span class="count">('.$this->pending_count.')</span>';
214
+		$refunded_count  = '&nbsp;<span class="count">('.$this->refunded_count.')</span>';
215
+		$failed_count    = '&nbsp;<span class="count">('.$this->failed_count.')</span>';
216
+		$abandoned_count = '&nbsp;<span class="count">('.$this->abandoned_count.')</span>';
217
+		$revoked_count   = '&nbsp;<span class="count">('.$this->revoked_count.')</span>';
218 218
 
219 219
 		$views = array(
220
-			'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array(
220
+			'all'       => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array(
221 221
 				'status',
222 222
 				'paged'
223
-			) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ),
224
-			'publish'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
223
+			)), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count),
224
+			'publish'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
225 225
 				'status' => 'publish',
226 226
 				'paged'  => false
227
-			) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ),
228
-			'pending'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
227
+			))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count),
228
+			'pending'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
229 229
 				'status' => 'pending',
230 230
 				'paged'  => false
231
-			) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ),
232
-			'refunded'  => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
231
+			))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count),
232
+			'refunded'  => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
233 233
 				'status' => 'refunded',
234 234
 				'paged'  => false
235
-			) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ),
236
-			'revoked'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
235
+			))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count),
236
+			'revoked'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
237 237
 				'status' => 'revoked',
238 238
 				'paged'  => false
239
-			) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ),
240
-			'failed'    => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
239
+			))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count),
240
+			'failed'    => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
241 241
 				'status' => 'failed',
242 242
 				'paged'  => false
243
-			) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ),
244
-			'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
243
+			))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count),
244
+			'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
245 245
 				'status' => 'cancelled',
246 246
 				'paged'  => false
247
-			) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ),
248
-			'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
247
+			))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count),
248
+			'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
249 249
 				'status' => 'abandoned',
250 250
 				'paged'  => false
251
-			) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count )
251
+			))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count)
252 252
 		);
253 253
 
254
-		return apply_filters( 'give_donations_table_views', $views );
254
+		return apply_filters('give_donations_table_views', $views);
255 255
 	}
256 256
 
257 257
 	/**
@@ -264,15 +264,15 @@  discard block
 block discarded – undo
264 264
 	public function get_columns() {
265 265
 		$columns = array(
266 266
 			'cb'            => '<input type="checkbox" />', //Render a checkbox instead of text
267
-			'donation'      => esc_html__( 'Donation', 'give' ),
268
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
269
-			'status'        => esc_html__( 'Status', 'give' ),
270
-			'date'          => esc_html__( 'Date', 'give' ),
271
-			'amount'        => esc_html__( 'Amount', 'give' ),
272
-			'details'       => esc_html__( 'Details', 'give' ),
267
+			'donation'      => esc_html__('Donation', 'give'),
268
+			'donation_form' => esc_html__('Donation Form', 'give'),
269
+			'status'        => esc_html__('Status', 'give'),
270
+			'date'          => esc_html__('Date', 'give'),
271
+			'amount'        => esc_html__('Amount', 'give'),
272
+			'details'       => esc_html__('Details', 'give'),
273 273
 		);
274 274
 
275
-		return apply_filters( 'give_donations_table_columns', $columns );
275
+		return apply_filters('give_donations_table_columns', $columns);
276 276
 	}
277 277
 
278 278
 	/**
@@ -284,14 +284,14 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	public function get_sortable_columns() {
286 286
 		$columns = array(
287
-			'donation'      => array( 'ID', true ),
288
-			'donation_form' => array( 'donation_form', false ),
289
-			'status'        => array( 'status', false ),
290
-			'amount'        => array( 'amount', false ),
291
-			'date'          => array( 'date', false )
287
+			'donation'      => array('ID', true),
288
+			'donation_form' => array('donation_form', false),
289
+			'status'        => array('status', false),
290
+			'amount'        => array('amount', false),
291
+			'date'          => array('date', false)
292 292
 		);
293 293
 
294
-		return apply_filters( 'give_donations_table_sortable_columns', $columns );
294
+		return apply_filters('give_donations_table_sortable_columns', $columns);
295 295
 	}
296 296
 
297 297
 	/**
@@ -317,65 +317,65 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @return string Column Name
319 319
 	 */
320
-	public function column_default( $payment, $column_name ) {
320
+	public function column_default($payment, $column_name) {
321 321
 
322
-		$single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) );
323
-		$row_actions         = $this->get_row_actions( $payment );
322
+		$single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details')));
323
+		$row_actions         = $this->get_row_actions($payment);
324 324
 
325
-		switch ( $column_name ) {
325
+		switch ($column_name) {
326 326
 			case 'donation' :
327 327
 				$value = sprintf(
328 328
 					'<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>',
329 329
 					$single_donation_url,
330
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ),
330
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID),
331 331
 					$payment->ID,
332
-					esc_html__( 'by', 'give' ),
333
-					$this->get_donor( $payment )
332
+					esc_html__('by', 'give'),
333
+					$this->get_donor($payment)
334 334
 				);
335
-				$value .= $this->get_donor_email( $payment );
336
-				$value .= $this->row_actions( $row_actions );
335
+				$value .= $this->get_donor_email($payment);
336
+				$value .= $this->row_actions($row_actions);
337 337
 				break;
338 338
 
339 339
 			case 'amount' :
340
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
341
-				$value  = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) );
340
+				$amount = ! empty($payment->total) ? $payment->total : 0;
341
+				$value  = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID));
342 342
 				break;
343 343
 
344 344
 			case 'donation_form' :
345 345
 
346
-				$value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>';
347
-				$level = give_get_payment_form_title( $payment->meta, true );
346
+				$value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>';
347
+				$level = give_get_payment_form_title($payment->meta, true);
348 348
 
349
-				if ( ! empty( $level ) ) {
349
+				if ( ! empty($level)) {
350 350
 					$value .= $level;
351 351
 				}
352 352
 
353 353
 				break;
354 354
 
355 355
 			case 'date' :
356
-				$date  = strtotime( $payment->date );
357
-				$value = date_i18n( give_date_format(), $date );
356
+				$date  = strtotime($payment->date);
357
+				$value = date_i18n(give_date_format(), $date);
358 358
 				break;
359 359
 
360 360
 			case 'status' :
361
-				$value = $this->get_payment_status( $payment );
361
+				$value = $this->get_payment_status($payment);
362 362
 				break;
363 363
 
364 364
 			case 'details' :
365 365
 				$value = sprintf(
366 366
 					'<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>',
367 367
 					$single_donation_url,
368
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID )
368
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID)
369 369
 				);
370 370
 				break;
371 371
 
372 372
 			default:
373
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
373
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
374 374
 				break;
375 375
 
376 376
 		}
377 377
 
378
-		return apply_filters( 'give_donations_table_column', $value, $payment->ID, $column_name );
378
+		return apply_filters('give_donations_table_column', $value, $payment->ID, $column_name);
379 379
 	}
380 380
 
381 381
 	/**
@@ -388,17 +388,17 @@  discard block
 block discarded – undo
388 388
 	 *
389 389
 	 * @return string                Data shown in the Email column
390 390
 	 */
391
-	public function get_donor_email( $payment ) {
391
+	public function get_donor_email($payment) {
392 392
 
393
-		$email = give_get_payment_user_email( $payment->ID );
393
+		$email = give_get_payment_user_email($payment->ID);
394 394
 
395
-		if ( empty( $email ) ) {
396
-			$email = esc_html__( '(unknown)', 'give' );
395
+		if (empty($email)) {
396
+			$email = esc_html__('(unknown)', 'give');
397 397
 		}
398 398
 
399
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>';
399
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.__('Email donor', 'give').'">'.$email.'</a>';
400 400
 
401
-		return apply_filters( 'give_donations_table_column', $value, $payment->ID, 'email' );
401
+		return apply_filters('give_donations_table_column', $value, $payment->ID, 'email');
402 402
 	}
403 403
 
404 404
 	/**
@@ -408,18 +408,18 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @return mixed|void
410 410
 	 */
411
-	function get_row_actions( $payment ) {
411
+	function get_row_actions($payment) {
412 412
 
413 413
 		$actions = array();
414
-		$email   = give_get_payment_user_email( $payment->ID );
414
+		$email   = give_get_payment_user_email($payment->ID);
415 415
 
416 416
 		// Add search term string back to base URL
417
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
418
-		if ( ! empty( $search_terms ) ) {
419
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
417
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
418
+		if ( ! empty($search_terms)) {
419
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
420 420
 		}
421 421
 
422
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
422
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
423 423
 
424 424
 			$actions['email_links'] = sprintf(
425 425
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 					),
434 434
 					'give_payment_nonce'
435 435
 				),
436
-				sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ),
437
-				esc_html__( 'Resend Donation Receipt', 'give' )
436
+				sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID),
437
+				esc_html__('Resend Donation Receipt', 'give')
438 438
 			);
439 439
 
440 440
 		}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 				),
452 452
 				'give_payment_nonce'
453 453
 			),
454
-			sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ),
455
-			esc_html__( 'Delete', 'give' )
454
+			sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID),
455
+			esc_html__('Delete', 'give')
456 456
 		);
457 457
 
458
-		return apply_filters( 'give_donation_row_actions', $actions, $payment );
458
+		return apply_filters('give_donation_row_actions', $actions, $payment);
459 459
 	}
460 460
 
461 461
 
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 	 *
470 470
 	 * @return string                Data shown in the Email column
471 471
 	 */
472
-	function get_payment_status( $payment ) {
473
-		$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
474
-		if ( $payment->mode == 'test' ) {
475
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
472
+	function get_payment_status($payment) {
473
+		$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
474
+		if ($payment->mode == 'test') {
475
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
476 476
 		}
477 477
 
478 478
 		return $value;
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 	 *
489 489
 	 * @return string Displays a checkbox
490 490
 	 */
491
-	public function column_cb( $payment ) {
491
+	public function column_cb($payment) {
492 492
 		return sprintf(
493 493
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
494 494
 			'payment',
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 	 *
507 507
 	 * @return string Displays a checkbox
508 508
 	 */
509
-	public function get_payment_id( $payment ) {
510
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
509
+	public function get_payment_id($payment) {
510
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
511 511
 	}
512 512
 
513 513
 	/**
@@ -520,19 +520,19 @@  discard block
 block discarded – undo
520 520
 	 *
521 521
 	 * @return string Data shown in the User column
522 522
 	 */
523
-	public function get_donor( $payment ) {
523
+	public function get_donor($payment) {
524 524
 
525
-		$customer_id = give_get_payment_customer_id( $payment->ID );
525
+		$customer_id = give_get_payment_customer_id($payment->ID);
526 526
 
527
-		if ( ! empty( $customer_id ) ) {
528
-			$customer = new Give_Customer( $customer_id );
529
-			$value    = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>';
527
+		if ( ! empty($customer_id)) {
528
+			$customer = new Give_Customer($customer_id);
529
+			$value    = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>';
530 530
 		} else {
531
-			$email = give_get_payment_user_email( $payment->ID );
532
-			$value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
531
+			$email = give_get_payment_user_email($payment->ID);
532
+			$value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>';
533 533
 		}
534 534
 
535
-		return apply_filters( 'give_donations_table_column', $value, $payment->ID, 'donor' );
535
+		return apply_filters('give_donations_table_column', $value, $payment->ID, 'donor');
536 536
 	}
537 537
 
538 538
 	/**
@@ -544,18 +544,18 @@  discard block
 block discarded – undo
544 544
 	 */
545 545
 	public function get_bulk_actions() {
546 546
 		$actions = array(
547
-			'delete'               => esc_html__( 'Delete', 'give' ),
548
-			'set-status-publish'   => esc_html__( 'Set To Completed', 'give' ),
549
-			'set-status-pending'   => esc_html__( 'Set To Pending', 'give' ),
550
-			'set-status-refunded'  => esc_html__( 'Set To Refunded', 'give' ),
551
-			'set-status-revoked'   => esc_html__( 'Set To Revoked', 'give' ),
552
-			'set-status-failed'    => esc_html__( 'Set To Failed', 'give' ),
553
-			'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ),
554
-			'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ),
555
-			'resend-receipt'       => esc_html__( 'Resend Email Receipts', 'give' )
547
+			'delete'               => esc_html__('Delete', 'give'),
548
+			'set-status-publish'   => esc_html__('Set To Completed', 'give'),
549
+			'set-status-pending'   => esc_html__('Set To Pending', 'give'),
550
+			'set-status-refunded'  => esc_html__('Set To Refunded', 'give'),
551
+			'set-status-revoked'   => esc_html__('Set To Revoked', 'give'),
552
+			'set-status-failed'    => esc_html__('Set To Failed', 'give'),
553
+			'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'),
554
+			'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'),
555
+			'resend-receipt'       => esc_html__('Resend Email Receipts', 'give')
556 556
 		);
557 557
 
558
-		return apply_filters( 'give_donations_table_bulk_actions', $actions );
558
+		return apply_filters('give_donations_table_bulk_actions', $actions);
559 559
 	}
560 560
 
561 561
 	/**
@@ -566,59 +566,59 @@  discard block
 block discarded – undo
566 566
 	 * @return void
567 567
 	 */
568 568
 	public function process_bulk_action() {
569
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
569
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
570 570
 		$action = $this->current_action();
571 571
 
572
-		if ( ! is_array( $ids ) ) {
573
-			$ids = array( $ids );
572
+		if ( ! is_array($ids)) {
573
+			$ids = array($ids);
574 574
 		}
575 575
 
576
-		if ( empty( $action ) ) {
576
+		if (empty($action)) {
577 577
 			return;
578 578
 		}
579 579
 
580
-		foreach ( $ids as $id ) {
580
+		foreach ($ids as $id) {
581 581
 
582 582
 			// Detect when a bulk action is being triggered...
583
-			switch ( $this->current_action() ) {
583
+			switch ($this->current_action()) {
584 584
 
585 585
 				case'delete':
586
-					give_delete_purchase( $id );
586
+					give_delete_purchase($id);
587 587
 					break;
588 588
 
589 589
 				case 'set-status-publish':
590
-					give_update_payment_status( $id, 'publish' );
590
+					give_update_payment_status($id, 'publish');
591 591
 					break;
592 592
 
593 593
 				case 'set-status-pending':
594
-					give_update_payment_status( $id, 'pending' );
594
+					give_update_payment_status($id, 'pending');
595 595
 					break;
596 596
 
597 597
 				case 'set-status-refunded':
598
-					give_update_payment_status( $id, 'refunded' );
598
+					give_update_payment_status($id, 'refunded');
599 599
 					break;
600 600
 				case 'set-status-revoked':
601
-					give_update_payment_status( $id, 'revoked' );
601
+					give_update_payment_status($id, 'revoked');
602 602
 					break;
603 603
 
604 604
 				case 'set-status-failed':
605
-					give_update_payment_status( $id, 'failed' );
605
+					give_update_payment_status($id, 'failed');
606 606
 					break;
607 607
 
608 608
 				case 'set-status-cancelled':
609
-					give_update_payment_status( $id, 'cancelled' );
609
+					give_update_payment_status($id, 'cancelled');
610 610
 					break;
611 611
 
612 612
 				case 'set-status-abandoned':
613
-					give_update_payment_status( $id, 'abandoned' );
613
+					give_update_payment_status($id, 'abandoned');
614 614
 					break;
615 615
 
616 616
 				case 'set-status-preapproval':
617
-					give_update_payment_status( $id, 'preapproval' );
617
+					give_update_payment_status($id, 'preapproval');
618 618
 					break;
619 619
 
620 620
 				case 'resend-receipt':
621
-					give_email_donation_receipt( $id, false );
621
+					give_email_donation_receipt($id, false);
622 622
 					break;
623 623
 			}
624 624
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 			 * @param int    $id The ID of the payment.
631 631
 			 * @param string $current_action The action that is being triggered.
632 632
 			 */
633
-			do_action( 'give_donations_table_do_bulk_action', $id, $this->current_action() );
633
+			do_action('give_donations_table_do_bulk_action', $id, $this->current_action());
634 634
 		}
635 635
 
636 636
 	}
@@ -646,27 +646,27 @@  discard block
 block discarded – undo
646 646
 
647 647
 		$args = array();
648 648
 
649
-		if ( isset( $_GET['user'] ) ) {
650
-			$args['user'] = urldecode( $_GET['user'] );
651
-		} elseif ( isset( $_GET['s'] ) ) {
652
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
653
-			if ( $is_user ) {
654
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
655
-				unset( $args['s'] );
649
+		if (isset($_GET['user'])) {
650
+			$args['user'] = urldecode($_GET['user']);
651
+		} elseif (isset($_GET['s'])) {
652
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
653
+			if ($is_user) {
654
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
655
+				unset($args['s']);
656 656
 			} else {
657
-				$args['s'] = sanitize_text_field( $_GET['s'] );
657
+				$args['s'] = sanitize_text_field($_GET['s']);
658 658
 			}
659 659
 		}
660 660
 
661
-		if ( ! empty( $_GET['start-date'] ) ) {
662
-			$args['start-date'] = urldecode( $_GET['start-date'] );
661
+		if ( ! empty($_GET['start-date'])) {
662
+			$args['start-date'] = urldecode($_GET['start-date']);
663 663
 		}
664 664
 
665
-		if ( ! empty( $_GET['end-date'] ) ) {
666
-			$args['end-date'] = urldecode( $_GET['end-date'] );
665
+		if ( ! empty($_GET['end-date'])) {
666
+			$args['end-date'] = urldecode($_GET['end-date']);
667 667
 		}
668 668
 
669
-		$payment_count         = give_count_payments( $args );
669
+		$payment_count         = give_count_payments($args);
670 670
 		$this->complete_count  = $payment_count->publish;
671 671
 		$this->pending_count   = $payment_count->pending;
672 672
 		$this->refunded_count  = $payment_count->refunded;
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		$this->cancelled_count = $payment_count->cancelled;
676 676
 		$this->abandoned_count = $payment_count->abandoned;
677 677
 
678
-		foreach ( $payment_count as $count ) {
678
+		foreach ($payment_count as $count) {
679 679
 			$this->total_count += $count;
680 680
 		}
681 681
 	}
@@ -690,26 +690,26 @@  discard block
 block discarded – undo
690 690
 	public function payments_data() {
691 691
 
692 692
 		$per_page   = $this->per_page;
693
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
694
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
695
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
696
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
697
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
698
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
699
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
700
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
701
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
702
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
703
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
704
-
705
-		if ( ! empty( $search ) ) {
693
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
694
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
695
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
696
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
697
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
698
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
699
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
700
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
701
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
702
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
703
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
704
+
705
+		if ( ! empty($search)) {
706 706
 			$status = 'any'; // Force all payment statuses when searching
707 707
 		}
708 708
 
709 709
 		$args = array(
710 710
 			'output'     => 'payments',
711 711
 			'number'     => $per_page,
712
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
712
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
713 713
 			'orderby'    => $orderby,
714 714
 			'order'      => $order,
715 715
 			'user'       => $user,
@@ -723,14 +723,14 @@  discard block
 block discarded – undo
723 723
 			'end_date'   => $end_date,
724 724
 		);
725 725
 
726
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
726
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
727 727
 
728 728
 			$args['search_in_notes'] = true;
729
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
729
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
730 730
 
731 731
 		}
732 732
 
733
-		$p_query = new Give_Payments_Query( $args );
733
+		$p_query = new Give_Payments_Query($args);
734 734
 
735 735
 		return $p_query->get_payments();
736 736
 
@@ -750,17 +750,17 @@  discard block
 block discarded – undo
750 750
 	 */
751 751
 	public function prepare_items() {
752 752
 
753
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
753
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
754 754
 
755 755
 		$columns  = $this->get_columns();
756 756
 		$hidden   = array(); // No hidden columns
757 757
 		$sortable = $this->get_sortable_columns();
758 758
 		$data     = $this->payments_data();
759
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
759
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
760 760
 
761
-		$this->_column_headers = array( $columns, $hidden, $sortable );
761
+		$this->_column_headers = array($columns, $hidden, $sortable);
762 762
 
763
-		switch ( $status ) {
763
+		switch ($status) {
764 764
 			case 'publish':
765 765
 				$total_items = $this->complete_count;
766 766
 				break;
@@ -787,19 +787,19 @@  discard block
 block discarded – undo
787 787
 				break;
788 788
 			default:
789 789
 				// Retrieve the count of the non-default-Give status
790
-				$count       = wp_count_posts( 'give_payment' );
790
+				$count       = wp_count_posts('give_payment');
791 791
 				$total_items = $count->{$status};
792 792
 				break;
793 793
 		}
794 794
 
795 795
 		$this->items = $data;
796 796
 
797
-		$this->set_pagination_args( array(
797
+		$this->set_pagination_args(array(
798 798
 				'total_items' => $total_items,
799 799
 				// WE have to calculate the total number of items
800 800
 				'per_page'    => $this->per_page,
801 801
 				// WE have to determine how many items to show on a page
802
-				'total_pages' => ceil( $total_items / $this->per_page )
802
+				'total_pages' => ceil($total_items / $this->per_page)
803 803
 				// WE have to calculate the total number of pages
804 804
 			)
805 805
 		);
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/upgrades/upgrade-functions.php 2 patches
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -26,30 +26,30 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function give_do_automatic_upgrades() {
28 28
 	$did_upgrade  = false;
29
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
29
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
30 30
 
31
-	if ( ! $give_version ) {
31
+	if ( ! $give_version) {
32 32
 		// 1.0 is the first version to use this option so we must add it.
33 33
 		$give_version = '1.0';
34 34
 	}
35 35
 
36
-	switch ( true ) {
36
+	switch (true) {
37 37
 
38
-		case version_compare( $give_version, '1.6', '<' ) :
38
+		case version_compare($give_version, '1.6', '<') :
39 39
 			give_v16_upgrades();
40 40
 			$did_upgrade = true;
41 41
 
42
-		case version_compare( $give_version, '1.7', '<' ) :
42
+		case version_compare($give_version, '1.7', '<') :
43 43
 			give_v17_upgrades();
44 44
 			$did_upgrade = true;
45 45
 	}
46 46
 
47
-	if ( $did_upgrade ) {
48
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
47
+	if ($did_upgrade) {
48
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
49 49
 	}
50 50
 }
51 51
 
52
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
52
+add_action('admin_init', 'give_do_automatic_upgrades');
53 53
 
54 54
 /**
55 55
  * Display Upgrade Notices
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function give_show_upgrade_notices() {
61 61
 
62
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
62
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
63 63
 		return;
64 64
 	} // Don't show notices on the upgrades page
65 65
 
66
-	$give_version = get_option( 'give_version' );
66
+	$give_version = get_option('give_version');
67 67
 
68
-	if ( ! $give_version ) {
68
+	if ( ! $give_version) {
69 69
 		// 1.0 is the first version to use this option so we must add it
70 70
 		$give_version = '1.0';
71 71
 	}
72 72
 
73
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
73
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
74 74
 
75 75
 	/*
76 76
 	 *  NOTICE:
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 
83 83
 	//v1.3.2 Upgrades
84
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
84
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
85 85
 		printf(
86 86
 		/* translators: %s: upgrade URL */
87
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
88
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
87
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
88
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
89 89
 		);
90 90
 	}
91 91
 
92 92
 	//v1.3.4 Upgrades //ensure the user has gone through 1.3.4
93
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
93
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
94 94
 		printf(
95 95
 		/* translators: %s: upgrade URL */
96
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
97
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
96
+			'<div class="updated"><p>'.__('Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
97
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
98 98
 		);
99 99
 	}
100 100
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 }
106 106
 
107
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
107
+add_action('admin_notices', 'give_show_upgrade_notices');
108 108
 
109 109
 /**
110 110
  * Triggers all upgrade functions
@@ -116,26 +116,26 @@  discard block
 block discarded – undo
116 116
  */
117 117
 function give_trigger_upgrades() {
118 118
 
119
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
120
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
119
+	if ( ! current_user_can('manage_give_settings')) {
120
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
121 121
 	}
122 122
 
123
-	$give_version = get_option( 'give_version' );
123
+	$give_version = get_option('give_version');
124 124
 
125
-	if ( ! $give_version ) {
125
+	if ( ! $give_version) {
126 126
 		// 1.0 is the first version to use this option so we must add it
127 127
 		$give_version = '1.0';
128
-		add_option( 'give_version', $give_version );
128
+		add_option('give_version', $give_version);
129 129
 	}
130 130
 
131
-	update_option( 'give_version', GIVE_VERSION );
131
+	update_option('give_version', GIVE_VERSION);
132 132
 
133
-	if ( DOING_AJAX ) {
134
-		die( 'complete' );
133
+	if (DOING_AJAX) {
134
+		die('complete');
135 135
 	} // Let AJAX know that the upgrade is complete
136 136
 }
137 137
 
138
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
138
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
139 139
 
140 140
 /**
141 141
  * Check if the upgrade routine has been run for a specific action
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @return bool                   If the action has been added to the completed actions array
148 148
  */
149
-function give_has_upgrade_completed( $upgrade_action = '' ) {
149
+function give_has_upgrade_completed($upgrade_action = '') {
150 150
 
151
-	if ( empty( $upgrade_action ) ) {
151
+	if (empty($upgrade_action)) {
152 152
 		return false;
153 153
 	}
154 154
 
155 155
 	$completed_upgrades = give_get_completed_upgrades();
156 156
 
157
-	return in_array( $upgrade_action, $completed_upgrades );
157
+	return in_array($upgrade_action, $completed_upgrades);
158 158
 
159 159
 }
160 160
 
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
  *
168 168
  * @return bool                   If the function was successfully added
169 169
  */
170
-function give_set_upgrade_complete( $upgrade_action = '' ) {
170
+function give_set_upgrade_complete($upgrade_action = '') {
171 171
 
172
-	if ( empty( $upgrade_action ) ) {
172
+	if (empty($upgrade_action)) {
173 173
 		return false;
174 174
 	}
175 175
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 	$completed_upgrades[] = $upgrade_action;
178 178
 
179 179
 	// Remove any blanks, and only show uniques
180
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
180
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
181 181
 
182
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
182
+	return update_option('give_completed_upgrades', $completed_upgrades);
183 183
 }
184 184
 
185 185
 /**
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
  */
191 191
 function give_get_completed_upgrades() {
192 192
 
193
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
193
+	$completed_upgrades = get_option('give_completed_upgrades');
194 194
 
195
-	if ( false === $completed_upgrades ) {
195
+	if (false === $completed_upgrades) {
196 196
 		$completed_upgrades = array();
197 197
 	}
198 198
 
@@ -210,30 +210,30 @@  discard block
 block discarded – undo
210 210
  */
211 211
 function give_v132_upgrade_give_payment_customer_id() {
212 212
 	global $wpdb;
213
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
214
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
213
+	if ( ! current_user_can('manage_give_settings')) {
214
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
215 215
 	}
216 216
 
217
-	ignore_user_abort( true );
217
+	ignore_user_abort(true);
218 218
 
219
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
220
-		@set_time_limit( 0 );
219
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
220
+		@set_time_limit(0);
221 221
 	}
222 222
 
223 223
 	//UPDATE DB METAKEYS
224 224
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
225
-	$query = $wpdb->query( $sql );
225
+	$query = $wpdb->query($sql);
226 226
 
227
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
228
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
229
-	delete_option( 'give_doing_upgrade' );
230
-	wp_redirect( admin_url() );
227
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
228
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
229
+	delete_option('give_doing_upgrade');
230
+	wp_redirect(admin_url());
231 231
 	exit;
232 232
 
233 233
 
234 234
 }
235 235
 
236
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
236
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
237 237
 
238 238
 /**
239 239
  * Upgrades the Offline Status
@@ -247,14 +247,14 @@  discard block
 block discarded – undo
247 247
 
248 248
 	global $wpdb;
249 249
 
250
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
251
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
250
+	if ( ! current_user_can('manage_give_settings')) {
251
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
252 252
 	}
253 253
 
254
-	ignore_user_abort( true );
254
+	ignore_user_abort(true);
255 255
 
256
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
257
-		@set_time_limit( 0 );
256
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
257
+		@set_time_limit(0);
258 258
 	}
259 259
 
260 260
 	// Get abandoned offline payments
@@ -264,35 +264,35 @@  discard block
 block discarded – undo
264 264
 	$where .= "AND ( p.post_status = 'abandoned' )";
265 265
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
266 266
 
267
-	$sql            = $select . $join . $where;
268
-	$found_payments = $wpdb->get_col( $sql );
267
+	$sql            = $select.$join.$where;
268
+	$found_payments = $wpdb->get_col($sql);
269 269
 
270 270
 
271
-	foreach ( $found_payments as $payment ) {
271
+	foreach ($found_payments as $payment) {
272 272
 
273 273
 		//Only change ones marked abandoned since our release last week
274 274
 		//because the admin may have marked some abandoned themselves
275
-		$modified_time = get_post_modified_time( 'U', false, $payment );
275
+		$modified_time = get_post_modified_time('U', false, $payment);
276 276
 
277 277
 		//1450124863 =  12/10/2015 20:42:25
278
-		if ( $modified_time >= 1450124863 ) {
278
+		if ($modified_time >= 1450124863) {
279 279
 
280
-			give_update_payment_status( $payment, 'pending' );
280
+			give_update_payment_status($payment, 'pending');
281 281
 
282 282
 		}
283 283
 
284 284
 	}
285 285
 
286
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
287
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
288
-	delete_option( 'give_doing_upgrade' );
289
-	wp_redirect( admin_url() );
286
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
287
+	give_set_upgrade_complete('upgrade_give_offline_status');
288
+	delete_option('give_doing_upgrade');
289
+	wp_redirect(admin_url());
290 290
 	exit;
291 291
 
292 292
 
293 293
 }
294 294
 
295
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
295
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
296 296
 
297 297
 /**
298 298
  * Cleanup User Roles
@@ -303,17 +303,17 @@  discard block
 block discarded – undo
303 303
  */
304 304
 function give_v152_cleanup_users() {
305 305
 
306
-	$give_version = get_option( 'give_version' );
306
+	$give_version = get_option('give_version');
307 307
 
308
-	if ( ! $give_version ) {
308
+	if ( ! $give_version) {
309 309
 		// 1.0 is the first version to use this option so we must add it
310 310
 		$give_version = '1.0';
311 311
 	}
312 312
 
313
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
313
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
314 314
 
315 315
 	//v1.5.2 Upgrades
316
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
316
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
317 317
 
318 318
 		//Delete all caps with "ss"
319 319
 		//Also delete all unused "campaign" roles
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 		);
361 361
 
362 362
 		global $wp_roles;
363
-		foreach ( $delete_caps as $cap ) {
364
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
365
-				$wp_roles->remove_cap( $role, $cap );
363
+		foreach ($delete_caps as $cap) {
364
+			foreach (array_keys($wp_roles->roles) as $role) {
365
+				$wp_roles->remove_cap($role, $cap);
366 366
 			}
367 367
 		}
368 368
 
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
 		$roles->add_caps();
373 373
 
374 374
 		//The Update Ran
375
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
376
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
377
-		delete_option( 'give_doing_upgrade' );
375
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
376
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
377
+		delete_option('give_doing_upgrade');
378 378
 
379 379
 	}
380 380
 
381 381
 }
382 382
 
383
-add_action( 'admin_init', 'give_v152_cleanup_users' );
383
+add_action('admin_init', 'give_v152_cleanup_users');
384 384
 
385 385
 /**
386 386
  * 1.6 Upgrade routine to create the customer meta table.
@@ -410,60 +410,60 @@  discard block
 block discarded – undo
410 410
  *
411 411
  * @since 1.7
412 412
  */
413
-function give_upgrade_addon_license_data(){
413
+function give_upgrade_addon_license_data() {
414 414
     global $give_options;
415 415
 
416 416
     $api_url = 'https://givewp.com/give-sl-api/';
417 417
 
418 418
     // Get addons license key.
419 419
     $addons = array();
420
-    foreach ( $give_options as $key => $value ) {
421
-        if( false !== strpos( $key, '_license_key' ) ) {
420
+    foreach ($give_options as $key => $value) {
421
+        if (false !== strpos($key, '_license_key')) {
422 422
             $addons[$key] = $value;
423 423
         }
424 424
     }
425 425
 
426 426
     // Bailout: We do not have any addon license data to upgrade.
427
-    if( empty( $addons ) ) {
427
+    if (empty($addons)) {
428 428
         return false;
429 429
     }
430 430
     
431
-    foreach ( $addons as $key => $addon_license ) {
431
+    foreach ($addons as $key => $addon_license) {
432 432
 
433 433
         // Get addon shortname.
434
-        $shortname = str_replace( '_license_key', '', $key );
434
+        $shortname = str_replace('_license_key', '', $key);
435 435
 
436 436
         // Addon license option name.
437
-        $addon_license_option_name = $shortname . '_license_active';
437
+        $addon_license_option_name = $shortname.'_license_active';
438 438
 
439 439
         // bailout if license is empty.
440
-        if( empty( $addon_license ) ) {
441
-            delete_option( $addon_license_option_name );
440
+        if (empty($addon_license)) {
441
+            delete_option($addon_license_option_name);
442 442
             continue;
443 443
         }
444 444
 
445 445
         // Get addon name.
446 446
         $addon_name = array();
447
-        $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
448
-        foreach ( $addon_name_parts as $name_part ) {
447
+        $addon_name_parts = explode('_', str_replace('give_', '', $shortname));
448
+        foreach ($addon_name_parts as $name_part) {
449 449
 
450 450
             // Fix addon name
451
-            switch ( $name_part ) {
451
+            switch ($name_part) {
452 452
                 case 'authorizenet' :
453 453
                     $name_part = 'authorize.net';
454 454
                     break;
455 455
             }
456 456
 
457
-            $addon_name[] = ucfirst( $name_part );
457
+            $addon_name[] = ucfirst($name_part);
458 458
         }
459 459
 
460
-        $addon_name = implode( ' ', $addon_name );
460
+        $addon_name = implode(' ', $addon_name);
461 461
 
462 462
         // Data to send to the API
463 463
         $api_params = array(
464 464
             'edd_action' => 'activate_license', //never change from "edd_" to "give_"!
465 465
             'license'    => $addon_license,
466
-            'item_name'  => urlencode( $addon_name ),
466
+            'item_name'  => urlencode($addon_name),
467 467
             'url'        => home_url()
468 468
         );
469 469
 
@@ -478,16 +478,16 @@  discard block
 block discarded – undo
478 478
         );
479 479
 
480 480
         // Make sure there are no errors
481
-        if ( is_wp_error( $response ) ) {
482
-            delete_option( $addon_license_option_name );
481
+        if (is_wp_error($response)) {
482
+            delete_option($addon_license_option_name);
483 483
             continue;
484 484
         }
485 485
 
486 486
         // Tell WordPress to look for updates
487
-        set_site_transient( 'update_plugins', null );
487
+        set_site_transient('update_plugins', null);
488 488
 
489 489
         // Decode license data
490
-        $license_data = json_decode( wp_remote_retrieve_body( $response ) );
491
-        update_option( $addon_license_option_name, $license_data );
490
+        $license_data = json_decode(wp_remote_retrieve_body($response));
491
+        update_option($addon_license_option_name, $license_data);
492 492
     }
493 493
 }
494 494
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -411,83 +411,83 @@
 block discarded – undo
411 411
  * @since 1.7
412 412
  */
413 413
 function give_upgrade_addon_license_data(){
414
-    $give_options = give_get_settings();
415
-
416
-    $api_url = 'https://givewp.com/give-sl-api/';
417
-
418
-    // Get addons license key.
419
-    $addons = array();
420
-    foreach ( $give_options as $key => $value ) {
421
-        if( false !== strpos( $key, '_license_key' ) ) {
422
-            $addons[$key] = $value;
423
-        }
424
-    }
425
-
426
-    // Bailout: We do not have any addon license data to upgrade.
427
-    if( empty( $addons ) ) {
428
-        return false;
429
-    }
414
+	$give_options = give_get_settings();
415
+
416
+	$api_url = 'https://givewp.com/give-sl-api/';
417
+
418
+	// Get addons license key.
419
+	$addons = array();
420
+	foreach ( $give_options as $key => $value ) {
421
+		if( false !== strpos( $key, '_license_key' ) ) {
422
+			$addons[$key] = $value;
423
+		}
424
+	}
425
+
426
+	// Bailout: We do not have any addon license data to upgrade.
427
+	if( empty( $addons ) ) {
428
+		return false;
429
+	}
430 430
     
431
-    foreach ( $addons as $key => $addon_license ) {
432
-
433
-        // Get addon shortname.
434
-        $shortname = str_replace( '_license_key', '', $key );
435
-
436
-        // Addon license option name.
437
-        $addon_license_option_name = $shortname . '_license_active';
438
-
439
-        // bailout if license is empty.
440
-        if( empty( $addon_license ) ) {
441
-            delete_option( $addon_license_option_name );
442
-            continue;
443
-        }
444
-
445
-        // Get addon name.
446
-        $addon_name = array();
447
-        $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
448
-        foreach ( $addon_name_parts as $name_part ) {
449
-
450
-            // Fix addon name
451
-            switch ( $name_part ) {
452
-                case 'authorizenet' :
453
-                    $name_part = 'authorize.net';
454
-                    break;
455
-            }
456
-
457
-            $addon_name[] = ucfirst( $name_part );
458
-        }
459
-
460
-        $addon_name = implode( ' ', $addon_name );
461
-
462
-        // Data to send to the API
463
-        $api_params = array(
464
-            'edd_action' => 'activate_license', //never change from "edd_" to "give_"!
465
-            'license'    => $addon_license,
466
-            'item_name'  => urlencode( $addon_name ),
467
-            'url'        => home_url()
468
-        );
469
-
470
-        // Call the API
471
-        $response = wp_remote_post(
472
-            $api_url,
473
-            array(
474
-                'timeout'   => 15,
475
-                'sslverify' => false,
476
-                'body'      => $api_params
477
-            )
478
-        );
479
-
480
-        // Make sure there are no errors
481
-        if ( is_wp_error( $response ) ) {
482
-            delete_option( $addon_license_option_name );
483
-            continue;
484
-        }
485
-
486
-        // Tell WordPress to look for updates
487
-        set_site_transient( 'update_plugins', null );
488
-
489
-        // Decode license data
490
-        $license_data = json_decode( wp_remote_retrieve_body( $response ) );
491
-        update_option( $addon_license_option_name, $license_data );
492
-    }
431
+	foreach ( $addons as $key => $addon_license ) {
432
+
433
+		// Get addon shortname.
434
+		$shortname = str_replace( '_license_key', '', $key );
435
+
436
+		// Addon license option name.
437
+		$addon_license_option_name = $shortname . '_license_active';
438
+
439
+		// bailout if license is empty.
440
+		if( empty( $addon_license ) ) {
441
+			delete_option( $addon_license_option_name );
442
+			continue;
443
+		}
444
+
445
+		// Get addon name.
446
+		$addon_name = array();
447
+		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
448
+		foreach ( $addon_name_parts as $name_part ) {
449
+
450
+			// Fix addon name
451
+			switch ( $name_part ) {
452
+				case 'authorizenet' :
453
+					$name_part = 'authorize.net';
454
+					break;
455
+			}
456
+
457
+			$addon_name[] = ucfirst( $name_part );
458
+		}
459
+
460
+		$addon_name = implode( ' ', $addon_name );
461
+
462
+		// Data to send to the API
463
+		$api_params = array(
464
+			'edd_action' => 'activate_license', //never change from "edd_" to "give_"!
465
+			'license'    => $addon_license,
466
+			'item_name'  => urlencode( $addon_name ),
467
+			'url'        => home_url()
468
+		);
469
+
470
+		// Call the API
471
+		$response = wp_remote_post(
472
+			$api_url,
473
+			array(
474
+				'timeout'   => 15,
475
+				'sslverify' => false,
476
+				'body'      => $api_params
477
+			)
478
+		);
479
+
480
+		// Make sure there are no errors
481
+		if ( is_wp_error( $response ) ) {
482
+			delete_option( $addon_license_option_name );
483
+			continue;
484
+		}
485
+
486
+		// Tell WordPress to look for updates
487
+		set_site_transient( 'update_plugins', null );
488
+
489
+		// Decode license data
490
+		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
491
+		update_option( $addon_license_option_name, $license_data );
492
+	}
493 493
 }
494 494
\ 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   +189 added lines, -189 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
 
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
 		'user_id' => 0
55 55
 	);
56 56
 
57
-	$customer_info = wp_parse_args( $customer_info, $defaults );
57
+	$customer_info = wp_parse_args($customer_info, $defaults);
58 58
 
59
-	if ( ! is_email( $customer_info['email'] ) ) {
60
-		give_set_error( 'give-invalid-email', esc_html__( 'Please enter a valid email address.', 'give' ) );
59
+	if ( ! is_email($customer_info['email'])) {
60
+		give_set_error('give-invalid-email', esc_html__('Please enter a valid email address.', 'give'));
61 61
 	}
62 62
 
63
-	if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) {
63
+	if ((int) $customer_info['user_id'] != (int) $customer->user_id) {
64 64
 
65 65
 		// Make sure we don't already have this user attached to a customer
66
-		if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) {
67
-			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'] ) );
66
+		if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) {
67
+			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']));
68 68
 		}
69 69
 
70 70
 		// Make sure it's actually a user
71
-		$user = get_user_by( 'id', $customer_info['user_id'] );
72
-		if ( ! empty( $customer_info['user_id'] ) && false === $user ) {
73
-			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'] ) );
71
+		$user = get_user_by('id', $customer_info['user_id']);
72
+		if ( ! empty($customer_info['user_id']) && false === $user) {
73
+			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']));
74 74
 		}
75 75
 
76 76
 	}
@@ -78,53 +78,53 @@  discard block
 block discarded – undo
78 78
 	// Record this for later
79 79
 	$previous_user_id = $customer->user_id;
80 80
 
81
-	if ( give_get_errors() ) {
81
+	if (give_get_errors()) {
82 82
 		return;
83 83
 	}
84 84
 
85 85
 	// Setup the customer address, if present
86 86
 	$address = array();
87
-	if ( intval( $customer_info['user_id'] ) > 0 ) {
87
+	if (intval($customer_info['user_id']) > 0) {
88 88
 
89
-		$current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true );
89
+		$current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true);
90 90
 
91
-		if ( false === $current_address ) {
92
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : '';
93
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : '';
94
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : '';
95
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : '';
96
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : '';
97
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : '';
91
+		if (false === $current_address) {
92
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : '';
93
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : '';
94
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : '';
95
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : '';
96
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : '';
97
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : '';
98 98
 		} else {
99
-			$current_address    = wp_parse_args( $current_address, array(
99
+			$current_address    = wp_parse_args($current_address, array(
100 100
 				'line1',
101 101
 				'line2',
102 102
 				'city',
103 103
 				'zip',
104 104
 				'state',
105 105
 				'country'
106
-			) );
107
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1'];
108
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2'];
109
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city'];
110
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country'];
111
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip'];
112
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state'];
106
+			));
107
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1'];
108
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2'];
109
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city'];
110
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country'];
111
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip'];
112
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state'];
113 113
 		}
114 114
 
115 115
 	}
116 116
 
117 117
 	// Sanitize the inputs
118 118
 	$customer_data            = array();
119
-	$customer_data['name']    = strip_tags( stripslashes( $customer_info['name'] ) );
119
+	$customer_data['name']    = strip_tags(stripslashes($customer_info['name']));
120 120
 	$customer_data['email']   = $customer_info['email'];
121 121
 	$customer_data['user_id'] = $customer_info['user_id'];
122 122
 
123
-	$customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id );
124
-	$address       = apply_filters( 'give_edit_customer_address', $address, $customer_id );
123
+	$customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id);
124
+	$address       = apply_filters('give_edit_customer_address', $address, $customer_id);
125 125
 
126
-	$customer_data = array_map( 'sanitize_text_field', $customer_data );
127
-	$address       = array_map( 'sanitize_text_field', $address );
126
+	$customer_data = array_map('sanitize_text_field', $customer_data);
127
+	$address       = array_map('sanitize_text_field', $address);
128 128
 
129 129
 
130 130
 	/**
@@ -136,34 +136,34 @@  discard block
 block discarded – undo
136 136
 	 * @param array $customer_data The customer data.
137 137
 	 * @param array $address       The customer address.
138 138
 	 */
139
-	do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address );
139
+	do_action('give_pre_edit_customer', $customer_id, $customer_data, $address);
140 140
 
141 141
 	$output         = array();
142 142
 	$previous_email = $customer->email;
143 143
 
144
-	if ( $customer->update( $customer_data ) ) {
144
+	if ($customer->update($customer_data)) {
145 145
 
146
-		if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) {
147
-			update_user_meta( $customer->user_id, '_give_user_address', $address );
146
+		if ( ! empty($customer->user_id) && $customer->user_id > 0) {
147
+			update_user_meta($customer->user_id, '_give_user_address', $address);
148 148
 		}
149 149
 
150 150
 		// Update some donation meta if we need to
151
-		$payments_array = explode( ',', $customer->payment_ids );
151
+		$payments_array = explode(',', $customer->payment_ids);
152 152
 
153
-		if ( $customer->email != $previous_email ) {
154
-			foreach ( $payments_array as $payment_id ) {
155
-				give_update_payment_meta( $payment_id, 'email', $customer->email );
153
+		if ($customer->email != $previous_email) {
154
+			foreach ($payments_array as $payment_id) {
155
+				give_update_payment_meta($payment_id, 'email', $customer->email);
156 156
 			}
157 157
 		}
158 158
 
159
-		if ( $customer->user_id != $previous_user_id ) {
160
-			foreach ( $payments_array as $payment_id ) {
161
-				give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id );
159
+		if ($customer->user_id != $previous_user_id) {
160
+			foreach ($payments_array as $payment_id) {
161
+				give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id);
162 162
 			}
163 163
 		}
164 164
 
165 165
 		$output['success']       = true;
166
-		$customer_data           = array_merge( $customer_data, $address );
166
+		$customer_data           = array_merge($customer_data, $address);
167 167
 		$output['customer_info'] = $customer_data;
168 168
 
169 169
 	} else {
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 	 * @param int   $customer_id   The ID of the customer.
181 181
 	 * @param array $customer_data The customer data.
182 182
 	 */
183
-	do_action( 'give_post_edit_customer', $customer_id, $customer_data );
183
+	do_action('give_post_edit_customer', $customer_id, $customer_data);
184 184
 
185
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
186
-		header( 'Content-Type: application/json' );
187
-		echo json_encode( $output );
185
+	if (defined('DOING_AJAX') && DOING_AJAX) {
186
+		header('Content-Type: application/json');
187
+		echo json_encode($output);
188 188
 		wp_die();
189 189
 	}
190 190
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
 }
194 194
 
195
-add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 );
195
+add_action('give_edit-customer', 'give_edit_customer', 10, 1);
196 196
 
197 197
 /**
198 198
  * Save a customer note being added
@@ -203,36 +203,36 @@  discard block
 block discarded – undo
203 203
  *
204 204
  * @return int         The Note ID that was saved, or 0 if nothing was saved
205 205
  */
206
-function give_customer_save_note( $args ) {
206
+function give_customer_save_note($args) {
207 207
 
208
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
208
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
209 209
 
210
-	if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) {
211
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
210
+	if ( ! is_admin() || ! current_user_can($customer_view_role)) {
211
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
212 212
 	}
213 213
 
214
-	if ( empty( $args ) ) {
214
+	if (empty($args)) {
215 215
 		return;
216 216
 	}
217 217
 
218
-	$customer_note = trim( sanitize_text_field( $args['customer_note'] ) );
218
+	$customer_note = trim(sanitize_text_field($args['customer_note']));
219 219
 	$customer_id   = (int) $args['customer_id'];
220 220
 	$nonce         = $args['add_customer_note_nonce'];
221 221
 
222
-	if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) {
223
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
222
+	if ( ! wp_verify_nonce($nonce, 'add-customer-note')) {
223
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
224 224
 	}
225 225
 
226
-	if ( empty( $customer_note ) ) {
227
-		give_set_error( 'empty-customer-note', esc_html__( 'A note is required.', 'give' ) );
226
+	if (empty($customer_note)) {
227
+		give_set_error('empty-customer-note', esc_html__('A note is required.', 'give'));
228 228
 	}
229 229
 
230
-	if ( give_get_errors() ) {
230
+	if (give_get_errors()) {
231 231
 		return;
232 232
 	}
233 233
 
234
-	$customer = new Give_Customer( $customer_id );
235
-	$new_note = $customer->add_note( $customer_note );
234
+	$customer = new Give_Customer($customer_id);
235
+	$new_note = $customer->add_note($customer_note);
236 236
 
237 237
 	/**
238 238
 	 * Fires before inserting customer note.
@@ -242,22 +242,22 @@  discard block
 block discarded – undo
242 242
 	 * @param int    $customer_id The ID of the customer.
243 243
 	 * @param string $new_note    Note content.
244 244
 	 */
245
-	do_action( 'give_pre_insert_customer_note', $customer_id, $new_note );
245
+	do_action('give_pre_insert_customer_note', $customer_id, $new_note);
246 246
 
247
-	if ( ! empty( $new_note ) && ! empty( $customer->id ) ) {
247
+	if ( ! empty($new_note) && ! empty($customer->id)) {
248 248
 
249 249
 		ob_start();
250 250
 		?>
251 251
 		<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
252 252
 			<span class="note-content-wrap">
253
-				<?php echo stripslashes( $new_note ); ?>
253
+				<?php echo stripslashes($new_note); ?>
254 254
 			</span>
255 255
 		</div>
256 256
 		<?php
257 257
 		$output = ob_get_contents();
258 258
 		ob_end_clean();
259 259
 
260
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
260
+		if (defined('DOING_AJAX') && DOING_AJAX) {
261 261
 			echo $output;
262 262
 			exit;
263 263
 		}
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
 }
272 272
 
273
-add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 );
273
+add_action('give_add-customer-note', 'give_customer_save_note', 10, 1);
274 274
 
275 275
 /**
276 276
  * Delete a customer
@@ -281,37 +281,37 @@  discard block
 block discarded – undo
281 281
  *
282 282
  * @return int Whether it was a successful deletion
283 283
  */
284
-function give_customer_delete( $args ) {
284
+function give_customer_delete($args) {
285 285
 
286
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
286
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
287 287
 
288
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
289
-		wp_die( esc_html__( 'You do not have permission to delete donors.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
288
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
289
+		wp_die(esc_html__('You do not have permission to delete donors.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
290 290
 	}
291 291
 
292
-	if ( empty( $args ) ) {
292
+	if (empty($args)) {
293 293
 		return;
294 294
 	}
295 295
 
296 296
 	$customer_id = (int) $args['customer_id'];
297
-	$confirm     = ! empty( $args['give-customer-delete-confirm'] ) ? true : false;
298
-	$remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false;
297
+	$confirm     = ! empty($args['give-customer-delete-confirm']) ? true : false;
298
+	$remove_data = ! empty($args['give-customer-delete-records']) ? true : false;
299 299
 	$nonce       = $args['_wpnonce'];
300 300
 
301
-	if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) {
302
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
301
+	if ( ! wp_verify_nonce($nonce, 'delete-customer')) {
302
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
303 303
 	}
304 304
 
305
-	if ( ! $confirm ) {
306
-		give_set_error( 'customer-delete-no-confirm', esc_html__( 'Please confirm you want to delete this donor.', 'give' ) );
305
+	if ( ! $confirm) {
306
+		give_set_error('customer-delete-no-confirm', esc_html__('Please confirm you want to delete this donor.', 'give'));
307 307
 	}
308 308
 
309
-	if ( give_get_errors() ) {
310
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) );
309
+	if (give_get_errors()) {
310
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id));
311 311
 		exit;
312 312
 	}
313 313
 
314
-	$customer = new Give_Customer( $customer_id );
314
+	$customer = new Give_Customer($customer_id);
315 315
 
316 316
 	/**
317 317
 	 * Fires before deleting customer.
@@ -322,53 +322,53 @@  discard block
 block discarded – undo
322 322
 	 * @param bool $confirm     Delete confirmation.
323 323
 	 * @param bool $remove_data Records delete confirmation.
324 324
 	 */
325
-	do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data );
325
+	do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data);
326 326
 	
327
-	if ( $customer->id > 0 ) {
327
+	if ($customer->id > 0) {
328 328
 
329
-		$payments_array = explode( ',', $customer->payment_ids );
330
-		$success        = Give()->customers->delete( $customer->id );
329
+		$payments_array = explode(',', $customer->payment_ids);
330
+		$success        = Give()->customers->delete($customer->id);
331 331
 
332
-		if ( $success ) {
332
+		if ($success) {
333 333
 
334
-			if ( $remove_data ) {
334
+			if ($remove_data) {
335 335
 
336 336
 				// Remove all donations, logs, etc
337
-				foreach ( $payments_array as $payment_id ) {
338
-					give_delete_purchase( $payment_id );
337
+				foreach ($payments_array as $payment_id) {
338
+					give_delete_purchase($payment_id);
339 339
 				}
340 340
 
341 341
 			} else {
342 342
 
343 343
 				// Just set the donations to customer_id of 0
344
-				foreach ( $payments_array as $payment_id ) {
345
-					give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 );
344
+				foreach ($payments_array as $payment_id) {
345
+					give_update_payment_meta($payment_id, '_give_payment_customer_id', 0);
346 346
 				}
347 347
 
348 348
 			}
349 349
 
350
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' );
350
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted');
351 351
 
352 352
 		} else {
353 353
 
354
-			give_set_error( 'give-donor-delete-failed', esc_html__( 'Error deleting donor.', 'give' ) );
355
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id );
354
+			give_set_error('give-donor-delete-failed', esc_html__('Error deleting donor.', 'give'));
355
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id);
356 356
 
357 357
 		}
358 358
 
359 359
 	} else {
360 360
 
361
-		give_set_error( 'give-customer-delete-invalid-id', esc_html__( 'Invalid Donor ID.', 'give' ) );
362
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
361
+		give_set_error('give-customer-delete-invalid-id', esc_html__('Invalid Donor ID.', 'give'));
362
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
363 363
 
364 364
 	}
365 365
 
366
-	wp_redirect( $redirect );
366
+	wp_redirect($redirect);
367 367
 	exit;
368 368
 
369 369
 }
370 370
 
371
-add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 );
371
+add_action('give_delete-customer', 'give_customer_delete', 10, 1);
372 372
 
373 373
 /**
374 374
  * Disconnect a user ID from a donor
@@ -379,27 +379,27 @@  discard block
 block discarded – undo
379 379
  *
380 380
  * @return bool        If the disconnect was successful
381 381
  */
382
-function give_disconnect_customer_user_id( $args ) {
382
+function give_disconnect_customer_user_id($args) {
383 383
 
384
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
384
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
385 385
 
386
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
387
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
386
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
387
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
388 388
 	}
389 389
 
390
-	if ( empty( $args ) ) {
390
+	if (empty($args)) {
391 391
 		return;
392 392
 	}
393 393
 
394 394
 	$customer_id = (int) $args['customer_id'];
395 395
 	$nonce       = $args['_wpnonce'];
396 396
 
397
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
398
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
397
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
398
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
399 399
 	}
400 400
 
401
-	$customer = new Give_Customer( $customer_id );
402
-	if ( empty( $customer->id ) ) {
401
+	$customer = new Give_Customer($customer_id);
402
+	if (empty($customer->id)) {
403 403
 		return false;
404 404
 	}
405 405
 
@@ -413,16 +413,16 @@  discard block
 block discarded – undo
413 413
 	 * @param int $customer_id The ID of the customer.
414 414
 	 * @param int $user_id     The ID of the user.
415 415
 	 */
416
-	do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $user_id );
416
+	do_action('give_pre_customer_disconnect_user_id', $customer_id, $user_id);
417 417
 
418 418
 	$output = array();
419
-	$customer_args = array( 'user_id' => 0 );
419
+	$customer_args = array('user_id' => 0);
420 420
 
421
-	if ( $customer->update( $customer_args ) ) {
421
+	if ($customer->update($customer_args)) {
422 422
 		global $wpdb;
423 423
 
424
-		if ( ! empty( $customer->payment_ids ) ) {
425
-			$wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" );
424
+		if ( ! empty($customer->payment_ids)) {
425
+			$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )");
426 426
 		}
427 427
 
428 428
 		$output['success'] = true;
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 	} else {
431 431
 
432 432
 		$output['success'] = false;
433
-		give_set_error( 'give-disconnect-user-fail', esc_html__( 'Failed to disconnect user from donor.', 'give' ) );
433
+		give_set_error('give-disconnect-user-fail', esc_html__('Failed to disconnect user from donor.', 'give'));
434 434
 	}
435 435
 
436 436
 	/**
@@ -440,11 +440,11 @@  discard block
 block discarded – undo
440 440
 	 *
441 441
 	 * @param int $customer_id The ID of the customer.
442 442
 	 */
443
-	do_action( 'give_post_customer_disconnect_user_id', $customer_id );
443
+	do_action('give_post_customer_disconnect_user_id', $customer_id);
444 444
 
445
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
446
-		header( 'Content-Type: application/json' );
447
-		echo json_encode( $output );
445
+	if (defined('DOING_AJAX') && DOING_AJAX) {
446
+		header('Content-Type: application/json');
447
+		echo json_encode($output);
448 448
 		wp_die();
449 449
 	}
450 450
 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 
453 453
 }
454 454
 
455
-add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 );
455
+add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1);
456 456
 
457 457
 /**
458 458
  * Add an email address to the donor from within the admin and log a donor note
@@ -461,81 +461,81 @@  discard block
 block discarded – undo
461 461
  * @param  array $args  Array of arguments: nonce, customer id, and email address
462 462
  * @return mixed        If DOING_AJAX echos out JSON, otherwise returns array of success (bool) and message (string)
463 463
  */
464
-function give_add_donor_email( $args ) {
465
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
464
+function give_add_donor_email($args) {
465
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
466 466
 
467
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
468
-		wp_die( __( 'You do not have permission to edit this donor.', 'edit' ) );
467
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
468
+		wp_die(__('You do not have permission to edit this donor.', 'edit'));
469 469
 	}
470 470
 
471 471
 	$output = array();
472
-	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
472
+	if (empty($args) || empty($args['email']) || empty($args['customer_id'])) {
473 473
 		$output['success'] = false;
474
-		if ( empty( $args['email'] ) ) {
475
-			$output['message'] = __( 'Email address is required.', 'give' );
476
-		} else if ( empty( $args['customer_id'] ) ) {
477
-			$output['message'] = __( 'Customer ID is required.', 'give' );
474
+		if (empty($args['email'])) {
475
+			$output['message'] = __('Email address is required.', 'give');
476
+		} else if (empty($args['customer_id'])) {
477
+			$output['message'] = __('Customer ID is required.', 'give');
478 478
 		} else {
479
-			$output['message'] = __( 'An error has occurred. Please try again.', 'give' );
479
+			$output['message'] = __('An error has occurred. Please try again.', 'give');
480 480
 		}
481
-	} else if ( ! wp_verify_nonce( $args['_wpnonce'], 'give_add_donor_email' ) ) {
481
+	} else if ( ! wp_verify_nonce($args['_wpnonce'], 'give_add_donor_email')) {
482 482
 		$output = array(
483 483
 			'success' => false,
484
-			'message' => __( 'Nonce verification failed.', 'give' ),
484
+			'message' => __('Nonce verification failed.', 'give'),
485 485
 		);
486
-	} else if ( ! is_email( $args['email'] ) ) {
486
+	} else if ( ! is_email($args['email'])) {
487 487
 		$output = array(
488 488
 			'success' => false,
489
-			'message' => __( 'Invalid email address.', 'give' ),
489
+			'message' => __('Invalid email address.', 'give'),
490 490
 		);
491 491
 	} else {
492
-		$email       = sanitize_email($args['email'] );
492
+		$email       = sanitize_email($args['email']);
493 493
 		$customer_id = (int) $args['customer_id'];
494 494
 		$primary     = 'true' === $args['primary'] ? true : false;
495
-		$customer    = new Give_Customer( $customer_id );
496
-		if ( false === $customer->add_email( $email, $primary ) ) {
497
-			if ( in_array( $email, $customer->emails ) ) {
495
+		$customer    = new Give_Customer($customer_id);
496
+		if (false === $customer->add_email($email, $primary)) {
497
+			if (in_array($email, $customer->emails)) {
498 498
 				$output = array(
499 499
 					'success'  => false,
500
-					'message'  => __( 'Email already associated with this donor.', 'give' ),
500
+					'message'  => __('Email already associated with this donor.', 'give'),
501 501
 				);
502 502
 			} else {
503 503
 				$output = array(
504 504
 					'success' => false,
505
-					'message' => __( 'Email address is already associated with another donor.', 'give' ),
505
+					'message' => __('Email address is already associated with another donor.', 'give'),
506 506
 				);
507 507
 			}
508 508
 		} else {
509
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id . '&give-message=email-added' );
509
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id.'&give-message=email-added');
510 510
 			$output = array(
511 511
 				'success'  => true,
512
-				'message'  => __( 'Email successfully added to donor.', 'give' ),
512
+				'message'  => __('Email successfully added to donor.', 'give'),
513 513
 				'redirect' => $redirect,
514 514
 			);
515 515
 
516 516
 			$user          = wp_get_current_user();
517
-			$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
518
-			$customer_note = __( sprintf( 'Email address %s added by %s', $email, $user_login ), 'give' );
519
-			$customer->add_note( $customer_note );
517
+			$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
518
+			$customer_note = __(sprintf('Email address %s added by %s', $email, $user_login), 'give');
519
+			$customer->add_note($customer_note);
520 520
 
521
-			if ( $primary ) {
522
-				$customer_note = __( sprintf( 'Email address %s set as primary by %s', $email, $user_login ), 'give' );
523
-				$customer->add_note( $customer_note );
521
+			if ($primary) {
522
+				$customer_note = __(sprintf('Email address %s set as primary by %s', $email, $user_login), 'give');
523
+				$customer->add_note($customer_note);
524 524
 			}
525 525
 		}
526 526
 	}
527 527
 
528
-	do_action( 'give_post_add_customer_email', $customer_id, $args );
528
+	do_action('give_post_add_customer_email', $customer_id, $args);
529 529
 
530
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
531
-		header( 'Content-Type: application/json' );
532
-		echo json_encode( $output );
530
+	if (defined('DOING_AJAX') && DOING_AJAX) {
531
+		header('Content-Type: application/json');
532
+		echo json_encode($output);
533 533
 		wp_die();
534 534
 	}
535 535
 
536 536
 	return $output;
537 537
 }
538
-add_action( 'give_add_donor_email', 'give_add_donor_email', 10, 1 );
538
+add_action('give_add_donor_email', 'give_add_donor_email', 10, 1);
539 539
 
540 540
 
541 541
 /**
@@ -546,36 +546,36 @@  discard block
 block discarded – undo
546 546
  * @return void|bool
547 547
  */
548 548
 function give_remove_donor_email() {
549
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
549
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
550 550
 		return false;
551 551
 	}
552
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
552
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
553 553
 		return false;
554 554
 	}
555
-	if ( empty( $_GET['_wpnonce'] ) ) {
555
+	if (empty($_GET['_wpnonce'])) {
556 556
 		return false;
557 557
 	}
558 558
 
559 559
 	$nonce = $_GET['_wpnonce'];
560
-	if ( ! wp_verify_nonce( $nonce, 'give-remove-donor-email' ) ) {
561
-		wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
560
+	if ( ! wp_verify_nonce($nonce, 'give-remove-donor-email')) {
561
+		wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array('response' => 403));
562 562
 	}
563 563
 
564
-	$customer = new Give_Customer( $_GET['id'] );
565
-	if ( $customer->remove_email( $_GET['email'] ) ) {
566
-		$url = add_query_arg( 'give-message', 'email-removed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ) );
564
+	$customer = new Give_Customer($_GET['id']);
565
+	if ($customer->remove_email($_GET['email'])) {
566
+		$url = add_query_arg('give-message', 'email-removed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id));
567 567
 		$user          = wp_get_current_user();
568
-		$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
569
-		$customer_note = __( sprintf( 'Email address %s removed by %s', $_GET['email'], $user_login ), 'give' );
570
-		$customer->add_note( $customer_note );
568
+		$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
569
+		$customer_note = __(sprintf('Email address %s removed by %s', $_GET['email'], $user_login), 'give');
570
+		$customer->add_note($customer_note);
571 571
 	} else {
572
-		$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 ) );
572
+		$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));
573 573
 	}
574 574
 
575
-	wp_safe_redirect( $url );
575
+	wp_safe_redirect($url);
576 576
 	exit;
577 577
 }
578
-add_action( 'give_remove_donor_email', 'give_remove_donor_email', 10 );
578
+add_action('give_remove_donor_email', 'give_remove_donor_email', 10);
579 579
 
580 580
 
581 581
 /**
@@ -586,38 +586,38 @@  discard block
 block discarded – undo
586 586
  * @return void|bool
587 587
  */
588 588
 function give_set_donor_primary_email() {
589
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
589
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
590 590
 		return false;
591 591
 	}
592 592
 
593
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
593
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
594 594
 		return false;
595 595
 	}
596 596
 
597
-	if ( empty( $_GET['_wpnonce'] ) ) {
597
+	if (empty($_GET['_wpnonce'])) {
598 598
 		return false;
599 599
 	}
600 600
 
601 601
 	$nonce = $_GET['_wpnonce'];
602 602
 
603
-	if ( ! wp_verify_nonce( $nonce, 'give-set-donor-primary-email' ) ) {
604
-		wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
603
+	if ( ! wp_verify_nonce($nonce, 'give-set-donor-primary-email')) {
604
+		wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array('response' => 403));
605 605
 	}
606 606
 
607
-	$donor = new Give_Customer( $_GET['id'] );
607
+	$donor = new Give_Customer($_GET['id']);
608 608
 
609
-	if ( $donor->set_primary_email( $_GET['email'] ) ) {
610
-		$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 ) );
609
+	if ($donor->set_primary_email($_GET['email'])) {
610
+		$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));
611 611
 		$user          = wp_get_current_user();
612
-		$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
613
-		$donor_note    = __( sprintf( 'Email address %s set as primary by %s', $_GET['email'], $user_login ), 'give' );
612
+		$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
613
+		$donor_note    = __(sprintf('Email address %s set as primary by %s', $_GET['email'], $user_login), 'give');
614 614
 
615
-		$donor->add_note( $donor_note );
615
+		$donor->add_note($donor_note);
616 616
 	} else {
617
-		$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 ) );
617
+		$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));
618 618
 	}
619 619
 
620
-	wp_safe_redirect( $url );
620
+	wp_safe_redirect($url);
621 621
 	exit;
622 622
 }
623
-add_action( 'give_set_donor_primary_email', 'give_set_donor_primary_email', 10 );
623
+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/class-give-donate-form.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -409,7 +409,7 @@
 block discarded – undo
409 409
 	 *
410 410
 	 * @param  array $data Array of attributes for a donation form.
411 411
 	 *
412
-	 * @return mixed       False if data isn't passed and class not instantiated for creation, or New Form ID.
412
+	 * @return boolean       False if data isn't passed and class not instantiated for creation, or New Form ID.
413 413
 	 */
414 414
 	public function create( $data = array() ) {
415 415
 
Please login to merge, or discard this patch.
includes/forms/template.php 2 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   +373 added lines, -373 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 = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = esc_url(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,15 +105,15 @@  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; ?>" action="<?php echo $form_action; ?>" method="post">
112 112
 				<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
113
-				<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
114
-				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
115
-				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
116
-				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
113
+				<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
114
+				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
115
+				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
116
+				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
117 117
 
118 118
 				<!-- The following field is for robots only, invisible to humans: -->
119 119
 				<span class="give-hidden" style="display: none !important;">
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
 				<?php
125 125
 
126 126
 				//Price ID hidden field for variable (mult-level) donation forms
127
-				if ( give_has_variable_prices( $form_id ) ) {
127
+				if (give_has_variable_prices($form_id)) {
128 128
 					//get default selected price ID
129
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
129
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
130 130
 					$price_id = 0;
131 131
 					//loop through prices
132
-					foreach ( $prices as $price ) {
133
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
132
+					foreach ($prices as $price) {
133
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
134 134
 							$price_id = $price['_give_id']['level_id'];
135 135
 						};
136 136
 					}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 				 * @param int   $form_id The form ID.
147 147
 				 * @param array $args    An array of form arguments.
148 148
 				 */
149
-				do_action( 'give_checkout_form_top', $form->ID, $args );
149
+				do_action('give_checkout_form_top', $form->ID, $args);
150 150
 
151 151
 				/**
152 152
 				 * Fires while outputing donation form, for payment gatways fields.
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 				 * @param int   $form_id The form ID.
157 157
 				 * @param array $args    An array of form arguments.
158 158
 				 */
159
-				do_action( 'give_donation_mode_select', $form->ID, $args );
159
+				do_action('give_donation_mode_select', $form->ID, $args);
160 160
 
161 161
 				/**
162 162
 				 * Fires while outputing donation form, after all other fields.
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 				 * @param int   $form_id The form ID.
167 167
 				 * @param array $args    An array of form arguments.
168 168
 				 */
169
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
169
+				do_action('give_checkout_form_bottom', $form->ID, $args);
170 170
 
171 171
 				?>
172 172
 			</form>
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 			 * @param int   $form_id The form ID.
181 181
 			 * @param array $args    An array of form arguments.
182 182
 			 */
183
-			do_action( 'give_post_form', $form->ID, $args );
183
+			do_action('give_post_form', $form->ID, $args);
184 184
 
185 185
 		}
186 186
 		?>
187 187
 
188
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
188
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
189 189
 	<?php
190 190
 
191 191
 	/**
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 	 * @param int   $form_id The form ID.
197 197
 	 * @param array $args    An array of form arguments.
198 198
 	 */
199
-	do_action( 'give_post_form_output', $form->ID, $args );
199
+	do_action('give_post_form_output', $form->ID, $args);
200 200
 
201 201
 	$final_output = ob_get_clean();
202 202
 
203
-	echo apply_filters( 'give_donate_form', $final_output, $args );
203
+	echo apply_filters('give_donate_form', $final_output, $args);
204 204
 }
205 205
 
206 206
 /**
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
  *
218 218
  * @return string
219 219
  */
220
-function give_show_purchase_form( $form_id ) {
220
+function give_show_purchase_form($form_id) {
221 221
 
222
-	$payment_mode = give_get_chosen_gateway( $form_id );
222
+	$payment_mode = give_get_chosen_gateway($form_id);
223 223
 
224
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
224
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
225 225
 		$form_id = $_POST['give_form_id'];
226 226
 	}
227 227
 
@@ -230,33 +230,33 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @since 1.7
232 232
 	 */
233
-	do_action( 'give_donation_form_top', $form_id );
233
+	do_action('give_donation_form_top', $form_id);
234 234
 
235
-	if ( give_can_checkout() && isset( $form_id ) ) {
235
+	if (give_can_checkout() && isset($form_id)) {
236 236
 
237 237
 		/**
238 238
 		 * Fires while displaying donation form, before registration login.
239 239
 		 *
240 240
 		 * @since 1.7
241 241
 		 */
242
-		do_action( 'give_donation_form_before_register_login', $form_id );
242
+		do_action('give_donation_form_before_register_login', $form_id);
243 243
 
244 244
 		/**
245 245
 		 * Fire when register/login form fields render.
246 246
 		 *
247 247
 		 * @since 1.7
248 248
 		 */
249
-		do_action( 'give_donation_form_register_login_fields', $form_id );
249
+		do_action('give_donation_form_register_login_fields', $form_id);
250 250
 
251 251
 		/**
252 252
 		 * Fire when credit card form fields render.
253 253
 		 *
254 254
 		 * @since 1.7
255 255
 		 */
256
-		do_action( 'give_donation_form_before_cc_form', $form_id );
256
+		do_action('give_donation_form_before_cc_form', $form_id);
257 257
 
258 258
 		// Load the credit card form and allow gateways to load their own if they wish
259
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
259
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
260 260
 			/**
261 261
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
262 262
 			 *
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 			 *
265 265
 			 * @param int $form_id The form ID.
266 266
 			 */
267
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
267
+			do_action("give_{$payment_mode}_cc_form", $form_id);
268 268
 		} else {
269 269
 			/**
270 270
 			 * Fires while displaying donation form, credit card form fields.
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 			 *
274 274
 			 * @param int $form_id The form ID.
275 275
 			 */
276
-			do_action( 'give_cc_form', $form_id );
276
+			do_action('give_cc_form', $form_id);
277 277
 		}
278 278
 
279 279
 		/**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		 *
282 282
 		 * @since 1.7
283 283
 		 */
284
-		do_action( 'give_donation_form_after_cc_form', $form_id );
284
+		do_action('give_donation_form_after_cc_form', $form_id);
285 285
 
286 286
 	} else {
287 287
 		/**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		 *
290 290
 		 * @since 1.7
291 291
 		 */
292
-		do_action( 'give_donation_form_no_access', $form_id );
292
+		do_action('give_donation_form_no_access', $form_id);
293 293
 
294 294
 	}
295 295
 
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 	 *
299 299
 	 * @since 1.7
300 300
 	 */
301
-	do_action( 'give_donation_form_bottom', $form_id );
301
+	do_action('give_donation_form_bottom', $form_id);
302 302
 }
303 303
 
304
-add_action( 'give_donation_form', 'give_show_purchase_form' );
304
+add_action('give_donation_form', 'give_show_purchase_form');
305 305
 
306 306
 /**
307 307
  * Give Show Login/Register Form Fields.
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
  *
313 313
  * @return void
314 314
  */
315
-function give_show_register_login_fields( $form_id ) {
315
+function give_show_register_login_fields($form_id) {
316 316
 
317
-	$show_register_form = give_show_login_register_option( $form_id );
317
+	$show_register_form = give_show_login_register_option($form_id);
318 318
 
319
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
319
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
320 320
 		?>
321 321
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
322 322
 			<?php
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
 			 *
326 326
 			 * @since 1.7
327 327
 			 */
328
-			do_action( 'give_donation_form_register_fields', $form_id );
328
+			do_action('give_donation_form_register_fields', $form_id);
329 329
 			?>
330 330
 		</div>
331 331
 		<?php
332
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
332
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
333 333
 		?>
334 334
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
335 335
 			<?php
@@ -338,23 +338,23 @@  discard block
 block discarded – undo
338 338
 			 *
339 339
 			 * @since 1.7
340 340
 			 */
341
-			do_action( 'give_donation_form_login_fields', $form_id );
341
+			do_action('give_donation_form_login_fields', $form_id);
342 342
 			?>
343 343
 		</div>
344 344
 		<?php
345 345
 	endif;
346 346
 
347
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
347
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
348 348
 		/**
349 349
 		 * Fire when user info render.
350 350
 		 *
351 351
 		 * @since 1.7
352 352
 		 */
353
-		do_action( 'give_donation_form_after_user_info', $form_id );
353
+		do_action('give_donation_form_after_user_info', $form_id);
354 354
 	}
355 355
 }
356 356
 
357
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
357
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
358 358
 
359 359
 /**
360 360
  * Donation Amount Field.
@@ -368,16 +368,16 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return void
370 370
  */
371
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
371
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
372 372
 
373 373
 	$give_options        = give_get_settings();
374
-	$variable_pricing    = give_has_variable_prices( $form_id );
375
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
376
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
377
-	$symbol              = give_currency_symbol( give_get_currency() );
378
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
379
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
380
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
374
+	$variable_pricing    = give_has_variable_prices($form_id);
375
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
376
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
377
+	$symbol              = give_currency_symbol(give_get_currency());
378
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
379
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
380
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
381 381
 
382 382
 	/**
383 383
 	 * Fires while displaying donation form, before donation level fields.
@@ -387,19 +387,19 @@  discard block
 block discarded – undo
387 387
 	 * @param int   $form_id The form ID.
388 388
 	 * @param array $args    An array of form arguments.
389 389
 	 */
390
-	do_action( 'give_before_donation_levels', $form_id, $args );
390
+	do_action('give_before_donation_levels', $form_id, $args);
391 391
 
392 392
 	//Set Price, No Custom Amount Allowed means hidden price field
393
-	if ( $allow_custom_amount == 'no' ) {
393
+	if ($allow_custom_amount == 'no') {
394 394
 		?>
395
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
395
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
396 396
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" value="<?php echo $default_amount; ?>" required>
397 397
 		<div class="set-price give-donation-amount form-row-wide">
398
-			<?php if ( $currency_position == 'before' ) {
398
+			<?php if ($currency_position == 'before') {
399 399
 				echo $currency_output;
400 400
 			} ?>
401 401
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
402
-			<?php if ( $currency_position == 'after' ) {
402
+			<?php if ($currency_position == 'after') {
403 403
 				echo $currency_output;
404 404
 			} ?>
405 405
 		</div>
@@ -409,12 +409,12 @@  discard block
 block discarded – undo
409 409
 		?>
410 410
 		<div class="give-total-wrap">
411 411
 			<div class="give-donation-amount form-row-wide">
412
-				<?php if ( $currency_position == 'before' ) {
412
+				<?php if ($currency_position == 'before') {
413 413
 					echo $currency_output;
414 414
 				} ?>
415
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
415
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
416 416
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
417
-				<?php if ( $currency_position == 'after' ) {
417
+				<?php if ($currency_position == 'after') {
418 418
 					echo $currency_output;
419 419
 				} ?>
420 420
 			</div>
@@ -429,16 +429,16 @@  discard block
 block discarded – undo
429 429
 	 * @param int   $form_id The form ID.
430 430
 	 * @param array $args    An array of form arguments.
431 431
 	 */
432
-	do_action( 'give_after_donation_amount', $form_id, $args );
432
+	do_action('give_after_donation_amount', $form_id, $args);
433 433
 
434 434
 	//Custom Amount Text
435
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
435
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
436 436
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
437 437
 	<?php }
438 438
 
439 439
 	//Output Variable Pricing Levels
440
-	if ( $variable_pricing ) {
441
-		give_output_levels( $form_id );
440
+	if ($variable_pricing) {
441
+		give_output_levels($form_id);
442 442
 	}
443 443
 
444 444
 	/**
@@ -449,10 +449,10 @@  discard block
 block discarded – undo
449 449
 	 * @param int   $form_id The form ID.
450 450
 	 * @param array $args    An array of form arguments.
451 451
 	 */
452
-	do_action( 'give_after_donation_levels', $form_id, $args );
452
+	do_action('give_after_donation_levels', $form_id, $args);
453 453
 }
454 454
 
455
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
455
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
456 456
 
457 457
 /**
458 458
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -463,32 +463,32 @@  discard block
 block discarded – undo
463 463
  *
464 464
  * @return string Donation levels.
465 465
  */
466
-function give_output_levels( $form_id ) {
466
+function give_output_levels($form_id) {
467 467
 
468 468
 	//Get variable pricing
469
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
470
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
471
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
472
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
473
-	if ( empty( $custom_amount_text ) ) {
474
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
469
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
470
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
471
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
472
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
473
+	if (empty($custom_amount_text)) {
474
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
475 475
 	}
476 476
 
477 477
 	$output  = '';
478 478
 	$counter = 0;
479 479
 
480
-	switch ( $display_style ) {
480
+	switch ($display_style) {
481 481
 		case 'buttons':
482 482
 
483 483
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
484 484
 
485
-			foreach ( $prices as $price ) {
486
-				$counter ++;
487
-				$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 );
488
-				$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 );
485
+			foreach ($prices as $price) {
486
+				$counter++;
487
+				$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);
488
+				$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);
489 489
 
490 490
 				$output .= '<li>';
491
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
491
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
492 492
 				$output .= $level_text;
493 493
 				$output .= '</button>';
494 494
 				$output .= '</li>';
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 			}
497 497
 
498 498
 			//Custom Amount
499
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
499
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
500 500
 				$output .= '<li>';
501 501
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
502 502
 				$output .= $custom_amount_text;
@@ -512,23 +512,23 @@  discard block
 block discarded – undo
512 512
 
513 513
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
514 514
 
515
-			foreach ( $prices as $price ) {
516
-				$counter ++;
517
-				$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 );
518
-				$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 );
515
+			foreach ($prices as $price) {
516
+				$counter++;
517
+				$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);
518
+				$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);
519 519
 
520 520
 				$output .= '<li>';
521
-				$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'] ) . '">';
522
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
521
+				$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']).'">';
522
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
523 523
 				$output .= '</li>';
524 524
 
525 525
 			}
526 526
 
527 527
 			//Custom Amount
528
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
528
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
529 529
 				$output .= '<li>';
530 530
 				$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">';
531
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
531
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
532 532
 				$output .= '</li>';
533 533
 			}
534 534
 
@@ -538,23 +538,23 @@  discard block
 block discarded – undo
538 538
 
539 539
 		case 'dropdown':
540 540
 
541
-			$output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
542
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
541
+			$output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
542
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
543 543
 
544 544
 			//first loop through prices
545
-			foreach ( $prices as $price ) {
546
-				$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 );
547
-				$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 );
545
+			foreach ($prices as $price) {
546
+				$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);
547
+				$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);
548 548
 
549
-				$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'] ) . '">';
549
+				$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']).'">';
550 550
 				$output .= $level_text;
551 551
 				$output .= '</option>';
552 552
 
553 553
 			}
554 554
 
555 555
 			//Custom Amount
556
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
557
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
556
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
557
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
558 558
 			}
559 559
 
560 560
 			$output .= '</select>';
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 			break;
563 563
 	}
564 564
 
565
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
565
+	echo apply_filters('give_form_level_output', $output, $form_id);
566 566
 }
567 567
 
568 568
 /**
@@ -577,26 +577,26 @@  discard block
 block discarded – undo
577 577
  *
578 578
  * @return string Checkout button.
579 579
  */
580
-function give_display_checkout_button( $form_id, $args ) {
580
+function give_display_checkout_button($form_id, $args) {
581 581
 
582
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
582
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
583 583
 		? $args['display_style']
584
-		: get_post_meta( $form_id, '_give_payment_display', true );
584
+		: get_post_meta($form_id, '_give_payment_display', true);
585 585
 
586 586
 	//no btn for onpage
587
-	if ( $display_option === 'onpage' ) {
587
+	if ($display_option === 'onpage') {
588 588
 		return;
589 589
 	}
590 590
 
591
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
592
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
591
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
592
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
593 593
 
594
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
594
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
595 595
 
596
-	echo apply_filters( 'give_display_checkout_button', $output );
596
+	echo apply_filters('give_display_checkout_button', $output);
597 597
 }
598 598
 
599
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
599
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
600 600
 
601 601
 /**
602 602
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -607,10 +607,10 @@  discard block
 block discarded – undo
607 607
  *
608 608
  * @return void
609 609
  */
610
-function give_user_info_fields( $form_id ) {
610
+function give_user_info_fields($form_id) {
611 611
 
612
-	if ( is_user_logged_in() ) :
613
-		$user_data = get_userdata( get_current_user_id() );
612
+	if (is_user_logged_in()) :
613
+		$user_data = get_userdata(get_current_user_id());
614 614
 	endif;
615 615
 
616 616
 	/**
@@ -618,35 +618,35 @@  discard block
 block discarded – undo
618 618
 	 *
619 619
 	 * @since 1.7
620 620
 	 */
621
-	do_action( 'give_donation_form_before_personal_info', $form_id );
621
+	do_action('give_donation_form_before_personal_info', $form_id);
622 622
 	?>
623 623
 	<fieldset id="give_checkout_user_info">
624
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
624
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
625 625
 		<p id="give-first-name-wrap" class="form-row form-row-first">
626 626
 			<label class="give-label" for="give-first">
627
-				<?php esc_html_e( 'First Name', 'give' ); ?>
628
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?>
627
+				<?php esc_html_e('First Name', 'give'); ?>
628
+				<?php if (give_field_is_required('give_first', $form_id)) { ?>
629 629
 					<span class="give-required-indicator">*</span>
630 630
 				<?php } ?>
631
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
631
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
632 632
 			</label>
633
-			<input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) {
633
+			<input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_e('First Name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) {
634 634
 				echo ' required ';
635 635
 			} ?>/>
636 636
 		</p>
637 637
 
638 638
 		<p id="give-last-name-wrap" class="form-row form-row-last">
639 639
 			<label class="give-label" for="give-last">
640
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
641
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?>
640
+				<?php esc_html_e('Last Name', 'give'); ?>
641
+				<?php if (give_field_is_required('give_last', $form_id)) { ?>
642 642
 					<span class="give-required-indicator">*</span>
643 643
 				<?php } ?>
644
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
644
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
645 645
 			</label>
646 646
 
647
-			<input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
647
+			<input class="give-input<?php if (give_field_is_required('give_last', $form_id)) {
648 648
 				echo ' required';
649
-			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
649
+			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) {
650 650
 				echo ' required ';
651 651
 			} ?> />
652 652
 		</p>
@@ -657,18 +657,18 @@  discard block
 block discarded – undo
657 657
 		 *
658 658
 		 * @since 1.7
659 659
 		 */
660
-		do_action( 'give_donation_form_before_email', $form_id );
660
+		do_action('give_donation_form_before_email', $form_id);
661 661
 		?>
662 662
 		<p id="give-email-wrap" class="form-row form-row-wide">
663 663
 			<label class="give-label" for="give-email">
664
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
665
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
664
+				<?php esc_html_e('Email Address', 'give'); ?>
665
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
666 666
 					<span class="give-required-indicator">*</span>
667 667
 				<?php } ?>
668
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span>
668
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span>
669 669
 			</label>
670 670
 
671
-			<input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) {
671
+			<input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) {
672 672
 				echo ' required ';
673 673
 			} ?>/>
674 674
 
@@ -679,14 +679,14 @@  discard block
 block discarded – undo
679 679
 		 *
680 680
 		 * @since 1.7
681 681
 		 */
682
-		do_action( 'give_donation_form_after_email', $form_id );
682
+		do_action('give_donation_form_after_email', $form_id);
683 683
 
684 684
 		/**
685 685
 		 * Fire after personal email field
686 686
 		 *
687 687
 		 * @since 1.7
688 688
 		 */
689
-		do_action( 'give_donation_form_user_info', $form_id );
689
+		do_action('give_donation_form_user_info', $form_id);
690 690
 		?>
691 691
 	</fieldset>
692 692
 	<?php
@@ -695,11 +695,11 @@  discard block
 block discarded – undo
695 695
 	 *
696 696
 	 * @since 1.7
697 697
 	 */
698
-	do_action( 'give_donation_form_after_personal_info', $form_id );
698
+	do_action('give_donation_form_after_personal_info', $form_id);
699 699
 }
700 700
 
701
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
702
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
701
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
702
+add_action('give_register_fields_before', 'give_user_info_fields');
703 703
 
704 704
 /**
705 705
  * Renders the credit card info form.
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
  *
711 711
  * @return void
712 712
  */
713
-function give_get_cc_form( $form_id ) {
713
+function give_get_cc_form($form_id) {
714 714
 
715 715
 	ob_start();
716 716
 
@@ -721,45 +721,45 @@  discard block
 block discarded – undo
721 721
 	 *
722 722
 	 * @param int $form_id The form ID.
723 723
 	 */
724
-	do_action( 'give_before_cc_fields', $form_id );
724
+	do_action('give_before_cc_fields', $form_id);
725 725
 	?>
726 726
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
727
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
728
-		<?php if ( is_ssl() ) : ?>
727
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
728
+		<?php if (is_ssl()) : ?>
729 729
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
730 730
 				<span class="give-icon padlock"></span>
731
-				<span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
731
+				<span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
732 732
 			</div>
733 733
 		<?php endif; ?>
734 734
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
735 735
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
736
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
736
+				<?php esc_html_e('Card Number', 'give'); ?>
737 737
 				<span class="give-required-indicator">*</span>
738
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
738
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
739 739
 				<span class="card-type"></span>
740 740
 			</label>
741 741
 
742
-			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" required/>
742
+			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" required/>
743 743
 		</p>
744 744
 
745 745
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
746 746
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
747
-				<?php esc_html_e( 'CVC', 'give' ); ?>
747
+				<?php esc_html_e('CVC', 'give'); ?>
748 748
 				<span class="give-required-indicator">*</span>
749
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
749
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
750 750
 			</label>
751 751
 
752
-			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" required/>
752
+			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" required/>
753 753
 		</p>
754 754
 
755 755
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
756 756
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
757
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
757
+				<?php esc_html_e('Name on the Card', 'give'); ?>
758 758
 				<span class="give-required-indicator">*</span>
759
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
759
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
760 760
 			</label>
761 761
 
762
-			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" required/>
762
+			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" required/>
763 763
 		</p>
764 764
 		<?php
765 765
 		/**
@@ -769,19 +769,19 @@  discard block
 block discarded – undo
769 769
 		 *
770 770
 		 * @param int $form_id The form ID.
771 771
 		 */
772
-		do_action( 'give_before_cc_expiration' );
772
+		do_action('give_before_cc_expiration');
773 773
 		?>
774 774
 		<p class="card-expiration form-row form-row-one-third">
775 775
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
776
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
776
+				<?php esc_html_e('Expiration', 'give'); ?>
777 777
 				<span class="give-required-indicator">*</span>
778
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
778
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
779 779
 			</label>
780 780
 
781 781
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
782 782
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
783 783
 
784
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required/>
784
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required/>
785 785
 		</p>
786 786
 		<?php
787 787
 		/**
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 		 *
792 792
 		 * @param int $form_id The form ID.
793 793
 		 */
794
-		do_action( 'give_after_cc_expiration', $form_id );
794
+		do_action('give_after_cc_expiration', $form_id);
795 795
 		?>
796 796
 	</fieldset>
797 797
 	<?php
@@ -802,12 +802,12 @@  discard block
 block discarded – undo
802 802
 	 *
803 803
 	 * @param int $form_id The form ID.
804 804
 	 */
805
-	do_action( 'give_after_cc_fields', $form_id );
805
+	do_action('give_after_cc_fields', $form_id);
806 806
 
807 807
 	echo ob_get_clean();
808 808
 }
809 809
 
810
-add_action( 'give_cc_form', 'give_get_cc_form' );
810
+add_action('give_cc_form', 'give_get_cc_form');
811 811
 
812 812
 /**
813 813
  * Outputs the default credit card address fields.
@@ -818,22 +818,22 @@  discard block
 block discarded – undo
818 818
  *
819 819
  * @return void
820 820
  */
821
-function give_default_cc_address_fields( $form_id ) {
821
+function give_default_cc_address_fields($form_id) {
822 822
 
823 823
 	$logged_in = is_user_logged_in();
824 824
 
825
-	if ( $logged_in ) {
826
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
825
+	if ($logged_in) {
826
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
827 827
 	}
828
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
829
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
830
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
831
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
828
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
829
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
830
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
831
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
832 832
 
833 833
 	ob_start();
834 834
 	?>
835 835
 	<fieldset id="give_cc_address" class="cc-address">
836
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
836
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
837 837
 		<?php
838 838
 		/**
839 839
 		 * Fires while rendering credit card billing form, before address fields.
@@ -842,97 +842,97 @@  discard block
 block discarded – undo
842 842
 		 *
843 843
 		 * @param int $form_id The form ID.
844 844
 		 */
845
-		do_action( 'give_cc_billing_top' );
845
+		do_action('give_cc_billing_top');
846 846
 		?>
847 847
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
848 848
 			<label for="card_address" class="give-label">
849
-				<?php esc_html_e( 'Address 1', 'give' ); ?>
849
+				<?php esc_html_e('Address 1', 'give'); ?>
850 850
 				<?php
851
-				if ( give_field_is_required( 'card_address', $form_id ) ) { ?>
851
+				if (give_field_is_required('card_address', $form_id)) { ?>
852 852
 					<span class="give-required-indicator">*</span>
853 853
 				<?php } ?>
854
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
854
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span>
855 855
 			</label>
856 856
 
857
-			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
857
+			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) {
858 858
 				echo ' required';
859
-			} ?>" placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
859
+			} ?>" placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) {
860 860
 				echo '  required ';
861 861
 			} ?>/>
862 862
 		</p>
863 863
 
864 864
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
865 865
 			<label for="card_address_2" class="give-label">
866
-				<?php esc_html_e( 'Address 2', 'give' ); ?>
867
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?>
866
+				<?php esc_html_e('Address 2', 'give'); ?>
867
+				<?php if (give_field_is_required('card_address_2', $form_id)) { ?>
868 868
 					<span class="give-required-indicator">*</span>
869 869
 				<?php } ?>
870
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
870
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
871 871
 			</label>
872 872
 
873
-			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
873
+			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) {
874 874
 				echo ' required';
875
-			} ?>" placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
875
+			} ?>" placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) {
876 876
 				echo ' required ';
877 877
 			} ?>/>
878 878
 		</p>
879 879
 
880 880
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
881 881
 			<label for="card_city" class="give-label">
882
-				<?php esc_html_e( 'City', 'give' ); ?>
883
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?>
882
+				<?php esc_html_e('City', 'give'); ?>
883
+				<?php if (give_field_is_required('card_city', $form_id)) { ?>
884 884
 					<span class="give-required-indicator">*</span>
885 885
 				<?php } ?>
886
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span>
886
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span>
887 887
 			</label>
888
-			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
888
+			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) {
889 889
 				echo ' required';
890
-			} ?>" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
890
+			} ?>" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) {
891 891
 				echo ' required ';
892 892
 			} ?>/>
893 893
 		</p>
894 894
 
895 895
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
896 896
 			<label for="card_zip" class="give-label">
897
-				<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
898
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?>
897
+				<?php esc_html_e('Zip / Postal Code', 'give'); ?>
898
+				<?php if (give_field_is_required('card_zip', $form_id)) { ?>
899 899
 					<span class="give-required-indicator">*</span>
900 900
 				<?php } ?>
901
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
901
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
902 902
 			</label>
903 903
 
904
-			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
904
+			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) {
905 905
 				echo ' required';
906
-			} ?>" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
906
+			} ?>" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) {
907 907
 				echo ' required ';
908 908
 			} ?>/>
909 909
 		</p>
910 910
 
911 911
 		<p id="give-card-country-wrap" class="form-row form-row-first">
912 912
 			<label for="billing_country" class="give-label">
913
-				<?php esc_html_e( 'Country', 'give' ); ?>
914
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?>
913
+				<?php esc_html_e('Country', 'give'); ?>
914
+				<?php if (give_field_is_required('billing_country', $form_id)) { ?>
915 915
 					<span class="give-required-indicator">*</span>
916 916
 				<?php } ?>
917
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
917
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
918 918
 			</label>
919 919
 
920
-			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
920
+			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) {
921 921
 				echo ' required';
922
-			} ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
922
+			} ?>"<?php if (give_field_is_required('billing_country', $form_id)) {
923 923
 				echo ' required ';
924 924
 			} ?>>
925 925
 				<?php
926 926
 
927 927
 				$selected_country = give_get_country();
928 928
 
929
-				if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) {
929
+				if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) {
930 930
 					$selected_country = $user_address['country'];
931 931
 				}
932 932
 
933 933
 				$countries = give_get_country_list();
934
-				foreach ( $countries as $country_code => $country ) {
935
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
934
+				foreach ($countries as $country_code => $country) {
935
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
936 936
 				}
937 937
 				?>
938 938
 			</select>
@@ -940,38 +940,38 @@  discard block
 block discarded – undo
940 940
 
941 941
 		<p id="give-card-state-wrap" class="form-row form-row-last">
942 942
 			<label for="card_state" class="give-label">
943
-				<?php esc_html_e( 'State / Province', 'give' ); ?>
944
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?>
943
+				<?php esc_html_e('State / Province', 'give'); ?>
944
+				<?php if (give_field_is_required('card_state', $form_id)) { ?>
945 945
 					<span class="give-required-indicator">*</span>
946 946
 				<?php } ?>
947
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span>
947
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span>
948 948
 			</label>
949 949
 
950 950
 			<?php
951 951
 			$selected_state = give_get_state();
952
-			$states         = give_get_states( $selected_country );
952
+			$states         = give_get_states($selected_country);
953 953
 
954
-			if ( $logged_in && ! empty( $user_address['state'] ) ) {
954
+			if ($logged_in && ! empty($user_address['state'])) {
955 955
 				$selected_state = $user_address['state'];
956 956
 			}
957 957
 
958
-			if ( ! empty( $states ) ) {
958
+			if ( ! empty($states)) {
959 959
 				?>
960
-				<select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
960
+				<select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) {
961 961
 					echo ' required';
962
-				} ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
962
+				} ?>"<?php if (give_field_is_required('card_state', $form_id)) {
963 963
 					echo ' required ';
964 964
 				} ?>>
965 965
 					<?php
966
-					foreach ( $states as $state_code => $state ) {
967
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
966
+					foreach ($states as $state_code => $state) {
967
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
968 968
 					}
969 969
 					?>
970 970
 				</select>
971 971
 				<?php
972 972
 			} else {
973 973
 				?>
974
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
974
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/>
975 975
 				<?php
976 976
 			}
977 977
 			?>
@@ -984,14 +984,14 @@  discard block
 block discarded – undo
984 984
 		 *
985 985
 		 * @param int $form_id The form ID.
986 986
 		 */
987
-		do_action( 'give_cc_billing_bottom' );
987
+		do_action('give_cc_billing_bottom');
988 988
 		?>
989 989
 	</fieldset>
990 990
 	<?php
991 991
 	echo ob_get_clean();
992 992
 }
993 993
 
994
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
994
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
995 995
 
996 996
 
997 997
 /**
@@ -1003,26 +1003,26 @@  discard block
 block discarded – undo
1003 1003
  *
1004 1004
  * @return string
1005 1005
  */
1006
-function give_get_register_fields( $form_id ) {
1006
+function give_get_register_fields($form_id) {
1007 1007
 
1008 1008
 	global $user_ID;
1009 1009
 
1010
-	if ( is_user_logged_in() ) {
1011
-		$user_data = get_userdata( $user_ID );
1010
+	if (is_user_logged_in()) {
1011
+		$user_data = get_userdata($user_ID);
1012 1012
 	}
1013 1013
 
1014
-	$show_register_form = give_show_login_register_option( $form_id );
1014
+	$show_register_form = give_show_login_register_option($form_id);
1015 1015
 
1016 1016
 	ob_start(); ?>
1017 1017
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
1018 1018
 
1019
-		<?php if ( $show_register_form == 'both' ) { ?>
1019
+		<?php if ($show_register_form == 'both') { ?>
1020 1020
 			<div class="give-login-account-wrap">
1021
-				<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1022
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1021
+				<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1022
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1023 1023
 				</p>
1024 1024
 				<p class="give-loading-text">
1025
-					<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p>
1025
+					<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p>
1026 1026
 			</div>
1027 1027
 		<?php } ?>
1028 1028
 
@@ -1034,15 +1034,15 @@  discard block
 block discarded – undo
1034 1034
 		 *
1035 1035
 		 * @param int $form_id The form ID.
1036 1036
 		 */
1037
-		do_action( 'give_register_fields_before', $form_id );
1037
+		do_action('give_register_fields_before', $form_id);
1038 1038
 		?>
1039 1039
 
1040 1040
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
1041 1041
 			<legend>
1042 1042
 				<?php
1043
-				echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
1044
-				if ( ! give_logged_in_only( $form_id ) ) {
1045
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1043
+				echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
1044
+				if ( ! give_logged_in_only($form_id)) {
1045
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1046 1046
 				}
1047 1047
 				?>
1048 1048
 			</legend>
@@ -1054,42 +1054,42 @@  discard block
 block discarded – undo
1054 1054
 			 *
1055 1055
 			 * @param int $form_id The form ID.
1056 1056
 			 */
1057
-			do_action( 'give_register_account_fields_before', $form_id );
1057
+			do_action('give_register_account_fields_before', $form_id);
1058 1058
 			?>
1059 1059
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
1060 1060
 				<label for="give-user-login-<?php echo $form_id; ?>">
1061
-					<?php esc_html_e( 'Username', 'give' ); ?>
1062
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1061
+					<?php esc_html_e('Username', 'give'); ?>
1062
+					<?php if (give_logged_in_only($form_id)) { ?>
1063 1063
 						<span class="give-required-indicator">*</span>
1064 1064
 					<?php } ?>
1065
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
1065
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span>
1066 1066
 				</label>
1067 1067
 
1068
-				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" type="text" placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/>
1068
+				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" type="text" placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/>
1069 1069
 			</div>
1070 1070
 
1071 1071
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
1072 1072
 				<label for="give-user-pass-<?php echo $form_id; ?>">
1073
-					<?php esc_html_e( 'Password', 'give' ); ?>
1074
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1073
+					<?php esc_html_e('Password', 'give'); ?>
1074
+					<?php if (give_logged_in_only($form_id)) { ?>
1075 1075
 						<span class="give-required-indicator">*</span>
1076 1076
 					<?php } ?>
1077
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span>
1077
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span>
1078 1078
 				</label>
1079 1079
 
1080
-				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/>
1080
+				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e('Password', 'give'); ?>" type="password"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/>
1081 1081
 			</div>
1082 1082
 
1083 1083
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third">
1084 1084
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
1085
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
1086
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1085
+					<?php esc_html_e('Confirm PW', 'give'); ?>
1086
+					<?php if (give_logged_in_only($form_id)) { ?>
1087 1087
 						<span class="give-required-indicator">*</span>
1088 1088
 					<?php } ?>
1089
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
1089
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span>
1090 1090
 				</label>
1091 1091
 
1092
-				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/>
1092
+				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" type="password"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/>
1093 1093
 			</div>
1094 1094
 			<?php
1095 1095
 			/**
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 			 *
1100 1100
 			 * @param int $form_id The form ID.
1101 1101
 			 */
1102
-			do_action( 'give_register_account_fields_after', $form_id );
1102
+			do_action('give_register_account_fields_after', $form_id);
1103 1103
 			?>
1104 1104
 		</fieldset>
1105 1105
 
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 		 *
1112 1112
 		 * @param int $form_id The form ID.
1113 1113
 		 */
1114
-		do_action( 'give_register_fields_after', $form_id );
1114
+		do_action('give_register_fields_after', $form_id);
1115 1115
 		?>
1116 1116
 
1117 1117
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 		 *
1123 1123
 		 * @since 1.7
1124 1124
 		 */
1125
-		do_action( 'give_donation_form_user_info', $form_id );
1125
+		do_action('give_donation_form_user_info', $form_id);
1126 1126
 		?>
1127 1127
 
1128 1128
 	</fieldset>
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 	echo ob_get_clean();
1131 1131
 }
1132 1132
 
1133
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' );
1133
+add_action('give_purchase_form_register_fields', 'give_get_register_fields');
1134 1134
 
1135 1135
 /**
1136 1136
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1143,31 +1143,31 @@  discard block
 block discarded – undo
1143 1143
  *
1144 1144
  * @return string
1145 1145
  */
1146
-function give_get_login_fields( $form_id ) {
1146
+function give_get_login_fields($form_id) {
1147 1147
 
1148
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1149
-	$show_register_form = give_show_login_register_option( $form_id );
1148
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1149
+	$show_register_form = give_show_login_register_option($form_id);
1150 1150
 
1151 1151
 	ob_start();
1152 1152
 	?>
1153 1153
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1154
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
1155
-			if ( ! give_logged_in_only( $form_id ) ) {
1156
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1154
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
1155
+			if ( ! give_logged_in_only($form_id)) {
1156
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1157 1157
 			} ?>
1158 1158
 		</legend>
1159
-		<?php if ( $show_register_form == 'both' ) { ?>
1159
+		<?php if ($show_register_form == 'both') { ?>
1160 1160
 			<p class="give-new-account-link">
1161
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
1162
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
1163
-					<?php esc_html_e( 'Register', 'give' );
1164
-					if ( ! give_logged_in_only( $form_id ) ) {
1165
-						echo ' ' . esc_html__( 'or checkout as a guest &raquo;', 'give' );
1161
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
1162
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
1163
+					<?php esc_html_e('Register', 'give');
1164
+					if ( ! give_logged_in_only($form_id)) {
1165
+						echo ' '.esc_html__('or checkout as a guest &raquo;', 'give');
1166 1166
 					} ?>
1167 1167
 				</a>
1168 1168
 			</p>
1169 1169
 			<p class="give-loading-text">
1170
-				<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p>
1170
+				<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p>
1171 1171
 		<?php } ?>
1172 1172
 		<?php
1173 1173
 		/**
@@ -1177,44 +1177,44 @@  discard block
 block discarded – undo
1177 1177
 		 *
1178 1178
 		 * @param int $form_id The form ID.
1179 1179
 		 */
1180
-		do_action( 'give_checkout_login_fields_before', $form_id );
1180
+		do_action('give_checkout_login_fields_before', $form_id);
1181 1181
 		?>
1182 1182
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
1183 1183
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1184
-				<?php esc_html_e( 'Username', 'give' ); ?>
1185
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1184
+				<?php esc_html_e('Username', 'give'); ?>
1185
+				<?php if (give_logged_in_only($form_id)) { ?>
1186 1186
 					<span class="give-required-indicator">*</span>
1187 1187
 				<?php } ?>
1188 1188
 			</label>
1189 1189
 
1190
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
1190
+			<input class="<?php if (give_logged_in_only($form_id)) {
1191 1191
 				echo 'required ';
1192
-			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"/>
1192
+			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e('Your username', 'give'); ?>"/>
1193 1193
 		</div>
1194 1194
 
1195 1195
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
1196 1196
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1197
-				<?php esc_html_e( 'Password', 'give' ); ?>
1198
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1197
+				<?php esc_html_e('Password', 'give'); ?>
1198
+				<?php if (give_logged_in_only($form_id)) { ?>
1199 1199
 					<span class="give-required-indicator">*</span>
1200 1200
 				<?php } ?>
1201 1201
 			</label>
1202
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
1202
+			<input class="<?php if (give_logged_in_only($form_id)) {
1203 1203
 				echo 'required ';
1204
-			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"/>
1204
+			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e('Your password', 'give'); ?>"/>
1205 1205
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1206 1206
 		</div>
1207 1207
 
1208 1208
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1209 1209
 			 <span class="give-forgot-password ">
1210
-				 <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a>
1210
+				 <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a>
1211 1211
 			 </span>
1212 1212
 		</div>
1213 1213
 
1214 1214
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1215
-			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e( 'Login', 'give' ); ?>"/>
1216
-			<?php if ( $show_register_form !== 'login' ) { ?>
1217
-				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/>
1215
+			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e('Login', 'give'); ?>"/>
1216
+			<?php if ($show_register_form !== 'login') { ?>
1217
+				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e('Cancel', 'give'); ?>"/>
1218 1218
 			<?php } ?>
1219 1219
 			<span class="give-loading-animation"></span>
1220 1220
 		</div>
@@ -1226,14 +1226,14 @@  discard block
 block discarded – undo
1226 1226
 		 *
1227 1227
 		 * @param int $form_id The form ID.
1228 1228
 		 */
1229
-		do_action( 'give_checkout_login_fields_after', $form_id );
1229
+		do_action('give_checkout_login_fields_after', $form_id);
1230 1230
 		?>
1231 1231
 	</fieldset><!--end #give-login-fields-->
1232 1232
 	<?php
1233 1233
 	echo ob_get_clean();
1234 1234
 }
1235 1235
 
1236
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 );
1236
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1);
1237 1237
 
1238 1238
 /**
1239 1239
  * Payment Mode Select.
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
  *
1250 1250
  * @return void
1251 1251
  */
1252
-function give_payment_mode_select( $form_id ) {
1252
+function give_payment_mode_select($form_id) {
1253 1253
 
1254 1254
 	$gateways = give_get_enabled_payment_gateways();
1255 1255
 
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 	 *
1261 1261
 	 * @param int $form_id The form ID.
1262 1262
 	 */
1263
-	do_action( 'give_donation_mode_top', $form_id ); ?>
1263
+	do_action('give_donation_mode_top', $form_id); ?>
1264 1264
 
1265 1265
 	<fieldset id="give-payment-mode-select">
1266 1266
 		<?php
@@ -1271,11 +1271,11 @@  discard block
 block discarded – undo
1271 1271
 		 *
1272 1272
 		 * @param int $form_id The form ID.
1273 1273
 		 */
1274
-		do_action( 'give_donation_mode_before_gateways_wrap' );
1274
+		do_action('give_donation_mode_before_gateways_wrap');
1275 1275
 		?>
1276 1276
 		<div id="give-payment-mode-wrap">
1277
-			<legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1278
-				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span>
1277
+			<legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1278
+				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span>
1279 1279
 			</legend>
1280 1280
 			<?php
1281 1281
 			/**
@@ -1283,14 +1283,14 @@  discard block
 block discarded – undo
1283 1283
 			 *
1284 1284
 			 * @since 1.7
1285 1285
 			 */
1286
-			do_action( 'give_donation_mode_before_gateways' )
1286
+			do_action('give_donation_mode_before_gateways')
1287 1287
 			?>
1288 1288
 			<ul id="give-gateway-radio-list">
1289
-				<?php foreach ( $gateways as $gateway_id => $gateway ) :
1290
-					$checked       = checked( $gateway_id, give_get_default_gateway( $form_id ), false );
1289
+				<?php foreach ($gateways as $gateway_id => $gateway) :
1290
+					$checked       = checked($gateway_id, give_get_default_gateway($form_id), false);
1291 1291
 					$checked_class = $checked ? ' give-gateway-option-selected' : '';
1292
-					echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">';
1293
-					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] );
1292
+					echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">';
1293
+					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']);
1294 1294
 					echo '</label></li>';
1295 1295
 				endforeach; ?>
1296 1296
 			</ul>
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
 			 *
1301 1301
 			 * @since 1.7
1302 1302
 			 */
1303
-			do_action( 'give_donation_mode_after_gateways' );
1303
+			do_action('give_donation_mode_after_gateways');
1304 1304
 			?>
1305 1305
 		</div>
1306 1306
 		<?php
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 		 *
1312 1312
 		 * @param int $form_id The form ID.
1313 1313
 		 */
1314
-		do_action( 'give_donation_mode_after_gateways_wrap' );
1314
+		do_action('give_donation_mode_after_gateways_wrap');
1315 1315
 		?>
1316 1316
 	</fieldset>
1317 1317
 
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
 	 *
1324 1324
 	 * @param int $form_id The form ID.
1325 1325
 	 */
1326
-	do_action( 'give_donation_mode_bottom', $form_id );
1326
+	do_action('give_donation_mode_bottom', $form_id);
1327 1327
 	?>
1328 1328
 
1329 1329
 	<div id="give_purchase_form_wrap">
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 		 *
1335 1335
 		 * @since 1.7
1336 1336
 		 */
1337
-		do_action( 'give_donation_form', $form_id );
1337
+		do_action('give_donation_form', $form_id);
1338 1338
 		?>
1339 1339
 
1340 1340
 	</div>
@@ -1345,10 +1345,10 @@  discard block
 block discarded – undo
1345 1345
 	 *
1346 1346
 	 * @since 1.7
1347 1347
 	 */
1348
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1348
+	do_action('give_donation_form_wrap_bottom', $form_id);
1349 1349
 }
1350 1350
 
1351
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1351
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1352 1352
 
1353 1353
 /**
1354 1354
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1361,49 +1361,49 @@  discard block
 block discarded – undo
1361 1361
  *
1362 1362
  * @return void|bool
1363 1363
  */
1364
-function give_terms_agreement( $form_id ) {
1365
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1364
+function give_terms_agreement($form_id) {
1365
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1366 1366
 
1367 1367
 	// Bailout if per form and global term and conditions is not setup
1368
-	if( 'yes' !== $form_option ) {
1368
+	if ('yes' !== $form_option) {
1369 1369
 		return false;
1370 1370
 	}
1371 1371
 
1372 1372
 	// Set term and conditions label and text on basis of per form and global setting.
1373
-	$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' ) );
1374
-	$terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' );
1373
+	$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'));
1374
+	$terms = ($terms = get_post_meta($form_id, '_give_agree_text', true)) ? $terms : give_get_option('agreement_text', '');
1375 1375
 
1376 1376
 	// Bailout: Check if term and conditions text is empty or not.
1377
-	if( empty( $terms ) ) {
1378
-		if( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
1379
-			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' ) );
1377
+	if (empty($terms)) {
1378
+		if (is_user_logged_in() && current_user_can('manage_options')) {
1379
+			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'));
1380 1380
 		}
1381 1381
 		return false;
1382 1382
 	}
1383 1383
 
1384 1384
 	?>
1385 1385
 	<fieldset id="give_terms_agreement">
1386
-		<div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;">
1386
+		<div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;">
1387 1387
 			<?php
1388 1388
 			/**
1389 1389
 			 * Fires while rendering terms of agreement, before the fields.
1390 1390
 			 *
1391 1391
 			 * @since 1.0
1392 1392
 			 */
1393
-			do_action( 'give_before_terms' );
1393
+			do_action('give_before_terms');
1394 1394
 
1395
-			echo wpautop( stripslashes( $terms ) );
1395
+			echo wpautop(stripslashes($terms));
1396 1396
 			/**
1397 1397
 			 * Fires while rendering terms of agreement, after the fields.
1398 1398
 			 *
1399 1399
 			 * @since 1.0
1400 1400
 			 */
1401
-			do_action( 'give_after_terms' );
1401
+			do_action('give_after_terms');
1402 1402
 			?>
1403 1403
 		</div>
1404 1404
 		<div id="give_show_terms">
1405
-			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1406
-			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1405
+			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php esc_html_e('Show Terms', 'give'); ?></a>
1406
+			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1407 1407
 		</div>
1408 1408
 
1409 1409
 		<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/>
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 	<?php
1414 1414
 }
1415 1415
 
1416
-add_action( 'give_donation_form_before_submit', 'give_terms_agreement', 10, 1 );
1416
+add_action('give_donation_form_before_submit', 'give_terms_agreement', 10, 1);
1417 1417
 
1418 1418
 /**
1419 1419
  * Checkout Final Total.
@@ -1426,27 +1426,27 @@  discard block
 block discarded – undo
1426 1426
  *
1427 1427
  * @return void
1428 1428
  */
1429
-function give_checkout_final_total( $form_id ) {
1429
+function give_checkout_final_total($form_id) {
1430 1430
 
1431
-	if ( isset( $_POST['give_total'] ) ) {
1432
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1431
+	if (isset($_POST['give_total'])) {
1432
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1433 1433
 	} else {
1434 1434
 		//default total
1435
-		$total = give_get_default_form_amount( $form_id );
1435
+		$total = give_get_default_form_amount($form_id);
1436 1436
 	}
1437 1437
 	//Only proceed if give_total available
1438
-	if ( empty( $total ) ) {
1438
+	if (empty($total)) {
1439 1439
 		return;
1440 1440
 	}
1441 1441
 	?>
1442 1442
 	<p id="give-final-total-wrap" class="form-wrap ">
1443
-		<span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span>
1444
-		<span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1443
+		<span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span>
1444
+		<span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1445 1445
 	</p>
1446 1446
 	<?php
1447 1447
 }
1448 1448
 
1449
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1449
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1450 1450
 
1451 1451
 /**
1452 1452
  * Renders the Checkout Submit section.
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
  *
1458 1458
  * @return void
1459 1459
  */
1460
-function give_checkout_submit( $form_id ) {
1460
+function give_checkout_submit($form_id) {
1461 1461
 	?>
1462 1462
 	<fieldset id="give_purchase_submit">
1463 1463
 		<?php
@@ -1466,24 +1466,24 @@  discard block
 block discarded – undo
1466 1466
 		 *
1467 1467
 		 * @since 1.7
1468 1468
 		 */
1469
-		do_action( 'give_donation_form_before_submit', $form_id );
1469
+		do_action('give_donation_form_before_submit', $form_id);
1470 1470
 
1471
-		give_checkout_hidden_fields( $form_id );
1471
+		give_checkout_hidden_fields($form_id);
1472 1472
 
1473
-		echo give_checkout_button_purchase( $form_id );
1473
+		echo give_checkout_button_purchase($form_id);
1474 1474
 
1475 1475
 		/**
1476 1476
 		 * Fire after donation form submit.
1477 1477
 		 *
1478 1478
 		 * @since 1.7
1479 1479
 		 */
1480
-		do_action( 'give_donation_form_after_submit', $form_id );
1480
+		do_action('give_donation_form_after_submit', $form_id);
1481 1481
 		?>
1482 1482
 	</fieldset>
1483 1483
 	<?php
1484 1484
 }
1485 1485
 
1486
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1486
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1487 1487
 
1488 1488
 /**
1489 1489
  * Give Checkout Button.
@@ -1496,17 +1496,17 @@  discard block
 block discarded – undo
1496 1496
  *
1497 1497
  * @return string
1498 1498
  */
1499
-function give_checkout_button_purchase( $form_id ) {
1499
+function give_checkout_button_purchase($form_id) {
1500 1500
 
1501
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1502
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1501
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1502
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1503 1503
 	ob_start(); ?>
1504 1504
 	<div class="give-submit-button-wrap give-clearfix">
1505 1505
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/>
1506 1506
 		<span class="give-loading-animation"></span>
1507 1507
 	</div>
1508 1508
 	<?php
1509
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1509
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1510 1510
 }
1511 1511
 
1512 1512
 /**
@@ -1520,18 +1520,18 @@  discard block
 block discarded – undo
1520 1520
  *
1521 1521
  * @return void
1522 1522
  */
1523
-function give_agree_to_terms_js( $form_id ) {
1523
+function give_agree_to_terms_js($form_id) {
1524 1524
 
1525
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1525
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1526 1526
 
1527
-	if ( $form_option === 'yes' ) {
1527
+	if ($form_option === 'yes') {
1528 1528
 		?>
1529 1529
 		<script type="text/javascript">
1530 1530
 			jQuery(document).ready(function ($) {
1531
-				$('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) {
1531
+				$('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) {
1532 1532
 					e.preventDefault();
1533
-					$('.give_terms-<?php echo $form_id;?>').slideToggle();
1534
-					$('.give_terms_links-<?php echo $form_id;?>').toggle();
1533
+					$('.give_terms-<?php echo $form_id; ?>').slideToggle();
1534
+					$('.give_terms_links-<?php echo $form_id; ?>').toggle();
1535 1535
 					return false;
1536 1536
 				});
1537 1537
 			});
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
 	}
1541 1541
 }
1542 1542
 
1543
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1543
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1544 1544
 
1545 1545
 /**
1546 1546
  * Show Give Goals.
@@ -1554,17 +1554,17 @@  discard block
 block discarded – undo
1554 1554
  *
1555 1555
  * @return mixed
1556 1556
  */
1557
-function give_show_goal_progress( $form_id, $args ) {
1557
+function give_show_goal_progress($form_id, $args) {
1558 1558
 
1559 1559
     ob_start();
1560
-    give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) );
1560
+    give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1561 1561
 
1562
-    echo apply_filters( 'give_goal_output', ob_get_clean() );
1562
+    echo apply_filters('give_goal_output', ob_get_clean());
1563 1563
 
1564 1564
 	return true;
1565 1565
 }
1566 1566
 
1567
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1567
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1568 1568
 
1569 1569
 /**
1570 1570
  * Adds Actions to Render Form Content.
@@ -1576,19 +1576,19 @@  discard block
 block discarded – undo
1576 1576
  *
1577 1577
  * @return void
1578 1578
  */
1579
-function give_form_content( $form_id, $args ) {
1579
+function give_form_content($form_id, $args) {
1580 1580
 
1581
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1581
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1582 1582
 		? $args['show_content']
1583
-		: get_post_meta( $form_id, '_give_content_option', true );
1583
+		: get_post_meta($form_id, '_give_content_option', true);
1584 1584
 
1585
-	if ( $show_content !== 'none' ) {
1585
+	if ($show_content !== 'none') {
1586 1586
 		//add action according to value
1587
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1587
+		add_action($show_content, 'give_form_display_content', 10, 2);
1588 1588
 	}
1589 1589
 }
1590 1590
 
1591
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1591
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1592 1592
 
1593 1593
 /**
1594 1594
  * Renders Post Form Content.
@@ -1602,24 +1602,24 @@  discard block
 block discarded – undo
1602 1602
  *
1603 1603
  * @return void
1604 1604
  */
1605
-function give_form_display_content( $form_id, $args ) {
1605
+function give_form_display_content($form_id, $args) {
1606 1606
 
1607
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1608
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1607
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1608
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1609 1609
 		? $args['show_content']
1610
-		: get_post_meta( $form_id, '_give_content_option', true );
1610
+		: get_post_meta($form_id, '_give_content_option', true);
1611 1611
 
1612
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1613
-		$content = apply_filters( 'the_content', $content );
1612
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1613
+		$content = apply_filters('the_content', $content);
1614 1614
 	}
1615 1615
 
1616
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1616
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1617 1617
 
1618
-	echo apply_filters( 'give_form_content_output', $output );
1618
+	echo apply_filters('give_form_content_output', $output);
1619 1619
 
1620 1620
 	//remove action to prevent content output on addition forms on page
1621 1621
 	//@see: https://github.com/WordImpress/Give/issues/634
1622
-	remove_action( $show_content, 'give_form_display_content' );
1622
+	remove_action($show_content, 'give_form_display_content');
1623 1623
 }
1624 1624
 
1625 1625
 /**
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
  *
1632 1632
  * @return void
1633 1633
  */
1634
-function give_checkout_hidden_fields( $form_id ) {
1634
+function give_checkout_hidden_fields($form_id) {
1635 1635
 
1636 1636
 	/**
1637 1637
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1640,13 +1640,13 @@  discard block
 block discarded – undo
1640 1640
 	 *
1641 1641
 	 * @param int $form_id The form ID.
1642 1642
 	 */
1643
-	do_action( 'give_hidden_fields_before', $form_id );
1643
+	do_action('give_hidden_fields_before', $form_id);
1644 1644
 
1645
-	if ( is_user_logged_in() ) { ?>
1645
+	if (is_user_logged_in()) { ?>
1646 1646
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1647 1647
 	<?php } ?>
1648 1648
 	<input type="hidden" name="give_action" value="purchase"/>
1649
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1649
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1650 1650
 	<?php
1651 1651
 	/**
1652 1652
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 	 *
1656 1656
 	 * @param int $form_id The form ID.
1657 1657
 	 */
1658
-	do_action( 'give_hidden_fields_after', $form_id );
1658
+	do_action('give_hidden_fields_after', $form_id);
1659 1659
 
1660 1660
 }
1661 1661
 
@@ -1670,20 +1670,20 @@  discard block
 block discarded – undo
1670 1670
  *
1671 1671
  * @return string $content Filtered content.
1672 1672
  */
1673
-function give_filter_success_page_content( $content ) {
1673
+function give_filter_success_page_content($content) {
1674 1674
 
1675 1675
 	$give_options = give_get_settings();
1676 1676
 
1677
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1678
-		if ( has_filter( 'give_donation_confirm_' . $_GET['payment-confirmation'] ) ) {
1679
-			$content = apply_filters( 'give_donation_confirm_' . $_GET['payment-confirmation'], $content );
1677
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1678
+		if (has_filter('give_donation_confirm_'.$_GET['payment-confirmation'])) {
1679
+			$content = apply_filters('give_donation_confirm_'.$_GET['payment-confirmation'], $content);
1680 1680
 		}
1681 1681
 	}
1682 1682
 
1683 1683
 	return $content;
1684 1684
 }
1685 1685
 
1686
-add_filter( 'the_content', 'give_filter_success_page_content' );
1686
+add_filter('the_content', 'give_filter_success_page_content');
1687 1687
 
1688 1688
 /**
1689 1689
  * Test Mode Frontend Warning.
@@ -1694,14 +1694,14 @@  discard block
 block discarded – undo
1694 1694
  */
1695 1695
 function give_test_mode_frontend_warning() {
1696 1696
 
1697
-	$test_mode = give_get_option( 'test_mode' );
1697
+	$test_mode = give_get_option('test_mode');
1698 1698
 
1699
-	if ( $test_mode == 'on' ) {
1700
-		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>';
1699
+	if ($test_mode == 'on') {
1700
+		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>';
1701 1701
 	}
1702 1702
 }
1703 1703
 
1704
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1704
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1705 1705
 
1706 1706
 /**
1707 1707
  * Members-only Form.
@@ -1715,21 +1715,21 @@  discard block
 block discarded – undo
1715 1715
  *
1716 1716
  * @return string
1717 1717
  */
1718
-function give_members_only_form( $final_output, $args ) {
1718
+function give_members_only_form($final_output, $args) {
1719 1719
 
1720
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1720
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1721 1721
 
1722 1722
 	//Sanity Check: Must have form_id & not be logged in
1723
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1723
+	if (empty($form_id) || is_user_logged_in()) {
1724 1724
 		return $final_output;
1725 1725
 	}
1726 1726
 
1727 1727
 	//Logged in only and Register / Login set to none
1728
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1728
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1729 1729
 
1730
-		$final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1730
+		$final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1731 1731
 
1732
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1732
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1733 1733
 
1734 1734
 	}
1735 1735
 
@@ -1737,4 +1737,4 @@  discard block
 block discarded – undo
1737 1737
 
1738 1738
 }
1739 1739
 
1740
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1740
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
includes/misc-functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -337,7 +337,7 @@
 block discarded – undo
337 337
  *
338 338
  * @since 1.0
339 339
  * @uses  Give()->session->get()
340
- * @return mixed array | false
340
+ * @return string array | false
341 341
  */
342 342
 function give_get_purchase_session() {
343 343
 	return Give()->session->get( 'give_purchase' );
Please login to merge, or discard this patch.
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	$ret = give_get_option('test_mode', false);
27 27
 
28
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
28
+	return (bool) apply_filters('give_is_test_mode', $ret);
29 29
 
30 30
 }
31 31
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function give_get_currency() {
39 39
 
40
-	$currency = give_get_option( 'currency', 'USD' );
40
+	$currency = give_get_option('currency', 'USD');
41 41
 
42
-	return apply_filters( 'give_currency', $currency );
42
+	return apply_filters('give_currency', $currency);
43 43
 }
44 44
 
45 45
 /**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function give_get_currency_position() {
53 53
 
54
-	$currency_pos = give_get_option( 'currency_position', 'before' );
54
+	$currency_pos = give_get_option('currency_position', 'before');
55 55
 
56
-	return apply_filters( 'give_currency_position', $currency_pos );
56
+	return apply_filters('give_currency_position', $currency_pos);
57 57
 }
58 58
 
59 59
 
@@ -66,39 +66,39 @@  discard block
 block discarded – undo
66 66
 
67 67
 function give_get_currencies() {
68 68
 	$currencies = array(
69
-		'USD'  => esc_html__( 'US Dollars ($)', 'give' ),
70
-		'EUR'  => esc_html__( 'Euros (€)', 'give' ),
71
-		'GBP'  => esc_html__( 'Pounds Sterling (£)', 'give' ),
72
-		'AUD'  => esc_html__( 'Australian Dollars ($)', 'give' ),
73
-		'BRL'  => esc_html__( 'Brazilian Real (R$)', 'give' ),
74
-		'CAD'  => esc_html__( 'Canadian Dollars ($)', 'give' ),
75
-		'CZK'  => esc_html__( 'Czech Koruna (Kč)', 'give' ),
76
-		'DKK'  => esc_html__( 'Danish Krone (kr)', 'give' ),
77
-		'HKD'  => esc_html__( 'Hong Kong Dollar ($)', 'give' ),
78
-		'HUF'  => esc_html__( 'Hungarian Forint (Ft)', 'give' ),
79
-		'ILS'  => esc_html__( 'Israeli Shekel (₪)', 'give' ),
80
-		'JPY'  => esc_html__( 'Japanese Yen (¥)', 'give' ),
81
-		'MYR'  => esc_html__( 'Malaysian Ringgits (RM)', 'give' ),
82
-		'MXN'  => esc_html__( 'Mexican Peso ($)', 'give' ),
83
-		'MAD'  => esc_html__( 'Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give' ),
84
-		'NZD'  => esc_html__( 'New Zealand Dollar ($)', 'give' ),
85
-		'NOK'  => esc_html__( 'Norwegian Krone (Kr.)', 'give' ),
86
-		'PHP'  => esc_html__( 'Philippine Pesos (₱)', 'give' ),
87
-		'PLN'  => esc_html__( 'Polish Zloty (zł)', 'give' ),
88
-		'SGD'  => esc_html__( 'Singapore Dollar ($)', 'give' ),
89
-		'KRW'  => esc_html__( 'South Korean Won (₩)', 'give' ),
90
-		'ZAR'  => esc_html__( 'South African Rand (R)', 'give' ),
91
-		'SEK'  => esc_html__( 'Swedish Krona (kr)', 'give' ),
92
-		'CHF'  => esc_html__( 'Swiss Franc (CHF)', 'give' ),
93
-		'TWD'  => esc_html__( 'Taiwan New Dollars (NT$)', 'give' ),
94
-		'THB'  => esc_html__( 'Thai Baht (฿)', 'give' ),
95
-		'INR'  => esc_html__( 'Indian Rupee (₹)', 'give' ),
96
-		'TRY'  => esc_html__( 'Turkish Lira (₺)', 'give' ),
97
-		'RIAL' => esc_html__( 'Iranian Rial (﷼)', 'give' ),
98
-		'RUB'  => esc_html__( 'Russian Rubles (руб)', 'give' )
69
+		'USD'  => esc_html__('US Dollars ($)', 'give'),
70
+		'EUR'  => esc_html__('Euros (€)', 'give'),
71
+		'GBP'  => esc_html__('Pounds Sterling (£)', 'give'),
72
+		'AUD'  => esc_html__('Australian Dollars ($)', 'give'),
73
+		'BRL'  => esc_html__('Brazilian Real (R$)', 'give'),
74
+		'CAD'  => esc_html__('Canadian Dollars ($)', 'give'),
75
+		'CZK'  => esc_html__('Czech Koruna (Kč)', 'give'),
76
+		'DKK'  => esc_html__('Danish Krone (kr)', 'give'),
77
+		'HKD'  => esc_html__('Hong Kong Dollar ($)', 'give'),
78
+		'HUF'  => esc_html__('Hungarian Forint (Ft)', 'give'),
79
+		'ILS'  => esc_html__('Israeli Shekel (₪)', 'give'),
80
+		'JPY'  => esc_html__('Japanese Yen (¥)', 'give'),
81
+		'MYR'  => esc_html__('Malaysian Ringgits (RM)', 'give'),
82
+		'MXN'  => esc_html__('Mexican Peso ($)', 'give'),
83
+		'MAD'  => esc_html__('Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give'),
84
+		'NZD'  => esc_html__('New Zealand Dollar ($)', 'give'),
85
+		'NOK'  => esc_html__('Norwegian Krone (Kr.)', 'give'),
86
+		'PHP'  => esc_html__('Philippine Pesos (₱)', 'give'),
87
+		'PLN'  => esc_html__('Polish Zloty (zł)', 'give'),
88
+		'SGD'  => esc_html__('Singapore Dollar ($)', 'give'),
89
+		'KRW'  => esc_html__('South Korean Won (₩)', 'give'),
90
+		'ZAR'  => esc_html__('South African Rand (R)', 'give'),
91
+		'SEK'  => esc_html__('Swedish Krona (kr)', 'give'),
92
+		'CHF'  => esc_html__('Swiss Franc (CHF)', 'give'),
93
+		'TWD'  => esc_html__('Taiwan New Dollars (NT$)', 'give'),
94
+		'THB'  => esc_html__('Thai Baht (฿)', 'give'),
95
+		'INR'  => esc_html__('Indian Rupee (₹)', 'give'),
96
+		'TRY'  => esc_html__('Turkish Lira (₺)', 'give'),
97
+		'RIAL' => esc_html__('Iranian Rial (﷼)', 'give'),
98
+		'RUB'  => esc_html__('Russian Rubles (руб)', 'give')
99 99
 	);
100 100
 
101
-	return apply_filters( 'give_currencies', $currencies );
101
+	return apply_filters('give_currencies', $currencies);
102 102
 }
103 103
 
104 104
 
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string           The symbol to use for the currency
115 115
  */
116
-function give_currency_symbol( $currency = '' ) {
116
+function give_currency_symbol($currency = '') {
117 117
 
118
-	if ( empty( $currency ) ) {
118
+	if (empty($currency)) {
119 119
 		$currency = give_get_currency();
120 120
 	}
121
-	switch ( $currency ) :
121
+	switch ($currency) :
122 122
 		case 'GBP' :
123 123
 			$symbol = '£';
124 124
 			break;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	endswitch;
198 198
 
199 199
 
200
-	return apply_filters( 'give_currency_symbol', $symbol, $currency );
200
+	return apply_filters('give_currency_symbol', $symbol, $currency);
201 201
 }
202 202
 
203 203
 
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function give_get_current_page_url() {
211 211
 
212
-	if ( is_front_page() ) {
213
-		$current_url = home_url( '/' );
212
+	if (is_front_page()) {
213
+		$current_url = home_url('/');
214 214
 	} else {
215
-		$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . untrailingslashit( $_SERVER['REQUEST_URI'] ) );
215
+		$current_url = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].untrailingslashit($_SERVER['REQUEST_URI']));
216 216
 	}
217 217
 
218
-	return apply_filters( 'give_get_current_page_url', esc_url( $current_url ) );
218
+	return apply_filters('give_get_current_page_url', esc_url($current_url));
219 219
 }
220 220
 
221 221
 
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	$gateways = give_get_enabled_payment_gateways();
238 238
 
239
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
239
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
240 240
 		$ret = true;
241
-	} else if ( count( $gateways ) == 1 ) {
241
+	} else if (count($gateways) == 1) {
242 242
 		$ret = false;
243
-	} else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
243
+	} else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
244 244
 		$ret = false;
245 245
 	}
246 246
 
247
-	return (bool) apply_filters( 'give_verify_credit_cards', $ret );
247
+	return (bool) apply_filters('give_verify_credit_cards', $ret);
248 248
 }
249 249
 
250 250
 /**
@@ -256,26 +256,26 @@  discard block
 block discarded – undo
256 256
 function give_get_timezone_id() {
257 257
 
258 258
 	// if site timezone string exists, return it
259
-	if ( $timezone = get_option( 'timezone_string' ) ) {
259
+	if ($timezone = get_option('timezone_string')) {
260 260
 		return $timezone;
261 261
 	}
262 262
 
263 263
 	// get UTC offset, if it isn't set return UTC
264
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
264
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
265 265
 		return 'UTC';
266 266
 	}
267 267
 
268 268
 	// attempt to guess the timezone string from the UTC offset
269
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
269
+	$timezone = timezone_name_from_abbr('', $utc_offset);
270 270
 
271 271
 	// last try, guess timezone string manually
272
-	if ( $timezone === false ) {
272
+	if ($timezone === false) {
273 273
 
274
-		$is_dst = date( 'I' );
274
+		$is_dst = date('I');
275 275
 
276
-		foreach ( timezone_abbreviations_list() as $abbr ) {
277
-			foreach ( $abbr as $city ) {
278
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
276
+		foreach (timezone_abbreviations_list() as $abbr) {
277
+			foreach ($abbr as $city) {
278
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
279 279
 					return $city['timezone_id'];
280 280
 				}
281 281
 			}
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
 
300 300
 	$ip = '127.0.0.1';
301 301
 
302
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
302
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
303 303
 		//check ip from share internet
304 304
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
305
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
305
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
306 306
 		//to check ip is pass from proxy
307 307
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
308
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
308
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
309 309
 		$ip = $_SERVER['REMOTE_ADDR'];
310 310
 	}
311 311
 
312
-	return apply_filters( 'give_get_ip', $ip );
312
+	return apply_filters('give_get_ip', $ip);
313 313
 }
314 314
 
315 315
 
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
  *
325 325
  * @uses  Give()->session->set()
326 326
  */
327
-function give_set_purchase_session( $purchase_data = array() ) {
328
-	Give()->session->set( 'give_purchase', $purchase_data );
329
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
327
+function give_set_purchase_session($purchase_data = array()) {
328
+	Give()->session->set('give_purchase', $purchase_data);
329
+	Give()->session->set('give_email', $purchase_data['user_email']);
330 330
 }
331 331
 
332 332
 /**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
  * @return mixed array | false
341 341
  */
342 342
 function give_get_purchase_session() {
343
-	return Give()->session->get( 'give_purchase' );
343
+	return Give()->session->get('give_purchase');
344 344
 }
345 345
 
346 346
 /**
@@ -355,14 +355,14 @@  discard block
 block discarded – undo
355 355
  *
356 356
  * @return string
357 357
  */
358
-function give_get_purchase_summary( $purchase_data, $email = true ) {
358
+function give_get_purchase_summary($purchase_data, $email = true) {
359 359
 	$summary = '';
360 360
 
361
-	if ( $email ) {
362
-		$summary .= $purchase_data['user_email'] . ' - ';
361
+	if ($email) {
362
+		$summary .= $purchase_data['user_email'].' - ';
363 363
 	}
364 364
 
365
-	$summary .= get_the_title( $purchase_data['post_data']['give-form-id'] );
365
+	$summary .= get_the_title($purchase_data['post_data']['give-form-id']);
366 366
 
367 367
 	return $summary;
368 368
 }
@@ -379,31 +379,31 @@  discard block
 block discarded – undo
379 379
 function give_get_host() {
380 380
 	$host = false;
381 381
 
382
-	if ( defined( 'WPE_APIKEY' ) ) {
382
+	if (defined('WPE_APIKEY')) {
383 383
 		$host = 'WP Engine';
384
-	} elseif ( defined( 'PAGELYBIN' ) ) {
384
+	} elseif (defined('PAGELYBIN')) {
385 385
 		$host = 'Pagely';
386
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
386
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
387 387
 		$host = 'ICDSoft';
388
-	} elseif ( DB_HOST == 'mysqlv5' ) {
388
+	} elseif (DB_HOST == 'mysqlv5') {
389 389
 		$host = 'NetworkSolutions';
390
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
390
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
391 391
 		$host = 'iPage';
392
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
392
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
393 393
 		$host = 'IPower';
394
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
394
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
395 395
 		$host = 'MediaTemple Grid';
396
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
396
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
397 397
 		$host = 'pair Networks';
398
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
398
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
399 399
 		$host = 'Rackspace Cloud';
400
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
400
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
401 401
 		$host = 'SysFix.eu Power Hosting';
402
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
402
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
403 403
 		$host = 'Flywheel';
404 404
 	} else {
405 405
 		// Adding a general fallback for data gathering
406
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
406
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
407 407
 	}
408 408
 
409 409
 	return $host;
@@ -419,67 +419,67 @@  discard block
 block discarded – undo
419 419
  *
420 420
  * @return bool true if host matches, false if not
421 421
  */
422
-function give_is_host( $host = false ) {
422
+function give_is_host($host = false) {
423 423
 
424 424
 	$return = false;
425 425
 
426
-	if ( $host ) {
427
-		$host = str_replace( ' ', '', strtolower( $host ) );
426
+	if ($host) {
427
+		$host = str_replace(' ', '', strtolower($host));
428 428
 
429
-		switch ( $host ) {
429
+		switch ($host) {
430 430
 			case 'wpengine':
431
-				if ( defined( 'WPE_APIKEY' ) ) {
431
+				if (defined('WPE_APIKEY')) {
432 432
 					$return = true;
433 433
 				}
434 434
 				break;
435 435
 			case 'pagely':
436
-				if ( defined( 'PAGELYBIN' ) ) {
436
+				if (defined('PAGELYBIN')) {
437 437
 					$return = true;
438 438
 				}
439 439
 				break;
440 440
 			case 'icdsoft':
441
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
441
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
442 442
 					$return = true;
443 443
 				}
444 444
 				break;
445 445
 			case 'networksolutions':
446
-				if ( DB_HOST == 'mysqlv5' ) {
446
+				if (DB_HOST == 'mysqlv5') {
447 447
 					$return = true;
448 448
 				}
449 449
 				break;
450 450
 			case 'ipage':
451
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
451
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
452 452
 					$return = true;
453 453
 				}
454 454
 				break;
455 455
 			case 'ipower':
456
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
456
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
457 457
 					$return = true;
458 458
 				}
459 459
 				break;
460 460
 			case 'mediatemplegrid':
461
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
461
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
462 462
 					$return = true;
463 463
 				}
464 464
 				break;
465 465
 			case 'pairnetworks':
466
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
466
+				if (strpos(DB_HOST, '.pair.com') !== false) {
467 467
 					$return = true;
468 468
 				}
469 469
 				break;
470 470
 			case 'rackspacecloud':
471
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
471
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
472 472
 					$return = true;
473 473
 				}
474 474
 				break;
475 475
 			case 'sysfix.eu':
476 476
 			case 'sysfix.eupowerhosting':
477
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
477
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
478 478
 					$return = true;
479 479
 				}
480 480
 				break;
481 481
 			case 'flywheel':
482
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
482
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
483 483
 					$return = true;
484 484
 				}
485 485
 				break;
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
  * @param string $replacement Optional. The function that should have been called.
513 513
  * @param array  $backtrace   Optional. Contains stack backtrace of deprecated function.
514 514
  */
515
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
515
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
516 516
 
517 517
 	/**
518 518
 	 * Fires while give deprecated function call occurs.
@@ -525,19 +525,19 @@  discard block
 block discarded – undo
525 525
 	 * @param string $replacement Optional. The function that should have been called.
526 526
 	 * @param string $version     The plugin version that deprecated the function.
527 527
 	 */
528
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
528
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
529 529
 
530
-	$show_errors = current_user_can( 'manage_options' );
530
+	$show_errors = current_user_can('manage_options');
531 531
 
532 532
 	// Allow plugin to filter the output error trigger
533
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
534
-		if ( ! is_null( $replacement ) ) {
535
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
536
-			trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
533
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
534
+		if ( ! is_null($replacement)) {
535
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
536
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
537 537
 			// Alternatively we could dump this to a file.
538 538
 		} else {
539
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
540
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
539
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
540
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
541 541
 			// Alternatively we could dump this to a file.
542 542
 		}
543 543
 	}
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
  * @return string $post_id
552 552
  */
553 553
 function give_get_admin_post_id() {
554
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
555
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
554
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
555
+	if ( ! $post_id && isset($_POST['post_id'])) {
556 556
 		$post_id = $_POST['post_id'];
557 557
 	}
558 558
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
  * @return string Arg separator output
567 567
  */
568 568
 function give_get_php_arg_separator_output() {
569
-	return ini_get( 'arg_separator.output' );
569
+	return ini_get('arg_separator.output');
570 570
 }
571 571
 
572 572
 
@@ -581,10 +581,10 @@  discard block
 block discarded – undo
581 581
  *
582 582
  * @return string Short month name
583 583
  */
584
-function give_month_num_to_name( $n ) {
585
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
584
+function give_month_num_to_name($n) {
585
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
586 586
 
587
-	return date_i18n( "M", $timestamp );
587
+	return date_i18n("M", $timestamp);
588 588
 }
589 589
 
590 590
 
@@ -597,10 +597,10 @@  discard block
 block discarded – undo
597 597
  *
598 598
  * @return bool Whether or not function is disabled.
599 599
  */
600
-function give_is_func_disabled( $function ) {
601
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
600
+function give_is_func_disabled($function) {
601
+	$disabled = explode(',', ini_get('disable_functions'));
602 602
 
603
-	return in_array( $function, $disabled );
603
+	return in_array($function, $disabled);
604 604
 }
605 605
 
606 606
 
@@ -611,31 +611,31 @@  discard block
 block discarded – undo
611 611
  */
612 612
 function give_get_newsletter() { ?>
613 613
 
614
-	<p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
614
+	<p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
615 615
 
616 616
 	<div class="give-newsletter-form-wrap">
617 617
 
618 618
 		<form action="//givewp.us3.list-manage.com/subscribe/post?u=3ccb75d68bda4381e2f45794c&amp;id=12a081aa13" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
619 619
 			<div class="give-newsletter-confirmation">
620
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
620
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
621 621
 			</div>
622 622
 
623 623
 			<table class="form-table give-newsletter-form">
624 624
 				<tr valign="middle">
625 625
 					<td>
626
-						<label for="mce-EMAIL" class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>
627
-						<input type="email" name="EMAIL" id="mce-EMAIL" placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" class="required email" value="">
626
+						<label for="mce-EMAIL" class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label>
627
+						<input type="email" name="EMAIL" id="mce-EMAIL" placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" class="required email" value="">
628 628
 					</td>
629 629
 					<td>
630
-						<label for="mce-FNAME" class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>
631
-						<input type="text" name="FNAME" id="mce-FNAME" placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="">
630
+						<label for="mce-FNAME" class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label>
631
+						<input type="text" name="FNAME" id="mce-FNAME" placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="">
632 632
 					</td>
633 633
 					<td>
634
-						<label for="mce-LNAME" class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
635
-						<input type="text" name="LNAME" id="mce-LNAME" placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value="">
634
+						<label for="mce-LNAME" class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label>
635
+						<input type="text" name="LNAME" id="mce-LNAME" placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value="">
636 636
 					</td>
637 637
 					<td>
638
-						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">
638
+						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_attr_e('Subscribe', 'give'); ?>">
639 639
 					</td>
640 640
 				</tr>
641 641
 			</table>
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 		<a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
697 697
 			printf(
698 698
 				/* translators: %s: Give twitter user @givewp */
699
-				esc_html_e( 'Follow %s', 'give' ),
699
+				esc_html_e('Follow %s', 'give'),
700 700
 				'@givewp'
701 701
 			);
702 702
 		?></a>
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
  *
726 726
  * @return string
727 727
  */
728
-function give_svg_icons( $icon ) {
728
+function give_svg_icons($icon) {
729 729
 
730 730
 	// Store your SVGs in an associative array
731 731
 	$svgs = array(
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 	);
738 738
 
739 739
 	// Return the chosen icon's SVG string
740
-	return $svgs[ $icon ];
740
+	return $svgs[$icon];
741 741
 }
742 742
 
743 743
 /**
@@ -749,15 +749,15 @@  discard block
 block discarded – undo
749 749
  *
750 750
  * @return mixed
751 751
  */
752
-function modify_nav_menu_meta_box_object( $post_type ) {
753
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
754
-		$post_type->labels->name = esc_html__( 'Donation Forms', 'give' );
752
+function modify_nav_menu_meta_box_object($post_type) {
753
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
754
+		$post_type->labels->name = esc_html__('Donation Forms', 'give');
755 755
 	}
756 756
 
757 757
 	return $post_type;
758 758
 }
759 759
 
760
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
760
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
761 761
 
762 762
 
763 763
 /**
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
  * @license    http://opensource.org/licenses/MIT MIT
772 772
  */
773 773
 
774
-if ( ! function_exists( 'array_column' ) ) {
774
+if ( ! function_exists('array_column')) {
775 775
 	/**
776 776
 	 * Returns the values from a single column of the input array, identified by
777 777
 	 * the $columnKey.
@@ -790,53 +790,53 @@  discard block
 block discarded – undo
790 790
 	 *
791 791
 	 * @return array
792 792
 	 */
793
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
793
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
794 794
 		// Using func_get_args() in order to check for proper number of
795 795
 		// parameters and trigger errors exactly as the built-in array_column()
796 796
 		// does in PHP 5.5.
797 797
 		$argc   = func_num_args();
798 798
 		$params = func_get_args();
799 799
 
800
-		if ( $argc < 2 ) {
801
-			trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING );
800
+		if ($argc < 2) {
801
+			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING);
802 802
 
803 803
 			return null;
804 804
 		}
805 805
 
806
-		if ( ! is_array( $params[0] ) ) {
807
-			trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING );
806
+		if ( ! is_array($params[0])) {
807
+			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING);
808 808
 
809 809
 			return null;
810 810
 		}
811 811
 
812
-		if ( ! is_int( $params[1] )
813
-		     && ! is_float( $params[1] )
814
-		     && ! is_string( $params[1] )
812
+		if ( ! is_int($params[1])
813
+		     && ! is_float($params[1])
814
+		     && ! is_string($params[1])
815 815
 		     && $params[1] !== null
816
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
816
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
817 817
 		) {
818
-			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
818
+			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING);
819 819
 
820 820
 			return false;
821 821
 		}
822 822
 
823
-		if ( isset( $params[2] )
824
-		     && ! is_int( $params[2] )
825
-		     && ! is_float( $params[2] )
826
-		     && ! is_string( $params[2] )
827
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
823
+		if (isset($params[2])
824
+		     && ! is_int($params[2])
825
+		     && ! is_float($params[2])
826
+		     && ! is_string($params[2])
827
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
828 828
 		) {
829
-			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
829
+			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING);
830 830
 
831 831
 			return false;
832 832
 		}
833 833
 
834 834
 		$paramsInput     = $params[0];
835
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
835
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
836 836
 
837 837
 		$paramsIndexKey = null;
838
-		if ( isset( $params[2] ) ) {
839
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
838
+		if (isset($params[2])) {
839
+			if (is_float($params[2]) || is_int($params[2])) {
840 840
 				$paramsIndexKey = (int) $params[2];
841 841
 			} else {
842 842
 				$paramsIndexKey = (string) $params[2];
@@ -845,26 +845,26 @@  discard block
 block discarded – undo
845 845
 
846 846
 		$resultArray = array();
847 847
 
848
-		foreach ( $paramsInput as $row ) {
848
+		foreach ($paramsInput as $row) {
849 849
 			$key    = $value = null;
850 850
 			$keySet = $valueSet = false;
851 851
 
852
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
852
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
853 853
 				$keySet = true;
854
-				$key    = (string) $row[ $paramsIndexKey ];
854
+				$key    = (string) $row[$paramsIndexKey];
855 855
 			}
856 856
 
857
-			if ( $paramsColumnKey === null ) {
857
+			if ($paramsColumnKey === null) {
858 858
 				$valueSet = true;
859 859
 				$value    = $row;
860
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
860
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
861 861
 				$valueSet = true;
862
-				$value    = $row[ $paramsColumnKey ];
862
+				$value    = $row[$paramsColumnKey];
863 863
 			}
864 864
 
865
-			if ( $valueSet ) {
866
-				if ( $keySet ) {
867
-					$resultArray[ $key ] = $value;
865
+			if ($valueSet) {
866
+				if ($keySet) {
867
+					$resultArray[$key] = $value;
868 868
 				} else {
869 869
 					$resultArray[] = $value;
870 870
 				}
@@ -886,40 +886,40 @@  discard block
 block discarded – undo
886 886
  *
887 887
  * @return bool Whether the receipt is visible or not.
888 888
  */
889
-function give_can_view_receipt( $payment_key = '' ) {
889
+function give_can_view_receipt($payment_key = '') {
890 890
 
891 891
 	$return = false;
892 892
 
893
-	if ( empty( $payment_key ) ) {
893
+	if (empty($payment_key)) {
894 894
 		return $return;
895 895
 	}
896 896
 
897 897
 	global $give_receipt_args;
898 898
 
899
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
899
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
900 900
 
901
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
901
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
902 902
 
903
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
903
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
904 904
 
905
-	if ( is_user_logged_in() ) {
906
-		if ( $user_id === (int) get_current_user_id() ) {
905
+	if (is_user_logged_in()) {
906
+		if ($user_id === (int) get_current_user_id()) {
907 907
 			$return = true;
908
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
908
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
909 909
 			$return = true;
910
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
910
+		} elseif (current_user_can('view_give_sensitive_data')) {
911 911
 			$return = true;
912 912
 		}
913 913
 	}
914 914
 
915 915
 	$session = give_get_purchase_session();
916
-	if ( ! empty( $session ) && ! is_user_logged_in() ) {
917
-		if ( $session['purchase_key'] === $payment_meta['key'] ) {
916
+	if ( ! empty($session) && ! is_user_logged_in()) {
917
+		if ($session['purchase_key'] === $payment_meta['key']) {
918 918
 			$return = true;
919 919
 		}
920 920
 	}
921 921
 
922
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
922
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
923 923
 
924 924
 }
925 925
 
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
  *
929 929
  * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
930 930
  */
931
-if ( ! function_exists( 'cal_days_in_month' ) ) {
931
+if ( ! function_exists('cal_days_in_month')) {
932 932
 	/**
933 933
 	 * cal_days_in_month
934 934
 	 *
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 	 *
939 939
 	 * @return bool|string
940 940
 	 */
941
-	function cal_days_in_month( $calendar, $month, $year ) {
942
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
941
+	function cal_days_in_month($calendar, $month, $year) {
942
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
943 943
 	}
944 944
 }
Please login to merge, or discard this patch.