Test Failed
Push — master ( 1d3b59...426730 )
by Devin
01:16
created
includes/admin/tools/import/class-give-import-donations.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 
455 455
 		/**
456 456
 		 * @param $option_value
457
-		 * @param $value
457
+		 * @param boolean $value
458 458
 		 *
459 459
 		 * @return string
460 460
 		 */
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		 *
545 545
 		 * @since 1.8.14
546 546
 		 *
547
-		 * @param $file_id
547
+		 * @param integer $file_id
548 548
 		 *
549 549
 		 * @return bool|int
550 550
 		 */
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -871,8 +871,8 @@
 block discarded – undo
871 871
 		 */
872 872
 		private function is_donations_import_page() {
873 873
 			return 'import' === give_get_current_setting_tab() &&
874
-			       isset( $_GET['importer-type'] ) &&
875
-			       $this->importer_type === give_clean( $_GET['importer-type'] );
874
+				   isset( $_GET['importer-type'] ) &&
875
+				   $this->importer_type === give_clean( $_GET['importer-type'] );
876 876
 		}
877 877
 	}
878 878
 
Please login to merge, or discard this patch.
Spacing   +189 added lines, -195 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  * @since       1.8.14
12 12
  */
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit; // Exit if accessed directly
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Import_Donations' ) ) {
18
+if ( ! class_exists('Give_Import_Donations')) {
19 19
 
20 20
 	/**
21 21
 	 * Give_Import_Donations.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		 * @access private
58 58
 		 */
59 59
 		private function __construct() {
60
-			self::$per_page  = ! empty( $_GET['per_page'] ) ? absint( $_GET['per_page'] ) : self::$per_page;
60
+			self::$per_page = ! empty($_GET['per_page']) ? absint($_GET['per_page']) : self::$per_page;
61 61
 		}
62 62
 
63 63
 		/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		 * @return static
70 70
 		 */
71 71
 		public static function get_instance() {
72
-			if ( null === static::$instance ) {
72
+			if (null === static::$instance) {
73 73
 				self::$instance = new static();
74 74
 			}
75 75
 
@@ -96,27 +96,27 @@  discard block
 block discarded – undo
96 96
 		 * @return void
97 97
 		 */
98 98
 		private function setup_hooks() {
99
-			if ( ! $this->is_donations_import_page() ) {
99
+			if ( ! $this->is_donations_import_page()) {
100 100
 				return;
101 101
 			}
102 102
 
103 103
 			// Do not render main import tools page.
104
-			remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) );
104
+			remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',));
105 105
 
106 106
 
107 107
 			// Render donation import page
108
-			add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) );
108
+			add_action('give_admin_field_tools_import', array($this, 'render_page'));
109 109
 
110 110
 			// Print the HTML.
111
-			add_action( 'give_tools_import_donations_form_start', array( $this, 'html' ), 10 );
111
+			add_action('give_tools_import_donations_form_start', array($this, 'html'), 10);
112 112
 
113 113
 			// Run when form submit.
114
-			add_action( 'give-tools_save_import', array( $this, 'save' ) );
114
+			add_action('give-tools_save_import', array($this, 'save'));
115 115
 
116
-			add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 );
116
+			add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1);
117 117
 
118 118
 			// Used to add submit button.
119
-			add_action( 'give_tools_import_donations_form_end', array( $this, 'submit' ), 10 );
119
+			add_action('give_tools_import_donations_form_end', array($this, 'submit'), 10);
120 120
 		}
121 121
 
122 122
 		/**
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 		 *
129 129
 		 * @return mixed
130 130
 		 */
131
-		public function update_notices( $messages ) {
132
-			if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) {
133
-				unset( $messages['give-setting-updated'] );
131
+		public function update_notices($messages) {
132
+			if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) {
133
+				unset($messages['give-setting-updated']);
134 134
 			}
135 135
 
136 136
 			return $messages;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		 * @since 1.8.14
143 143
 		 */
144 144
 		public function submit() {
145
-			wp_nonce_field( 'give-save-settings', '_give-save-settings' );
145
+			wp_nonce_field('give-save-settings', '_give-save-settings');
146 146
 			?>
147 147
 			<input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/>
148 148
 			<input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/>
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 				<table class="widefat export-options-table give-table <?php echo "step-{$step}"; ?>" id="<?php echo "step-{$step}"; ?>">
165 165
 					<tbody>
166 166
 						<?php
167
-						switch ( $this->get_step() ) {
167
+						switch ($this->get_step()) {
168 168
 							case 1:
169 169
 								$this->render_media_csv();
170 170
 								break;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 								$this->import_success();
182 182
 						}
183 183
 
184
-						if ( false === $this->check_for_dropdown_or_import() ) {
184
+						if (false === $this->check_for_dropdown_or_import()) {
185 185
 							?>
186 186
 							<tr valign="top">
187 187
 								<th></th>
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 									<input type="submit"
190 190
 										   class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>"
191 191
 										   id="recount-stats-submit"
192
-										   value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/>
192
+										   value="<?php esc_attr_e('Submit', 'give'); ?>"/>
193 193
 								</th>
194 194
 							</tr>
195 195
 							<?php
@@ -208,56 +208,56 @@  discard block
 block discarded – undo
208 208
 		 */
209 209
 		public function import_success() {
210 210
 
211
-			$delete_csv = ( ! empty( $_GET['delete_csv'] ) ? absint( $_GET['delete_csv'] ) : false );
212
-			$csv        = ( ! empty( $_GET['csv'] ) ? absint( $_GET['csv'] ) : false );
213
-			if ( ! empty( $delete_csv ) && ! empty( $csv ) ) {
214
-				wp_delete_attachment( $csv, true );
211
+			$delete_csv = ( ! empty($_GET['delete_csv']) ? absint($_GET['delete_csv']) : false);
212
+			$csv        = ( ! empty($_GET['csv']) ? absint($_GET['csv']) : false);
213
+			if ( ! empty($delete_csv) && ! empty($csv)) {
214
+				wp_delete_attachment($csv, true);
215 215
 			}
216 216
 
217 217
 			$report      = give_import_donation_report();
218 218
 			$report_html = array(
219 219
 				'duplicate_donor'    => array(
220
-					__( '%s duplicate %s detected', 'give' ),
221
-					__( 'donor', 'give' ),
222
-					__( 'donors', 'give' ),
220
+					__('%s duplicate %s detected', 'give'),
221
+					__('donor', 'give'),
222
+					__('donors', 'give'),
223 223
 				),
224 224
 				'create_donor'       => array(
225
-					__( '%s %s created', 'give' ),
226
-					__( 'donor', 'give' ),
227
-					__( 'donors', 'give' ),
225
+					__('%s %s created', 'give'),
226
+					__('donor', 'give'),
227
+					__('donors', 'give'),
228 228
 				),
229 229
 				'create_form'        => array(
230
-					__( '%s donation %s created', 'give' ),
231
-					__( 'form', 'give' ),
232
-					__( 'forms', 'give' ),
230
+					__('%s donation %s created', 'give'),
231
+					__('form', 'give'),
232
+					__('forms', 'give'),
233 233
 				),
234 234
 				'duplicate_donation' => array(
235
-					__( '%s duplicate %s detected', 'give' ),
236
-					__( 'donation', 'give' ),
237
-					__( 'donations', 'give' ),
235
+					__('%s duplicate %s detected', 'give'),
236
+					__('donation', 'give'),
237
+					__('donations', 'give'),
238 238
 				),
239 239
 				'create_donation'    => array(
240
-					__( '%s %s imported', 'give' ),
241
-					__( 'donation', 'give' ),
242
-					__( 'donations', 'give' ),
240
+					__('%s %s imported', 'give'),
241
+					__('donation', 'give'),
242
+					__('donations', 'give'),
243 243
 				),
244 244
 			);
245
-			$total       = (int) $_GET['total'];
246
-			-- $total;
245
+			$total = (int) $_GET['total'];
246
+			--$total;
247 247
 			$success = (bool) $_GET['success'];
248 248
 			?>
249 249
 			<tr valign="top" class="give-import-dropdown">
250 250
 				<th colspan="2">
251 251
 					<h2>
252 252
 						<?php
253
-						if ( $success ) {
253
+						if ($success) {
254 254
 							echo sprintf(
255
-								__( 'Import complete! %s donations processed', 'give' ),
255
+								__('Import complete! %s donations processed', 'give'),
256 256
 								"<strong>{$total}</strong>"
257 257
 							);
258 258
 						} else {
259 259
 							echo sprintf(
260
-								__( 'Failed to import %s donations', 'give' ),
260
+								__('Failed to import %s donations', 'give'),
261 261
 								"<strong>{$total}</strong>"
262 262
 							);
263 263
 						}
@@ -265,25 +265,25 @@  discard block
 block discarded – undo
265 265
 					</h2>
266 266
 
267 267
 					<?php
268
-					$text      = __( 'Import Donation', 'give' );
268
+					$text      = __('Import Donation', 'give');
269 269
 					$query_arg = array(
270 270
 						'post_type' => 'give_forms',
271 271
 						'page'      => 'give-tools',
272 272
 						'tab'       => 'import',
273 273
 					);
274
-					if ( $success ) {
274
+					if ($success) {
275 275
 						$query_arg = array(
276 276
 							'post_type' => 'give_forms',
277 277
 							'page'      => 'give-payment-history',
278 278
 						);
279
-						$text      = __( 'View Donations', 'give' );
279
+						$text = __('View Donations', 'give');
280 280
 					}
281 281
 
282
-					foreach ( $report as $key => $value ) {
283
-						if ( array_key_exists( $key, $report_html ) && ! empty( $value ) ) {
282
+					foreach ($report as $key => $value) {
283
+						if (array_key_exists($key, $report_html) && ! empty($value)) {
284 284
 							?>
285 285
 							<p>
286
-								<?php echo esc_html( wp_sprintf( $report_html[ $key ][0], $value, _n( $report_html[ $key ][1], $report_html[ $key ][2], $value, 'give' ) ) ); ?>
286
+								<?php echo esc_html(wp_sprintf($report_html[$key][0], $value, _n($report_html[$key][1], $report_html[$key][2], $value, 'give'))); ?>
287 287
 							</p>
288 288
 							<?php
289 289
 						}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 					?>
292 292
 
293 293
 					<p>
294
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a>
294
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg, admin_url('edit.php')); ?>"><?php echo $text; ?></a>
295 295
 					</p>
296 296
 				</th>
297 297
 			</tr>
@@ -308,26 +308,26 @@  discard block
 block discarded – undo
308 308
 			give_import_donation_report_reset();
309 309
 
310 310
 			$csv         = (int) $_REQUEST['csv'];
311
-			$delimiter   = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' );
311
+			$delimiter   = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv');
312 312
 			$index_start = 1;
313 313
 			$index_end   = 1;
314 314
 			$next        = true;
315
-			$total       = self::get_csv_total( $csv );
316
-			if ( self::$per_page < $total ) {
317
-				$total_ajax = ceil( $total / self::$per_page );
315
+			$total       = self::get_csv_total($csv);
316
+			if (self::$per_page < $total) {
317
+				$total_ajax = ceil($total / self::$per_page);
318 318
 				$index_end  = self::$per_page;
319 319
 			} else {
320 320
 				$total_ajax = 1;
321 321
 				$index_end  = $total;
322 322
 				$next       = false;
323 323
 			}
324
-			$current_percentage = 100 / ( $total_ajax + 1 );
324
+			$current_percentage = 100 / ($total_ajax + 1);
325 325
 
326 326
 			?>
327 327
 			<tr valign="top" class="give-import-dropdown">
328 328
 				<th colspan="2">
329
-					<h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2>
330
-					<p class="give-field-description"><?php esc_html_e( 'Your donations are now being imported...', 'give' ) ?></p>
329
+					<h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2>
330
+					<p class="give-field-description"><?php esc_html_e('Your donations are now being imported...', 'give') ?></p>
331 331
 				</th>
332 332
 			</tr>
333 333
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 						<div style="width: <?php echo $current_percentage; ?>%"></div>
347 347
 					</div>
348 348
 					<input type="hidden" value="3" name="step">
349
-					<input type="hidden" value='<?php echo maybe_serialize( $_REQUEST['mapto'] ); ?>' name="mapto"
349
+					<input type="hidden" value='<?php echo maybe_serialize($_REQUEST['mapto']); ?>' name="mapto"
350 350
 						   class="mapto">
351 351
 					<input type="hidden" value="<?php echo $_REQUEST['csv']; ?>" name="csv" class="csv">
352 352
 					<input type="hidden" value="<?php echo $_REQUEST['mode']; ?>" name="mode" class="mode">
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 					<input type="hidden" value="<?php echo $_REQUEST['delete_csv']; ?>" name="delete_csv"
356 356
 						   class="delete_csv">
357 357
 					<input type="hidden" value="<?php echo $delimiter; ?>" name="delimiter">
358
-					<input type="hidden" value='<?php echo maybe_serialize( self::get_importer( $csv, 0, $delimiter ) ); ?>'
358
+					<input type="hidden" value='<?php echo maybe_serialize(self::get_importer($csv, 0, $delimiter)); ?>'
359 359
 						   name="main_key"
360 360
 						   class="main_key">
361 361
 				</th>
@@ -376,20 +376,20 @@  discard block
 block discarded – undo
376 376
 		 */
377 377
 		public function check_for_dropdown_or_import() {
378 378
 			$return = true;
379
-			if ( isset( $_REQUEST['mapto'] ) ) {
379
+			if (isset($_REQUEST['mapto'])) {
380 380
 				$mapto = (array) $_REQUEST['mapto'];
381
-				if ( false === in_array( 'form_title', $mapto ) && false === in_array( 'form_id', $mapto ) ) {
382
-					Give_Admin_Settings::add_error( 'give-import-csv-form', __( 'In order to import donations, a column must be mapped to either the "Donation Form Title" or "Donation Form ID" field. Please map a column to one of those fields.', 'give' ) );
381
+				if (false === in_array('form_title', $mapto) && false === in_array('form_id', $mapto)) {
382
+					Give_Admin_Settings::add_error('give-import-csv-form', __('In order to import donations, a column must be mapped to either the "Donation Form Title" or "Donation Form ID" field. Please map a column to one of those fields.', 'give'));
383 383
 					$return = false;
384 384
 				}
385 385
 
386
-				if ( false === in_array( 'amount', $mapto ) ) {
387
-					Give_Admin_Settings::add_error( 'give-import-csv-amount', __( 'In order to import donations, a column must be mapped to the "Amount" field. Please map a column to that field.', 'give' ) );
386
+				if (false === in_array('amount', $mapto)) {
387
+					Give_Admin_Settings::add_error('give-import-csv-amount', __('In order to import donations, a column must be mapped to the "Amount" field. Please map a column to that field.', 'give'));
388 388
 					$return = false;
389 389
 				}
390 390
 
391
-				if ( false === in_array( 'email', $mapto ) && false === in_array( 'donor_id', $mapto ) ) {
392
-					Give_Admin_Settings::add_error( 'give-import-csv-donor', __( 'In order to import donations, a column must be mapped to either the "Donor Email" or "Donor ID" field. Please map a column to that field.', 'give' ) );
391
+				if (false === in_array('email', $mapto) && false === in_array('donor_id', $mapto)) {
392
+					Give_Admin_Settings::add_error('give-import-csv-donor', __('In order to import donations, a column must be mapped to either the "Donor Email" or "Donor ID" field. Please map a column to that field.', 'give'));
393 393
 					$return = false;
394 394
 				}
395 395
 			} else {
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
 		 */
407 407
 		public function render_dropdown() {
408 408
 			$csv       = (int) $_GET['csv'];
409
-			$delimiter = ( ! empty( $_GET['delimiter'] ) ? give_clean( $_GET['delimiter'] ) : 'csv' );
409
+			$delimiter = ( ! empty($_GET['delimiter']) ? give_clean($_GET['delimiter']) : 'csv');
410 410
 
411 411
 			// TO check if the CSV files that is being add is valid or not if not then redirect to first step again
412
-			if ( ! $this->is_valid_csv( $csv ) ) {
412
+			if ( ! $this->is_valid_csv($csv)) {
413 413
 				$url = give_import_page_url();
414 414
 				?>
415 415
 				<script type="text/javascript">
@@ -420,27 +420,27 @@  discard block
 block discarded – undo
420 420
 				?>
421 421
 				<tr valign="top" class="give-import-dropdown">
422 422
 					<th colspan="2">
423
-						<h2 id="give-import-title"><?php esc_html_e( 'Map CSV fields to donations', 'give' ) ?></h2>
424
-						<p class="give-field-description"><?php esc_html_e( 'Select fields from your CSV file to map against donations fields or to ignore during import.', 'give' ) ?></p>
423
+						<h2 id="give-import-title"><?php esc_html_e('Map CSV fields to donations', 'give') ?></h2>
424
+						<p class="give-field-description"><?php esc_html_e('Select fields from your CSV file to map against donations fields or to ignore during import.', 'give') ?></p>
425 425
 					</th>
426 426
 				</tr>
427 427
 
428 428
 				<tr valign="top" class="give-import-dropdown">
429
-					<th><b><?php esc_html_e( 'Column name', 'give' ); ?></b></th>
430
-					<th><b><?php esc_html_e( 'Map to field', 'give' ); ?></b></th>
429
+					<th><b><?php esc_html_e('Column name', 'give'); ?></b></th>
430
+					<th><b><?php esc_html_e('Map to field', 'give'); ?></b></th>
431 431
 				</tr>
432 432
 
433 433
 				<?php
434
-				$raw_key   = $this->get_importer( $csv, 0, $delimiter );
435
-				$mapto     = (array) ( isset( $_REQUEST['mapto'] ) ? $_REQUEST['mapto'] : array() );
434
+				$raw_key   = $this->get_importer($csv, 0, $delimiter);
435
+				$mapto     = (array) (isset($_REQUEST['mapto']) ? $_REQUEST['mapto'] : array());
436 436
 
437
-				foreach ( $raw_key as $index => $value ) {
437
+				foreach ($raw_key as $index => $value) {
438 438
 					?>
439 439
 					<tr valign="top" class="give-import-option">
440 440
 						<th><?php echo $value; ?></th>
441 441
 						<th>
442 442
 							<?php
443
-							$this->get_columns( $index, $value, $mapto );
443
+							$this->get_columns($index, $value, $mapto);
444 444
 							?>
445 445
 						</th>
446 446
 					</tr>
@@ -455,14 +455,14 @@  discard block
 block discarded – undo
455 455
 		 *
456 456
 		 * @return string
457 457
 		 */
458
-		public function selected( $option_value, $value ) {
459
-			$option_value = strtolower( $option_value );
460
-			$value = strtolower( $value );
458
+		public function selected($option_value, $value) {
459
+			$option_value = strtolower($option_value);
460
+			$value = strtolower($value);
461 461
 
462 462
 			$selected = '';
463
-			if ( stristr( $value, $option_value ) ) {
463
+			if (stristr($value, $option_value)) {
464 464
 				$selected = 'selected';
465
-			} elseif ( strrpos( $value, '_' ) && stristr( $option_value, __( 'Import as Meta', 'give' ) ) ) {
465
+			} elseif (strrpos($value, '_') && stristr($option_value, __('Import as Meta', 'give'))) {
466 466
 				$selected = 'selected';
467 467
 			}
468 468
 
@@ -481,28 +481,28 @@  discard block
 block discarded – undo
481 481
 		 *
482 482
 		 * @return void
483 483
 		 */
484
-		private function get_columns( $index, $value = false, $mapto = array() ) {
484
+		private function get_columns($index, $value = false, $mapto = array()) {
485 485
 			$default       = give_import_default_options();
486
-			$current_mapto = (string) ( ! empty( $mapto[ $index ] ) ? $mapto[ $index ] : '' );
486
+			$current_mapto = (string) ( ! empty($mapto[$index]) ? $mapto[$index] : '');
487 487
 			?>
488 488
 			<select name="mapto[<?php echo $index; ?>]">
489
-				<?php $this->get_dropdown_option_html( $default, $current_mapto, $value ); ?>
489
+				<?php $this->get_dropdown_option_html($default, $current_mapto, $value); ?>
490 490
 
491
-				<optgroup label="<?php _e( 'Donations', 'give' ); ?>">
491
+				<optgroup label="<?php _e('Donations', 'give'); ?>">
492 492
 					<?php
493
-					$this->get_dropdown_option_html( give_import_donations_options(), $current_mapto, $value );
493
+					$this->get_dropdown_option_html(give_import_donations_options(), $current_mapto, $value);
494 494
 					?>
495 495
 				</optgroup>
496 496
 
497
-				<optgroup label="<?php _e( 'Donors', 'give' ); ?>">
497
+				<optgroup label="<?php _e('Donors', 'give'); ?>">
498 498
 					<?php
499
-					$this->get_dropdown_option_html( give_import_donor_options(), $current_mapto, $value );
499
+					$this->get_dropdown_option_html(give_import_donor_options(), $current_mapto, $value);
500 500
 					?>
501 501
 				</optgroup>
502 502
 
503
-				<optgroup label="<?php _e( 'Forms', 'give' ); ?>">
503
+				<optgroup label="<?php _e('Forms', 'give'); ?>">
504 504
 					<?php
505
-					$this->get_dropdown_option_html( give_import_donation_form_options(), $current_mapto, $value );
505
+					$this->get_dropdown_option_html(give_import_donation_form_options(), $current_mapto, $value);
506 506
 					?>
507 507
 				</optgroup>
508 508
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 				 *
514 514
 				 * @since 1.8.15
515 515
 				 */
516
-				do_action( 'give_import_dropdown_option', $index, $value, $mapto, $current_mapto );
516
+				do_action('give_import_dropdown_option', $index, $value, $mapto, $current_mapto);
517 517
 				?>
518 518
 			</select>
519 519
 			<?php
@@ -531,16 +531,16 @@  discard block
 block discarded – undo
531 531
 		 *
532 532
 		 * @return void
533 533
 		 */
534
-		public function get_dropdown_option_html( $options, $current_mapto, $value = false ) {
535
-			foreach ( $options as $option => $option_value ) {
534
+		public function get_dropdown_option_html($options, $current_mapto, $value = false) {
535
+			foreach ($options as $option => $option_value) {
536 536
 				$option_value_texts = (array) $option_value;
537 537
 				$option_text = $option_value_texts[0];
538 538
 
539
-				$checked = ( ( $current_mapto === $option ) ? 'selected' : false );
540
-				if ( empty( $checked ) ) {
541
-					foreach ( $option_value_texts as $option_value_text ) {
542
-						$checked = $this->selected( $option_value_text, $value );
543
-						if ( $checked ) {
539
+				$checked = (($current_mapto === $option) ? 'selected' : false);
540
+				if (empty($checked)) {
541
+					foreach ($option_value_texts as $option_value_text) {
542
+						$checked = $this->selected($option_value_text, $value);
543
+						if ($checked) {
544 544
 							break;
545 545
 						}
546 546
 					}
@@ -564,13 +564,13 @@  discard block
 block discarded – undo
564 564
 		 *
565 565
 		 * @return bool|int
566 566
 		 */
567
-		public function get_csv_total( $file_id ) {
567
+		public function get_csv_total($file_id) {
568 568
 			$total = false;
569
-			if ( $file_id ) {
570
-				$file_dir = get_attached_file( $file_id );
571
-				if ( $file_dir ) {
572
-					$file = new SplFileObject( $file_dir, 'r' );
573
-					$file->seek( PHP_INT_MAX );
569
+			if ($file_id) {
570
+				$file_dir = get_attached_file($file_id);
571
+				if ($file_dir) {
572
+					$file = new SplFileObject($file_dir, 'r');
573
+					$file->seek(PHP_INT_MAX);
574 574
 					$total = $file->key() + 1;
575 575
 				}
576 576
 			}
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		 *
590 590
 		 * @return array|bool $raw_data title of the CSV file fields
591 591
 		 */
592
-		public function get_importer( $file_id, $index = 0, $delimiter = 'csv' ) {
592
+		public function get_importer($file_id, $index = 0, $delimiter = 'csv') {
593 593
 			/**
594 594
 			 * Filter to modify delimiter of Import.
595 595
 			 *
@@ -597,16 +597,16 @@  discard block
 block discarded – undo
597 597
 			 *
598 598
 			 * Return string $delimiter.
599 599
 			 */
600
-			$delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter );
600
+			$delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter);
601 601
 
602 602
 			$raw_data = false;
603
-			$file_dir = get_attached_file( $file_id );
604
-			if ( $file_dir ) {
605
-				if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) {
606
-					$raw_data = fgetcsv( $handle, $index, $delimiter );
603
+			$file_dir = get_attached_file($file_id);
604
+			if ($file_dir) {
605
+				if (false !== ($handle = fopen($file_dir, 'r'))) {
606
+					$raw_data = fgetcsv($handle, $index, $delimiter);
607 607
 					// Remove BOM signature from the first item.
608
-					if ( isset( $raw_data[0] ) ) {
609
-						$raw_data[0] = $this->remove_utf8_bom( $raw_data[0] );
608
+					if (isset($raw_data[0])) {
609
+						$raw_data[0] = $this->remove_utf8_bom($raw_data[0]);
610 610
 					}
611 611
 				}
612 612
 			}
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
 		 *
624 624
 		 * @return string
625 625
 		 */
626
-		public function remove_utf8_bom( $string ) {
627
-			if ( 'efbbbf' === substr( bin2hex( $string ), 0, 6 ) ) {
628
-				$string = substr( $string, 3 );
626
+		public function remove_utf8_bom($string) {
627
+			if ('efbbbf' === substr(bin2hex($string), 0, 6)) {
628
+				$string = substr($string, 3);
629 629
 			}
630 630
 
631 631
 			return $string;
@@ -641,17 +641,17 @@  discard block
 block discarded – undo
641 641
 			$step = $this->get_step();
642 642
 			?>
643 643
 			<ol class="give-progress-steps">
644
-				<li class="<?php echo( 1 === $step ? 'active' : '' ); ?>">
645
-					<?php esc_html_e( 'Upload CSV file', 'give' ); ?>
644
+				<li class="<?php echo(1 === $step ? 'active' : ''); ?>">
645
+					<?php esc_html_e('Upload CSV file', 'give'); ?>
646 646
 				</li>
647
-				<li class="<?php echo( 2 === $step ? 'active' : '' ); ?>">
648
-					<?php esc_html_e( 'Column mapping', 'give' ); ?>
647
+				<li class="<?php echo(2 === $step ? 'active' : ''); ?>">
648
+					<?php esc_html_e('Column mapping', 'give'); ?>
649 649
 				</li>
650
-				<li class="<?php echo( 3 === $step ? 'active' : '' ); ?>">
651
-					<?php esc_html_e( 'Import', 'give' ); ?>
650
+				<li class="<?php echo(3 === $step ? 'active' : ''); ?>">
651
+					<?php esc_html_e('Import', 'give'); ?>
652 652
 				</li>
653
-				<li class="<?php echo( 4 === $step ? 'active' : '' ); ?>">
654
-					<?php esc_html_e( 'Done!', 'give' ); ?>
653
+				<li class="<?php echo(4 === $step ? 'active' : ''); ?>">
654
+					<?php esc_html_e('Done!', 'give'); ?>
655 655
 				</li>
656 656
 			</ol>
657 657
 			<?php
@@ -665,16 +665,16 @@  discard block
 block discarded – undo
665 665
 		 * @return int $step on which step doest the import is on.
666 666
 		 */
667 667
 		public function get_step() {
668
-			$step    = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 );
668
+			$step    = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0);
669 669
 			$on_step = 1;
670 670
 
671
-			if ( empty( $step ) || 1 === $step ) {
671
+			if (empty($step) || 1 === $step) {
672 672
 				$on_step = 1;
673
-			} elseif ( $this->check_for_dropdown_or_import() ) {
673
+			} elseif ($this->check_for_dropdown_or_import()) {
674 674
 				$on_step = 3;
675
-			} elseif ( 2 === $step ) {
675
+			} elseif (2 === $step) {
676 676
 				$on_step = 2;
677
-			} elseif ( 4 === $step ) {
677
+			} elseif (4 === $step) {
678 678
 				$on_step = 4;
679 679
 			}
680 680
 
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 		 * @since 1.8.14
688 688
 		 */
689 689
 		public function render_page() {
690
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-donations.php';
690
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-donations.php';
691 691
 		}
692 692
 
693 693
 		/**
@@ -702,37 +702,34 @@  discard block
 block discarded – undo
702 702
 			?>
703 703
 			<tr valign="top">
704 704
 				<th colspan="2">
705
-					<h2 id="give-import-title"><?php esc_html_e( 'Import donations from a CSV file', 'give' ) ?></h2>
706
-					<p class="give-field-description"><?php esc_html_e( 'This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give' ) ?></p>
705
+					<h2 id="give-import-title"><?php esc_html_e('Import donations from a CSV file', 'give') ?></h2>
706
+					<p class="give-field-description"><?php esc_html_e('This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give') ?></p>
707 707
 				</th>
708 708
 			</tr>
709 709
 			<?php
710
-			$csv         = ( isset( $_POST['csv'] ) ? give_clean( $_POST['csv'] ) : '' );
711
-			$csv_id      = ( isset( $_POST['csv_id'] ) ? give_clean( $_POST['csv_id'] ) : '' );
712
-			$delimiter   = ( isset( $_POST['delimiter'] ) ? give_clean( $_POST['delimiter'] ) : 'csv' );
713
-			$mode        = empty( $_POST['mode'] ) ?
714
-				'disabled' :
715
-				( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? 'enabled' : 'disabled' );
716
-			$create_user = empty( $_POST['create_user'] ) ?
717
-				'enabled' :
718
-				( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? 'enabled' : 'disabled' );
719
-			$delete_csv  = empty( $_POST['delete_csv'] ) ?
720
-				'enabled' :
721
-				( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? 'enabled' : 'disabled' );
710
+			$csv         = (isset($_POST['csv']) ? give_clean($_POST['csv']) : '');
711
+			$csv_id      = (isset($_POST['csv_id']) ? give_clean($_POST['csv_id']) : '');
712
+			$delimiter   = (isset($_POST['delimiter']) ? give_clean($_POST['delimiter']) : 'csv');
713
+			$mode        = empty($_POST['mode']) ?
714
+				'disabled' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? 'enabled' : 'disabled');
715
+			$create_user = empty($_POST['create_user']) ?
716
+				'enabled' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? 'enabled' : 'disabled');
717
+			$delete_csv  = empty($_POST['delete_csv']) ?
718
+				'enabled' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? 'enabled' : 'disabled');
722 719
 
723 720
 			// Reset csv and csv_id if csv
724
-			if ( empty( $csv_id ) || ! $this->is_valid_csv( $csv_id, $csv ) ) {
721
+			if (empty($csv_id) || ! $this->is_valid_csv($csv_id, $csv)) {
725 722
 				$csv_id = $csv = '';
726 723
 			}
727
-			$per_page = isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page;
724
+			$per_page = isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page;
728 725
 
729 726
 			$settings = array(
730 727
 				array(
731 728
 					'id'          => 'csv',
732
-					'name'        => __( 'Choose a CSV file:', 'give' ),
729
+					'name'        => __('Choose a CSV file:', 'give'),
733 730
 					'type'        => 'file',
734
-					'attributes'  => array( 'editing' => 'false', 'library' => 'text' ),
735
-					'description' => __( 'The file must be a Comma Seperated Version (CSV) file type only.', 'give' ),
731
+					'attributes'  => array('editing' => 'false', 'library' => 'text'),
732
+					'description' => __('The file must be a Comma Seperated Version (CSV) file type only.', 'give'),
736 733
 					'fvalue'      => 'url',
737 734
 					'default'     => $csv,
738 735
 				),
@@ -743,61 +740,61 @@  discard block
 block discarded – undo
743 740
 				),
744 741
 				array(
745 742
 					'id'          => 'delimiter',
746
-					'name'        => __( 'CSV Delimiter:', 'give' ),
747
-					'description' => __( 'In case your CSV file supports a different type of separator (or delimiter) -- like a tab or space -- you can set that here.', 'give' ),
743
+					'name'        => __('CSV Delimiter:', 'give'),
744
+					'description' => __('In case your CSV file supports a different type of separator (or delimiter) -- like a tab or space -- you can set that here.', 'give'),
748 745
 					'default'     => $delimiter,
749 746
 					'type'        => 'select',
750 747
 					'options'     => array(
751
-						'csv'                  => esc_html__( 'Comma', 'give' ),
752
-						'tab-separated-values' => esc_html__( 'Tab', 'give' ),
748
+						'csv'                  => esc_html__('Comma', 'give'),
749
+						'tab-separated-values' => esc_html__('Tab', 'give'),
753 750
 					),
754 751
 				),
755 752
 				array(
756 753
 					'id'          => 'mode',
757
-					'name'        => __( 'Test Mode:', 'give' ),
758
-					'description' => __( 'Test mode allows you to preview what this import would look like without making any actual changes to your site or your database.', 'give' ),
754
+					'name'        => __('Test Mode:', 'give'),
755
+					'description' => __('Test mode allows you to preview what this import would look like without making any actual changes to your site or your database.', 'give'),
759 756
 					'default'     => $mode,
760 757
 					'type'        => 'radio_inline',
761 758
 					'options'     => array(
762
-						'enabled'  => __( 'Enabled', 'give' ),
763
-						'disabled' => __( 'Disabled', 'give' ),
759
+						'enabled'  => __('Enabled', 'give'),
760
+						'disabled' => __('Disabled', 'give'),
764 761
 					),
765 762
 				),
766 763
 				array(
767 764
 					'id'          => 'create_user',
768
-					'name'        => __( 'Create WP users for new donors:', 'give' ),
769
-					'description' => __( 'The importer can create WordPress user accounts based on the names and email addresses of the donations in your CSV file. Enable this option if you\'d like the importer to do that.', 'give' ),
765
+					'name'        => __('Create WP users for new donors:', 'give'),
766
+					'description' => __('The importer can create WordPress user accounts based on the names and email addresses of the donations in your CSV file. Enable this option if you\'d like the importer to do that.', 'give'),
770 767
 					'default'     => $create_user,
771 768
 					'type'        => 'radio_inline',
772 769
 					'options'     => array(
773
-						'enabled'  => __( 'Enabled', 'give' ),
774
-						'disabled' => __( 'Disabled', 'give' ),
770
+						'enabled'  => __('Enabled', 'give'),
771
+						'disabled' => __('Disabled', 'give'),
775 772
 					),
776 773
 				),
777 774
 				array(
778 775
 					'id'          => 'delete_csv',
779
-					'name'        => __( 'Delete CSV after import:', 'give' ),
780
-					'description' => __( 'Your CSV file will be uploaded via the WordPress Media Library. It\'s a good idea to delete it after the import is finished so that your sensitive data is not accessible on the web. Disable this only if you plan to delete the file manually later.', 'give' ),
776
+					'name'        => __('Delete CSV after import:', 'give'),
777
+					'description' => __('Your CSV file will be uploaded via the WordPress Media Library. It\'s a good idea to delete it after the import is finished so that your sensitive data is not accessible on the web. Disable this only if you plan to delete the file manually later.', 'give'),
781 778
 					'default'     => $delete_csv,
782 779
 					'type'        => 'radio_inline',
783 780
 					'options'     => array(
784
-						'enabled'  => __( 'Enabled', 'give' ),
785
-						'disabled' => __( 'Disabled', 'give' ),
781
+						'enabled'  => __('Enabled', 'give'),
782
+						'disabled' => __('Disabled', 'give'),
786 783
 					),
787 784
 				),
788 785
 				array(
789 786
 					'id'          => 'per_page',
790
-					'name'        => __( 'Process Rows Per Batch:', 'give' ),
787
+					'name'        => __('Process Rows Per Batch:', 'give'),
791 788
 					'type'        => 'number',
792
-					'description' => __( 'Determine how many rows you would like to import per cycle.', 'give' ),
789
+					'description' => __('Determine how many rows you would like to import per cycle.', 'give'),
793 790
 					'default'     => $per_page,
794 791
 					'class'       => 'give-text-small',
795 792
 				),
796 793
 			);
797 794
 
798
-			$settings = apply_filters( 'give_import_file_upload_html', $settings );
795
+			$settings = apply_filters('give_import_file_upload_html', $settings);
799 796
 
800
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
797
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
801 798
 		}
802 799
 
803 800
 		/**
@@ -810,27 +807,24 @@  discard block
 block discarded – undo
810 807
 			$step = $this->get_step();
811 808
 
812 809
 			// Validation for first step.
813
-			if ( 1 === $step ) {
814
-				$csv_id = absint( $_POST['csv_id'] );
810
+			if (1 === $step) {
811
+				$csv_id = absint($_POST['csv_id']);
815 812
 
816
-				if ( $this->is_valid_csv( $csv_id, esc_url( $_POST['csv'] ) ) ) {
813
+				if ($this->is_valid_csv($csv_id, esc_url($_POST['csv']))) {
817 814
 
818
-					$url = give_import_page_url( (array) apply_filters( 'give_import_step_two_url', array(
815
+					$url = give_import_page_url((array) apply_filters('give_import_step_two_url', array(
819 816
 						'step'          => '2',
820 817
 						'importer-type' => $this->importer_type,
821 818
 						'csv'           => $csv_id,
822
-						'delimiter'     => isset( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv',
823
-						'mode'          => empty( $_POST['mode'] ) ?
824
-							'0' :
825
-							( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? '1' : '0' ),
826
-						'create_user'   => empty( $_POST['create_user'] ) ?
827
-							'0' :
828
-							( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? '1' : '0' ),
829
-						'delete_csv'    => empty( $_POST['delete_csv'] ) ?
830
-							'1' :
831
-							( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? '1' : '0' ),
832
-						'per_page'      => isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page,
833
-					) ) );
819
+						'delimiter'     => isset($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv',
820
+						'mode'          => empty($_POST['mode']) ?
821
+							'0' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? '1' : '0'),
822
+						'create_user'   => empty($_POST['create_user']) ?
823
+							'0' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? '1' : '0'),
824
+						'delete_csv'    => empty($_POST['delete_csv']) ?
825
+							'1' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? '1' : '0'),
826
+						'per_page'      => isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page,
827
+					)));
834 828
 					?>
835 829
 					<script type="text/javascript">
836 830
 						window.location = "<?php echo $url; ?>"
@@ -851,25 +845,25 @@  discard block
 block discarded – undo
851 845
 		 *
852 846
 		 * @return bool $has_error CSV is valid or not.
853 847
 		 */
854
-		private function is_valid_csv( $csv = false, $match_url = '' ) {
848
+		private function is_valid_csv($csv = false, $match_url = '') {
855 849
 			$is_valid_csv = true;
856 850
 
857
-			if ( $csv ) {
858
-				$csv_url = wp_get_attachment_url( $csv );
851
+			if ($csv) {
852
+				$csv_url = wp_get_attachment_url($csv);
859 853
 
860
-				$delimiter = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' );
854
+				$delimiter = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv');
861 855
 
862 856
 				if (
863 857
 					! $csv_url ||
864
-					( ! empty( $match_url ) && ( $csv_url !== $match_url ) ) ||
865
-					( ( $mime_type = get_post_mime_type( $csv ) ) && ! strpos( $mime_type, $delimiter ) )
858
+					( ! empty($match_url) && ($csv_url !== $match_url)) ||
859
+					(($mime_type = get_post_mime_type($csv)) && ! strpos($mime_type, $delimiter))
866 860
 				) {
867 861
 					$is_valid_csv = false;
868
-					Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) );
862
+					Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give'));
869 863
 				}
870 864
 			} else {
871 865
 				$is_valid_csv = false;
872
-				Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) );
866
+				Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give'));
873 867
 			}
874 868
 
875 869
 			return $is_valid_csv;
@@ -885,8 +879,8 @@  discard block
 block discarded – undo
885 879
 		 * @param $field
886 880
 		 * @param $option_value
887 881
 		 */
888
-		public function render_import_field( $field, $option_value ) {
889
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php';
882
+		public function render_import_field($field, $option_value) {
883
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php';
890 884
 		}
891 885
 
892 886
 		/**
@@ -897,8 +891,8 @@  discard block
 block discarded – undo
897 891
 		 */
898 892
 		private function is_donations_import_page() {
899 893
 			return 'import' === give_get_current_setting_tab() &&
900
-			       isset( $_GET['importer-type'] ) &&
901
-			       $this->importer_type === give_clean( $_GET['importer-type'] );
894
+			       isset($_GET['importer-type']) &&
895
+			       $this->importer_type === give_clean($_GET['importer-type']);
902 896
 		}
903 897
 	}
904 898
 
Please login to merge, or discard this patch.
includes/admin/payments/payments-history.php 1 patch
Spacing   +22 added lines, -22 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,12 +25,12 @@  discard block
 block discarded – undo
25 25
 */
26 26
 function give_payment_history_page() {
27 27
 
28
-	$give_payment = get_post_type_object( 'give_payment' );
28
+	$give_payment = get_post_type_object('give_payment');
29 29
 
30
-	if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) {
31
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php';
30
+	if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) {
31
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php';
32 32
 	} else {
33
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php';
33
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php';
34 34
 		$payments_table = new Give_Payment_History_Table();
35 35
 		$payments_table->prepare_items();
36 36
 	?>
@@ -44,18 +44,18 @@  discard block
 block discarded – undo
44 44
 		 *
45 45
 		 * @since 1.7
46 46
 		 */
47
-		do_action( 'give_payments_page_top' );
47
+		do_action('give_payments_page_top');
48 48
 		?>
49 49
 		<hr class="wp-header-end">
50 50
 
51
-		<form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
51
+		<form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
52 52
 			<input type="hidden" name="post_type" value="give_forms" />
53 53
 			<input type="hidden" name="page" value="give-payment-history" />
54 54
 			<?php $payments_table->views() ?>
55 55
 			<?php $payments_table->advanced_filters(); ?>
56 56
 		</form>
57 57
 
58
-		<form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
58
+		<form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
59 59
 			<input type="hidden" name="post_type" value="give_forms" />
60 60
 			<input type="hidden" name="page" value="give-payment-history" />
61 61
 			<?php $payments_table->display() ?>
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		 *
68 68
 		 * @since 1.7
69 69
 		 */
70
-		do_action( 'give_payments_page_bottom' );
70
+		do_action('give_payments_page_bottom');
71 71
 		?>
72 72
 
73 73
 	</div>
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
  * @param $title
85 85
  * @return string
86 86
  */
87
-function give_view_order_details_title( $admin_title, $title ) {
87
+function give_view_order_details_title($admin_title, $title) {
88 88
 
89
-	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) {
89
+	if ('give_forms_page_give-payment-history' != get_current_screen()->base) {
90 90
 		return $admin_title;
91 91
 	}
92 92
 
93
-	if( ! isset( $_GET['give-action'] ) ) {
93
+	if ( ! isset($_GET['give-action'])) {
94 94
 		return $admin_title;
95 95
 	}
96 96
 
97
-	switch( $_GET['give-action'] ) :
97
+	switch ($_GET['give-action']) :
98 98
 
99 99
 		case 'view-payment-details' :
100 100
 			$title = sprintf(
101 101
 				/* translators: %s: admin title */
102
-				esc_html__( 'View Donation Details - %s', 'give' ),
102
+				esc_html__('View Donation Details - %s', 'give'),
103 103
 				$admin_title
104 104
 			);
105 105
 			break;
106 106
 		case 'edit-payment' :
107 107
 			$title = sprintf(
108 108
 				/* translators: %s: admin title */
109
-				esc_html__( 'Edit Donation - %s', 'give' ),
109
+				esc_html__('Edit Donation - %s', 'give'),
110 110
 				$admin_title
111 111
 			);
112 112
 			break;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 	return $title;
119 119
 }
120
-add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 );
120
+add_filter('admin_title', 'give_view_order_details_title', 10, 2);
121 121
 
122 122
 /**
123 123
  * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen.
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
  * @param $context
130 130
  * @return string
131 131
  */
132
-function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) {
132
+function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) {
133 133
 
134
-	$post = get_post( $post_id );
134
+	$post = get_post($post_id);
135 135
 
136
-	if( ! $post ) {
136
+	if ( ! $post) {
137 137
 		return $url;
138 138
 	}
139 139
 
140
-	if( 'give_payment' != $post->post_type ) {
140
+	if ('give_payment' != $post->post_type) {
141 141
 		return $url;
142 142
 	}
143 143
 
144
-	$url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id );
144
+	$url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id);
145 145
 
146 146
 	return $url;
147 147
 }
148
-add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 );
148
+add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3);
Please login to merge, or discard this patch.
includes/admin/add-ons.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 	ob_start(); ?>
27 27
 	<div class="wrap" id="give-add-ons">
28 28
 		<h1><?php echo get_admin_page_title(); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h1>
32 32
 
33 33
 		<hr class="wp-header-end">
34 34
 
35
-		<p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
35
+		<p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
36 36
 		<?php echo give_add_ons_get_feed(); ?>
37 37
 	</div>
38 38
 	<?php
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 function give_add_ons_get_feed() {
51 51
 
52 52
 	$addons_debug = false; //set to true to debug
53
-	$cache        = Give_Cache::get( 'give_add_ons_feed', true );
53
+	$cache        = Give_Cache::get('give_add_ons_feed', true);
54 54
 
55
-	if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) {
56
-		$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
55
+	if ($cache === false || $addons_debug === true && WP_DEBUG === true) {
56
+		$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
57 57
 
58
-		if ( ! is_wp_error( $feed ) ) {
59
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
60
-				$cache = wp_remote_retrieve_body( $feed );
61
-				Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true );
58
+		if ( ! is_wp_error($feed)) {
59
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
60
+				$cache = wp_remote_retrieve_body($feed);
61
+				Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true);
62 62
 			}
63 63
 		} else {
64 64
 			$cache = sprintf(
65 65
 				'<div class="error"><p>%s</p></div>',
66
-				esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' )
66
+				esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give')
67 67
 			);
68 68
 		}
69 69
 	}
Please login to merge, or discard this patch.
includes/price-functions.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array|bool Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @return array Variable prices
67 67
  */
68
-function give_get_variable_price_ids( $form_id = 0 ) {
69
-	if( ! ( $prices = give_get_variable_prices( $form_id ) ) ) {
68
+function give_get_variable_price_ids($form_id = 0) {
69
+	if ( ! ($prices = give_get_variable_prices($form_id))) {
70 70
 		return array();
71 71
 	}
72 72
 
73 73
 	$price_ids = array();
74
-	foreach ( $prices as $price ){
74
+	foreach ($prices as $price) {
75 75
 		$price_ids[] = $price['_give_id']['level_id'];
76 76
 	}
77 77
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
  *
90 90
  * @return string $default_price
91 91
  */
92
-function give_get_default_multilevel_amount( $form_id ) {
92
+function give_get_default_multilevel_amount($form_id) {
93 93
 	$default_price = '1.00';
94
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
94
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
95 95
 
96
-	foreach ( $prices as $price ) {
96
+	foreach ($prices as $price) {
97 97
 
98
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
98
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
99 99
 			$default_price = $price['_give_amount'];
100 100
 		}
101 101
 
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
  * @return string $default_price
117 117
  * @since      1.0
118 118
  */
119
-function give_get_default_form_amount( $form_id ) {
119
+function give_get_default_form_amount($form_id) {
120 120
 
121
-	if ( give_has_variable_prices( $form_id ) ) {
121
+	if (give_has_variable_prices($form_id)) {
122 122
 
123
-		$default_amount = give_get_default_multilevel_amount( $form_id );
123
+		$default_amount = give_get_default_multilevel_amount($form_id);
124 124
 
125 125
 	} else {
126 126
 
127
-		$default_amount = give_get_meta( $form_id, '_give_set_price', true );
127
+		$default_amount = give_get_meta($form_id, '_give_set_price', true);
128 128
 
129 129
 	}
130 130
 
131
-	return apply_filters( 'give_default_form_amount', $default_amount, $form_id );
131
+	return apply_filters('give_default_form_amount', $default_amount, $form_id);
132 132
 
133 133
 }
134 134
 
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @return bool
148 148
  */
149
-function give_is_custom_price_mode( $form_id = 0 ) {
149
+function give_is_custom_price_mode($form_id = 0) {
150 150
 
151
-	if ( empty( $form_id ) ) {
151
+	if (empty($form_id)) {
152 152
 		return false;
153 153
 	}
154 154
 
155
-	$form = new Give_Donate_Form( $form_id );
155
+	$form = new Give_Donate_Form($form_id);
156 156
 
157 157
 	return $form->is_custom_price_mode();
158 158
 }
159 159
\ No newline at end of file
Please login to merge, or discard this patch.
includes/forms/template.php 4 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1020,9 +1020,12 @@
 block discarded – undo
1020 1020
 				    }
1021 1021
 				    ?>
1022 1022
 			    </select>
1023
-		    <?php else : ?>
1023
+		    <?php else {
1024
+	: ?>
1024 1025
 			    <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1025
-			           placeholder="<?php echo $label; ?>" value="<?php echo $selected_state; ?>"/>
1026
+			           placeholder="<?php echo $label;
1027
+}
1028
+?>" value="<?php echo $selected_state; ?>"/>
1026 1029
 		    <?php endif; ?>
1027 1030
 	    </p>
1028 1031
 
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @since 1.0
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
 
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
  *
1444 1444
  * @param  int $form_id The form ID.
1445 1445
  *
1446
- * @return bool
1446
+ * @return false|null
1447 1447
  */
1448 1448
 function give_terms_agreement( $form_id ) {
1449 1449
 	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
  * @param  int   $form_id The form ID.
1622 1622
  * @param  array $args    An array of form arguments.
1623 1623
  *
1624
- * @return mixed
1624
+ * @return boolean
1625 1625
  */
1626 1626
 function give_show_goal_progress( $form_id, $args ) {
1627 1627
 
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
  *
1647 1647
  * @since  1.8
1648 1648
  *
1649
- * @param  $form_id
1649
+ * @param  integer $form_id
1650 1650
  * @param  $args
1651 1651
  *
1652 1652
  * @return mixed|string
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
  * @param  int   $form_id The form ID.
1688 1688
  * @param  array $args    An array of form arguments.
1689 1689
  *
1690
- * @return void|bool
1690
+ * @return false|null
1691 1691
  */
1692 1692
 function give_form_content( $form_id, $args ) {
1693 1693
 
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -928,10 +928,10 @@  discard block
 block discarded – undo
928 928
 			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
929 929
 		    >
930 930
 			    <?php
931
-			    foreach ( $countries as $country_code => $country ) {
932
-				    echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
933
-			    }
934
-			    ?>
931
+				foreach ( $countries as $country_code => $country ) {
932
+					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
933
+				}
934
+				?>
935 935
 		    </select>
936 936
 	    </p>
937 937
 
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 		    <label for="card_state" class="give-label">
1001 1001
 			    <span class="state-label-text"><?php echo $label; ?></span>
1002 1002
 			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1003
-				    ?>
1003
+					?>
1004 1004
 				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
1005 1005
 			    <?php endif; ?>
1006 1006
 			    <span class="give-tooltip give-icon give-icon-question"
@@ -1008,17 +1008,17 @@  discard block
 block discarded – undo
1008 1008
 		    </label>
1009 1009
 		    <?php
1010 1010
 
1011
-		    if ( ! empty( $states ) ) : ?>
1011
+			if ( ! empty( $states ) ) : ?>
1012 1012
 			    <select
1013 1013
 					    name="card_state"
1014 1014
 					    id="card_state"
1015 1015
 					    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1016 1016
 				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1017 1017
 				    <?php
1018
-				    foreach ( $states as $state_code => $state ) {
1019
-					    echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1020
-				    }
1021
-				    ?>
1018
+					foreach ( $states as $state_code => $state ) {
1019
+						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1020
+					}
1021
+					?>
1022 1022
 			    </select>
1023 1023
 		    <?php else : ?>
1024 1024
 			    <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
Please login to merge, or discard this patch.
Spacing   +401 added lines, -402 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,50 +23,50 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id,
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID.
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts.
58 58
 	if (
59
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
60
-		|| ( 'trash' === $form->post_status )
59
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
60
+		|| ('trash' === $form->post_status)
61 61
 	) {
62 62
 		return false;
63 63
 	}
64 64
 
65 65
 	//Get the form wrap CSS classes.
66
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
66
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
67 67
 
68 68
 	//Get the <form> tag wrap CSS classes.
69
-	$form_classes = $form->get_form_classes( $args );
69
+	$form_classes = $form->get_form_classes($args);
70 70
 
71 71
 	ob_start();
72 72
 
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 * @param int   $form_id The form ID.
79 79
 	 * @param array $args    An array of form arguments.
80 80
 	 */
81
-	do_action( 'give_pre_form_output', $form->ID, $args, $form );
81
+	do_action('give_pre_form_output', $form->ID, $args, $form);
82 82
 
83 83
 	?>
84 84
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
85 85
 
86
-		<?php if ( $form->is_close_donation_form() ) {
86
+		<?php if ($form->is_close_donation_form()) {
87 87
 
88 88
 			// Get Goal thank you message.
89
-			$goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
90
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : '';
89
+			$goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
90
+			$goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : '';
91 91
 
92 92
 			// Print thank you message.
93
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form );
93
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form);
94 94
 
95 95
 		} else {
96 96
 			/**
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 			 * 1. if show_title params set to true
99 99
 			 * 2. if admin set form display_style to button
100 100
 			 */
101
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
101
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
102 102
 			if (
103 103
 				(
104
-					( isset( $args['show_title'] ) && $args['show_title'] == true )
105
-					|| ( 'button' === get_post_meta( $form_id, '_give_payment_display', true ) )
104
+					(isset($args['show_title']) && $args['show_title'] == true)
105
+					|| ('button' === get_post_meta($form_id, '_give_payment_display', true))
106 106
 				)
107
-				&& ! doing_action( 'give_single_form_summary' )
107
+				&& ! doing_action('give_single_form_summary')
108 108
 			) {
109 109
 				echo $form_title;
110 110
 			}
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 			 * @param array            $args    An array of form arguments.
119 119
 			 * @param Give_Donate_Form $form    Form object.
120 120
 			 */
121
-			do_action( 'give_pre_form', $form->ID, $args, $form );
121
+			do_action('give_pre_form', $form->ID, $args, $form);
122 122
 
123 123
 			// Set form html tags.
124 124
 			$form_html_tags = array(
125 125
 				'id'     => "give-form-{$form_id}",
126 126
 				'class'  => $form_classes,
127
-				'action' => esc_url_raw( $form_action ),
127
+				'action' => esc_url_raw($form_action),
128 128
 			);
129 129
 
130 130
 			/**
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 			 * @param array            $form_html_tags Array of form html tags.
136 136
 			 * @param Give_Donate_Form $form           Form object.
137 137
 			 */
138
-			$form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form );
138
+			$form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form);
139 139
 			?>
140
-			<form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post">
140
+			<form <?php echo give_get_attribute_str($form_html_tags); ?> method="post">
141 141
 
142 142
 				<!-- The following field is for robots only, invisible to humans: -->
143 143
 				<span class="give-hidden" style="display: none !important;">
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 				 * @param array            $args    An array of form arguments.
157 157
 				 * @param Give_Donate_Form $form    Form object.
158 158
 				 */
159
-				do_action( 'give_donation_form_top', $form->ID, $args, $form );
159
+				do_action('give_donation_form_top', $form->ID, $args, $form);
160 160
 
161 161
 				/**
162 162
 				 * Fires while outputting donation form, for payment gateway fields.
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 				 * @param array            $args    An array of form arguments.
168 168
 				 * @param Give_Donate_Form $form    Form object.
169 169
 				 */
170
-				do_action( 'give_payment_mode_select', $form->ID, $args, $form );
170
+				do_action('give_payment_mode_select', $form->ID, $args, $form);
171 171
 
172 172
 				/**
173 173
 				 * Fires while outputting donation form, after all other fields.
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 				 * @param array            $args    An array of form arguments.
179 179
 				 * @param Give_Donate_Form $form    Form object.
180 180
 				 */
181
-				do_action( 'give_donation_form_bottom', $form->ID, $args, $form );
181
+				do_action('give_donation_form_bottom', $form->ID, $args, $form);
182 182
 
183 183
 				?>
184 184
 			</form>
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 			 * @param array            $args    An array of form arguments.
194 194
 			 * @param Give_Donate_Form $form    Form object.
195 195
 			 */
196
-			do_action( 'give_post_form', $form->ID, $args, $form );
196
+			do_action('give_post_form', $form->ID, $args, $form);
197 197
 
198 198
 		}
199 199
 		?>
200 200
 
201
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
201
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
202 202
 	<?php
203 203
 
204 204
 	/**
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 	 * @param int   $form_id The form ID.
210 210
 	 * @param array $args    An array of form arguments.
211 211
 	 */
212
-	do_action( 'give_post_form_output', $form->ID, $args );
212
+	do_action('give_post_form_output', $form->ID, $args);
213 213
 
214 214
 	$final_output = ob_get_clean();
215 215
 
216
-	echo apply_filters( 'give_donate_form', $final_output, $args );
216
+	echo apply_filters('give_donate_form', $final_output, $args);
217 217
 }
218 218
 
219 219
 /**
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
  *
231 231
  * @return string
232 232
  */
233
-function give_show_purchase_form( $form_id ) {
233
+function give_show_purchase_form($form_id) {
234 234
 
235
-	$payment_mode = give_get_chosen_gateway( $form_id );
235
+	$payment_mode = give_get_chosen_gateway($form_id);
236 236
 
237
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
237
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
238 238
 		$form_id = $_POST['give_form_id'];
239 239
 	}
240 240
 
@@ -243,33 +243,33 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @since 1.7
245 245
 	 */
246
-	do_action( 'give_payment_fields_top', $form_id );
246
+	do_action('give_payment_fields_top', $form_id);
247 247
 
248
-	if ( give_can_checkout() && isset( $form_id ) ) {
248
+	if (give_can_checkout() && isset($form_id)) {
249 249
 
250 250
 		/**
251 251
 		 * Fires while displaying donation form, before registration login.
252 252
 		 *
253 253
 		 * @since 1.7
254 254
 		 */
255
-		do_action( 'give_donation_form_before_register_login', $form_id );
255
+		do_action('give_donation_form_before_register_login', $form_id);
256 256
 
257 257
 		/**
258 258
 		 * Fire when register/login form fields render.
259 259
 		 *
260 260
 		 * @since 1.7
261 261
 		 */
262
-		do_action( 'give_donation_form_register_login_fields', $form_id );
262
+		do_action('give_donation_form_register_login_fields', $form_id);
263 263
 
264 264
 		/**
265 265
 		 * Fire when credit card form fields render.
266 266
 		 *
267 267
 		 * @since 1.7
268 268
 		 */
269
-		do_action( 'give_donation_form_before_cc_form', $form_id );
269
+		do_action('give_donation_form_before_cc_form', $form_id);
270 270
 
271 271
 		// Load the credit card form and allow gateways to load their own if they wish.
272
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
272
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
273 273
 			/**
274 274
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
275 275
 			 *
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			 *
278 278
 			 * @param int $form_id The form ID.
279 279
 			 */
280
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
280
+			do_action("give_{$payment_mode}_cc_form", $form_id);
281 281
 		} else {
282 282
 			/**
283 283
 			 * Fires while displaying donation form, credit card form fields.
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			 *
287 287
 			 * @param int $form_id The form ID.
288 288
 			 */
289
-			do_action( 'give_cc_form', $form_id );
289
+			do_action('give_cc_form', $form_id);
290 290
 		}
291 291
 
292 292
 		/**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		 *
295 295
 		 * @since 1.7
296 296
 		 */
297
-		do_action( 'give_donation_form_after_cc_form', $form_id );
297
+		do_action('give_donation_form_after_cc_form', $form_id);
298 298
 
299 299
 	} else {
300 300
 		/**
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		 *
303 303
 		 * @since 1.7
304 304
 		 */
305
-		do_action( 'give_donation_form_no_access', $form_id );
305
+		do_action('give_donation_form_no_access', $form_id);
306 306
 
307 307
 	}
308 308
 
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @since 1.7
313 313
 	 */
314
-	do_action( 'give_payment_fields_bottom', $form_id );
314
+	do_action('give_payment_fields_bottom', $form_id);
315 315
 }
316 316
 
317
-add_action( 'give_donation_form', 'give_show_purchase_form' );
317
+add_action('give_donation_form', 'give_show_purchase_form');
318 318
 
319 319
 /**
320 320
  * Give Show Login/Register Form Fields.
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
  *
326 326
  * @return void
327 327
  */
328
-function give_show_register_login_fields( $form_id ) {
328
+function give_show_register_login_fields($form_id) {
329 329
 
330
-	$show_register_form = give_show_login_register_option( $form_id );
330
+	$show_register_form = give_show_login_register_option($form_id);
331 331
 
332
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
332
+	if (($show_register_form === 'registration' || ($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,11 +338,11 @@  discard block
 block discarded – undo
338 338
 			 *
339 339
 			 * @since 1.7
340 340
 			 */
341
-			do_action( 'give_donation_form_register_fields', $form_id );
341
+			do_action('give_donation_form_register_fields', $form_id);
342 342
 			?>
343 343
 		</div>
344 344
 		<?php
345
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
345
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
346 346
 		?>
347 347
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
348 348
 			<?php
@@ -351,23 +351,23 @@  discard block
 block discarded – undo
351 351
 			 *
352 352
 			 * @since 1.7
353 353
 			 */
354
-			do_action( 'give_donation_form_login_fields', $form_id );
354
+			do_action('give_donation_form_login_fields', $form_id);
355 355
 			?>
356 356
 		</div>
357 357
 		<?php
358 358
 	endif;
359 359
 
360
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
360
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
361 361
 		/**
362 362
 		 * Fire when user info render.
363 363
 		 *
364 364
 		 * @since 1.7
365 365
 		 */
366
-		do_action( 'give_donation_form_after_user_info', $form_id );
366
+		do_action('give_donation_form_after_user_info', $form_id);
367 367
 	}
368 368
 }
369 369
 
370
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
370
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
371 371
 
372 372
 /**
373 373
  * Donation Amount Field.
@@ -382,16 +382,16 @@  discard block
 block discarded – undo
382 382
  *
383 383
  * @return void
384 384
  */
385
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
385
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
386 386
 
387 387
 	$give_options        = give_get_settings();
388
-	$variable_pricing    = give_has_variable_prices( $form_id );
389
-	$allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
390
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
391
-	$symbol              = give_currency_symbol( give_get_currency( $form_id, $args ) );
392
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
393
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false, 'currency' => give_get_currency( $form_id ) ) );
394
-	$custom_amount_text  = give_get_meta( $form_id, '_give_custom_amount_text', true );
388
+	$variable_pricing    = give_has_variable_prices($form_id);
389
+	$allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
390
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
391
+	$symbol              = give_currency_symbol(give_get_currency($form_id, $args));
392
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
393
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false, 'currency' => give_get_currency($form_id)));
394
+	$custom_amount_text  = give_get_meta($form_id, '_give_custom_amount_text', true);
395 395
 
396 396
 	/**
397 397
 	 * Fires while displaying donation form, before donation level fields.
@@ -401,20 +401,20 @@  discard block
 block discarded – undo
401 401
 	 * @param int   $form_id The form ID.
402 402
 	 * @param array $args    An array of form arguments.
403 403
 	 */
404
-	do_action( 'give_before_donation_levels', $form_id, $args );
404
+	do_action('give_before_donation_levels', $form_id, $args);
405 405
 
406 406
 	//Set Price, No Custom Amount Allowed means hidden price field
407
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
407
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
408 408
 		?>
409
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
409
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
410 410
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
411 411
 			   value="<?php echo $default_amount; ?>" required aria-required="true"/>
412 412
 		<div class="set-price give-donation-amount form-row-wide">
413
-			<?php if ( $currency_position == 'before' ) {
413
+			<?php if ($currency_position == 'before') {
414 414
 				echo $currency_output;
415 415
 			} ?>
416 416
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
417
-			<?php if ( $currency_position == 'after' ) {
417
+			<?php if ($currency_position == 'after') {
418 418
 				echo $currency_output;
419 419
 			} ?>
420 420
 		</div>
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
 		?>
425 425
 		<div class="give-total-wrap">
426 426
 			<div class="give-donation-amount form-row-wide">
427
-				<?php if ( $currency_position == 'before' ) {
427
+				<?php if ($currency_position == 'before') {
428 428
 					echo $currency_output;
429 429
 				} ?>
430
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
430
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
431 431
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
432 432
 					   placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
433
-				<?php if ( $currency_position == 'after' ) {
433
+				<?php if ($currency_position == 'after') {
434 434
 					echo $currency_output;
435 435
 				} ?>
436 436
 			</div>
@@ -445,16 +445,16 @@  discard block
 block discarded – undo
445 445
 	 * @param int   $form_id The form ID.
446 446
 	 * @param array $args    An array of form arguments.
447 447
 	 */
448
-	do_action( 'give_after_donation_amount', $form_id, $args );
448
+	do_action('give_after_donation_amount', $form_id, $args);
449 449
 
450 450
 	//Custom Amount Text
451
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?>
451
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?>
452 452
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
453 453
 	<?php }
454 454
 
455 455
 	//Output Variable Pricing Levels.
456
-	if ( $variable_pricing ) {
457
-		give_output_levels( $form_id );
456
+	if ($variable_pricing) {
457
+		give_output_levels($form_id);
458 458
 	}
459 459
 
460 460
 	/**
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
 	 * @param int   $form_id The form ID.
466 466
 	 * @param array $args    An array of form arguments.
467 467
 	 */
468
-	do_action( 'give_after_donation_levels', $form_id, $args );
468
+	do_action('give_after_donation_levels', $form_id, $args);
469 469
 }
470 470
 
471
-add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 );
471
+add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2);
472 472
 
473 473
 /**
474 474
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -479,30 +479,30 @@  discard block
 block discarded – undo
479 479
  *
480 480
  * @return string Donation levels.
481 481
  */
482
-function give_output_levels( $form_id ) {
482
+function give_output_levels($form_id) {
483 483
 
484 484
 	//Get variable pricing.
485
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
486
-	$display_style      = give_get_meta( $form_id, '_give_display_style', true );
487
-	$custom_amount      = give_get_meta( $form_id, '_give_custom_amount', true );
488
-	$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
489
-	if ( empty( $custom_amount_text ) ) {
490
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
485
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
486
+	$display_style      = give_get_meta($form_id, '_give_display_style', true);
487
+	$custom_amount      = give_get_meta($form_id, '_give_custom_amount', true);
488
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
489
+	if (empty($custom_amount_text)) {
490
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
491 491
 	}
492 492
 
493 493
 	$output = '';
494 494
 
495
-	switch ( $display_style ) {
495
+	switch ($display_style) {
496 496
 		case 'buttons':
497 497
 
498 498
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
499 499
 
500
-			foreach ( $prices as $price ) {
501
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
502
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
500
+			foreach ($prices as $price) {
501
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
502
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
503 503
 
504 504
 				$output .= '<li>';
505
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
505
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
506 506
 				$output .= $level_text;
507 507
 				$output .= '</button>';
508 508
 				$output .= '</li>';
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 			}
511 511
 
512 512
 			//Custom Amount.
513
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
513
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
514 514
 				$output .= '<li>';
515 515
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
516 516
 				$output .= $custom_amount_text;
@@ -526,22 +526,22 @@  discard block
 block discarded – undo
526 526
 
527 527
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
528 528
 
529
-			foreach ( $prices as $price ) {
530
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
531
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
529
+			foreach ($prices as $price) {
530
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
531
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
532 532
 
533 533
 				$output .= '<li>';
534
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
535
-				$output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>';
534
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
535
+				$output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>';
536 536
 				$output .= '</li>';
537 537
 
538 538
 			}
539 539
 
540 540
 			//Custom Amount.
541
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
541
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
542 542
 				$output .= '<li>';
543 543
 				$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">';
544
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
544
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
545 545
 				$output .= '</li>';
546 546
 			}
547 547
 
@@ -551,23 +551,23 @@  discard block
 block discarded – undo
551 551
 
552 552
 		case 'dropdown':
553 553
 
554
-			$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
555
-			$output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
554
+			$output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
555
+			$output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
556 556
 
557 557
 			//first loop through prices.
558
-			foreach ( $prices as $price ) {
559
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
560
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
558
+			foreach ($prices as $price) {
559
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
560
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
561 561
 
562
-				$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'], array( 'sanitize' => false ) ) . '">';
562
+				$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'], array('sanitize' => false)).'">';
563 563
 				$output .= $level_text;
564 564
 				$output .= '</option>';
565 565
 
566 566
 			}
567 567
 
568 568
 			//Custom Amount.
569
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
570
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
569
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
570
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
571 571
 			}
572 572
 
573 573
 			$output .= '</select>';
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 			break;
576 576
 	}
577 577
 
578
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
578
+	echo apply_filters('give_form_level_output', $output, $form_id);
579 579
 }
580 580
 
581 581
 /**
@@ -590,27 +590,27 @@  discard block
 block discarded – undo
590 590
  *
591 591
  * @return string Checkout button.
592 592
  */
593
-function give_display_checkout_button( $form_id, $args ) {
593
+function give_display_checkout_button($form_id, $args) {
594 594
 
595
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
595
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
596 596
 		? $args['display_style']
597
-		: give_get_meta( $form_id, '_give_payment_display', true );
597
+		: give_get_meta($form_id, '_give_payment_display', true);
598 598
 
599
-	if ( 'button' === $display_option ) {
599
+	if ('button' === $display_option) {
600 600
 		$display_option = 'modal';
601
-	} elseif ( $display_option === 'onpage' ) {
601
+	} elseif ($display_option === 'onpage') {
602 602
 		return '';
603 603
 	}
604 604
 
605
-	$display_label_field = give_get_meta( $form_id, '_give_reveal_label', true );
606
-	$display_label       = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
605
+	$display_label_field = give_get_meta($form_id, '_give_reveal_label', true);
606
+	$display_label       = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
607 607
 
608
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
608
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
609 609
 
610
-	echo apply_filters( 'give_display_checkout_button', $output );
610
+	echo apply_filters('give_display_checkout_button', $output);
611 611
 }
612 612
 
613
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
613
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
614 614
 
615 615
 /**
616 616
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -623,55 +623,55 @@  discard block
 block discarded – undo
623 623
  *
624 624
  * @return void
625 625
  */
626
-function give_user_info_fields( $form_id ) {
626
+function give_user_info_fields($form_id) {
627 627
 	// Get user info.
628
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
628
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
629 629
 
630 630
 	/**
631 631
 	 * Fire before user personal information fields
632 632
 	 *
633 633
 	 * @since 1.7
634 634
 	 */
635
-	do_action( 'give_donation_form_before_personal_info', $form_id );
635
+	do_action('give_donation_form_before_personal_info', $form_id);
636 636
 	?>
637 637
 	<fieldset id="give_checkout_user_info">
638
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
638
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
639 639
 		<p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
640 640
 			<label class="give-label" for="give-first">
641
-				<?php _e( 'First Name', 'give' ); ?>
642
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
641
+				<?php _e('First Name', 'give'); ?>
642
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
643 643
 					<span class="give-required-indicator">*</span>
644 644
 				<?php endif ?>
645
-				<?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?>
645
+				<?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?>
646 646
 			</label>
647 647
 			<input
648 648
 					class="give-input required"
649 649
 					type="text"
650 650
 					name="give_first"
651
-					placeholder="<?php _e( 'First Name', 'give' ); ?>"
651
+					placeholder="<?php _e('First Name', 'give'); ?>"
652 652
 					id="give-first"
653
-					value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
654
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
653
+					value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
654
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
655 655
 			/>
656 656
 		</p>
657 657
 
658 658
 		<p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
659 659
 			<label class="give-label" for="give-last">
660
-				<?php _e( 'Last Name', 'give' ); ?>
661
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
660
+				<?php _e('Last Name', 'give'); ?>
661
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
662 662
 					<span class="give-required-indicator">*</span>
663 663
 				<?php endif ?>
664
-				<?php echo Give()->tooltips->render_help( __( 'We will use this as well to personalize your account experience.', 'give' ) ); ?>
664
+				<?php echo Give()->tooltips->render_help(__('We will use this as well to personalize your account experience.', 'give')); ?>
665 665
 			</label>
666 666
 
667 667
 			<input
668
-					class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
668
+					class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
669 669
 					type="text"
670 670
 					name="give_last"
671 671
 					id="give-last"
672
-					placeholder="<?php _e( 'Last Name', 'give' ); ?>"
673
-					value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
674
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
672
+					placeholder="<?php _e('Last Name', 'give'); ?>"
673
+					value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
674
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
675 675
 			/>
676 676
 		</p>
677 677
 
@@ -681,25 +681,25 @@  discard block
 block discarded – undo
681 681
 		 *
682 682
 		 * @since 1.7
683 683
 		 */
684
-		do_action( 'give_donation_form_before_email', $form_id );
684
+		do_action('give_donation_form_before_email', $form_id);
685 685
 		?>
686 686
 		<p id="give-email-wrap" class="form-row form-row-wide">
687 687
 			<label class="give-label" for="give-email">
688
-				<?php _e( 'Email Address', 'give' ); ?>
689
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
688
+				<?php _e('Email Address', 'give'); ?>
689
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
690 690
 					<span class="give-required-indicator">*</span>
691 691
 				<?php } ?>
692
-				<?php echo Give()->tooltips->render_help( __( 'We will send the donation receipt to this address.', 'give' ) ); ?>
692
+				<?php echo Give()->tooltips->render_help(__('We will send the donation receipt to this address.', 'give')); ?>
693 693
 			</label>
694 694
 
695 695
 			<input
696 696
 					class="give-input required"
697 697
 					type="email"
698 698
 					name="give_email"
699
-					placeholder="<?php _e( 'Email Address', 'give' ); ?>"
699
+					placeholder="<?php _e('Email Address', 'give'); ?>"
700 700
 					id="give-email"
701
-					value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
702
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
701
+					value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
702
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
703 703
 			/>
704 704
 
705 705
 		</p>
@@ -709,14 +709,14 @@  discard block
 block discarded – undo
709 709
 		 *
710 710
 		 * @since 1.7
711 711
 		 */
712
-		do_action( 'give_donation_form_after_email', $form_id );
712
+		do_action('give_donation_form_after_email', $form_id);
713 713
 
714 714
 		/**
715 715
 		 * Fire after personal email field
716 716
 		 *
717 717
 		 * @since 1.7
718 718
 		 */
719
-		do_action( 'give_donation_form_user_info', $form_id );
719
+		do_action('give_donation_form_user_info', $form_id);
720 720
 		?>
721 721
 	</fieldset>
722 722
 	<?php
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 	 *
726 726
 	 * @since 1.7
727 727
 	 */
728
-	do_action( 'give_donation_form_after_personal_info', $form_id );
728
+	do_action('give_donation_form_after_personal_info', $form_id);
729 729
 }
730 730
 
731
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
732
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
731
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
732
+add_action('give_register_fields_before', 'give_user_info_fields');
733 733
 
734 734
 /**
735 735
  * Renders the credit card info form.
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
  *
741 741
  * @return void
742 742
  */
743
-function give_get_cc_form( $form_id ) {
743
+function give_get_cc_form($form_id) {
744 744
 
745 745
 	ob_start();
746 746
 
@@ -751,50 +751,50 @@  discard block
 block discarded – undo
751 751
 	 *
752 752
 	 * @param int $form_id The form ID.
753 753
 	 */
754
-	do_action( 'give_before_cc_fields', $form_id );
754
+	do_action('give_before_cc_fields', $form_id);
755 755
 	?>
756 756
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
757
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
758
-		<?php if ( is_ssl() ) : ?>
757
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
758
+		<?php if (is_ssl()) : ?>
759 759
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
760 760
 				<span class="give-icon padlock"></span>
761
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
761
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
762 762
 			</div>
763 763
 		<?php endif; ?>
764 764
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
765 765
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
766
-				<?php _e( 'Card Number', 'give' ); ?>
766
+				<?php _e('Card Number', 'give'); ?>
767 767
 				<span class="give-required-indicator">*</span>
768
-				<?php echo Give()->tooltips->render_help( __( 'The (typically) 16 digits on the front of your credit card.', 'give' ) ); ?>
768
+				<?php echo Give()->tooltips->render_help(__('The (typically) 16 digits on the front of your credit card.', 'give')); ?>
769 769
 				<span class="card-type"></span>
770 770
 			</label>
771 771
 
772 772
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
773
-				   class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>"
773
+				   class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>"
774 774
 				   required aria-required="true"/>
775 775
 		</p>
776 776
 
777 777
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive">
778 778
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
779
-				<?php _e( 'CVC', 'give' ); ?>
779
+				<?php _e('CVC', 'give'); ?>
780 780
 				<span class="give-required-indicator">*</span>
781
-				<?php echo Give()->tooltips->render_help( __( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ) ); ?>
781
+				<?php echo Give()->tooltips->render_help(__('The 3 digit (back) or 4 digit (front) value on your card.', 'give')); ?>
782 782
 			</label>
783 783
 
784 784
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
785
-				   class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>"
785
+				   class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>"
786 786
 				   required aria-required="true"/>
787 787
 		</p>
788 788
 
789 789
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
790 790
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
791
-				<?php _e( 'Name on the Card', 'give' ); ?>
791
+				<?php _e('Name on the Card', 'give'); ?>
792 792
 				<span class="give-required-indicator">*</span>
793
-				<?php echo Give()->tooltips->render_help( __( 'The name printed on the front of your credit card.', 'give' ) ); ?>
793
+				<?php echo Give()->tooltips->render_help(__('The name printed on the front of your credit card.', 'give')); ?>
794 794
 			</label>
795 795
 
796 796
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
797
-				   class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
797
+				   class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
798 798
 				   required aria-required="true"/>
799 799
 		</p>
800 800
 		<?php
@@ -805,19 +805,19 @@  discard block
 block discarded – undo
805 805
 		 *
806 806
 		 * @param int $form_id The form ID.
807 807
 		 */
808
-		do_action( 'give_before_cc_expiration' );
808
+		do_action('give_before_cc_expiration');
809 809
 		?>
810 810
 		<p class="card-expiration form-row form-row-one-third form-row-responsive">
811 811
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
812
-				<?php _e( 'Expiration', 'give' ); ?>
812
+				<?php _e('Expiration', 'give'); ?>
813 813
 				<span class="give-required-indicator">*</span>
814
-				<?php echo Give()->tooltips->render_help( __( 'The date your credit card expires, typically on the front of the card.', 'give' ) ); ?>
814
+				<?php echo Give()->tooltips->render_help(__('The date your credit card expires, typically on the front of the card.', 'give')); ?>
815 815
 			</label>
816 816
 
817 817
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
818 818
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
819 819
 
820
-			<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 aria-required="true"/>
820
+			<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 aria-required="true"/>
821 821
 		</p>
822 822
 		<?php
823 823
 		/**
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 		 *
828 828
 		 * @param int $form_id The form ID.
829 829
 		 */
830
-		do_action( 'give_after_cc_expiration', $form_id );
830
+		do_action('give_after_cc_expiration', $form_id);
831 831
 		?>
832 832
 	</fieldset>
833 833
 	<?php
@@ -838,12 +838,12 @@  discard block
 block discarded – undo
838 838
 	 *
839 839
 	 * @param int $form_id The form ID.
840 840
 	 */
841
-	do_action( 'give_after_cc_fields', $form_id );
841
+	do_action('give_after_cc_fields', $form_id);
842 842
 
843 843
 	echo ob_get_clean();
844 844
 }
845 845
 
846
-add_action( 'give_cc_form', 'give_get_cc_form' );
846
+add_action('give_cc_form', 'give_get_cc_form');
847 847
 
848 848
 /**
849 849
  * Outputs the default credit card address fields.
@@ -854,20 +854,20 @@  discard block
 block discarded – undo
854 854
  *
855 855
  * @return void
856 856
  */
857
-function give_default_cc_address_fields( $form_id ) {
857
+function give_default_cc_address_fields($form_id) {
858 858
 	// Get user info.
859
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
859
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
860 860
 
861 861
 	$logged_in = is_user_logged_in();
862 862
 
863
-	if ( $logged_in ) {
864
-		$user_address = give_get_donor_address( get_current_user_id() );
863
+	if ($logged_in) {
864
+		$user_address = give_get_donor_address(get_current_user_id());
865 865
 	}
866 866
 
867 867
 	ob_start();
868 868
 	?>
869 869
 	<fieldset id="give_cc_address" class="cc-address">
870
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
870
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
871 871
 		<?php
872 872
 		/**
873 873
 		 * Fires while rendering credit card billing form, before address fields.
@@ -876,36 +876,36 @@  discard block
 block discarded – undo
876 876
 		 *
877 877
 		 * @param int $form_id The form ID.
878 878
 		 */
879
-		do_action( 'give_cc_billing_top' );
879
+		do_action('give_cc_billing_top');
880 880
 
881 881
 		// For Country.
882 882
 		$selected_country = give_get_country();
883
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
883
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
884 884
 			$selected_country = $give_user_info['billing_country'];
885 885
 		}
886 886
 		$countries = give_get_country_list();
887 887
 
888 888
 		// For state
889 889
 		$selected_state = '';
890
-		if ( $selected_country === give_get_country() ) {
890
+		if ($selected_country === give_get_country()) {
891 891
 			// Get defalut selected state by admin.
892 892
 			$selected_state = give_get_state();
893 893
 		}
894 894
 		// Get the last payment made by user states.
895
-		if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) {
895
+		if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) {
896 896
 			$selected_state = $give_user_info['card_state'];
897 897
 		}
898 898
 		// Get the country code
899
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
899
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
900 900
 			$selected_country = $give_user_info['billing_country'];
901 901
 		}
902
-		$label        = __( 'State', 'give' );
902
+		$label        = __('State', 'give');
903 903
 		$states_label = give_get_states_label();
904 904
 		// Check if $country code exists in the array key for states label.
905
-		if ( array_key_exists( $selected_country, $states_label ) ) {
906
-			$label = $states_label[ $selected_country ];
905
+		if (array_key_exists($selected_country, $states_label)) {
906
+			$label = $states_label[$selected_country];
907 907
 		}
908
-		$states = give_get_states( $selected_country );
908
+		$states = give_get_states($selected_country);
909 909
 		// Get the country list that do not have any states init.
910 910
 		$no_states_country = give_no_states_country_list();
911 911
 		// Get the country list that does not require states.
@@ -913,23 +913,23 @@  discard block
 block discarded – undo
913 913
 		?>
914 914
 	    <p id="give-card-country-wrap" class="form-row form-row-wide">
915 915
 		    <label for="billing_country" class="give-label">
916
-			    <?php esc_html_e( 'Country', 'give' ); ?>
917
-			    <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
916
+			    <?php esc_html_e('Country', 'give'); ?>
917
+			    <?php if (give_field_is_required('billing_country', $form_id)) : ?>
918 918
 				    <span class="give-required-indicator">*</span>
919 919
 			    <?php endif; ?>
920 920
 			    <span class="give-tooltip give-icon give-icon-question"
921
-			          data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
921
+			          data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
922 922
 		    </label>
923 923
 
924 924
 		    <select
925 925
 				    name="billing_country"
926 926
 				    id="billing_country"
927
-				    class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
928
-			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
927
+				    class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
928
+			    <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
929 929
 		    >
930 930
 			    <?php
931
-			    foreach ( $countries as $country_code => $country ) {
932
-				    echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
931
+			    foreach ($countries as $country_code => $country) {
932
+				    echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
933 933
 			    }
934 934
 			    ?>
935 935
 		    </select>
@@ -937,86 +937,86 @@  discard block
 block discarded – undo
937 937
 
938 938
 		<p id="give-card-address-wrap" class="form-row form-row-wide">
939 939
 			<label for="card_address" class="give-label">
940
-				<?php _e( 'Address 1', 'give' ); ?>
940
+				<?php _e('Address 1', 'give'); ?>
941 941
 				<?php
942
-				if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
942
+				if (give_field_is_required('card_address', $form_id)) : ?>
943 943
 					<span class="give-required-indicator">*</span>
944 944
 				<?php endif; ?>
945
-				<?php echo Give()->tooltips->render_help( __( 'The primary billing address for your credit card.', 'give' ) ); ?>
945
+				<?php echo Give()->tooltips->render_help(__('The primary billing address for your credit card.', 'give')); ?>
946 946
 			</label>
947 947
 
948 948
 			<input
949 949
 					type="text"
950 950
 					id="card_address"
951 951
 					name="card_address"
952
-					class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
953
-					placeholder="<?php _e( 'Address line 1', 'give' ); ?>"
954
-					value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
955
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
952
+					class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
953
+					placeholder="<?php _e('Address line 1', 'give'); ?>"
954
+					value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
955
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
956 956
 			/>
957 957
 		</p>
958 958
 
959 959
 		<p id="give-card-address-2-wrap" class="form-row form-row-wide">
960 960
 			<label for="card_address_2" class="give-label">
961
-				<?php _e( 'Address 2', 'give' ); ?>
962
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
961
+				<?php _e('Address 2', 'give'); ?>
962
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
963 963
 					<span class="give-required-indicator">*</span>
964 964
 				<?php endif; ?>
965
-				<?php echo Give()->tooltips->render_help( __( '(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give' ) ); ?>
965
+				<?php echo Give()->tooltips->render_help(__('(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give')); ?>
966 966
 			</label>
967 967
 
968 968
 			<input
969 969
 					type="text"
970 970
 					id="card_address_2"
971 971
 					name="card_address_2"
972
-					class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
973
-					placeholder="<?php _e( 'Address line 2', 'give' ); ?>"
974
-					value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
975
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
972
+					class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
973
+					placeholder="<?php _e('Address line 2', 'give'); ?>"
974
+					value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
975
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
976 976
 			/>
977 977
 		</p>
978 978
 
979 979
 		<p id="give-card-city-wrap" class="form-row form-row-wide">
980 980
 			<label for="card_city" class="give-label">
981
-				<?php _e( 'City', 'give' ); ?>
982
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
981
+				<?php _e('City', 'give'); ?>
982
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
983 983
 					<span class="give-required-indicator">*</span>
984 984
 				<?php endif; ?>
985
-				<?php echo Give()->tooltips->render_help( __( 'The city for your billing address.', 'give' ) ); ?>
985
+				<?php echo Give()->tooltips->render_help(__('The city for your billing address.', 'give')); ?>
986 986
 			</label>
987 987
 			<input
988 988
 					type="text"
989 989
 					id="card_city"
990 990
 					name="card_city"
991
-					class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
992
-					placeholder="<?php _e( 'City', 'give' ); ?>"
993
-					value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
994
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
991
+					class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
992
+					placeholder="<?php _e('City', 'give'); ?>"
993
+					value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
994
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
995 995
 			/>
996 996
 		</p>
997 997
 
998 998
 	    <p id="give-card-state-wrap"
999
-	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> ">
999
+	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> ">
1000 1000
 		    <label for="card_state" class="give-label">
1001 1001
 			    <span class="state-label-text"><?php echo $label; ?></span>
1002
-			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1002
+			    <?php if (give_field_is_required('card_state', $form_id)) :
1003 1003
 				    ?>
1004
-				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
1004
+				    <span class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : '') ?> ">*</span>
1005 1005
 			    <?php endif; ?>
1006 1006
 			    <span class="give-tooltip give-icon give-icon-question"
1007
-			          data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span>
1007
+			          data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span>
1008 1008
 		    </label>
1009 1009
 		    <?php
1010 1010
 
1011
-		    if ( ! empty( $states ) ) : ?>
1011
+		    if ( ! empty($states)) : ?>
1012 1012
 			    <select
1013 1013
 					    name="card_state"
1014 1014
 					    id="card_state"
1015
-					    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1016
-				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1015
+					    class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1016
+				    <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>>
1017 1017
 				    <?php
1018
-				    foreach ( $states as $state_code => $state ) {
1019
-					    echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1018
+				    foreach ($states as $state_code => $state) {
1019
+					    echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1020 1020
 				    }
1021 1021
 				    ?>
1022 1022
 			    </select>
@@ -1028,11 +1028,11 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
 		<p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive">
1030 1030
 			<label for="card_zip" class="give-label">
1031
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
1032
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
1031
+				<?php _e('Zip / Postal Code', 'give'); ?>
1032
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
1033 1033
 					<span class="give-required-indicator">*</span>
1034 1034
 				<?php endif; ?>
1035
-				<?php echo Give()->tooltips->render_help( __( 'The ZIP Code or postal code for your billing address.', 'give' ) ); ?>
1035
+				<?php echo Give()->tooltips->render_help(__('The ZIP Code or postal code for your billing address.', 'give')); ?>
1036 1036
 			</label>
1037 1037
 
1038 1038
 			<input
@@ -1040,10 +1040,10 @@  discard block
 block discarded – undo
1040 1040
 					size="4"
1041 1041
 					id="card_zip"
1042 1042
 					name="card_zip"
1043
-					class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
1044
-					placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>"
1045
-					value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
1046
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1043
+					class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
1044
+					placeholder="<?php _e('Zip / Postal Code', 'give'); ?>"
1045
+					value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
1046
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
1047 1047
 			/>
1048 1048
 		</p>
1049 1049
 		<?php
@@ -1054,14 +1054,14 @@  discard block
 block discarded – undo
1054 1054
 		 *
1055 1055
 		 * @param int $form_id The form ID.
1056 1056
 		 */
1057
-		do_action( 'give_cc_billing_bottom' );
1057
+		do_action('give_cc_billing_bottom');
1058 1058
 		?>
1059 1059
 	</fieldset>
1060 1060
 	<?php
1061 1061
 	echo ob_get_clean();
1062 1062
 }
1063 1063
 
1064
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1064
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1065 1065
 
1066 1066
 
1067 1067
 /**
@@ -1074,15 +1074,15 @@  discard block
 block discarded – undo
1074 1074
  *
1075 1075
  * @return string
1076 1076
  */
1077
-function give_get_register_fields( $form_id ) {
1077
+function give_get_register_fields($form_id) {
1078 1078
 
1079 1079
 	global $user_ID;
1080 1080
 
1081
-	if ( is_user_logged_in() ) {
1082
-		$user_data = get_userdata( $user_ID );
1081
+	if (is_user_logged_in()) {
1082
+		$user_data = get_userdata($user_ID);
1083 1083
 	}
1084 1084
 
1085
-	$show_register_form = give_show_login_register_option( $form_id );
1085
+	$show_register_form = give_show_login_register_option($form_id);
1086 1086
 
1087 1087
 	ob_start(); ?>
1088 1088
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 		 *
1096 1096
 		 * @param int $form_id The form ID.
1097 1097
 		 */
1098
-		do_action( 'give_register_fields_before', $form_id );
1098
+		do_action('give_register_fields_before', $form_id);
1099 1099
 		?>
1100 1100
 
1101 1101
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
@@ -1107,22 +1107,22 @@  discard block
 block discarded – undo
1107 1107
 			 *
1108 1108
 			 * @param int $form_id The form ID.
1109 1109
 			 */
1110
-			do_action( 'give_register_account_fields_before', $form_id );
1110
+			do_action('give_register_account_fields_before', $form_id);
1111 1111
 			?>
1112 1112
 			<div id="give-create-account-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1113 1113
 				<label for="give-create-account-<?php echo $form_id; ?>">
1114 1114
 					<?php
1115 1115
 					// Add attributes to checkbox, if Guest Checkout is disabled.
1116
-					$is_guest_checkout = give_get_meta( $form_id, '_give_logged_in_only', true );
1117
-					$id                = 'give-create-account-' . $form_id;
1118
-					if ( ! give_is_setting_enabled( $is_guest_checkout ) ) {
1116
+					$is_guest_checkout = give_get_meta($form_id, '_give_logged_in_only', true);
1117
+					$id                = 'give-create-account-'.$form_id;
1118
+					if ( ! give_is_setting_enabled($is_guest_checkout)) {
1119 1119
 						echo Give()->tooltips->render(
1120 1120
 							array(
1121 1121
 								'tag_content' => sprintf(
1122 1122
 									'<input type="checkbox" name="give_create_account" value="on" id="%s" class="give-input give-disabled" checked />',
1123 1123
 									$id
1124 1124
 								),
1125
-								'label'       => __( 'Registration is required to donate.', 'give' ),
1125
+								'label'       => __('Registration is required to donate.', 'give'),
1126 1126
 							) );
1127 1127
 					} else {
1128 1128
 						?>
@@ -1130,16 +1130,16 @@  discard block
 block discarded – undo
1130 1130
 						<?php
1131 1131
 					}
1132 1132
 					?>
1133
-					<?php _e( 'Create an account', 'give' ); ?>
1134
-					<?php echo Give()->tooltips->render_help( __( 'Create an account on the site to see and manage donation history.', 'give' ) ); ?>
1133
+					<?php _e('Create an account', 'give'); ?>
1134
+					<?php echo Give()->tooltips->render_help(__('Create an account on the site to see and manage donation history.', 'give')); ?>
1135 1135
 				</label>
1136 1136
 			</div>
1137 1137
 
1138
-			<?php if ( 'both' === $show_register_form ) { ?>
1138
+			<?php if ('both' === $show_register_form) { ?>
1139 1139
 				<div class="give-login-account-wrap form-row form-row-last form-row-responsive">
1140
-					<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1141
-						<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1142
-						   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1140
+					<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1141
+						<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1142
+						   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1143 1143
 					</p>
1144 1144
 					<p class="give-loading-text">
1145 1145
 						<span class="give-loading-animation"></span>
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 			 *
1156 1156
 			 * @param int $form_id The form ID.
1157 1157
 			 */
1158
-			do_action( 'give_register_account_fields_after', $form_id );
1158
+			do_action('give_register_account_fields_after', $form_id);
1159 1159
 			?>
1160 1160
 		</fieldset>
1161 1161
 
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 		 *
1168 1168
 		 * @param int $form_id The form ID.
1169 1169
 		 */
1170
-		do_action( 'give_register_fields_after', $form_id );
1170
+		do_action('give_register_fields_after', $form_id);
1171 1171
 		?>
1172 1172
 
1173 1173
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 		 *
1179 1179
 		 * @since 1.7
1180 1180
 		 */
1181
-		do_action( 'give_donation_form_user_info', $form_id );
1181
+		do_action('give_donation_form_user_info', $form_id);
1182 1182
 		?>
1183 1183
 
1184 1184
 	</fieldset>
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 	echo ob_get_clean();
1187 1187
 }
1188 1188
 
1189
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1189
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1190 1190
 
1191 1191
 /**
1192 1192
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1199,27 +1199,27 @@  discard block
 block discarded – undo
1199 1199
  *
1200 1200
  * @return string
1201 1201
  */
1202
-function give_get_login_fields( $form_id ) {
1202
+function give_get_login_fields($form_id) {
1203 1203
 
1204
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1205
-	$show_register_form = give_show_login_register_option( $form_id );
1204
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1205
+	$show_register_form = give_show_login_register_option($form_id);
1206 1206
 
1207 1207
 	ob_start();
1208 1208
 	?>
1209 1209
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1210
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
1211
-			if ( ! give_logged_in_only( $form_id ) ) {
1212
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
1210
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
1211
+			if ( ! give_logged_in_only($form_id)) {
1212
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
1213 1213
 			} ?>
1214 1214
 		</legend>
1215
-		<?php if ( $show_register_form == 'both' ) { ?>
1215
+		<?php if ($show_register_form == 'both') { ?>
1216 1216
 			<p class="give-new-account-link">
1217
-				<?php _e( 'Need to create an account?', 'give' ); ?>&nbsp;
1218
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1217
+				<?php _e('Need to create an account?', 'give'); ?>&nbsp;
1218
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1219 1219
 				   data-action="give_checkout_register">
1220
-					<?php _e( 'Register', 'give' );
1221
-					if ( ! give_logged_in_only( $form_id ) ) {
1222
-						echo ' ' . __( 'and donate as a guest &raquo;', 'give' );
1220
+					<?php _e('Register', 'give');
1221
+					if ( ! give_logged_in_only($form_id)) {
1222
+						echo ' '.__('and donate as a guest &raquo;', 'give');
1223 1223
 					} ?>
1224 1224
 				</a>
1225 1225
 			</p>
@@ -1235,49 +1235,49 @@  discard block
 block discarded – undo
1235 1235
 		 *
1236 1236
 		 * @param int $form_id The form ID.
1237 1237
 		 */
1238
-		do_action( 'give_checkout_login_fields_before', $form_id );
1238
+		do_action('give_checkout_login_fields_before', $form_id);
1239 1239
 		?>
1240 1240
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1241 1241
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1242
-				<?php _e( 'Username', 'give' ); ?>
1243
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1242
+				<?php _e('Username', 'give'); ?>
1243
+				<?php if (give_logged_in_only($form_id)) { ?>
1244 1244
 					<span class="give-required-indicator">*</span>
1245 1245
 				<?php } ?>
1246 1246
 			</label>
1247 1247
 
1248
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1248
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1249 1249
 				   name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1250
-				   placeholder="<?php _e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1250
+				   placeholder="<?php _e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1251 1251
 		</div>
1252 1252
 
1253 1253
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1254 1254
 			 class="give_login_password form-row form-row-last form-row-responsive">
1255 1255
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1256
-				<?php _e( 'Password', 'give' ); ?>
1257
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1256
+				<?php _e('Password', 'give'); ?>
1257
+				<?php if (give_logged_in_only($form_id)) { ?>
1258 1258
 					<span class="give-required-indicator">*</span>
1259 1259
 				<?php } ?>
1260 1260
 			</label>
1261
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1261
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1262 1262
 				   type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1263
-				   placeholder="<?php _e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1263
+				   placeholder="<?php _e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1264 1264
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1265 1265
 		</div>
1266 1266
 
1267 1267
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1268 1268
 			 <span class="give-forgot-password ">
1269 1269
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1270
-					target="_blank"><?php _e( 'Reset Password', 'give' ) ?></a>
1270
+					target="_blank"><?php _e('Reset Password', 'give') ?></a>
1271 1271
 			 </span>
1272 1272
 		</div>
1273 1273
 
1274 1274
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1275 1275
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1276
-				   value="<?php _e( 'Login', 'give' ); ?>"/>
1277
-			<?php if ( $show_register_form !== 'login' ) { ?>
1276
+				   value="<?php _e('Login', 'give'); ?>"/>
1277
+			<?php if ($show_register_form !== 'login') { ?>
1278 1278
 				<input type="button" data-action="give_cancel_login"
1279 1279
 					   class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1280
-					   value="<?php _e( 'Cancel', 'give' ); ?>"/>
1280
+					   value="<?php _e('Cancel', 'give'); ?>"/>
1281 1281
 			<?php } ?>
1282 1282
 			<span class="give-loading-animation"></span>
1283 1283
 		</div>
@@ -1289,14 +1289,14 @@  discard block
 block discarded – undo
1289 1289
 		 *
1290 1290
 		 * @param int $form_id The form ID.
1291 1291
 		 */
1292
-		do_action( 'give_checkout_login_fields_after', $form_id );
1292
+		do_action('give_checkout_login_fields_after', $form_id);
1293 1293
 		?>
1294 1294
 	</fieldset><!--end #give-login-fields-->
1295 1295
 	<?php
1296 1296
 	echo ob_get_clean();
1297 1297
 }
1298 1298
 
1299
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1299
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1300 1300
 
1301 1301
 /**
1302 1302
  * Payment Mode Select.
@@ -1312,9 +1312,9 @@  discard block
 block discarded – undo
1312 1312
  *
1313 1313
  * @return void
1314 1314
  */
1315
-function give_payment_mode_select( $form_id ) {
1315
+function give_payment_mode_select($form_id) {
1316 1316
 
1317
-	$gateways = give_get_enabled_payment_gateways( $form_id );
1317
+	$gateways = give_get_enabled_payment_gateways($form_id);
1318 1318
 
1319 1319
 	/**
1320 1320
 	 * Fires while selecting payment gateways, before the fields.
@@ -1323,10 +1323,10 @@  discard block
 block discarded – undo
1323 1323
 	 *
1324 1324
 	 * @param int $form_id The form ID.
1325 1325
 	 */
1326
-	do_action( 'give_payment_mode_top', $form_id );
1326
+	do_action('give_payment_mode_top', $form_id);
1327 1327
 	?>
1328 1328
 
1329
-	<fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1329
+	<fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1330 1330
 		echo 'style="display: none;"';
1331 1331
 	} ?>>
1332 1332
 		<?php
@@ -1337,10 +1337,10 @@  discard block
 block discarded – undo
1337 1337
 		 *
1338 1338
 		 * @param int $form_id The form ID.
1339 1339
 		 */
1340
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1340
+		do_action('give_payment_mode_before_gateways_wrap');
1341 1341
 		?>
1342 1342
 		<legend
1343
-				class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1343
+				class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1344 1344
 			<span class="give-loading-text"><span
1345 1345
 						class="give-loading-animation"></span>
1346 1346
             </span>
@@ -1353,26 +1353,26 @@  discard block
 block discarded – undo
1353 1353
 			 *
1354 1354
 			 * @since 1.7
1355 1355
 			 */
1356
-			do_action( 'give_payment_mode_before_gateways' )
1356
+			do_action('give_payment_mode_before_gateways')
1357 1357
 			?>
1358 1358
 			<ul id="give-gateway-radio-list">
1359 1359
 				<?php
1360 1360
 				/**
1361 1361
 				 * Loop through the active payment gateways.
1362 1362
 				 */
1363
-				$selected_gateway  = give_get_chosen_gateway( $form_id );
1363
+				$selected_gateway = give_get_chosen_gateway($form_id);
1364 1364
 
1365
-				foreach ( $gateways as $gateway_id => $gateway ) :
1365
+				foreach ($gateways as $gateway_id => $gateway) :
1366 1366
 					//Determine the default gateway.
1367
-					$checked = checked( $gateway_id, $selected_gateway, false );
1367
+					$checked = checked($gateway_id, $selected_gateway, false);
1368 1368
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?>
1369 1369
 					<li<?php echo $checked_class ?>>
1370 1370
 						<input type="radio" name="payment-mode" class="give-gateway"
1371
-							   id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1372
-							   value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1373
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1371
+							   id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1372
+							   value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1373
+						<label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1374 1374
 							   class="give-gateway-option"
1375
-							   id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label>
1375
+							   id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label>
1376 1376
 					</li>
1377 1377
 					<?php
1378 1378
 				endforeach;
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 			 *
1385 1385
 			 * @since 1.7
1386 1386
 			 */
1387
-			do_action( 'give_payment_mode_after_gateways' );
1387
+			do_action('give_payment_mode_after_gateways');
1388 1388
 			?>
1389 1389
 		</div>
1390 1390
 		<?php
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
 		 *
1396 1396
 		 * @param int $form_id The form ID.
1397 1397
 		 */
1398
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1398
+		do_action('give_payment_mode_after_gateways_wrap');
1399 1399
 		?>
1400 1400
 	</fieldset>
1401 1401
 
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 	 *
1408 1408
 	 * @param int $form_id The form ID.
1409 1409
 	 */
1410
-	do_action( 'give_payment_mode_bottom', $form_id );
1410
+	do_action('give_payment_mode_bottom', $form_id);
1411 1411
 	?>
1412 1412
 
1413 1413
 	<div id="give_purchase_form_wrap">
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
 		 *
1419 1419
 		 * @since 1.7
1420 1420
 		 */
1421
-		do_action( 'give_donation_form', $form_id );
1421
+		do_action('give_donation_form', $form_id);
1422 1422
 		?>
1423 1423
 
1424 1424
 	</div>
@@ -1429,10 +1429,10 @@  discard block
 block discarded – undo
1429 1429
 	 *
1430 1430
 	 * @since 1.7
1431 1431
 	 */
1432
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1432
+	do_action('give_donation_form_wrap_bottom', $form_id);
1433 1433
 }
1434 1434
 
1435
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1435
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1436 1436
 
1437 1437
 /**
1438 1438
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1445,31 +1445,31 @@  discard block
 block discarded – undo
1445 1445
  *
1446 1446
  * @return bool
1447 1447
  */
1448
-function give_terms_agreement( $form_id ) {
1449
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1448
+function give_terms_agreement($form_id) {
1449
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1450 1450
 
1451 1451
 	// Bailout if per form and global term and conditions is not setup.
1452 1452
 	if (
1453
-		give_is_setting_enabled( $form_option, 'global' )
1454
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1453
+		give_is_setting_enabled($form_option, 'global')
1454
+		&& give_is_setting_enabled(give_get_option('terms'))
1455 1455
 	) {
1456
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1457
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1458
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1456
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1457
+		$terms         = $terms = give_get_option('agreement_text', '');
1458
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1459 1459
 
1460
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1461
-		$label         = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1462
-		$terms         = give_get_meta( $form_id, '_give_agree_text', true );
1463
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1460
+	} elseif (give_is_setting_enabled($form_option)) {
1461
+		$label         = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1462
+		$terms         = give_get_meta($form_id, '_give_agree_text', true);
1463
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1464 1464
 
1465 1465
 	} else {
1466 1466
 		return false;
1467 1467
 	}
1468 1468
 
1469 1469
 	// Bailout: Check if term and conditions text is empty or not.
1470
-	if ( empty( $terms ) ) {
1471
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1472
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1470
+	if (empty($terms)) {
1471
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1472
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1473 1473
 		}
1474 1474
 
1475 1475
 		return false;
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 
1478 1478
 	?>
1479 1479
 	<fieldset id="give_terms_agreement">
1480
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1480
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1481 1481
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1482 1482
 			<?php
1483 1483
 			/**
@@ -1485,22 +1485,22 @@  discard block
 block discarded – undo
1485 1485
 			 *
1486 1486
 			 * @since 1.0
1487 1487
 			 */
1488
-			do_action( 'give_before_terms' );
1488
+			do_action('give_before_terms');
1489 1489
 
1490
-			echo wpautop( stripslashes( $terms ) );
1490
+			echo wpautop(stripslashes($terms));
1491 1491
 			/**
1492 1492
 			 * Fires while rendering terms of agreement, after the fields.
1493 1493
 			 *
1494 1494
 			 * @since 1.0
1495 1495
 			 */
1496
-			do_action( 'give_after_terms' );
1496
+			do_action('give_after_terms');
1497 1497
 			?>
1498 1498
 		</div>
1499 1499
 		<div id="give_show_terms">
1500 1500
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1501
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1501
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1502 1502
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1503
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1503
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1504 1504
 		</div>
1505 1505
 
1506 1506
 		<input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 	<?php
1512 1512
 }
1513 1513
 
1514
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1514
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1515 1515
 
1516 1516
 /**
1517 1517
  * Checkout Final Total.
@@ -1524,31 +1524,30 @@  discard block
 block discarded – undo
1524 1524
  *
1525 1525
  * @return void
1526 1526
  */
1527
-function give_checkout_final_total( $form_id ) {
1527
+function give_checkout_final_total($form_id) {
1528 1528
 
1529
-	$total = isset( $_POST['give_total'] ) ?
1530
-		apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) :
1531
-		give_get_default_form_amount( $form_id );
1529
+	$total = isset($_POST['give_total']) ?
1530
+		apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id);
1532 1531
 
1533 1532
 
1534 1533
 	// Only proceed if give_total available.
1535
-	if ( empty( $total ) ) {
1534
+	if (empty($total)) {
1536 1535
 		return;
1537 1536
 	}
1538 1537
 	?>
1539 1538
 	<p id="give-final-total-wrap" class="form-wrap ">
1540 1539
 		<span class="give-donation-total-label">
1541
-			<?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?>
1540
+			<?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?>
1542 1541
 		</span>
1543 1542
 		<span class="give-final-total-amount"
1544
-			  data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>">
1545
-			<?php echo give_currency_filter( give_format_amount( $total, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ); ?>
1543
+			  data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>">
1544
+			<?php echo give_currency_filter(give_format_amount($total, array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))); ?>
1546 1545
 		</span>
1547 1546
 	</p>
1548 1547
 	<?php
1549 1548
 }
1550 1549
 
1551
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1550
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1552 1551
 
1553 1552
 /**
1554 1553
  * Renders the Checkout Submit section.
@@ -1559,7 +1558,7 @@  discard block
 block discarded – undo
1559 1558
  *
1560 1559
  * @return void
1561 1560
  */
1562
-function give_checkout_submit( $form_id ) {
1561
+function give_checkout_submit($form_id) {
1563 1562
 	?>
1564 1563
 	<fieldset id="give_purchase_submit">
1565 1564
 		<?php
@@ -1568,24 +1567,24 @@  discard block
 block discarded – undo
1568 1567
 		 *
1569 1568
 		 * @since 1.7
1570 1569
 		 */
1571
-		do_action( 'give_donation_form_before_submit', $form_id );
1570
+		do_action('give_donation_form_before_submit', $form_id);
1572 1571
 
1573
-		give_checkout_hidden_fields( $form_id );
1572
+		give_checkout_hidden_fields($form_id);
1574 1573
 
1575
-		echo give_get_donation_form_submit_button( $form_id );
1574
+		echo give_get_donation_form_submit_button($form_id);
1576 1575
 
1577 1576
 		/**
1578 1577
 		 * Fire after donation form submit.
1579 1578
 		 *
1580 1579
 		 * @since 1.7
1581 1580
 		 */
1582
-		do_action( 'give_donation_form_after_submit', $form_id );
1581
+		do_action('give_donation_form_after_submit', $form_id);
1583 1582
 		?>
1584 1583
 	</fieldset>
1585 1584
 	<?php
1586 1585
 }
1587 1586
 
1588
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1587
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1589 1588
 
1590 1589
 /**
1591 1590
  * Give Donation form submit button.
@@ -1596,10 +1595,10 @@  discard block
 block discarded – undo
1596 1595
  *
1597 1596
  * @return string
1598 1597
  */
1599
-function give_get_donation_form_submit_button( $form_id ) {
1598
+function give_get_donation_form_submit_button($form_id) {
1600 1599
 
1601
-	$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
1602
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1600
+	$display_label_field = give_get_meta($form_id, '_give_checkout_label', true);
1601
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1603 1602
 	ob_start();
1604 1603
 	?>
1605 1604
 	<div class="give-submit-button-wrap give-clearfix">
@@ -1608,7 +1607,7 @@  discard block
 block discarded – undo
1608 1607
 		<span class="give-loading-animation"></span>
1609 1608
 	</div>
1610 1609
 	<?php
1611
-	return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id );
1610
+	return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id);
1612 1611
 }
1613 1612
 
1614 1613
 /**
@@ -1623,22 +1622,22 @@  discard block
 block discarded – undo
1623 1622
  *
1624 1623
  * @return mixed
1625 1624
  */
1626
-function give_show_goal_progress( $form_id, $args ) {
1625
+function give_show_goal_progress($form_id, $args) {
1627 1626
 
1628 1627
 	ob_start();
1629
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1628
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1630 1629
 
1631 1630
 	/**
1632 1631
 	 * Filter progress bar output
1633 1632
 	 *
1634 1633
 	 * @since 2.0
1635 1634
 	 */
1636
-	echo apply_filters( 'give_goal_output', ob_get_clean(), $form_id, $args );
1635
+	echo apply_filters('give_goal_output', ob_get_clean(), $form_id, $args);
1637 1636
 
1638 1637
 	return true;
1639 1638
 }
1640 1639
 
1641
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1640
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1642 1641
 
1643 1642
 
1644 1643
 /**
@@ -1651,10 +1650,10 @@  discard block
 block discarded – undo
1651 1650
  *
1652 1651
  * @return mixed|string
1653 1652
  */
1654
-function give_get_form_content_placement( $form_id, $args ) {
1653
+function give_get_form_content_placement($form_id, $args) {
1655 1654
 	$show_content = '';
1656 1655
 
1657
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1656
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1658 1657
 		// Content positions.
1659 1658
 		$content_placement = array(
1660 1659
 			'above' => 'give_pre_form',
@@ -1662,18 +1661,18 @@  discard block
 block discarded – undo
1662 1661
 		);
1663 1662
 
1664 1663
 		// Check if content position already decoded.
1665
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1664
+		if (in_array($args['show_content'], $content_placement)) {
1666 1665
 			return $args['show_content'];
1667 1666
 		}
1668 1667
 
1669
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1668
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1670 1669
 
1671
-	} elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) {
1672
-		$show_content = give_get_meta( $form_id, '_give_content_placement', true );
1670
+	} elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) {
1671
+		$show_content = give_get_meta($form_id, '_give_content_placement', true);
1673 1672
 
1674
-	} elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) {
1673
+	} elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) {
1675 1674
 		// Backward compatibility for _give_content_option for v18.
1676
-		$show_content = give_get_meta( $form_id, '_give_content_option', true );
1675
+		$show_content = give_get_meta($form_id, '_give_content_option', true);
1677 1676
 	}
1678 1677
 
1679 1678
 	return $show_content;
@@ -1689,20 +1688,20 @@  discard block
 block discarded – undo
1689 1688
  *
1690 1689
  * @return void|bool
1691 1690
  */
1692
-function give_form_content( $form_id, $args ) {
1691
+function give_form_content($form_id, $args) {
1693 1692
 
1694
-	$show_content = give_get_form_content_placement( $form_id, $args );
1693
+	$show_content = give_get_form_content_placement($form_id, $args);
1695 1694
 
1696 1695
 	// Bailout.
1697
-	if ( empty( $show_content ) ) {
1696
+	if (empty($show_content)) {
1698 1697
 		return false;
1699 1698
 	}
1700 1699
 
1701 1700
 	// Add action according to value.
1702
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
1701
+	add_action($show_content, 'give_form_display_content', 10, 2);
1703 1702
 }
1704 1703
 
1705
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1704
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1706 1705
 
1707 1706
 /**
1708 1707
  * Renders Post Form Content.
@@ -1716,22 +1715,22 @@  discard block
 block discarded – undo
1716 1715
  *
1717 1716
  * @return void
1718 1717
  */
1719
-function give_form_display_content( $form_id, $args ) {
1718
+function give_form_display_content($form_id, $args) {
1720 1719
 
1721
-	$content      = wpautop( give_get_meta( $form_id, '_give_form_content', true ) );
1722
-	$show_content = give_get_form_content_placement( $form_id, $args );
1720
+	$content      = wpautop(give_get_meta($form_id, '_give_form_content', true));
1721
+	$show_content = give_get_form_content_placement($form_id, $args);
1723 1722
 
1724
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
1725
-		$content = apply_filters( 'the_content', $content );
1723
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
1724
+		$content = apply_filters('the_content', $content);
1726 1725
 	}
1727 1726
 
1728
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>';
1727
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>';
1729 1728
 
1730
-	echo apply_filters( 'give_form_content_output', $output );
1729
+	echo apply_filters('give_form_content_output', $output);
1731 1730
 
1732 1731
 	// remove action to prevent content output on addition forms on page.
1733 1732
 	// @see: https://github.com/WordImpress/Give/issues/634.
1734
-	remove_action( $show_content, 'give_form_display_content' );
1733
+	remove_action($show_content, 'give_form_display_content');
1735 1734
 }
1736 1735
 
1737 1736
 /**
@@ -1743,7 +1742,7 @@  discard block
 block discarded – undo
1743 1742
  *
1744 1743
  * @return void
1745 1744
  */
1746
-function give_checkout_hidden_fields( $form_id ) {
1745
+function give_checkout_hidden_fields($form_id) {
1747 1746
 
1748 1747
 	/**
1749 1748
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1752,13 +1751,13 @@  discard block
 block discarded – undo
1752 1751
 	 *
1753 1752
 	 * @param int $form_id The form ID.
1754 1753
 	 */
1755
-	do_action( 'give_hidden_fields_before', $form_id );
1754
+	do_action('give_hidden_fields_before', $form_id);
1756 1755
 
1757
-	if ( is_user_logged_in() ) { ?>
1756
+	if (is_user_logged_in()) { ?>
1758 1757
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1759 1758
 	<?php } ?>
1760 1759
 	<input type="hidden" name="give_action" value="purchase"/>
1761
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1760
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1762 1761
 	<?php
1763 1762
 	/**
1764 1763
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1767,7 +1766,7 @@  discard block
 block discarded – undo
1767 1766
 	 *
1768 1767
 	 * @param int $form_id The form ID.
1769 1768
 	 */
1770
-	do_action( 'give_hidden_fields_after', $form_id );
1769
+	do_action('give_hidden_fields_after', $form_id);
1771 1770
 
1772 1771
 }
1773 1772
 
@@ -1782,20 +1781,20 @@  discard block
 block discarded – undo
1782 1781
  *
1783 1782
  * @return string $content Filtered content.
1784 1783
  */
1785
-function give_filter_success_page_content( $content ) {
1784
+function give_filter_success_page_content($content) {
1786 1785
 
1787 1786
 	$give_options = give_get_settings();
1788 1787
 
1789
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1790
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1791
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1788
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1789
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1790
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1792 1791
 		}
1793 1792
 	}
1794 1793
 
1795 1794
 	return $content;
1796 1795
 }
1797 1796
 
1798
-add_filter( 'the_content', 'give_filter_success_page_content' );
1797
+add_filter('the_content', 'give_filter_success_page_content');
1799 1798
 
1800 1799
 /**
1801 1800
  * Test Mode Frontend Warning.
@@ -1806,12 +1805,12 @@  discard block
 block discarded – undo
1806 1805
  */
1807 1806
 function give_test_mode_frontend_warning() {
1808 1807
 
1809
-	if ( give_is_test_mode() ) {
1810
-		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>';
1808
+	if (give_is_test_mode()) {
1809
+		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>';
1811 1810
 	}
1812 1811
 }
1813 1812
 
1814
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1813
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1815 1814
 
1816 1815
 /**
1817 1816
  * Members-only Form.
@@ -1825,21 +1824,21 @@  discard block
 block discarded – undo
1825 1824
  *
1826 1825
  * @return string
1827 1826
  */
1828
-function give_members_only_form( $final_output, $args ) {
1827
+function give_members_only_form($final_output, $args) {
1829 1828
 
1830
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1829
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1831 1830
 
1832 1831
 	//Sanity Check: Must have form_id & not be logged in.
1833
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1832
+	if (empty($form_id) || is_user_logged_in()) {
1834 1833
 		return $final_output;
1835 1834
 	}
1836 1835
 
1837 1836
 	//Logged in only and Register / Login set to none.
1838
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1837
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1839 1838
 
1840
-		$final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1839
+		$final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1841 1840
 
1842
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1841
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1843 1842
 
1844 1843
 	}
1845 1844
 
@@ -1847,7 +1846,7 @@  discard block
 block discarded – undo
1847 1846
 
1848 1847
 }
1849 1848
 
1850
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1849
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
1851 1850
 
1852 1851
 
1853 1852
 /**
@@ -1859,28 +1858,28 @@  discard block
 block discarded – undo
1859 1858
  * @param array            $args
1860 1859
  * @param Give_Donate_Form $form
1861 1860
  */
1862
-function __give_form_add_donation_hidden_field( $form_id, $args, $form ) {
1861
+function __give_form_add_donation_hidden_field($form_id, $args, $form) {
1863 1862
 	?>
1864 1863
 	<input type="hidden" name="give-form-id" value="<?php echo $form_id; ?>"/>
1865
-	<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
1864
+	<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
1866 1865
 	<input type="hidden" name="give-current-url"
1867
-		   value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1868
-	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1866
+		   value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1867
+	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1869 1868
 	<input type="hidden" name="give-form-minimum"
1870
-		   value="<?php echo give_format_amount( give_get_form_minimum_price( $form_id ), array( 'sanitize' => false ) ); ?>"/>
1869
+		   value="<?php echo give_format_amount(give_get_form_minimum_price($form_id), array('sanitize' => false)); ?>"/>
1871 1870
 	<?php
1872 1871
 
1873 1872
 	// WP nonce field.
1874
-	wp_nonce_field( "donation_form_nonce_{$form_id}", '_wpnonce', false );
1873
+	wp_nonce_field("donation_form_nonce_{$form_id}", '_wpnonce', false);
1875 1874
 
1876 1875
 	// Price ID hidden field for variable (multi-level) donation forms.
1877
-	if ( give_has_variable_prices( $form_id ) ) {
1876
+	if (give_has_variable_prices($form_id)) {
1878 1877
 		// Get default selected price ID.
1879
-		$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
1878
+		$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
1880 1879
 		$price_id = 0;
1881 1880
 		//loop through prices.
1882
-		foreach ( $prices as $price ) {
1883
-			if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
1881
+		foreach ($prices as $price) {
1882
+			if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
1884 1883
 				$price_id = $price['_give_id']['level_id'];
1885 1884
 			};
1886 1885
 		}
@@ -1893,7 +1892,7 @@  discard block
 block discarded – undo
1893 1892
 	}
1894 1893
 }
1895 1894
 
1896
-add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 );
1895
+add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3);
1897 1896
 
1898 1897
 /**
1899 1898
  * Add currency settings on donation form.
@@ -1905,20 +1904,20 @@  discard block
 block discarded – undo
1905 1904
  *
1906 1905
  * @return array
1907 1906
  */
1908
-function __give_form_add_currency_settings( $form_html_tags, $form ) {
1909
-	$form_currency     = give_get_currency( $form->ID );
1910
-	$currency_settings = give_get_currency_formatting_settings( $form_currency );
1907
+function __give_form_add_currency_settings($form_html_tags, $form) {
1908
+	$form_currency     = give_get_currency($form->ID);
1909
+	$currency_settings = give_get_currency_formatting_settings($form_currency);
1911 1910
 
1912 1911
 	// Check if currency exist.
1913
-	if ( empty( $currency_settings ) ) {
1912
+	if (empty($currency_settings)) {
1914 1913
 		return $form_html_tags;
1915 1914
 	}
1916 1915
 
1917
-	$form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency );
1916
+	$form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency);
1918 1917
 	$form_html_tags['data-currency_code']   = $form_currency;
1919 1918
 
1920
-	if ( ! empty( $currency_settings ) ) {
1921
-		foreach ( $currency_settings as $key => $value ) {
1919
+	if ( ! empty($currency_settings)) {
1920
+		foreach ($currency_settings as $key => $value) {
1922 1921
 			$form_html_tags["data-{$key}"] = $value;
1923 1922
 		}
1924 1923
 	}
@@ -1926,4 +1925,4 @@  discard block
 block discarded – undo
1926 1925
 	return $form_html_tags;
1927 1926
 }
1928 1927
 
1929
-add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 );
1928
+add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2);
Please login to merge, or discard this patch.
includes/process-donation.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -288,8 +288,8 @@
 block discarded – undo
288 288
 
289 289
 	// Check spam detect.
290 290
 	if ( isset( $_POST['action'] )
291
-	     && give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) )
292
-	     && give_is_spam_donation()
291
+		 && give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) )
292
+		 && give_is_spam_donation()
293 293
 	) {
294 294
 		give_set_error( 'invalid_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) );
295 295
 	}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  * @access private
23 23
  * @since  1.0
24 24
  *
25
- * @return mixed
25
+ * @return false|null
26 26
  */
27 27
 function give_process_donation_form() {
28 28
 	$is_ajax = isset( $_POST['give_ajax'] );
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
  * @access      private
463 463
  * @since       1.0
464 464
  *
465
- * @param       $form_id
465
+ * @param       integer $form_id
466 466
  *
467 467
  * @return      array
468 468
  */
Please login to merge, or discard this patch.
Spacing   +249 added lines, -250 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,20 +25,20 @@  discard block
 block discarded – undo
25 25
  * @return mixed
26 26
  */
27 27
 function give_process_donation_form() {
28
-	$is_ajax = isset( $_POST['give_ajax'] );
28
+	$is_ajax = isset($_POST['give_ajax']);
29 29
 
30 30
 	// Verify donation form nonce.
31
-	if(  ! give_verify_donation_form_nonce() ) {
32
-		if( $is_ajax ) {
31
+	if ( ! give_verify_donation_form_nonce()) {
32
+		if ($is_ajax) {
33 33
 			/**
34 34
 			 * Fires when AJAX sends back errors from the donation form.
35 35
 			 *
36 36
 			 * @since 1.0
37 37
 			 */
38
-			do_action( 'give_ajax_donation_errors' );
38
+			do_action('give_ajax_donation_errors');
39 39
 			
40 40
 			give_die();
41
-		} else{
41
+		} else {
42 42
 			give_send_back_to_checkout();
43 43
 		}
44 44
 	}
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @since 1.0
50 50
 	 */
51
-	do_action( 'give_pre_process_donation' );
51
+	do_action('give_pre_process_donation');
52 52
 
53 53
 	// Validate the form $_POST data.
54 54
 	$valid_data = give_donation_form_validate_fields();
@@ -63,24 +63,24 @@  discard block
 block discarded – undo
63 63
 	 * @param bool|array $valid_data Validate fields.
64 64
 	 * @param array $_POST Array of variables passed via the HTTP POST.
65 65
 	 */
66
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
66
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
67 67
 
68 68
 	// Process the login form.
69
-	if ( isset( $_POST['give_login_submit'] ) ) {
69
+	if (isset($_POST['give_login_submit'])) {
70 70
 		give_process_form_login();
71 71
 	}
72 72
 
73 73
 	// Validate the user.
74
-	$user = give_get_donation_form_user( $valid_data );
74
+	$user = give_get_donation_form_user($valid_data);
75 75
 
76
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
77
-		if ( $is_ajax ) {
76
+	if (false === $valid_data || give_get_errors() || ! $user) {
77
+		if ($is_ajax) {
78 78
 			/**
79 79
 			 * Fires when AJAX sends back errors from the donation form.
80 80
 			 *
81 81
 			 * @since 1.0
82 82
 			 */
83
-			do_action( 'give_ajax_donation_errors' );
83
+			do_action('give_ajax_donation_errors');
84 84
 			give_die();
85 85
 		} else {
86 86
 			return false;
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
 	}
89 89
 
90 90
 	// If AJAX send back success to proceed with form submission.
91
-	if ( $is_ajax ) {
91
+	if ($is_ajax) {
92 92
 		echo 'success';
93 93
 		give_die();
94 94
 	}
95 95
 
96 96
 	// After AJAX: Setup session if not using php_sessions.
97
-	if ( ! Give()->session->use_php_sessions() ) {
97
+	if ( ! Give()->session->use_php_sessions()) {
98 98
 		// Double-check that set_cookie is publicly accessible.
99 99
 		// we're using a slightly modified class-wp-sessions.php.
100
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
101
-		if ( $session_reflection->isPublic() ) {
100
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
101
+		if ($session_reflection->isPublic()) {
102 102
 			// Manually set the cookie.
103 103
 			Give()->session->init()->set_cookie();
104 104
 		}
@@ -113,21 +113,20 @@  discard block
 block discarded – undo
113 113
 		'address'    => $user['address'],
114 114
 	);
115 115
 
116
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
116
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
117 117
 
118
-	$price        = isset( $_POST['give-amount'] ) ?
119
-		(float) apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give-amount'] ) ) :
120
-		'0.00';
121
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
118
+	$price        = isset($_POST['give-amount']) ?
119
+		(float) apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give-amount'])) : '0.00';
120
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
122 121
 
123 122
 	// Setup donation information.
124 123
 	$donation_data = array(
125 124
 		'price'         => $price,
126 125
 		'purchase_key'  => $purchase_key,
127 126
 		'user_email'    => $user['user_email'],
128
-		'date'          => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
129
-		'user_info'     => stripslashes_deep( $user_info ),
130
-		'post_data'     => give_clean( $_POST ),
127
+		'date'          => date('Y-m-d H:i:s', current_time('timestamp')),
128
+		'user_info'     => stripslashes_deep($user_info),
129
+		'post_data'     => give_clean($_POST),
131 130
 		'gateway'       => $valid_data['gateway'],
132 131
 		'card_info'     => $valid_data['cc_info'],
133 132
 	);
@@ -146,10 +145,10 @@  discard block
 block discarded – undo
146 145
 	 * @param array $user_info Array containing basic user information.
147 146
 	 * @param bool|array $valid_data Validate fields.
148 147
 	 */
149
-	do_action( 'give_checkout_before_gateway', give_clean( $_POST ), $user_info, $valid_data );
148
+	do_action('give_checkout_before_gateway', give_clean($_POST), $user_info, $valid_data);
150 149
 
151 150
 	// Sanity check for price.
152
-	if ( ! $donation_data['price'] ) {
151
+	if ( ! $donation_data['price']) {
153 152
 		// Revert to manual.
154 153
 		$donation_data['gateway'] = 'manual';
155 154
 		$_POST['give-gateway']    = 'manual';
@@ -160,26 +159,26 @@  discard block
 block discarded – undo
160 159
 	 *
161 160
 	 * @since 1.7
162 161
 	 */
163
-	$donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data );
162
+	$donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data);
164 163
 
165 164
 	// Setup the data we're storing in the donation session.
166 165
 	$session_data = $donation_data;
167 166
 
168 167
 	// Make sure credit card numbers are never stored in sessions.
169
-	unset( $session_data['card_info']['card_number'] );
170
-	unset( $session_data['post_data']['card_number'] );
168
+	unset($session_data['card_info']['card_number']);
169
+	unset($session_data['post_data']['card_number']);
171 170
 
172 171
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
173
-	give_set_purchase_session( $session_data );
172
+	give_set_purchase_session($session_data);
174 173
 
175 174
 	// Send info to the gateway for payment processing.
176
-	give_send_to_gateway( $donation_data['gateway'], $donation_data );
175
+	give_send_to_gateway($donation_data['gateway'], $donation_data);
177 176
 	give_die();
178 177
 }
179 178
 
180
-add_action( 'give_purchase', 'give_process_donation_form' );
181
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
182
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
179
+add_action('give_purchase', 'give_process_donation_form');
180
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
181
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
183 182
 
184 183
 
185 184
 /**
@@ -192,29 +191,29 @@  discard block
 block discarded – undo
192 191
  *
193 192
  * @return void
194 193
  */
195
-function give_check_logged_in_user_for_existing_email( $valid_data, $post ) {
194
+function give_check_logged_in_user_for_existing_email($valid_data, $post) {
196 195
 
197 196
 	// Verify that the email address belongs to this customer.
198
-	if ( is_user_logged_in() ) {
197
+	if (is_user_logged_in()) {
199 198
 
200 199
 		$submitted_email = $valid_data['logged_in_user']['user_email'];
201
-		$donor           = new Give_Donor( get_current_user_id(), true );
200
+		$donor           = new Give_Donor(get_current_user_id(), true);
202 201
 
203 202
 		// If this email address is not registered with this customer, see if it belongs to any other customer.
204 203
 		if (
205 204
 			$submitted_email !== $donor->email
206
-			&& ( is_array( $donor->emails ) && ! in_array( $submitted_email, $donor->emails ) )
205
+			&& (is_array($donor->emails) && ! in_array($submitted_email, $donor->emails))
207 206
 		) {
208
-			$found_donor = new Give_Donor( $submitted_email );
207
+			$found_donor = new Give_Donor($submitted_email);
209 208
 
210
-			if ( $found_donor->id > 0 ) {
211
-				give_set_error( 'give-customer-email-exists', sprintf( __( 'You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give' ), $donor->email, $submitted_email ) );
209
+			if ($found_donor->id > 0) {
210
+				give_set_error('give-customer-email-exists', sprintf(__('You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give'), $donor->email, $submitted_email));
212 211
 			}
213 212
 		}
214 213
 	}
215 214
 }
216 215
 
217
-add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2 );
216
+add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2);
218 217
 
219 218
 /**
220 219
  * Process the checkout login form
@@ -224,49 +223,49 @@  discard block
 block discarded – undo
224 223
  * @return      void
225 224
  */
226 225
 function give_process_form_login() {
227
-	$is_ajax = isset( $_POST['give_ajax'] );
226
+	$is_ajax = isset($_POST['give_ajax']);
228 227
 
229 228
 	$user_data = give_donation_form_validate_user_login();
230 229
 
231
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
232
-		if ( $is_ajax ) {
230
+	if (give_get_errors() || $user_data['user_id'] < 1) {
231
+		if ($is_ajax) {
233 232
 			/**
234 233
 			 * Fires when AJAX sends back errors from the donation form.
235 234
 			 *
236 235
 			 * @since 1.0
237 236
 			 */
238 237
 			ob_start();
239
-			do_action( 'give_ajax_donation_errors' );
238
+			do_action('give_ajax_donation_errors');
240 239
 			$message = ob_get_contents();
241 240
 			ob_end_clean();
242
-			wp_send_json_error( $message );
241
+			wp_send_json_error($message);
243 242
 		} else {
244
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
243
+			wp_redirect($_SERVER['HTTP_REFERER']);
245 244
 			exit;
246 245
 		}
247 246
 	}
248 247
 
249
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
248
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
250 249
 
251
-	if ( $is_ajax ) {
250
+	if ($is_ajax) {
252 251
 		$message = Give()->notices->print_frontend_notice(
253 252
 			sprintf(
254 253
 			/* translators: %s: user first name */
255
-				esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ),
256
-				( ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login']
254
+				esc_html__('Welcome %s! You have successfully logged into your account.', 'give'),
255
+				( ! empty($user_data['user_first'])) ? $user_data['user_first'] : $user_data['user_login']
257 256
 			),
258 257
 			false,
259 258
 			'success'
260 259
 		);
261 260
 
262
-		wp_send_json_success( $message );
261
+		wp_send_json_success($message);
263 262
 	} else {
264
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
263
+		wp_redirect($_SERVER['HTTP_REFERER']);
265 264
 	}
266 265
 }
267 266
 
268
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
269
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
267
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
268
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
270 269
 
271 270
 /**
272 271
  * Donation Form Validate Fields.
@@ -278,52 +277,52 @@  discard block
 block discarded – undo
278 277
 function give_donation_form_validate_fields() {
279 278
 
280 279
 	// Check if there is $_POST.
281
-	if ( empty( $_POST ) ) {
280
+	if (empty($_POST)) {
282 281
 		return false;
283 282
 	}
284 283
 
285
-	$form_id = ! empty( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
284
+	$form_id = ! empty($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
286 285
 
287 286
 	// Start an array to collect valid data.
288 287
 	$valid_data = array(
289 288
 		'gateway'          => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here).
290
-		'need_new_user'    => false,     // New user flag.
291
-		'need_user_login'  => false,     // Login user flag.
292
-		'logged_user_data' => array(),   // Logged user collected data.
293
-		'new_user_data'    => array(),   // New user collected data.
294
-		'login_user_data'  => array(),   // Login user collected data.
295
-		'guest_user_data'  => array(),   // Guest user collected data.
296
-		'cc_info'          => give_donation_form_validate_cc(),// Credit card info.
289
+		'need_new_user'    => false, // New user flag.
290
+		'need_user_login'  => false, // Login user flag.
291
+		'logged_user_data' => array(), // Logged user collected data.
292
+		'new_user_data'    => array(), // New user collected data.
293
+		'login_user_data'  => array(), // Login user collected data.
294
+		'guest_user_data'  => array(), // Guest user collected data.
295
+		'cc_info'          => give_donation_form_validate_cc(), // Credit card info.
297 296
 	);
298 297
 
299 298
 	// Validate Honeypot First.
300
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
301
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
299
+	if ( ! empty($_POST['give-honeypot'])) {
300
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
302 301
 	}
303 302
 
304 303
 	// Check spam detect.
305
-	if ( isset( $_POST['action'] )
306
-	     && give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) )
304
+	if (isset($_POST['action'])
305
+	     && give_is_setting_enabled(give_get_option('akismet_spam_protection'))
307 306
 	     && give_is_spam_donation()
308 307
 	) {
309
-		give_set_error( 'invalid_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) );
308
+		give_set_error('invalid_donation', __('This donation has been flagged as spam. Please try again.', 'give'));
310 309
 	}
311 310
 
312 311
 	// Validate agree to terms.
313
-	if ( give_is_terms_enabled( $form_id ) ) {
312
+	if (give_is_terms_enabled($form_id)) {
314 313
 		give_donation_form_validate_agree_to_terms();
315 314
 	}
316 315
 
317
-	if ( is_user_logged_in() ) {
316
+	if (is_user_logged_in()) {
318 317
 		// Collect logged in user data.
319 318
 		$valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user();
320
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' && ! empty( $_POST['give_create_account'] ) ) {
319
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register' && ! empty($_POST['give_create_account'])) {
321 320
 		// Set new user registration as required.
322 321
 		$valid_data['need_new_user'] = true;
323 322
 		// Validate new user data.
324 323
 		$valid_data['new_user_data'] = give_donation_form_validate_new_user();
325 324
 		// Check if login validation is needed.
326
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
325
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
327 326
 		// Set user login as required.
328 327
 		$valid_data['need_user_login'] = true;
329 328
 		// Validate users login info.
@@ -347,14 +346,14 @@  discard block
 block discarded – undo
347 346
 function give_is_spam_donation() {
348 347
 	$spam = false;
349 348
 
350
-	$user_agent = (string) isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
349
+	$user_agent = (string) isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
351 350
 
352
-	if ( strlen( $user_agent ) < 2 ) {
351
+	if (strlen($user_agent) < 2) {
353 352
 		$spam = true;
354 353
 	}
355 354
 
356 355
 	// Allow developer to customized Akismet spam detect API call and it's response.
357
-	return apply_filters( 'give_spam', $spam );
356
+	return apply_filters('give_spam', $spam);
358 357
 }
359 358
 
360 359
 /**
@@ -368,41 +367,41 @@  discard block
 block discarded – undo
368 367
  */
369 368
 function give_donation_form_validate_gateway() {
370 369
 
371
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
372
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_maybe_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
373
-	$gateway = give_get_default_gateway( $form_id );
370
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
371
+	$amount  = isset($_REQUEST['give-amount']) ? give_maybe_sanitize_amount($_REQUEST['give-amount']) : 0;
372
+	$gateway = give_get_default_gateway($form_id);
374 373
 
375 374
 	// Check if a gateway value is present.
376
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
375
+	if ( ! empty($_REQUEST['give-gateway'])) {
377 376
 
378
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
377
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
379 378
 
380 379
 		// Is amount being donated in LIVE mode 0.00? If so, error:
381
-		if ( $amount == 0 && ! give_is_test_mode() ) {
380
+		if ($amount == 0 && ! give_is_test_mode()) {
382 381
 
383
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
382
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
384 383
 
385 384
 		} // End if().
386
-		elseif ( ! give_verify_minimum_price() ) {
385
+		elseif ( ! give_verify_minimum_price()) {
387 386
 			// translators: %s: minimum donation amount.
388 387
 			give_set_error(
389 388
 				'invalid_donation_minimum',
390 389
 				sprintf(
391 390
 				/* translators: %s: minimum donation amount */
392
-					__( 'This form has a minimum donation amount of %s.', 'give' ),
393
-					give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ), array( 'sanitize' => false ) ) )
391
+					__('This form has a minimum donation amount of %s.', 'give'),
392
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id), array('sanitize' => false)))
394 393
 				)
395 394
 			);
396 395
 
397 396
 		} //Is this test mode zero donation? Let it through but set to manual gateway.
398
-		elseif ( $amount == 0 && give_is_test_mode() ) {
397
+		elseif ($amount == 0 && give_is_test_mode()) {
399 398
 
400 399
 			$gateway = 'manual';
401 400
 
402 401
 		} //Check if this gateway is active.
403
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
402
+		elseif ( ! give_is_gateway_active($gateway)) {
404 403
 
405
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
404
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
406 405
 
407 406
 		}
408 407
 	}
@@ -420,21 +419,21 @@  discard block
 block discarded – undo
420 419
  */
421 420
 function give_verify_minimum_price() {
422 421
 
423
-	$amount          = give_maybe_sanitize_amount( $_REQUEST['give-amount'] );
424
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
425
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : null;
426
-	$variable_prices = give_has_variable_prices( $form_id );
422
+	$amount          = give_maybe_sanitize_amount($_REQUEST['give-amount']);
423
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
424
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : null;
425
+	$variable_prices = give_has_variable_prices($form_id);
427 426
 
428
-	if ( $variable_prices && in_array( $price_id, give_get_variable_price_ids( $form_id ) ) ) {
427
+	if ($variable_prices && in_array($price_id, give_get_variable_price_ids($form_id))) {
429 428
 
430
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
429
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
431 430
 
432
-		if ( $price_level_amount == $amount ) {
431
+		if ($price_level_amount == $amount) {
433 432
 			return true;
434 433
 		}
435 434
 	}
436 435
 
437
-	if ( give_get_form_minimum_price( $form_id ) > $amount ) {
436
+	if (give_get_form_minimum_price($form_id) > $amount) {
438 437
 		return false;
439 438
 	}
440 439
 
@@ -450,9 +449,9 @@  discard block
 block discarded – undo
450 449
  */
451 450
 function give_donation_form_validate_agree_to_terms() {
452 451
 	// Validate agree to terms.
453
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
452
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
454 453
 		// User did not agree.
455
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) );
454
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give')));
456 455
 	}
457 456
 }
458 457
 
@@ -466,59 +465,59 @@  discard block
 block discarded – undo
466 465
  *
467 466
  * @return      array
468 467
  */
469
-function give_get_required_fields( $form_id ) {
468
+function give_get_required_fields($form_id) {
470 469
 
471
-	$payment_mode = give_get_chosen_gateway( $form_id );
470
+	$payment_mode = give_get_chosen_gateway($form_id);
472 471
 
473 472
 	$required_fields = array(
474 473
 		'give_email' => array(
475 474
 			'error_id'      => 'invalid_email',
476
-			'error_message' => __( 'Please enter a valid email address.', 'give' ),
475
+			'error_message' => __('Please enter a valid email address.', 'give'),
477 476
 		),
478 477
 		'give_first' => array(
479 478
 			'error_id'      => 'invalid_first_name',
480
-			'error_message' => __( 'Please enter your first name.', 'give' ),
479
+			'error_message' => __('Please enter your first name.', 'give'),
481 480
 		),
482 481
 	);
483 482
 
484
-	$require_address = give_require_billing_address( $payment_mode );
483
+	$require_address = give_require_billing_address($payment_mode);
485 484
 
486
-	if ( $require_address ) {
487
-		$required_fields['card_address']    = array(
485
+	if ($require_address) {
486
+		$required_fields['card_address'] = array(
488 487
 			'error_id'      => 'invalid_card_address',
489
-			'error_message' => __( 'Please enter your primary billing address.', 'give' ),
488
+			'error_message' => __('Please enter your primary billing address.', 'give'),
490 489
 		);
491
-		$required_fields['card_zip']        = array(
490
+		$required_fields['card_zip'] = array(
492 491
 			'error_id'      => 'invalid_zip_code',
493
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' ),
492
+			'error_message' => __('Please enter your zip / postal code.', 'give'),
494 493
 		);
495
-		$required_fields['card_city']       = array(
494
+		$required_fields['card_city'] = array(
496 495
 			'error_id'      => 'invalid_city',
497
-			'error_message' => __( 'Please enter your billing city.', 'give' ),
496
+			'error_message' => __('Please enter your billing city.', 'give'),
498 497
 		);
499 498
 		$required_fields['billing_country'] = array(
500 499
 			'error_id'      => 'invalid_country',
501
-			'error_message' => __( 'Please select your billing country.', 'give' ),
500
+			'error_message' => __('Please select your billing country.', 'give'),
502 501
 		);
503 502
 
504 503
 
505 504
 		$required_fields['card_state'] = array(
506 505
 			'error_id'      => 'invalid_state',
507
-			'error_message' => __( 'Please enter billing state / province / County.', 'give' ),
506
+			'error_message' => __('Please enter billing state / province / County.', 'give'),
508 507
 		);
509 508
 
510 509
 		// Check if billing country already exists.
511
-		if ( ! empty( $_POST['billing_country'] ) ) {
510
+		if ( ! empty($_POST['billing_country'])) {
512 511
 			// Get the value from $_POST.
513
-			$country = sanitize_text_field( $_POST['billing_country'] );
512
+			$country = sanitize_text_field($_POST['billing_country']);
514 513
 
515 514
 			// Get the country list that does not required any states init.
516 515
 			$states_country = give_states_not_required_country_list();
517 516
 
518 517
 			// Check if states is empty or not.
519
-			if ( array_key_exists( $country, $states_country ) ) {
518
+			if (array_key_exists($country, $states_country)) {
520 519
 				// If states is empty remove the required feilds of state in billing cart.
521
-				unset( $required_fields['card_state'] );
520
+				unset($required_fields['card_state']);
522 521
 			}
523 522
 		}
524 523
 	}
@@ -528,7 +527,7 @@  discard block
 block discarded – undo
528 527
 	 *
529 528
 	 * @since 1.7
530 529
 	 */
531
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
530
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
532 531
 
533 532
 	return $required_fields;
534 533
 
@@ -543,16 +542,16 @@  discard block
 block discarded – undo
543 542
  *
544 543
  * @return bool
545 544
  */
546
-function give_require_billing_address( $payment_mode ) {
545
+function give_require_billing_address($payment_mode) {
547 546
 
548 547
 	$return = false;
549 548
 
550
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
549
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
551 550
 		$return = true;
552 551
 	}
553 552
 
554 553
 	// Let payment gateways and other extensions determine if address fields should be required.
555
-	return apply_filters( 'give_require_billing_address', $return );
554
+	return apply_filters('give_require_billing_address', $return);
556 555
 
557 556
 }
558 557
 
@@ -566,38 +565,38 @@  discard block
 block discarded – undo
566 565
 function give_donation_form_validate_logged_in_user() {
567 566
 	global $user_ID;
568 567
 
569
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
568
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
570 569
 
571 570
 	// Start empty array to collect valid user data.
572 571
 	$valid_user_data = array(
573 572
 		// Assume there will be errors.
574
-		'user_id' => - 1,
573
+		'user_id' => -1,
575 574
 	);
576 575
 
577 576
 	// Verify there is a user_ID.
578
-	if ( $user_ID > 0 ) {
577
+	if ($user_ID > 0) {
579 578
 		// Get the logged in user data.
580
-		$user_data = get_userdata( $user_ID );
579
+		$user_data = get_userdata($user_ID);
581 580
 
582 581
 		// Validate Required Form Fields.
583
-		give_validate_required_form_fields( $form_id );
582
+		give_validate_required_form_fields($form_id);
584 583
 
585 584
 		// Verify data.
586
-		if ( $user_data ) {
585
+		if ($user_data) {
587 586
 			// Collected logged in user data.
588 587
 			$valid_user_data = array(
589 588
 				'user_id'    => $user_ID,
590
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
591
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
592
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
589
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
590
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
591
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
593 592
 			);
594 593
 
595
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
596
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
594
+			if ( ! is_email($valid_user_data['user_email'])) {
595
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
597 596
 			}
598 597
 		} else {
599 598
 			// Set invalid user error.
600
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
599
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
601 600
 		}
602 601
 	}
603 602
 
@@ -619,7 +618,7 @@  discard block
 block discarded – undo
619 618
 	// Default user data.
620 619
 	$default_user_data = array(
621 620
 		'give-form-id'           => '',
622
-		'user_id'                => - 1, // Assume there will be errors.
621
+		'user_id'                => -1, // Assume there will be errors.
623 622
 		'user_first'             => '',
624 623
 		'user_last'              => '',
625 624
 		'give_user_login'        => false,
@@ -629,14 +628,14 @@  discard block
 block discarded – undo
629 628
 	);
630 629
 
631 630
 	// Get user data.
632
-	$user_data            = wp_parse_args( give_clean( $_POST ), $default_user_data );
631
+	$user_data            = wp_parse_args(give_clean($_POST), $default_user_data);
633 632
 	$registering_new_user = false;
634
-	$form_id              = absint( $user_data['give-form-id'] );
633
+	$form_id              = absint($user_data['give-form-id']);
635 634
 
636 635
 	// Start an empty array to collect valid user data.
637 636
 	$valid_user_data = array(
638 637
 		// Assume there will be errors.
639
-		'user_id'    => - 1,
638
+		'user_id'    => -1,
640 639
 
641 640
 		// Get first name.
642 641
 		'user_first' => $user_data['give_first'],
@@ -649,13 +648,13 @@  discard block
 block discarded – undo
649 648
 	);
650 649
 
651 650
 	// Validate Required Form Fields.
652
-	give_validate_required_form_fields( $form_id );
651
+	give_validate_required_form_fields($form_id);
653 652
 
654 653
 	// Set Email as Username.
655 654
 	$valid_user_data['user_login'] = $user_data['give_email'];
656 655
 
657 656
 	// Check if we have an email to verify.
658
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
657
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
659 658
 		$valid_user_data['user_email'] = $user_data['give_email'];
660 659
 	}
661 660
 
@@ -674,36 +673,36 @@  discard block
 block discarded – undo
674 673
 	// Start an array to collect valid user data.
675 674
 	$valid_user_data = array(
676 675
 		// Assume there will be errors.
677
-		'user_id' => - 1,
676
+		'user_id' => -1,
678 677
 	);
679 678
 
680 679
 	// Username.
681
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
682
-		give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) );
680
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
681
+		give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give'));
683 682
 
684 683
 		return $valid_user_data;
685 684
 	}
686 685
 
687 686
 	// Get the user by login.
688
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
687
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
689 688
 
690 689
 	// Check if user exists.
691
-	if ( $user_data ) {
690
+	if ($user_data) {
692 691
 		// Get password.
693
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
692
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
694 693
 
695 694
 		// Check user_pass.
696
-		if ( $user_pass ) {
695
+		if ($user_pass) {
697 696
 			// Check if password is valid.
698
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
697
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
699 698
 				// Incorrect password.
700 699
 				give_set_error(
701 700
 					'password_incorrect',
702 701
 					sprintf(
703 702
 						'%1$s <a href="%2$s">%3$s</a>',
704
-						__( 'The password you entered is incorrect.', 'give' ),
705
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
706
-						__( 'Reset Password', 'give' )
703
+						__('The password you entered is incorrect.', 'give'),
704
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
705
+						__('Reset Password', 'give')
707 706
 					)
708 707
 				);
709 708
 				// All is correct.
@@ -721,11 +720,11 @@  discard block
 block discarded – undo
721 720
 			}
722 721
 		} else {
723 722
 			// Empty password.
724
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
723
+			give_set_error('password_empty', __('Enter a password.', 'give'));
725 724
 		}
726 725
 	} else {
727 726
 		// No username.
728
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
727
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
729 728
 	}// End if().
730 729
 
731 730
 	return $valid_user_data;
@@ -740,7 +739,7 @@  discard block
 block discarded – undo
740 739
  */
741 740
 function give_donation_form_validate_guest_user() {
742 741
 
743
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
742
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
744 743
 
745 744
 	// Start an array to collect valid user data.
746 745
 	$valid_user_data = array(
@@ -749,31 +748,31 @@  discard block
 block discarded – undo
749 748
 	);
750 749
 
751 750
 	// Get the guest email.
752
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
751
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
753 752
 
754 753
 	// Check email.
755
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
754
+	if ($guest_email && strlen($guest_email) > 0) {
756 755
 		// Validate email.
757
-		if ( ! is_email( $guest_email ) ) {
756
+		if ( ! is_email($guest_email)) {
758 757
 			// Invalid email.
759
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
758
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
760 759
 		} else {
761 760
 			// All is good to go.
762 761
 			$valid_user_data['user_email'] = $guest_email;
763 762
 
764 763
 			// Get user_id from donor if exist.
765
-			$donor = new Give_Donor( $guest_email );
766
-			if ( $donor->id && $donor->user_id ) {
764
+			$donor = new Give_Donor($guest_email);
765
+			if ($donor->id && $donor->user_id) {
767 766
 				$valid_user_data['user_id'] = $donor->user_id;
768 767
 			}
769 768
 		}
770 769
 	} else {
771 770
 		// No email.
772
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
771
+		give_set_error('email_empty', __('Enter an email.', 'give'));
773 772
 	}
774 773
 
775 774
 	// Validate Required Form Fields.
776
-	give_validate_required_form_fields( $form_id );
775
+	give_validate_required_form_fields($form_id);
777 776
 
778 777
 	return $valid_user_data;
779 778
 }
@@ -787,36 +786,36 @@  discard block
 block discarded – undo
787 786
  * @since   1.0
788 787
  * @return  integer
789 788
  */
790
-function give_register_and_login_new_user( $user_data = array() ) {
789
+function give_register_and_login_new_user($user_data = array()) {
791 790
 	// Verify the array.
792
-	if ( empty( $user_data ) ) {
793
-		return - 1;
791
+	if (empty($user_data)) {
792
+		return -1;
794 793
 	}
795 794
 
796
-	if ( give_get_errors() ) {
797
-		return - 1;
795
+	if (give_get_errors()) {
796
+		return -1;
798 797
 	}
799 798
 
800
-	$user_args = apply_filters( 'give_insert_user_args', array(
801
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
802
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
803
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
804
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
805
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
806
-		'user_registered' => date( 'Y-m-d H:i:s' ),
807
-		'role'            => give_get_option( 'donor_default_user_role', 'give_donor' ),
808
-	), $user_data );
799
+	$user_args = apply_filters('give_insert_user_args', array(
800
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
801
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
802
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
803
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
804
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
805
+		'user_registered' => date('Y-m-d H:i:s'),
806
+		'role'            => give_get_option('donor_default_user_role', 'give_donor'),
807
+	), $user_data);
809 808
 
810 809
 	// Insert new user.
811
-	$user_id = wp_insert_user( $user_args );
810
+	$user_id = wp_insert_user($user_args);
812 811
 
813 812
 	// Validate inserted user.
814
-	if ( is_wp_error( $user_id ) ) {
815
-		return - 1;
813
+	if (is_wp_error($user_id)) {
814
+		return -1;
816 815
 	}
817 816
 
818 817
 	// Allow themes and plugins to filter the user data.
819
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
818
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
820 819
 
821 820
 	/**
822 821
 	 * Fires after inserting user.
@@ -826,7 +825,7 @@  discard block
 block discarded – undo
826 825
 	 * @param int $user_id User id.
827 826
 	 * @param array $user_data Array containing user data.
828 827
 	 */
829
-	do_action( 'give_insert_user', $user_id, $user_data );
828
+	do_action('give_insert_user', $user_id, $user_data);
830 829
 
831 830
 	/**
832 831
 	 * Filter allow user to alter if user when to login or not when user is register for the first time.
@@ -835,9 +834,9 @@  discard block
 block discarded – undo
835 834
 	 *
836 835
 	 * return bool True if login with registration and False if only want to register.
837 836
 	 */
838
-	if ( true === (bool) apply_filters( 'give_log_user_in_on_register', true ) ) {
837
+	if (true === (bool) apply_filters('give_log_user_in_on_register', true)) {
839 838
 		// Login new user.
840
-		give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
839
+		give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
841 840
 	}
842 841
 
843 842
 	// Return user id.
@@ -853,27 +852,27 @@  discard block
 block discarded – undo
853 852
  * @since   1.0
854 853
  * @return  array|bool
855 854
  */
856
-function give_get_donation_form_user( $valid_data = array() ) {
855
+function give_get_donation_form_user($valid_data = array()) {
857 856
 
858 857
 	// Initialize user.
859 858
 	$user    = false;
860
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
859
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
861 860
 
862
-	if ( $is_ajax ) {
861
+	if ($is_ajax) {
863 862
 		// Do not create or login the user during the ajax submission (check for errors only).
864 863
 		return true;
865
-	} elseif ( is_user_logged_in() ) {
864
+	} elseif (is_user_logged_in()) {
866 865
 		// Set the valid user as the logged in collected data.
867 866
 		$user = $valid_data['logged_in_user'];
868
-	} elseif ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
867
+	} elseif ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
869 868
 		// New user registration.
870
-		if ( $valid_data['need_new_user'] === true ) {
869
+		if ($valid_data['need_new_user'] === true) {
871 870
 			// Set user.
872 871
 			$user = $valid_data['new_user_data'];
873 872
 			// Register and login new user.
874
-			$user['user_id'] = give_register_and_login_new_user( $user );
873
+			$user['user_id'] = give_register_and_login_new_user($user);
875 874
 			// User login
876
-		} elseif ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
875
+		} elseif ($valid_data['need_user_login'] === true && ! $is_ajax) {
877 876
 
878 877
 			/**
879 878
 			 * The login form is now processed in the give_process_donation_login() function.
@@ -885,42 +884,42 @@  discard block
 block discarded – undo
885 884
 			// Set user.
886 885
 			$user = $valid_data['login_user_data'];
887 886
 			// Login user.
888
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
887
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
889 888
 		}
890 889
 	}
891 890
 
892 891
 	// Check guest checkout.
893
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
892
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
894 893
 		// Set user
895 894
 		$user = $valid_data['guest_user_data'];
896 895
 	}
897 896
 
898 897
 	// Verify we have an user.
899
-	if ( false === $user || empty( $user ) ) {
898
+	if (false === $user || empty($user)) {
900 899
 		// Return false.
901 900
 		return false;
902 901
 	}
903 902
 
904 903
 	// Get user first name.
905
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
906
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
904
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
905
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
907 906
 	}
908 907
 
909 908
 	// Get user last name.
910
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
911
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
909
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
910
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
912 911
 	}
913 912
 
914 913
 	// Get the user's billing address details.
915 914
 	$user['address']            = array();
916
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? give_clean( $_POST['card_address'] ) : false;
917
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? give_clean( $_POST['card_address_2'] ) : false;
918
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? give_clean( $_POST['card_city'] ) : false;
919
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? give_clean( $_POST['card_state'] ) : false;
920
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? give_clean( $_POST['card_zip'] ) : false;
921
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : false;
922
-
923
-	if ( empty( $user['address']['country'] ) ) {
915
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? give_clean($_POST['card_address']) : false;
916
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? give_clean($_POST['card_address_2']) : false;
917
+	$user['address']['city']    = ! empty($_POST['card_city']) ? give_clean($_POST['card_city']) : false;
918
+	$user['address']['state']   = ! empty($_POST['card_state']) ? give_clean($_POST['card_state']) : false;
919
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? give_clean($_POST['card_zip']) : false;
920
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : false;
921
+
922
+	if (empty($user['address']['country'])) {
924 923
 		$user['address'] = false;
925 924
 	} // End if().
926 925
 
@@ -940,16 +939,16 @@  discard block
 block discarded – undo
940 939
 	$card_data = give_get_donation_cc_info();
941 940
 
942 941
 	// Validate the card zip.
943
-	if ( ! empty( $card_data['card_zip'] ) ) {
944
-		if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
945
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
942
+	if ( ! empty($card_data['card_zip'])) {
943
+		if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
944
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
946 945
 		}
947 946
 	}
948 947
 
949 948
 	// Ensure no spaces.
950
-	if ( ! empty( $card_data['card_number'] ) ) {
951
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs
952
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
949
+	if ( ! empty($card_data['card_number'])) {
950
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs
951
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
953 952
 	}
954 953
 
955 954
 	// This should validate card numbers at some point too.
@@ -966,17 +965,17 @@  discard block
 block discarded – undo
966 965
 function give_get_donation_cc_info() {
967 966
 
968 967
 	$cc_info                   = array();
969
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
970
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
971
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
972
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
973
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
974
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
975
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
976
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
977
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
978
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
979
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
968
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
969
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
970
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
971
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
972
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
973
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
974
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
975
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
976
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
977
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
978
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
980 979
 
981 980
 	// Return cc info.
982 981
 	return $cc_info;
@@ -992,14 +991,14 @@  discard block
 block discarded – undo
992 991
  *
993 992
  * @return bool|mixed
994 993
  */
995
-function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
994
+function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') {
996 995
 	$ret = false;
997 996
 
998
-	if ( empty( $zip ) || empty( $country_code ) ) {
997
+	if (empty($zip) || empty($country_code)) {
999 998
 		return $ret;
1000 999
 	}
1001 1000
 
1002
-	$country_code = strtoupper( $country_code );
1001
+	$country_code = strtoupper($country_code);
1003 1002
 
1004 1003
 	$zip_regex = array(
1005 1004
 		'AD' => 'AD\d{3}',
@@ -1159,11 +1158,11 @@  discard block
 block discarded – undo
1159 1158
 		'ZM' => '\d{5}',
1160 1159
 	);
1161 1160
 
1162
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1161
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1163 1162
 		$ret = true;
1164 1163
 	}
1165 1164
 
1166
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1165
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1167 1166
 }
1168 1167
 
1169 1168
 
@@ -1177,47 +1176,47 @@  discard block
 block discarded – undo
1177 1176
  *
1178 1177
  * @return bool
1179 1178
  */
1180
-function give_validate_donation_amount( $valid_data, $data ) {
1179
+function give_validate_donation_amount($valid_data, $data) {
1181 1180
 	/* @var Give_Donate_Form $form */
1182
-	$form = new Give_Donate_Form( $data['give-form-id'] );
1181
+	$form = new Give_Donate_Form($data['give-form-id']);
1183 1182
 
1184 1183
 	$donation_level_matched = false;
1185 1184
 
1186
-	if ( $form->is_set_type_donation_form() ) {
1185
+	if ($form->is_set_type_donation_form()) {
1187 1186
 		// Sanitize donation amount.
1188
-		$data['give-amount'] = give_maybe_sanitize_amount( $data['give-amount'] );
1187
+		$data['give-amount'] = give_maybe_sanitize_amount($data['give-amount']);
1189 1188
 
1190 1189
 		// Backward compatibility.
1191
-		if ( $form->is_custom_price( $data['give-amount'] ) ) {
1190
+		if ($form->is_custom_price($data['give-amount'])) {
1192 1191
 			$_POST['give-price-id'] = 'custom';
1193 1192
 		}
1194 1193
 
1195 1194
 		$donation_level_matched = true;
1196 1195
 
1197
-	} elseif ( $form->is_multi_type_donation_form() ) {
1196
+	} elseif ($form->is_multi_type_donation_form()) {
1198 1197
 
1199 1198
 		// Bailout.
1200
-		if ( ! ( $variable_prices = $form->get_prices() ) ) {
1199
+		if ( ! ($variable_prices = $form->get_prices())) {
1201 1200
 			return false;
1202 1201
 		}
1203 1202
 
1204 1203
 		// Sanitize donation amount.
1205
-		$data['give-amount'] = give_maybe_sanitize_amount( $data['give-amount'] );
1204
+		$data['give-amount'] = give_maybe_sanitize_amount($data['give-amount']);
1206 1205
 
1207
-		if ( $data['give-amount'] === give_maybe_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ) ) ) {
1206
+		if ($data['give-amount'] === give_maybe_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']))) {
1208 1207
 			return true;
1209 1208
 		}
1210 1209
 
1211
-		if ( $form->is_custom_price( $data['give-amount'] ) ) {
1210
+		if ($form->is_custom_price($data['give-amount'])) {
1212 1211
 			$_POST['give-price-id'] = 'custom';
1213 1212
 		} else {
1214 1213
 			// Find correct donation level from all donation levels.
1215
-			foreach ( $variable_prices as $variable_price ) {
1214
+			foreach ($variable_prices as $variable_price) {
1216 1215
 				// Sanitize level amount.
1217
-				$variable_price['_give_amount'] = give_maybe_sanitize_amount( $variable_price['_give_amount'] );
1216
+				$variable_price['_give_amount'] = give_maybe_sanitize_amount($variable_price['_give_amount']);
1218 1217
 
1219 1218
 				// Set first match donation level ID.
1220
-				if ( $data['give-amount'] === $variable_price['_give_amount'] ) {
1219
+				if ($data['give-amount'] === $variable_price['_give_amount']) {
1221 1220
 					$_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1222 1221
 					break;
1223 1222
 				}
@@ -1226,15 +1225,15 @@  discard block
 block discarded – undo
1226 1225
 
1227 1226
 		// If donation amount is not find in donation levels then check if form has custom donation feature enable or not.
1228 1227
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1229
-		if ( ! empty( $_POST['give-price-id'] ) ) {
1228
+		if ( ! empty($_POST['give-price-id'])) {
1230 1229
 			$donation_level_matched = true;
1231 1230
 		}
1232 1231
 	}// End if().
1233 1232
 
1234
-	return ( $donation_level_matched ? true : false );
1233
+	return ($donation_level_matched ? true : false);
1235 1234
 }
1236 1235
 
1237
-add_action( 'give_checkout_error_checks', 'give_validate_donation_amount', 10, 2 );
1236
+add_action('give_checkout_error_checks', 'give_validate_donation_amount', 10, 2);
1238 1237
 
1239 1238
 /**
1240 1239
  * Validate Required Form Fields.
@@ -1243,17 +1242,17 @@  discard block
 block discarded – undo
1243 1242
  *
1244 1243
  * @since 2.0
1245 1244
  */
1246
-function give_validate_required_form_fields( $form_id ) {
1245
+function give_validate_required_form_fields($form_id) {
1247 1246
 
1248 1247
 	// Loop through required fields and show error messages.
1249
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
1248
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
1250 1249
 
1251 1250
 		// Clean Up Data of the input fields.
1252
-		$field_value = give_clean( $_POST[ $field_name ] );
1251
+		$field_value = give_clean($_POST[$field_name]);
1253 1252
 
1254 1253
 		// Check whether the required field is empty, then show the error message.
1255
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $field_value ) ) {
1256
-			give_set_error( $value['error_id'], $value['error_message'] );
1254
+		if (in_array($value, give_get_required_fields($form_id)) && empty($field_value)) {
1255
+			give_set_error($value['error_id'], $value['error_message']);
1257 1256
 		}
1258 1257
 	}
1259 1258
 }
Please login to merge, or discard this patch.
includes/import-functions.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -666,6 +666,7 @@
 block discarded – undo
666 666
  * Check if Import donation is duplicate
667 667
  *
668 668
  * @since 1.8.13
669
+ * @param Give_Donate_Form $form
669 670
  */
670 671
 function give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data ) {
671 672
 	$return = false;
Please login to merge, or discard this patch.
Spacing   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.8.13
21 21
  */
22 22
 function give_import_donation_report() {
23
-	return get_option( 'give_import_donation_report', array() );
23
+	return get_option('give_import_donation_report', array());
24 24
 }
25 25
 
26 26
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @since 1.8.13
31 31
  */
32
-function give_import_donation_report_update( $value = array() ) {
33
-	update_option( 'give_import_donation_report', $value );
32
+function give_import_donation_report_update($value = array()) {
33
+	update_option('give_import_donation_report', $value);
34 34
 }
35 35
 
36 36
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  * @since 1.8.13
41 41
  */
42 42
 function give_import_donation_report_reset() {
43
-	update_option( 'give_import_donation_report', array() );
43
+	update_option('give_import_donation_report', array());
44 44
 }
45 45
 
46 46
 /**
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  *
53 53
  * @return array|bool|Give_Donate_Form|int|null|WP_Post
54 54
  */
55
-function give_import_get_form_data_from_csv( $data, $import_setting = array() ) {
55
+function give_import_get_form_data_from_csv($data, $import_setting = array()) {
56 56
 	$new_form = false;
57 57
 
58 58
 	// Get the import report
@@ -61,58 +61,58 @@  discard block
 block discarded – undo
61 61
 	$form = false;
62 62
 	$meta = array();
63 63
 
64
-	if ( ! empty( $data['form_id'] ) ) {
65
-		$form = new Give_Donate_Form( $data['form_id'] );
64
+	if ( ! empty($data['form_id'])) {
65
+		$form = new Give_Donate_Form($data['form_id']);
66 66
 		// Add support to older php version.
67 67
 		$form_id = $form->get_ID();
68
-		if ( empty( $form_id ) ) {
69
-			$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
68
+		if (empty($form_id)) {
69
+			$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
70 70
 			$form                     = false;
71 71
 		}
72 72
 	}
73 73
 
74
-	if ( false === $form && ! empty( $data['form_title'] ) ) {
75
-		$form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' );
74
+	if (false === $form && ! empty($data['form_title'])) {
75
+		$form = get_page_by_title($data['form_title'], OBJECT, 'give_forms');
76 76
 
77
-		if ( ! empty( $form->ID ) ) {
77
+		if ( ! empty($form->ID)) {
78 78
 
79
-			$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
79
+			$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
80 80
 
81
-			$form = new Give_Donate_Form( $form->ID );
81
+			$form = new Give_Donate_Form($form->ID);
82 82
 		} else {
83 83
 			$form                  = new Give_Donate_Form();
84 84
 			$args                  = array(
85 85
 				'post_title'  => $data['form_title'],
86 86
 				'post_status' => 'publish',
87 87
 			);
88
-			$form                  = $form->create( $args );
89
-			$report['create_form'] = ( ! empty( $report['create_form'] ) ? ( absint( $report['create_form'] ) + 1 ) : 1 );
88
+			$form                  = $form->create($args);
89
+			$report['create_form'] = ( ! empty($report['create_form']) ? (absint($report['create_form']) + 1) : 1);
90 90
 			$new_form              = true;
91 91
 
92 92
 		}
93 93
 
94
-		$form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' );
95
-		$form = new Give_Donate_Form( $form->ID );
94
+		$form = get_page_by_title($data['form_title'], OBJECT, 'give_forms');
95
+		$form = new Give_Donate_Form($form->ID);
96 96
 	}
97 97
 
98
-	if ( ! empty( $form ) && $form->get_ID() ) {
99
-		if ( ! empty( $data['form_level'] ) && 'custom' != (string) strtolower( $data['form_level'] ) ) {
98
+	if ( ! empty($form) && $form->get_ID()) {
99
+		if ( ! empty($data['form_level']) && 'custom' != (string) strtolower($data['form_level'])) {
100 100
 			$prices     = (array) $form->get_prices();
101 101
 			$price_text = array();
102
-			foreach ( $prices as $key => $price ) {
103
-				if ( isset( $price['_give_id']['level_id'] ) ) {
104
-					$price_text[ $price['_give_id']['level_id'] ] = ( ! empty( $price['_give_text'] ) ? $price['_give_text'] : '' );
102
+			foreach ($prices as $key => $price) {
103
+				if (isset($price['_give_id']['level_id'])) {
104
+					$price_text[$price['_give_id']['level_id']] = ( ! empty($price['_give_text']) ? $price['_give_text'] : '');
105 105
 				}
106 106
 			}
107 107
 
108
-			if ( ! in_array( $data['form_level'], $price_text ) ) {
108
+			if ( ! in_array($data['form_level'], $price_text)) {
109 109
 
110 110
 				// For generating unquiet level id.
111 111
 				$count     = 1;
112
-				$new_level = count( $prices ) + $count;
113
-				while ( array_key_exists( $new_level, $price_text ) ) {
114
-					$count ++;
115
-					$new_level = count( $prices ) + $count;
112
+				$new_level = count($prices) + $count;
113
+				while (array_key_exists($new_level, $price_text)) {
114
+					$count++;
115
+					$new_level = count($prices) + $count;
116 116
 				}
117 117
 
118 118
 				$multi_level_donations = array(
@@ -120,57 +120,57 @@  discard block
 block discarded – undo
120 120
 						'_give_id'     => array(
121 121
 							'level_id' => $new_level,
122 122
 						),
123
-						'_give_amount' => give_sanitize_amount_for_db( $data['amount'] ),
123
+						'_give_amount' => give_sanitize_amount_for_db($data['amount']),
124 124
 						'_give_text'   => $data['form_level'],
125 125
 					),
126 126
 				);
127 127
 
128
-				$price_text[ $new_level ] = $data['form_level'];
128
+				$price_text[$new_level] = $data['form_level'];
129 129
 
130
-				if ( ! empty( $prices ) && is_array( $prices ) && ! empty( $prices[0] ) ) {
131
-					$prices = wp_parse_args( $multi_level_donations, $prices );
130
+				if ( ! empty($prices) && is_array($prices) && ! empty($prices[0])) {
131
+					$prices = wp_parse_args($multi_level_donations, $prices);
132 132
 
133 133
 					// Sort $prices by amount in ascending order.
134
-					$prices = wp_list_sort( $prices, '_give_amount', 'ASC' );
134
+					$prices = wp_list_sort($prices, '_give_amount', 'ASC');
135 135
 				} else {
136 136
 					$prices = $multi_level_donations;
137 137
 				}
138 138
 
139 139
 				// Unset _give_default key from $prices.
140
-				foreach ( $prices as $key => $price ) {
141
-					if ( isset( $prices[ $key ]['_give_default'] ) ) {
142
-						unset( $prices[ $key ]['_give_default'] );
140
+				foreach ($prices as $key => $price) {
141
+					if (isset($prices[$key]['_give_default'])) {
142
+						unset($prices[$key]['_give_default']);
143 143
 					}
144 144
 				}
145 145
 
146 146
 				// Set the first $price of the $prices as defalut.
147 147
 				$prices[0]['_give_default'] = 'default';
148 148
 			}
149
-			$form->price_id = array_search( $data['form_level'], $price_text );
149
+			$form->price_id = array_search($data['form_level'], $price_text);
150 150
 
151
-			$donation_levels_amounts = wp_list_pluck( $prices, '_give_amount' );
152
-			$min_amount              = min( $donation_levels_amounts );
153
-			$max_amount              = max( $donation_levels_amounts );
151
+			$donation_levels_amounts = wp_list_pluck($prices, '_give_amount');
152
+			$min_amount              = min($donation_levels_amounts);
153
+			$max_amount              = max($donation_levels_amounts);
154 154
 
155 155
 			$meta = array(
156 156
 				'_give_levels_minimum_amount' => $min_amount,
157 157
 				'_give_levels_maximum_amount' => $max_amount,
158 158
 				'_give_price_option'          => 'multi',
159
-				'_give_donation_levels'       => array_values( $prices ),
159
+				'_give_donation_levels'       => array_values($prices),
160 160
 			);
161 161
 		} else {
162 162
 			$form->price_id = 'custom';
163 163
 		}
164 164
 
165 165
 		$defaults = array(
166
-			'_give_set_price'    => give_sanitize_amount_for_db( $data['amount'] ),
166
+			'_give_set_price'    => give_sanitize_amount_for_db($data['amount']),
167 167
 			'_give_price_option' => 'set',
168 168
 		);
169 169
 
170 170
 		// If new form is created.
171
-		if ( ! empty( $new_form ) ) {
171
+		if ( ! empty($new_form)) {
172 172
 			$new_form = array(
173
-				'_give_custom_amount_text' => ( ! empty( $data['form_custom_amount_text'] ) ? $data['form_custom_amount_text'] : 'Custom' ),
173
+				'_give_custom_amount_text' => ( ! empty($data['form_custom_amount_text']) ? $data['form_custom_amount_text'] : 'Custom'),
174 174
 				'_give_logged_in_only'     => 'enabled',
175 175
 				'_give_custom_amount'      => 'enabled',
176 176
 				'_give_payment_import'     => true,
@@ -181,18 +181,18 @@  discard block
 block discarded – undo
181 181
 				'_give_default_gateway'    => 'global',
182 182
 				'_give_show_register_form' => 'both',
183 183
 			);
184
-			$defaults = wp_parse_args( $defaults, $new_form );
184
+			$defaults = wp_parse_args($defaults, $new_form);
185 185
 		}
186 186
 
187
-		$meta = wp_parse_args( $meta, $defaults );
187
+		$meta = wp_parse_args($meta, $defaults);
188 188
 
189
-		foreach ( $meta as $key => $value ) {
190
-			give_update_meta( $form->get_ID(), $key, $value );
189
+		foreach ($meta as $key => $value) {
190
+			give_update_meta($form->get_ID(), $key, $value);
191 191
 		}
192 192
 	}
193 193
 
194 194
 	// update the report
195
-	give_import_donation_report_update( $report );
195
+	give_import_donation_report_update($report);
196 196
 
197 197
 	return $form;
198 198
 }
@@ -206,30 +206,30 @@  discard block
 block discarded – undo
206 206
  *
207 207
  * @return bool|false|WP_User
208 208
  */
209
-function give_import_get_user_from_csv( $data, $import_setting = array() ) {
209
+function give_import_get_user_from_csv($data, $import_setting = array()) {
210 210
 	$report     = give_import_donation_report();
211 211
 	$donor_data = false;
212 212
 	$donor_id   = false;
213 213
 
214 214
 	// check if donor id is not empty
215
-	if ( ! empty( $data['donor_id'] ) ) {
216
-		$donor_data = new Give_Donor( (int) $data['donor_id'] );
217
-		if ( ! empty( $donor_data->id ) ) {
218
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
215
+	if ( ! empty($data['donor_id'])) {
216
+		$donor_data = new Give_Donor((int) $data['donor_id']);
217
+		if ( ! empty($donor_data->id)) {
218
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
219 219
 		}
220 220
 	}
221 221
 
222
-	if ( empty( $donor_data->id ) && ! empty( $data['user_id'] ) ) {
222
+	if (empty($donor_data->id) && ! empty($data['user_id'])) {
223 223
 		$user_id    = (int) $data['user_id'];
224
-		$donor_data = new Give_Donor( $user_id, true );
224
+		$donor_data = new Give_Donor($user_id, true);
225 225
 
226 226
 
227
-		if ( empty( $donor_data->id ) ) {
228
-			$donor_data = get_user_by( 'id', $user_id );
229
-			if ( ! empty( $donor_data->ID ) ) {
230
-				$first_name = ( ! empty( $data['first_name'] ) ? $data['first_name'] : $donor_data->user_nicename );
231
-				$last_name  = ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ( $lastname = get_user_meta( $donor_data->ID, 'last_name', true ) ) ? $lastname : '' ) );
232
-				$name       = $first_name . ' ' . $last_name;
227
+		if (empty($donor_data->id)) {
228
+			$donor_data = get_user_by('id', $user_id);
229
+			if ( ! empty($donor_data->ID)) {
230
+				$first_name = ( ! empty($data['first_name']) ? $data['first_name'] : $donor_data->user_nicename);
231
+				$last_name  = ( ! empty($data['last_name']) ? $data['last_name'] : (($lastname = get_user_meta($donor_data->ID, 'last_name', true)) ? $lastname : ''));
232
+				$name       = $first_name.' '.$last_name;
233 233
 				$user_email = $donor_data->user_email;
234 234
 				$donor_args = array(
235 235
 					'name'    => $name,
@@ -238,45 +238,45 @@  discard block
 block discarded – undo
238 238
 				);
239 239
 
240 240
 				$donor_data = new Give_Donor();
241
-				$donor_data->create( $donor_args );
241
+				$donor_data->create($donor_args);
242 242
 
243 243
 				// Adding notes that donor is being imported from CSV.
244 244
 				$current_user = wp_get_current_user();
245
-				$donor_data->add_note( esc_html( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) ) );
245
+				$donor_data->add_note(esc_html(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email)));
246 246
 
247 247
 				// Add is used to ensure duplicate emails are not added
248
-				if ( $user_email != $data['email'] && ! empty( $data['email'] ) ) {
249
-					$donor_data->add_meta( 'additional_email', $data['email'] );
248
+				if ($user_email != $data['email'] && ! empty($data['email'])) {
249
+					$donor_data->add_meta('additional_email', $data['email']);
250 250
 				}
251 251
 
252
-				$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
252
+				$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
253 253
 			}
254 254
 		} else {
255 255
 			// Add is used to ensure duplicate emails are not added
256
-			if ( $donor_data->email != $data['email'] ) {
257
-				$donor_data->add_meta( 'additional_email', ( ! empty( $data['email'] ) ? $data['email'] : $donor_data->email ) );
256
+			if ($donor_data->email != $data['email']) {
257
+				$donor_data->add_meta('additional_email', ( ! empty($data['email']) ? $data['email'] : $donor_data->email));
258 258
 			}
259
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
259
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
260 260
 		}
261 261
 	}
262 262
 
263
-	if ( empty( $donor_data->id ) && ! empty( $data['email'] ) ) {
263
+	if (empty($donor_data->id) && ! empty($data['email'])) {
264 264
 
265
-		$donor_data = new Give_Donor( $data['email'] );
266
-		if ( empty( $donor_data->id ) ) {
267
-			$donor_data = get_user_by( 'email', $data['email'] );
265
+		$donor_data = new Give_Donor($data['email']);
266
+		if (empty($donor_data->id)) {
267
+			$donor_data = get_user_by('email', $data['email']);
268 268
 
269
-			if ( empty( $donor_data->ID ) && isset( $import_setting['create_user'] ) && 1 === absint( $import_setting['create_user'] ) ) {
270
-				$data['first_name'] = ( ! empty( $data['first_name'] ) ? $data['first_name'] : $data['email'] );
271
-				$data['last_name'] = ( ! empty( $data['last_name'] ) ? $data['last_name'] : '' );
272
-				$give_role         = (array) give_get_option( 'donor_default_user_role', get_option( 'default_role', ( ( $give_donor = wp_roles()->is_role( 'give_donor' ) ) && ! empty( $give_donor ) ? 'give_donor' : 'subscriber' ) ) );
269
+			if (empty($donor_data->ID) && isset($import_setting['create_user']) && 1 === absint($import_setting['create_user'])) {
270
+				$data['first_name'] = ( ! empty($data['first_name']) ? $data['first_name'] : $data['email']);
271
+				$data['last_name'] = ( ! empty($data['last_name']) ? $data['last_name'] : '');
272
+				$give_role         = (array) give_get_option('donor_default_user_role', get_option('default_role', (($give_donor = wp_roles()->is_role('give_donor')) && ! empty($give_donor) ? 'give_donor' : 'subscriber')));
273 273
 				$donor_args        = array(
274 274
 					'user_login'      => $data['email'],
275 275
 					'user_email'      => $data['email'],
276
-					'user_registered' => date( 'Y-m-d H:i:s' ),
276
+					'user_registered' => date('Y-m-d H:i:s'),
277 277
 					'user_first'      => $data['first_name'],
278 278
 					'user_last'       => $data['last_name'],
279
-					'user_pass'       => wp_generate_password( 8, true ),
279
+					'user_pass'       => wp_generate_password(8, true),
280 280
 					'role'            => $give_role,
281 281
 				);
282 282
 
@@ -285,55 +285,55 @@  discard block
 block discarded – undo
285 285
 				 *
286 286
 				 * @since 1.8.13
287 287
 				 */
288
-				$donor_args = (array) apply_filters( 'give_import_insert_user_args', $donor_args, $data, $import_setting );
288
+				$donor_args = (array) apply_filters('give_import_insert_user_args', $donor_args, $data, $import_setting);
289 289
 
290 290
 				// This action was added to remove the login when using the give register function.
291
-				add_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 );
292
-				$donor_id = give_register_and_login_new_user( $donor_args );
293
-				remove_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 );
291
+				add_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11);
292
+				$donor_id = give_register_and_login_new_user($donor_args);
293
+				remove_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11);
294 294
 
295
-				update_user_meta( $donor_id, '_give_payment_import', true );
296
-				$donor_data = new Give_Donor( $donor_id, true );
295
+				update_user_meta($donor_id, '_give_payment_import', true);
296
+				$donor_data = new Give_Donor($donor_id, true);
297 297
 			} else {
298
-				$donor_id = ( ! empty( $donor_data->ID ) ? $donor_data->ID : false );
298
+				$donor_id = ( ! empty($donor_data->ID) ? $donor_data->ID : false);
299 299
 			}
300 300
 
301
-			if ( ! empty( $donor_id ) || ( isset( $import_setting['create_user'] ) && 0 === absint( $import_setting['create_user'] ) ) ) {
302
-				$donor_data = new Give_Donor( $donor_id, true );
301
+			if ( ! empty($donor_id) || (isset($import_setting['create_user']) && 0 === absint($import_setting['create_user']))) {
302
+				$donor_data = new Give_Donor($donor_id, true);
303 303
 
304
-				if ( empty( $donor_data->id ) ) {
304
+				if (empty($donor_data->id)) {
305 305
 
306
-					if ( ! empty( $data['form_id'] ) ) {
307
-						$form = new Give_Donate_Form( $data['form_id'] );
306
+					if ( ! empty($data['form_id'])) {
307
+						$form = new Give_Donate_Form($data['form_id']);
308 308
 					}
309 309
 
310
-					$payment_title = ( isset( $data['form_title'] ) ? $data['form_title'] : ( isset( $form ) ? $form->get_name() : esc_html__( 'New Form', 'give' ) ) );
310
+					$payment_title = (isset($data['form_title']) ? $data['form_title'] : (isset($form) ? $form->get_name() : esc_html__('New Form', 'give')));
311 311
 					$donor_args    = array(
312
-						'name'  => ! is_email( $payment_title ) ? $data['first_name'] . ' ' . $data['last_name'] : '',
312
+						'name'  => ! is_email($payment_title) ? $data['first_name'].' '.$data['last_name'] : '',
313 313
 						'email' => $data['email'],
314 314
 					);
315 315
 
316
-					if ( ! empty( $donor_id ) ) {
316
+					if ( ! empty($donor_id)) {
317 317
 						$donor_args['user_id'] = $donor_id;
318 318
 					}
319 319
 
320
-					$donor_data->create( $donor_args );
320
+					$donor_data->create($donor_args);
321 321
 
322 322
 					// Adding notes that donor is being imported from CSV.
323 323
 					$current_user = wp_get_current_user();
324
-					$donor_data->add_note( esc_html( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) ) );
324
+					$donor_data->add_note(esc_html(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email)));
325 325
 
326
-					$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
326
+					$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
327 327
 				} else {
328
-					$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
328
+					$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
329 329
 				}
330 330
 			}
331 331
 		} else {
332
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
332
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
333 333
 		}
334 334
 	}
335 335
 	// update the report
336
-	give_import_donation_report_update( $report );
336
+	give_import_donation_report_update($report);
337 337
 
338 338
 	return $donor_data;
339 339
 }
@@ -351,9 +351,9 @@  discard block
 block discarded – undo
351 351
 	 *
352 352
 	 * @return array
353 353
 	 */
354
-	return (array) apply_filters( 'give_import_default_options', array(
355
-		'' => __( 'Do not import', 'give' ),
356
-	) );
354
+	return (array) apply_filters('give_import_default_options', array(
355
+		'' => __('Do not import', 'give'),
356
+	));
357 357
 }
358 358
 
359 359
 /**
@@ -369,62 +369,62 @@  discard block
 block discarded – undo
369 369
 	 *
370 370
 	 * @return array
371 371
 	 */
372
-	return (array) apply_filters( 'give_import_donations_options', array(
373
-		'id'          => __( 'Donation ID', 'give' ),
372
+	return (array) apply_filters('give_import_donations_options', array(
373
+		'id'          => __('Donation ID', 'give'),
374 374
 		'amount'      => array(
375
-			__( 'Donation Amount', 'give' ),
376
-			__( 'Amount', 'give' )
375
+			__('Donation Amount', 'give'),
376
+			__('Amount', 'give')
377 377
 		),
378 378
 		'post_date'   => array(
379
-			__( 'Donation Date', 'give' ),
380
-			__( 'Date', 'give' ),
379
+			__('Donation Date', 'give'),
380
+			__('Date', 'give'),
381 381
 		),
382 382
 		'first_name'  => array(
383
-			__( 'Donor First Name', 'give' ),
384
-			__( 'First Name', 'give' ),
385
-			__( 'Name', 'give' ),
383
+			__('Donor First Name', 'give'),
384
+			__('First Name', 'give'),
385
+			__('Name', 'give'),
386 386
 		),
387 387
 		'last_name'   => array(
388
-			__( 'Donor Last Name', 'give' ),
389
-			__( 'Last Name', 'give' ),
388
+			__('Donor Last Name', 'give'),
389
+			__('Last Name', 'give'),
390 390
 		),
391 391
 		'line1'       => array(
392
-			__( 'Address 1', 'give' ),
393
-			__( 'Address', 'give' ),
392
+			__('Address 1', 'give'),
393
+			__('Address', 'give'),
394 394
 		),
395
-		'line2'       => __( 'Address 2', 'give' ),
396
-		'city'        => __( 'City', 'give' ),
395
+		'line2'       => __('Address 2', 'give'),
396
+		'city'        => __('City', 'give'),
397 397
 		'state'       => array(
398
-			__( 'State', 'give' ),
399
-			__( 'Province', 'give' ),
400
-			__( 'County', 'give' ),
401
-			__( 'Region', 'give' ),
398
+			__('State', 'give'),
399
+			__('Province', 'give'),
400
+			__('County', 'give'),
401
+			__('Region', 'give'),
402 402
 		),
403
-		'country'     => __( 'Country', 'give' ),
403
+		'country'     => __('Country', 'give'),
404 404
 		'zip'         => array(
405
-			__( 'Zip', 'give' ),
406
-			__( 'Zip Code', 'give' ),
407
-			__( 'Postal Code', 'give' ),
405
+			__('Zip', 'give'),
406
+			__('Zip Code', 'give'),
407
+			__('Postal Code', 'give'),
408 408
 		),
409 409
 		'email'       => array(
410
-			__( 'Donor Email', 'give' ),
411
-			__( 'Email', 'give' )
410
+			__('Donor Email', 'give'),
411
+			__('Email', 'give')
412 412
 		),
413 413
 		'post_status' => array(
414
-			__( 'Donation Status', 'give' ),
415
-			__( 'Status', 'give' ),
414
+			__('Donation Status', 'give'),
415
+			__('Status', 'give'),
416 416
 		),
417 417
 		'gateway'     => array(
418
-			__( 'Payment Method', 'give' ),
419
-			__( 'Method', 'give' ),
418
+			__('Payment Method', 'give'),
419
+			__('Method', 'give'),
420 420
 		),
421
-		'notes'       => __( 'Notes', 'give' ),
421
+		'notes'       => __('Notes', 'give'),
422 422
 		'mode'        => array(
423
-			__( 'Test Mode', 'give' ),
424
-			__( 'Mode', 'give' ),
423
+			__('Test Mode', 'give'),
424
+			__('Mode', 'give'),
425 425
 		),
426
-		'post_meta'   => __( 'Import as Meta', 'give' ),
427
-	) );
426
+		'post_meta'   => __('Import as Meta', 'give'),
427
+	));
428 428
 }
429 429
 
430 430
 /**
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 	 *
441 441
 	 * @return array
442 442
 	 */
443
-	return (array) apply_filters( 'give_import_donor_options', array(
444
-		'donor_id' => __( 'Donor ID', 'give' ),
445
-		'user_id'  => __( 'User ID', 'give' ),
446
-	) );
443
+	return (array) apply_filters('give_import_donor_options', array(
444
+		'donor_id' => __('Donor ID', 'give'),
445
+		'user_id'  => __('User ID', 'give'),
446
+	));
447 447
 }
448 448
 
449 449
 /**
@@ -459,23 +459,23 @@  discard block
 block discarded – undo
459 459
 	 *
460 460
 	 * @return array
461 461
 	 */
462
-	return (array) apply_filters( 'give_import_donation_form_options', array(
462
+	return (array) apply_filters('give_import_donation_form_options', array(
463 463
 		'form_title'              => array(
464
-			__( 'Donation Form Title', 'give' ),
465
-			__( 'Donation Form', 'give' ),
466
-			__( 'Form Name', 'give' ),
467
-			__( 'Title', 'give' ),
464
+			__('Donation Form Title', 'give'),
465
+			__('Donation Form', 'give'),
466
+			__('Form Name', 'give'),
467
+			__('Title', 'give'),
468 468
 		),
469 469
 		'form_id'                 => array(
470
-			__( 'Donation Form ID', 'give' ),
471
-			__( 'Form ID', 'give' )
470
+			__('Donation Form ID', 'give'),
471
+			__('Form ID', 'give')
472 472
 		),
473 473
 		'form_level'              => array(
474
-			__( 'Donation Level', 'give' ),
475
-			__( 'Level', 'give' ),
474
+			__('Donation Level', 'give'),
475
+			__('Level', 'give'),
476 476
 		),
477
-		'form_custom_amount_text' => __( 'Custom Amount Text', 'give' ),
478
-	) );
477
+		'form_custom_amount_text' => __('Custom Amount Text', 'give'),
478
+	));
479 479
 }
480 480
 
481 481
 /**
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
  *
489 489
  * @return array
490 490
  */
491
-function give_get_donation_data_from_csv( $file_id, $start, $end, $delimiter = 'csv' ) {
491
+function give_get_donation_data_from_csv($file_id, $start, $end, $delimiter = 'csv') {
492 492
 	/**
493 493
 	 * Filter to modify delimiter of Import.
494 494
 	 *
@@ -497,19 +497,19 @@  discard block
 block discarded – undo
497 497
 	 *
498 498
 	 * Return string $delimiter.
499 499
 	 */
500
-	$delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter );
500
+	$delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter);
501 501
 
502 502
 	$raw_data = array();
503
-	$file_dir = get_attached_file( $file_id );
503
+	$file_dir = get_attached_file($file_id);
504 504
 	$count    = 0;
505
-	if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) {
506
-		while ( false !== ( $row = fgetcsv( $handle, 0, $delimiter ) ) ) {
507
-			if ( $count >= $start && $count <= $end ) {
505
+	if (false !== ($handle = fopen($file_dir, 'r'))) {
506
+		while (false !== ($row = fgetcsv($handle, 0, $delimiter))) {
507
+			if ($count >= $start && $count <= $end) {
508 508
 				$raw_data[] = $row;
509 509
 			}
510
-			$count ++;
510
+			$count++;
511 511
 		}
512
-		fclose( $handle );
512
+		fclose($handle);
513 513
 	}
514 514
 
515 515
 	return $raw_data;
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
  *
526 526
  * @return bool
527 527
  */
528
-function give_log_user_in_on_register_callback( $value ) {
528
+function give_log_user_in_on_register_callback($value) {
529 529
 	return false;
530 530
 }
531 531
 
@@ -541,22 +541,22 @@  discard block
 block discarded – undo
541 541
  *
542 542
  * @return bool
543 543
  */
544
-function give_save_import_donation_to_db( $raw_key, $row_data, $main_key = array(), $import_setting = array() ) {
545
-	$data                          = array_combine( $raw_key, $row_data );
544
+function give_save_import_donation_to_db($raw_key, $row_data, $main_key = array(), $import_setting = array()) {
545
+	$data                          = array_combine($raw_key, $row_data);
546 546
 	$price_id                      = false;
547 547
 	$donor_id                      = 0;
548
-	$import_setting['create_user'] = ( isset( $import_setting['create_user'] ) ? $import_setting['create_user'] : 1 );
548
+	$import_setting['create_user'] = (isset($import_setting['create_user']) ? $import_setting['create_user'] : 1);
549 549
 
550
-	$data = (array) apply_filters( 'give_save_import_donation_to_db', $data );
550
+	$data = (array) apply_filters('give_save_import_donation_to_db', $data);
551 551
 
552
-	$data['amount'] = give_maybe_sanitize_amount( $data['amount'] );
552
+	$data['amount'] = give_maybe_sanitize_amount($data['amount']);
553 553
 
554 554
 	// Here come the login function.
555
-	$donor_data = give_import_get_user_from_csv( $data, $import_setting );
556
-	if ( ! empty( $donor_data->id ) ) {
557
-		if ( ! empty( $donor_data->user_id ) ) {
555
+	$donor_data = give_import_get_user_from_csv($data, $import_setting);
556
+	if ( ! empty($donor_data->id)) {
557
+		if ( ! empty($donor_data->user_id)) {
558 558
 			$donor_id = $donor_data->user_id;
559
-		} elseif ( ! empty( $data['user_id'] ) ) {
559
+		} elseif ( ! empty($data['user_id'])) {
560 560
 			$donor_id = $data['user_id'];
561 561
 		}
562 562
 	} else {
@@ -564,97 +564,97 @@  discard block
 block discarded – undo
564 564
 	}
565 565
 
566 566
 	// get form data or register a form data.
567
-	$form = give_import_get_form_data_from_csv( $data, $import_setting );
568
-	if ( false == $form ) {
567
+	$form = give_import_get_form_data_from_csv($data, $import_setting);
568
+	if (false == $form) {
569 569
 		return false;
570 570
 	} else {
571
-		$price_id = ( ! empty( $form->price_id ) ) ? $form->price_id : false;
571
+		$price_id = ( ! empty($form->price_id)) ? $form->price_id : false;
572 572
 	}
573 573
 
574 574
 
575 575
 	$address = array(
576
-		'line1'   => ( ! empty( $data['line1'] ) ? give_clean( $data['line1'] ) : '' ),
577
-		'line2'   => ( ! empty( $data['line1'] ) ? give_clean( $data['line2'] ) : '' ),
578
-		'city'    => ( ! empty( $data['line1'] ) ? give_clean( $data['city'] ) : '' ),
579
-		'zip'     => ( ! empty( $data['zip'] ) ? give_clean( $data['zip'] ) : '' ),
580
-		'state'   => ( ! empty( $data['state'] ) ? give_clean( $data['state'] ) : '' ),
581
-		'country' => ( ! empty( $data['country'] ) ? ( ( $country_code = array_search( $data['country'], give_get_country_list() ) ) ? $country_code : $data['country'] ) : '' ),
576
+		'line1'   => ( ! empty($data['line1']) ? give_clean($data['line1']) : ''),
577
+		'line2'   => ( ! empty($data['line1']) ? give_clean($data['line2']) : ''),
578
+		'city'    => ( ! empty($data['line1']) ? give_clean($data['city']) : ''),
579
+		'zip'     => ( ! empty($data['zip']) ? give_clean($data['zip']) : ''),
580
+		'state'   => ( ! empty($data['state']) ? give_clean($data['state']) : ''),
581
+		'country' => ( ! empty($data['country']) ? (($country_code = array_search($data['country'], give_get_country_list())) ? $country_code : $data['country']) : ''),
582 582
 	);
583 583
 
584 584
 	//Create payment_data array
585 585
 	$payment_data = array(
586 586
 		'donor_id'        => $donor_data->id,
587 587
 		'price'           => $data['amount'],
588
-		'status'          => ( ! empty( $data['post_status'] ) ? $data['post_status'] : 'publish' ),
588
+		'status'          => ( ! empty($data['post_status']) ? $data['post_status'] : 'publish'),
589 589
 		'currency'        => give_get_currency(),
590 590
 		'user_info'       => array(
591 591
 			'id'         => $donor_id,
592
-			'email'      => ( ! empty( $data['email'] ) ? $data['email'] : ( isset( $donor_data->email ) ? $donor_data->email : false ) ),
593
-			'first_name' => ( ! empty( $data['first_name'] ) ? $data['first_name'] : ( ! empty( $donor_id ) && ( $first_name = get_user_meta( $donor_id, 'first_name', true ) ) ? $first_name : $donor_data->name ) ),
594
-			'last_name'  => ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ! empty( $donor_id ) && ( $last_name = get_user_meta( $donor_id, 'last_name', true ) ) ? $last_name : $donor_data->name ) ),
592
+			'email'      => ( ! empty($data['email']) ? $data['email'] : (isset($donor_data->email) ? $donor_data->email : false)),
593
+			'first_name' => ( ! empty($data['first_name']) ? $data['first_name'] : ( ! empty($donor_id) && ($first_name = get_user_meta($donor_id, 'first_name', true)) ? $first_name : $donor_data->name)),
594
+			'last_name'  => ( ! empty($data['last_name']) ? $data['last_name'] : ( ! empty($donor_id) && ($last_name = get_user_meta($donor_id, 'last_name', true)) ? $last_name : $donor_data->name)),
595 595
 			'address'    => $address,
596 596
 		),
597
-		'gateway'         => ( ! empty( $data['gateway'] ) && 'offline' != strtolower( $data['gateway'] ) ? strtolower( $data['gateway'] ) : 'manual' ),
598
-		'give_form_title' => ( ! empty( $data['form_title'] ) ? $data['form_title'] : $form->get_name() ),
597
+		'gateway'         => ( ! empty($data['gateway']) && 'offline' != strtolower($data['gateway']) ? strtolower($data['gateway']) : 'manual'),
598
+		'give_form_title' => ( ! empty($data['form_title']) ? $data['form_title'] : $form->get_name()),
599 599
 		'give_form_id'    => (string) $form->get_ID(),
600 600
 		'give_price_id'   => $price_id,
601
-		'purchase_key'    => strtolower( md5( uniqid() ) ),
601
+		'purchase_key'    => strtolower(md5(uniqid())),
602 602
 		'user_email'      => $data['email'],
603
-		'post_date'       => ( ! empty( $data['post_date'] ) ? mysql2date( 'Y-m-d H:i:s', $data['post_date'] ) : current_time( 'mysql' ) ),
604
-		'mode'            => ( ! empty( $data['mode'] ) ? ( 'true' == (string) $data['mode'] || 'TRUE' == (string) $data['mode'] ? 'test' : 'live' ) : ( isset( $import_setting['mode'] ) ? ( true == (bool) $import_setting['mode'] ? 'test' : 'live' ) : ( give_is_test_mode() ? 'test' : 'live' ) ) ),
603
+		'post_date'       => ( ! empty($data['post_date']) ? mysql2date('Y-m-d H:i:s', $data['post_date']) : current_time('mysql')),
604
+		'mode'            => ( ! empty($data['mode']) ? ('true' == (string) $data['mode'] || 'TRUE' == (string) $data['mode'] ? 'test' : 'live') : (isset($import_setting['mode']) ? (true == (bool) $import_setting['mode'] ? 'test' : 'live') : (give_is_test_mode() ? 'test' : 'live'))),
605 605
 	);
606 606
 
607
-	$payment_data = apply_filters( 'give_import_before_import_payment', $payment_data, $data, $donor_data, $form );
607
+	$payment_data = apply_filters('give_import_before_import_payment', $payment_data, $data, $donor_data, $form);
608 608
 
609 609
 	// Get the report
610 610
 	$report = give_import_donation_report();
611 611
 
612 612
 	// Check for duplicate code.
613
-	$donation_duplicate = give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data );
614
-	if ( false !== $donation_duplicate ) {
615
-		$report['donation_details'][ $import_setting['donation_key'] ]['duplicate'] = $donation_duplicate;
616
-		$report['duplicate_donation'] = ( ! empty( $report['duplicate_donation'] ) ? ( absint( $report['duplicate_donation'] ) + 1 ) : 1 );
613
+	$donation_duplicate = give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data);
614
+	if (false !== $donation_duplicate) {
615
+		$report['donation_details'][$import_setting['donation_key']]['duplicate'] = $donation_duplicate;
616
+		$report['duplicate_donation'] = ( ! empty($report['duplicate_donation']) ? (absint($report['duplicate_donation']) + 1) : 1);
617 617
 	} else {
618
-		add_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1 );
619
-		add_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2 );
620
-		add_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3 );
621
-		add_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11, 2 );
622
-		$payment = give_insert_payment( $payment_data );
623
-		remove_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1 );
624
-		remove_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11 );
625
-		remove_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11 );
626
-		remove_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11 );
618
+		add_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1);
619
+		add_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2);
620
+		add_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3);
621
+		add_action('give_insert_payment', 'give_import_donation_insert_payment', 11, 2);
622
+		$payment = give_insert_payment($payment_data);
623
+		remove_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1);
624
+		remove_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11);
625
+		remove_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11);
626
+		remove_action('give_insert_payment', 'give_import_donation_insert_payment', 11);
627 627
 
628
-		if ( $payment ) {
628
+		if ($payment) {
629 629
 
630
-			$report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 );
630
+			$report['create_donation'] = ( ! empty($report['create_donation']) ? (absint($report['create_donation']) + 1) : 1);
631 631
 
632
-			update_post_meta( $payment, '_give_payment_import', true );
632
+			update_post_meta($payment, '_give_payment_import', true);
633 633
 
634
-			if ( ! empty( $import_setting['csv'] ) ) {
635
-				update_post_meta( $payment, '_give_payment_import_id', $import_setting['csv'] );
634
+			if ( ! empty($import_setting['csv'])) {
635
+				update_post_meta($payment, '_give_payment_import_id', $import_setting['csv']);
636 636
 			}
637 637
 
638 638
 			// Insert Notes.
639
-			if ( ! empty( $data['notes'] ) ) {
640
-				give_insert_payment_note( $payment, $data['notes'] );
639
+			if ( ! empty($data['notes'])) {
640
+				give_insert_payment_note($payment, $data['notes']);
641 641
 			}
642 642
 
643
-			$meta_exists = array_keys( $raw_key, 'post_meta' );
644
-			if ( ! empty( $main_key ) && ! empty( $meta_exists ) ) {
645
-				foreach ( $meta_exists as $meta_exist ) {
646
-					if ( ! empty( $main_key[ $meta_exist ] ) && ! empty( $row_data[ $meta_exist ] ) ) {
647
-						update_post_meta( $payment, $main_key[ $meta_exist ], $row_data[ $meta_exist ] );
643
+			$meta_exists = array_keys($raw_key, 'post_meta');
644
+			if ( ! empty($main_key) && ! empty($meta_exists)) {
645
+				foreach ($meta_exists as $meta_exist) {
646
+					if ( ! empty($main_key[$meta_exist]) && ! empty($row_data[$meta_exist])) {
647
+						update_post_meta($payment, $main_key[$meta_exist], $row_data[$meta_exist]);
648 648
 					}
649 649
 				}
650 650
 			}
651 651
 		} else {
652
-			$report['failed_donation'] = ( ! empty( $report['failed_donation'] ) ? ( absint( $report['failed_donation'] ) + 1 ) : 1 );
652
+			$report['failed_donation'] = ( ! empty($report['failed_donation']) ? (absint($report['failed_donation']) + 1) : 1);
653 653
 		}
654 654
 	}
655 655
 
656 656
 	// update the report
657
-	give_import_donation_report_update( $report );
657
+	give_import_donation_report_update($report);
658 658
 
659 659
 	return true;
660 660
 }
@@ -670,12 +670,12 @@  discard block
 block discarded – undo
670 670
  *
671 671
  * @return Give_Donor
672 672
  */
673
-function give_donation_import_update_donor_information( $donor, $payment_id, $payment_data ) {
673
+function give_donation_import_update_donor_information($donor, $payment_id, $payment_data) {
674 674
 	$old_donor = $donor;
675
-	if ( ! empty( $payment_data['donor_id'] ) ) {
676
-		$donor_id = absint( $payment_data['donor_id'] );
677
-		$donor    = new Give_Donor( $donor_id );
678
-		if ( ! empty( $donor->id ) ) {
675
+	if ( ! empty($payment_data['donor_id'])) {
676
+		$donor_id = absint($payment_data['donor_id']);
677
+		$donor    = new Give_Donor($donor_id);
678
+		if ( ! empty($donor->id)) {
679 679
 			return $donor;
680 680
 		}
681 681
 	}
@@ -688,12 +688,12 @@  discard block
 block discarded – undo
688 688
  *
689 689
  * @since 1.8.13
690 690
  */
691
-function give_import_donation_insert_payment( $payment_id, $payment_data ) {
691
+function give_import_donation_insert_payment($payment_id, $payment_data) {
692 692
 	// Update Give Customers purchase_count
693
-	if ( ! empty( $payment_data['status'] ) && ( 'complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'] ) ) {
694
-		$donor_id = (int) get_post_meta( $payment_id, '_give_payment_customer_id', true );
695
-		if ( ! empty( $donor_id ) ) {
696
-			$donor = new Give_Donor( $donor_id );
693
+	if ( ! empty($payment_data['status']) && ('complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'])) {
694
+		$donor_id = (int) get_post_meta($payment_id, '_give_payment_customer_id', true);
695
+		if ( ! empty($donor_id)) {
696
+			$donor = new Give_Donor($donor_id);
697 697
 			$donor->increase_purchase_count();
698 698
 		}
699 699
 	}
@@ -704,8 +704,8 @@  discard block
 block discarded – undo
704 704
  *
705 705
  * @since 1.8.13
706 706
  */
707
-function give_donation_import_give_insert_payment_args( $args, $payment_data ) {
708
-	if ( ! empty( $payment_data['user_info']['id'] ) ) {
707
+function give_donation_import_give_insert_payment_args($args, $payment_data) {
708
+	if ( ! empty($payment_data['user_info']['id'])) {
709 709
 		$args['post_author'] = (int) $payment_data['user_info']['id'];
710 710
 	}
711 711
 
@@ -717,11 +717,11 @@  discard block
 block discarded – undo
717 717
  *
718 718
  * @since 1.8.13
719 719
  */
720
-function give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data ) {
720
+function give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data) {
721 721
 	$return = false;
722
-	if ( ! empty( $data['post_date'] ) ) {
723
-		$post_date = mysql2date( 'Y-m-d-H-i-s', $data['post_date'] );
724
-		$post_date = explode( '-', $post_date );
722
+	if ( ! empty($data['post_date'])) {
723
+		$post_date = mysql2date('Y-m-d-H-i-s', $data['post_date']);
724
+		$post_date = explode('-', $post_date);
725 725
 		$args = array(
726 726
 			'output'                 => 'post',
727 727
 			'cache_results'          => false,
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 			'meta_query'             => array(
743 743
 				array(
744 744
 					'key'     => '_give_payment_total',
745
-					'value'   => preg_replace( '/[\$,]/', '', $payment_data['price'] ),
745
+					'value'   => preg_replace('/[\$,]/', '', $payment_data['price']),
746 746
 					'compare' => 'LIKE',
747 747
 				),
748 748
 				array(
@@ -764,9 +764,9 @@  discard block
 block discarded – undo
764 764
 			),
765 765
 		);
766 766
 
767
-		$payments  = new Give_Payments_Query( $args );
767
+		$payments  = new Give_Payments_Query($args);
768 768
 		$donations = $payments->get_payments();
769
-		if ( ! empty( $donations ) ) {
769
+		if ( ! empty($donations)) {
770 770
 			$return = $donations;
771 771
 		}
772 772
 	}
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 	 *
777 777
 	 * @since 1.8.18
778 778
 	 */
779
-	return apply_filters( 'give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data );
779
+	return apply_filters('give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data);
780 780
 }
781 781
 
782 782
 /**
@@ -788,9 +788,9 @@  discard block
 block discarded – undo
788 788
  *
789 789
  * @return void
790 790
  */
791
-function give_donation_import_insert_default_payment_note( $payment_id ) {
791
+function give_donation_import_insert_default_payment_note($payment_id) {
792 792
 	$current_user = wp_get_current_user();
793
-	give_insert_payment_note( $payment_id, esc_html( wp_sprintf( __( 'This donation was imported by %s', 'give' ), $current_user->user_email ) ) );
793
+	give_insert_payment_note($payment_id, esc_html(wp_sprintf(__('This donation was imported by %s', 'give'), $current_user->user_email)));
794 794
 }
795 795
 
796 796
 /**
@@ -802,14 +802,14 @@  discard block
 block discarded – undo
802 802
  *
803 803
  * @return string URL
804 804
  */
805
-function give_import_page_url( $parameter = array() ) {
805
+function give_import_page_url($parameter = array()) {
806 806
 	$defalut_query_arg = array(
807 807
 		'post_type'     => 'give_forms',
808 808
 		'page'          => 'give-tools',
809 809
 		'tab'           => 'import',
810 810
 		'importer-type' => 'import_donations',
811 811
 	);
812
-	$import_query_arg  = wp_parse_args( $parameter, $defalut_query_arg );
812
+	$import_query_arg = wp_parse_args($parameter, $defalut_query_arg);
813 813
 
814
-	return add_query_arg( $import_query_arg, admin_url( 'edit.php' ) );
814
+	return add_query_arg($import_query_arg, admin_url('edit.php'));
815 815
 }
816 816
\ No newline at end of file
Please login to merge, or discard this patch.
includes/gateways/manual.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-add_action( 'give_manual_cc_form', '__return_false' );
23
+add_action('give_manual_cc_form', '__return_false');
24 24
 
25 25
 /**
26 26
  * Processes the donation data and uses the Manual Payment gateway to record
@@ -32,44 +32,44 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_manual_payment( $purchase_data ) {
35
+function give_manual_payment($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41 41
 	//Create payment_data array
42 42
 	$payment_data = array(
43 43
 		'price'           => $purchase_data['price'],
44 44
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
45
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
45
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
46 46
 		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
47 47
 		'date'            => $purchase_data['date'],
48 48
 		'user_email'      => $purchase_data['user_email'],
49 49
 		'purchase_key'    => $purchase_data['purchase_key'],
50
-		'currency'        => give_get_currency( $purchase_data['post_data']['give-form-id'], $purchase_data ),
50
+		'currency'        => give_get_currency($purchase_data['post_data']['give-form-id'], $purchase_data),
51 51
 		'user_info'       => $purchase_data['user_info'],
52 52
 		'status'          => 'pending'
53 53
 	);
54 54
 	// Record the pending payment
55
-	$payment = give_insert_payment( $payment_data );
55
+	$payment = give_insert_payment($payment_data);
56 56
 
57
-	if ( $payment ) {
58
-		give_update_payment_status( $payment, 'publish' );
57
+	if ($payment) {
58
+		give_update_payment_status($payment, 'publish');
59 59
 		give_send_to_success_page();
60 60
 	} else {
61 61
 		give_record_gateway_error(
62
-			esc_html__( 'Payment Error', 'give' ),
62
+			esc_html__('Payment Error', 'give'),
63 63
 			sprintf(
64 64
 				/* translators: %s: payment data */
65
-				esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ),
66
-				json_encode( $payment_data )
65
+				esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'),
66
+				json_encode($payment_data)
67 67
 			),
68 68
 			$payment
69 69
 		);
70 70
 		// If errors are present, send the user back to the donation page so they can be corrected
71
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
71
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
72 72
 	}
73 73
 }
74 74
 
75
-add_action( 'give_gateway_manual', 'give_manual_payment' );
75
+add_action('give_gateway_manual', 'give_manual_payment');
Please login to merge, or discard this patch.
includes/admin/donors/class-donor-table.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@
 block discarded – undo
258 258
 	 * @access public
259 259
 	 * @since  1.0
260 260
 	 *
261
-	 * @return mixed string If search is present, false otherwise.
261
+	 * @return string|false string If search is present, false otherwise.
262 262
 	 */
263 263
 	public function get_search() {
264 264
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  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
 
19 19
 // Load WP_List_Table if not loaded.
20
-if ( ! class_exists( 'WP_List_Table' ) ) {
21
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
20
+if ( ! class_exists('WP_List_Table')) {
21
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
22 22
 }
23 23
 
24 24
 /**
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	public function __construct() {
62 62
 
63 63
 		// Set parent defaults.
64
-		parent::__construct( array(
65
-			'singular' => __( 'Donor', 'give' ), // Singular name of the listed records.
66
-			'plural'   => __( 'Donors', 'give' ), // Plural name of the listed records.
64
+		parent::__construct(array(
65
+			'singular' => __('Donor', 'give'), // Singular name of the listed records.
66
+			'plural'   => __('Donors', 'give'), // Plural name of the listed records.
67 67
 			'ajax'     => false, // Does this table support ajax?.
68
-		) );
68
+		));
69 69
 
70 70
 	}
71 71
 
@@ -80,23 +80,23 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return void
82 82
 	 */
83
-	public function search_box( $text, $input_id ) {
84
-		$input_id = $input_id . '-search-input';
83
+	public function search_box($text, $input_id) {
84
+		$input_id = $input_id.'-search-input';
85 85
 
86
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
87
-			echo sprintf( '<input type="hidden" name="orderby" value="%1$s" />', esc_attr( $_REQUEST['orderby'] ) );
86
+		if ( ! empty($_REQUEST['orderby'])) {
87
+			echo sprintf('<input type="hidden" name="orderby" value="%1$s" />', esc_attr($_REQUEST['orderby']));
88 88
 		}
89 89
 
90
-		if ( ! empty( $_REQUEST['order'] ) ) {
91
-			echo sprintf( '<input type="hidden" name="order" value="%1$s" />', esc_attr( $_REQUEST['order'] ) );
90
+		if ( ! empty($_REQUEST['order'])) {
91
+			echo sprintf('<input type="hidden" name="order" value="%1$s" />', esc_attr($_REQUEST['order']));
92 92
 		}
93 93
 		?>
94 94
 		<p class="search-box" role="search">
95 95
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
96 96
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
97
-			<?php submit_button( $text, 'button', false, false, array(
97
+			<?php submit_button($text, 'button', false, false, array(
98 98
 				'ID' => 'search-submit',
99
-			) ); ?>
99
+			)); ?>
100 100
 		</p>
101 101
 		<?php
102 102
 	}
@@ -112,32 +112,32 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @return string Column Name.
114 114
 	 */
115
-	public function column_default( $donor, $column_name ) {
115
+	public function column_default($donor, $column_name) {
116 116
 
117
-		switch ( $column_name ) {
117
+		switch ($column_name) {
118 118
 
119 119
 			case 'num_donations' :
120 120
 				$value = sprintf(
121 121
 					'<a href="%s">%s</a>',
122
-					admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&status=publish&donor=' . absint( $donor['id'] ) ),
123
-					esc_html( $donor['num_donations'] )
122
+					admin_url('edit.php?post_type=give_forms&page=give-payment-history&status=publish&donor='.absint($donor['id'])),
123
+					esc_html($donor['num_donations'])
124 124
 				);
125 125
 				break;
126 126
 
127 127
 			case 'amount_spent' :
128
-				$value = give_currency_filter( give_format_amount( $donor[ $column_name ], array( 'sanitize' => false ) ) );
128
+				$value = give_currency_filter(give_format_amount($donor[$column_name], array('sanitize' => false)));
129 129
 				break;
130 130
 
131 131
 			case 'date_created' :
132
-				$value = date_i18n( give_date_format(), strtotime( $donor['date_created'] ) );
132
+				$value = date_i18n(give_date_format(), strtotime($donor['date_created']));
133 133
 				break;
134 134
 
135 135
 			default:
136
-				$value = isset( $donor[ $column_name ] ) ? $donor[ $column_name ] : null;
136
+				$value = isset($donor[$column_name]) ? $donor[$column_name] : null;
137 137
 				break;
138 138
 		}
139 139
 
140
-		return apply_filters( "give_donors_column_{$column_name}", $value, $donor['id'] );
140
+		return apply_filters("give_donors_column_{$column_name}", $value, $donor['id']);
141 141
 
142 142
 	}
143 143
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @return string
153 153
 	 */
154
-	public function column_cb( $donor ){
154
+	public function column_cb($donor) {
155 155
 		return sprintf(
156 156
 			'<input class="donor-selector" type="checkbox" name="%1$s[]" value="%2$d" data-name="%3$s" />',
157 157
 			$this->_args['singular'],
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return string
172 172
 	 */
173
-	public function column_name( $donor ) {
174
-		$name     = '#' . $donor['id'] . ' ';
175
-		$name     .= ! empty( $donor['name'] ) ? $donor['name'] : '<em>' . __( 'Unnamed Donor', 'give' ) . '</em>';
176
-		$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] );
177
-		$actions  = $this->get_row_actions( $donor );
173
+	public function column_name($donor) {
174
+		$name     = '#'.$donor['id'].' ';
175
+		$name .= ! empty($donor['name']) ? $donor['name'] : '<em>'.__('Unnamed Donor', 'give').'</em>';
176
+		$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']);
177
+		$actions  = $this->get_row_actions($donor);
178 178
 
179
-		return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions );
179
+		return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions);
180 180
 	}
181 181
 
182 182
 	/**
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 	public function get_columns() {
191 191
 		$columns = array(
192 192
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
193
-			'name'          => __( 'Name', 'give' ),
194
-			'email'         => __( 'Email', 'give' ),
195
-			'num_donations' => __( 'Donations', 'give' ),
196
-			'amount_spent'  => __( 'Total Donated', 'give' ),
197
-			'date_created'  => __( 'Date Created', 'give' ),
193
+			'name'          => __('Name', 'give'),
194
+			'email'         => __('Email', 'give'),
195
+			'num_donations' => __('Donations', 'give'),
196
+			'amount_spent'  => __('Total Donated', 'give'),
197
+			'date_created'  => __('Date Created', 'give'),
198 198
 		);
199 199
 
200
-		return apply_filters( 'give_list_donors_columns', $columns );
200
+		return apply_filters('give_list_donors_columns', $columns);
201 201
 
202 202
 	}
203 203
 
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
 	public function get_sortable_columns() {
212 212
 
213 213
 		$columns = array(
214
-			'date_created'  => array( 'date_created', true ),
215
-			'name'          => array( 'name', true ),
216
-			'num_donations' => array( 'purchase_count', false ),
217
-			'amount_spent'  => array( 'purchase_value', false ),
214
+			'date_created'  => array('date_created', true),
215
+			'name'          => array('name', true),
216
+			'num_donations' => array('purchase_count', false),
217
+			'amount_spent'  => array('purchase_value', false),
218 218
 		);
219 219
 
220
-		return apply_filters( 'give_list_donors_sortable_columns', $columns );
220
+		return apply_filters('give_list_donors_sortable_columns', $columns);
221 221
 	}
222 222
 
223 223
 	/**
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @return array An array of action links.
232 232
 	 */
233
-	public function get_row_actions( $donor ) {
233
+	public function get_row_actions($donor) {
234 234
 
235 235
 		$actions = array(
236
-			'view'   => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ), sprintf( esc_attr__( 'View "%s"', 'give' ), $donor['name'] ), __( 'View Donor', 'give' ) ),
237
-			'notes'  => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor['id'] ), sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $donor['name'] ), __( 'Notes', 'give' ) ),
238
-			'delete' => sprintf( '<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'],sprintf( esc_attr__( 'Delete "%s"', 'give' ), $donor['name'] ), __( 'Delete', 'give' ) ),
236
+			'view'   => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']), sprintf(esc_attr__('View "%s"', 'give'), $donor['name']), __('View Donor', 'give')),
237
+			'notes'  => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor['id']), sprintf(esc_attr__('Notes for "%s"', 'give'), $donor['name']), __('Notes', 'give')),
238
+			'delete' => sprintf('<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'], sprintf(esc_attr__('Delete "%s"', 'give'), $donor['name']), __('Delete', 'give')),
239 239
 		);
240 240
 
241
-		return apply_filters( 'give_donor_row_actions', $actions, $donor );
241
+		return apply_filters('give_donor_row_actions', $actions, $donor);
242 242
 
243 243
 	}
244 244
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @return int Current page number.
252 252
 	 */
253 253
 	public function get_paged() {
254
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
254
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
255 255
 	}
256 256
 
257 257
 	/**
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 * @return mixed string If search is present, false otherwise.
264 264
 	 */
265 265
 	public function get_search() {
266
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
266
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
267 267
 	}
268 268
 
269 269
 	/**
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public function get_bulk_actions() {
278 278
 		$actions = array(
279
-			'delete' => __( 'Delete', 'give' ),
279
+			'delete' => __('Delete', 'give'),
280 280
 		);
281 281
 		return $actions;
282 282
 	}
@@ -289,19 +289,19 @@  discard block
 block discarded – undo
289 289
 	 * @access protected
290 290
 	 * @since  1.8.16
291 291
 	 */
292
-	protected function display_tablenav( $which ) {
293
-		if ( 'top' === $which ) {
294
-			wp_nonce_field( 'bulk-' . $this->_args['plural'], '_wpnonce', false );
292
+	protected function display_tablenav($which) {
293
+		if ('top' === $which) {
294
+			wp_nonce_field('bulk-'.$this->_args['plural'], '_wpnonce', false);
295 295
 		}
296 296
 		?>
297
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
298
-			<?php if ( $this->has_items() ): ?>
297
+		<div class="tablenav <?php echo esc_attr($which); ?>">
298
+			<?php if ($this->has_items()): ?>
299 299
 				<div class="alignleft actions bulkactions">
300
-					<?php $this->bulk_actions( $which ); ?>
300
+					<?php $this->bulk_actions($which); ?>
301 301
 				</div>
302 302
 			<?php endif;
303
-			$this->extra_tablenav( $which );
304
-			$this->pagination( $which );
303
+			$this->extra_tablenav($which);
304
+			$this->pagination($which);
305 305
 			?>
306 306
 			<br class="clear" />
307 307
 		</div>
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
 
323 323
 		// Get donor query.
324 324
 		$args   = $this->get_donor_query();
325
-		$donors = Give()->donors->get_donors( $args );
325
+		$donors = Give()->donors->get_donors($args);
326 326
 
327
-		if ( $donors ) {
327
+		if ($donors) {
328 328
 
329
-			foreach ( $donors as $donor ) {
329
+			foreach ($donors as $donor) {
330 330
 
331
-				$user_id = ! empty( $donor->user_id ) ? intval( $donor->user_id ) : 0;
331
+				$user_id = ! empty($donor->user_id) ? intval($donor->user_id) : 0;
332 332
 
333 333
 				$data[] = array(
334 334
 					'id'            => $donor->id,
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			}
343 343
 		}
344 344
 
345
-		return apply_filters( 'give_donors_column_query_data', $data );
345
+		return apply_filters('give_donors_column_query_data', $data);
346 346
 	}
347 347
 
348 348
 	/**
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
 
358 358
 		$_donor_query['number'] = - 1;
359 359
 		$_donor_query['offset'] = 0;
360
-		$donors                 = Give()->donors->get_donors( $_donor_query );
360
+		$donors                 = Give()->donors->get_donors($_donor_query);
361 361
 
362
-		return count( $donors );
362
+		return count($donors);
363 363
 	}
364 364
 
365 365
 	/**
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	public function get_donor_query() {
374 374
 		$paged   = $this->get_paged();
375
-		$offset  = $this->per_page * ( $paged - 1 );
375
+		$offset  = $this->per_page * ($paged - 1);
376 376
 		$search  = $this->get_search();
377
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
378
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
377
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
378
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
379 379
 
380 380
 		$args = array(
381 381
 			'number'  => $this->per_page,
@@ -384,10 +384,10 @@  discard block
 block discarded – undo
384 384
 			'orderby' => $orderby,
385 385
 		);
386 386
 
387
-		if ( $search ) {
388
-			if ( is_email( $search ) ) {
387
+		if ($search) {
388
+			if (is_email($search)) {
389 389
 				$args['email'] = $search;
390
-			} elseif ( is_numeric( $search ) ) {
390
+			} elseif (is_numeric($search)) {
391 391
 				$args['id'] = $search;
392 392
 			} else {
393 393
 				$args['name'] = $search;
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
 	 * @since  1.8.17
406 406
 	 * @access public
407 407
 	 */
408
-	public function single_row( $item ) {
409
-		echo sprintf( '<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name'] );
410
-		$this->single_row_columns( $item );
408
+	public function single_row($item) {
409
+		echo sprintf('<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name']);
410
+		$this->single_row_columns($item);
411 411
 		echo '</tr>';
412 412
 	}
413 413
 
@@ -420,11 +420,11 @@  discard block
 block discarded – undo
420 420
 	public function display() {
421 421
 		$singular = $this->_args['singular'];
422 422
 
423
-		$this->display_tablenav( 'top' );
423
+		$this->display_tablenav('top');
424 424
 
425
-		$this->screen->render_screen_reader_content( 'heading_list' );
425
+		$this->screen->render_screen_reader_content('heading_list');
426 426
 		?>
427
-		<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
427
+		<table class="wp-list-table <?php echo implode(' ', $this->get_table_classes()); ?>">
428 428
 			<thead>
429 429
 			<tr>
430 430
 				<?php $this->print_column_headers(); ?>
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 			</thead>
433 433
 
434 434
 			<tbody id="the-list"<?php
435
-			if ( $singular ) {
435
+			if ($singular) {
436 436
 				echo " data-wp-lists='list:$singular'";
437 437
 			} ?>>
438 438
 			<tr class="hidden"></tr>
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 				<td colspan="6" class="colspanchange">
441 441
 
442 442
 					<fieldset class="inline-edit-col-left">
443
-						<legend class="inline-edit-legend"><?php _e( 'BULK DELETE', 'give' ); ?></legend>
443
+						<legend class="inline-edit-legend"><?php _e('BULK DELETE', 'give'); ?></legend>
444 444
 						<div class="inline-edit-col">
445 445
 							<div id="bulk-titles">
446 446
 								<div id="give-bulk-donors" class="give-bulk-donors">
@@ -453,22 +453,22 @@  discard block
 block discarded – undo
453 453
 						<div class="inline-edit-col">
454 454
 							<label>
455 455
 								<input id="give-delete-donor-confirm" type="checkbox" name="give-delete-donor-confirm"/>
456
-								<?php _e( 'Are you sure you want to delete the selected donor(s)?', 'give' ); ?>
456
+								<?php _e('Are you sure you want to delete the selected donor(s)?', 'give'); ?>
457 457
 							</label>
458 458
 							<label>
459 459
 								<input id="give-delete-donor-records" type="checkbox" name="give-delete-donor-records"/>
460
-								<?php _e( 'Delete all associated donations and records?', 'give' ); ?>
460
+								<?php _e('Delete all associated donations and records?', 'give'); ?>
461 461
 							</label>
462 462
 						</div>
463 463
 					</fieldset>
464 464
 
465 465
 					<p class="submit inline-edit-save">
466 466
 						<input type="hidden" name="give_action" value="delete_donor"/>
467
-						<input type="hidden" name="s" value="<?php echo ( ! empty( $_GET['s'] ) ) ? $_GET['s'] : ''; ?>"/>
468
-						<input type="hidden" name="orderby" value="<?php echo ( ! empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'id'; ?>"/>
469
-						<input type="hidden" name="order" value="<?php echo ( ! empty( $_GET['order'] ) ) ? $_GET['order'] : 'desc'; ?>"/>
470
-						<button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php _e( 'Cancel', 'give' ); ?></button>
471
-						<input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php _e( 'Delete', 'give' ); ?>">
467
+						<input type="hidden" name="s" value="<?php echo ( ! empty($_GET['s'])) ? $_GET['s'] : ''; ?>"/>
468
+						<input type="hidden" name="orderby" value="<?php echo ( ! empty($_GET['orderby'])) ? $_GET['orderby'] : 'id'; ?>"/>
469
+						<input type="hidden" name="order" value="<?php echo ( ! empty($_GET['order'])) ? $_GET['order'] : 'desc'; ?>"/>
470
+						<button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php _e('Cancel', 'give'); ?></button>
471
+						<input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php _e('Delete', 'give'); ?>">
472 472
 						<br class="clear">
473 473
 					</p>
474 474
 				</td>
@@ -478,13 +478,13 @@  discard block
 block discarded – undo
478 478
 
479 479
 			<tfoot>
480 480
 			<tr>
481
-				<?php $this->print_column_headers( false ); ?>
481
+				<?php $this->print_column_headers(false); ?>
482 482
 			</tr>
483 483
 			</tfoot>
484 484
 
485 485
 		</table>
486 486
 		<?php
487
-		$this->display_tablenav( 'bottom' );
487
+		$this->display_tablenav('bottom');
488 488
 	}
489 489
 
490 490
 	/**
@@ -501,16 +501,16 @@  discard block
 block discarded – undo
501 501
 		$hidden   = array(); // No hidden columns.
502 502
 		$sortable = $this->get_sortable_columns();
503 503
 
504
-		$this->_column_headers = array( $columns, $hidden, $sortable );
504
+		$this->_column_headers = array($columns, $hidden, $sortable);
505 505
 
506 506
 		$this->items = $this->donor_data();
507 507
 
508 508
 		$this->total = $this->get_donor_count();
509 509
 
510
-		$this->set_pagination_args( array(
510
+		$this->set_pagination_args(array(
511 511
 			'total_items' => $this->total,
512 512
 			'per_page'    => $this->per_page,
513
-			'total_pages' => ceil( $this->total / $this->per_page ),
514
-		) );
513
+			'total_pages' => ceil($this->total / $this->per_page),
514
+		));
515 515
 	}
516 516
 }
Please login to merge, or discard this patch.