Test Failed
Push — master ( 9a7225...07651e )
by Ravinder
05:42
created
includes/admin/tools/data/class-give-tools-delete-import-donors.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -290,7 +290,7 @@
 block discarded – undo
290 290
 	 *
291 291
 	 * @since 1.8.12
292 292
 	 *
293
-	 * @return int
293
+	 * @return double
294 294
 	 */
295 295
 	public function get_percentage_complete() {
296 296
 		return ceil( ( 100 * $this->step_completed ) / $this->total_step );
Please login to merge, or discard this patch.
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @param int $_step Steps.
136 136
 	 */
137
-	public function __construct( $_step = 1 ) {
138
-		parent::__construct( $_step );
137
+	public function __construct($_step = 1) {
138
+		parent::__construct($_step);
139 139
 
140 140
 		$this->is_writable = true;
141 141
 	}
@@ -154,38 +154,38 @@  discard block
 block discarded – undo
154 154
 		$donor_ids    = array();
155 155
 
156 156
 		// Check if the ajax request if running for the first time.
157
-		if ( 1 === (int) $this->step ) {
157
+		if (1 === (int) $this->step) {
158 158
 
159 159
 			// Delete all the form ids.
160
-			$this->delete_option( $this->form_key );
160
+			$this->delete_option($this->form_key);
161 161
 
162 162
 			// Delete all the donation ids.
163
-			$this->delete_option( $this->donation_key );
163
+			$this->delete_option($this->donation_key);
164 164
 
165 165
 			// Delete all the donor ids.
166
-			$this->delete_option( $this->donor_key );
166
+			$this->delete_option($this->donor_key);
167 167
 
168 168
 			// Delete all the step and set to 'count' which if the first step in the process of deleting the donors.
169
-			$this->update_option( $this->step_key, 'count' );
169
+			$this->update_option($this->step_key, 'count');
170 170
 
171 171
 			// Delete tha page count of the step.
172
-			$this->update_option( $this->step_on_key, '0' );
172
+			$this->update_option($this->step_on_key, '0');
173 173
 		} else {
174 174
 
175 175
 			// Get the old donors list.
176
-			$donor_ids = $this->get_option( $this->donor_key );
176
+			$donor_ids = $this->get_option($this->donor_key);
177 177
 
178 178
 			// Get the old donation list.
179
-			$donation_ids = $this->get_option( $this->donation_key );
179
+			$donation_ids = $this->get_option($this->donation_key);
180 180
 		}
181 181
 
182 182
 		// Get the step and check for it if it's on the first step( 'count' ) or not.
183 183
 		$step = (int) $this->get_step();
184
-		if ( 1 === $step ) {
184
+		if (1 === $step) {
185 185
 			/**
186 186
 			 * Will add or update the donation and donor data by running wp query.
187 187
 			 */
188
-			$this->count( $step, $donation_ids, $donor_ids );
188
+			$this->count($step, $donation_ids, $donor_ids);
189 189
 		}
190 190
 	}
191 191
 
@@ -196,18 +196,18 @@  discard block
 block discarded – undo
196 196
 	 * @param array  $donation_ids Contain the list of all the donation id's that has being add before this.
197 197
 	 * @param array  $donor_ids    Contain the list of all the donors id's that has being add before this.
198 198
 	 */
199
-	private function count( $step, $donation_ids = array(), $donor_ids = array() ) {
199
+	private function count($step, $donation_ids = array(), $donor_ids = array()) {
200 200
 
201 201
 		// Get the Page count by default it's zero.
202 202
 		$paged = (int) $this->get_step_page();
203 203
 
204 204
 		// Increased the page count by one.
205
-		++ $paged;
205
+		++$paged;
206 206
 
207 207
 		/**
208 208
 		 * Filter add to alter the argument before the wp quest run
209 209
 		 */
210
-		$args = apply_filters( 'give_tools_reset_stats_total_args', array(
210
+		$args = apply_filters('give_tools_reset_stats_total_args', array(
211 211
 			'post_type'      => 'give_payment',
212 212
 			'post_status'    => 'any',
213 213
 			'posts_per_page' => $this->per_step,
@@ -215,41 +215,41 @@  discard block
 block discarded – undo
215 215
 			'meta_key'       => '_give_payment_import',
216 216
 			'meta_value_num' => 1,
217 217
 			'meta_compare'   => '=',
218
-		) );
218
+		));
219 219
 
220 220
 		// Reset the post data.
221 221
 		wp_reset_postdata();
222 222
 
223 223
 		// Getting the new donation.
224
-		$donation_posts = new WP_Query( $args );
224
+		$donation_posts = new WP_Query($args);
225 225
 
226 226
 		// The Loop.
227
-		if ( $donation_posts->have_posts() ) {
228
-			while ( $donation_posts->have_posts() ) {
227
+		if ($donation_posts->have_posts()) {
228
+			while ($donation_posts->have_posts()) {
229 229
 				$add_author = true;
230 230
 				$donation_posts->the_post();
231 231
 				global $post;
232 232
 				// Add the donation id in side the array.
233 233
 				$donation_ids[] = $post->ID;
234 234
 
235
-				$donor_id = (int) give_get_meta( $post->ID, '_give_payment_customer_id', true );
236
-				if ( ! empty( $donor_id ) ) {
237
-					$donor = new Give_Donor( $donor_id );
238
-					if ( ! empty( $donor->id ) ) {
239
-						if ( empty( $donor->user_id ) && ! empty( $donor->payment_ids ) ) {
235
+				$donor_id = (int) give_get_meta($post->ID, '_give_payment_customer_id', true);
236
+				if ( ! empty($donor_id)) {
237
+					$donor = new Give_Donor($donor_id);
238
+					if ( ! empty($donor->id)) {
239
+						if (empty($donor->user_id) && ! empty($donor->payment_ids)) {
240 240
 							$add_author = false;
241
-							$count      = (int) count( $donor->payment_ids );
242
-							if ( 1 === $count ) {
243
-								give_delete_donor_and_related_donation( $donor );
241
+							$count      = (int) count($donor->payment_ids);
242
+							if (1 === $count) {
243
+								give_delete_donor_and_related_donation($donor);
244 244
 							} else {
245
-								$donor->remove_payment( $post->ID );
245
+								$donor->remove_payment($post->ID);
246 246
 								$donor->decrease_donation_count();
247 247
 							}
248 248
 						}
249 249
 					}
250 250
 				}
251 251
 
252
-				if ( ! empty( $add_author ) ) {
252
+				if ( ! empty($add_author)) {
253 253
 					// Add the donor id in side the array.
254 254
 					$donor_ids[] = (int) $post->post_author;
255 255
 				}
@@ -263,24 +263,24 @@  discard block
 block discarded – undo
263 263
 		$max_num_pages = (int) $donation_posts->max_num_pages;
264 264
 
265 265
 		// Check current page is less then max number of page or not.
266
-		if ( $paged < $max_num_pages ) {
266
+		if ($paged < $max_num_pages) {
267 267
 
268 268
 			// Update the current page variable for the next step.
269
-			$this->update_option( $this->step_on_key, $paged );
269
+			$this->update_option($this->step_on_key, $paged);
270 270
 
271 271
 			// Calculating percentage.
272 272
 			$page_remain          = $max_num_pages - $paged;
273
-			$this->total_step     = (int) $max_num_pages + ( $total_donation / $this->per_step ) + ( ( $page_remain * 2 ) * count( $donor_ids ) );
273
+			$this->total_step     = (int) $max_num_pages + ($total_donation / $this->per_step) + (($page_remain * 2) * count($donor_ids));
274 274
 			$this->step_completed = $paged;
275 275
 		} else {
276
-			$donation_ids_count = count( $donor_ids );
277
-			$this->update_option( $this->step_key, 'donation' );
278
-			$this->update_option( $this->step_on_key, '0' );
276
+			$donation_ids_count = count($donor_ids);
277
+			$this->update_option($this->step_key, 'donation');
278
+			$this->update_option($this->step_on_key, '0');
279 279
 		}
280 280
 
281
-		$donor_ids = array_unique( $donor_ids );
282
-		$this->update_option( $this->donor_key, $donor_ids );
283
-		$this->update_option( $this->donation_key, $donation_ids );
281
+		$donor_ids = array_unique($donor_ids);
282
+		$this->update_option($this->donor_key, $donor_ids);
283
+		$this->update_option($this->donation_key, $donation_ids);
284 284
 
285 285
 		wp_reset_postdata();
286 286
 	}
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 * @return int
294 294
 	 */
295 295
 	public function get_percentage_complete() {
296
-		return ceil( ( 100 * $this->step_completed ) / $this->total_step );
296
+		return ceil((100 * $this->step_completed) / $this->total_step);
297 297
 	}
298 298
 
299 299
 	/**
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	public function process_step() {
305 305
 
306
-		if ( ! $this->can_export() ) {
306
+		if ( ! $this->can_export()) {
307 307
 			wp_die(
308
-				esc_html__( 'You do not have permission to delete Import transactions.', 'give' ),
309
-				esc_html__( 'Error', 'give' ),
308
+				esc_html__('You do not have permission to delete Import transactions.', 'give'),
309
+				esc_html__('Error', 'give'),
310 310
 				array(
311 311
 					'response' => 403,
312 312
 				)
@@ -315,18 +315,18 @@  discard block
 block discarded – undo
315 315
 
316 316
 		$had_data = $this->get_data();
317 317
 
318
-		if ( $had_data ) {
318
+		if ($had_data) {
319 319
 			$this->done = false;
320 320
 
321 321
 			return true;
322 322
 		} else {
323
-			update_option( 'give_earnings_total', give_get_total_earnings( true ), false );
324
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
323
+			update_option('give_earnings_total', give_get_total_earnings(true), false);
324
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
325 325
 
326
-			$this->delete_option( $this->donation_key );
326
+			$this->delete_option($this->donation_key);
327 327
 
328 328
 			$this->done    = true;
329
-			$this->message = __( 'Imported donor and transactions successfully deleted.', 'give' );
329
+			$this->message = __('Imported donor and transactions successfully deleted.', 'give');
330 330
 
331 331
 			return false;
332 332
 		}
@@ -344,12 +344,12 @@  discard block
 block discarded – undo
344 344
 	public function get_data() {
345 345
 
346 346
 		// Get the donation id's.
347
-		$donation_ids = $this->get_option( $this->donation_key );
347
+		$donation_ids = $this->get_option($this->donation_key);
348 348
 
349 349
 		/**
350 350
 		 * Return false id not Import donation is found.
351 351
 		 */
352
-		if ( empty( $donation_ids ) ) {
352
+		if (empty($donation_ids)) {
353 353
 			$this->is_empty   = true;
354 354
 			$this->total_step = 1;
355 355
 
@@ -360,110 +360,110 @@  discard block
 block discarded – undo
360 360
 		$step = (int) $this->get_step();
361 361
 
362 362
 		// Get the donor ids.
363
-		$donor_ids = $this->get_option( $this->donor_key );
363
+		$donor_ids = $this->get_option($this->donor_key);
364 364
 
365 365
 		// Delete all the imported donations.
366
-		if ( 2 === $step ) {
366
+		if (2 === $step) {
367 367
 			$pass_to_donor = false;
368 368
 			$page          = (int) $this->get_step_page();
369
-			$page ++;
370
-			$count = count( $donation_ids );
369
+			$page++;
370
+			$count = count($donation_ids);
371 371
 
372
-			$this->total_step     = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids );
372
+			$this->total_step     = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids);
373 373
 			$this->step_completed = $page;
374 374
 
375
-			if ( $count > $this->per_step ) {
375
+			if ($count > $this->per_step) {
376 376
 
377
-				$this->update_option( $this->step_on_key, $page );
378
-				$donation_ids = $this->get_delete_ids( $donation_ids, $page );
379
-				$current_page = (int) ceil( $count / $this->per_step );
377
+				$this->update_option($this->step_on_key, $page);
378
+				$donation_ids = $this->get_delete_ids($donation_ids, $page);
379
+				$current_page = (int) ceil($count / $this->per_step);
380 380
 
381
-				if ( $page === $current_page ) {
381
+				if ($page === $current_page) {
382 382
 					$pass_to_donor = true;
383 383
 				}
384 384
 			} else {
385 385
 				$pass_to_donor = true;
386 386
 			}
387 387
 
388
-			if ( true === $pass_to_donor ) {
389
-				$this->update_option( $this->step_key, 'donor' );
390
-				$this->update_option( $this->step_on_key, '0' );
388
+			if (true === $pass_to_donor) {
389
+				$this->update_option($this->step_key, 'donor');
390
+				$this->update_option($this->step_on_key, '0');
391 391
 			}
392 392
 
393 393
 			// Get the old form list.
394
-			$form_ids = (array) $this->get_option( $this->form_key );
394
+			$form_ids = (array) $this->get_option($this->form_key);
395 395
 
396
-			foreach ( $donation_ids as $item ) {
397
-				$form_ids[] = give_get_meta( $item, '_give_payment_form_id', true );
396
+			foreach ($donation_ids as $item) {
397
+				$form_ids[] = give_get_meta($item, '_give_payment_form_id', true);
398 398
 
399 399
 				// Delete the main payment.
400
-				give_delete_donation( absint( $item ) );
400
+				give_delete_donation(absint($item));
401 401
 			}
402 402
 
403 403
 			// Update the new form list.
404
-			$this->update_option( $this->form_key, $form_ids );
404
+			$this->update_option($this->form_key, $form_ids);
405 405
 		} // End if().
406 406
 
407 407
 		// Delete all the donors.
408
-		if ( 3 === $step ) {
408
+		if (3 === $step) {
409 409
 
410 410
 			// Get the old form list.
411
-			$form_ids = (array) $this->get_option( $this->form_key );
412
-			if ( ! empty( $form_ids ) ) {
413
-				$form_ids = array_unique( $form_ids );
414
-				foreach ( $form_ids as $form_id ) {
415
-					give_recount_form_income_donation( (int) $form_id );
411
+			$form_ids = (array) $this->get_option($this->form_key);
412
+			if ( ! empty($form_ids)) {
413
+				$form_ids = array_unique($form_ids);
414
+				foreach ($form_ids as $form_id) {
415
+					give_recount_form_income_donation((int) $form_id);
416 416
 				}
417 417
 			}
418 418
 			// update the new form list.
419
-			$this->update_option( $this->form_key, array() );
419
+			$this->update_option($this->form_key, array());
420 420
 
421 421
 			$page  = (int) $this->get_step_page();
422
-			$count = count( $donor_ids );
422
+			$count = count($donor_ids);
423 423
 
424
-			$this->total_step     = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids );
425
-			$this->step_completed = $page + ( count( $donation_ids ) / $this->per_step );
424
+			$this->total_step     = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids);
425
+			$this->step_completed = $page + (count($donation_ids) / $this->per_step);
426 426
 
427
-			if ( ! empty( $donor_ids[ $page ] ) ) {
428
-				$args = apply_filters( 'give_tools_reset_stats_total_args', array(
427
+			if ( ! empty($donor_ids[$page])) {
428
+				$args = apply_filters('give_tools_reset_stats_total_args', array(
429 429
 					'post_status'    => 'any',
430 430
 					'posts_per_page' => 1,
431
-					'author'         => $donor_ids[ $page ],
432
-				) );
431
+					'author'         => $donor_ids[$page],
432
+				));
433 433
 
434 434
 				$donations = array();
435
-				$payments  = new Give_Payments_Query( $args );
435
+				$payments  = new Give_Payments_Query($args);
436 436
 				$payments  = $payments->get_payments();
437
-				if ( empty( $payments ) ) {
438
-					Give()->donors->delete_by_user_id( $donor_ids[ $page ] );
437
+				if (empty($payments)) {
438
+					Give()->donors->delete_by_user_id($donor_ids[$page]);
439 439
 
440 440
 					/**
441 441
 					 * If Checked then delete WP user.
442 442
 					 *
443 443
 					 * @since 1.8.14
444 444
 					 */
445
-					$delete_import_donors = isset( $_REQUEST['delete-import-donors'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['delete-import-donors'] ) ) : '';
445
+					$delete_import_donors = isset($_REQUEST['delete-import-donors']) ? sanitize_text_field(wp_unslash($_REQUEST['delete-import-donors'])) : '';
446 446
 
447
-					if ( 'on' === (string) $delete_import_donors ) {
448
-						wp_delete_user( $donor_ids[ $page ] );
447
+					if ('on' === (string) $delete_import_donors) {
448
+						wp_delete_user($donor_ids[$page]);
449 449
 					}
450 450
 				} else {
451
-					foreach ( $payments as $payment ) {
451
+					foreach ($payments as $payment) {
452 452
 						$donations[] = $payment->ID;
453 453
 					}
454 454
 
455
-					$donor          = new Give_Donor( $donor_ids[ $page ], true );
455
+					$donor          = new Give_Donor($donor_ids[$page], true);
456 456
 					$data_to_update = array(
457
-						'purchase_count' => count( $donations ),
458
-						'payment_ids'    => implode( ',', $donations ),
457
+						'purchase_count' => count($donations),
458
+						'payment_ids'    => implode(',', $donations),
459 459
 					);
460
-					$donor->update( $data_to_update );
460
+					$donor->update($data_to_update);
461 461
 				}
462 462
 			} // End if().
463 463
 
464
-			$page ++;
465
-			$this->update_option( $this->step_on_key, $page );
466
-			if ( $count === $page ) {
464
+			$page++;
465
+			$this->update_option($this->step_on_key, $page);
466
+			if ($count === $page) {
467 467
 				$this->is_empty = false;
468 468
 
469 469
 				return false;
@@ -483,24 +483,24 @@  discard block
 block discarded – undo
483 483
 	 *
484 484
 	 * @return mixed
485 485
 	 */
486
-	public function get_delete_ids( $donation_ids, $page ) {
487
-		$index            = $page --;
488
-		$count            = count( $donation_ids );
486
+	public function get_delete_ids($donation_ids, $page) {
487
+		$index            = $page--;
488
+		$count            = count($donation_ids);
489 489
 		$temp             = 0;
490 490
 		$current_page     = 0;
491 491
 		$post_delete      = $this->per_step;
492 492
 		$page_donation_id = array();
493 493
 
494
-		foreach ( $donation_ids as $item ) {
495
-			$temp ++;
496
-			$page_donation_id[ $current_page ][] = $item;
497
-			if ( $temp === $post_delete ) {
498
-				$current_page ++;
494
+		foreach ($donation_ids as $item) {
495
+			$temp++;
496
+			$page_donation_id[$current_page][] = $item;
497
+			if ($temp === $post_delete) {
498
+				$current_page++;
499 499
 				$temp = 0;
500 500
 			}
501 501
 		}
502 502
 
503
-		return $page_donation_id[ $page ];
503
+		return $page_donation_id[$page];
504 504
 	}
505 505
 
506 506
 	/**
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
 	 *
514 514
 	 * @return mixed Returns the data from the database
515 515
 	 */
516
-	public function get_option( $key, $default_value = false ) {
517
-		return get_option( $key, $default_value );
516
+	public function get_option($key, $default_value = false) {
517
+		return get_option($key, $default_value);
518 518
 	}
519 519
 
520 520
 	/**
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 	 *
528 528
 	 * @return void
529 529
 	 */
530
-	public function update_option( $key, $value ) {
531
-		update_option( $key, $value, false );
530
+	public function update_option($key, $value) {
531
+		update_option($key, $value, false);
532 532
 	}
533 533
 
534 534
 	/**
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
 	 *
541 541
 	 * @return void
542 542
 	 */
543
-	public function delete_option( $key ) {
544
-		delete_option( $key );
543
+	public function delete_option($key) {
544
+		delete_option($key);
545 545
 	}
546 546
 
547 547
 	/**
@@ -552,12 +552,12 @@  discard block
 block discarded – undo
552 552
 	 * @return int|string
553 553
 	 */
554 554
 	private function get_step() {
555
-		$step_key = (string) $this->get_option( $this->step_key, false );
556
-		if ( 'count' === $step_key ) {
555
+		$step_key = (string) $this->get_option($this->step_key, false);
556
+		if ('count' === $step_key) {
557 557
 			return 1;
558
-		} elseif ( 'donation' === $step_key ) {
558
+		} elseif ('donation' === $step_key) {
559 559
 			return 2;
560
-		} elseif ( 'donor' === $step_key ) {
560
+		} elseif ('donor' === $step_key) {
561 561
 			return 3;
562 562
 		} else {
563 563
 			return $step_key;
@@ -568,6 +568,6 @@  discard block
 block discarded – undo
568 568
 	 * Get the current $page value in the ajax.
569 569
 	 */
570 570
 	private function get_step_page() {
571
-		return $this->get_option( $this->step_on_key, false );
571
+		return $this->get_option($this->step_on_key, false);
572 572
 	}
573 573
 }
Please login to merge, or discard this patch.
includes/class-give-comment.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 * @param int        $comment_id
446 446
 	 * @param WP_Comment $comment
447 447
 	 *
448
-	 * @return mixed
448
+	 * @return string
449 449
 	 */
450 450
 	public function __get_comment_author( $author, $comment_id, $comment ) {
451 451
 		if ( in_array( $comment->comment_type, $this->comment_types ) ) {
@@ -468,6 +468,7 @@  discard block
 block discarded – undo
468 468
 	 * @access public
469 469
 	 *
470 470
 	 * @param array @comment_types
471
+	 * @param string[] $comment_types
471 472
 	 *
472 473
 	 * @return array
473 474
 	 */
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @return Give_Comment
47 47
 	 */
48 48
 	public static function get_instance() {
49
-		if ( null === static::$instance ) {
49
+		if (null === static::$instance) {
50 50
 			self::$instance = new static();
51 51
 			self::$instance->init();
52 52
 		}
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 		 */
69 69
 		$this->comment_types = apply_filters(
70 70
 			'give_comment_type',
71
-			self::get_comment_types( array( 'payment', 'donor' ) )
71
+			self::get_comment_types(array('payment', 'donor'))
72 72
 		);
73 73
 
74
-		add_action( 'pre_get_comments', array( $this, 'hide_comments' ), 10 );
75
-		add_filter( 'comments_clauses', array( $this, 'hide_comments_pre_wp_41' ), 10, 1 );
76
-		add_filter( 'comment_feed_where', array( $this, 'hide_comments_from_feeds' ), 10, 1 );
77
-		add_filter( 'wp_count_comments', array( $this, 'remove_comments_from_comment_counts' ), 10, 2 );
78
-		add_filter( 'get_comment_author', array( $this, '__get_comment_author' ), 10, 3 );
74
+		add_action('pre_get_comments', array($this, 'hide_comments'), 10);
75
+		add_filter('comments_clauses', array($this, 'hide_comments_pre_wp_41'), 10, 1);
76
+		add_filter('comment_feed_where', array($this, 'hide_comments_from_feeds'), 10, 1);
77
+		add_filter('wp_count_comments', array($this, 'remove_comments_from_comment_counts'), 10, 2);
78
+		add_filter('get_comment_author', array($this, '__get_comment_author'), 10, 3);
79 79
 	}
80 80
 
81 81
 	/**
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return int|WP_Error
93 93
 	 */
94
-	public static function add( $id, $note, $comment_type, $comment_args = array() ) {
94
+	public static function add($id, $note, $comment_type, $comment_args = array()) {
95 95
 		// Bailout
96
-		if ( empty( $id ) || empty( $note ) || empty( $comment_type ) ) {
97
-			return new WP_Error( 'give_invalid_required_param', __( 'This comment has invalid ID or comment text or cooment type', 'give' ) );
96
+		if (empty($id) || empty($note) || empty($comment_type)) {
97
+			return new WP_Error('give_invalid_required_param', __('This comment has invalid ID or comment text or cooment type', 'give'));
98 98
 		}
99 99
 
100
-		$is_existing_comment = array_key_exists( 'comment_ID', $comment_args ) && ! empty( $comment_args['comment_ID'] );
100
+		$is_existing_comment = array_key_exists('comment_ID', $comment_args) && ! empty($comment_args['comment_ID']);
101 101
 		$action_type         = $is_existing_comment ? 'update' : 'insert';
102 102
 
103 103
 		/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		 *
109 109
 		 * @since 1.0
110 110
 		 */
111
-		do_action( "give_pre_{$action_type}_{$comment_type}_note", $id, $note );
111
+		do_action("give_pre_{$action_type}_{$comment_type}_note", $id, $note);
112 112
 
113 113
 		$comment_args = wp_parse_args(
114 114
 			$comment_args,
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 				'comment_post_ID'      => $id,
117 117
 				'comment_content'      => $note,
118 118
 				'user_id'              => is_admin() ? get_current_user_id() : 0,
119
-				'comment_date'         => current_time( 'mysql' ),
120
-				'comment_date_gmt'     => current_time( 'mysql', 1 ),
119
+				'comment_date'         => current_time('mysql'),
120
+				'comment_date_gmt'     => current_time('mysql', 1),
121 121
 				'comment_approved'     => 1,
122 122
 				'comment_parent'       => 0,
123 123
 				'comment_author'       => '',
@@ -131,24 +131,24 @@  discard block
 block discarded – undo
131 131
 
132 132
 
133 133
 		// Check comment max length.
134
-		$error = wp_check_comment_data_max_lengths( $comment_args );
135
-		if( is_wp_error( $error ) ) {
134
+		$error = wp_check_comment_data_max_lengths($comment_args);
135
+		if (is_wp_error($error)) {
136 136
 			return $error;
137 137
 		}
138 138
 
139 139
 		// Remove moderation emails when comment posted.
140
-		remove_action( 'comment_post', 'wp_new_comment_notify_moderator' );
141
-		remove_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
140
+		remove_action('comment_post', 'wp_new_comment_notify_moderator');
141
+		remove_action('comment_post', 'wp_new_comment_notify_postauthor');
142 142
 
143 143
 		$comment_id = $is_existing_comment
144
-			? wp_update_comment( $comment_args )
145
-			: wp_new_comment( $comment_args, true );
144
+			? wp_update_comment($comment_args)
145
+			: wp_new_comment($comment_args, true);
146 146
 
147 147
 		// Add moderation emails when comment posted.
148
-		add_action( 'comment_post', 'wp_new_comment_notify_moderator' );
149
-		add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
148
+		add_action('comment_post', 'wp_new_comment_notify_moderator');
149
+		add_action('comment_post', 'wp_new_comment_notify_postauthor');
150 150
 
151
-		update_comment_meta( $comment_id, "_give_{$comment_type}_id", $id );
151
+		update_comment_meta($comment_id, "_give_{$comment_type}_id", $id);
152 152
 
153 153
 		/**
154 154
 		 * Fires after payment|donor comment inserted/updated.
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		 *
160 160
 		 * @since 1.0
161 161
 		 */
162
-		do_action( "give_{$action_type}_{$comment_type}_note", $comment_id, $id, $note );
162
+		do_action("give_{$action_type}_{$comment_type}_note", $comment_id, $id, $note);
163 163
 
164 164
 		return $comment_id;
165 165
 	}
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @return bool True on success, false otherwise.
181 181
 	 */
182
-	public static function delete( $comment_id, $id, $comment_type ) {
182
+	public static function delete($comment_id, $id, $comment_type) {
183 183
 		$ret = false;
184 184
 
185 185
 		// Bailout
186
-		if ( empty( $id ) || empty( $comment_id ) || empty( $comment_type ) ) {
186
+		if (empty($id) || empty($comment_id) || empty($comment_type)) {
187 187
 			return $ret;
188 188
 		}
189 189
 
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 		 *
196 196
 		 * @since 1.0
197 197
 		 */
198
-		do_action( "give_pre_delete_{$comment_type}_note", $comment_id, $id );
198
+		do_action("give_pre_delete_{$comment_type}_note", $comment_id, $id);
199 199
 
200
-		$ret = wp_delete_comment( $comment_id, true );
200
+		$ret = wp_delete_comment($comment_id, true);
201 201
 
202 202
 		/**
203 203
 		 * Fires after donation note deleted.
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		 *
209 209
 		 * @since 1.0
210 210
 		 */
211
-		do_action( "give_post_delete_{$comment_type}_note", $comment_id, $id, $ret );
211
+		do_action("give_post_delete_{$comment_type}_note", $comment_id, $id, $ret);
212 212
 
213 213
 		return $ret;
214 214
 	}
@@ -227,25 +227,25 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @return array
229 229
 	 */
230
-	public static function get( $id, $comment_type, $comment_args = array(), $search = '' ) {
230
+	public static function get($id, $comment_type, $comment_args = array(), $search = '') {
231 231
 		$comments = array();
232 232
 
233 233
 		// Set default meta_query value.
234
-		if ( ! isset( $comment_args['meta_query'] ) ) {
234
+		if ( ! isset($comment_args['meta_query'])) {
235 235
 			$comment_args['meta_query'] = array();
236 236
 		}
237 237
 
238 238
 		// Bailout
239
-		if ( empty( $id ) || empty( $comment_type ) ) {
239
+		if (empty($id) || empty($comment_type)) {
240 240
 			return $comments;
241 241
 		}
242 242
 
243
-		remove_action( 'pre_get_comments', array( self::$instance, 'hide_comments' ), 10 );
244
-		remove_filter( 'comments_clauses', array( self::$instance, 'hide_comments_pre_wp_41' ), 10 );
243
+		remove_action('pre_get_comments', array(self::$instance, 'hide_comments'), 10);
244
+		remove_filter('comments_clauses', array(self::$instance, 'hide_comments_pre_wp_41'), 10);
245 245
 
246
-		switch ( $comment_type ) {
246
+		switch ($comment_type) {
247 247
 			case 'payment':
248
-				$comment_args['meta_query'] = ! empty( $comment_args['meta_query'] )
248
+				$comment_args['meta_query'] = ! empty($comment_args['meta_query'])
249 249
 					? $comment_args['meta_query']
250 250
 					: array(
251 251
 						array(
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 						)
255 255
 					);
256 256
 
257
-				$comments = get_comments( wp_parse_args(
257
+				$comments = get_comments(wp_parse_args(
258 258
 					$comment_args,
259 259
 					array(
260 260
 						'post_id' => $id,
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 						'search'  => $search,
263 263
 						'type'    => 'give_payment_note'
264 264
 					)
265
-				) );
265
+				));
266 266
 				break;
267 267
 
268 268
 			case 'donor':
269
-				$comment_args['meta_query'] = ! empty( $comment_args['meta_query'] )
269
+				$comment_args['meta_query'] = ! empty($comment_args['meta_query'])
270 270
 					? $comment_args['meta_query']
271 271
 					: array(
272 272
 						array(
@@ -275,19 +275,19 @@  discard block
 block discarded – undo
275 275
 						)
276 276
 					);
277 277
 
278
-				$comments = get_comments( wp_parse_args(
278
+				$comments = get_comments(wp_parse_args(
279 279
 					$comment_args,
280 280
 					array(
281 281
 						'order'  => 'ASC',
282 282
 						'search' => $search,
283 283
 						'type'   => 'give_donor_note'
284 284
 					)
285
-				) );
285
+				));
286 286
 				break;
287 287
 		}
288 288
 
289
-		add_action( 'pre_get_comments', array( self::$instance, 'hide_comments' ), 10, 1 );
290
-		add_filter( 'comments_clauses', array( self::$instance, 'hide_comments_pre_wp_41' ), 10, 1 );
289
+		add_action('pre_get_comments', array(self::$instance, 'hide_comments'), 10, 1);
290
+		add_filter('comments_clauses', array(self::$instance, 'hide_comments_pre_wp_41'), 10, 1);
291 291
 
292 292
 		return $comments;
293 293
 	}
@@ -303,14 +303,14 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @return void
305 305
 	 */
306
-	public function hide_comments( $query ) {
307
-		if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) {
308
-			$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
309
-			if ( ! is_array( $types ) ) {
310
-				$types = array( $types );
306
+	public function hide_comments($query) {
307
+		if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) {
308
+			$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
309
+			if ( ! is_array($types)) {
310
+				$types = array($types);
311 311
 			}
312 312
 
313
-			$types = array_filter( array_merge( $types, $this->comment_types ) );
313
+			$types = array_filter(array_merge($types, $this->comment_types));
314 314
 
315 315
 			$query->query_vars['type__not_in'] = $types;
316 316
 		}
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
 	 *
327 327
 	 * @return array $clauses Updated comment clauses.
328 328
 	 */
329
-	public function hide_comments_pre_wp_41( $clauses ) {
330
-		if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) {
331
-			foreach ( $this->comment_types as $comment_type ) {
329
+	public function hide_comments_pre_wp_41($clauses) {
330
+		if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) {
331
+			foreach ($this->comment_types as $comment_type) {
332 332
 				$clauses['where'] .= " AND comment_type != \"{$comment_type}\"";
333 333
 			}
334 334
 		}
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
 	 *
347 347
 	 * @return string $where
348 348
 	 */
349
-	public function hide_comments_from_feeds( $where ) {
349
+	public function hide_comments_from_feeds($where) {
350 350
 		global $wpdb;
351 351
 
352
-		foreach ( $this->comment_types as $comment_type ) {
353
-			$where .= $wpdb->prepare( ' AND comment_type!=%s', $comment_type );
352
+		foreach ($this->comment_types as $comment_type) {
353
+			$where .= $wpdb->prepare(' AND comment_type!=%s', $comment_type);
354 354
 		}
355 355
 
356 356
 		return $where;
@@ -367,30 +367,30 @@  discard block
 block discarded – undo
367 367
 	 *
368 368
 	 * @return array|object Array of comment counts.
369 369
 	 */
370
-	public function remove_comments_from_comment_counts( $stats, $post_id ) {
370
+	public function remove_comments_from_comment_counts($stats, $post_id) {
371 371
 		global $wpdb;
372 372
 
373 373
 		$post_id = (int) $post_id;
374 374
 
375
-		if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
375
+		if (apply_filters('give_count_payment_notes_in_comments', false)) {
376 376
 			return $stats;
377 377
 		}
378 378
 
379
-		$stats = Give_Cache::get_group( "comments-{$post_id}", 'counts' );
379
+		$stats = Give_Cache::get_group("comments-{$post_id}", 'counts');
380 380
 
381 381
 		// Return result from cache.
382
-		if ( ! is_null( $stats ) ) {
382
+		if ( ! is_null($stats)) {
383 383
 			return $stats;
384 384
 		}
385 385
 
386 386
 		$where = 'WHERE';
387 387
 
388
-		foreach ( $this->comment_types as $index => $comment_type ) {
389
-			$where .= ( $index ? ' AND ' : ' ' ) . "comment_type != \"{$comment_type}\"";
388
+		foreach ($this->comment_types as $index => $comment_type) {
389
+			$where .= ($index ? ' AND ' : ' ')."comment_type != \"{$comment_type}\"";
390 390
 		}
391 391
 
392
-		if ( $post_id > 0 ) {
393
-			$where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
392
+		if ($post_id > 0) {
393
+			$where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id);
394 394
 		}
395 395
 
396 396
 		$count = $wpdb->get_results(
@@ -411,26 +411,26 @@  discard block
 block discarded – undo
411 411
 			'post-trashed' => 'post-trashed',
412 412
 		);
413 413
 
414
-		foreach ( (array) $count as $row ) {
414
+		foreach ((array) $count as $row) {
415 415
 			// Don't count post-trashed toward totals.
416
-			if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
416
+			if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
417 417
 				$total += $row['num_comments'];
418 418
 			}
419
-			if ( isset( $approved[ $row['comment_approved'] ] ) ) {
420
-				$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
419
+			if (isset($approved[$row['comment_approved']])) {
420
+				$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
421 421
 			}
422 422
 		}
423 423
 
424 424
 		$stats['total_comments'] = $stats['all'] = $total;
425
-		foreach ( $approved as $key ) {
426
-			if ( empty( $stats[ $key ] ) ) {
427
-				$stats[ $key ] = 0;
425
+		foreach ($approved as $key) {
426
+			if (empty($stats[$key])) {
427
+				$stats[$key] = 0;
428 428
 			}
429 429
 		}
430 430
 
431 431
 		$stats = (object) $stats;
432 432
 
433
-		Give_Cache::set_group( "comments-{$post_id}", $stats, 'counts' );
433
+		Give_Cache::set_group("comments-{$post_id}", $stats, 'counts');
434 434
 
435 435
 		return $stats;
436 436
 	}
@@ -447,12 +447,12 @@  discard block
 block discarded – undo
447 447
 	 *
448 448
 	 * @return mixed
449 449
 	 */
450
-	public function __get_comment_author( $author, $comment_id, $comment ) {
451
-		if ( in_array( $comment->comment_type, $this->comment_types ) ) {
452
-			switch ( $comment->comment_type ) {
450
+	public function __get_comment_author($author, $comment_id, $comment) {
451
+		if (in_array($comment->comment_type, $this->comment_types)) {
452
+			switch ($comment->comment_type) {
453 453
 				case 'give_payment_note':
454
-					if ( get_comment_meta( $comment_id, '_give_donor_id', true ) ) {
455
-						$author = give_get_donor_name_by( $comment->comment_post_ID );
454
+					if (get_comment_meta($comment_id, '_give_donor_id', true)) {
455
+						$author = give_get_donor_name_by($comment->comment_post_ID);
456 456
 					}
457 457
 			}
458 458
 		}
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
 	 *
472 472
 	 * @return array
473 473
 	 */
474
-	public static function get_comment_types( $comment_types ) {
474
+	public static function get_comment_types($comment_types) {
475 475
 		$_comment_types = array();
476
-		foreach ( $comment_types as $comment_type ) {
476
+		foreach ($comment_types as $comment_type) {
477 477
 			$_comment_types[] = "give_{$comment_type}_note";
478 478
 		}
479 479
 
Please login to merge, or discard this patch.
includes/class-give-db-meta.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	/**
280 280
 	 * Rename query clauses for new meta table
281 281
 	 *
282
-	 * @param $clause
282
+	 * @param string $clause
283 283
 	 * @param $filter
284 284
 	 *
285 285
 	 * @return mixed
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 	 * @since  2.0.4
516 516
 	 * @access public
517 517
 	 *
518
-	 * @return string
518
+	 * @return boolean
519 519
 	 */
520 520
 	public function get_meta_type() {
521 521
 		return $this->meta_type;
Please login to merge, or discard this patch.
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -77,40 +77,40 @@  discard block
 block discarded – undo
77 77
 		parent::__construct();
78 78
 
79 79
 		// Bailout.
80
-		if ( empty( $this->supports ) || ! $this->is_custom_meta_table_active() ) {
80
+		if (empty($this->supports) || ! $this->is_custom_meta_table_active()) {
81 81
 			return;
82 82
 		}
83 83
 
84
-		if ( in_array( 'add_post_metadata', $this->supports ) ) {
85
-			add_filter( 'add_post_metadata', array( $this, '__add_meta' ), 0, 5 );
84
+		if (in_array('add_post_metadata', $this->supports)) {
85
+			add_filter('add_post_metadata', array($this, '__add_meta'), 0, 5);
86 86
 		}
87 87
 
88
-		if ( in_array( 'get_post_metadata', $this->supports ) ) {
89
-			add_filter( 'get_post_metadata', array( $this, '__get_meta' ), 10, 4 );
88
+		if (in_array('get_post_metadata', $this->supports)) {
89
+			add_filter('get_post_metadata', array($this, '__get_meta'), 10, 4);
90 90
 		}
91 91
 
92
-		if ( in_array( 'update_post_metadata', $this->supports ) ) {
93
-			add_filter( 'update_post_metadata', array( $this, '__update_meta' ), 0, 5 );
92
+		if (in_array('update_post_metadata', $this->supports)) {
93
+			add_filter('update_post_metadata', array($this, '__update_meta'), 0, 5);
94 94
 		}
95 95
 
96
-		if ( in_array( 'delete_post_metadata', $this->supports ) ) {
97
-			add_filter( 'delete_post_metadata', array( $this, '__delete_meta' ), 0, 5 );
96
+		if (in_array('delete_post_metadata', $this->supports)) {
97
+			add_filter('delete_post_metadata', array($this, '__delete_meta'), 0, 5);
98 98
 		}
99 99
 
100
-		if ( in_array( 'posts_where', $this->supports ) ) {
101
-			add_filter( 'posts_where', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
100
+		if (in_array('posts_where', $this->supports)) {
101
+			add_filter('posts_where', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
102 102
 		}
103 103
 
104
-		if ( in_array( 'posts_join', $this->supports ) ) {
105
-			add_filter( 'posts_join', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
104
+		if (in_array('posts_join', $this->supports)) {
105
+			add_filter('posts_join', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
106 106
 		}
107 107
 
108
-		if ( in_array( 'posts_groupby', $this->supports ) ) {
109
-			add_filter( 'posts_groupby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
108
+		if (in_array('posts_groupby', $this->supports)) {
109
+			add_filter('posts_groupby', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
110 110
 		}
111 111
 
112
-		if ( in_array( 'posts_orderby', $this->supports ) ) {
113
-			add_filter( 'posts_orderby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
112
+		if (in_array('posts_orderby', $this->supports)) {
113
+			add_filter('posts_orderby', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
114 114
 		}
115 115
 	}
116 116
 
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 	 * @return  mixed                 Will be an array if $single is false. Will be value of meta data field if $single
129 129
 	 *                                is true.
130 130
 	 */
131
-	public function get_meta( $id = 0, $meta_key = '', $single = false ) {
132
-		$id = $this->sanitize_id( $id );
131
+	public function get_meta($id = 0, $meta_key = '', $single = false) {
132
+		$id = $this->sanitize_id($id);
133 133
 
134 134
 		// Bailout.
135
-		if ( ! $this->is_valid_post_type( $id ) ) {
135
+		if ( ! $this->is_valid_post_type($id)) {
136 136
 			return $this->check;
137 137
 		}
138 138
 
139
-		if ( $this->raw_result ) {
140
-			if ( ! ( $value = get_metadata( $this->meta_type, $id, $meta_key, false ) ) ) {
139
+		if ($this->raw_result) {
140
+			if ( ! ($value = get_metadata($this->meta_type, $id, $meta_key, false))) {
141 141
 				$value = '';
142 142
 			}
143 143
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			$this->raw_result = false;
146 146
 
147 147
 		} else {
148
-			$value = get_metadata( $this->meta_type, $id, $meta_key, $single );
148
+			$value = get_metadata($this->meta_type, $id, $meta_key, $single);
149 149
 		}
150 150
 
151 151
 		return $value;
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @return  int|bool                  False for failure. True for success.
169 169
 	 */
170
-	public function add_meta( $id = 0, $meta_key = '', $meta_value, $unique = false ) {
171
-		$id = $this->sanitize_id( $id );
170
+	public function add_meta($id = 0, $meta_key = '', $meta_value, $unique = false) {
171
+		$id = $this->sanitize_id($id);
172 172
 
173 173
 		// Bailout.
174
-		if ( ! $this->is_valid_post_type( $id ) ) {
174
+		if ( ! $this->is_valid_post_type($id)) {
175 175
 			return $this->check;
176 176
 		}
177 177
 
178
-		$meta_id = add_metadata( $this->meta_type, $id, $meta_key, $meta_value, $unique );
178
+		$meta_id = add_metadata($this->meta_type, $id, $meta_key, $meta_value, $unique);
179 179
 
180
-		if ( $meta_id ) {
181
-			$this->delete_cache( $id );
180
+		if ($meta_id) {
181
+			$this->delete_cache($id);
182 182
 		}
183 183
 
184 184
 		return $meta_id;
@@ -204,18 +204,18 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return  int|bool                  False on failure, true if success.
206 206
 	 */
207
-	public function update_meta( $id = 0, $meta_key = '', $meta_value, $prev_value = '' ) {
208
-		$id = $this->sanitize_id( $id );
207
+	public function update_meta($id = 0, $meta_key = '', $meta_value, $prev_value = '') {
208
+		$id = $this->sanitize_id($id);
209 209
 
210 210
 		// Bailout.
211
-		if ( ! $this->is_valid_post_type( $id ) ) {
211
+		if ( ! $this->is_valid_post_type($id)) {
212 212
 			return $this->check;
213 213
 		}
214 214
 
215
-		$meta_id = update_metadata( $this->meta_type, $id, $meta_key, $meta_value, $prev_value );
215
+		$meta_id = update_metadata($this->meta_type, $id, $meta_key, $meta_value, $prev_value);
216 216
 
217
-		if ( $meta_id ) {
218
-			$this->delete_cache( $id );
217
+		if ($meta_id) {
218
+			$this->delete_cache($id);
219 219
 		}
220 220
 
221 221
 		return $meta_id;
@@ -238,18 +238,18 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @return  bool                  False for failure. True for success.
240 240
 	 */
241
-	public function delete_meta( $id = 0, $meta_key = '', $meta_value = '', $delete_all = '' ) {
242
-		$id = $this->sanitize_id( $id );
241
+	public function delete_meta($id = 0, $meta_key = '', $meta_value = '', $delete_all = '') {
242
+		$id = $this->sanitize_id($id);
243 243
 
244 244
 		// Bailout.
245
-		if ( ! $this->is_valid_post_type( $id ) ) {
245
+		if ( ! $this->is_valid_post_type($id)) {
246 246
 			return $this->check;
247 247
 		}
248 248
 
249
-		$is_meta_deleted = delete_metadata( $this->meta_type, $id, $meta_key, $meta_value, $delete_all );
249
+		$is_meta_deleted = delete_metadata($this->meta_type, $id, $meta_key, $meta_value, $delete_all);
250 250
 
251
-		if ( $is_meta_deleted ) {
252
-			$this->delete_cache( $id );
251
+		if ($is_meta_deleted) {
252
+			$this->delete_cache($id);
253 253
 		}
254 254
 
255 255
 		return $is_meta_deleted;
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @return string
268 268
 	 */
269
-	public function __rename_meta_table_name_in_query( $clause, $wp_query ) {
269
+	public function __rename_meta_table_name_in_query($clause, $wp_query) {
270 270
 		// Add new table to sql query.
271
-		if ( $this->is_post_type_query( $wp_query ) && ! empty( $wp_query->meta_query->queries ) ) {
272
-			$clause = $this->__rename_meta_table_name( $clause, current_filter() );
271
+		if ($this->is_post_type_query($wp_query) && ! empty($wp_query->meta_query->queries)) {
272
+			$clause = $this->__rename_meta_table_name($clause, current_filter());
273 273
 		}
274 274
 
275 275
 		return $clause;
@@ -284,42 +284,42 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @return mixed
286 286
 	 */
287
-	public function __rename_meta_table_name( $clause, $filter ) {
287
+	public function __rename_meta_table_name($clause, $filter) {
288 288
 		global $wpdb;
289 289
 
290
-		$clause = str_replace( "{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause );
291
-		$clause = str_replace( $wpdb->postmeta, $this->table_name, $clause );
290
+		$clause = str_replace("{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause);
291
+		$clause = str_replace($wpdb->postmeta, $this->table_name, $clause);
292 292
 
293
-		switch ( $filter ) {
293
+		switch ($filter) {
294 294
 			case 'posts_join':
295
-				$joins = array( 'INNER JOIN', 'LEFT JOIN' );
295
+				$joins = array('INNER JOIN', 'LEFT JOIN');
296 296
 
297
-				foreach ( $joins as $join ) {
298
-					if ( false !== strpos( $clause, $join ) ) {
299
-						$clause = explode( $join, $clause );
297
+				foreach ($joins as $join) {
298
+					if (false !== strpos($clause, $join)) {
299
+						$clause = explode($join, $clause);
300 300
 
301
-						foreach ( $clause as $key => $clause_part ) {
302
-							if ( empty( $clause_part ) ) {
301
+						foreach ($clause as $key => $clause_part) {
302
+							if (empty($clause_part)) {
303 303
 								continue;
304 304
 							}
305 305
 
306
-							preg_match( '/' . $wpdb->prefix . 'give_' . $this->meta_type . 'meta AS (.*) ON/', $clause_part, $alias_table_name );
306
+							preg_match('/'.$wpdb->prefix.'give_'.$this->meta_type.'meta AS (.*) ON/', $clause_part, $alias_table_name);
307 307
 
308
-							if ( isset( $alias_table_name[1] ) ) {
309
-								$clause[ $key ] = str_replace( "{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part );
308
+							if (isset($alias_table_name[1])) {
309
+								$clause[$key] = str_replace("{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part);
310 310
 							}
311 311
 						}
312 312
 
313
-						$clause = implode( "{$join} ", $clause );
313
+						$clause = implode("{$join} ", $clause);
314 314
 					}
315 315
 				}
316 316
 				break;
317 317
 
318 318
 			case 'posts_where':
319
-				$clause = str_replace( array( 'mt2.post_id', 'mt1.post_id' ), array(
319
+				$clause = str_replace(array('mt2.post_id', 'mt1.post_id'), array(
320 320
 					"mt2.{$this->meta_type}_id",
321 321
 					"mt1.{$this->meta_type}_id"
322
-				), $clause );
322
+				), $clause);
323 323
 				break;
324 324
 		}
325 325
 
@@ -337,19 +337,19 @@  discard block
 block discarded – undo
337 337
 	 *
338 338
 	 * @return bool
339 339
 	 */
340
-	protected function is_post_type_query( $wp_query ) {
340
+	protected function is_post_type_query($wp_query) {
341 341
 		$status = false;
342 342
 
343 343
 		// Check if it is payment query.
344
-		if ( ! empty( $wp_query->query['post_type'] ) ) {
344
+		if ( ! empty($wp_query->query['post_type'])) {
345 345
 			if (
346
-				is_string( $wp_query->query['post_type'] ) &&
346
+				is_string($wp_query->query['post_type']) &&
347 347
 				$this->post_type === $wp_query->query['post_type']
348 348
 			) {
349 349
 				$status = true;
350 350
 			} elseif (
351
-				is_array( $wp_query->query['post_type'] ) &&
352
-				in_array( $this->post_type, $wp_query->query['post_type'] )
351
+				is_array($wp_query->query['post_type']) &&
352
+				in_array($this->post_type, $wp_query->query['post_type'])
353 353
 			) {
354 354
 				$status = true;
355 355
 			}
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
 	 *
369 369
 	 * @return bool
370 370
 	 */
371
-	protected function is_valid_post_type( $ID ) {
372
-		return $ID && ( $this->post_type === get_post_type( $ID ) );
371
+	protected function is_valid_post_type($ID) {
372
+		return $ID && ($this->post_type === get_post_type($ID));
373 373
 	}
374 374
 
375 375
 	/**
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 	 *
396 396
 	 * @return void
397 397
 	 */
398
-	private function delete_cache( $id, $meta_type = '' ) {
399
-		$meta_type = empty( $meta_type ) ? $this->meta_type : $meta_type;
398
+	private function delete_cache($id, $meta_type = '') {
399
+		$meta_type = empty($meta_type) ? $this->meta_type : $meta_type;
400 400
 
401 401
 		$group = array(
402 402
 			'payment'  => 'give-donations', // Backward compatibility
@@ -405,8 +405,8 @@  discard block
 block discarded – undo
405 405
 			'customer' => 'give-donors', // Backward compatibility for pre upgrade in 2.0
406 406
 		);
407 407
 
408
-		if ( array_key_exists( $meta_type, $group ) ) {
409
-			Give_Cache::delete_group( $id, $group[ $meta_type ] );
408
+		if (array_key_exists($meta_type, $group)) {
409
+			Give_Cache::delete_group($id, $group[$meta_type]);
410 410
 		}
411 411
 	}
412 412
 
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 	 *
422 422
 	 * @return mixed
423 423
 	 */
424
-	public function __call( $name, $arguments ) {
425
-		switch ( $name ) {
424
+	public function __call($name, $arguments) {
425
+		switch ($name) {
426 426
 			case '__add_meta':
427 427
 				$this->check = $arguments[0];
428 428
 				$id          = $arguments[1];
@@ -431,11 +431,11 @@  discard block
 block discarded – undo
431 431
 				$unique      = $arguments[4];
432 432
 
433 433
 				// Bailout.
434
-				if ( ! $this->is_valid_post_type( $id ) ) {
434
+				if ( ! $this->is_valid_post_type($id)) {
435 435
 					return $this->check;
436 436
 				}
437 437
 
438
-				return $this->add_meta( $id, $meta_key, $meta_value, $unique );
438
+				return $this->add_meta($id, $meta_key, $meta_value, $unique);
439 439
 
440 440
 			case '__get_meta':
441 441
 				$this->check = $arguments[0];
@@ -444,13 +444,13 @@  discard block
 block discarded – undo
444 444
 				$single      = $arguments[3];
445 445
 
446 446
 				// Bailout.
447
-				if ( ! $this->is_valid_post_type( $id ) ) {
447
+				if ( ! $this->is_valid_post_type($id)) {
448 448
 					return $this->check;
449 449
 				}
450 450
 
451 451
 				$this->raw_result = true;
452 452
 
453
-				return $this->get_meta( $id, $meta_key, $single );
453
+				return $this->get_meta($id, $meta_key, $single);
454 454
 
455 455
 			case '__update_meta':
456 456
 				$this->check = $arguments[0];
@@ -459,11 +459,11 @@  discard block
 block discarded – undo
459 459
 				$meta_value  = $arguments[3];
460 460
 
461 461
 				// Bailout.
462
-				if ( ! $this->is_valid_post_type( $id ) ) {
462
+				if ( ! $this->is_valid_post_type($id)) {
463 463
 					return $this->check;
464 464
 				}
465 465
 
466
-				return $this->update_meta( $id, $meta_key, $meta_value );
466
+				return $this->update_meta($id, $meta_key, $meta_value);
467 467
 
468 468
 			case '__delete_meta':
469 469
 				$this->check = $arguments[0];
@@ -473,11 +473,11 @@  discard block
 block discarded – undo
473 473
 				$delete_all  = $arguments[3];
474 474
 
475 475
 				// Bailout.
476
-				if ( ! $this->is_valid_post_type( $id ) ) {
476
+				if ( ! $this->is_valid_post_type($id)) {
477 477
 					return $this->check;
478 478
 				}
479 479
 
480
-				return $this->delete_meta( $id, $meta_key, $meta_value, $delete_all );
480
+				return $this->delete_meta($id, $meta_key, $meta_value, $delete_all);
481 481
 		}
482 482
 	}
483 483
 
@@ -502,10 +502,10 @@  discard block
 block discarded – undo
502 502
 			KEY meta_key (meta_key({$this->min_index_length}))
503 503
 			) {$charset_collate};";
504 504
 
505
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
506
-		dbDelta( $sql );
505
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
506
+		dbDelta($sql);
507 507
 
508
-		update_option( $this->table_name . '_db_version', $this->version, false );
508
+		update_option($this->table_name.'_db_version', $this->version, false);
509 509
 	}
510 510
 
511 511
 
@@ -531,12 +531,12 @@  discard block
 block discarded – undo
531 531
 	 *
532 532
 	 * @return  bool  False for failure. True for success.
533 533
 	 */
534
-	public function delete_all_meta( $id = 0 ) {
534
+	public function delete_all_meta($id = 0) {
535 535
 		global $wpdb;
536
-		$status = $wpdb->delete( $this->table_name, array( "{$this->meta_type}_id" => $id ), array( '%d' ) );
536
+		$status = $wpdb->delete($this->table_name, array("{$this->meta_type}_id" => $id), array('%d'));
537 537
 
538
-		if ( $status ) {
539
-			$this->delete_cache( $id, $this->meta_type );
538
+		if ($status) {
539
+			$this->delete_cache($id, $this->meta_type);
540 540
 		}
541 541
 
542 542
 		return $status;
Please login to merge, or discard this patch.
includes/class-give-donor.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1052,7 +1052,7 @@
 block discarded – undo
1052 1052
 	 * @access public
1053 1053
 	 *
1054 1054
 	 * @param  string $meta_key   Metadata name. Default is empty.
1055
-	 * @param  mixed  $meta_value Optional. Metadata value. Default is empty.
1055
+	 * @param  string  $meta_value Optional. Metadata value. Default is empty.
1056 1056
 	 *
1057 1057
 	 * @return bool               False for failure. True for success.
1058 1058
 	 */
Please login to merge, or discard this patch.
Spacing   +273 added lines, -273 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
 
@@ -149,29 +149,29 @@  discard block
 block discarded – undo
149 149
 	 * @param int|bool $_id_or_email
150 150
 	 * @param bool     $by_user_id
151 151
 	 */
152
-	public function __construct( $_id_or_email = false, $by_user_id = false ) {
152
+	public function __construct($_id_or_email = false, $by_user_id = false) {
153 153
 
154 154
 		$this->db = Give()->donors;
155 155
 
156
-		if ( false === $_id_or_email || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) ) {
156
+		if (false === $_id_or_email || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))) {
157 157
 			return false;
158 158
 		}
159 159
 
160
-		$by_user_id = is_bool( $by_user_id ) ? $by_user_id : false;
160
+		$by_user_id = is_bool($by_user_id) ? $by_user_id : false;
161 161
 
162
-		if ( is_numeric( $_id_or_email ) ) {
162
+		if (is_numeric($_id_or_email)) {
163 163
 			$field = $by_user_id ? 'user_id' : 'id';
164 164
 		} else {
165 165
 			$field = 'email';
166 166
 		}
167 167
 
168
-		$donor = $this->db->get_donor_by( $field, $_id_or_email );
168
+		$donor = $this->db->get_donor_by($field, $_id_or_email);
169 169
 
170
-		if ( empty( $donor ) || ! is_object( $donor ) ) {
170
+		if (empty($donor) || ! is_object($donor)) {
171 171
 			return false;
172 172
 		}
173 173
 
174
-		$this->setup_donor( $donor );
174
+		$this->setup_donor($donor);
175 175
 
176 176
 	}
177 177
 
@@ -187,19 +187,19 @@  discard block
 block discarded – undo
187 187
 	 *
188 188
 	 * @return bool             If the setup was successful or not.
189 189
 	 */
190
-	private function setup_donor( $donor ) {
190
+	private function setup_donor($donor) {
191 191
 
192
-		if ( ! is_object( $donor ) ) {
192
+		if ( ! is_object($donor)) {
193 193
 			return false;
194 194
 		}
195 195
 
196 196
 		// Get cached donors.
197
-		$donor_vars = Give_Cache::get_group( $donor->id, 'give-donors' );
197
+		$donor_vars = Give_Cache::get_group($donor->id, 'give-donors');
198 198
 
199
-		if ( is_null( $donor_vars ) ) {
200
-			foreach ( $donor as $key => $value ) {
199
+		if (is_null($donor_vars)) {
200
+			foreach ($donor as $key => $value) {
201 201
 
202
-				switch ( $key ) {
202
+				switch ($key) {
203 203
 
204 204
 					case 'notes':
205 205
 						$this->$key = $this->get_notes();
@@ -213,20 +213,20 @@  discard block
 block discarded – undo
213 213
 			}
214 214
 
215 215
 			// Get donor's all email including primary email.
216
-			$this->emails = (array) $this->get_meta( 'additional_email', false );
217
-			$this->emails = array( 'primary' => $this->email ) + $this->emails;
216
+			$this->emails = (array) $this->get_meta('additional_email', false);
217
+			$this->emails = array('primary' => $this->email) + $this->emails;
218 218
 
219 219
 			$this->setup_address();
220 220
 
221
-			Give_Cache::set_group( $donor->id, get_object_vars( $this ), 'give-donors' );
221
+			Give_Cache::set_group($donor->id, get_object_vars($this), 'give-donors');
222 222
 		} else {
223
-			foreach ( $donor_vars as $donor_var => $value ) {
223
+			foreach ($donor_vars as $donor_var => $value) {
224 224
 				$this->$donor_var = $value;
225 225
 			}
226 226
 		}
227 227
 
228 228
 		// Donor ID and email are the only things that are necessary, make sure they exist.
229
-		if ( ! empty( $this->id ) && ! empty( $this->email ) ) {
229
+		if ( ! empty($this->id) && ! empty($this->email)) {
230 230
 			return true;
231 231
 		}
232 232
 
@@ -245,25 +245,25 @@  discard block
 block discarded – undo
245 245
 		global $wpdb;
246 246
 		$meta_type = Give()->donor_meta->meta_type;
247 247
 
248
-		$addresses = $wpdb->get_results( $wpdb->prepare( "
248
+		$addresses = $wpdb->get_results($wpdb->prepare("
249 249
 				SELECT meta_key, meta_value FROM {$wpdb->donormeta}
250 250
 				WHERE meta_key
251 251
 				LIKE '%%%s%%'
252 252
 				AND {$meta_type}_id=%d
253
-				", 'give_donor_address', $this->id ), ARRAY_N );
253
+				", 'give_donor_address', $this->id), ARRAY_N);
254 254
 
255
-		if ( empty( $addresses ) ) {
255
+		if (empty($addresses)) {
256 256
 			return $this->address;
257 257
 		}
258 258
 
259
-		foreach ( $addresses as $address ) {
260
-			$address[0] = str_replace( '_give_donor_address_', '', $address[0] );
261
-			$address[0] = explode( '_', $address[0] );
259
+		foreach ($addresses as $address) {
260
+			$address[0] = str_replace('_give_donor_address_', '', $address[0]);
261
+			$address[0] = explode('_', $address[0]);
262 262
 
263
-			if ( 3 === count( $address[0] ) ) {
264
-				$this->address[ $address[0][0] ][ $address[0][2] ][ $address[0][1] ] = $address[1];
263
+			if (3 === count($address[0])) {
264
+				$this->address[$address[0][0]][$address[0][2]][$address[0][1]] = $address[1];
265 265
 			} else {
266
-				$this->address[ $address[0][0] ][ $address[0][1] ] = $address[1];
266
+				$this->address[$address[0][0]][$address[0][1]] = $address[1];
267 267
 			}
268 268
 		}
269 269
 	}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @return array The donor's address, if any
281 281
 	 */
282
-	public function get_donor_address( $args = array() ) {
282
+	public function get_donor_address($args = array()) {
283 283
 		$args = wp_parse_args(
284 284
 			$args,
285 285
 			array(
@@ -297,24 +297,24 @@  discard block
 block discarded – undo
297 297
 		);
298 298
 
299 299
 		// Backward compatibility.
300
-		if ( ! give_has_upgrade_completed( 'v20_upgrades_user_address' ) ) {
300
+		if ( ! give_has_upgrade_completed('v20_upgrades_user_address')) {
301 301
 
302 302
 			// Backward compatibility for user id param.
303
-			return wp_parse_args( (array) get_user_meta( $this->user_id, '_give_user_address', true ), $default_address );
303
+			return wp_parse_args((array) get_user_meta($this->user_id, '_give_user_address', true), $default_address);
304 304
 
305 305
 		}
306 306
 
307
-		if ( ! $this->id || empty( $this->address ) || ! array_key_exists( $args['address_type'], $this->address ) ) {
307
+		if ( ! $this->id || empty($this->address) || ! array_key_exists($args['address_type'], $this->address)) {
308 308
 			return $default_address;
309 309
 		}
310 310
 
311
-		switch ( true ) {
312
-			case is_string( end( $this->address[ $args['address_type'] ] ) ):
313
-				$address = wp_parse_args( $this->address[ $args['address_type'] ], $default_address );
311
+		switch (true) {
312
+			case is_string(end($this->address[$args['address_type']])):
313
+				$address = wp_parse_args($this->address[$args['address_type']], $default_address);
314 314
 				break;
315 315
 
316
-			case is_array( end( $this->address[ $args['address_type'] ] ) ):
317
-				$address = wp_parse_args( array_shift( $this->address[ $args['address_type'] ] ), $default_address );
316
+			case is_array(end($this->address[$args['address_type']])):
317
+				$address = wp_parse_args(array_shift($this->address[$args['address_type']]), $default_address);
318 318
 				break;
319 319
 		}
320 320
 
@@ -331,16 +331,16 @@  discard block
 block discarded – undo
331 331
 	 *
332 332
 	 * @return mixed|\WP_Error
333 333
 	 */
334
-	public function __get( $key ) {
334
+	public function __get($key) {
335 335
 
336
-		if ( method_exists( $this, 'get_' . $key ) ) {
336
+		if (method_exists($this, 'get_'.$key)) {
337 337
 
338
-			return call_user_func( array( $this, 'get_' . $key ) );
338
+			return call_user_func(array($this, 'get_'.$key));
339 339
 
340 340
 		} else {
341 341
 
342 342
 			/* translators: %s: property key */
343
-			return new WP_Error( 'give-donor-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
343
+			return new WP_Error('give-donor-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
344 344
 
345 345
 		}
346 346
 
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 	 *
357 357
 	 * @return bool|int    False if not a valid creation, donor ID if user is found or valid creation.
358 358
 	 */
359
-	public function create( $data = array() ) {
359
+	public function create($data = array()) {
360 360
 
361
-		if ( $this->id != 0 || empty( $data ) ) {
361
+		if ($this->id != 0 || empty($data)) {
362 362
 			return false;
363 363
 		}
364 364
 
@@ -366,15 +366,15 @@  discard block
 block discarded – undo
366 366
 			'payment_ids' => '',
367 367
 		);
368 368
 
369
-		$args = wp_parse_args( $data, $defaults );
370
-		$args = $this->sanitize_columns( $args );
369
+		$args = wp_parse_args($data, $defaults);
370
+		$args = $this->sanitize_columns($args);
371 371
 
372
-		if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) {
372
+		if (empty($args['email']) || ! is_email($args['email'])) {
373 373
 			return false;
374 374
 		}
375 375
 
376
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
377
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
376
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
377
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
378 378
 		}
379 379
 
380 380
 		/**
@@ -384,18 +384,18 @@  discard block
 block discarded – undo
384 384
 		 *
385 385
 		 * @param array $args Donor attributes.
386 386
 		 */
387
-		do_action( 'give_donor_pre_create', $args );
387
+		do_action('give_donor_pre_create', $args);
388 388
 
389 389
 		$created = false;
390 390
 
391 391
 		// The DB class 'add' implies an update if the donor being asked to be created already exists
392
-		if ( $this->db->add( $data ) ) {
392
+		if ($this->db->add($data)) {
393 393
 
394 394
 			// We've successfully added/updated the donor, reset the class vars with the new data
395
-			$donor = $this->db->get_donor_by( 'email', $args['email'] );
395
+			$donor = $this->db->get_donor_by('email', $args['email']);
396 396
 
397 397
 			// Setup the donor data with the values from DB
398
-			$this->setup_donor( $donor );
398
+			$this->setup_donor($donor);
399 399
 
400 400
 			$created = $this->id;
401 401
 		}
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 		 * @param bool|int $created False if not a valid creation, donor ID if user is found or valid creation.
409 409
 		 * @param array    $args    Customer attributes.
410 410
 		 */
411
-		do_action( 'give_donor_post_create', $created, $args );
411
+		do_action('give_donor_post_create', $created, $args);
412 412
 
413 413
 		return $created;
414 414
 
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
 	 *
425 425
 	 * @return bool        If the update was successful or not.
426 426
 	 */
427
-	public function update( $data = array() ) {
427
+	public function update($data = array()) {
428 428
 
429
-		if ( empty( $data ) ) {
429
+		if (empty($data)) {
430 430
 			return false;
431 431
 		}
432 432
 
433
-		$data = $this->sanitize_columns( $data );
433
+		$data = $this->sanitize_columns($data);
434 434
 
435 435
 		/**
436 436
 		 * Fires before updating donors.
@@ -440,15 +440,15 @@  discard block
 block discarded – undo
440 440
 		 * @param int   $donor_id Donor id.
441 441
 		 * @param array $data     Donor attributes.
442 442
 		 */
443
-		do_action( 'give_donor_pre_update', $this->id, $data );
443
+		do_action('give_donor_pre_update', $this->id, $data);
444 444
 
445 445
 		$updated = false;
446 446
 
447
-		if ( $this->db->update( $this->id, $data ) ) {
447
+		if ($this->db->update($this->id, $data)) {
448 448
 
449
-			$donor = $this->db->get_donor_by( 'id', $this->id );
449
+			$donor = $this->db->get_donor_by('id', $this->id);
450 450
 
451
-			$this->setup_donor( $donor );
451
+			$this->setup_donor($donor);
452 452
 
453 453
 			$updated = true;
454 454
 		}
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 		 * @param int   $donor_id Donor id.
463 463
 		 * @param array $data     Donor attributes.
464 464
 		 */
465
-		do_action( 'give_donor_post_update', $updated, $this->id, $data );
465
+		do_action('give_donor_post_update', $updated, $this->id, $data);
466 466
 
467 467
 		return $updated;
468 468
 	}
@@ -480,27 +480,27 @@  discard block
 block discarded – undo
480 480
 	 *
481 481
 	 * @return bool            If the attachment was successfully.
482 482
 	 */
483
-	public function attach_payment( $payment_id = 0, $update_stats = true ) {
483
+	public function attach_payment($payment_id = 0, $update_stats = true) {
484 484
 
485
-		if ( empty( $payment_id ) ) {
485
+		if (empty($payment_id)) {
486 486
 			return false;
487 487
 		}
488 488
 
489
-		if ( empty( $this->payment_ids ) ) {
489
+		if (empty($this->payment_ids)) {
490 490
 
491 491
 			$new_payment_ids = $payment_id;
492 492
 
493 493
 		} else {
494 494
 
495
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
495
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
496 496
 
497
-			if ( in_array( $payment_id, $payment_ids ) ) {
497
+			if (in_array($payment_id, $payment_ids)) {
498 498
 				$update_stats = false;
499 499
 			}
500 500
 
501 501
 			$payment_ids[] = $payment_id;
502 502
 
503
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
503
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
504 504
 
505 505
 		}
506 506
 
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
 		 * @param int $payment_id Payment id.
513 513
 		 * @param int $donor_id   Donor id.
514 514
 		 */
515
-		do_action( 'give_donor_pre_attach_payment', $payment_id, $this->id );
515
+		do_action('give_donor_pre_attach_payment', $payment_id, $this->id);
516 516
 
517
-		$payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) );
517
+		$payment_added = $this->update(array('payment_ids' => $new_payment_ids));
518 518
 
519
-		if ( $payment_added ) {
519
+		if ($payment_added) {
520 520
 
521 521
 			$this->payment_ids = $new_payment_ids;
522 522
 
523 523
 			// We added this payment successfully, increment the stats
524
-			if ( $update_stats ) {
525
-				$payment_amount = give_donation_amount( $payment_id, array( 'type' => 'stats' ) );
524
+			if ($update_stats) {
525
+				$payment_amount = give_donation_amount($payment_id, array('type' => 'stats'));
526 526
 
527
-				if ( ! empty( $payment_amount ) ) {
528
-					$this->increase_value( $payment_amount );
527
+				if ( ! empty($payment_amount)) {
528
+					$this->increase_value($payment_amount);
529 529
 				}
530 530
 
531 531
 				$this->increase_purchase_count();
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 		 * @param int  $payment_id    Payment id.
542 542
 		 * @param int  $donor_id      Donor id.
543 543
 		 */
544
-		do_action( 'give_donor_post_attach_payment', $payment_added, $payment_id, $this->id );
544
+		do_action('give_donor_post_attach_payment', $payment_added, $payment_id, $this->id);
545 545
 
546 546
 		return $payment_added;
547 547
 	}
@@ -559,33 +559,33 @@  discard block
 block discarded – undo
559 559
 	 *
560 560
 	 * @return boolean               If the removal was successful.
561 561
 	 */
562
-	public function remove_payment( $payment_id = 0, $update_stats = true ) {
562
+	public function remove_payment($payment_id = 0, $update_stats = true) {
563 563
 
564
-		if ( empty( $payment_id ) ) {
564
+		if (empty($payment_id)) {
565 565
 			return false;
566 566
 		}
567 567
 
568
-		$payment = new Give_Payment( $payment_id );
568
+		$payment = new Give_Payment($payment_id);
569 569
 
570
-		if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) {
570
+		if ('publish' !== $payment->status && 'revoked' !== $payment->status) {
571 571
 			$update_stats = false;
572 572
 		}
573 573
 
574 574
 		$new_payment_ids = '';
575 575
 
576
-		if ( ! empty( $this->payment_ids ) ) {
576
+		if ( ! empty($this->payment_ids)) {
577 577
 
578
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
578
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
579 579
 
580
-			$pos = array_search( $payment_id, $payment_ids );
581
-			if ( false === $pos ) {
580
+			$pos = array_search($payment_id, $payment_ids);
581
+			if (false === $pos) {
582 582
 				return false;
583 583
 			}
584 584
 
585
-			unset( $payment_ids[ $pos ] );
586
-			$payment_ids = array_filter( $payment_ids );
585
+			unset($payment_ids[$pos]);
586
+			$payment_ids = array_filter($payment_ids);
587 587
 
588
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
588
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
589 589
 
590 590
 		}
591 591
 
@@ -597,20 +597,20 @@  discard block
 block discarded – undo
597 597
 		 * @param int $payment_id Payment id.
598 598
 		 * @param int $donor_id   Customer id.
599 599
 		 */
600
-		do_action( 'give_donor_pre_remove_payment', $payment_id, $this->id );
600
+		do_action('give_donor_pre_remove_payment', $payment_id, $this->id);
601 601
 
602
-		$payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) );
602
+		$payment_removed = $this->update(array('payment_ids' => $new_payment_ids));
603 603
 
604
-		if ( $payment_removed ) {
604
+		if ($payment_removed) {
605 605
 
606 606
 			$this->payment_ids = $new_payment_ids;
607 607
 
608
-			if ( $update_stats ) {
608
+			if ($update_stats) {
609 609
 				// We removed this payment successfully, decrement the stats
610
-				$payment_amount = give_donation_amount( $payment_id );
610
+				$payment_amount = give_donation_amount($payment_id);
611 611
 
612
-				if ( ! empty( $payment_amount ) ) {
613
-					$this->decrease_value( $payment_amount );
612
+				if ( ! empty($payment_amount)) {
613
+					$this->decrease_value($payment_amount);
614 614
 				}
615 615
 
616 616
 				$this->decrease_donation_count();
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 		 * @param int  $payment_id      Payment id.
627 627
 		 * @param int  $donor_id        Donor id.
628 628
 		 */
629
-		do_action( 'give_donor_post_remove_payment', $payment_removed, $payment_id, $this->id );
629
+		do_action('give_donor_post_remove_payment', $payment_removed, $payment_id, $this->id);
630 630
 
631 631
 		return $payment_removed;
632 632
 
@@ -642,10 +642,10 @@  discard block
 block discarded – undo
642 642
 	 *
643 643
 	 * @return int        The donation count.
644 644
 	 */
645
-	public function increase_purchase_count( $count = 1 ) {
645
+	public function increase_purchase_count($count = 1) {
646 646
 
647 647
 		// Make sure it's numeric and not negative.
648
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
648
+		if ( ! is_numeric($count) || $count != absint($count)) {
649 649
 			return false;
650 650
 		}
651 651
 
@@ -659,9 +659,9 @@  discard block
 block discarded – undo
659 659
 		 * @param int $count    The number to increase by.
660 660
 		 * @param int $donor_id Donor id.
661 661
 		 */
662
-		do_action( 'give_donor_pre_increase_donation_count', $count, $this->id );
662
+		do_action('give_donor_pre_increase_donation_count', $count, $this->id);
663 663
 
664
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
664
+		if ($this->update(array('purchase_count' => $new_total))) {
665 665
 			$this->purchase_count = $new_total;
666 666
 		}
667 667
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 		 * @param int $count          The number increased by.
675 675
 		 * @param int $donor_id       Donor id.
676 676
 		 */
677
-		do_action( 'give_donor_post_increase_donation_count', $this->purchase_count, $count, $this->id );
677
+		do_action('give_donor_post_increase_donation_count', $this->purchase_count, $count, $this->id);
678 678
 
679 679
 		return $this->purchase_count;
680 680
 	}
@@ -689,16 +689,16 @@  discard block
 block discarded – undo
689 689
 	 *
690 690
 	 * @return mixed      If successful, the new count, otherwise false.
691 691
 	 */
692
-	public function decrease_donation_count( $count = 1 ) {
692
+	public function decrease_donation_count($count = 1) {
693 693
 
694 694
 		// Make sure it's numeric and not negative
695
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
695
+		if ( ! is_numeric($count) || $count != absint($count)) {
696 696
 			return false;
697 697
 		}
698 698
 
699 699
 		$new_total = (int) $this->purchase_count - (int) $count;
700 700
 
701
-		if ( $new_total < 0 ) {
701
+		if ($new_total < 0) {
702 702
 			$new_total = 0;
703 703
 		}
704 704
 
@@ -710,9 +710,9 @@  discard block
 block discarded – undo
710 710
 		 * @param int $count    The number to decrease by.
711 711
 		 * @param int $donor_id Customer id.
712 712
 		 */
713
-		do_action( 'give_donor_pre_decrease_donation_count', $count, $this->id );
713
+		do_action('give_donor_pre_decrease_donation_count', $count, $this->id);
714 714
 
715
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
715
+		if ($this->update(array('purchase_count' => $new_total))) {
716 716
 			$this->purchase_count = $new_total;
717 717
 		}
718 718
 
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 		 * @param int $count          The number decreased by.
726 726
 		 * @param int $donor_id       Donor id.
727 727
 		 */
728
-		do_action( 'give_donor_post_decrease_donation_count', $this->purchase_count, $count, $this->id );
728
+		do_action('give_donor_post_decrease_donation_count', $this->purchase_count, $count, $this->id);
729 729
 
730 730
 		return $this->purchase_count;
731 731
 	}
@@ -740,9 +740,9 @@  discard block
 block discarded – undo
740 740
 	 *
741 741
 	 * @return mixed        If successful, the new value, otherwise false.
742 742
 	 */
743
-	public function increase_value( $value = 0.00 ) {
743
+	public function increase_value($value = 0.00) {
744 744
 
745
-		$new_value = floatval( $this->purchase_value ) + $value;
745
+		$new_value = floatval($this->purchase_value) + $value;
746 746
 
747 747
 		/**
748 748
 		 * Fires before increasing donor lifetime value.
@@ -752,9 +752,9 @@  discard block
 block discarded – undo
752 752
 		 * @param float $value    The value to increase by.
753 753
 		 * @param int   $donor_id Customer id.
754 754
 		 */
755
-		do_action( 'give_donor_pre_increase_value', $value, $this->id );
755
+		do_action('give_donor_pre_increase_value', $value, $this->id);
756 756
 
757
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
757
+		if ($this->update(array('purchase_value' => $new_value))) {
758 758
 			$this->purchase_value = $new_value;
759 759
 		}
760 760
 
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 		 * @param float $value          The value increased by.
768 768
 		 * @param int   $donor_id       Donor id.
769 769
 		 */
770
-		do_action( 'give_donor_post_increase_value', $this->purchase_value, $value, $this->id );
770
+		do_action('give_donor_post_increase_value', $this->purchase_value, $value, $this->id);
771 771
 
772 772
 		return $this->purchase_value;
773 773
 	}
@@ -782,11 +782,11 @@  discard block
 block discarded – undo
782 782
 	 *
783 783
 	 * @return mixed        If successful, the new value, otherwise false.
784 784
 	 */
785
-	public function decrease_value( $value = 0.00 ) {
785
+	public function decrease_value($value = 0.00) {
786 786
 
787
-		$new_value = floatval( $this->purchase_value ) - $value;
787
+		$new_value = floatval($this->purchase_value) - $value;
788 788
 
789
-		if ( $new_value < 0 ) {
789
+		if ($new_value < 0) {
790 790
 			$new_value = 0.00;
791 791
 		}
792 792
 
@@ -798,9 +798,9 @@  discard block
 block discarded – undo
798 798
 		 * @param float $value    The value to decrease by.
799 799
 		 * @param int   $donor_id Donor id.
800 800
 		 */
801
-		do_action( 'give_donor_pre_decrease_value', $value, $this->id );
801
+		do_action('give_donor_pre_decrease_value', $value, $this->id);
802 802
 
803
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
803
+		if ($this->update(array('purchase_value' => $new_value))) {
804 804
 			$this->purchase_value = $new_value;
805 805
 		}
806 806
 
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 		 * @param float $value          The value decreased by.
814 814
 		 * @param int   $donor_id       Donor id.
815 815
 		 */
816
-		do_action( 'give_donor_post_decrease_value', $this->purchase_value, $value, $this->id );
816
+		do_action('give_donor_post_decrease_value', $this->purchase_value, $value, $this->id);
817 817
 
818 818
 		return $this->purchase_value;
819 819
 	}
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 	 *
834 834
 	 * @return mixed              If successful, the new donation stat value, otherwise false.
835 835
 	 */
836
-	public function update_donation_value( $curr_amount, $new_amount ) {
836
+	public function update_donation_value($curr_amount, $new_amount) {
837 837
 		/**
838 838
 		 * Payment total difference value can be:
839 839
 		 *  zero   (in case amount not change)
@@ -843,15 +843,15 @@  discard block
 block discarded – undo
843 843
 		$payment_total_diff = $new_amount - $curr_amount;
844 844
 
845 845
 		// We do not need to update donation stat if donation did not change.
846
-		if ( ! $payment_total_diff ) {
846
+		if ( ! $payment_total_diff) {
847 847
 			return false;
848 848
 		}
849 849
 
850
-		if ( $payment_total_diff > 0 ) {
851
-			$this->increase_value( $payment_total_diff );
850
+		if ($payment_total_diff > 0) {
851
+			$this->increase_value($payment_total_diff);
852 852
 		} else {
853 853
 			// Pass payment total difference as +ve value to decrease amount from user lifetime stat.
854
-			$this->decrease_value( - $payment_total_diff );
854
+			$this->decrease_value( -$payment_total_diff );
855 855
 		}
856 856
 
857 857
 		return $this->purchase_value;
@@ -868,15 +868,15 @@  discard block
 block discarded – undo
868 868
 	 *
869 869
 	 * @return array       The notes requested.
870 870
 	 */
871
-	public function get_notes( $length = 20, $paged = 1 ) {
871
+	public function get_notes($length = 20, $paged = 1) {
872 872
 
873
-		$length = is_numeric( $length ) ? $length : 20;
874
-		$offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0;
873
+		$length = is_numeric($length) ? $length : 20;
874
+		$offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0;
875 875
 
876 876
 		$all_notes   = $this->get_raw_notes();
877
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
877
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
878 878
 
879
-		$desired_notes = array_slice( $notes_array, $offset, $length );
879
+		$desired_notes = array_slice($notes_array, $offset, $length);
880 880
 
881 881
 		return $desired_notes;
882 882
 
@@ -893,9 +893,9 @@  discard block
 block discarded – undo
893 893
 	public function get_notes_count() {
894 894
 
895 895
 		$all_notes   = $this->get_raw_notes();
896
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
896
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
897 897
 
898
-		return count( $notes_array );
898
+		return count($notes_array);
899 899
 
900 900
 	}
901 901
 
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 	 *
909 909
 	 * @return string|float
910 910
 	 */
911
-	public function get_total_donation_amount( $args = array() ) {
911
+	public function get_total_donation_amount($args = array()) {
912 912
 
913 913
 		/**
914 914
 		 * Filter total donation amount.
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 		 * @param integer      $donor_id       Donor ID.
920 920
 		 * @param array        $args           Pass additional data.
921 921
 		 */
922
-		return apply_filters( 'give_get_total_donation_amount', $this->purchase_value, $this->id, $args );
922
+		return apply_filters('give_get_total_donation_amount', $this->purchase_value, $this->id, $args);
923 923
 	}
924 924
 
925 925
 	/**
@@ -932,22 +932,22 @@  discard block
 block discarded – undo
932 932
 	 *
933 933
 	 * @return string|boolean The new note if added successfully, false otherwise.
934 934
 	 */
935
-	public function add_note( $note = '' ) {
935
+	public function add_note($note = '') {
936 936
 
937
-		$note = trim( $note );
938
-		if ( empty( $note ) ) {
937
+		$note = trim($note);
938
+		if (empty($note)) {
939 939
 			return false;
940 940
 		}
941 941
 
942 942
 		$notes = $this->get_raw_notes();
943 943
 
944
-		if ( empty( $notes ) ) {
944
+		if (empty($notes)) {
945 945
 			$notes = '';
946 946
 		}
947 947
 
948
-		$note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note;
949
-		$new_note    = apply_filters( 'give_customer_add_note_string', $note_string );
950
-		$notes       .= "\n\n" . $new_note;
948
+		$note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note;
949
+		$new_note    = apply_filters('give_customer_add_note_string', $note_string);
950
+		$notes .= "\n\n".$new_note;
951 951
 
952 952
 		/**
953 953
 		 * Fires before donor note is added.
@@ -957,11 +957,11 @@  discard block
 block discarded – undo
957 957
 		 * @param string $new_note New note to add.
958 958
 		 * @param int    $donor_id Donor id.
959 959
 		 */
960
-		do_action( 'give_donor_pre_add_note', $new_note, $this->id );
960
+		do_action('give_donor_pre_add_note', $new_note, $this->id);
961 961
 
962
-		$updated = $this->update( array( 'notes' => $notes ) );
962
+		$updated = $this->update(array('notes' => $notes));
963 963
 
964
-		if ( $updated ) {
964
+		if ($updated) {
965 965
 			$this->notes = $this->get_notes();
966 966
 		}
967 967
 
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 		 * @param string $new_note    New note added.
975 975
 		 * @param int    $donor_id    Donor id.
976 976
 		 */
977
-		do_action( 'give_donor_post_add_note', $this->notes, $new_note, $this->id );
977
+		do_action('give_donor_post_add_note', $this->notes, $new_note, $this->id);
978 978
 
979 979
 		// Return the formatted note, so we can test, as well as update any displays
980 980
 		return $new_note;
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 	 */
992 992
 	private function get_raw_notes() {
993 993
 
994
-		$all_notes = $this->db->get_column( 'notes', $this->id );
994
+		$all_notes = $this->db->get_column('notes', $this->id);
995 995
 
996 996
 		return $all_notes;
997 997
 
@@ -1009,8 +1009,8 @@  discard block
 block discarded – undo
1009 1009
 	 * @return mixed            Will be an array if $single is false. Will be value of meta data field if $single is
1010 1010
 	 *                          true.
1011 1011
 	 */
1012
-	public function get_meta( $meta_key = '', $single = true ) {
1013
-		return Give()->donor_meta->get_meta( $this->id, $meta_key, $single );
1012
+	public function get_meta($meta_key = '', $single = true) {
1013
+		return Give()->donor_meta->get_meta($this->id, $meta_key, $single);
1014 1014
 	}
1015 1015
 
1016 1016
 	/**
@@ -1025,8 +1025,8 @@  discard block
 block discarded – undo
1025 1025
 	 *
1026 1026
 	 * @return bool               False for failure. True for success.
1027 1027
 	 */
1028
-	public function add_meta( $meta_key = '', $meta_value, $unique = false ) {
1029
-		return Give()->donor_meta->add_meta( $this->id, $meta_key, $meta_value, $unique );
1028
+	public function add_meta($meta_key = '', $meta_value, $unique = false) {
1029
+		return Give()->donor_meta->add_meta($this->id, $meta_key, $meta_value, $unique);
1030 1030
 	}
1031 1031
 
1032 1032
 	/**
@@ -1041,8 +1041,8 @@  discard block
 block discarded – undo
1041 1041
 	 *
1042 1042
 	 * @return bool               False on failure, true if success.
1043 1043
 	 */
1044
-	public function update_meta( $meta_key = '', $meta_value, $prev_value = '' ) {
1045
-		return Give()->donor_meta->update_meta( $this->id, $meta_key, $meta_value, $prev_value );
1044
+	public function update_meta($meta_key = '', $meta_value, $prev_value = '') {
1045
+		return Give()->donor_meta->update_meta($this->id, $meta_key, $meta_value, $prev_value);
1046 1046
 	}
1047 1047
 
1048 1048
 	/**
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
 	 *
1057 1057
 	 * @return bool               False for failure. True for success.
1058 1058
 	 */
1059
-	public function delete_meta( $meta_key = '', $meta_value = '' ) {
1060
-		return Give()->donor_meta->delete_meta( $this->id, $meta_key, $meta_value );
1059
+	public function delete_meta($meta_key = '', $meta_value = '') {
1060
+		return Give()->donor_meta->delete_meta($this->id, $meta_key, $meta_value);
1061 1061
 	}
1062 1062
 
1063 1063
 	/**
@@ -1070,51 +1070,51 @@  discard block
 block discarded – undo
1070 1070
 	 *
1071 1071
 	 * @return array       The sanitized data, based off column defaults.
1072 1072
 	 */
1073
-	private function sanitize_columns( $data ) {
1073
+	private function sanitize_columns($data) {
1074 1074
 
1075 1075
 		$columns        = $this->db->get_columns();
1076 1076
 		$default_values = $this->db->get_column_defaults();
1077 1077
 
1078
-		foreach ( $columns as $key => $type ) {
1078
+		foreach ($columns as $key => $type) {
1079 1079
 
1080 1080
 			// Only sanitize data that we were provided
1081
-			if ( ! array_key_exists( $key, $data ) ) {
1081
+			if ( ! array_key_exists($key, $data)) {
1082 1082
 				continue;
1083 1083
 			}
1084 1084
 
1085
-			switch ( $type ) {
1085
+			switch ($type) {
1086 1086
 
1087 1087
 				case '%s':
1088
-					if ( 'email' == $key ) {
1089
-						$data[ $key ] = sanitize_email( $data[ $key ] );
1090
-					} elseif ( 'notes' == $key ) {
1091
-						$data[ $key ] = strip_tags( $data[ $key ] );
1088
+					if ('email' == $key) {
1089
+						$data[$key] = sanitize_email($data[$key]);
1090
+					} elseif ('notes' == $key) {
1091
+						$data[$key] = strip_tags($data[$key]);
1092 1092
 					} else {
1093
-						$data[ $key ] = sanitize_text_field( $data[ $key ] );
1093
+						$data[$key] = sanitize_text_field($data[$key]);
1094 1094
 					}
1095 1095
 					break;
1096 1096
 
1097 1097
 				case '%d':
1098
-					if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) {
1099
-						$data[ $key ] = $default_values[ $key ];
1098
+					if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) {
1099
+						$data[$key] = $default_values[$key];
1100 1100
 					} else {
1101
-						$data[ $key ] = absint( $data[ $key ] );
1101
+						$data[$key] = absint($data[$key]);
1102 1102
 					}
1103 1103
 					break;
1104 1104
 
1105 1105
 				case '%f':
1106 1106
 					// Convert what was given to a float
1107
-					$value = floatval( $data[ $key ] );
1107
+					$value = floatval($data[$key]);
1108 1108
 
1109
-					if ( ! is_float( $value ) ) {
1110
-						$data[ $key ] = $default_values[ $key ];
1109
+					if ( ! is_float($value)) {
1110
+						$data[$key] = $default_values[$key];
1111 1111
 					} else {
1112
-						$data[ $key ] = $value;
1112
+						$data[$key] = $value;
1113 1113
 					}
1114 1114
 					break;
1115 1115
 
1116 1116
 				default:
1117
-					$data[ $key ] = sanitize_text_field( $data[ $key ] );
1117
+					$data[$key] = sanitize_text_field($data[$key]);
1118 1118
 					break;
1119 1119
 
1120 1120
 			}
@@ -1134,33 +1134,33 @@  discard block
 block discarded – undo
1134 1134
 	 *
1135 1135
 	 * @return bool            If the email was added successfully
1136 1136
 	 */
1137
-	public function add_email( $email = '', $primary = false ) {
1138
-		if ( ! is_email( $email ) ) {
1137
+	public function add_email($email = '', $primary = false) {
1138
+		if ( ! is_email($email)) {
1139 1139
 			return false;
1140 1140
 		}
1141
-		$existing = new Give_Donor( $email );
1141
+		$existing = new Give_Donor($email);
1142 1142
 
1143
-		if ( $existing->id > 0 ) {
1143
+		if ($existing->id > 0) {
1144 1144
 			// Email address already belongs to another donor
1145 1145
 			return false;
1146 1146
 		}
1147 1147
 
1148
-		if ( email_exists( $email ) ) {
1149
-			$user = get_user_by( 'email', $email );
1150
-			if ( $user->ID != $this->user_id ) {
1148
+		if (email_exists($email)) {
1149
+			$user = get_user_by('email', $email);
1150
+			if ($user->ID != $this->user_id) {
1151 1151
 				return false;
1152 1152
 			}
1153 1153
 		}
1154 1154
 
1155
-		do_action( 'give_donor_pre_add_email', $email, $this->id, $this );
1155
+		do_action('give_donor_pre_add_email', $email, $this->id, $this);
1156 1156
 
1157 1157
 		// Add is used to ensure duplicate emails are not added
1158
-		$ret = (bool) $this->add_meta( 'additional_email', $email );
1158
+		$ret = (bool) $this->add_meta('additional_email', $email);
1159 1159
 
1160
-		do_action( 'give_donor_post_add_email', $email, $this->id, $this );
1160
+		do_action('give_donor_post_add_email', $email, $this->id, $this);
1161 1161
 
1162
-		if ( $ret && true === $primary ) {
1163
-			$this->set_primary_email( $email );
1162
+		if ($ret && true === $primary) {
1163
+			$this->set_primary_email($email);
1164 1164
 		}
1165 1165
 
1166 1166
 		return $ret;
@@ -1176,16 +1176,16 @@  discard block
 block discarded – undo
1176 1176
 	 *
1177 1177
 	 * @return bool          If the email was removed successfully.
1178 1178
 	 */
1179
-	public function remove_email( $email = '' ) {
1180
-		if ( ! is_email( $email ) ) {
1179
+	public function remove_email($email = '') {
1180
+		if ( ! is_email($email)) {
1181 1181
 			return false;
1182 1182
 		}
1183 1183
 
1184
-		do_action( 'give_donor_pre_remove_email', $email, $this->id, $this );
1184
+		do_action('give_donor_pre_remove_email', $email, $this->id, $this);
1185 1185
 
1186
-		$ret = (bool) $this->delete_meta( 'additional_email', $email );
1186
+		$ret = (bool) $this->delete_meta('additional_email', $email);
1187 1187
 
1188
-		do_action( 'give_donor_post_remove_email', $email, $this->id, $this );
1188
+		do_action('give_donor_post_remove_email', $email, $this->id, $this);
1189 1189
 
1190 1190
 		return $ret;
1191 1191
 	}
@@ -1202,16 +1202,16 @@  discard block
 block discarded – undo
1202 1202
 	 *
1203 1203
 	 * @return bool                      If the email was set as primary successfully.
1204 1204
 	 */
1205
-	public function set_primary_email( $new_primary_email = '' ) {
1206
-		if ( ! is_email( $new_primary_email ) ) {
1205
+	public function set_primary_email($new_primary_email = '') {
1206
+		if ( ! is_email($new_primary_email)) {
1207 1207
 			return false;
1208 1208
 		}
1209 1209
 
1210
-		do_action( 'give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this );
1210
+		do_action('give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this);
1211 1211
 
1212
-		$existing = new Give_Donor( $new_primary_email );
1212
+		$existing = new Give_Donor($new_primary_email);
1213 1213
 
1214
-		if ( $existing->id > 0 && (int) $existing->id !== (int) $this->id ) {
1214
+		if ($existing->id > 0 && (int) $existing->id !== (int) $this->id) {
1215 1215
 			// This email belongs to another donor.
1216 1216
 			return false;
1217 1217
 		}
@@ -1219,21 +1219,21 @@  discard block
 block discarded – undo
1219 1219
 		$old_email = $this->email;
1220 1220
 
1221 1221
 		// Update donor record with new email.
1222
-		$update = $this->update( array( 'email' => $new_primary_email ) );
1222
+		$update = $this->update(array('email' => $new_primary_email));
1223 1223
 
1224 1224
 		// Remove new primary from list of additional emails.
1225
-		$remove = $this->remove_email( $new_primary_email );
1225
+		$remove = $this->remove_email($new_primary_email);
1226 1226
 
1227 1227
 		// Add old email to additional emails list.
1228
-		$add = $this->add_email( $old_email );
1228
+		$add = $this->add_email($old_email);
1229 1229
 
1230 1230
 		$ret = $update && $remove && $add;
1231 1231
 
1232
-		if ( $ret ) {
1232
+		if ($ret) {
1233 1233
 			$this->email = $new_primary_email;
1234 1234
 		}
1235 1235
 
1236
-		do_action( 'give_donor_post_set_primary_email', $new_primary_email, $this->id, $this );
1236
+		do_action('give_donor_post_set_primary_email', $new_primary_email, $this->id, $this);
1237 1237
 
1238 1238
 		return $ret;
1239 1239
 	}
@@ -1248,17 +1248,17 @@  discard block
 block discarded – undo
1248 1248
 	 *
1249 1249
 	 * @return bool
1250 1250
 	 */
1251
-	private function is_valid_address( $address ) {
1251
+	private function is_valid_address($address) {
1252 1252
 		$is_valid_address = true;
1253 1253
 
1254 1254
 		// Address ready to process even if only one value set.
1255
-		foreach ( $address as $address_type => $value ) {
1255
+		foreach ($address as $address_type => $value) {
1256 1256
 			// @todo: Handle state field validation on basis of country.
1257
-			if ( in_array( $address_type, array( 'line2', 'state' ) ) ) {
1257
+			if (in_array($address_type, array('line2', 'state'))) {
1258 1258
 				continue;
1259 1259
 			}
1260 1260
 
1261
-			if ( empty( $value ) ) {
1261
+			if (empty($value)) {
1262 1262
 				$is_valid_address = false;
1263 1263
 				break;
1264 1264
 			}
@@ -1285,57 +1285,57 @@  discard block
 block discarded – undo
1285 1285
 	 *
1286 1286
 	 * @return bool
1287 1287
 	 */
1288
-	public function add_address( $address_type, $address ) {
1288
+	public function add_address($address_type, $address) {
1289 1289
 		// Bailout.
1290
-		if ( empty( $address_type ) || ! $this->is_valid_address( $address ) || ! $this->id ) {
1290
+		if (empty($address_type) || ! $this->is_valid_address($address) || ! $this->id) {
1291 1291
 			return false;
1292 1292
 		}
1293 1293
 
1294 1294
 		// Check if multiple address exist or not and set params.
1295 1295
 		$multi_address_id = null;
1296
-		if ( $is_multi_address = ( false !== strpos( $address_type, '[]' ) ) ) {
1297
-			$address_type = $is_multi_address ? str_replace( '[]', '', $address_type ) : $address_type;
1298
-		} elseif ( $is_multi_address = ( false !== strpos( $address_type, '_' ) ) ) {
1299
-			$multi_address_id = $is_multi_address ? array_pop( explode( '_', $address_type ) ) : $address_type;
1296
+		if ($is_multi_address = (false !== strpos($address_type, '[]'))) {
1297
+			$address_type = $is_multi_address ? str_replace('[]', '', $address_type) : $address_type;
1298
+		} elseif ($is_multi_address = (false !== strpos($address_type, '_'))) {
1299
+			$multi_address_id = $is_multi_address ? array_pop(explode('_', $address_type)) : $address_type;
1300 1300
 
1301
-			$address_type = $is_multi_address ? array_shift( explode( '_', $address_type ) ) : $address_type;
1301
+			$address_type = $is_multi_address ? array_shift(explode('_', $address_type)) : $address_type;
1302 1302
 		}
1303 1303
 
1304 1304
 		// Bailout: do not save duplicate orders
1305
-		if ( $this->does_address_exist( $address_type, $address ) ) {
1305
+		if ($this->does_address_exist($address_type, $address)) {
1306 1306
 			return false;
1307 1307
 		}
1308 1308
 
1309 1309
 		// Set default address.
1310
-		$address = wp_parse_args( $address, array(
1310
+		$address = wp_parse_args($address, array(
1311 1311
 			'line1'   => '',
1312 1312
 			'line2'   => '',
1313 1313
 			'city'    => '',
1314 1314
 			'state'   => '',
1315 1315
 			'country' => '',
1316 1316
 			'zip'     => '',
1317
-		) );
1317
+		));
1318 1318
 
1319 1319
 		// Set meta key prefix.
1320 1320
 		global $wpdb;
1321 1321
 		$meta_key_prefix = "_give_donor_address_{$address_type}_{address_name}";
1322 1322
 		$meta_type       = Give()->donor_meta->meta_type;
1323 1323
 
1324
-		if ( $is_multi_address ) {
1325
-			if ( is_null( $multi_address_id ) ) {
1324
+		if ($is_multi_address) {
1325
+			if (is_null($multi_address_id)) {
1326 1326
 				// Get latest address key to set multi address id.
1327
-				$multi_address_id = $wpdb->get_var( $wpdb->prepare( "
1327
+				$multi_address_id = $wpdb->get_var($wpdb->prepare("
1328 1328
 						SELECT meta_key FROM {$wpdb->donormeta}
1329 1329
 						WHERE meta_key
1330 1330
 						LIKE '%%%s%%'
1331 1331
 						AND {$meta_type}_id=%d
1332 1332
 						ORDER BY meta_id DESC
1333 1333
 						LIMIT 1
1334
-						", "_give_donor_address_{$address_type}_line1", $this->id ) );
1334
+						", "_give_donor_address_{$address_type}_line1", $this->id));
1335 1335
 
1336
-				if ( ! empty( $multi_address_id ) ) {
1337
-					$multi_address_id = absint( substr( strrchr( $multi_address_id, '_' ), 1 ) );
1338
-					$multi_address_id ++;
1336
+				if ( ! empty($multi_address_id)) {
1337
+					$multi_address_id = absint(substr(strrchr($multi_address_id, '_'), 1));
1338
+					$multi_address_id++;
1339 1339
 				} else {
1340 1340
 					$multi_address_id = 0;
1341 1341
 				}
@@ -1345,9 +1345,9 @@  discard block
 block discarded – undo
1345 1345
 		}
1346 1346
 
1347 1347
 		// Save donor address.
1348
-		foreach ( $address as $type => $value ) {
1349
-			$meta_key = str_replace( '{address_name}', $type, $meta_key_prefix );
1350
-			Give()->donor_meta->update_meta( $this->id, $meta_key, $value );
1348
+		foreach ($address as $type => $value) {
1349
+			$meta_key = str_replace('{address_name}', $type, $meta_key_prefix);
1350
+			Give()->donor_meta->update_meta($this->id, $meta_key, $value);
1351 1351
 		}
1352 1352
 
1353 1353
 		$this->setup_address();
@@ -1366,31 +1366,31 @@  discard block
 block discarded – undo
1366 1366
 	 *
1367 1367
 	 * @return bool
1368 1368
 	 */
1369
-	public function remove_address( $address_id ) {
1369
+	public function remove_address($address_id) {
1370 1370
 		global $wpdb;
1371 1371
 
1372 1372
 		// Get address type.
1373
-		$is_multi_address = false !== strpos( $address_id, '_' ) ? true : false;
1373
+		$is_multi_address = false !== strpos($address_id, '_') ? true : false;
1374 1374
 
1375
-		$address_type = false !== strpos( $address_id, '_' ) ? array_shift( explode( '_', $address_id ) ) : $address_id;
1375
+		$address_type = false !== strpos($address_id, '_') ? array_shift(explode('_', $address_id)) : $address_id;
1376 1376
 
1377
-		$address_count = false !== strpos( $address_id, '_' ) ? array_pop( explode( '_', $address_id ) ) : null;
1377
+		$address_count = false !== strpos($address_id, '_') ? array_pop(explode('_', $address_id)) : null;
1378 1378
 
1379 1379
 		// Set meta key prefix.
1380 1380
 		$meta_key_prefix = "_give_donor_address_{$address_type}_%";
1381
-		if ( $is_multi_address && is_numeric( $address_count ) ) {
1381
+		if ($is_multi_address && is_numeric($address_count)) {
1382 1382
 			$meta_key_prefix .= "_{$address_count}";
1383 1383
 		}
1384 1384
 
1385 1385
 		$meta_type = Give()->donor_meta->meta_type;
1386 1386
 
1387 1387
 		// Process query.
1388
-		$row_affected = $wpdb->query( $wpdb->prepare( "
1388
+		$row_affected = $wpdb->query($wpdb->prepare("
1389 1389
 				DELETE FROM {$wpdb->donormeta}
1390 1390
 				WHERE meta_key
1391 1391
 				LIKE '%s'
1392 1392
 				AND {$meta_type}_id=%d
1393
-				", $meta_key_prefix, $this->id ) );
1393
+				", $meta_key_prefix, $this->id));
1394 1394
 
1395 1395
 		$this->setup_address();
1396 1396
 
@@ -1409,39 +1409,39 @@  discard block
 block discarded – undo
1409 1409
 	 *
1410 1410
 	 * @return bool
1411 1411
 	 */
1412
-	public function update_address( $address_id, $address ) {
1412
+	public function update_address($address_id, $address) {
1413 1413
 		global $wpdb;
1414 1414
 
1415 1415
 		// Get address type.
1416
-		$is_multi_address = false !== strpos( $address_id, '_' ) ? true : false;
1416
+		$is_multi_address = false !== strpos($address_id, '_') ? true : false;
1417 1417
 
1418
-		$address_type = false !== strpos( $address_id, '_' ) ? array_shift( explode( '_', $address_id ) ) : $address_id;
1418
+		$address_type = false !== strpos($address_id, '_') ? array_shift(explode('_', $address_id)) : $address_id;
1419 1419
 
1420
-		$address_count = false !== strpos( $address_id, '_' ) ? array_pop( explode( '_', $address_id ) ) : null;
1420
+		$address_count = false !== strpos($address_id, '_') ? array_pop(explode('_', $address_id)) : null;
1421 1421
 
1422 1422
 		// Set meta key prefix.
1423 1423
 		$meta_key_prefix = "_give_donor_address_{$address_type}_%";
1424
-		if ( $is_multi_address && is_numeric( $address_count ) ) {
1424
+		if ($is_multi_address && is_numeric($address_count)) {
1425 1425
 			$meta_key_prefix .= "_{$address_count}";
1426 1426
 		}
1427 1427
 
1428 1428
 		$meta_type = Give()->donor_meta->meta_type;
1429 1429
 
1430 1430
 		// Process query.
1431
-		$row_affected = $wpdb->get_results( $wpdb->prepare( "
1431
+		$row_affected = $wpdb->get_results($wpdb->prepare("
1432 1432
 				SELECT meta_key FROM {$wpdb->donormeta}
1433 1433
 				WHERE meta_key
1434 1434
 				LIKE '%s'
1435 1435
 				AND {$meta_type}_id=%d
1436
-				", $meta_key_prefix, $this->id ) );
1436
+				", $meta_key_prefix, $this->id));
1437 1437
 
1438 1438
 		// Return result.
1439
-		if ( ! count( $row_affected ) ) {
1439
+		if ( ! count($row_affected)) {
1440 1440
 			return false;
1441 1441
 		}
1442 1442
 
1443 1443
 		// Update address.
1444
-		if ( ! $this->add_address( $address_id, $address ) ) {
1444
+		if ( ! $this->add_address($address_id, $address)) {
1445 1445
 			return false;
1446 1446
 		}
1447 1447
 
@@ -1460,39 +1460,39 @@  discard block
 block discarded – undo
1460 1460
 	 *
1461 1461
 	 * @return bool|null
1462 1462
 	 */
1463
-	public function does_address_exist( $current_address_type, $current_address ) {
1463
+	public function does_address_exist($current_address_type, $current_address) {
1464 1464
 		$status = false;
1465 1465
 
1466 1466
 		// Bailout.
1467
-		if ( empty( $current_address_type ) || empty( $current_address ) ) {
1467
+		if (empty($current_address_type) || empty($current_address)) {
1468 1468
 			return null;
1469 1469
 		}
1470 1470
 
1471 1471
 		// Bailout.
1472
-		if ( empty( $this->address ) || empty( $this->address[ $current_address_type ] ) ) {
1472
+		if (empty($this->address) || empty($this->address[$current_address_type])) {
1473 1473
 			return $status;
1474 1474
 		}
1475 1475
 
1476 1476
 		// Get address.
1477
-		$address = $this->address[ $current_address_type ];
1477
+		$address = $this->address[$current_address_type];
1478 1478
 
1479
-		switch ( true ) {
1479
+		switch (true) {
1480 1480
 
1481 1481
 			// Single address.
1482
-			case is_string( end( $address ) ) :
1483
-				$status = $this->is_address_match( $current_address, $address );
1482
+			case is_string(end($address)) :
1483
+				$status = $this->is_address_match($current_address, $address);
1484 1484
 				break;
1485 1485
 
1486 1486
 			// Multi address.
1487
-			case is_array( end( $address ) ):
1487
+			case is_array(end($address)):
1488 1488
 				// Compare address.
1489
-				foreach ( $address as $saved_address ) {
1490
-					if ( empty( $saved_address ) ) {
1489
+				foreach ($address as $saved_address) {
1490
+					if (empty($saved_address)) {
1491 1491
 						continue;
1492 1492
 					}
1493 1493
 
1494 1494
 					// Exit loop immediately if address exist.
1495
-					if ( $status = $this->is_address_match( $current_address, $saved_address ) ) {
1495
+					if ($status = $this->is_address_match($current_address, $saved_address)) {
1496 1496
 						break;
1497 1497
 					}
1498 1498
 				}
@@ -1513,10 +1513,10 @@  discard block
 block discarded – undo
1513 1513
 	 *
1514 1514
 	 * @return bool
1515 1515
 	 */
1516
-	private function is_address_match( $address_1, $address_2 ) {
1517
-		$result = array_diff( $address_1, $address_2 );
1516
+	private function is_address_match($address_1, $address_2) {
1517
+		$result = array_diff($address_1, $address_2);
1518 1518
 
1519
-		return empty( $result );
1519
+		return empty($result);
1520 1520
 	}
1521 1521
 
1522 1522
 	/**
@@ -1527,23 +1527,23 @@  discard block
 block discarded – undo
1527 1527
 	 * @since   2.0
1528 1528
 	 * @return  object
1529 1529
 	 */
1530
-	public function split_donor_name( $id ) {
1530
+	public function split_donor_name($id) {
1531 1531
 		$first_name = $last_name = '';
1532
-		$donor      = new Give_Donor( $id );
1532
+		$donor      = new Give_Donor($id);
1533 1533
 
1534
-		$split_donor_name = explode( ' ', $donor->name, 2 );
1534
+		$split_donor_name = explode(' ', $donor->name, 2);
1535 1535
 
1536 1536
 		// Check for existence of first name after split of donor name.
1537
-		if ( is_array( $split_donor_name ) && ! empty( $split_donor_name[0] ) ) {
1537
+		if (is_array($split_donor_name) && ! empty($split_donor_name[0])) {
1538 1538
 			$first_name = $split_donor_name[0];
1539 1539
 		}
1540 1540
 
1541 1541
 		// Check for existence of last name after split of donor name.
1542
-		if ( is_array( $split_donor_name ) && ! empty( $split_donor_name[1] ) ) {
1542
+		if (is_array($split_donor_name) && ! empty($split_donor_name[1])) {
1543 1543
 			$last_name = $split_donor_name[1];
1544 1544
 		}
1545 1545
 
1546
-		return (object) array( 'first_name' => $first_name, 'last_name' => $last_name );
1546
+		return (object) array('first_name' => $first_name, 'last_name' => $last_name);
1547 1547
 	}
1548 1548
 
1549 1549
 	/**
@@ -1553,9 +1553,9 @@  discard block
 block discarded – undo
1553 1553
 	 * @return  string
1554 1554
 	 */
1555 1555
 	public function get_first_name() {
1556
-		$first_name = $this->get_meta( '_give_donor_first_name' );
1557
-		if ( ! $first_name ) {
1558
-			$first_name = $this->split_donor_name( $this->id )->first_name;
1556
+		$first_name = $this->get_meta('_give_donor_first_name');
1557
+		if ( ! $first_name) {
1558
+			$first_name = $this->split_donor_name($this->id)->first_name;
1559 1559
 		}
1560 1560
 
1561 1561
 		return $first_name;
@@ -1568,15 +1568,15 @@  discard block
 block discarded – undo
1568 1568
 	 * @return  string
1569 1569
 	 */
1570 1570
 	public function get_last_name() {
1571
-		$first_name = $this->get_meta( '_give_donor_first_name' );
1572
-		$last_name  = $this->get_meta( '_give_donor_last_name' );
1571
+		$first_name = $this->get_meta('_give_donor_first_name');
1572
+		$last_name  = $this->get_meta('_give_donor_last_name');
1573 1573
 
1574 1574
 		// This condition will prevent unnecessary splitting of donor name to fetch last name.
1575
-		if ( ! $first_name && ! $last_name ) {
1576
-			$last_name = $this->split_donor_name( $this->id )->last_name;
1575
+		if ( ! $first_name && ! $last_name) {
1576
+			$last_name = $this->split_donor_name($this->id)->last_name;
1577 1577
 		}
1578 1578
 
1579
-		return ( $last_name ) ? $last_name : '';
1579
+		return ($last_name) ? $last_name : '';
1580 1580
 	}
1581 1581
 
1582 1582
 	/**
@@ -1587,7 +1587,7 @@  discard block
 block discarded – undo
1587 1587
 	 * @return  string $company_name Donor Company Name
1588 1588
 	 */
1589 1589
 	public function get_company_name() {
1590
-		$company_name = $this->get_meta( '_give_donor_company' );
1590
+		$company_name = $this->get_meta('_give_donor_company');
1591 1591
 
1592 1592
 		return $company_name;
1593 1593
 	}
@@ -1601,9 +1601,9 @@  discard block
 block discarded – undo
1601 1601
 	 */
1602 1602
 	public function get_last_donation() {
1603 1603
 
1604
-		$payments = array_unique( array_values( explode( ',', $this->payment_ids ) ) );
1604
+		$payments = array_unique(array_values(explode(',', $this->payment_ids)));
1605 1605
 
1606
-		return end( $payments );
1606
+		return end($payments);
1607 1607
 
1608 1608
 	}
1609 1609
 
@@ -1616,18 +1616,18 @@  discard block
 block discarded – undo
1616 1616
 	 *
1617 1617
 	 * @return string The date of the last donation.
1618 1618
 	 */
1619
-	public function get_last_donation_date( $formatted = false ) {
1619
+	public function get_last_donation_date($formatted = false) {
1620 1620
 		$completed_data = '';
1621 1621
 
1622 1622
 		// Return if donation id is invalid.
1623
-		if( ! ( $last_donation = absint( $this->get_last_donation() ) ) ) {
1623
+		if ( ! ($last_donation = absint($this->get_last_donation()))) {
1624 1624
 			return $completed_data;
1625 1625
 		}
1626 1626
 
1627
-		$completed_data = give_get_payment_completed_date( $last_donation );
1627
+		$completed_data = give_get_payment_completed_date($last_donation);
1628 1628
 
1629
-		if ( $formatted ) {
1630
-			return date_i18n( give_date_format(), strtotime( $completed_data ) );
1629
+		if ($formatted) {
1630
+			return date_i18n(give_date_format(), strtotime($completed_data));
1631 1631
 		}
1632 1632
 
1633 1633
 		return $completed_data;
@@ -1643,10 +1643,10 @@  discard block
 block discarded – undo
1643 1643
 	 */
1644 1644
 	public function get_donor_initals() {
1645 1645
 
1646
-		$first_name_initial = mb_substr( $this->get_first_name(), 0, 1, 'utf-8' );
1647
-		$last_name_initial  = mb_substr( $this->get_last_name(), 0, 1, 'utf-8' );
1646
+		$first_name_initial = mb_substr($this->get_first_name(), 0, 1, 'utf-8');
1647
+		$last_name_initial  = mb_substr($this->get_last_name(), 0, 1, 'utf-8');
1648 1648
 
1649
-		return apply_filters( 'get_donor_initals', $first_name_initial . $last_name_initial );
1649
+		return apply_filters('get_donor_initals', $first_name_initial.$last_name_initial);
1650 1650
 
1651 1651
 	}
1652 1652
 
Please login to merge, or discard this patch.
includes/donors/frontend-donor-functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
  *
47 47
  * @since 2.2.0
48 48
  *
49
- * @param string|int $id_or_email
49
+ * @param string $id_or_email
50 50
  *
51 51
  * @return bool
52 52
  */
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @return string HTML output.
23 23
  */
24
-function give_get_donor_avatar( $donor, $size = 60 ) {
24
+function give_get_donor_avatar($donor, $size = 60) {
25 25
 	ob_start();
26 26
 	?>
27 27
 	<div class="give-donor__image">
28 28
 		<?php
29 29
 		// Check if gravatar exists.
30
-		if ( give_validate_gravatar( $donor->email ) ) {
30
+		if (give_validate_gravatar($donor->email)) {
31 31
 			// Return avatar.
32
-			echo get_avatar( $donor->email, $size );
32
+			echo get_avatar($donor->email, $size);
33 33
 		} else {
34 34
 			// No gravatar = output initials.
35 35
 			echo $donor->get_donor_initals();
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	</div>
38 38
 	<?php
39 39
 
40
-	return apply_filters( 'give_get_donor_avatar', ob_get_clean() );
40
+	return apply_filters('give_get_donor_avatar', ob_get_clean());
41 41
 
42 42
 }
43 43
 
@@ -50,51 +50,51 @@  discard block
 block discarded – undo
50 50
  *
51 51
  * @return bool
52 52
  */
53
-function give_validate_gravatar( $id_or_email ) {
53
+function give_validate_gravatar($id_or_email) {
54 54
 
55 55
 	//id or email code borrowed from wp-includes/pluggable.php
56 56
 	$email = '';
57
-	if ( is_numeric( $id_or_email ) ) {
57
+	if (is_numeric($id_or_email)) {
58 58
 		$id   = (int) $id_or_email;
59
-		$user = get_userdata( $id );
60
-		if ( $user ) {
59
+		$user = get_userdata($id);
60
+		if ($user) {
61 61
 			$email = $user->user_email;
62 62
 		}
63
-	} elseif ( is_object( $id_or_email ) ) {
63
+	} elseif (is_object($id_or_email)) {
64 64
 		// No avatar for pingbacks or trackbacks
65
-		$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
66
-		if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
65
+		$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
66
+		if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
67 67
 			return false;
68 68
 		}
69 69
 
70
-		if ( ! empty( $id_or_email->user_id ) ) {
70
+		if ( ! empty($id_or_email->user_id)) {
71 71
 			$id   = (int) $id_or_email->user_id;
72
-			$user = get_userdata( $id );
73
-			if ( $user ) {
72
+			$user = get_userdata($id);
73
+			if ($user) {
74 74
 				$email = $user->user_email;
75 75
 			}
76
-		} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
76
+		} elseif ( ! empty($id_or_email->comment_author_email)) {
77 77
 			$email = $id_or_email->comment_author_email;
78 78
 		}
79 79
 	} else {
80 80
 		$email = $id_or_email;
81 81
 	}
82 82
 
83
-	$hashkey = md5( strtolower( trim( $email ) ) );
84
-	$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
83
+	$hashkey = md5(strtolower(trim($email)));
84
+	$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
85 85
 
86
-	$data = wp_cache_get( $hashkey );
87
-	if ( false === $data ) {
88
-		$response = wp_remote_head( $uri );
89
-		if ( is_wp_error( $response ) ) {
86
+	$data = wp_cache_get($hashkey);
87
+	if (false === $data) {
88
+		$response = wp_remote_head($uri);
89
+		if (is_wp_error($response)) {
90 90
 			$data = 'not200';
91 91
 		} else {
92 92
 			$data = $response['response']['code'];
93 93
 		}
94
-		wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 );
94
+		wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5);
95 95
 
96 96
 	}
97
-	if ( $data == '200' ) {
97
+	if ($data == '200') {
98 98
 		return true;
99 99
 	} else {
100 100
 		return false;
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
  *
115 115
  * @return int The new note ID
116 116
  */
117
-function give_insert_donor_donation_comment( $donation_id, $donor, $note, $comment_args = array() ) {
117
+function give_insert_donor_donation_comment($donation_id, $donor, $note, $comment_args = array()) {
118 118
 	$comment_args = wp_parse_args(
119 119
 		$comment_args,
120 120
 		array(
121 121
 			'comment_approved' => 0,
122
-			'comment_parent'   => give_get_payment_form_id( $donation_id )
122
+			'comment_parent'   => give_get_payment_form_id($donation_id)
123 123
 		)
124 124
 	);
125 125
 
126
-	$comment_id = Give_Comment::add( $donation_id, $note, 'payment', $comment_args );
126
+	$comment_id = Give_Comment::add($donation_id, $note, 'payment', $comment_args);
127 127
 
128
-	update_comment_meta( $comment_id, '_give_donor_id', $donor );
128
+	update_comment_meta($comment_id, '_give_donor_id', $donor);
129 129
 
130 130
 	return $comment_id;
131 131
 }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
  *
145 145
  * @return WP_Comment|array
146 146
  */
147
-function give_get_donor_donation_comment( $donation_id, $donor_id, $search = '' ) {
147
+function give_get_donor_donation_comment($donation_id, $donor_id, $search = '') {
148 148
 	$comments = Give_Comment::get(
149 149
 		$donation_id,
150 150
 		'payment',
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		$search
161 161
 	);
162 162
 
163
-	return ( ! empty( $comments ) ? current( $comments ) : array() );
163
+	return ( ! empty($comments) ? current($comments) : array());
164 164
 }
165 165
 
166 166
 /**
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
  *
177 177
  * @return int
178 178
  */
179
-function give_get_donor_donation_comment_id( $donation_id, $donor_id, $search = '' ) {
179
+function give_get_donor_donation_comment_id($donation_id, $donor_id, $search = '') {
180 180
 	/* @var WP_Comment|array $comment */
181
-	$comment    = give_get_donor_donation_comment( $donation_id, $donor_id, $search );
181
+	$comment    = give_get_donor_donation_comment($donation_id, $donor_id, $search);
182 182
 	$comment_id = $comment instanceof WP_Comment ? $comment->comment_ID : 0;
183 183
 
184 184
 	return $comment_id;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
  *
198 198
  * @return array
199 199
  */
200
-function give_get_donor_donation_comments( $donor_id, $comment_args = array(), $search = '' ) {
200
+function give_get_donor_donation_comments($donor_id, $comment_args = array(), $search = '') {
201 201
 	$comments = Give_Comment::get(
202 202
 		$donor_id,
203 203
 		'payment',
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		$search
206 206
 	);
207 207
 
208
-	return ( ! empty( $comments ) ? $comments : array() );
208
+	return ( ! empty($comments) ? $comments : array());
209 209
 }
210 210
 
211 211
 
@@ -219,19 +219,19 @@  discard block
 block discarded – undo
219 219
  *
220 220
  * @return string
221 221
  */
222
-function give_get_donor_donation_comment_html( $comment, $payment_id = 0 ) {
222
+function give_get_donor_donation_comment_html($comment, $payment_id = 0) {
223 223
 
224
-	if ( is_numeric( $comment ) ) {
225
-		$comment = get_comment( $comment );
224
+	if (is_numeric($comment)) {
225
+		$comment = get_comment($comment);
226 226
 	}
227 227
 
228
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
228
+	$date_format = give_date_format().', '.get_option('time_format');
229 229
 
230 230
 	$comment_html = sprintf(
231 231
 		'<div class="give-payment-note" id="give-payment-note-%s"><p><strong>%s</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">%s</span><br/>%s</p></div>',
232 232
 		$comment->comment_ID,
233
-		get_comment_author( $comment->comment_ID ),
234
-		date_i18n( $date_format, strtotime( $comment->comment_date ) ),
233
+		get_comment_author($comment->comment_ID),
234
+		date_i18n($date_format, strtotime($comment->comment_date)),
235 235
 		$comment->comment_content
236 236
 	);
237 237
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
  *
251 251
  * @return WP_Comment/array
252 252
  */
253
-function give_get_donor_latest_comment( $donor_id, $form_id = 0 ) {
253
+function give_get_donor_latest_comment($donor_id, $form_id = 0) {
254 254
 	$comment_args = array(
255 255
 		'post_id'    => 0,
256 256
 		'orderby'    => 'comment_ID',
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	);
271 271
 
272 272
 	// Get donor donation comment for specific form.
273
-	if ( $form_id ) {
273
+	if ($form_id) {
274 274
 		$comment_args['parent'] = $form_id;
275 275
 	}
276 276
 
277
-	$comment = current( give_get_donor_donation_comments( $donor_id, $comment_args ) );
277
+	$comment = current(give_get_donor_donation_comments($donor_id, $comment_args));
278 278
 
279 279
 	return $comment;
280 280
 }
Please login to merge, or discard this patch.
includes/forms/functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  *
156 156
  * Used to redirect a user back to the donation form if there are errors present.
157 157
  *
158
- * @param array|string $args
158
+ * @param string $args
159 159
  *
160 160
  * @access public
161 161
  * @since  1.0
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
  * @since  1.0
302 302
  * @since  1.8.16 Add security check
303 303
  *
304
- * @return bool
304
+ * @return false|null
305 305
  */
306 306
 function give_listen_for_failed_payments() {
307 307
 
@@ -1292,7 +1292,7 @@  discard block
 block discarded – undo
1292 1292
  * @since 2.2.0
1293 1293
  *
1294 1294
  * @param array|integer   $price_or_level_id Price level data.
1295
- * @param boolean|integer $form_id           Donation Form ID.
1295
+ * @param integer $form_id           Donation Form ID.
1296 1296
  *
1297 1297
  * @return boolean
1298 1298
  */
Please login to merge, or discard this patch.
Spacing   +264 added lines, -266 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,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = give_get_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = give_get_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) {
75
-		$float_labels = give_get_option( 'floatlabels', 'disabled' );
74
+	if (empty($float_labels) || ('global' === $float_labels)) {
75
+		$float_labels = give_get_option('floatlabels', 'disabled');
76 76
 	}
77 77
 
78
-	return give_is_setting_enabled( $float_labels );
78
+	return give_is_setting_enabled($float_labels);
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	$give_options = give_get_settings();
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	$give_options    = give_get_settings();
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -161,19 +161,19 @@  discard block
 block discarded – undo
161 161
  * @since  1.0
162 162
  * @return Void
163 163
  */
164
-function give_send_back_to_checkout( $args = array() ) {
164
+function give_send_back_to_checkout($args = array()) {
165 165
 
166
-	$url     = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : '';
166
+	$url     = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : '';
167 167
 	$form_id = 0;
168 168
 
169 169
 	// Set the form_id.
170
-	if ( isset( $_POST['give-form-id'] ) ) {
171
-		$form_id = sanitize_text_field( $_POST['give-form-id'] );
170
+	if (isset($_POST['give-form-id'])) {
171
+		$form_id = sanitize_text_field($_POST['give-form-id']);
172 172
 	}
173 173
 
174 174
 	// Need a URL to continue. If none, redirect back to single form.
175
-	if ( empty( $url ) ) {
176
-		wp_safe_redirect( get_permalink( $form_id ) );
175
+	if (empty($url)) {
176
+		wp_safe_redirect(get_permalink($form_id));
177 177
 		give_die();
178 178
 	}
179 179
 
@@ -182,41 +182,41 @@  discard block
 block discarded – undo
182 182
 	);
183 183
 
184 184
 	// Set the $level_id.
185
-	if ( isset( $_POST['give-price-id'] ) ) {
186
-		$defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] );
185
+	if (isset($_POST['give-price-id'])) {
186
+		$defaults['level-id'] = sanitize_text_field($_POST['give-price-id']);
187 187
 	}
188 188
 
189 189
 	// Check for backward compatibility.
190
-	if ( is_string( $args ) ) {
191
-		$args = str_replace( '?', '', $args );
190
+	if (is_string($args)) {
191
+		$args = str_replace('?', '', $args);
192 192
 	}
193 193
 
194
-	$args = wp_parse_args( $args, $defaults );
194
+	$args = wp_parse_args($args, $defaults);
195 195
 
196 196
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
197
-	$url_data = wp_parse_url( $url );
197
+	$url_data = wp_parse_url($url);
198 198
 
199 199
 	// Check if an array to prevent notices before parsing.
200
-	if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) {
201
-		parse_str( $url_data['query'], $query );
200
+	if (isset($url_data['query']) && ! empty($url_data['query'])) {
201
+		parse_str($url_data['query'], $query);
202 202
 
203 203
 		// Precaution: don't allow any CC info.
204
-		unset( $query['card_number'] );
205
-		unset( $query['card_cvc'] );
204
+		unset($query['card_number']);
205
+		unset($query['card_cvc']);
206 206
 
207 207
 	} else {
208 208
 		// No $url_data so pass empty array.
209 209
 		$query = array();
210 210
 	}
211 211
 
212
-	$new_query        = array_merge( $args, $query );
213
-	$new_query_string = http_build_query( $new_query );
212
+	$new_query        = array_merge($args, $query);
213
+	$new_query_string = http_build_query($new_query);
214 214
 
215 215
 	// Assemble URL parts.
216
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
216
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
217 217
 
218 218
 	// Redirect them.
219
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
219
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
220 220
 	give_die();
221 221
 
222 222
 }
@@ -232,16 +232,16 @@  discard block
 block discarded – undo
232 232
  * @since       1.0
233 233
  * @return      string
234 234
  */
235
-function give_get_success_page_url( $query_string = null ) {
235
+function give_get_success_page_url($query_string = null) {
236 236
 
237
-	$success_page = give_get_option( 'success_page', 0 );
238
-	$success_page = get_permalink( $success_page );
237
+	$success_page = give_get_option('success_page', 0);
238
+	$success_page = get_permalink($success_page);
239 239
 
240
-	if ( $query_string ) {
240
+	if ($query_string) {
241 241
 		$success_page .= $query_string;
242 242
 	}
243 243
 
244
-	return apply_filters( 'give_success_page_url', $success_page );
244
+	return apply_filters('give_success_page_url', $success_page);
245 245
 
246 246
 }
247 247
 
@@ -254,32 +254,31 @@  discard block
 block discarded – undo
254 254
  *
255 255
  * @return mixed Full URL to the Failed Donation Page, if present, home page if it doesn't exist.
256 256
  */
257
-function give_get_failed_transaction_uri( $extras = false ) {
257
+function give_get_failed_transaction_uri($extras = false) {
258 258
 	$give_options = give_get_settings();
259 259
 
260 260
 	// Remove question mark.
261
-	if ( 0 === strpos( $extras, '?' ) ) {
262
-		$extras = substr( $extras, 1 );
261
+	if (0 === strpos($extras, '?')) {
262
+		$extras = substr($extras, 1);
263 263
 	}
264 264
 
265
-	$extras_args = wp_parse_args( $extras );
265
+	$extras_args = wp_parse_args($extras);
266 266
 
267 267
 	// Set nonce if payment id exist in extra params.
268
-	if ( array_key_exists( 'payment-id', $extras_args ) ) {
269
-		$extras_args['_wpnonce'] = wp_create_nonce( "give-failed-donation-{$extras_args['payment-id']}" );
270
-		$extras                  = http_build_query( $extras_args );
268
+	if (array_key_exists('payment-id', $extras_args)) {
269
+		$extras_args['_wpnonce'] = wp_create_nonce("give-failed-donation-{$extras_args['payment-id']}");
270
+		$extras                  = http_build_query($extras_args);
271 271
 	}
272 272
 
273
-	$uri = ! empty( $give_options['failure_page'] ) ?
274
-		trailingslashit( get_permalink( $give_options['failure_page'] ) ) :
275
-		home_url();
273
+	$uri = ! empty($give_options['failure_page']) ?
274
+		trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
276 275
 
277 276
 
278
-	if ( $extras ) {
277
+	if ($extras) {
279 278
 		$uri .= "?{$extras}";
280 279
 	}
281 280
 
282
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
281
+	return apply_filters('give_get_failed_transaction_uri', $uri);
283 282
 }
284 283
 
285 284
 /**
@@ -290,9 +289,9 @@  discard block
 block discarded – undo
290 289
  */
291 290
 function give_is_failed_transaction_page() {
292 291
 	$give_options = give_get_settings();
293
-	$ret          = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
292
+	$ret          = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
294 293
 
295
-	return apply_filters( 'give_is_failure_page', $ret );
294
+	return apply_filters('give_is_failure_page', $ret);
296 295
 }
297 296
 
298 297
 /**
@@ -305,25 +304,25 @@  discard block
 block discarded – undo
305 304
  */
306 305
 function give_listen_for_failed_payments() {
307 306
 
308
-	$failed_page = give_get_option( 'failure_page', 0 );
309
-	$payment_id  = ! empty( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : 0;
310
-	$nonce       = ! empty( $_GET['_wpnonce'] ) ? give_clean( $_GET['_wpnonce'] ) : false;
307
+	$failed_page = give_get_option('failure_page', 0);
308
+	$payment_id  = ! empty($_GET['payment-id']) ? absint($_GET['payment-id']) : 0;
309
+	$nonce       = ! empty($_GET['_wpnonce']) ? give_clean($_GET['_wpnonce']) : false;
311 310
 
312 311
 	// Bailout.
313
-	if ( ! $failed_page || ! is_page( $failed_page ) || ! $payment_id || ! $nonce ) {
312
+	if ( ! $failed_page || ! is_page($failed_page) || ! $payment_id || ! $nonce) {
314 313
 		return false;
315 314
 	}
316 315
 
317 316
 	// Security check.
318
-	if ( ! wp_verify_nonce( $nonce, "give-failed-donation-{$payment_id}" ) ) {
319
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ) );
317
+	if ( ! wp_verify_nonce($nonce, "give-failed-donation-{$payment_id}")) {
318
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'));
320 319
 	}
321 320
 
322 321
 	// Set payment status to failure
323
-	give_update_payment_status( $payment_id, 'failed' );
322
+	give_update_payment_status($payment_id, 'failed');
324 323
 }
325 324
 
326
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
325
+add_action('template_redirect', 'give_listen_for_failed_payments');
327 326
 
328 327
 /**
329 328
  * Retrieve the Donation History page URI
@@ -336,9 +335,9 @@  discard block
 block discarded – undo
336 335
 function give_get_history_page_uri() {
337 336
 	$give_options = give_get_settings();
338 337
 
339
-	$history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' );
338
+	$history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url');
340 339
 
341
-	return apply_filters( 'give_get_history_page_uri', $history_page );
340
+	return apply_filters('give_get_history_page_uri', $history_page);
342 341
 }
343 342
 
344 343
 /**
@@ -351,11 +350,11 @@  discard block
 block discarded – undo
351 350
  * @since       1.0
352 351
  * @return      bool
353 352
  */
354
-function give_field_is_required( $field = '', $form_id ) {
353
+function give_field_is_required($field = '', $form_id) {
355 354
 
356
-	$required_fields = give_get_required_fields( $form_id );
355
+	$required_fields = give_get_required_fields($form_id);
357 356
 
358
-	return array_key_exists( $field, $required_fields );
357
+	return array_key_exists($field, $required_fields);
359 358
 }
360 359
 
361 360
 /**
@@ -372,12 +371,12 @@  discard block
 block discarded – undo
372 371
  *
373 372
  * @return void
374 373
  */
375
-function give_record_donation_in_log( $give_form_id = 0, $payment_id, $price_id = false, $donation_date = null ) {
374
+function give_record_donation_in_log($give_form_id = 0, $payment_id, $price_id = false, $donation_date = null) {
376 375
 	$log_data = array(
377 376
 		'log_parent'   => $payment_id,
378 377
 		'log_type'     => 'sale',
379
-		'log_date'     => isset( $donation_date ) ? $donation_date : null,
380
-		'log_date_gmt' => isset( $donation_date ) ? $donation_date : null,
378
+		'log_date'     => isset($donation_date) ? $donation_date : null,
379
+		'log_date_gmt' => isset($donation_date) ? $donation_date : null,
381 380
 	);
382 381
 
383 382
 	$log_meta = array(
@@ -385,7 +384,7 @@  discard block
 block discarded – undo
385 384
 		'price_id' => (int) $price_id,
386 385
 	);
387 386
 
388
-	Give()->logs->insert_log( $log_data, $log_meta );
387
+	Give()->logs->insert_log($log_data, $log_meta);
389 388
 }
390 389
 
391 390
 
@@ -399,13 +398,13 @@  discard block
 block discarded – undo
399 398
  *
400 399
  * @return bool|int
401 400
  */
402
-function give_increase_donation_count( $form_id = 0, $quantity = 1 ) {
401
+function give_increase_donation_count($form_id = 0, $quantity = 1) {
403 402
 	$quantity = (int) $quantity;
404 403
 
405 404
 	/** @var \Give_Donate_Form $form */
406
-	$form = new Give_Donate_Form( $form_id );
405
+	$form = new Give_Donate_Form($form_id);
407 406
 
408
-	return $form->increase_sales( $quantity );
407
+	return $form->increase_sales($quantity);
409 408
 }
410 409
 
411 410
 /**
@@ -418,13 +417,13 @@  discard block
 block discarded – undo
418 417
  *
419 418
  * @return bool|int
420 419
  */
421
-function give_decrease_donation_count( $form_id = 0, $quantity = 1 ) {
420
+function give_decrease_donation_count($form_id = 0, $quantity = 1) {
422 421
 	$quantity = (int) $quantity;
423 422
 
424 423
 	/** @var \Give_Donate_Form $form */
425
-	$form = new Give_Donate_Form( $form_id );
424
+	$form = new Give_Donate_Form($form_id);
426 425
 
427
-	return $form->decrease_sales( $quantity );
426
+	return $form->decrease_sales($quantity);
428 427
 }
429 428
 
430 429
 /**
@@ -440,11 +439,11 @@  discard block
 block discarded – undo
440 439
  *
441 440
  * @return bool|int
442 441
  */
443
-function give_increase_earnings( $give_form_id = 0, $amount, $payment_id = 0 ) {
442
+function give_increase_earnings($give_form_id = 0, $amount, $payment_id = 0) {
444 443
 	/** @var \Give_Donate_Form $form */
445
-	$form = new Give_Donate_Form( $give_form_id );
444
+	$form = new Give_Donate_Form($give_form_id);
446 445
 
447
-	return $form->increase_earnings( $amount, $payment_id );
446
+	return $form->increase_earnings($amount, $payment_id);
448 447
 }
449 448
 
450 449
 /**
@@ -462,11 +461,11 @@  discard block
 block discarded – undo
462 461
  *
463 462
  * @return bool|int
464 463
  */
465
-function give_decrease_form_earnings( $form_id = 0, $amount, $payment_id = 0 ) {
464
+function give_decrease_form_earnings($form_id = 0, $amount, $payment_id = 0) {
466 465
 	/** @var \Give_Donate_Form $form */
467
-	$form = new Give_Donate_Form( $form_id );
466
+	$form = new Give_Donate_Form($form_id);
468 467
 
469
-	return $form->decrease_earnings( $amount, $payment_id );
468
+	return $form->decrease_earnings($amount, $payment_id);
470 469
 }
471 470
 
472 471
 
@@ -479,15 +478,15 @@  discard block
 block discarded – undo
479 478
  *
480 479
  * @return int $earnings Earnings for a certain form
481 480
  */
482
-function give_get_form_earnings_stats( $form_id = 0 ) {
483
-	$give_form = new Give_Donate_Form( $form_id );
481
+function give_get_form_earnings_stats($form_id = 0) {
482
+	$give_form = new Give_Donate_Form($form_id);
484 483
 
485 484
 	/**
486 485
 	 * Filter the form earnings
487 486
 	 *
488 487
 	 * @since 1.8.17
489 488
 	 */
490
-	return apply_filters( 'give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form );
489
+	return apply_filters('give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form);
491 490
 }
492 491
 
493 492
 
@@ -500,8 +499,8 @@  discard block
 block discarded – undo
500 499
  *
501 500
  * @return int $sales Amount of sales for a certain form
502 501
  */
503
-function give_get_form_sales_stats( $give_form_id = 0 ) {
504
-	$give_form = new Give_Donate_Form( $give_form_id );
502
+function give_get_form_sales_stats($give_form_id = 0) {
503
+	$give_form = new Give_Donate_Form($give_form_id);
505 504
 
506 505
 	return $give_form->sales;
507 506
 }
@@ -516,16 +515,16 @@  discard block
 block discarded – undo
516 515
  *
517 516
  * @return float $sales Average monthly sales
518 517
  */
519
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
520
-	$sales        = give_get_form_sales_stats( $form_id );
521
-	$release_date = get_post_field( 'post_date', $form_id );
518
+function give_get_average_monthly_form_sales($form_id = 0) {
519
+	$sales        = give_get_form_sales_stats($form_id);
520
+	$release_date = get_post_field('post_date', $form_id);
522 521
 
523
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
522
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
524 523
 
525
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
524
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
526 525
 
527
-	if ( $months > 0 ) {
528
-		$sales = ( $sales / $months );
526
+	if ($months > 0) {
527
+		$sales = ($sales / $months);
529 528
 	}
530 529
 
531 530
 	return $sales;
@@ -541,16 +540,16 @@  discard block
 block discarded – undo
541 540
  *
542 541
  * @return float $earnings Average monthly earnings
543 542
  */
544
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
545
-	$earnings     = give_get_form_earnings_stats( $form_id );
546
-	$release_date = get_post_field( 'post_date', $form_id );
543
+function give_get_average_monthly_form_earnings($form_id = 0) {
544
+	$earnings     = give_get_form_earnings_stats($form_id);
545
+	$release_date = get_post_field('post_date', $form_id);
547 546
 
548
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
547
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
549 548
 
550
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
549
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
551 550
 
552
-	if ( $months > 0 ) {
553
-		$earnings = ( $earnings / $months );
551
+	if ($months > 0) {
552
+		$earnings = ($earnings / $months);
554 553
 	}
555 554
 
556 555
 	return $earnings < 0 ? 0 : $earnings;
@@ -571,34 +570,34 @@  discard block
 block discarded – undo
571 570
  *
572 571
  * @return string $price_name Name of the price option
573 572
  */
574
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true ) {
573
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true) {
575 574
 
576
-	$prices     = give_get_variable_prices( $form_id );
575
+	$prices     = give_get_variable_prices($form_id);
577 576
 	$price_name = '';
578 577
 
579
-	if ( false === $prices ) {
578
+	if (false === $prices) {
580 579
 		return $price_name;
581 580
 	}
582 581
 
583
-	foreach ( $prices as $price ) {
582
+	foreach ($prices as $price) {
584 583
 
585
-		if ( intval( $price['_give_id']['level_id'] ) === intval( $price_id ) ) {
584
+		if (intval($price['_give_id']['level_id']) === intval($price_id)) {
586 585
 
587
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
586
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
588 587
 			$price_fallback = $use_fallback ?
589 588
 				give_currency_filter(
590 589
 					give_format_amount(
591 590
 						$price['_give_amount'],
592
-						array( 'sanitize' => false )
591
+						array('sanitize' => false)
593 592
 					),
594
-					array( 'decode_currency' => true )
593
+					array('decode_currency' => true)
595 594
 				) : '';
596
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
595
+			$price_name = ! empty($price_text) ? $price_text : $price_fallback;
597 596
 
598 597
 		}
599 598
 	}
600 599
 
601
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
600
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
602 601
 }
603 602
 
604 603
 
@@ -612,25 +611,25 @@  discard block
 block discarded – undo
612 611
  *
613 612
  * @return string $range A fully formatted price range
614 613
  */
615
-function give_price_range( $form_id = 0, $formatted = true ) {
616
-	$low        = give_get_lowest_price_option( $form_id );
617
-	$high       = give_get_highest_price_option( $form_id );
618
-	$order_type = ! empty( $_REQUEST['order'] ) ? $_REQUEST['order'] : 'asc';
614
+function give_price_range($form_id = 0, $formatted = true) {
615
+	$low        = give_get_lowest_price_option($form_id);
616
+	$high       = give_get_highest_price_option($form_id);
617
+	$order_type = ! empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc';
619 618
 
620 619
 	$range = sprintf(
621 620
 		'<span class="give_price_range_%1$s">%2$s</span><span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span><span class="give_price_range_%3$s">%4$s</span>',
622 621
 		'asc' === $order_type ? 'low' : 'high',
623
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ),
622
+		'asc' === $order_type ? give_currency_filter(give_format_amount($low, array('sanitize' => false))) : give_currency_filter(give_format_amount($high, array('sanitize' => false))),
624 623
 		'asc' === $order_type ? 'high' : 'low',
625
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) )
624
+		'asc' === $order_type ? give_currency_filter(give_format_amount($high, array('sanitize' => false))) : give_currency_filter(give_format_amount($low, array('sanitize' => false)))
626 625
 
627 626
 	);
628 627
 
629
-	if ( ! $formatted ) {
630
-		$range = wp_strip_all_tags( $range );
628
+	if ( ! $formatted) {
629
+		$range = wp_strip_all_tags($range);
631 630
 	}
632 631
 
633
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
632
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
634 633
 }
635 634
 
636 635
 
@@ -645,35 +644,35 @@  discard block
 block discarded – undo
645 644
  *
646 645
  * @return int ID of the lowest price
647 646
  */
648
-function give_get_lowest_price_id( $form_id = 0 ) {
647
+function give_get_lowest_price_id($form_id = 0) {
649 648
 
650
-	if ( empty( $form_id ) ) {
649
+	if (empty($form_id)) {
651 650
 		$form_id = get_the_ID();
652 651
 	}
653 652
 
654
-	if ( ! give_has_variable_prices( $form_id ) ) {
655
-		return give_get_form_price( $form_id );
653
+	if ( ! give_has_variable_prices($form_id)) {
654
+		return give_get_form_price($form_id);
656 655
 	}
657 656
 
658
-	$prices = give_get_variable_prices( $form_id );
657
+	$prices = give_get_variable_prices($form_id);
659 658
 
660 659
 	$min = $min_id = 0;
661 660
 
662
-	if ( ! empty( $prices ) ) {
661
+	if ( ! empty($prices)) {
663 662
 
664
-		foreach ( $prices as $key => $price ) {
663
+		foreach ($prices as $key => $price) {
665 664
 
666
-			if ( empty( $price['_give_amount'] ) ) {
665
+			if (empty($price['_give_amount'])) {
667 666
 				continue;
668 667
 			}
669 668
 
670
-			if ( ! isset( $min ) ) {
669
+			if ( ! isset($min)) {
671 670
 				$min = $price['_give_amount'];
672 671
 			} else {
673
-				$min = min( $min, $price['_give_amount'] );
672
+				$min = min($min, $price['_give_amount']);
674 673
 			}
675 674
 
676
-			if ( $price['_give_amount'] == $min ) {
675
+			if ($price['_give_amount'] == $min) {
677 676
 				$min_id = $price['_give_id']['level_id'];
678 677
 			}
679 678
 		}
@@ -691,22 +690,22 @@  discard block
 block discarded – undo
691 690
  *
692 691
  * @return float Amount of the lowest price
693 692
  */
694
-function give_get_lowest_price_option( $form_id = 0 ) {
695
-	if ( empty( $form_id ) ) {
693
+function give_get_lowest_price_option($form_id = 0) {
694
+	if (empty($form_id)) {
696 695
 		$form_id = get_the_ID();
697 696
 	}
698 697
 
699
-	if ( ! give_has_variable_prices( $form_id ) ) {
700
-		return give_get_form_price( $form_id );
698
+	if ( ! give_has_variable_prices($form_id)) {
699
+		return give_get_form_price($form_id);
701 700
 	}
702 701
 
703
-	if ( ! ( $low = get_post_meta( $form_id, '_give_levels_minimum_amount', true ) ) ) {
702
+	if ( ! ($low = get_post_meta($form_id, '_give_levels_minimum_amount', true))) {
704 703
 		// Backward compatibility.
705
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
706
-		$low    = ! empty( $prices ) ? min( $prices ) : 0;
704
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
705
+		$low    = ! empty($prices) ? min($prices) : 0;
707 706
 	}
708 707
 
709
-	return give_maybe_sanitize_amount( $low );
708
+	return give_maybe_sanitize_amount($low);
710 709
 }
711 710
 
712 711
 /**
@@ -718,23 +717,23 @@  discard block
 block discarded – undo
718 717
  *
719 718
  * @return float Amount of the highest price
720 719
  */
721
-function give_get_highest_price_option( $form_id = 0 ) {
720
+function give_get_highest_price_option($form_id = 0) {
722 721
 
723
-	if ( empty( $form_id ) ) {
722
+	if (empty($form_id)) {
724 723
 		$form_id = get_the_ID();
725 724
 	}
726 725
 
727
-	if ( ! give_has_variable_prices( $form_id ) ) {
728
-		return give_get_form_price( $form_id );
726
+	if ( ! give_has_variable_prices($form_id)) {
727
+		return give_get_form_price($form_id);
729 728
 	}
730 729
 
731
-	if ( ! ( $high = get_post_meta( $form_id, '_give_levels_maximum_amount', true ) ) ) {
730
+	if ( ! ($high = get_post_meta($form_id, '_give_levels_maximum_amount', true))) {
732 731
 		// Backward compatibility.
733
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
734
-		$high   = ! empty( $prices ) ? max( $prices ) : 0;
732
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
733
+		$high   = ! empty($prices) ? max($prices) : 0;
735 734
 	}
736 735
 
737
-	return give_maybe_sanitize_amount( $high );
736
+	return give_maybe_sanitize_amount($high);
738 737
 }
739 738
 
740 739
 /**
@@ -746,15 +745,15 @@  discard block
 block discarded – undo
746 745
  *
747 746
  * @return mixed string|int Price of the form
748 747
  */
749
-function give_get_form_price( $form_id = 0 ) {
748
+function give_get_form_price($form_id = 0) {
750 749
 
751
-	if ( empty( $form_id ) ) {
750
+	if (empty($form_id)) {
752 751
 		return false;
753 752
 	}
754 753
 
755
-	$form = new Give_Donate_Form( $form_id );
754
+	$form = new Give_Donate_Form($form_id);
756 755
 
757
-	return $form->__get( 'price' );
756
+	return $form->__get('price');
758 757
 }
759 758
 
760 759
 /**
@@ -766,13 +765,13 @@  discard block
 block discarded – undo
766 765
  *
767 766
  * @return mixed string|int Minimum price of the form
768 767
  */
769
-function give_get_form_minimum_price( $form_id = 0 ) {
768
+function give_get_form_minimum_price($form_id = 0) {
770 769
 
771
-	if ( empty( $form_id ) ) {
770
+	if (empty($form_id)) {
772 771
 		return false;
773 772
 	}
774 773
 
775
-	$form = new Give_Donate_Form( $form_id );
774
+	$form = new Give_Donate_Form($form_id);
776 775
 
777 776
 	return $form->get_minimum_price();
778 777
 
@@ -787,13 +786,13 @@  discard block
 block discarded – undo
787 786
  *
788 787
  * @return bool|float
789 788
  */
790
-function give_get_form_maximum_price( $form_id = 0 ) {
789
+function give_get_form_maximum_price($form_id = 0) {
791 790
 
792
-	if ( empty( $form_id ) ) {
791
+	if (empty($form_id)) {
793 792
 		return false;
794 793
 	}
795 794
 
796
-	$form = new Give_Donate_Form( $form_id );
795
+	$form = new Give_Donate_Form($form_id);
797 796
 
798 797
 	return $form->get_maximum_price();
799 798
 }
@@ -809,48 +808,48 @@  discard block
 block discarded – undo
809 808
  *
810 809
  * @return int $formatted_price
811 810
  */
812
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
811
+function give_price($form_id = 0, $echo = true, $price_id = false) {
813 812
 	$price = 0;
814 813
 
815
-	if ( empty( $form_id ) ) {
814
+	if (empty($form_id)) {
816 815
 		$form_id = get_the_ID();
817 816
 	}
818 817
 
819
-	if ( give_has_variable_prices( $form_id ) ) {
818
+	if (give_has_variable_prices($form_id)) {
820 819
 
821
-		$prices = give_get_variable_prices( $form_id );
820
+		$prices = give_get_variable_prices($form_id);
822 821
 
823
-		if ( false !== $price_id ) {
822
+		if (false !== $price_id) {
824 823
 
825 824
 			// loop through multi-prices to see which is default
826
-			foreach ( $prices as $price ) {
825
+			foreach ($prices as $price) {
827 826
 				// this is the default price
828
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
827
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
829 828
 					$price = (float) $price['_give_amount'];
830 829
 				};
831 830
 			}
832 831
 		} else {
833 832
 
834
-			$price = give_get_lowest_price_option( $form_id );
833
+			$price = give_get_lowest_price_option($form_id);
835 834
 		}
836 835
 	} else {
837 836
 
838
-		$price = give_get_form_price( $form_id );
837
+		$price = give_get_form_price($form_id);
839 838
 	}
840 839
 
841
-	$price           = apply_filters( 'give_form_price', give_maybe_sanitize_amount( $price ), $form_id );
842
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
843
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
840
+	$price           = apply_filters('give_form_price', give_maybe_sanitize_amount($price), $form_id);
841
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
842
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
844 843
 
845
-	if ( $echo ) {
844
+	if ($echo) {
846 845
 		echo $formatted_price;
847 846
 	} else {
848 847
 		return $formatted_price;
849 848
 	}
850 849
 }
851 850
 
852
-add_filter( 'give_form_price', 'give_format_amount', 10 );
853
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
851
+add_filter('give_form_price', 'give_format_amount', 10);
852
+add_filter('give_form_price', 'give_currency_filter', 20);
854 853
 
855 854
 
856 855
 /**
@@ -863,19 +862,19 @@  discard block
 block discarded – undo
863 862
  *
864 863
  * @return float $amount Amount of the price option
865 864
  */
866
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
867
-	$prices = give_get_variable_prices( $form_id );
865
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
866
+	$prices = give_get_variable_prices($form_id);
868 867
 
869 868
 	$amount = 0.00;
870 869
 
871
-	foreach ( $prices as $price ) {
872
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
873
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
870
+	foreach ($prices as $price) {
871
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
872
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
874 873
 			break;
875 874
 		};
876 875
 	}
877 876
 
878
-	return apply_filters( 'give_get_price_option_amount', give_maybe_sanitize_amount( $amount ), $form_id, $price_id );
877
+	return apply_filters('give_get_price_option_amount', give_maybe_sanitize_amount($amount), $form_id, $price_id);
879 878
 }
880 879
 
881 880
 /**
@@ -887,13 +886,13 @@  discard block
 block discarded – undo
887 886
  *
888 887
  * @return mixed string|int Goal of the form
889 888
  */
890
-function give_get_form_goal( $form_id = 0 ) {
889
+function give_get_form_goal($form_id = 0) {
891 890
 
892
-	if ( empty( $form_id ) ) {
891
+	if (empty($form_id)) {
893 892
 		return false;
894 893
 	}
895 894
 
896
-	$form = new Give_Donate_Form( $form_id );
895
+	$form = new Give_Donate_Form($form_id);
897 896
 
898 897
 	return $form->goal;
899 898
 
@@ -908,13 +907,13 @@  discard block
 block discarded – undo
908 907
  *
909 908
  * @return mixed string|int Goal of the form
910 909
  */
911
-function give_get_form_goal_format( $form_id = 0 ) {
910
+function give_get_form_goal_format($form_id = 0) {
912 911
 
913
-	if ( empty( $form_id ) ) {
912
+	if (empty($form_id)) {
914 913
 		return false;
915 914
 	}
916 915
 
917
-	return give_get_meta( $form_id, '_give_goal_format', true );
916
+	return give_get_meta($form_id, '_give_goal_format', true);
918 917
 
919 918
 }
920 919
 
@@ -928,19 +927,19 @@  discard block
 block discarded – undo
928 927
  *
929 928
  * @return string $formatted_goal
930 929
  */
931
-function give_goal( $form_id = 0, $echo = true ) {
930
+function give_goal($form_id = 0, $echo = true) {
932 931
 
933
-	if ( empty( $form_id ) ) {
932
+	if (empty($form_id)) {
934 933
 		$form_id = get_the_ID();
935 934
 	}
936 935
 
937
-	$goal        = give_get_form_goal( $form_id );
938
-	$goal_format = give_get_form_goal_format( $form_id );
936
+	$goal        = give_get_form_goal($form_id);
937
+	$goal_format = give_get_form_goal_format($form_id);
939 938
 
940
-	if ( 'donation' === $goal_format ) {
939
+	if ('donation' === $goal_format) {
941 940
 		$goal = "{$goal} donations";
942 941
 	} else {
943
-		$goal = apply_filters( 'give_form_goal', give_maybe_sanitize_amount( $goal ), $form_id );
942
+		$goal = apply_filters('give_form_goal', give_maybe_sanitize_amount($goal), $form_id);
944 943
 	}
945 944
 
946 945
 	$formatted_goal = sprintf(
@@ -948,17 +947,17 @@  discard block
 block discarded – undo
948 947
 		$form_id,
949 948
 		$goal
950 949
 	);
951
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
950
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
952 951
 
953
-	if ( $echo ) {
952
+	if ($echo) {
954 953
 		echo $formatted_goal;
955 954
 	} else {
956 955
 		return $formatted_goal;
957 956
 	}
958 957
 }
959 958
 
960
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
961
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
959
+add_filter('give_form_goal', 'give_format_amount', 10);
960
+add_filter('give_form_goal', 'give_currency_filter', 20);
962 961
 
963 962
 
964 963
 /**
@@ -970,15 +969,15 @@  discard block
 block discarded – undo
970 969
  *
971 970
  * @return bool  $ret Whether or not the logged_in_only setting is set
972 971
  */
973
-function give_logged_in_only( $form_id ) {
972
+function give_logged_in_only($form_id) {
974 973
 	// If _give_logged_in_only is set to enable then guest can donate from that specific form.
975 974
 	// Otherwise it is member only donation form.
976
-	$val = give_get_meta( $form_id, '_give_logged_in_only', true );
977
-	$val = ! empty( $val ) ? $val : 'enabled';
975
+	$val = give_get_meta($form_id, '_give_logged_in_only', true);
976
+	$val = ! empty($val) ? $val : 'enabled';
978 977
 
979
-	$ret = ! give_is_setting_enabled( $val );
978
+	$ret = ! give_is_setting_enabled($val);
980 979
 
981
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
980
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
982 981
 }
983 982
 
984 983
 
@@ -991,11 +990,11 @@  discard block
 block discarded – undo
991 990
  *
992 991
  * @return string
993 992
  */
994
-function give_show_login_register_option( $form_id ) {
993
+function give_show_login_register_option($form_id) {
995 994
 
996
-	$show_register_form = give_get_meta( $form_id, '_give_show_register_form', true );
995
+	$show_register_form = give_get_meta($form_id, '_give_show_register_form', true);
997 996
 
998
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
997
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
999 998
 
1000 999
 }
1001 1000
 
@@ -1011,12 +1010,12 @@  discard block
 block discarded – undo
1011 1010
  *
1012 1011
  * @return array
1013 1012
  */
1014
-function _give_get_prefill_form_field_values( $form_id ) {
1013
+function _give_get_prefill_form_field_values($form_id) {
1015 1014
 	$logged_in_donor_info = array();
1016 1015
 
1017
-	if ( is_user_logged_in() ) :
1018
-		$donor_data    = get_userdata( get_current_user_id() );
1019
-		$donor         = new Give_Donor( get_current_user_id(), true );
1016
+	if (is_user_logged_in()) :
1017
+		$donor_data    = get_userdata(get_current_user_id());
1018
+		$donor         = new Give_Donor(get_current_user_id(), true);
1020 1019
 		$donor_address = $donor->get_donor_address();
1021 1020
 		$company_name  = $donor->get_company_name();
1022 1021
 
@@ -1028,7 +1027,7 @@  discard block
 block discarded – undo
1028 1027
 			'give_last'       => $donor_data->last_name,
1029 1028
 
1030 1029
 			// Title Prefix.
1031
-			'give_title'      => $donor->get_meta( '_give_donor_title_prefix', true ),
1030
+			'give_title'      => $donor->get_meta('_give_donor_title_prefix', true),
1032 1031
 
1033 1032
 			// Company name.
1034 1033
 			'company_name'    => $company_name,
@@ -1058,23 +1057,23 @@  discard block
 block discarded – undo
1058 1057
 
1059 1058
 	// Bailout: Auto fill form field values only form form which donor is donating.
1060 1059
 	if (
1061
-		empty( $_GET['form-id'] )
1060
+		empty($_GET['form-id'])
1062 1061
 		|| ! $form_id
1063
-		|| ( $form_id !== absint( $_GET['form-id'] ) )
1062
+		|| ($form_id !== absint($_GET['form-id']))
1064 1063
 	) {
1065 1064
 		return $logged_in_donor_info;
1066 1065
 	}
1067 1066
 
1068 1067
 	// Get purchase data.
1069
-	$give_purchase_data = Give()->session->get( 'give_purchase' );
1068
+	$give_purchase_data = Give()->session->get('give_purchase');
1070 1069
 
1071 1070
 	// Get donor info from form data.
1072
-	$give_donor_info_in_session = empty( $give_purchase_data['post_data'] )
1071
+	$give_donor_info_in_session = empty($give_purchase_data['post_data'])
1073 1072
 		? array()
1074 1073
 		: $give_purchase_data['post_data'];
1075 1074
 
1076 1075
 	// Output.
1077
-	return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info );
1076
+	return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info);
1078 1077
 }
1079 1078
 
1080 1079
 /**
@@ -1087,13 +1086,13 @@  discard block
 block discarded – undo
1087 1086
  *
1088 1087
  * @return int
1089 1088
  */
1090
-function give_get_form_donor_count( $form_id, $args = array() ) {
1089
+function give_get_form_donor_count($form_id, $args = array()) {
1091 1090
 	global $wpdb;
1092 1091
 
1093
-	$cache_key   = Give_Cache::get_key( "form_donor_count_{$form_id}", $args, false );
1094
-	$donor_count = absint( Give_Cache::get_db_query( $cache_key ) );
1092
+	$cache_key   = Give_Cache::get_key("form_donor_count_{$form_id}", $args, false);
1093
+	$donor_count = absint(Give_Cache::get_db_query($cache_key));
1095 1094
 
1096
-	if ( $form_id && ! $donor_count ) {
1095
+	if ($form_id && ! $donor_count) {
1097 1096
 		// Set arguments.
1098 1097
 		$args = wp_parse_args(
1099 1098
 			$args,
@@ -1103,7 +1102,7 @@  discard block
 block discarded – undo
1103 1102
 		);
1104 1103
 
1105 1104
 		$donation_meta_table  = Give()->payment_meta->table_name;
1106
-		$donation_id_col_name = Give()->payment_meta->get_meta_type() . '_id';
1105
+		$donation_id_col_name = Give()->payment_meta->get_meta_type().'_id';
1107 1106
 
1108 1107
 		$distinct = $args['unique'] ? 'DISTINCT meta_value' : 'meta_value';
1109 1108
 
@@ -1128,7 +1127,7 @@  discard block
 block discarded – undo
1128 1127
 			'publish'
1129 1128
 		);
1130 1129
 
1131
-		$donor_count = absint( $wpdb->get_var( $query ) );
1130
+		$donor_count = absint($wpdb->get_var($query));
1132 1131
 	}
1133 1132
 
1134 1133
 
@@ -1137,7 +1136,7 @@  discard block
 block discarded – undo
1137 1136
 	 *
1138 1137
 	 * @since 2.1.0
1139 1138
 	 */
1140
-	$donor_count = apply_filters( 'give_get_form_donor_count', $donor_count, $form_id, $args );
1139
+	$donor_count = apply_filters('give_get_form_donor_count', $donor_count, $form_id, $args);
1141 1140
 
1142 1141
 	return $donor_count;
1143 1142
 }
@@ -1151,33 +1150,33 @@  discard block
 block discarded – undo
1151 1150
  *
1152 1151
  * @return void
1153 1152
  */
1154
-function give_set_form_closed_status( $form_id ) {
1153
+function give_set_form_closed_status($form_id) {
1155 1154
 
1156 1155
 	// Bailout.
1157
-	if ( empty( $form_id ) ) {
1156
+	if (empty($form_id)) {
1158 1157
 		return;
1159 1158
 	}
1160 1159
 
1161 1160
 	$open_form       = false;
1162
-	$is_goal_enabled = give_is_setting_enabled( give_get_meta( $form_id, '_give_goal_option', true, 'disabled' ) );
1161
+	$is_goal_enabled = give_is_setting_enabled(give_get_meta($form_id, '_give_goal_option', true, 'disabled'));
1163 1162
 
1164 1163
 	// Proceed, if the form goal is enabled.
1165
-	if ( $is_goal_enabled ) {
1164
+	if ($is_goal_enabled) {
1166 1165
 
1167
-		$close_form_when_goal_achieved = give_is_setting_enabled( give_get_meta( $form_id, '_give_close_form_when_goal_achieved', true, 'disabled' ) );
1166
+		$close_form_when_goal_achieved = give_is_setting_enabled(give_get_meta($form_id, '_give_close_form_when_goal_achieved', true, 'disabled'));
1168 1167
 
1169 1168
 		// Proceed, if close form when goal achieved option is enabled.
1170
-		if ( $close_form_when_goal_achieved ) {
1169
+		if ($close_form_when_goal_achieved) {
1171 1170
 
1172
-			$form                = new Give_Donate_Form( $form_id );
1173
-			$goal_progress_stats = give_goal_progress_stats( $form );
1171
+			$form                = new Give_Donate_Form($form_id);
1172
+			$goal_progress_stats = give_goal_progress_stats($form);
1174 1173
 
1175 1174
 			// Verify whether the form is closed or not after processing data.
1176 1175
 			$closed = $goal_progress_stats['raw_goal'] <= $goal_progress_stats['raw_actual'];
1177 1176
 
1178 1177
 			// Update form meta if verified that the form is closed.
1179
-			if ( $closed ) {
1180
-				give_update_meta( $form_id, '_give_form_status', 'closed' );
1178
+			if ($closed) {
1179
+				give_update_meta($form_id, '_give_form_status', 'closed');
1181 1180
 			} else {
1182 1181
 				$open_form = true;
1183 1182
 			}
@@ -1189,8 +1188,8 @@  discard block
 block discarded – undo
1189 1188
 	}
1190 1189
 
1191 1190
 	// If $open_form is true, then update form status to open.
1192
-	if ( $open_form ) {
1193
-		give_update_meta( $form_id, '_give_form_status', 'open' );
1191
+	if ($open_form) {
1192
+		give_update_meta($form_id, '_give_form_status', 'open');
1194 1193
 	}
1195 1194
 }
1196 1195
 
@@ -1203,32 +1202,31 @@  discard block
 block discarded – undo
1203 1202
  *
1204 1203
  * @return string
1205 1204
  */
1206
-function give_admin_form_goal_stats( $form_id ) {
1205
+function give_admin_form_goal_stats($form_id) {
1207 1206
 
1208 1207
 	$html             = '';
1209
-	$goal_stats       = give_goal_progress_stats( $form_id );
1210
-	$percent_complete = round( ( $goal_stats['raw_actual'] / $goal_stats['raw_goal'] ), 3 ) * 100;
1208
+	$goal_stats       = give_goal_progress_stats($form_id);
1209
+	$percent_complete = round(($goal_stats['raw_actual'] / $goal_stats['raw_goal']), 3) * 100;
1211 1210
 
1212 1211
 	$html .= sprintf(
1213 1212
 		'<div class="give-admin-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="%1$s">
1214 1213
 <span style="width:%1$s%%;"></span>
1215 1214
 </div>',
1216
-		esc_attr( $goal_stats['progress'] )
1215
+		esc_attr($goal_stats['progress'])
1217 1216
 	);
1218 1217
 
1219 1218
 	$html .= sprintf(
1220
-		( 'percentage' !== $goal_stats['format'] ) ?
1221
-			'<div class="give-goal-text"><span>%1$s</span> %2$s <a href="%3$s">%4$s</a> %5$s ' :
1222
-			'<div class="give-goal-text"><a href="%3$s">%1$s </a>',
1223
-		( 'percentage' !== $goal_stats['format'] ) ? $goal_stats['actual'] : $percent_complete . '%',
1224
-		( 'percentage' !== $goal_stats['format'] ) ? __( 'of', 'give' ) : '',
1225
-		esc_url( admin_url( "post.php?post={$form_id}&action=edit&give_tab=donation_goal_options" ) ),
1219
+		('percentage' !== $goal_stats['format']) ?
1220
+			'<div class="give-goal-text"><span>%1$s</span> %2$s <a href="%3$s">%4$s</a> %5$s ' : '<div class="give-goal-text"><a href="%3$s">%1$s </a>',
1221
+		('percentage' !== $goal_stats['format']) ? $goal_stats['actual'] : $percent_complete.'%',
1222
+		('percentage' !== $goal_stats['format']) ? __('of', 'give') : '',
1223
+		esc_url(admin_url("post.php?post={$form_id}&action=edit&give_tab=donation_goal_options")),
1226 1224
 		$goal_stats['goal'],
1227
-		( 'donors' === $goal_stats['format'] ? __( 'Donors', 'give' ) : ( 'donation' === $goal_stats['format'] ? __( 'Donations', 'give' ) : '' ) )
1225
+		('donors' === $goal_stats['format'] ? __('Donors', 'give') : ('donation' === $goal_stats['format'] ? __('Donations', 'give') : ''))
1228 1226
 	);
1229 1227
 
1230
-	if ( $goal_stats['raw_actual'] >= $goal_stats['raw_goal'] ) {
1231
-		$html .= sprintf( '<span class="give-admin-goal-achieved"><span class="dashicons dashicons-star-filled"></span> %s</span>', __( 'Goal achieved', 'give' ) );
1228
+	if ($goal_stats['raw_actual'] >= $goal_stats['raw_goal']) {
1229
+		$html .= sprintf('<span class="give-admin-goal-achieved"><span class="dashicons dashicons-star-filled"></span> %s</span>', __('Goal achieved', 'give'));
1232 1230
 	}
1233 1231
 
1234 1232
 	$html .= '</div>';
@@ -1246,11 +1244,11 @@  discard block
 block discarded – undo
1246 1244
  *
1247 1245
  * @return null | array
1248 1246
  */
1249
-function give_form_get_default_level( $form_id ) {
1247
+function give_form_get_default_level($form_id) {
1250 1248
 	$default_level = null;
1251 1249
 
1252 1250
 	// If donation form has variable prices.
1253
-	if ( give_has_variable_prices( $form_id ) ) {
1251
+	if (give_has_variable_prices($form_id)) {
1254 1252
 		/**
1255 1253
 		 * Filter the variable pricing
1256 1254
 		 *
@@ -1262,12 +1260,12 @@  discard block
 block discarded – undo
1262 1260
 		 * @param array $prices Array of variable prices.
1263 1261
 		 * @param int   $form   Form ID.
1264 1262
 		 */
1265
-		$prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
1263
+		$prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
1266 1264
 
1267 1265
 		// Go through each of the level and get the default level id.
1268
-		foreach ( $prices as $level ) {
1266
+		foreach ($prices as $level) {
1269 1267
 			if (
1270
-				isset( $level['_give_default'] )
1268
+				isset($level['_give_default'])
1271 1269
 				&& $level['_give_default'] === 'default'
1272 1270
 			) {
1273 1271
 				$default_level = $level;
@@ -1283,7 +1281,7 @@  discard block
 block discarded – undo
1283 1281
 	 * @param array   $default_level Default level price data.
1284 1282
 	 * @param integer $form_id       Donation form ID.
1285 1283
 	 */
1286
-	return apply_filters( 'give_form_get_default_level', $default_level, $form_id );
1284
+	return apply_filters('give_form_get_default_level', $default_level, $form_id);
1287 1285
 }
1288 1286
 
1289 1287
 /**
@@ -1296,21 +1294,21 @@  discard block
 block discarded – undo
1296 1294
  *
1297 1295
  * @return boolean
1298 1296
  */
1299
-function give_is_default_level_id( $price_or_level_id, $form_id = 0 ) {
1297
+function give_is_default_level_id($price_or_level_id, $form_id = 0) {
1300 1298
 	$is_default = false;
1301 1299
 
1302 1300
 	if (
1303
-		! empty( $form_id )
1304
-		&& is_numeric( $price_or_level_id )
1301
+		! empty($form_id)
1302
+		&& is_numeric($price_or_level_id)
1305 1303
 	) {
1306 1304
 		// Get default level id.
1307
-		$form_price_data = give_form_get_default_level( $form_id );
1305
+		$form_price_data = give_form_get_default_level($form_id);
1308 1306
 
1309
-		$is_default = ! is_null( $form_price_data ) && ( $price_or_level_id === absint( $form_price_data['_give_id']['level_id'] ) );
1307
+		$is_default = ! is_null($form_price_data) && ($price_or_level_id === absint($form_price_data['_give_id']['level_id']));
1310 1308
 	}
1311 1309
 
1312
-	$is_default = false === $is_default && is_array( $price_or_level_id ) ?
1313
-		( isset( $price_or_level_id['_give_default'] ) && $price_or_level_id['_give_default'] === 'default' )
1310
+	$is_default = false === $is_default && is_array($price_or_level_id) ?
1311
+		(isset($price_or_level_id['_give_default']) && $price_or_level_id['_give_default'] === 'default')
1314 1312
 		: $is_default;
1315 1313
 
1316 1314
 	/**
@@ -1321,5 +1319,5 @@  discard block
 block discarded – undo
1321 1319
 	 * @param bool          $is_default        True if it is default price level id otherwise false.
1322 1320
 	 * @param array|integer $price_or_level_id Price Data.
1323 1321
 	 */
1324
-	return apply_filters( 'give_is_default_level_id', $is_default, $price_or_level_id );
1322
+	return apply_filters('give_is_default_level_id', $is_default, $price_or_level_id);
1325 1323
 }
Please login to merge, or discard this patch.
includes/misc-functions.php 2 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
  *
229 229
  * @since 1.8.17
230 230
  *
231
- * @return array|string
231
+ * @return boolean
232 232
  */
233 233
 function give_get_history_session() {
234 234
 	return (bool) Give()->session->get( 'history_access' );
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
  *
706 706
  * @todo  Remove this, when WordPress Core ticket is resolved (https://core.trac.wordpress.org/ticket/16828).
707 707
  *
708
- * @return bool
708
+ * @return false|null
709 709
  */
710 710
 function give_donation_metabox_menu() {
711 711
 
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
  *
984 984
  * @since 1.8
985 985
  *
986
- * @param $form_id
986
+ * @param integer $form_id
987 987
  *
988 988
  * @return bool
989 989
  */
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
  * @param int    $id
1091 1091
  * @param string $meta_key
1092 1092
  * @param mixed  $meta_value
1093
- * @param mixed  $prev_value
1093
+ * @param string  $prev_value
1094 1094
  *
1095 1095
  * @return mixed
1096 1096
  */
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
  * @since 1.8.13
1350 1350
  *
1351 1351
  * @param array      $list      List of objects or arrays
1352
- * @param int|string $field     Field from the object to place instead of the entire object
1352
+ * @param string $field     Field from the object to place instead of the entire object
1353 1353
  * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
1354 1354
  *                              Default null.
1355 1355
  *
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
  *
1780 1780
  * @since 2.1
1781 1781
  *
1782
- * @param $form_id
1782
+ * @param integer $form_id
1783 1783
  *
1784 1784
  * @return bool
1785 1785
  */
@@ -2167,7 +2167,7 @@  discard block
 block discarded – undo
2167 2167
  *
2168 2168
  * @since 2.2.0
2169 2169
  *
2170
- * @return object
2170
+ * @return Give_Donor
2171 2171
  */
2172 2172
 function give_get_name_with_title_prefixes( $donor ) {
2173 2173
 
Please login to merge, or discard this patch.
Spacing   +446 added lines, -446 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function give_is_test_mode() {
25 25
 
26
-	$ret = give_is_setting_enabled( give_get_option( 'test_mode' ) );
26
+	$ret = give_is_setting_enabled(give_get_option('test_mode'));
27 27
 
28
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
28
+	return (bool) apply_filters('give_is_test_mode', $ret);
29 29
 
30 30
 }
31 31
 
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
 
40 40
 	global $wp;
41 41
 
42
-	if ( get_option( 'permalink_structure' ) ) {
43
-		$base = trailingslashit( home_url( $wp->request ) );
42
+	if (get_option('permalink_structure')) {
43
+		$base = trailingslashit(home_url($wp->request));
44 44
 	} else {
45
-		$base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) );
46
-		$base = remove_query_arg( array( 'post_type', 'name' ), $base );
45
+		$base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request)));
46
+		$base = remove_query_arg(array('post_type', 'name'), $base);
47 47
 	}
48 48
 
49 49
 	$scheme      = is_ssl() ? 'https' : 'http';
50
-	$current_uri = set_url_scheme( $base, $scheme );
50
+	$current_uri = set_url_scheme($base, $scheme);
51 51
 
52
-	if ( is_front_page() ) {
53
-		$current_uri = home_url( '/' );
52
+	if (is_front_page()) {
53
+		$current_uri = home_url('/');
54 54
 	}
55 55
 
56 56
 	/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param string $current_uri
62 62
 	 */
63
-	return apply_filters( 'give_get_current_page_url', $current_uri );
63
+	return apply_filters('give_get_current_page_url', $current_uri);
64 64
 
65 65
 }
66 66
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	$gateways = give_get_enabled_payment_gateways();
84 84
 
85
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
85
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
86 86
 		$ret = true;
87
-	} elseif ( count( $gateways ) == 1 ) {
87
+	} elseif (count($gateways) == 1) {
88 88
 		$ret = false;
89
-	} elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
89
+	} elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
90 90
 		$ret = false;
91 91
 	}
92 92
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @param bool $ret
99 99
 	 */
100
-	return (bool) apply_filters( 'give_is_cc_verify_enabled', $ret );
100
+	return (bool) apply_filters('give_is_cc_verify_enabled', $ret);
101 101
 }
102 102
 
103 103
 /**
@@ -109,26 +109,26 @@  discard block
 block discarded – undo
109 109
 function give_get_timezone_id() {
110 110
 
111 111
 	// if site timezone string exists, return it.
112
-	if ( $timezone = get_option( 'timezone_string' ) ) {
112
+	if ($timezone = get_option('timezone_string')) {
113 113
 		return $timezone;
114 114
 	}
115 115
 
116 116
 	// get UTC offset, if it isn't set return UTC.
117
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
117
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
118 118
 		return 'UTC';
119 119
 	}
120 120
 
121 121
 	// attempt to guess the timezone string from the UTC offset.
122
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
122
+	$timezone = timezone_name_from_abbr('', $utc_offset);
123 123
 
124 124
 	// last try, guess timezone string manually.
125
-	if ( $timezone === false ) {
125
+	if ($timezone === false) {
126 126
 
127
-		$is_dst = date( 'I' );
127
+		$is_dst = date('I');
128 128
 
129
-		foreach ( timezone_abbreviations_list() as $abbr ) {
130
-			foreach ( $abbr as $city ) {
131
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
129
+		foreach (timezone_abbreviations_list() as $abbr) {
130
+			foreach ($abbr as $city) {
131
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
132 132
 					return $city['timezone_id'];
133 133
 				}
134 134
 			}
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
 
153 153
 	$ip = '127.0.0.1';
154 154
 
155
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
155
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
156 156
 		// check ip from share internet
157 157
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
158
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
158
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
159 159
 		// to check ip is pass from proxy
160 160
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
161
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
161
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
162 162
 		$ip = $_SERVER['REMOTE_ADDR'];
163 163
 	}
164 164
 
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @since 1.0
169 169
 	 */
170
-	$ip = apply_filters( 'give_get_ip', $ip );
170
+	$ip = apply_filters('give_get_ip', $ip);
171 171
 
172 172
 	// Filter empty values.
173
-	if ( false !== strpos( $ip, ',' ) ) {
174
-		$ip = give_clean( explode( ',', $ip ) );
175
-		$ip = array_filter( $ip );
176
-		$ip = implode( ',', $ip );
173
+	if (false !== strpos($ip, ',')) {
174
+		$ip = give_clean(explode(',', $ip));
175
+		$ip = array_filter($ip);
176
+		$ip = implode(',', $ip);
177 177
 	} else {
178
-		$ip = give_clean( $ip );
178
+		$ip = give_clean($ip);
179 179
 	}
180 180
 
181 181
 	return $ip;
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @uses  Give()->session->set()
195 195
  */
196
-function give_set_purchase_session( $purchase_data = array() ) {
197
-	Give()->session->set( 'give_purchase', $purchase_data );
198
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
196
+function give_set_purchase_session($purchase_data = array()) {
197
+	Give()->session->set('give_purchase', $purchase_data);
198
+	Give()->session->set('give_email', $purchase_data['user_email']);
199 199
 }
200 200
 
201 201
 /**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
  * @return mixed array | false
210 210
  */
211 211
 function give_get_purchase_session() {
212
-	return Give()->session->get( 'give_purchase' );
212
+	return Give()->session->get('give_purchase');
213 213
 }
214 214
 
215 215
 /**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
  * @return array|string
221 221
  */
222 222
 function give_get_receipt_session() {
223
-	return Give()->session->get( 'receipt_access' );
223
+	return Give()->session->get('receipt_access');
224 224
 }
225 225
 
226 226
 /**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
  * @return array|string
232 232
  */
233 233
 function give_get_history_session() {
234
-	return (bool) Give()->session->get( 'history_access' );
234
+	return (bool) Give()->session->get('history_access');
235 235
 }
236 236
 
237 237
 /**
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
  *
244 244
  * @return string By default, the name of the form. Then the price level text if any is found.
245 245
  */
246
-function give_payment_gateway_item_title( $payment_data ) {
246
+function give_payment_gateway_item_title($payment_data) {
247 247
 
248
-	$form_id   = intval( $payment_data['post_data']['give-form-id'] );
249
-	$item_name = isset( $payment_data['post_data']['give-form-title'] ) ? $payment_data['post_data']['give-form-title'] : '';
250
-	$price_id  = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
248
+	$form_id   = intval($payment_data['post_data']['give-form-id']);
249
+	$item_name = isset($payment_data['post_data']['give-form-title']) ? $payment_data['post_data']['give-form-title'] : '';
250
+	$price_id  = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
251 251
 
252 252
 	// Verify has variable prices.
253
-	if ( give_has_variable_prices( $form_id ) && ! empty( $price_id ) ) {
253
+	if (give_has_variable_prices($form_id) && ! empty($price_id)) {
254 254
 
255
-		$item_price_level_text = give_get_price_option_name( $form_id, $price_id, 0, false );
255
+		$item_price_level_text = give_get_price_option_name($form_id, $price_id, 0, false);
256 256
 
257 257
 		/**
258 258
 		 * Output donation level text if:
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 		 * 1. It's not a custom amount
261 261
 		 * 2. The level field has actual text and isn't the amount (which is already displayed on the receipt).
262 262
 		 */
263
-		if ( 'custom' !== $price_id && ! empty( $item_price_level_text ) ) {
263
+		if ('custom' !== $price_id && ! empty($item_price_level_text)) {
264 264
 			// Matches a donation level - append level text.
265
-			$item_name .= ' - ' . $item_price_level_text;
265
+			$item_name .= ' - '.$item_price_level_text;
266 266
 		}
267 267
 	}
268 268
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 *
278 278
 	 * @return string
279 279
 	 */
280
-	return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data );
280
+	return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data);
281 281
 }
282 282
 
283 283
 /**
@@ -293,38 +293,38 @@  discard block
 block discarded – undo
293 293
  *
294 294
  * @return string
295 295
  */
296
-function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) {
296
+function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) {
297 297
 
298
-	$form_id  = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : '';
299
-	$price_id = isset( $donation_data['post_data']['give-price-id'] ) ? $donation_data['post_data']['give-price-id'] : '';
298
+	$form_id  = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : '';
299
+	$price_id = isset($donation_data['post_data']['give-price-id']) ? $donation_data['post_data']['give-price-id'] : '';
300 300
 
301 301
 	// Form title.
302
-	$summary = ( ! empty( $donation_data['post_data']['give-form-title'] ) ? $donation_data['post_data']['give-form-title'] : ( ! empty( $form_id ) ? wp_sprintf( __( 'Donation Form ID: %d', 'give' ), $form_id ) : __( 'Untitled donation form', 'give' ) ) );
302
+	$summary = ( ! empty($donation_data['post_data']['give-form-title']) ? $donation_data['post_data']['give-form-title'] : ( ! empty($form_id) ? wp_sprintf(__('Donation Form ID: %d', 'give'), $form_id) : __('Untitled donation form', 'give')));
303 303
 
304 304
 	// Form multilevel if applicable.
305
-	if ( ! empty( $price_id ) && 'custom' !== $price_id ) {
306
-		$summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] );
305
+	if ( ! empty($price_id) && 'custom' !== $price_id) {
306
+		$summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']);
307 307
 	}
308 308
 
309 309
 	// Add Donor's name + email if requested.
310
-	if ( $name_and_email ) {
310
+	if ($name_and_email) {
311 311
 
312 312
 		// First name
313
-		if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) {
314
-			$summary .= ' - ' . $donation_data['user_info']['first_name'];
313
+		if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) {
314
+			$summary .= ' - '.$donation_data['user_info']['first_name'];
315 315
 		}
316 316
 
317
-		if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) {
318
-			$summary .= ' ' . $donation_data['user_info']['last_name'];
317
+		if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) {
318
+			$summary .= ' '.$donation_data['user_info']['last_name'];
319 319
 		}
320 320
 
321
-		$summary .= ' (' . $donation_data['user_email'] . ')';
321
+		$summary .= ' ('.$donation_data['user_email'].')';
322 322
 	}
323 323
 
324 324
 	// Cut the length
325
-	$summary = substr( $summary, 0, $length );
325
+	$summary = substr($summary, 0, $length);
326 326
 
327
-	return apply_filters( 'give_payment_gateway_donation_summary', $summary );
327
+	return apply_filters('give_payment_gateway_donation_summary', $summary);
328 328
 }
329 329
 
330 330
 
@@ -339,31 +339,31 @@  discard block
 block discarded – undo
339 339
 function give_get_host() {
340 340
 	$host = false;
341 341
 
342
-	if ( defined( 'WPE_APIKEY' ) ) {
342
+	if (defined('WPE_APIKEY')) {
343 343
 		$host = 'WP Engine';
344
-	} elseif ( defined( 'PAGELYBIN' ) ) {
344
+	} elseif (defined('PAGELYBIN')) {
345 345
 		$host = 'Pagely';
346
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
346
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
347 347
 		$host = 'ICDSoft';
348
-	} elseif ( DB_HOST == 'mysqlv5' ) {
348
+	} elseif (DB_HOST == 'mysqlv5') {
349 349
 		$host = 'NetworkSolutions';
350
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
350
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
351 351
 		$host = 'iPage';
352
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
352
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
353 353
 		$host = 'IPower';
354
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
354
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
355 355
 		$host = 'MediaTemple Grid';
356
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
356
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
357 357
 		$host = 'pair Networks';
358
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
358
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
359 359
 		$host = 'Rackspace Cloud';
360
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
360
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
361 361
 		$host = 'SysFix.eu Power Hosting';
362
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
362
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
363 363
 		$host = 'Flywheel';
364 364
 	} else {
365 365
 		// Adding a general fallback for data gathering
366
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
366
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
367 367
 	}
368 368
 
369 369
 	return $host;
@@ -379,67 +379,67 @@  discard block
 block discarded – undo
379 379
  *
380 380
  * @return bool true if host matches, false if not
381 381
  */
382
-function give_is_host( $host = false ) {
382
+function give_is_host($host = false) {
383 383
 
384 384
 	$return = false;
385 385
 
386
-	if ( $host ) {
387
-		$host = str_replace( ' ', '', strtolower( $host ) );
386
+	if ($host) {
387
+		$host = str_replace(' ', '', strtolower($host));
388 388
 
389
-		switch ( $host ) {
389
+		switch ($host) {
390 390
 			case 'wpengine':
391
-				if ( defined( 'WPE_APIKEY' ) ) {
391
+				if (defined('WPE_APIKEY')) {
392 392
 					$return = true;
393 393
 				}
394 394
 				break;
395 395
 			case 'pagely':
396
-				if ( defined( 'PAGELYBIN' ) ) {
396
+				if (defined('PAGELYBIN')) {
397 397
 					$return = true;
398 398
 				}
399 399
 				break;
400 400
 			case 'icdsoft':
401
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
401
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
402 402
 					$return = true;
403 403
 				}
404 404
 				break;
405 405
 			case 'networksolutions':
406
-				if ( DB_HOST == 'mysqlv5' ) {
406
+				if (DB_HOST == 'mysqlv5') {
407 407
 					$return = true;
408 408
 				}
409 409
 				break;
410 410
 			case 'ipage':
411
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
411
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
412 412
 					$return = true;
413 413
 				}
414 414
 				break;
415 415
 			case 'ipower':
416
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
416
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
417 417
 					$return = true;
418 418
 				}
419 419
 				break;
420 420
 			case 'mediatemplegrid':
421
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
421
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
422 422
 					$return = true;
423 423
 				}
424 424
 				break;
425 425
 			case 'pairnetworks':
426
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
426
+				if (strpos(DB_HOST, '.pair.com') !== false) {
427 427
 					$return = true;
428 428
 				}
429 429
 				break;
430 430
 			case 'rackspacecloud':
431
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
431
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
432 432
 					$return = true;
433 433
 				}
434 434
 				break;
435 435
 			case 'sysfix.eu':
436 436
 			case 'sysfix.eupowerhosting':
437
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
437
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
438 438
 					$return = true;
439 439
 				}
440 440
 				break;
441 441
 			case 'flywheel':
442
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
442
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
443 443
 					$return = true;
444 444
 				}
445 445
 				break;
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
  * @param string $replacement Optional. The function that should have been called.
473 473
  * @param array  $backtrace   Optional. Contains stack backtrace of deprecated function.
474 474
  */
475
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
475
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
476 476
 
477 477
 	/**
478 478
 	 * Fires while give deprecated function call occurs.
@@ -485,19 +485,19 @@  discard block
 block discarded – undo
485 485
 	 * @param string $replacement Optional. The function that should have been called.
486 486
 	 * @param string $version     The plugin version that deprecated the function.
487 487
 	 */
488
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
488
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
489 489
 
490
-	$show_errors = current_user_can( 'manage_options' );
490
+	$show_errors = current_user_can('manage_options');
491 491
 
492 492
 	// Allow plugin to filter the output error trigger.
493
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
494
-		if ( ! is_null( $replacement ) ) {
495
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
496
-			trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
493
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
494
+		if ( ! is_null($replacement)) {
495
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
496
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
497 497
 			// Alternatively we could dump this to a file.
498 498
 		} else {
499
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
500
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
499
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
500
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
501 501
 			// Alternatively we could dump this to a file.
502 502
 		}
503 503
 	}
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
  * @return string $post_id
512 512
  */
513 513
 function give_get_admin_post_id() {
514
-	$post_id = isset( $_REQUEST['post'] ) ? absint( $_REQUEST['post'] ) : null;
514
+	$post_id = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : null;
515 515
 
516
-	$post_id = ! empty( $post_id ) ? $post_id : ( isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : null );
516
+	$post_id = ! empty($post_id) ? $post_id : (isset($_REQUEST['post_id']) ? absint($_REQUEST['post_id']) : null);
517 517
 
518
-	$post_id = ! empty( $post_id ) ? $post_id : ( isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : null );
518
+	$post_id = ! empty($post_id) ? $post_id : (isset($_REQUEST['post_ID']) ? absint($_REQUEST['post_ID']) : null);
519 519
 
520 520
 	return $post_id;
521 521
 }
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
  * @return string Arg separator output
528 528
  */
529 529
 function give_get_php_arg_separator_output() {
530
-	return ini_get( 'arg_separator.output' );
530
+	return ini_get('arg_separator.output');
531 531
 }
532 532
 
533 533
 
@@ -542,10 +542,10 @@  discard block
 block discarded – undo
542 542
  *
543 543
  * @return string Short month name
544 544
  */
545
-function give_month_num_to_name( $n ) {
546
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
545
+function give_month_num_to_name($n) {
546
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
547 547
 
548
-	return date_i18n( 'M', $timestamp );
548
+	return date_i18n('M', $timestamp);
549 549
 }
550 550
 
551 551
 
@@ -558,10 +558,10 @@  discard block
 block discarded – undo
558 558
  *
559 559
  * @return bool Whether or not function is disabled.
560 560
  */
561
-function give_is_func_disabled( $function ) {
562
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
561
+function give_is_func_disabled($function) {
562
+	$disabled = explode(',', ini_get('disable_functions'));
563 563
 
564
-	return in_array( $function, $disabled );
564
+	return in_array($function, $disabled);
565 565
 }
566 566
 
567 567
 /**
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 function give_get_newsletter() {
573 573
 	?>
574 574
 
575
-	<p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
575
+	<p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
576 576
 
577 577
 	<div class="give-newsletter-form-wrap">
578 578
 
@@ -580,33 +580,33 @@  discard block
 block discarded – undo
580 580
 			  method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"
581 581
 			  target="_blank">
582 582
 			<div class="give-newsletter-confirmation">
583
-				<p><?php esc_html_e( 'To complete your subscription, click the confirmation link in your email. Thank you!', 'give' ); ?></p>
583
+				<p><?php esc_html_e('To complete your subscription, click the confirmation link in your email. Thank you!', 'give'); ?></p>
584 584
 			</div>
585 585
 
586 586
 			<table class="form-table give-newsletter-form">
587 587
 				<tr valign="middle">
588 588
 					<td>
589 589
 						<label for="mce-EMAIL"
590
-							   class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>
590
+							   class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label>
591 591
 						<input type="email" name="EMAIL" id="mce-EMAIL"
592
-							   placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>"
592
+							   placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>"
593 593
 							   class="required email" value="" required>
594 594
 					</td>
595 595
 					<td>
596 596
 						<label for="mce-FNAME"
597
-							   class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>
597
+							   class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label>
598 598
 						<input type="text" name="FNAME" id="mce-FNAME"
599
-							   placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="" required>
599
+							   placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="" required>
600 600
 					</td>
601 601
 					<td>
602 602
 						<label for="mce-LNAME"
603
-							   class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
603
+							   class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label>
604 604
 						<input type="text" name="LNAME" id="mce-LNAME"
605
-							   placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value="">
605
+							   placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value="">
606 606
 					</td>
607 607
 					<td>
608 608
 						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button"
609
-							   value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">
609
+							   value="<?php esc_attr_e('Subscribe', 'give'); ?>">
610 610
 					</td>
611 611
 				</tr>
612 612
 			</table>
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
  *
664 664
  * @return string
665 665
  */
666
-function give_svg_icons( $icon ) {
666
+function give_svg_icons($icon) {
667 667
 
668 668
 	// Store your SVGs in an associative array
669 669
 	$svgs = array(
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 	);
676 676
 
677 677
 	// Return the chosen icon's SVG string
678
-	return $svgs[ $icon ];
678
+	return $svgs[$icon];
679 679
 }
680 680
 
681 681
 /**
@@ -687,15 +687,15 @@  discard block
 block discarded – undo
687 687
  *
688 688
  * @return mixed
689 689
  */
690
-function modify_nav_menu_meta_box_object( $post_type ) {
691
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
692
-		$post_type->labels->name = esc_html__( 'Donation Forms', 'give' );
690
+function modify_nav_menu_meta_box_object($post_type) {
691
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
692
+		$post_type->labels->name = esc_html__('Donation Forms', 'give');
693 693
 	}
694 694
 
695 695
 	return $post_type;
696 696
 }
697 697
 
698
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
698
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
699 699
 
700 700
 /**
701 701
  * Show Donation Forms Post Type in Appearance > Menus by default on fresh install.
@@ -712,30 +712,30 @@  discard block
 block discarded – undo
712 712
 	$screen = get_current_screen();
713 713
 
714 714
 	// Proceed, if current screen is navigation menus.
715
-	if ( 'nav-menus' === $screen->id && give_is_setting_enabled( give_get_option( 'forms_singular' ) ) && ! get_user_option( 'give_is_donation_forms_menu_updated' ) ) {
715
+	if ('nav-menus' === $screen->id && give_is_setting_enabled(give_get_option('forms_singular')) && ! get_user_option('give_is_donation_forms_menu_updated')) {
716 716
 
717 717
 		// Return false, if it fails to retrieve hidden meta box list and is not admin.
718
-		if ( ! is_admin() || ( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) ) ) {
718
+		if ( ! is_admin() || ( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus'))) {
719 719
 			return false;
720 720
 		}
721 721
 
722 722
 		// Return false, In case, we don't find 'Donation Form' in hidden meta box list.
723
-		if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) {
723
+		if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) {
724 724
 			return false;
725 725
 		}
726 726
 
727 727
 		// Exclude 'Donation Form' value from hidden meta box's list.
728
-		$hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) );
728
+		$hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms'));
729 729
 
730 730
 		// Get current user ID.
731 731
 		$user = wp_get_current_user();
732 732
 
733
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
734
-		update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true );
733
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
734
+		update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true);
735 735
 	}
736 736
 }
737 737
 
738
-add_action( 'current_screen', 'give_donation_metabox_menu' );
738
+add_action('current_screen', 'give_donation_metabox_menu');
739 739
 
740 740
 /**
741 741
  * Array_column backup usage
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
  * @license    https://opensource.org/licenses/MIT MIT
749 749
  */
750 750
 
751
-if ( ! function_exists( 'array_column' ) ) {
751
+if ( ! function_exists('array_column')) {
752 752
 	/**
753 753
 	 * Returns the values from a single column of the input array, identified by
754 754
 	 * the $columnKey.
@@ -767,43 +767,43 @@  discard block
 block discarded – undo
767 767
 	 *
768 768
 	 * @return array
769 769
 	 */
770
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
770
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
771 771
 		// Using func_get_args() in order to check for proper number of
772 772
 		// parameters and trigger errors exactly as the built-in array_column()
773 773
 		// does in PHP 5.5.
774 774
 		$argc   = func_num_args();
775 775
 		$params = func_get_args();
776 776
 
777
-		if ( $argc < 2 ) {
778
-			trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING );
777
+		if ($argc < 2) {
778
+			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING);
779 779
 
780 780
 			return null;
781 781
 		}
782 782
 
783
-		if ( ! is_array( $params[0] ) ) {
784
-			trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING );
783
+		if ( ! is_array($params[0])) {
784
+			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING);
785 785
 
786 786
 			return null;
787 787
 		}
788 788
 
789
-		if ( ! is_int( $params[1] ) && ! is_float( $params[1] ) && ! is_string( $params[1] ) && $params[1] !== null && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) ) {
790
-			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
789
+		if ( ! is_int($params[1]) && ! is_float($params[1]) && ! is_string($params[1]) && $params[1] !== null && ! (is_object($params[1]) && method_exists($params[1], '__toString'))) {
790
+			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING);
791 791
 
792 792
 			return false;
793 793
 		}
794 794
 
795
-		if ( isset( $params[2] ) && ! is_int( $params[2] ) && ! is_float( $params[2] ) && ! is_string( $params[2] ) && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) ) {
796
-			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
795
+		if (isset($params[2]) && ! is_int($params[2]) && ! is_float($params[2]) && ! is_string($params[2]) && ! (is_object($params[2]) && method_exists($params[2], '__toString'))) {
796
+			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING);
797 797
 
798 798
 			return false;
799 799
 		}
800 800
 
801 801
 		$paramsInput     = $params[0];
802
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
802
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
803 803
 
804 804
 		$paramsIndexKey = null;
805
-		if ( isset( $params[2] ) ) {
806
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
805
+		if (isset($params[2])) {
806
+			if (is_float($params[2]) || is_int($params[2])) {
807 807
 				$paramsIndexKey = (int) $params[2];
808 808
 			} else {
809 809
 				$paramsIndexKey = (string) $params[2];
@@ -812,26 +812,26 @@  discard block
 block discarded – undo
812 812
 
813 813
 		$resultArray = array();
814 814
 
815
-		foreach ( $paramsInput as $row ) {
815
+		foreach ($paramsInput as $row) {
816 816
 			$key    = $value = null;
817 817
 			$keySet = $valueSet = false;
818 818
 
819
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
819
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
820 820
 				$keySet = true;
821
-				$key    = (string) $row[ $paramsIndexKey ];
821
+				$key    = (string) $row[$paramsIndexKey];
822 822
 			}
823 823
 
824
-			if ( $paramsColumnKey === null ) {
824
+			if ($paramsColumnKey === null) {
825 825
 				$valueSet = true;
826 826
 				$value    = $row;
827
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
827
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
828 828
 				$valueSet = true;
829
-				$value    = $row[ $paramsColumnKey ];
829
+				$value    = $row[$paramsColumnKey];
830 830
 			}
831 831
 
832
-			if ( $valueSet ) {
833
-				if ( $keySet ) {
834
-					$resultArray[ $key ] = $value;
832
+			if ($valueSet) {
833
+				if ($keySet) {
834
+					$resultArray[$key] = $value;
835 835
 				} else {
836 836
 					$resultArray[] = $value;
837 837
 				}
@@ -851,54 +851,54 @@  discard block
 block discarded – undo
851 851
  *
852 852
  * @return bool Whether the receipt is visible or not.
853 853
  */
854
-function give_can_view_receipt( $payment_key = '' ) {
854
+function give_can_view_receipt($payment_key = '') {
855 855
 
856 856
 	$return = false;
857 857
 
858
-	if ( empty( $payment_key ) ) {
858
+	if (empty($payment_key)) {
859 859
 		return $return;
860 860
 	}
861 861
 
862 862
 	global $give_receipt_args;
863 863
 
864
-	$give_receipt_args['id'] = give_get_donation_id_by_key( $payment_key );
864
+	$give_receipt_args['id'] = give_get_donation_id_by_key($payment_key);
865 865
 
866
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
866
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
867 867
 
868
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
868
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
869 869
 
870
-	if ( is_user_logged_in() ) {
871
-		if ( $user_id === (int) get_current_user_id() ) {
870
+	if (is_user_logged_in()) {
871
+		if ($user_id === (int) get_current_user_id()) {
872 872
 			$return = true;
873
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
873
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
874 874
 			$return = true;
875
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
875
+		} elseif (current_user_can('view_give_sensitive_data')) {
876 876
 			$return = true;
877 877
 		}
878 878
 	}
879 879
 
880 880
 	// Check whether it is purchase session?
881 881
 	$purchase_session = give_get_purchase_session();
882
-	if ( ! empty( $purchase_session ) && ! is_user_logged_in() ) {
883
-		if ( $purchase_session['purchase_key'] === $payment_meta['key'] ) {
882
+	if ( ! empty($purchase_session) && ! is_user_logged_in()) {
883
+		if ($purchase_session['purchase_key'] === $payment_meta['key']) {
884 884
 			$return = true;
885 885
 		}
886 886
 	}
887 887
 
888 888
 	// Check whether it is receipt access session?
889 889
 	$receipt_session = give_get_receipt_session();
890
-	if ( ! empty( $receipt_session ) && ! is_user_logged_in() ) {
891
-		if ( $receipt_session === $payment_meta['key'] ) {
890
+	if ( ! empty($receipt_session) && ! is_user_logged_in()) {
891
+		if ($receipt_session === $payment_meta['key']) {
892 892
 			$return = true;
893 893
 		}
894 894
 	}
895 895
 
896 896
 	// Check whether it is history access session?
897
-	if ( true === give_get_history_session() ) {
897
+	if (true === give_get_history_session()) {
898 898
 		$return = true;
899 899
 	}
900 900
 
901
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
901
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
902 902
 
903 903
 }
904 904
 
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
  *
908 908
  * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
909 909
  */
910
-if ( ! function_exists( 'cal_days_in_month' ) ) {
910
+if ( ! function_exists('cal_days_in_month')) {
911 911
 	/**
912 912
 	 * cal_days_in_month
913 913
 	 *
@@ -917,8 +917,8 @@  discard block
 block discarded – undo
917 917
 	 *
918 918
 	 * @return bool|string
919 919
 	 */
920
-	function cal_days_in_month( $calendar, $month, $year ) {
921
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
920
+	function cal_days_in_month($calendar, $month, $year) {
921
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
922 922
 	}
923 923
 }
924 924
 
@@ -937,40 +937,40 @@  discard block
 block discarded – undo
937 937
  */
938 938
 function give_get_plugins() {
939 939
 	$plugins             = get_plugins();
940
-	$active_plugin_paths = (array) get_option( 'active_plugins', array() );
940
+	$active_plugin_paths = (array) get_option('active_plugins', array());
941 941
 
942
-	if ( is_multisite() ) {
943
-		$network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
944
-		$active_plugin_paths            = array_merge( $active_plugin_paths, $network_activated_plugin_paths );
942
+	if (is_multisite()) {
943
+		$network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array()));
944
+		$active_plugin_paths            = array_merge($active_plugin_paths, $network_activated_plugin_paths);
945 945
 	}
946 946
 
947
-	foreach ( $plugins as $plugin_path => $plugin_data ) {
947
+	foreach ($plugins as $plugin_path => $plugin_data) {
948 948
 		// Is plugin active?
949
-		if ( in_array( $plugin_path, $active_plugin_paths ) ) {
950
-			$plugins[ $plugin_path ]['Status'] = 'active';
949
+		if (in_array($plugin_path, $active_plugin_paths)) {
950
+			$plugins[$plugin_path]['Status'] = 'active';
951 951
 		} else {
952
-			$plugins[ $plugin_path ]['Status'] = 'inactive';
952
+			$plugins[$plugin_path]['Status'] = 'inactive';
953 953
 		}
954 954
 
955
-		$dirname = strtolower( dirname( $plugin_path ) );
955
+		$dirname = strtolower(dirname($plugin_path));
956 956
 
957 957
 		// Is plugin a Give add-on by WordImpress?
958
-		if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) {
958
+		if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) {
959 959
 			// Plugin is a Give-addon.
960
-			$plugins[ $plugin_path ]['Type'] = 'add-on';
960
+			$plugins[$plugin_path]['Type'] = 'add-on';
961 961
 
962 962
 			/* @var stdClass $license_active */
963
-			$license_active = __give_get_active_license_info( Give_License::get_short_name( $plugin_data['Name'] ) );
963
+			$license_active = __give_get_active_license_info(Give_License::get_short_name($plugin_data['Name']));
964 964
 
965 965
 			// Does a valid license exist?
966
-			if ( ! empty( $license_active ) && 'valid' === $license_active->license ) {
967
-				$plugins[ $plugin_path ]['License'] = true;
966
+			if ( ! empty($license_active) && 'valid' === $license_active->license) {
967
+				$plugins[$plugin_path]['License'] = true;
968 968
 			} else {
969
-				$plugins[ $plugin_path ]['License'] = false;
969
+				$plugins[$plugin_path]['License'] = false;
970 970
 			}
971 971
 		} else {
972 972
 			// Plugin is not a Give add-on.
973
-			$plugins[ $plugin_path ]['Type'] = 'other';
973
+			$plugins[$plugin_path]['Type'] = 'other';
974 974
 		}
975 975
 	}
976 976
 
@@ -986,13 +986,13 @@  discard block
 block discarded – undo
986 986
  *
987 987
  * @return bool
988 988
  */
989
-function give_is_terms_enabled( $form_id ) {
990
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
989
+function give_is_terms_enabled($form_id) {
990
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
991 991
 
992
-	if ( give_is_setting_enabled( $form_option, 'global' ) && give_is_setting_enabled( give_get_option( 'terms' ) ) ) {
992
+	if (give_is_setting_enabled($form_option, 'global') && give_is_setting_enabled(give_get_option('terms'))) {
993 993
 		return true;
994 994
 
995
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
995
+	} elseif (give_is_setting_enabled($form_option)) {
996 996
 		return true;
997 997
 
998 998
 	} else {
@@ -1016,10 +1016,10 @@  discard block
 block discarded – undo
1016 1016
  *
1017 1017
  * @return WP_Error|bool
1018 1018
  */
1019
-function give_delete_donation_stats( $date_range = '', $args = array() ) {
1019
+function give_delete_donation_stats($date_range = '', $args = array()) {
1020 1020
 
1021 1021
 	// Delete all cache.
1022
-	$status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) );
1022
+	$status = Give_Cache::delete(Give_Cache::get_options_like('give_stats'));
1023 1023
 
1024 1024
 	/**
1025 1025
 	 * Fire the action when donation stats delete.
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 	 * @param string|array $date_range
1030 1030
 	 * @param array        $args
1031 1031
 	 */
1032
-	do_action( 'give_delete_donation_stats', $status, $date_range, $args );
1032
+	do_action('give_delete_donation_stats', $status, $date_range, $args);
1033 1033
 
1034 1034
 	return $status;
1035 1035
 }
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 function give_is_add_new_form_page() {
1044 1044
 	$status = false;
1045 1045
 
1046
-	if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) {
1046
+	if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) {
1047 1047
 		$status = true;
1048 1048
 	}
1049 1049
 
@@ -1066,15 +1066,15 @@  discard block
 block discarded – undo
1066 1066
  *
1067 1067
  * @return mixed
1068 1068
  */
1069
-function give_get_meta( $id, $meta_key = '', $single = false, $default = false ) {
1069
+function give_get_meta($id, $meta_key = '', $single = false, $default = false) {
1070 1070
 	/**
1071 1071
 	 * Filter the meta value
1072 1072
 	 *
1073 1073
 	 * @since 1.8.8
1074 1074
 	 */
1075
-	$meta_value = apply_filters( 'give_get_meta', get_post_meta( $id, $meta_key, $single ), $id, $meta_key, $default );
1075
+	$meta_value = apply_filters('give_get_meta', get_post_meta($id, $meta_key, $single), $id, $meta_key, $default);
1076 1076
 
1077
-	if ( ( empty( $meta_key ) || empty( $meta_value ) ) && $default ) {
1077
+	if ((empty($meta_key) || empty($meta_value)) && $default) {
1078 1078
 		$meta_value = $default;
1079 1079
 	}
1080 1080
 
@@ -1093,15 +1093,15 @@  discard block
 block discarded – undo
1093 1093
  *
1094 1094
  * @return mixed
1095 1095
  */
1096
-function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) {
1097
-	$status = update_post_meta( $id, $meta_key, $meta_value, $prev_value );
1096
+function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') {
1097
+	$status = update_post_meta($id, $meta_key, $meta_value, $prev_value);
1098 1098
 
1099 1099
 	/**
1100 1100
 	 * Filter the meta value update status
1101 1101
 	 *
1102 1102
 	 * @since 1.8.8
1103 1103
 	 */
1104
-	return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value );
1104
+	return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value);
1105 1105
 }
1106 1106
 
1107 1107
 /**
@@ -1115,15 +1115,15 @@  discard block
 block discarded – undo
1115 1115
  *
1116 1116
  * @return mixed
1117 1117
  */
1118
-function give_delete_meta( $id, $meta_key, $meta_value = '' ) {
1119
-	$status = delete_post_meta( $id, $meta_key, $meta_value );
1118
+function give_delete_meta($id, $meta_key, $meta_value = '') {
1119
+	$status = delete_post_meta($id, $meta_key, $meta_value);
1120 1120
 
1121 1121
 	/**
1122 1122
 	 * Filter the meta value delete status
1123 1123
 	 *
1124 1124
 	 * @since 1.8.8
1125 1125
 	 */
1126
-	return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value );
1126
+	return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value);
1127 1127
 }
1128 1128
 
1129 1129
 /**
@@ -1135,22 +1135,22 @@  discard block
 block discarded – undo
1135 1135
  *
1136 1136
  * @return bool                   If the action has been added to the completed actions array
1137 1137
  */
1138
-function give_has_upgrade_completed( $upgrade_action = '' ) {
1138
+function give_has_upgrade_completed($upgrade_action = '') {
1139 1139
 	// Bailout.
1140
-	if ( empty( $upgrade_action ) ) {
1140
+	if (empty($upgrade_action)) {
1141 1141
 		return false;
1142 1142
 	}
1143 1143
 
1144 1144
 	// Fresh install?
1145 1145
 	// If fresh install then all upgrades will be consider as completed.
1146
-	$is_fresh_install = ! get_option( 'give_version' );
1147
-	if ( $is_fresh_install ) {
1146
+	$is_fresh_install = ! get_option('give_version');
1147
+	if ($is_fresh_install) {
1148 1148
 		return true;
1149 1149
 	}
1150 1150
 
1151 1151
 	$completed_upgrades = give_get_completed_upgrades();
1152 1152
 
1153
-	return in_array( $upgrade_action, $completed_upgrades );
1153
+	return in_array($upgrade_action, $completed_upgrades);
1154 1154
 
1155 1155
 }
1156 1156
 
@@ -1162,8 +1162,8 @@  discard block
 block discarded – undo
1162 1162
  * @return mixed   When nothing to resume returns false, otherwise starts the upgrade where it left off
1163 1163
  */
1164 1164
 function give_maybe_resume_upgrade() {
1165
-	$doing_upgrade = get_option( 'give_doing_upgrade', false );
1166
-	if ( empty( $doing_upgrade ) ) {
1165
+	$doing_upgrade = get_option('give_doing_upgrade', false);
1166
+	if (empty($doing_upgrade)) {
1167 1167
 		return false;
1168 1168
 	}
1169 1169
 
@@ -1179,9 +1179,9 @@  discard block
 block discarded – undo
1179 1179
  *
1180 1180
  * @return bool                   If the function was successfully added
1181 1181
  */
1182
-function give_set_upgrade_complete( $upgrade_action = '' ) {
1182
+function give_set_upgrade_complete($upgrade_action = '') {
1183 1183
 
1184
-	if ( empty( $upgrade_action ) ) {
1184
+	if (empty($upgrade_action)) {
1185 1185
 		return false;
1186 1186
 	}
1187 1187
 
@@ -1189,16 +1189,16 @@  discard block
 block discarded – undo
1189 1189
 	$completed_upgrades[] = $upgrade_action;
1190 1190
 
1191 1191
 	// Remove any blanks, and only show uniques.
1192
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
1192
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
1193 1193
 
1194 1194
 	/**
1195 1195
 	 * Fire the action when any upgrade set to complete.
1196 1196
 	 *
1197 1197
 	 * @since 1.8.12
1198 1198
 	 */
1199
-	do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades );
1199
+	do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades);
1200 1200
 
1201
-	return update_option( 'give_completed_upgrades', $completed_upgrades, false );
1201
+	return update_option('give_completed_upgrades', $completed_upgrades, false);
1202 1202
 }
1203 1203
 
1204 1204
 /**
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
  * @return array The array of completed upgrades
1209 1209
  */
1210 1210
 function give_get_completed_upgrades() {
1211
-	return (array) get_option( 'give_completed_upgrades' );
1211
+	return (array) get_option('give_completed_upgrades');
1212 1212
 }
1213 1213
 
1214 1214
 /**
@@ -1223,16 +1223,16 @@  discard block
 block discarded – undo
1223 1223
  *
1224 1224
  * @return null|array
1225 1225
  */
1226
-function __give_v20_bc_table_details( $type ) {
1226
+function __give_v20_bc_table_details($type) {
1227 1227
 	global $wpdb;
1228 1228
 	$table = array();
1229 1229
 
1230 1230
 	// Bailout.
1231
-	if ( empty( $type ) ) {
1231
+	if (empty($type)) {
1232 1232
 		return null;
1233 1233
 	}
1234 1234
 
1235
-	switch ( $type ) {
1235
+	switch ($type) {
1236 1236
 		case 'form':
1237 1237
 			$table['name']         = $wpdb->formmeta;
1238 1238
 			$table['column']['id'] = 'form_id';
@@ -1241,11 +1241,11 @@  discard block
 block discarded – undo
1241 1241
 
1242 1242
 		case 'payment':
1243 1243
 			$table['name']         = $wpdb->donationmeta;
1244
-			$table['column']['id'] = Give()->payment_meta->get_meta_type() . '_id';
1244
+			$table['column']['id'] = Give()->payment_meta->get_meta_type().'_id';
1245 1245
 	}
1246 1246
 
1247 1247
 	// Backward compatibility.
1248
-	if ( ! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) ) {
1248
+	if ( ! give_has_upgrade_completed('v20_move_metadata_into_new_table')) {
1249 1249
 		$table['name']         = $wpdb->postmeta;
1250 1250
 		$table['column']['id'] = 'post_id';
1251 1251
 	}
@@ -1260,12 +1260,12 @@  discard block
 block discarded – undo
1260 1260
  *
1261 1261
  * @param WP_Query $query
1262 1262
  */
1263
-function give_remove_pages_from_search( $query ) {
1263
+function give_remove_pages_from_search($query) {
1264 1264
 
1265
-	if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
1265
+	if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) {
1266 1266
 
1267
-		$transaction_failed = give_get_option( 'failure_page', 0 );
1268
-		$success_page       = give_get_option( 'success_page', 0 );
1267
+		$transaction_failed = give_get_option('failure_page', 0);
1268
+		$success_page       = give_get_option('success_page', 0);
1269 1269
 
1270 1270
 		$args = apply_filters(
1271 1271
 			'give_remove_pages_from_search', array(
@@ -1273,11 +1273,11 @@  discard block
 block discarded – undo
1273 1273
 				$success_page,
1274 1274
 			), $query
1275 1275
 		);
1276
-		$query->set( 'post__not_in', $args );
1276
+		$query->set('post__not_in', $args);
1277 1277
 	}
1278 1278
 }
1279 1279
 
1280
-add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 );
1280
+add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1);
1281 1281
 
1282 1282
 /**
1283 1283
  * Inserts a new key/value before a key in the array.
@@ -1293,14 +1293,14 @@  discard block
 block discarded – undo
1293 1293
  *
1294 1294
  * @see   array_insert_before()
1295 1295
  */
1296
-function give_array_insert_before( $key, array &$array, $new_key, $new_value ) {
1297
-	if ( array_key_exists( $key, $array ) ) {
1296
+function give_array_insert_before($key, array &$array, $new_key, $new_value) {
1297
+	if (array_key_exists($key, $array)) {
1298 1298
 		$new = array();
1299
-		foreach ( $array as $k => $value ) {
1300
-			if ( $k === $key ) {
1301
-				$new[ $new_key ] = $new_value;
1299
+		foreach ($array as $k => $value) {
1300
+			if ($k === $key) {
1301
+				$new[$new_key] = $new_value;
1302 1302
 			}
1303
-			$new[ $k ] = $value;
1303
+			$new[$k] = $value;
1304 1304
 		}
1305 1305
 
1306 1306
 		return $new;
@@ -1323,13 +1323,13 @@  discard block
 block discarded – undo
1323 1323
  *
1324 1324
  * @see   array_insert_before()
1325 1325
  */
1326
-function give_array_insert_after( $key, array &$array, $new_key, $new_value ) {
1327
-	if ( array_key_exists( $key, $array ) ) {
1326
+function give_array_insert_after($key, array &$array, $new_key, $new_value) {
1327
+	if (array_key_exists($key, $array)) {
1328 1328
 		$new = array();
1329
-		foreach ( $array as $k => $value ) {
1330
-			$new[ $k ] = $value;
1331
-			if ( $k === $key ) {
1332
-				$new[ $new_key ] = $new_value;
1329
+		foreach ($array as $k => $value) {
1330
+			$new[$k] = $value;
1331
+			if ($k === $key) {
1332
+				$new[$new_key] = $new_value;
1333 1333
 			}
1334 1334
 		}
1335 1335
 
@@ -1356,21 +1356,21 @@  discard block
 block discarded – undo
1356 1356
  *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
1357 1357
  *               `$list` will be preserved in the results.
1358 1358
  */
1359
-function give_list_pluck( $list, $field, $index_key = null ) {
1359
+function give_list_pluck($list, $field, $index_key = null) {
1360 1360
 
1361
-	if ( ! $index_key ) {
1361
+	if ( ! $index_key) {
1362 1362
 		/**
1363 1363
 		 * This is simple. Could at some point wrap array_column()
1364 1364
 		 * if we knew we had an array of arrays.
1365 1365
 		 */
1366
-		foreach ( $list as $key => $value ) {
1367
-			if ( is_object( $value ) ) {
1368
-				if ( isset( $value->$field ) ) {
1369
-					$list[ $key ] = $value->$field;
1366
+		foreach ($list as $key => $value) {
1367
+			if (is_object($value)) {
1368
+				if (isset($value->$field)) {
1369
+					$list[$key] = $value->$field;
1370 1370
 				}
1371 1371
 			} else {
1372
-				if ( isset( $value[ $field ] ) ) {
1373
-					$list[ $key ] = $value[ $field ];
1372
+				if (isset($value[$field])) {
1373
+					$list[$key] = $value[$field];
1374 1374
 				}
1375 1375
 			}
1376 1376
 		}
@@ -1383,18 +1383,18 @@  discard block
 block discarded – undo
1383 1383
 	 * to the end of the stack. This is how array_column() behaves.
1384 1384
 	 */
1385 1385
 	$newlist = array();
1386
-	foreach ( $list as $value ) {
1387
-		if ( is_object( $value ) ) {
1388
-			if ( isset( $value->$index_key ) ) {
1389
-				$newlist[ $value->$index_key ] = $value->$field;
1386
+	foreach ($list as $value) {
1387
+		if (is_object($value)) {
1388
+			if (isset($value->$index_key)) {
1389
+				$newlist[$value->$index_key] = $value->$field;
1390 1390
 			} else {
1391 1391
 				$newlist[] = $value->$field;
1392 1392
 			}
1393 1393
 		} else {
1394
-			if ( isset( $value[ $index_key ] ) ) {
1395
-				$newlist[ $value[ $index_key ] ] = $value[ $field ];
1394
+			if (isset($value[$index_key])) {
1395
+				$newlist[$value[$index_key]] = $value[$field];
1396 1396
 			} else {
1397
-				$newlist[] = $value[ $field ];
1397
+				$newlist[] = $value[$field];
1398 1398
 			}
1399 1399
 		}
1400 1400
 	}
@@ -1417,8 +1417,8 @@  discard block
 block discarded – undo
1417 1417
  *
1418 1418
  * @return int|false Meta ID on success, false on failure.
1419 1419
  */
1420
-function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) {
1421
-	return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique );
1420
+function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) {
1421
+	return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique);
1422 1422
 }
1423 1423
 
1424 1424
 /**
@@ -1436,8 +1436,8 @@  discard block
 block discarded – undo
1436 1436
  *
1437 1437
  * @return bool True on success, false on failure.
1438 1438
  */
1439
-function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) {
1440
-	return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value );
1439
+function delete_donor_meta($donor_id, $meta_key, $meta_value = '') {
1440
+	return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value);
1441 1441
 }
1442 1442
 
1443 1443
 /**
@@ -1452,8 +1452,8 @@  discard block
 block discarded – undo
1452 1452
  * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
1453 1453
  *  is true.
1454 1454
  */
1455
-function get_donor_meta( $donor_id, $key = '', $single = false ) {
1456
-	return get_metadata( 'give_customer', $donor_id, $key, $single );
1455
+function get_donor_meta($donor_id, $key = '', $single = false) {
1456
+	return get_metadata('give_customer', $donor_id, $key, $single);
1457 1457
 }
1458 1458
 
1459 1459
 /**
@@ -1470,8 +1470,8 @@  discard block
 block discarded – undo
1470 1470
  *
1471 1471
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
1472 1472
  */
1473
-function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) {
1474
-	return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value );
1473
+function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') {
1474
+	return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value);
1475 1475
 }
1476 1476
 
1477 1477
 
@@ -1484,15 +1484,15 @@  discard block
 block discarded – undo
1484 1484
  *
1485 1485
  * @return void
1486 1486
  */
1487
-function give_recount_form_income_donation( $form_id = 0 ) {
1487
+function give_recount_form_income_donation($form_id = 0) {
1488 1488
 	// Check if form id is not empty.
1489
-	if ( ! empty( $form_id ) ) {
1489
+	if ( ! empty($form_id)) {
1490 1490
 		/**
1491 1491
 		 * Filter to modify payment status.
1492 1492
 		 *
1493 1493
 		 * @since 1.8.13
1494 1494
 		 */
1495
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
1495
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
1496 1496
 
1497 1497
 		/**
1498 1498
 		 * Filter to modify args of payment query before recalculating the form total
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
 			'give_recount_form_stats_args', array(
1504 1504
 				'give_forms'     => $form_id,
1505 1505
 				'status'         => $accepted_statuses,
1506
-				'posts_per_page' => - 1,
1506
+				'posts_per_page' => -1,
1507 1507
 				'fields'         => 'ids',
1508 1508
 			)
1509 1509
 		);
@@ -1513,28 +1513,28 @@  discard block
 block discarded – undo
1513 1513
 			'earnings' => 0,
1514 1514
 		);
1515 1515
 
1516
-		$payments = new Give_Payments_Query( $args );
1516
+		$payments = new Give_Payments_Query($args);
1517 1517
 		$payments = $payments->get_payments();
1518 1518
 
1519
-		if ( $payments ) {
1520
-			foreach ( $payments as $payment ) {
1519
+		if ($payments) {
1520
+			foreach ($payments as $payment) {
1521 1521
 				// Ensure acceptible status only
1522
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
1522
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
1523 1523
 					continue;
1524 1524
 				}
1525 1525
 
1526 1526
 				// Ensure only payments for this form are counted
1527
-				if ( $payment->form_id != $form_id ) {
1527
+				if ($payment->form_id != $form_id) {
1528 1528
 					continue;
1529 1529
 				}
1530 1530
 
1531
-				$totals['sales'] ++;
1531
+				$totals['sales']++;
1532 1532
 				$totals['earnings'] += $payment->total;
1533 1533
 
1534 1534
 			}
1535 1535
 		}
1536
-		give_update_meta( $form_id, '_give_form_sales', $totals['sales'] );
1537
-		give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
1536
+		give_update_meta($form_id, '_give_form_sales', $totals['sales']);
1537
+		give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
1538 1538
 	}// End if().
1539 1539
 }
1540 1540
 
@@ -1549,26 +1549,26 @@  discard block
 block discarded – undo
1549 1549
  *
1550 1550
  * @return string
1551 1551
  */
1552
-function give_get_attribute_str( $attributes, $default_attributes = array() ) {
1552
+function give_get_attribute_str($attributes, $default_attributes = array()) {
1553 1553
 	$attribute_str = '';
1554 1554
 
1555
-	if ( isset( $attributes['attributes'] ) ) {
1555
+	if (isset($attributes['attributes'])) {
1556 1556
 		$attributes = $attributes['attributes'];
1557 1557
 	}
1558 1558
 
1559
-	if ( ! empty( $default_attributes ) ) {
1560
-		$attributes = wp_parse_args( $attributes, $default_attributes );
1559
+	if ( ! empty($default_attributes)) {
1560
+		$attributes = wp_parse_args($attributes, $default_attributes);
1561 1561
 	}
1562 1562
 
1563
-	if ( empty( $attributes ) ) {
1563
+	if (empty($attributes)) {
1564 1564
 		return $attribute_str;
1565 1565
 	}
1566 1566
 
1567
-	foreach ( $attributes as $tag => $value ) {
1567
+	foreach ($attributes as $tag => $value) {
1568 1568
 		$attribute_str .= " {$tag}=\"{$value}\"";
1569 1569
 	}
1570 1570
 
1571
-	return trim( $attribute_str );
1571
+	return trim($attribute_str);
1572 1572
 }
1573 1573
 
1574 1574
 /**
@@ -1581,7 +1581,7 @@  discard block
 block discarded – undo
1581 1581
 function give_get_wp_upload_dir() {
1582 1582
 	$wp_upload_dir = wp_upload_dir();
1583 1583
 
1584
-	return ( ! empty( $wp_upload_dir['path'] ) ? $wp_upload_dir['path'] : false );
1584
+	return ( ! empty($wp_upload_dir['path']) ? $wp_upload_dir['path'] : false);
1585 1585
 }
1586 1586
 
1587 1587
 /**
@@ -1593,15 +1593,15 @@  discard block
 block discarded – undo
1593 1593
  *
1594 1594
  * @return string|bool $file_contents File content
1595 1595
  */
1596
-function give_get_core_settings_json( $file_name ) {
1596
+function give_get_core_settings_json($file_name) {
1597 1597
 	$upload_dir = give_get_wp_upload_dir();
1598
-	$file_path  = $upload_dir . '/' . $file_name;
1598
+	$file_path  = $upload_dir.'/'.$file_name;
1599 1599
 
1600
-	if ( is_wp_error( $file_path ) || empty( $file_path ) ) {
1601
-		Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
1600
+	if (is_wp_error($file_path) || empty($file_path)) {
1601
+		Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
1602 1602
 	}
1603 1603
 
1604
-	$file_contents = file_get_contents( $file_path );
1604
+	$file_contents = file_get_contents($file_path);
1605 1605
 
1606 1606
 	return $file_contents;
1607 1607
 }
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
  * @return int $country The two letter country code for the site's base country
1615 1615
  */
1616 1616
 function give_get_limit_display_donations() {
1617
-	return give_get_option( 'limit_display_donations', 1 );
1617
+	return give_get_option('limit_display_donations', 1);
1618 1618
 }
1619 1619
 
1620 1620
 /**
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
  * @since 1.8.17
1624 1624
  */
1625 1625
 function give_donation_history_table_end() {
1626
-	$email = Give()->session->get( 'give_email' );
1626
+	$email = Give()->session->get('give_email');
1627 1627
 	?>
1628 1628
 	<tfoot>
1629 1629
 	<tr>
@@ -1631,15 +1631,15 @@  discard block
 block discarded – undo
1631 1631
 			<div class="give-security-wrap">
1632 1632
 				<div class="give-security-column give-security-description-wrap">
1633 1633
 					<?php
1634
-					echo sprintf( __( 'For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give' ), $email );
1634
+					echo sprintf(__('For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give'), $email);
1635 1635
 					?>
1636 1636
 				</div>
1637 1637
 				<div class="give-security-column give-security-button-wrap">
1638 1638
 					<a href="#" data-email="<?php echo $email; ?>" id="give-confirm-email-btn"
1639 1639
 					   class="give-confirm-email-btn give-btn">
1640
-						<?php _e( 'Confirm Email', 'give' ); ?>
1640
+						<?php _e('Confirm Email', 'give'); ?>
1641 1641
 					</a>
1642
-					<span><?php _e( 'Email Sent!', 'give' ); ?></span>
1642
+					<span><?php _e('Email Sent!', 'give'); ?></span>
1643 1643
 				</div>
1644 1644
 			</div>
1645 1645
 		</td>
@@ -1660,10 +1660,10 @@  discard block
 block discarded – undo
1660 1660
  *
1661 1661
  * @return void
1662 1662
  */
1663
-function give_doing_it_wrong( $function, $message, $version ) {
1664
-	$message .= "\nBacktrace:" . wp_debug_backtrace_summary();
1663
+function give_doing_it_wrong($function, $message, $version) {
1664
+	$message .= "\nBacktrace:".wp_debug_backtrace_summary();
1665 1665
 
1666
-	_doing_it_wrong( $function, $message, $version );
1666
+	_doing_it_wrong($function, $message, $version);
1667 1667
 }
1668 1668
 
1669 1669
 
@@ -1673,10 +1673,10 @@  discard block
 block discarded – undo
1673 1673
  * @since 1.8.18
1674 1674
  */
1675 1675
 function give_ignore_user_abort() {
1676
-	ignore_user_abort( true );
1676
+	ignore_user_abort(true);
1677 1677
 
1678
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
1679
-		set_time_limit( 0 );
1678
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
1679
+		set_time_limit(0);
1680 1680
 	}
1681 1681
 }
1682 1682
 
@@ -1690,28 +1690,28 @@  discard block
 block discarded – undo
1690 1690
  *
1691 1691
  * @return int
1692 1692
  */
1693
-function give_get_total_post_type_count( $post_type = '', $args = array() ) {
1693
+function give_get_total_post_type_count($post_type = '', $args = array()) {
1694 1694
 	global $wpdb;
1695 1695
 	$where = '';
1696 1696
 
1697
-	if ( ! $post_type ) {
1697
+	if ( ! $post_type) {
1698 1698
 		return 0;
1699 1699
 	}
1700 1700
 
1701 1701
 	// Bulit where query
1702
-	if ( ! empty( $post_type ) ) {
1702
+	if ( ! empty($post_type)) {
1703 1703
 		$where .= ' WHERE';
1704 1704
 
1705
-		if ( is_array( $post_type ) ) {
1706
-			$where .= " post_type='" . implode( "' OR post_type='", $post_type ) . "'";
1705
+		if (is_array($post_type)) {
1706
+			$where .= " post_type='".implode("' OR post_type='", $post_type)."'";
1707 1707
 		} else {
1708 1708
 			$where .= " post_type='{$post_type}'";
1709 1709
 		}
1710 1710
 	}
1711 1711
 
1712
-	$result = $wpdb->get_var( "SELECT count(ID) FROM {$wpdb->posts}{$where}" );
1712
+	$result = $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts}{$where}");
1713 1713
 
1714
-	return absint( $result );
1714
+	return absint($result);
1715 1715
 }
1716 1716
 
1717 1717
 /**
@@ -1724,9 +1724,9 @@  discard block
 block discarded – undo
1724 1724
  *
1725 1725
  * @credit WooCommerce
1726 1726
  */
1727
-function give_maybe_define_constant( $name, $value ) {
1728
-	if ( ! defined( $name ) ) {
1729
-		define( $name, $value );
1727
+function give_maybe_define_constant($name, $value) {
1728
+	if ( ! defined($name)) {
1729
+		define($name, $value);
1730 1730
 	}
1731 1731
 }
1732 1732
 
@@ -1740,8 +1740,8 @@  discard block
 block discarded – undo
1740 1740
  *
1741 1741
  * @return string
1742 1742
  */
1743
-function give_time_do_tags( $string, $timestamp = 0 ) {
1744
-	$current_time = ! empty( $timestamp ) ? $timestamp : current_time( 'timestamp' );
1743
+function give_time_do_tags($string, $timestamp = 0) {
1744
+	$current_time = ! empty($timestamp) ? $timestamp : current_time('timestamp');
1745 1745
 
1746 1746
 	$formatted_string = str_replace(
1747 1747
 		array(
@@ -1756,15 +1756,15 @@  discard block
 block discarded – undo
1756 1756
 			'{N}',
1757 1757
 			'{S}',
1758 1758
 		), array(
1759
-			date( 'j', $current_time ),
1760
-			date( 'd', $current_time ),
1761
-			date( 'n', $current_time ),
1762
-			date( 'm', $current_time ),
1763
-			date( 'Y', $current_time ),
1764
-			date( 'Y', $current_time ),
1765
-			date( 'G', $current_time ),
1766
-			date( 'H', $current_time ),
1767
-			date( 's', $current_time ),
1759
+			date('j', $current_time),
1760
+			date('d', $current_time),
1761
+			date('n', $current_time),
1762
+			date('m', $current_time),
1763
+			date('Y', $current_time),
1764
+			date('Y', $current_time),
1765
+			date('G', $current_time),
1766
+			date('H', $current_time),
1767
+			date('s', $current_time),
1768 1768
 		), $string
1769 1769
 	);
1770 1770
 
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 	 *
1774 1774
 	 * @since 2.1.0
1775 1775
 	 */
1776
-	return apply_filters( 'give_time_do_tags', $formatted_string, $string, $timestamp );
1776
+	return apply_filters('give_time_do_tags', $formatted_string, $string, $timestamp);
1777 1777
 }
1778 1778
 
1779 1779
 
@@ -1786,24 +1786,24 @@  discard block
 block discarded – undo
1786 1786
  *
1787 1787
  * @return bool
1788 1788
  */
1789
-function give_is_company_field_enabled( $form_id ) {
1790
-	$form_setting_val   = give_get_meta( $form_id, '_give_company_field', true );
1791
-	$global_setting_val = give_get_option( 'company_field' );
1789
+function give_is_company_field_enabled($form_id) {
1790
+	$form_setting_val   = give_get_meta($form_id, '_give_company_field', true);
1791
+	$global_setting_val = give_get_option('company_field');
1792 1792
 
1793
-	if ( ! empty( $form_setting_val ) ) {
1794
-		if ( give_is_setting_enabled( $form_setting_val, array( 'required', 'optional' ) ) ) {
1793
+	if ( ! empty($form_setting_val)) {
1794
+		if (give_is_setting_enabled($form_setting_val, array('required', 'optional'))) {
1795 1795
 			return true;
1796
-		} elseif ( 'global' === $form_setting_val && give_is_setting_enabled(
1796
+		} elseif ('global' === $form_setting_val && give_is_setting_enabled(
1797 1797
 			$global_setting_val, array(
1798 1798
 				'required',
1799 1799
 				'optional',
1800 1800
 			)
1801
-		) ) {
1801
+		)) {
1802 1802
 			return true;
1803 1803
 		} else {
1804 1804
 			return false;
1805 1805
 		}
1806
-	} elseif ( give_is_setting_enabled( $global_setting_val, array( 'required', 'optional' ) ) ) {
1806
+	} elseif (give_is_setting_enabled($global_setting_val, array('required', 'optional'))) {
1807 1807
 		return true;
1808 1808
 
1809 1809
 	} else {
@@ -1820,19 +1820,19 @@  discard block
 block discarded – undo
1820 1820
  *
1821 1821
  * @return bool
1822 1822
  */
1823
-function give_is_anonymous_donation_field_enabled( $form_id ) {
1824
-	$form_setting_val   = give_get_meta( $form_id, '_give_anonymous_donation', true, 'global' );
1825
-	$global_setting_val = give_get_option( 'anonymous_donation', 'disabled' );
1823
+function give_is_anonymous_donation_field_enabled($form_id) {
1824
+	$form_setting_val   = give_get_meta($form_id, '_give_anonymous_donation', true, 'global');
1825
+	$global_setting_val = give_get_option('anonymous_donation', 'disabled');
1826 1826
 
1827
-	if ( ! empty( $form_setting_val ) ) {
1828
-		if ( give_is_setting_enabled( $form_setting_val ) ) {
1827
+	if ( ! empty($form_setting_val)) {
1828
+		if (give_is_setting_enabled($form_setting_val)) {
1829 1829
 			return true;
1830
-		} elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val ) ) {
1830
+		} elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val)) {
1831 1831
 			return true;
1832 1832
 		} else {
1833 1833
 			return false;
1834 1834
 		}
1835
-	} elseif ( give_is_setting_enabled( $global_setting_val ) ) {
1835
+	} elseif (give_is_setting_enabled($global_setting_val)) {
1836 1836
 		return true;
1837 1837
 	}
1838 1838
 
@@ -1848,19 +1848,19 @@  discard block
 block discarded – undo
1848 1848
  *
1849 1849
  * @return bool
1850 1850
  */
1851
-function give_is_donor_comment_field_enabled( $form_id ) {
1852
-	$form_setting_val   = give_get_meta( $form_id, '_give_donor_comment', true, 'global' );
1853
-	$global_setting_val = give_get_option( 'donor_comment', 'disabled' );
1851
+function give_is_donor_comment_field_enabled($form_id) {
1852
+	$form_setting_val   = give_get_meta($form_id, '_give_donor_comment', true, 'global');
1853
+	$global_setting_val = give_get_option('donor_comment', 'disabled');
1854 1854
 
1855
-	if ( ! empty( $form_setting_val ) ) {
1856
-		if ( give_is_setting_enabled( $form_setting_val ) ) {
1855
+	if ( ! empty($form_setting_val)) {
1856
+		if (give_is_setting_enabled($form_setting_val)) {
1857 1857
 			return true;
1858
-		} elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val ) ) {
1858
+		} elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val)) {
1859 1859
 			return true;
1860 1860
 		} else {
1861 1861
 			return false;
1862 1862
 		}
1863
-	} elseif ( give_is_setting_enabled( $global_setting_val ) ) {
1863
+	} elseif (give_is_setting_enabled($global_setting_val)) {
1864 1864
 		return true;
1865 1865
 	}
1866 1866
 
@@ -1878,12 +1878,12 @@  discard block
 block discarded – undo
1878 1878
  *
1879 1879
  * @return array
1880 1880
  */
1881
-function __give_get_active_license_info( $license_id ) {
1881
+function __give_get_active_license_info($license_id) {
1882 1882
 	global $wpdb;
1883 1883
 	$option_name = "{$license_id}_license_active";
1884 1884
 	$data        = array();
1885 1885
 
1886
-	if ( ! isset( $GLOBALS['give_active_licenses_info'] ) ) {
1886
+	if ( ! isset($GLOBALS['give_active_licenses_info'])) {
1887 1887
 		$GLOBALS['give_active_licenses_info'] = array();
1888 1888
 
1889 1889
 		$licenses_info = $wpdb->get_results(
@@ -1896,16 +1896,16 @@  discard block
 block discarded – undo
1896 1896
 			ARRAY_A
1897 1897
 		);
1898 1898
 
1899
-		if ( ! empty( $licenses_info ) ) {
1899
+		if ( ! empty($licenses_info)) {
1900 1900
 			$GLOBALS['give_active_licenses_info'] = array_combine(
1901
-				wp_list_pluck( $licenses_info, 'option_name' ),
1902
-				wp_list_pluck( $licenses_info, 'option_value' )
1901
+				wp_list_pluck($licenses_info, 'option_name'),
1902
+				wp_list_pluck($licenses_info, 'option_value')
1903 1903
 			);
1904 1904
 		}
1905 1905
 	}
1906 1906
 
1907
-	if ( in_array( $option_name, array_keys( $GLOBALS['give_active_licenses_info'] ) ) ) {
1908
-		$data = maybe_unserialize( $GLOBALS['give_active_licenses_info'][ $option_name ] );
1907
+	if (in_array($option_name, array_keys($GLOBALS['give_active_licenses_info']))) {
1908
+		$data = maybe_unserialize($GLOBALS['give_active_licenses_info'][$option_name]);
1909 1909
 	}
1910 1910
 
1911 1911
 	return $data;
@@ -1921,18 +1921,18 @@  discard block
 block discarded – undo
1921 1921
  *
1922 1922
  * @return array
1923 1923
  */
1924
-function __give_get_active_by_user_meta( $banner_addon_name ) {
1924
+function __give_get_active_by_user_meta($banner_addon_name) {
1925 1925
 	global $wpdb;
1926 1926
 
1927 1927
 	// Get the option key.
1928
-	$option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key( $banner_addon_name );
1928
+	$option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key($banner_addon_name);
1929 1929
 	$data        = array();
1930 1930
 
1931 1931
 	if (
1932
-		! isset( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] )
1933
-		|| empty( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] )
1932
+		! isset($GLOBALS['give_addon_activated_by_user'][$banner_addon_name])
1933
+		|| empty($GLOBALS['give_addon_activated_by_user'][$banner_addon_name])
1934 1934
 	) {
1935
-		$GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] = array();
1935
+		$GLOBALS['give_addon_activated_by_user'][$banner_addon_name] = array();
1936 1936
 
1937 1937
 		// Get the meta of activation banner by user.
1938 1938
 		$activation_banners = $wpdb->get_results(
@@ -1945,16 +1945,16 @@  discard block
 block discarded – undo
1945 1945
 			ARRAY_A
1946 1946
 		);
1947 1947
 
1948
-		if ( ! empty( $activation_banners ) ) {
1948
+		if ( ! empty($activation_banners)) {
1949 1949
 			$GLOBALS['give_addon_activated_by_user'] = array_combine(
1950
-				wp_list_pluck( $activation_banners, 'option_name' ),
1951
-				wp_list_pluck( $activation_banners, 'option_value' )
1950
+				wp_list_pluck($activation_banners, 'option_name'),
1951
+				wp_list_pluck($activation_banners, 'option_value')
1952 1952
 			);
1953 1953
 		}
1954 1954
 	}
1955 1955
 
1956
-	if ( in_array( $option_name, array_keys( $GLOBALS['give_addon_activated_by_user'] ) ) ) {
1957
-		$data = maybe_unserialize( $GLOBALS['give_addon_activated_by_user'][ $option_name ] );
1956
+	if (in_array($option_name, array_keys($GLOBALS['give_addon_activated_by_user']))) {
1957
+		$data = maybe_unserialize($GLOBALS['give_addon_activated_by_user'][$option_name]);
1958 1958
 	}
1959 1959
 
1960 1960
 	return $data;
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
 	 *
1974 1974
 	 * @see wp-inlucdes/pluggable.php:wp_nonce_tick
1975 1975
 	 */
1976
-	return (int) apply_filters( 'nonce_life', DAY_IN_SECONDS );
1976
+	return (int) apply_filters('nonce_life', DAY_IN_SECONDS);
1977 1977
 }
1978 1978
 
1979 1979
 /**
@@ -1987,11 +1987,11 @@  discard block
 block discarded – undo
1987 1987
  *
1988 1988
  * @return string
1989 1989
  */
1990
-function give_get_nonce_field( $action, $name, $referer = false ) {
1990
+function give_get_nonce_field($action, $name, $referer = false) {
1991 1991
 	return str_replace(
1992 1992
 		"id=\"{$name}\"",
1993 1993
 		'',
1994
-		wp_nonce_field( $action, $name, $referer, false )
1994
+		wp_nonce_field($action, $name, $referer, false)
1995 1995
 	);
1996 1996
 }
1997 1997
 
@@ -2004,31 +2004,31 @@  discard block
 block discarded – undo
2004 2004
  *
2005 2005
  * @return array
2006 2006
  */
2007
-function give_goal_progress_stats( $form ) {
2007
+function give_goal_progress_stats($form) {
2008 2008
 
2009
-	if ( ! $form instanceof Give_Donate_Form ) {
2010
-		$form = new Give_Donate_Form( $form );
2009
+	if ( ! $form instanceof Give_Donate_Form) {
2010
+		$form = new Give_Donate_Form($form);
2011 2011
 	}
2012 2012
 
2013 2013
 	$donors = '';
2014 2014
 
2015
-	$goal_format = give_get_form_goal_format( $form->ID );
2015
+	$goal_format = give_get_form_goal_format($form->ID);
2016 2016
 
2017 2017
 	/**
2018 2018
 	 * Filter the form.
2019 2019
 	 *
2020 2020
 	 * @since 1.8.8
2021 2021
 	 */
2022
-	$total_goal = apply_filters( 'give_goal_amount_target_output', round( give_maybe_sanitize_amount( $form->goal ) ), $form->ID, $form );
2022
+	$total_goal = apply_filters('give_goal_amount_target_output', round(give_maybe_sanitize_amount($form->goal)), $form->ID, $form);
2023 2023
 
2024
-	switch ( $goal_format ) {
2024
+	switch ($goal_format) {
2025 2025
 		case 'donation':
2026 2026
 			/**
2027 2027
 			 * Filter the form donations.
2028 2028
 			 *
2029 2029
 			 * @since 2.1
2030 2030
 			 */
2031
-			$actual = $donations = apply_filters( 'give_goal_donations_raised_output', $form->sales, $form->ID, $form );
2031
+			$actual = $donations = apply_filters('give_goal_donations_raised_output', $form->sales, $form->ID, $form);
2032 2032
 			break;
2033 2033
 		case 'donors':
2034 2034
 			/**
@@ -2042,7 +2042,7 @@  discard block
 block discarded – undo
2042 2042
 			 *
2043 2043
 			 * @return int $donors Total number of donors that donated to the form.
2044 2044
 			 */
2045
-			$actual = $donors = apply_filters( 'give_goal_donors_target_output', give_get_form_donor_count( $form->ID ), $form->ID, $form );
2045
+			$actual = $donors = apply_filters('give_goal_donors_target_output', give_get_form_donor_count($form->ID), $form->ID, $form);
2046 2046
 			break;
2047 2047
 		default:
2048 2048
 			/**
@@ -2050,11 +2050,11 @@  discard block
 block discarded – undo
2050 2050
 			 *
2051 2051
 			 * @since 1.8.8
2052 2052
 			 */
2053
-			$actual = $income = apply_filters( 'give_goal_amount_raised_output', $form->earnings, $form->ID, $form );
2053
+			$actual = $income = apply_filters('give_goal_amount_raised_output', $form->earnings, $form->ID, $form);
2054 2054
 			break;
2055 2055
 	}
2056 2056
 
2057
-	$progress = $total_goal ? round( ( $actual / $total_goal ) * 100, 2 ) : 0;
2057
+	$progress = $total_goal ? round(($actual / $total_goal) * 100, 2) : 0;
2058 2058
 
2059 2059
 	$stats_array = array(
2060 2060
 		'raw_actual' => $actual,
@@ -2066,20 +2066,20 @@  discard block
 block discarded – undo
2066 2066
 	 *
2067 2067
 	 * @since 1.8.8
2068 2068
 	 */
2069
-	$progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form->ID, $form );
2069
+	$progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form->ID, $form);
2070 2070
 
2071 2071
 	// Define Actual Goal based on the goal format.
2072
-	if ( 'percentage' === $goal_format ) {
2072
+	if ('percentage' === $goal_format) {
2073 2073
 		$actual = "{$actual}%";
2074
-	} elseif ( 'amount' === $goal_format ) {
2075
-		$actual = give_currency_filter( give_format_amount( $actual ) );
2074
+	} elseif ('amount' === $goal_format) {
2075
+		$actual = give_currency_filter(give_format_amount($actual));
2076 2076
 	}
2077 2077
 
2078 2078
 	// Define Total Goal based on the goal format.
2079
-	if ( 'percentage' === $goal_format ) {
2079
+	if ('percentage' === $goal_format) {
2080 2080
 		$total_goal = '';
2081
-	} elseif ( 'amount' === $goal_format ) {
2082
-		$total_goal = give_currency_filter( give_format_amount( $total_goal ) );
2081
+	} elseif ('amount' === $goal_format) {
2082
+		$total_goal = give_currency_filter(give_format_amount($total_goal));
2083 2083
 	}
2084 2084
 
2085 2085
 	$stats_array = array_merge(
@@ -2097,7 +2097,7 @@  discard block
 block discarded – undo
2097 2097
 	 *
2098 2098
 	 * @since 2.1
2099 2099
 	 */
2100
-	return apply_filters( 'give_goal_progress_stats', $stats_array );
2100
+	return apply_filters('give_goal_progress_stats', $stats_array);
2101 2101
 }
2102 2102
 
2103 2103
 /**
@@ -2109,20 +2109,20 @@  discard block
 block discarded – undo
2109 2109
  *
2110 2110
  * @return mixed
2111 2111
  */
2112
-function give_get_name_title_prefixes( $form_id = 0 ) {
2112
+function give_get_name_title_prefixes($form_id = 0) {
2113 2113
 
2114
-	$name_title_prefix = give_is_name_title_prefix_enabled( $form_id );
2115
-	$title_prefixes    = give_get_option( 'title_prefixes' );
2114
+	$name_title_prefix = give_is_name_title_prefix_enabled($form_id);
2115
+	$title_prefixes    = give_get_option('title_prefixes');
2116 2116
 
2117 2117
 	// If form id exists, then fetch form specific title prefixes.
2118
-	if ( intval( $form_id ) > 0 && $name_title_prefix ) {
2118
+	if (intval($form_id) > 0 && $name_title_prefix) {
2119 2119
 
2120
-		$form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true );
2121
-		if ( 'global' !== $form_title_prefix ) {
2122
-			$form_title_prefixes = give_get_meta( $form_id, '_give_title_prefixes', true );
2120
+		$form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true);
2121
+		if ('global' !== $form_title_prefix) {
2122
+			$form_title_prefixes = give_get_meta($form_id, '_give_title_prefixes', true);
2123 2123
 
2124 2124
 			// Check whether the form based title prefixes exists or not.
2125
-			if ( is_array( $form_title_prefixes ) && count( $form_title_prefixes ) > 0 ) {
2125
+			if (is_array($form_title_prefixes) && count($form_title_prefixes) > 0) {
2126 2126
 				$title_prefixes = $form_title_prefixes;
2127 2127
 			}
2128 2128
 		}
@@ -2141,22 +2141,22 @@  discard block
 block discarded – undo
2141 2141
  *
2142 2142
  * @return bool
2143 2143
  */
2144
-function give_is_name_title_prefix_enabled( $form_id = 0, $status = '' ) {
2145
-	if ( empty( $status ) ) {
2146
-		$status = array( 'required', 'optional' );
2144
+function give_is_name_title_prefix_enabled($form_id = 0, $status = '') {
2145
+	if (empty($status)) {
2146
+		$status = array('required', 'optional');
2147 2147
 	} else {
2148
-		$status = array( $status );
2148
+		$status = array($status);
2149 2149
 	}
2150 2150
 
2151
-	$title_prefix_status = give_is_setting_enabled( give_get_option( 'name_title_prefix' ), $status );
2151
+	$title_prefix_status = give_is_setting_enabled(give_get_option('name_title_prefix'), $status);
2152 2152
 
2153
-	if ( intval( $form_id ) > 0 ) {
2154
-		$form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true );
2153
+	if (intval($form_id) > 0) {
2154
+		$form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true);
2155 2155
 
2156
-		if ( 'disabled' === $form_title_prefix ) {
2156
+		if ('disabled' === $form_title_prefix) {
2157 2157
 			$title_prefix_status = false;
2158
-		} elseif ( in_array( $form_title_prefix, $status, true ) ) {
2159
-			$title_prefix_status = give_is_setting_enabled( $form_title_prefix, $status );
2158
+		} elseif (in_array($form_title_prefix, $status, true)) {
2159
+			$title_prefix_status = give_is_setting_enabled($form_title_prefix, $status);
2160 2160
 		}
2161 2161
 	}
2162 2162
 
@@ -2173,18 +2173,18 @@  discard block
 block discarded – undo
2173 2173
  *
2174 2174
  * @return object
2175 2175
  */
2176
-function give_get_name_with_title_prefixes( $donor ) {
2176
+function give_get_name_with_title_prefixes($donor) {
2177 2177
 
2178 2178
 	// Prepare Give_Donor object, if $donor is numeric.
2179
-	if ( is_numeric( $donor ) ) {
2180
-		$donor = new Give_Donor( $donor );
2179
+	if (is_numeric($donor)) {
2180
+		$donor = new Give_Donor($donor);
2181 2181
 	}
2182 2182
 
2183
-	$title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true );
2183
+	$title_prefix = Give()->donor_meta->get_meta($donor->id, '_give_donor_title_prefix', true);
2184 2184
 
2185 2185
 	// Update Donor name, if non empty title prefix.
2186
-	if ( ! empty( $title_prefix ) ) {
2187
-		$donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name );
2186
+	if ( ! empty($title_prefix)) {
2187
+		$donor->name = give_get_donor_name_with_title_prefixes($title_prefix, $donor->name);
2188 2188
 	}
2189 2189
 
2190 2190
 	return $donor;
@@ -2200,15 +2200,15 @@  discard block
 block discarded – undo
2200 2200
  *
2201 2201
  * @return string
2202 2202
  */
2203
-function give_get_donor_name_with_title_prefixes( $title_prefix, $name ) {
2203
+function give_get_donor_name_with_title_prefixes($title_prefix, $name) {
2204 2204
 
2205 2205
 	$donor_name = $name;
2206 2206
 
2207
-	if ( ! empty( $title_prefix ) && ! empty( $name ) ) {
2207
+	if ( ! empty($title_prefix) && ! empty($name)) {
2208 2208
 		$donor_name = "{$title_prefix} {$name}";
2209 2209
 	}
2210 2210
 
2211
-	return trim( $donor_name );
2211
+	return trim($donor_name);
2212 2212
 }
2213 2213
 
2214 2214
 /**
@@ -2228,9 +2228,9 @@  discard block
 block discarded – undo
2228 2228
 	return apply_filters(
2229 2229
 		'give_get_default_title_prefixes',
2230 2230
 		array(
2231
-			'Mr.'  => __( 'Mr.', 'give' ),
2232
-			'Mrs.' => __( 'Mrs.', 'give' ),
2233
-			'Ms.'  => __( 'Ms.', 'give' ),
2231
+			'Mr.'  => __('Mr.', 'give'),
2232
+			'Mrs.' => __('Mrs.', 'give'),
2233
+			'Ms.'  => __('Ms.', 'give'),
2234 2234
 		)
2235 2235
 	);
2236 2236
 }
@@ -2244,27 +2244,27 @@  discard block
 block discarded – undo
2244 2244
  *
2245 2245
  * @return bool
2246 2246
  */
2247
-function give_is_name_title_prefix_required( $form_id = 0 ) {
2247
+function give_is_name_title_prefix_required($form_id = 0) {
2248 2248
 
2249 2249
 	// Bail out, if name title prefix is not enabled.
2250
-	if ( ! give_is_name_title_prefix_enabled( $form_id ) ) {
2250
+	if ( ! give_is_name_title_prefix_enabled($form_id)) {
2251 2251
 		return false;
2252 2252
 	}
2253 2253
 
2254
-	$status      = array( 'optional' );
2255
-	$is_optional = give_is_setting_enabled( give_get_option( 'name_title_prefix' ), $status );
2254
+	$status      = array('optional');
2255
+	$is_optional = give_is_setting_enabled(give_get_option('name_title_prefix'), $status);
2256 2256
 
2257
-	if ( intval( $form_id ) > 0 ) {
2258
-		$form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true );
2257
+	if (intval($form_id) > 0) {
2258
+		$form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true);
2259 2259
 
2260
-		if ( 'required' === $form_title_prefix ) {
2260
+		if ('required' === $form_title_prefix) {
2261 2261
 			$is_optional = false;
2262
-		} elseif ( 'optional' === $form_title_prefix ) {
2262
+		} elseif ('optional' === $form_title_prefix) {
2263 2263
 			$is_optional = true;
2264 2264
 		}
2265 2265
 	}
2266 2266
 
2267
-	return ( ! $is_optional );
2267
+	return ( ! $is_optional);
2268 2268
 }
2269 2269
 
2270 2270
 /**
@@ -2275,11 +2275,11 @@  discard block
 block discarded – undo
2275 2275
  * @return array $message admin message key.
2276 2276
  */
2277 2277
 function give_get_admin_messages_key() {
2278
-	$messages = empty( $_GET['give-messages'] ) ? array() : give_clean( $_GET['give-messages'] );
2278
+	$messages = empty($_GET['give-messages']) ? array() : give_clean($_GET['give-messages']);
2279 2279
 
2280 2280
 	// backward compatibility.
2281
-	if ( ! empty( $_GET['give-message'] ) ) {
2282
-		$messages[] = give_clean( $_GET['give-message'] );
2281
+	if ( ! empty($_GET['give-message'])) {
2282
+		$messages[] = give_clean($_GET['give-message']);
2283 2283
 	}
2284 2284
 
2285 2285
 	/**
@@ -2291,7 +2291,7 @@  discard block
 block discarded – undo
2291 2291
 	 *
2292 2292
 	 * @return array $message admin message key.
2293 2293
 	 */
2294
-	return (array) apply_filters( 'give_get_admin_messages_key', $messages );
2294
+	return (array) apply_filters('give_get_admin_messages_key', $messages);
2295 2295
 }
2296 2296
 
2297 2297
 /**
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 function give_get_user_agent() {
2305 2305
 
2306 2306
 	// Get User Agent.
2307
-	$user_agent = ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? give_clean( $_SERVER['HTTP_USER_AGENT'] ) : ''; // WPCS: input var ok.
2307
+	$user_agent = ! empty($_SERVER['HTTP_USER_AGENT']) ? give_clean($_SERVER['HTTP_USER_AGENT']) : ''; // WPCS: input var ok.
2308 2308
 
2309 2309
 	return $user_agent;
2310 2310
 }
@@ -2319,11 +2319,11 @@  discard block
 block discarded – undo
2319 2319
  * @param  integer $expire Expiry of the cookie.
2320 2320
  * @param  bool    $secure Whether the cookie should be served only over https.
2321 2321
  */
2322
-function give_setcookie( $name, $value, $expire = 0, $secure = false ) {
2323
-	if ( ! headers_sent() ) {
2322
+function give_setcookie($name, $value, $expire = 0, $secure = false) {
2323
+	if ( ! headers_sent()) {
2324 2324
 		setcookie(
2325 2325
 			$name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure,
2326
-			apply_filters( 'give_cookie_httponly', false, $name, $value, $expire, $secure )
2326
+			apply_filters('give_cookie_httponly', false, $name, $value, $expire, $secure)
2327 2327
 		);
2328 2328
 	}
2329 2329
 }
@@ -2337,7 +2337,7 @@  discard block
 block discarded – undo
2337 2337
  *
2338 2338
  * @return string Formatted address.
2339 2339
  */
2340
-function give_get_formatted_address( $address = array() ) {
2340
+function give_get_formatted_address($address = array()) {
2341 2341
 	$formatted_address = '';
2342 2342
 
2343 2343
 	/**
@@ -2345,21 +2345,21 @@  discard block
 block discarded – undo
2345 2345
 	 *
2346 2346
 	 * @since 2.2.0
2347 2347
 	 */
2348
-	$address_format = apply_filters( 'give_address_format_template', "{street_address}\n{city}, {state} {postal_code}\n{country}" );
2349
-	preg_match_all( '/{([A-z0-9\-\_\ ]+)}/s', $address_format, $matches );
2348
+	$address_format = apply_filters('give_address_format_template', "{street_address}\n{city}, {state} {postal_code}\n{country}");
2349
+	preg_match_all('/{([A-z0-9\-\_\ ]+)}/s', $address_format, $matches);
2350 2350
 
2351
-	if ( ! empty( $matches ) && ! empty( $address ) ) {
2351
+	if ( ! empty($matches) && ! empty($address)) {
2352 2352
 		$address_values = array();
2353 2353
 
2354
-		foreach ( $matches[1] as $address_tag ) {
2355
-			$address_values[ $address_tag ] = '';
2354
+		foreach ($matches[1] as $address_tag) {
2355
+			$address_values[$address_tag] = '';
2356 2356
 
2357
-			if ( isset( $address[ $address_tag ] ) ) {
2358
-				$address_values[ $address_tag ] = $address[ $address_tag ];
2357
+			if (isset($address[$address_tag])) {
2358
+				$address_values[$address_tag] = $address[$address_tag];
2359 2359
 			}
2360 2360
 		}
2361 2361
 
2362
-		$formatted_address = str_ireplace( $matches[0], $address_values, $address_format );
2362
+		$formatted_address = str_ireplace($matches[0], $address_values, $address_format);
2363 2363
 	}
2364 2364
 
2365 2365
 	/**
@@ -2370,7 +2370,7 @@  discard block
 block discarded – undo
2370 2370
 	 * @param string $formatted_address Formatted address.
2371 2371
 	 * @param string $address_format    Format of the address.
2372 2372
 	 */
2373
-	$formatted_address = apply_filters( 'give_get_formatted_address', $formatted_address, $address_format, $address );
2373
+	$formatted_address = apply_filters('give_get_formatted_address', $formatted_address, $address_format, $address);
2374 2374
 
2375 2375
 	return $formatted_address;
2376 2376
 }
@@ -2384,10 +2384,10 @@  discard block
 block discarded – undo
2384 2384
  *
2385 2385
  * @return string The JS date format.
2386 2386
  */
2387
-function give_convert_php_date_format_to_js( $php_format ) {
2387
+function give_convert_php_date_format_to_js($php_format) {
2388 2388
 	$js_format = $php_format;
2389 2389
 
2390
-	switch ( $php_format ) {
2390
+	switch ($php_format) {
2391 2391
 		case 'F j, Y':
2392 2392
 			$js_format = 'MM dd, yy';
2393 2393
 			break;
@@ -2410,7 +2410,7 @@  discard block
 block discarded – undo
2410 2410
 	 * @param string $js_format  The JS date format.
2411 2411
 	 * @param string $php_format The PHP date format.
2412 2412
 	 */
2413
-	$js_format = apply_filters( 'give_js_date_format', $js_format, $php_format );
2413
+	$js_format = apply_filters('give_js_date_format', $js_format, $php_format);
2414 2414
 
2415 2415
 	return $js_format;
2416 2416
 }
@@ -2424,7 +2424,7 @@  discard block
 block discarded – undo
2424 2424
  */
2425 2425
 function give_get_localized_date_format_to_js() {
2426 2426
 
2427
-	return give_convert_php_date_format_to_js( get_option( 'date_format' ) );
2427
+	return give_convert_php_date_format_to_js(get_option('date_format'));
2428 2428
 }
2429 2429
 
2430 2430
 /**
@@ -2437,21 +2437,21 @@  discard block
 block discarded – undo
2437 2437
  *
2438 2438
  * @return string
2439 2439
  */
2440
-function give_get_safe_asset_url( $url ) {
2440
+function give_get_safe_asset_url($url) {
2441 2441
 
2442 2442
 	// Bailout, if empty URL passed.
2443
-	if ( empty( $url ) ) {
2443
+	if (empty($url)) {
2444 2444
 		return $url;
2445 2445
 	}
2446 2446
 
2447
-	$schema        = parse_url( $url, PHP_URL_SCHEME );
2448
-	$schema_length = strlen( $schema ) + 1;
2449
-	$url           = substr( $url, $schema_length );
2447
+	$schema        = parse_url($url, PHP_URL_SCHEME);
2448
+	$schema_length = strlen($schema) + 1;
2449
+	$url           = substr($url, $schema_length);
2450 2450
 
2451 2451
 	/**
2452 2452
 	 * Fire the filter
2453 2453
 	 *
2454 2454
 	 * @since 2.2.0
2455 2455
 	 */
2456
-	return apply_filters( 'give_get_safe_asset_url', $url );
2456
+	return apply_filters('give_get_safe_asset_url', $url);
2457 2457
 }
Please login to merge, or discard this patch.
includes/payments/class-give-payment.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 *
406 406
 	 * @param  int|bool $payment_id A given payment.
407 407
 	 *
408
-	 * @return mixed void|false
408
+	 * @return false|null void|false
409 409
 	 */
410 410
 	public function __construct( $payment_id = false ) {
411 411
 
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 	 *
1175 1175
 	 * @param  string|bool $note The note to add.
1176 1176
 	 *
1177
-	 * @return bool           If the note was specified or not
1177
+	 * @return false|null           If the note was specified or not
1178 1178
 	 */
1179 1179
 	public function add_note( $note = false ) {
1180 1180
 		// Bail if no note specified.
Please login to merge, or discard this patch.
Spacing   +280 added lines, -281 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
 
@@ -407,13 +407,13 @@  discard block
 block discarded – undo
407 407
 	 *
408 408
 	 * @return mixed void|false
409 409
 	 */
410
-	public function __construct( $payment_id = false ) {
410
+	public function __construct($payment_id = false) {
411 411
 
412
-		if ( empty( $payment_id ) ) {
412
+		if (empty($payment_id)) {
413 413
 			return false;
414 414
 		}
415 415
 
416
-		$this->setup_payment( $payment_id );
416
+		$this->setup_payment($payment_id);
417 417
 	}
418 418
 
419 419
 	/**
@@ -426,11 +426,11 @@  discard block
 block discarded – undo
426 426
 	 *
427 427
 	 * @return mixed        The value.
428 428
 	 */
429
-	public function __get( $key ) {
429
+	public function __get($key) {
430 430
 
431
-		if ( method_exists( $this, 'get_' . $key ) ) {
431
+		if (method_exists($this, 'get_'.$key)) {
432 432
 
433
-			$value = call_user_func( array( $this, 'get_' . $key ) );
433
+			$value = call_user_func(array($this, 'get_'.$key));
434 434
 
435 435
 		} else {
436 436
 
@@ -452,18 +452,18 @@  discard block
 block discarded – undo
452 452
 	 * @param  string $key   The property name.
453 453
 	 * @param  mixed  $value The value of the property.
454 454
 	 */
455
-	public function __set( $key, $value ) {
456
-		$ignore = array( '_ID' );
455
+	public function __set($key, $value) {
456
+		$ignore = array('_ID');
457 457
 
458
-		if ( 'status' === $key ) {
458
+		if ('status' === $key) {
459 459
 			$this->old_status = $this->status;
460 460
 		}
461 461
 
462
-		if ( ! in_array( $key, $ignore ) ) {
463
-			$this->pending[ $key ] = $value;
462
+		if ( ! in_array($key, $ignore)) {
463
+			$this->pending[$key] = $value;
464 464
 		}
465 465
 
466
-		if ( '_ID' !== $key ) {
466
+		if ('_ID' !== $key) {
467 467
 			$this->$key = $value;
468 468
 		}
469 469
 	}
@@ -478,9 +478,9 @@  discard block
 block discarded – undo
478 478
 	 *
479 479
 	 * @return boolean|null       If the item is set or not
480 480
 	 */
481
-	public function __isset( $name ) {
482
-		if ( property_exists( $this, $name ) ) {
483
-			return false === empty( $this->$name );
481
+	public function __isset($name) {
482
+		if (property_exists($this, $name)) {
483
+			return false === empty($this->$name);
484 484
 		} else {
485 485
 			return null;
486 486
 		}
@@ -496,20 +496,20 @@  discard block
 block discarded – undo
496 496
 	 *
497 497
 	 * @return bool            If the setup was successful or not
498 498
 	 */
499
-	private function setup_payment( $payment_id ) {
499
+	private function setup_payment($payment_id) {
500 500
 		$this->pending = array();
501 501
 
502
-		if ( empty( $payment_id ) ) {
502
+		if (empty($payment_id)) {
503 503
 			return false;
504 504
 		}
505 505
 
506
-		$payment = get_post( absint( $payment_id ) );
506
+		$payment = get_post(absint($payment_id));
507 507
 
508
-		if ( ! $payment || is_wp_error( $payment ) ) {
508
+		if ( ! $payment || is_wp_error($payment)) {
509 509
 			return false;
510 510
 		}
511 511
 
512
-		if ( 'give_payment' !== $payment->post_type ) {
512
+		if ('give_payment' !== $payment->post_type) {
513 513
 			return false;
514 514
 		}
515 515
 
@@ -523,17 +523,17 @@  discard block
 block discarded – undo
523 523
 		 * @param Give_Payment $this       Payment object.
524 524
 		 * @param int          $payment_id The ID of the payment.
525 525
 		 */
526
-		do_action( 'give_pre_setup_payment', $this, $payment_id );
526
+		do_action('give_pre_setup_payment', $this, $payment_id);
527 527
 
528 528
 		// Get payment from cache.
529
-		$donation_vars = Give_Cache::get_group( $payment_id, 'give-donations' );
529
+		$donation_vars = Give_Cache::get_group($payment_id, 'give-donations');
530 530
 
531
-		if ( is_null( $donation_vars ) ) {
531
+		if (is_null($donation_vars)) {
532 532
 			// Primary Identifier.
533
-			$this->ID = absint( $payment_id );
533
+			$this->ID = absint($payment_id);
534 534
 
535 535
 			// Protected ID that can never be changed.
536
-			$this->_ID = absint( $payment_id );
536
+			$this->_ID = absint($payment_id);
537 537
 
538 538
 			// We have a payment, get the generic payment_meta item to reduce calls to it.
539 539
 			$this->payment_meta = $this->get_meta();
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 			$this->parent_payment = $payment->post_parent;
550 550
 
551 551
 			$all_payment_statuses  = give_get_payment_statuses();
552
-			$this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status );
552
+			$this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status);
553 553
 
554 554
 			// Currency Based.
555 555
 			$this->total    = $this->setup_total();
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 			$this->address      = $this->setup_address();
571 571
 			$this->first_name   = $this->user_info['first_name'];
572 572
 			$this->last_name    = $this->user_info['last_name'];
573
-			$this->title_prefix = isset( $this->user_info['title'] ) ? $this->user_info['title'] : '';
573
+			$this->title_prefix = isset($this->user_info['title']) ? $this->user_info['title'] : '';
574 574
 
575 575
 			// Other Identifiers.
576 576
 			$this->form_title = $this->setup_form_title();
@@ -579,10 +579,10 @@  discard block
 block discarded – undo
579 579
 			$this->key        = $this->setup_payment_key();
580 580
 			$this->number     = $this->setup_payment_number();
581 581
 
582
-			Give_Cache::set_group( $this->ID, get_object_vars( $this ), 'give-donations' );
582
+			Give_Cache::set_group($this->ID, get_object_vars($this), 'give-donations');
583 583
 		} else {
584 584
 
585
-			foreach ( $donation_vars as $donation_var => $value ) {
585
+			foreach ($donation_vars as $donation_var => $value) {
586 586
 				$this->$donation_var = $value;
587 587
 			}
588 588
 		} // End if().
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		 * @param Give_Payment $this       Payment object.
598 598
 		 * @param int          $payment_id The ID of the payment.
599 599
 		 */
600
-		do_action( 'give_setup_payment', $this, $payment_id );
600
+		do_action('give_setup_payment', $this, $payment_id);
601 601
 
602 602
 		return true;
603 603
 	}
@@ -616,11 +616,11 @@  discard block
 block discarded – undo
616 616
 	 *
617 617
 	 * @return void
618 618
 	 */
619
-	public function update_payment_setup( $payment_id ) {
619
+	public function update_payment_setup($payment_id) {
620 620
 		// Delete cache.
621
-		Give_Cache::delete_group( $this->ID,'give-donations' );
621
+		Give_Cache::delete_group($this->ID, 'give-donations');
622 622
 
623
-		$this->setup_payment( $payment_id );
623
+		$this->setup_payment($payment_id);
624 624
 	}
625 625
 
626 626
 	/**
@@ -635,24 +635,24 @@  discard block
 block discarded – undo
635 635
 
636 636
 		// Construct the payment title.
637 637
 		$payment_title = '';
638
-		if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) {
639
-			$payment_title = $this->first_name . ' ' . $this->last_name;
640
-		} elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) {
638
+		if ( ! empty($this->first_name) && ! empty($this->last_name)) {
639
+			$payment_title = $this->first_name.' '.$this->last_name;
640
+		} elseif ( ! empty($this->first_name) && empty($this->last_name)) {
641 641
 			$payment_title = $this->first_name;
642
-		} elseif ( ! empty( $this->email ) && is_email( $this->email ) ) {
642
+		} elseif ( ! empty($this->email) && is_email($this->email)) {
643 643
 			$payment_title = $this->email;
644 644
 		}
645 645
 
646 646
 		// Set Key.
647
-		if ( empty( $this->key ) ) {
647
+		if (empty($this->key)) {
648 648
 
649
-			$auth_key             = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
650
-			$this->key            = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );  // Unique key.
649
+			$auth_key             = defined('AUTH_KEY') ? AUTH_KEY : '';
650
+			$this->key            = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key.
651 651
 			$this->pending['key'] = $this->key;
652 652
 		}
653 653
 
654 654
 		// Set IP.
655
-		if ( empty( $this->ip ) ) {
655
+		if (empty($this->ip)) {
656 656
 
657 657
 			$this->ip            = give_get_ip();
658 658
 			$this->pending['ip'] = $this->ip;
@@ -682,19 +682,19 @@  discard block
 block discarded – undo
682 682
 			'status'       => $this->status,
683 683
 		);
684 684
 
685
-		$args = apply_filters( 'give_insert_payment_args', array(
685
+		$args = apply_filters('give_insert_payment_args', array(
686 686
 			'post_title'    => $payment_title,
687 687
 			'post_status'   => $this->status,
688 688
 			'post_type'     => 'give_payment',
689
-			'post_date'     => ! empty( $this->date ) ? $this->date : null,
690
-			'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null,
689
+			'post_date'     => ! empty($this->date) ? $this->date : null,
690
+			'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null,
691 691
 			'post_parent'   => $this->parent_payment,
692
-		), $payment_data );
692
+		), $payment_data);
693 693
 
694 694
 		// Create a blank payment.
695
-		$payment_id = wp_insert_post( $args );
695
+		$payment_id = wp_insert_post($args);
696 696
 
697
-		if ( ! empty( $payment_id ) ) {
697
+		if ( ! empty($payment_id)) {
698 698
 
699 699
 			$this->ID  = $payment_id;
700 700
 			$this->_ID = $payment_id;
@@ -706,43 +706,43 @@  discard block
 block discarded – undo
706 706
 			 *
707 707
 			 * @since 1.8.13
708 708
 			 */
709
-			$donor = apply_filters( 'give_update_donor_information', $donor, $payment_id, $payment_data, $args );
709
+			$donor = apply_filters('give_update_donor_information', $donor, $payment_id, $payment_data, $args);
710 710
 
711
-			if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) {
712
-				$donor = new Give_Donor( get_current_user_id(), true );
711
+			if (did_action('give_pre_process_donation') && is_user_logged_in()) {
712
+				$donor = new Give_Donor(get_current_user_id(), true);
713 713
 
714 714
 				// Donor is logged in but used a different email to purchase with so assign to their donor record.
715
-				if ( ! empty( $donor->id ) && $this->email !== $donor->email ) {
716
-					$donor->add_email( $this->email );
715
+				if ( ! empty($donor->id) && $this->email !== $donor->email) {
716
+					$donor->add_email($this->email);
717 717
 				}
718 718
 			}
719 719
 
720
-			if ( empty( $donor->id ) ) {
721
-				$donor = new Give_Donor( $this->email );
720
+			if (empty($donor->id)) {
721
+				$donor = new Give_Donor($this->email);
722 722
 			}
723 723
 
724
-			if ( empty( $donor->id ) ) {
724
+			if (empty($donor->id)) {
725 725
 
726 726
 				$donor_data = array(
727
-					'name'    => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '',
727
+					'name'    => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '',
728 728
 					'email'   => $this->email,
729 729
 					'user_id' => $this->user_id,
730 730
 				);
731 731
 
732
-				$donor->create( $donor_data );
732
+				$donor->create($donor_data);
733 733
 
734 734
 			}
735 735
 
736 736
 			// Update Donor Meta once donor is created.
737
-			$donor->update_meta( '_give_donor_first_name', $this->first_name );
738
-			$donor->update_meta( '_give_donor_last_name', $this->last_name );
739
-			$donor->update_meta( '_give_donor_title_prefix', $this->title_prefix );
737
+			$donor->update_meta('_give_donor_first_name', $this->first_name);
738
+			$donor->update_meta('_give_donor_last_name', $this->last_name);
739
+			$donor->update_meta('_give_donor_title_prefix', $this->title_prefix);
740 740
 
741 741
 			$this->customer_id            = $donor->id;
742 742
 			$this->pending['customer_id'] = $this->customer_id;
743
-			$donor->attach_payment( $this->ID, false );
743
+			$donor->attach_payment($this->ID, false);
744 744
 
745
-			$this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data );
745
+			$this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data);
746 746
 
747 747
 			/*
748 748
 			 * _give_payment_meta backward compatibility.
@@ -750,25 +750,25 @@  discard block
 block discarded – undo
750 750
 			 * @since 2.0.1
751 751
 			 */
752 752
 			$custom_payment_meta = array_diff(
753
-				array_map( 'maybe_serialize', $this->payment_meta ),
754
-				array_map( 'maybe_serialize', $payment_data )
753
+				array_map('maybe_serialize', $this->payment_meta),
754
+				array_map('maybe_serialize', $payment_data)
755 755
 			);
756 756
 
757
-			if ( ! empty( $custom_payment_meta ) ) {
758
-				give_doing_it_wrong( '_give_payment_meta', __( 'This custom meta key deprecated. We are not using this meta key for storing payment meta but your custom meta data will be store because we added backward compatibility. Please change your logic because in future we can remove it.', 'give' ), '2.0.0' );
757
+			if ( ! empty($custom_payment_meta)) {
758
+				give_doing_it_wrong('_give_payment_meta', __('This custom meta key deprecated. We are not using this meta key for storing payment meta but your custom meta data will be store because we added backward compatibility. Please change your logic because in future we can remove it.', 'give'), '2.0.0');
759 759
 
760
-				$this->update_meta( '_give_payment_meta', array_map( 'maybe_unserialize', $custom_payment_meta ) );
760
+				$this->update_meta('_give_payment_meta', array_map('maybe_unserialize', $custom_payment_meta));
761 761
 			}
762 762
 
763
-			$give_company = ( ! empty( $_REQUEST['give_company_name'] ) ? give_clean( $_REQUEST['give_company_name'] ) : '' );
763
+			$give_company = ( ! empty($_REQUEST['give_company_name']) ? give_clean($_REQUEST['give_company_name']) : '');
764 764
 
765 765
 			// Check $page_url is not empty.
766
-			if ( $give_company ) {
767
-				give_update_meta( $payment_id, '_give_donation_company', $give_company );
766
+			if ($give_company) {
767
+				give_update_meta($payment_id, '_give_donation_company', $give_company);
768 768
 
769
-				$donor_id = absint( $donor->id );
770
-				if ( ! empty( $donor_id ) ) {
771
-					Give()->donor_meta->update_meta( $donor_id, '_give_donor_company', $give_company );
769
+				$donor_id = absint($donor->id);
770
+				if ( ! empty($donor_id)) {
771
+					Give()->donor_meta->update_meta($donor_id, '_give_donor_company', $give_company);
772 772
 				}
773 773
 			}
774 774
 
@@ -792,11 +792,11 @@  discard block
 block discarded – undo
792 792
 		$saved = false;
793 793
 
794 794
 		// Must have an ID.
795
-		if ( empty( $this->ID ) ) {
795
+		if (empty($this->ID)) {
796 796
 
797 797
 			$payment_id = $this->insert_payment();
798 798
 
799
-			if ( false === $payment_id ) {
799
+			if (false === $payment_id) {
800 800
 				$saved = false;
801 801
 			} else {
802 802
 				$this->ID = $payment_id;
@@ -804,42 +804,42 @@  discard block
 block discarded – undo
804 804
 		}
805 805
 
806 806
 		// Set ID if not matching.
807
-		if ( $this->ID !== $this->_ID ) {
807
+		if ($this->ID !== $this->_ID) {
808 808
 			$this->ID = $this->_ID;
809 809
 		}
810 810
 
811 811
 		// If we have something pending, let's save it.
812
-		if ( ! empty( $this->pending ) ) {
812
+		if ( ! empty($this->pending)) {
813 813
 
814 814
 			$total_increase = 0;
815 815
 			$total_decrease = 0;
816 816
 
817
-			foreach ( $this->pending as $key => $value ) {
817
+			foreach ($this->pending as $key => $value) {
818 818
 
819
-				switch ( $key ) {
819
+				switch ($key) {
820 820
 
821 821
 					case 'donations':
822 822
 						// Update totals for pending donations.
823
-						foreach ( $this->pending[ $key ] as $item ) {
823
+						foreach ($this->pending[$key] as $item) {
824 824
 
825
-							$quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1;
826
-							$price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0;
825
+							$quantity = isset($item['quantity']) ? $item['quantity'] : 1;
826
+							$price_id = isset($item['price_id']) ? $item['price_id'] : 0;
827 827
 
828
-							switch ( $item['action'] ) {
828
+							switch ($item['action']) {
829 829
 
830 830
 								case 'add':
831 831
 
832 832
 									$price = $item['price'];
833 833
 
834
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
834
+									if ('publish' === $this->status || 'complete' === $this->status) {
835 835
 
836 836
 										// Add donation to logs.
837
-										$log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) );
838
-										give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date );
837
+										$log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp'));
838
+										give_record_donation_in_log($item['id'], $this->ID, $price_id, $log_date);
839 839
 
840
-										$form = new Give_Donate_Form( $item['id'] );
841
-										$form->increase_sales( $quantity );
842
-										$form->increase_earnings( $price, $this->ID );
840
+										$form = new Give_Donate_Form($item['id']);
841
+										$form->increase_sales($quantity);
842
+										$form->increase_earnings($price, $this->ID);
843 843
 
844 844
 										$total_increase += $price;
845 845
 									}
@@ -847,10 +847,10 @@  discard block
 block discarded – undo
847 847
 
848 848
 								case 'remove':
849 849
 									$this->delete_sales_logs();
850
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
851
-										$form = new Give_Donate_Form( $item['id'] );
852
-										$form->decrease_sales( $quantity );
853
-										$form->decrease_earnings( $item['amount'], $this->ID );
850
+									if ('publish' === $this->status || 'complete' === $this->status) {
851
+										$form = new Give_Donate_Form($item['id']);
852
+										$form->decrease_sales($quantity);
853
+										$form->decrease_earnings($item['amount'], $this->ID);
854 854
 
855 855
 										$total_decrease += $item['amount'];
856 856
 									}
@@ -861,89 +861,89 @@  discard block
 block discarded – undo
861 861
 						break;
862 862
 
863 863
 					case 'status':
864
-						$this->update_status( $this->status );
864
+						$this->update_status($this->status);
865 865
 						break;
866 866
 
867 867
 					case 'gateway':
868
-						$this->update_meta( '_give_payment_gateway', $this->gateway );
868
+						$this->update_meta('_give_payment_gateway', $this->gateway);
869 869
 						break;
870 870
 
871 871
 					case 'mode':
872
-						$this->update_meta( '_give_payment_mode', $this->mode );
872
+						$this->update_meta('_give_payment_mode', $this->mode);
873 873
 						break;
874 874
 
875 875
 					case 'transaction_id':
876
-						$this->update_meta( '_give_payment_transaction_id', $this->transaction_id );
876
+						$this->update_meta('_give_payment_transaction_id', $this->transaction_id);
877 877
 						break;
878 878
 
879 879
 					case 'ip':
880
-						$this->update_meta( '_give_payment_donor_ip', $this->ip );
880
+						$this->update_meta('_give_payment_donor_ip', $this->ip);
881 881
 						break;
882 882
 
883 883
 					case 'customer_id':
884
-						$this->update_meta( '_give_payment_donor_id', $this->customer_id );
884
+						$this->update_meta('_give_payment_donor_id', $this->customer_id);
885 885
 						break;
886 886
 
887 887
 					case 'form_title':
888
-						$this->update_meta( '_give_payment_form_title', $this->form_title );
888
+						$this->update_meta('_give_payment_form_title', $this->form_title);
889 889
 						break;
890 890
 
891 891
 					case 'form_id':
892
-						$this->update_meta( '_give_payment_form_id', $this->form_id );
892
+						$this->update_meta('_give_payment_form_id', $this->form_id);
893 893
 						break;
894 894
 
895 895
 					case 'price_id':
896
-						$this->update_meta( '_give_payment_price_id', $this->price_id );
896
+						$this->update_meta('_give_payment_price_id', $this->price_id);
897 897
 						break;
898 898
 
899 899
 					case 'first_name':
900
-						$this->update_meta( '_give_donor_billing_first_name', $this->first_name );
900
+						$this->update_meta('_give_donor_billing_first_name', $this->first_name);
901 901
 						break;
902 902
 
903 903
 					case 'last_name':
904
-						$this->update_meta( '_give_donor_billing_last_name', $this->last_name );
904
+						$this->update_meta('_give_donor_billing_last_name', $this->last_name);
905 905
 						break;
906 906
 
907 907
 					case 'currency':
908
-						$this->update_meta( '_give_payment_currency', $this->currency );
908
+						$this->update_meta('_give_payment_currency', $this->currency);
909 909
 						break;
910 910
 
911 911
 					case 'address':
912
-						if ( ! empty( $this->address ) ) {
913
-							foreach ( $this->address as $address_name => $address ) {
914
-								switch ( $address_name ) {
912
+						if ( ! empty($this->address)) {
913
+							foreach ($this->address as $address_name => $address) {
914
+								switch ($address_name) {
915 915
 									case 'line1':
916
-										$this->update_meta( '_give_donor_billing_address1', $address );
916
+										$this->update_meta('_give_donor_billing_address1', $address);
917 917
 										break;
918 918
 
919 919
 									case 'line2':
920
-										$this->update_meta( '_give_donor_billing_address2', $address );
920
+										$this->update_meta('_give_donor_billing_address2', $address);
921 921
 										break;
922 922
 
923 923
 									default:
924
-										$this->update_meta( "_give_donor_billing_{$address_name}", $address );
924
+										$this->update_meta("_give_donor_billing_{$address_name}", $address);
925 925
 								}
926 926
 							}
927 927
 						}
928 928
 						break;
929 929
 
930 930
 					case 'email':
931
-						$this->update_meta( '_give_payment_donor_email', $this->email );
931
+						$this->update_meta('_give_payment_donor_email', $this->email);
932 932
 						break;
933 933
 
934 934
 					case 'title_prefix':
935
-						$this->update_meta( '_give_payment_donor_title_prefix', $this->title_prefix );
935
+						$this->update_meta('_give_payment_donor_title_prefix', $this->title_prefix);
936 936
 						break;
937 937
 
938 938
 					case 'key':
939
-						$this->update_meta( '_give_payment_purchase_key', $this->key );
939
+						$this->update_meta('_give_payment_purchase_key', $this->key);
940 940
 						break;
941 941
 
942 942
 					case 'number':
943 943
 						// @todo: remove unused meta data.
944 944
 						// Core is using post_title to store donation serial code ( fi enabled ) instead this meta key.
945 945
 						// Do not use this meta key in your logic, can be remove in future
946
-						$this->update_meta( '_give_payment_number', $this->number );
946
+						$this->update_meta('_give_payment_number', $this->number);
947 947
 						break;
948 948
 
949 949
 					case 'date':
@@ -953,11 +953,11 @@  discard block
 block discarded – undo
953 953
 							'edit_date' => true,
954 954
 						);
955 955
 
956
-						wp_update_post( $args );
956
+						wp_update_post($args);
957 957
 						break;
958 958
 
959 959
 					case 'completed_date':
960
-						$this->update_meta( '_give_completed_date', $this->completed_date );
960
+						$this->update_meta('_give_completed_date', $this->completed_date);
961 961
 						break;
962 962
 
963 963
 					case 'parent_payment':
@@ -966,11 +966,11 @@  discard block
 block discarded – undo
966 966
 							'post_parent' => $this->parent_payment,
967 967
 						);
968 968
 
969
-						wp_update_post( $args );
969
+						wp_update_post($args);
970 970
 						break;
971 971
 
972 972
 					case 'total':
973
-						$this->update_meta( '_give_payment_total', give_sanitize_amount_for_db( $this->total ) );
973
+						$this->update_meta('_give_payment_total', give_sanitize_amount_for_db($this->total));
974 974
 						break;
975 975
 
976 976
 					default:
@@ -981,46 +981,46 @@  discard block
 block discarded – undo
981 981
 						 *
982 982
 						 * @param Give_Payment $this Payment object.
983 983
 						 */
984
-						do_action( 'give_payment_save', $this, $key );
984
+						do_action('give_payment_save', $this, $key);
985 985
 						break;
986 986
 				} // End switch().
987 987
 			} // End foreach().
988 988
 
989
-			if ( 'pending' !== $this->status ) {
989
+			if ('pending' !== $this->status) {
990 990
 
991
-				$donor = new Give_Donor( $this->customer_id );
991
+				$donor = new Give_Donor($this->customer_id);
992 992
 
993 993
 				$total_change = $total_increase - $total_decrease;
994
-				if ( $total_change < 0 ) {
994
+				if ($total_change < 0) {
995 995
 
996
-					$total_change = - ( $total_change );
996
+					$total_change = - ($total_change);
997 997
 
998 998
 					// Decrease the donor's donation stats.
999
-					$donor->decrease_value( $total_change );
1000
-					give_decrease_total_earnings( $total_change );
999
+					$donor->decrease_value($total_change);
1000
+					give_decrease_total_earnings($total_change);
1001 1001
 
1002 1002
 					$donor->decrease_donation_count();
1003 1003
 
1004
-				} elseif ( $total_change > 0 ) {
1004
+				} elseif ($total_change > 0) {
1005 1005
 
1006 1006
 					// Increase the donor's donation stats.
1007
-					$donor->increase_value( $total_change );
1008
-					give_increase_total_earnings( $total_change );
1007
+					$donor->increase_value($total_change);
1008
+					give_increase_total_earnings($total_change);
1009 1009
 
1010 1010
 					$donor->increase_purchase_count();
1011 1011
 
1012 1012
 				}
1013 1013
 
1014 1014
 				// Verify and update form meta based on the form status.
1015
-				give_set_form_closed_status( $this->form_id );
1015
+				give_set_form_closed_status($this->form_id);
1016 1016
 			}
1017 1017
 
1018 1018
 			$this->pending = array();
1019 1019
 			$saved         = true;
1020 1020
 		} // End if().
1021 1021
 
1022
-		if ( true === $saved ) {
1023
-			$this->setup_payment( $this->ID );
1022
+		if (true === $saved) {
1023
+			$this->setup_payment($this->ID);
1024 1024
 		}
1025 1025
 
1026 1026
 		return $saved;
@@ -1038,12 +1038,12 @@  discard block
 block discarded – undo
1038 1038
 	 *
1039 1039
 	 * @return bool           True when successful, false otherwise
1040 1040
 	 */
1041
-	public function add_donation( $form_id = 0, $args = array(), $options = array() ) {
1041
+	public function add_donation($form_id = 0, $args = array(), $options = array()) {
1042 1042
 
1043
-		$donation = new Give_Donate_Form( $form_id );
1043
+		$donation = new Give_Donate_Form($form_id);
1044 1044
 
1045 1045
 		// Bail if this post isn't a give donation form.
1046
-		if ( ! $donation || 'give_forms' !== $donation->post_type ) {
1046
+		if ( ! $donation || 'give_forms' !== $donation->post_type) {
1047 1047
 			return false;
1048 1048
 		}
1049 1049
 
@@ -1053,25 +1053,25 @@  discard block
 block discarded – undo
1053 1053
 			'price_id' => false,
1054 1054
 		);
1055 1055
 
1056
-		$args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults );
1056
+		$args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults);
1057 1057
 
1058 1058
 		// Allow overriding the price.
1059
-		if ( false !== $args['price'] ) {
1059
+		if (false !== $args['price']) {
1060 1060
 			$donation_amount = $args['price'];
1061 1061
 		} else {
1062 1062
 
1063 1063
 			// Deal with variable pricing.
1064
-			if ( give_has_variable_prices( $donation->ID ) ) {
1065
-				$prices          = give_get_meta( $form_id, '_give_donation_levels', true );
1064
+			if (give_has_variable_prices($donation->ID)) {
1065
+				$prices          = give_get_meta($form_id, '_give_donation_levels', true);
1066 1066
 				$donation_amount = '';
1067 1067
 
1068 1068
 				// Loop through prices.
1069
-				foreach ( $prices as $price ) {
1069
+				foreach ($prices as $price) {
1070 1070
 					// Find a match between price_id and level_id.
1071 1071
 					// First verify array keys exists THEN make the match.
1072 1072
 					if (
1073
-						isset( $args['price_id'] ) &&
1074
-						isset( $price['_give_id']['level_id'] ) &&
1073
+						isset($args['price_id']) &&
1074
+						isset($price['_give_id']['level_id']) &&
1075 1075
 						$args['price_id'] === (int) $price['_give_id']['level_id']
1076 1076
 					) {
1077 1077
 						$donation_amount = $price['_give_amount'];
@@ -1079,37 +1079,37 @@  discard block
 block discarded – undo
1079 1079
 				}
1080 1080
 
1081 1081
 				// Fallback to the lowest price point.
1082
-				if ( '' === $donation_amount ) {
1083
-					$donation_amount  = give_get_lowest_price_option( $donation->ID );
1084
-					$args['price_id'] = give_get_lowest_price_id( $donation->ID );
1082
+				if ('' === $donation_amount) {
1083
+					$donation_amount  = give_get_lowest_price_option($donation->ID);
1084
+					$args['price_id'] = give_get_lowest_price_id($donation->ID);
1085 1085
 				}
1086 1086
 			} else {
1087 1087
 				// Simple form price.
1088
-				$donation_amount = give_get_form_price( $donation->ID );
1088
+				$donation_amount = give_get_form_price($donation->ID);
1089 1089
 			}
1090 1090
 		}
1091 1091
 
1092 1092
 		// Sanitizing the price here so we don't have a dozen calls later.
1093
-		$donation_amount = give_maybe_sanitize_amount( $donation_amount );
1094
-		$total           = round( $donation_amount, give_get_price_decimals( $this->ID ) );
1093
+		$donation_amount = give_maybe_sanitize_amount($donation_amount);
1094
+		$total           = round($donation_amount, give_get_price_decimals($this->ID));
1095 1095
 
1096 1096
 		// Add Options.
1097 1097
 		$default_options = array();
1098
-		if ( false !== $args['price_id'] ) {
1098
+		if (false !== $args['price_id']) {
1099 1099
 			$default_options['price_id'] = (int) $args['price_id'];
1100 1100
 		}
1101
-		$options = wp_parse_args( $options, $default_options );
1101
+		$options = wp_parse_args($options, $default_options);
1102 1102
 
1103 1103
 		// Do not allow totals to go negative.
1104
-		if ( $total < 0 ) {
1104
+		if ($total < 0) {
1105 1105
 			$total = 0;
1106 1106
 		}
1107 1107
 
1108 1108
 		$donation = array(
1109 1109
 			'name'     => $donation->post_title,
1110 1110
 			'id'       => $donation->ID,
1111
-			'price'    => round( $total, give_get_price_decimals( $this->ID ) ),
1112
-			'subtotal' => round( $total, give_get_price_decimals( $this->ID ) ),
1111
+			'price'    => round($total, give_get_price_decimals($this->ID)),
1112
+			'subtotal' => round($total, give_get_price_decimals($this->ID)),
1113 1113
 			'price_id' => $args['price_id'],
1114 1114
 			'action'   => 'add',
1115 1115
 			'options'  => $options,
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 
1118 1118
 		$this->pending['donations'][] = $donation;
1119 1119
 
1120
-		$this->increase_subtotal( $total );
1120
+		$this->increase_subtotal($total);
1121 1121
 
1122 1122
 		return true;
1123 1123
 
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 	 *
1135 1135
 	 * @return bool           If the item was removed or not
1136 1136
 	 */
1137
-	public function remove_donation( $form_id, $args = array() ) {
1137
+	public function remove_donation($form_id, $args = array()) {
1138 1138
 
1139 1139
 		// Set some defaults.
1140 1140
 		$defaults = array(
@@ -1142,12 +1142,12 @@  discard block
 block discarded – undo
1142 1142
 			'price'    => false,
1143 1143
 			'price_id' => false,
1144 1144
 		);
1145
-		$args     = wp_parse_args( $args, $defaults );
1145
+		$args = wp_parse_args($args, $defaults);
1146 1146
 
1147
-		$form = new Give_Donate_Form( $form_id );
1147
+		$form = new Give_Donate_Form($form_id);
1148 1148
 
1149 1149
 		// Bail if this post isn't a valid give donation form.
1150
-		if ( ! $form || 'give_forms' !== $form->post_type ) {
1150
+		if ( ! $form || 'give_forms' !== $form->post_type) {
1151 1151
 			return false;
1152 1152
 		}
1153 1153
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 
1161 1161
 		$this->pending['donations'][] = $pending_args;
1162 1162
 
1163
-		$this->decrease_subtotal( $this->total );
1163
+		$this->decrease_subtotal($this->total);
1164 1164
 
1165 1165
 		return true;
1166 1166
 	}
@@ -1176,13 +1176,13 @@  discard block
 block discarded – undo
1176 1176
 	 *
1177 1177
 	 * @return bool           If the note was specified or not
1178 1178
 	 */
1179
-	public function add_note( $note = false ) {
1179
+	public function add_note($note = false) {
1180 1180
 		// Bail if no note specified.
1181
-		if ( ! $note ) {
1181
+		if ( ! $note) {
1182 1182
 			return false;
1183 1183
 		}
1184 1184
 
1185
-		give_insert_payment_note( $this->ID, $note );
1185
+		give_insert_payment_note($this->ID, $note);
1186 1186
 	}
1187 1187
 
1188 1188
 	/**
@@ -1195,8 +1195,8 @@  discard block
 block discarded – undo
1195 1195
 	 *
1196 1196
 	 * @return void
1197 1197
 	 */
1198
-	private function increase_subtotal( $amount = 0.00 ) {
1199
-		$amount         = (float) $amount;
1198
+	private function increase_subtotal($amount = 0.00) {
1199
+		$amount = (float) $amount;
1200 1200
 		$this->subtotal += $amount;
1201 1201
 
1202 1202
 		$this->recalculate_total();
@@ -1212,11 +1212,11 @@  discard block
 block discarded – undo
1212 1212
 	 *
1213 1213
 	 * @return void
1214 1214
 	 */
1215
-	private function decrease_subtotal( $amount = 0.00 ) {
1216
-		$amount         = (float) $amount;
1215
+	private function decrease_subtotal($amount = 0.00) {
1216
+		$amount = (float) $amount;
1217 1217
 		$this->subtotal -= $amount;
1218 1218
 
1219
-		if ( $this->subtotal < 0 ) {
1219
+		if ($this->subtotal < 0) {
1220 1220
 			$this->subtotal = 0;
1221 1221
 		}
1222 1222
 
@@ -1246,24 +1246,24 @@  discard block
 block discarded – undo
1246 1246
 	 *
1247 1247
 	 * @return bool   $updated Returns if the status was successfully updated.
1248 1248
 	 */
1249
-	public function update_status( $status = false ) {
1249
+	public function update_status($status = false) {
1250 1250
 
1251 1251
 		// standardize the 'complete(d)' status.
1252
-		if ( 'completed' === $status || 'complete' === $status ) {
1252
+		if ('completed' === $status || 'complete' === $status) {
1253 1253
 			$status = 'publish';
1254 1254
 		}
1255 1255
 
1256
-		$old_status = ! empty( $this->old_status ) ? $this->old_status : false;
1256
+		$old_status = ! empty($this->old_status) ? $this->old_status : false;
1257 1257
 
1258
-		if ( $old_status === $status ) {
1258
+		if ($old_status === $status) {
1259 1259
 			return false; // Don't permit status changes that aren't changes.
1260 1260
 		}
1261 1261
 
1262
-		$do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status );
1262
+		$do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
1263 1263
 
1264 1264
 		$updated = false;
1265 1265
 
1266
-		if ( $do_change ) {
1266
+		if ($do_change) {
1267 1267
 
1268 1268
 			/**
1269 1269
 			 * Fires before changing payment status.
@@ -1274,21 +1274,21 @@  discard block
 block discarded – undo
1274 1274
 			 * @param string $status     The new status.
1275 1275
 			 * @param string $old_status The old status.
1276 1276
 			 */
1277
-			do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status );
1277
+			do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
1278 1278
 
1279 1279
 			$update_fields = array(
1280 1280
 				'ID'          => $this->ID,
1281 1281
 				'post_status' => $status,
1282
-				'edit_date'   => current_time( 'mysql' ),
1282
+				'edit_date'   => current_time('mysql'),
1283 1283
 			);
1284 1284
 
1285
-			$updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) );
1285
+			$updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
1286 1286
 
1287 1287
 			$all_payment_statuses  = give_get_payment_statuses();
1288
-			$this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status );
1288
+			$this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
1289 1289
 
1290 1290
 			// Process any specific status functions.
1291
-			$this->process_status( $status );
1291
+			$this->process_status($status);
1292 1292
 
1293 1293
 			/**
1294 1294
 			 * Fires after changing payment status.
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 			 * @param string $status     The new status.
1300 1300
 			 * @param string $old_status The old status.
1301 1301
 			 */
1302
-			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
1302
+			do_action('give_update_payment_status', $this->ID, $status, $old_status);
1303 1303
 
1304 1304
 		} // End if().
1305 1305
 
@@ -1334,27 +1334,27 @@  discard block
 block discarded – undo
1334 1334
 	 *
1335 1335
 	 * @return mixed             The value from the post meta
1336 1336
 	 */
1337
-	public function get_meta( $meta_key = '_give_payment_meta', $single = true ) {
1337
+	public function get_meta($meta_key = '_give_payment_meta', $single = true) {
1338 1338
 		if (
1339
-			! has_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta' ) &&
1340
-			! doing_filter( 'get_post_metadata' )
1339
+			! has_filter('get_post_metadata', 'give_bc_v20_get_payment_meta') &&
1340
+			! doing_filter('get_post_metadata')
1341 1341
 		) {
1342
-			add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
1342
+			add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4);
1343 1343
 		}
1344 1344
 
1345
-		$meta = give_get_meta( $this->ID, $meta_key, $single );
1345
+		$meta = give_get_meta($this->ID, $meta_key, $single);
1346 1346
 
1347 1347
 		/**
1348 1348
 		 * Filter the specific meta key value.
1349 1349
 		 *
1350 1350
 		 * @since 1.5
1351 1351
 		 */
1352
-		$meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID );
1352
+		$meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID);
1353 1353
 
1354 1354
 		// Security check.
1355
-		if ( is_serialized( $meta ) ) {
1356
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches );
1357
-			if ( ! empty( $matches ) ) {
1355
+		if (is_serialized($meta)) {
1356
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches);
1357
+			if ( ! empty($matches)) {
1358 1358
 				$meta = array();
1359 1359
 			}
1360 1360
 		}
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 		 *
1365 1365
 		 * @since 1.5
1366 1366
 		 */
1367
-		return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key );
1367
+		return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key);
1368 1368
 	}
1369 1369
 
1370 1370
 	/**
@@ -1379,8 +1379,8 @@  discard block
 block discarded – undo
1379 1379
 	 *
1380 1380
 	 * @return int|bool           Meta ID if the key didn't exist, true on successful update, false on failure
1381 1381
 	 */
1382
-	public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1383
-		if ( empty( $meta_key ) ) {
1382
+	public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') {
1383
+		if (empty($meta_key)) {
1384 1384
 			return false;
1385 1385
 		}
1386 1386
 
@@ -1390,9 +1390,9 @@  discard block
 block discarded – undo
1390 1390
 		 *
1391 1391
 		 * @since 1.5
1392 1392
 		 */
1393
-		$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1393
+		$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1394 1394
 
1395
-		return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value );
1395
+		return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value);
1396 1396
 	}
1397 1397
 
1398 1398
 	/**
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
 	 *
1406 1406
 	 * @return void
1407 1407
 	 */
1408
-	private function process_status( $status ) {
1408
+	private function process_status($status) {
1409 1409
 		$process = true;
1410 1410
 
1411 1411
 		// Bailout, if changed from completed to preapproval/processing.
@@ -1420,9 +1420,9 @@  discard block
 block discarded – undo
1420 1420
 		}
1421 1421
 
1422 1422
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1423
-		$process = apply_filters( "give_should_process_{$status}", $process, $this );
1423
+		$process = apply_filters("give_should_process_{$status}", $process, $this);
1424 1424
 
1425
-		if ( false === $process ) {
1425
+		if (false === $process) {
1426 1426
 			return;
1427 1427
 		}
1428 1428
 
@@ -1433,13 +1433,13 @@  discard block
 block discarded – undo
1433 1433
 		 *
1434 1434
 		 * @since 1.5
1435 1435
 		 */
1436
-		do_action( "give_pre_{$status}_payment", $this );
1436
+		do_action("give_pre_{$status}_payment", $this);
1437 1437
 
1438
-		$decrease_earnings       = apply_filters( "give_decrease_earnings_on_{$status}", true, $this );
1439
-		$decrease_donor_value    = apply_filters( "give_decrease_donor_value_on_{$status}", true, $this );
1440
-		$decrease_donation_count = apply_filters( "give_decrease_donors_donation_count_on_{$status}", true, $this );
1438
+		$decrease_earnings       = apply_filters("give_decrease_earnings_on_{$status}", true, $this);
1439
+		$decrease_donor_value    = apply_filters("give_decrease_donor_value_on_{$status}", true, $this);
1440
+		$decrease_donation_count = apply_filters("give_decrease_donors_donation_count_on_{$status}", true, $this);
1441 1441
 
1442
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1442
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1443 1443
 		$this->delete_sales_logs();
1444 1444
 
1445 1445
 		// @todo: Refresh only range related stat cache
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
 		 *
1453 1453
 		 * @since 1.5
1454 1454
 		 */
1455
-		do_action( "give_post_{$status}_payment", $this );
1455
+		do_action("give_post_{$status}_payment", $this);
1456 1456
 	}
1457 1457
 
1458 1458
 	/**
@@ -1467,25 +1467,25 @@  discard block
 block discarded – undo
1467 1467
 	 *
1468 1468
 	 * @return void
1469 1469
 	 */
1470
-	private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) {
1470
+	private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) {
1471 1471
 
1472
-		give_undo_donation( $this->ID );
1472
+		give_undo_donation($this->ID);
1473 1473
 
1474 1474
 		// Decrease store earnings.
1475
-		if ( true === $alter_store_earnings ) {
1476
-			give_decrease_total_earnings( $this->total );
1475
+		if (true === $alter_store_earnings) {
1476
+			give_decrease_total_earnings($this->total);
1477 1477
 		}
1478 1478
 
1479 1479
 		// Decrement the stats for the donor.
1480
-		if ( ! empty( $this->customer_id ) ) {
1480
+		if ( ! empty($this->customer_id)) {
1481 1481
 
1482
-			$donor = new Give_Donor( $this->customer_id );
1482
+			$donor = new Give_Donor($this->customer_id);
1483 1483
 
1484
-			if ( true === $alter_customer_value ) {
1485
-				$donor->decrease_value( $this->total );
1484
+			if (true === $alter_customer_value) {
1485
+				$donor->decrease_value($this->total);
1486 1486
 			}
1487 1487
 
1488
-			if ( true === $alter_customer_purchase_count ) {
1488
+			if (true === $alter_customer_purchase_count) {
1489 1489
 				$donor->decrease_donation_count();
1490 1490
 			}
1491 1491
 		}
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 	 */
1503 1503
 	private function delete_sales_logs() {
1504 1504
 		// Remove related sale log entries.
1505
-		Give()->logs->delete_logs( $this->ID );
1505
+		Give()->logs->delete_logs($this->ID);
1506 1506
 	}
1507 1507
 
1508 1508
 	/**
@@ -1523,13 +1523,13 @@  discard block
 block discarded – undo
1523 1523
 	 * @return string The date the payment was completed
1524 1524
 	 */
1525 1525
 	private function setup_completed_date() {
1526
-		$payment = get_post( $this->ID );
1526
+		$payment = get_post($this->ID);
1527 1527
 
1528
-		if ( 'pending' === $payment->post_status || 'preapproved' === $payment->post_status ) {
1528
+		if ('pending' === $payment->post_status || 'preapproved' === $payment->post_status) {
1529 1529
 			return false; // This payment was never completed.
1530 1530
 		}
1531 1531
 
1532
-		$date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date;
1532
+		$date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date;
1533 1533
 
1534 1534
 		return $date;
1535 1535
 	}
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
 	 * @return string The payment mode
1544 1544
 	 */
1545 1545
 	private function setup_mode() {
1546
-		return $this->get_meta( '_give_payment_mode' );
1546
+		return $this->get_meta('_give_payment_mode');
1547 1547
 	}
1548 1548
 
1549 1549
 	/**
@@ -1555,7 +1555,7 @@  discard block
 block discarded – undo
1555 1555
 	 * @return bool The payment import
1556 1556
 	 */
1557 1557
 	private function setup_import() {
1558
-		return (bool) $this->get_meta( '_give_payment_import' );
1558
+		return (bool) $this->get_meta('_give_payment_import');
1559 1559
 	}
1560 1560
 
1561 1561
 	/**
@@ -1567,9 +1567,9 @@  discard block
 block discarded – undo
1567 1567
 	 * @return float The payment total
1568 1568
 	 */
1569 1569
 	private function setup_total() {
1570
-		$amount = $this->get_meta( '_give_payment_total', true );
1570
+		$amount = $this->get_meta('_give_payment_total', true);
1571 1571
 
1572
-		return round( floatval( $amount ), give_get_price_decimals( $this->ID ) );
1572
+		return round(floatval($amount), give_get_price_decimals($this->ID));
1573 1573
 	}
1574 1574
 
1575 1575
 	/**
@@ -1596,17 +1596,16 @@  discard block
 block discarded – undo
1596 1596
 	 * @return string The currency for the payment
1597 1597
 	 */
1598 1598
 	private function setup_currency() {
1599
-		$currency = $this->get_meta( '_give_payment_currency', true );
1600
-		$currency = ! empty( $currency ) ?
1601
-			$currency :
1602
-			/**
1599
+		$currency = $this->get_meta('_give_payment_currency', true);
1600
+		$currency = ! empty($currency) ?
1601
+			$currency : /**
1603 1602
 			 * Filter the default donation currency
1604 1603
 			 *
1605 1604
 			 * @since 1.5
1606 1605
 			 */
1607 1606
 			apply_filters(
1608 1607
 				'give_payment_currency_default',
1609
-				give_get_currency( $this->form_id, $this ),
1608
+				give_get_currency($this->form_id, $this),
1610 1609
 				$this
1611 1610
 			);
1612 1611
 
@@ -1622,7 +1621,7 @@  discard block
 block discarded – undo
1622 1621
 	 * @return string The gateway
1623 1622
 	 */
1624 1623
 	private function setup_gateway() {
1625
-		$gateway = $this->get_meta( '_give_payment_gateway', true );
1624
+		$gateway = $this->get_meta('_give_payment_gateway', true);
1626 1625
 
1627 1626
 		return $gateway;
1628 1627
 	}
@@ -1636,11 +1635,11 @@  discard block
 block discarded – undo
1636 1635
 	 * @return string The donation ID
1637 1636
 	 */
1638 1637
 	private function setup_transaction_id() {
1639
-		$transaction_id = $this->get_meta( '_give_payment_transaction_id', true );
1638
+		$transaction_id = $this->get_meta('_give_payment_transaction_id', true);
1640 1639
 
1641
-		if ( empty( $transaction_id ) ) {
1640
+		if (empty($transaction_id)) {
1642 1641
 			$gateway        = $this->gateway;
1643
-			$transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID );
1642
+			$transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID);
1644 1643
 		}
1645 1644
 
1646 1645
 		return $transaction_id;
@@ -1656,7 +1655,7 @@  discard block
 block discarded – undo
1656 1655
 	 * @return string The IP address for the payment
1657 1656
 	 */
1658 1657
 	private function setup_ip() {
1659
-		$ip = $this->get_meta( '_give_payment_donor_ip', true );
1658
+		$ip = $this->get_meta('_give_payment_donor_ip', true);
1660 1659
 
1661 1660
 		return $ip;
1662 1661
 	}
@@ -1671,7 +1670,7 @@  discard block
 block discarded – undo
1671 1670
 	 * @return int The Donor ID.
1672 1671
 	 */
1673 1672
 	private function setup_donor_id() {
1674
-		$donor_id = $this->get_meta( '_give_payment_donor_id', true );
1673
+		$donor_id = $this->get_meta('_give_payment_donor_id', true);
1675 1674
 
1676 1675
 		return $donor_id;
1677 1676
 	}
@@ -1688,8 +1687,8 @@  discard block
 block discarded – undo
1688 1687
 	 */
1689 1688
 	private function setup_user_id() {
1690 1689
 
1691
-		$donor   = Give()->customers->get_customer_by( 'id', $this->customer_id );
1692
-		$user_id = $donor ? absint( $donor->user_id ) : 0;
1690
+		$donor   = Give()->customers->get_customer_by('id', $this->customer_id);
1691
+		$user_id = $donor ? absint($donor->user_id) : 0;
1693 1692
 
1694 1693
 
1695 1694
 		return $user_id;
@@ -1706,10 +1705,10 @@  discard block
 block discarded – undo
1706 1705
 	 * @return string The email address for the payment.
1707 1706
 	 */
1708 1707
 	private function setup_email() {
1709
-		$email = $this->get_meta( '_give_payment_donor_email', true );
1708
+		$email = $this->get_meta('_give_payment_donor_email', true);
1710 1709
 
1711
-		if ( empty( $email ) && $this->customer_id ) {
1712
-			$email = Give()->donors->get_column( 'email', $this->customer_id );
1710
+		if (empty($email) && $this->customer_id) {
1711
+			$email = Give()->donors->get_column('email', $this->customer_id);
1713 1712
 		}
1714 1713
 
1715 1714
 		return $email;
@@ -1730,22 +1729,22 @@  discard block
 block discarded – undo
1730 1729
 			'last_name'  => $this->last_name,
1731 1730
 		);
1732 1731
 
1733
-		$user_info = isset( $this->payment_meta['user_info'] ) ? $this->payment_meta['user_info'] : array();
1732
+		$user_info = isset($this->payment_meta['user_info']) ? $this->payment_meta['user_info'] : array();
1734 1733
 
1735
-		if ( is_serialized( $user_info ) ) {
1736
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
1737
-			if ( ! empty( $matches ) ) {
1734
+		if (is_serialized($user_info)) {
1735
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
1736
+			if ( ! empty($matches)) {
1738 1737
 				$user_info = array();
1739 1738
 			}
1740 1739
 		}
1741 1740
 
1742
-		$user_info = wp_parse_args( $user_info, $defaults );
1741
+		$user_info = wp_parse_args($user_info, $defaults);
1743 1742
 
1744
-		if ( empty( $user_info ) ) {
1743
+		if (empty($user_info)) {
1745 1744
 			// Get the donor, but only if it's been created.
1746
-			$donor = new Give_Donor( $this->customer_id );
1745
+			$donor = new Give_Donor($this->customer_id);
1747 1746
 
1748
-			if ( $donor->id > 0 ) {
1747
+			if ($donor->id > 0) {
1749 1748
 				$user_info = array(
1750 1749
 					'first_name' => $donor->get_first_name(),
1751 1750
 					'last_name'  => $donor->get_last_name(),
@@ -1755,29 +1754,29 @@  discard block
 block discarded – undo
1755 1754
 			}
1756 1755
 		} else {
1757 1756
 			// Get the donor, but only if it's been created.
1758
-			$donor = new Give_Donor( $this->customer_id );
1757
+			$donor = new Give_Donor($this->customer_id);
1759 1758
 
1760
-			if ( $donor->id > 0 ) {
1761
-				foreach ( $user_info as $key => $value ) {
1762
-					if ( ! empty( $value ) ) {
1759
+			if ($donor->id > 0) {
1760
+				foreach ($user_info as $key => $value) {
1761
+					if ( ! empty($value)) {
1763 1762
 						continue;
1764 1763
 					}
1765 1764
 
1766
-					switch ( $key ) {
1765
+					switch ($key) {
1767 1766
 						case 'title':
1768
-							$user_info[ $key ] = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true );
1767
+							$user_info[$key] = Give()->donor_meta->get_meta($donor->id, '_give_donor_title_prefix', true);
1769 1768
 							break;
1770 1769
 
1771 1770
 						case 'first_name':
1772
-							$user_info[ $key ] = $donor->get_first_name();
1771
+							$user_info[$key] = $donor->get_first_name();
1773 1772
 							break;
1774 1773
 
1775 1774
 						case 'last_name':
1776
-							$user_info[ $key ] = $donor->get_last_name();
1775
+							$user_info[$key] = $donor->get_last_name();
1777 1776
 							break;
1778 1777
 
1779 1778
 						case 'email':
1780
-							$user_info[ $key ] = $donor->email;
1779
+							$user_info[$key] = $donor->email;
1781 1780
 							break;
1782 1781
 					}
1783 1782
 				}
@@ -1797,12 +1796,12 @@  discard block
 block discarded – undo
1797 1796
 	 * @return array The Address information for the payment.
1798 1797
 	 */
1799 1798
 	private function setup_address() {
1800
-		$address['line1']   = give_get_meta( $this->ID, '_give_donor_billing_address1', true, '' );
1801
-		$address['line2']   = give_get_meta( $this->ID, '_give_donor_billing_address2', true, '' );
1802
-		$address['city']    = give_get_meta( $this->ID, '_give_donor_billing_city', true, '' );
1803
-		$address['state']   = give_get_meta( $this->ID, '_give_donor_billing_state', true, '' );
1804
-		$address['zip']     = give_get_meta( $this->ID, '_give_donor_billing_zip', true, '' );
1805
-		$address['country'] = give_get_meta( $this->ID, '_give_donor_billing_country', true, '' );
1799
+		$address['line1']   = give_get_meta($this->ID, '_give_donor_billing_address1', true, '');
1800
+		$address['line2']   = give_get_meta($this->ID, '_give_donor_billing_address2', true, '');
1801
+		$address['city']    = give_get_meta($this->ID, '_give_donor_billing_city', true, '');
1802
+		$address['state']   = give_get_meta($this->ID, '_give_donor_billing_state', true, '');
1803
+		$address['zip']     = give_get_meta($this->ID, '_give_donor_billing_zip', true, '');
1804
+		$address['country'] = give_get_meta($this->ID, '_give_donor_billing_country', true, '');
1806 1805
 
1807 1806
 		return $address;
1808 1807
 	}
@@ -1817,7 +1816,7 @@  discard block
 block discarded – undo
1817 1816
 	 */
1818 1817
 	private function setup_form_title() {
1819 1818
 
1820
-		$form_id = $this->get_meta( '_give_payment_form_title', true );
1819
+		$form_id = $this->get_meta('_give_payment_form_title', true);
1821 1820
 
1822 1821
 		return $form_id;
1823 1822
 	}
@@ -1832,7 +1831,7 @@  discard block
 block discarded – undo
1832 1831
 	 */
1833 1832
 	private function setup_form_id() {
1834 1833
 
1835
-		$form_id = $this->get_meta( '_give_payment_form_id', true );
1834
+		$form_id = $this->get_meta('_give_payment_form_id', true);
1836 1835
 
1837 1836
 		return $form_id;
1838 1837
 	}
@@ -1846,7 +1845,7 @@  discard block
 block discarded – undo
1846 1845
 	 * @return int The Form Price ID.
1847 1846
 	 */
1848 1847
 	private function setup_price_id() {
1849
-		$price_id = $this->get_meta( '_give_payment_price_id', true );
1848
+		$price_id = $this->get_meta('_give_payment_price_id', true);
1850 1849
 
1851 1850
 		return $price_id;
1852 1851
 	}
@@ -1860,7 +1859,7 @@  discard block
 block discarded – undo
1860 1859
 	 * @return string The Payment Key.
1861 1860
 	 */
1862 1861
 	private function setup_payment_key() {
1863
-		$key = $this->get_meta( '_give_payment_purchase_key', true );
1862
+		$key = $this->get_meta('_give_payment_purchase_key', true);
1864 1863
 
1865 1864
 		return $key;
1866 1865
 	}
@@ -1885,7 +1884,7 @@  discard block
 block discarded – undo
1885 1884
 	 * @return array The payment object as an array.
1886 1885
 	 */
1887 1886
 	public function array_convert() {
1888
-		return get_object_vars( $this );
1887
+		return get_object_vars($this);
1889 1888
 	}
1890 1889
 
1891 1890
 
@@ -1898,7 +1897,7 @@  discard block
 block discarded – undo
1898 1897
 	 * @return bool
1899 1898
 	 */
1900 1899
 	public function is_completed() {
1901
-		return ( 'publish' === $this->status && $this->completed_date );
1900
+		return ('publish' === $this->status && $this->completed_date);
1902 1901
 	}
1903 1902
 
1904 1903
 	/**
@@ -1910,7 +1909,7 @@  discard block
 block discarded – undo
1910 1909
 	 * @return string Date payment was completed.
1911 1910
 	 */
1912 1911
 	private function get_completed_date() {
1913
-		return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this );
1912
+		return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this);
1914 1913
 	}
1915 1914
 
1916 1915
 	/**
@@ -1922,7 +1921,7 @@  discard block
 block discarded – undo
1922 1921
 	 * @return float Payment subtotal.
1923 1922
 	 */
1924 1923
 	private function get_subtotal() {
1925
-		return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this );
1924
+		return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this);
1926 1925
 	}
1927 1926
 
1928 1927
 	/**
@@ -1934,7 +1933,7 @@  discard block
 block discarded – undo
1934 1933
 	 * @return string Payment currency code.
1935 1934
 	 */
1936 1935
 	private function get_currency() {
1937
-		return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this );
1936
+		return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this);
1938 1937
 	}
1939 1938
 
1940 1939
 	/**
@@ -1946,7 +1945,7 @@  discard block
 block discarded – undo
1946 1945
 	 * @return string Gateway used.
1947 1946
 	 */
1948 1947
 	private function get_gateway() {
1949
-		return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this );
1948
+		return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this);
1950 1949
 	}
1951 1950
 
1952 1951
 	/**
@@ -1958,7 +1957,7 @@  discard block
 block discarded – undo
1958 1957
 	 * @return string Donation ID from merchant processor.
1959 1958
 	 */
1960 1959
 	private function get_transaction_id() {
1961
-		return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this );
1960
+		return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this);
1962 1961
 	}
1963 1962
 
1964 1963
 	/**
@@ -1970,7 +1969,7 @@  discard block
 block discarded – undo
1970 1969
 	 * @return string Payment IP address
1971 1970
 	 */
1972 1971
 	private function get_ip() {
1973
-		return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this );
1972
+		return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this);
1974 1973
 	}
1975 1974
 
1976 1975
 	/**
@@ -1982,7 +1981,7 @@  discard block
 block discarded – undo
1982 1981
 	 * @return int Payment donor ID.
1983 1982
 	 */
1984 1983
 	private function get_donor_id() {
1985
-		return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this );
1984
+		return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this);
1986 1985
 	}
1987 1986
 
1988 1987
 	/**
@@ -1994,7 +1993,7 @@  discard block
 block discarded – undo
1994 1993
 	 * @return int Payment user ID.
1995 1994
 	 */
1996 1995
 	private function get_user_id() {
1997
-		return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this );
1996
+		return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this);
1998 1997
 	}
1999 1998
 
2000 1999
 	/**
@@ -2006,7 +2005,7 @@  discard block
 block discarded – undo
2006 2005
 	 * @return string Payment donor email.
2007 2006
 	 */
2008 2007
 	private function get_email() {
2009
-		return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this );
2008
+		return apply_filters('give_payment_user_email', $this->email, $this->ID, $this);
2010 2009
 	}
2011 2010
 
2012 2011
 	/**
@@ -2018,7 +2017,7 @@  discard block
 block discarded – undo
2018 2017
 	 * @return array Payment user info.
2019 2018
 	 */
2020 2019
 	private function get_user_info() {
2021
-		return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this );
2020
+		return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this);
2022 2021
 	}
2023 2022
 
2024 2023
 	/**
@@ -2030,7 +2029,7 @@  discard block
 block discarded – undo
2030 2029
 	 * @return array Payment billing address.
2031 2030
 	 */
2032 2031
 	private function get_address() {
2033
-		return apply_filters( 'give_payment_address', $this->address, $this->ID, $this );
2032
+		return apply_filters('give_payment_address', $this->address, $this->ID, $this);
2034 2033
 	}
2035 2034
 
2036 2035
 	/**
@@ -2042,7 +2041,7 @@  discard block
 block discarded – undo
2042 2041
 	 * @return string Payment key.
2043 2042
 	 */
2044 2043
 	private function get_key() {
2045
-		return apply_filters( 'give_payment_key', $this->key, $this->ID, $this );
2044
+		return apply_filters('give_payment_key', $this->key, $this->ID, $this);
2046 2045
 	}
2047 2046
 
2048 2047
 	/**
@@ -2054,7 +2053,7 @@  discard block
 block discarded – undo
2054 2053
 	 * @return string Payment form id
2055 2054
 	 */
2056 2055
 	private function get_form_id() {
2057
-		return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this );
2056
+		return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this);
2058 2057
 	}
2059 2058
 
2060 2059
 	/**
@@ -2066,7 +2065,7 @@  discard block
 block discarded – undo
2066 2065
 	 * @return int|string Payment number
2067 2066
 	 */
2068 2067
 	private function get_number() {
2069
-		return apply_filters( 'give_payment_number', $this->number, $this->ID, $this );
2068
+		return apply_filters('give_payment_number', $this->number, $this->ID, $this);
2070 2069
 	}
2071 2070
 
2072 2071
 	/**
@@ -2078,7 +2077,7 @@  discard block
 block discarded – undo
2078 2077
 	 *
2079 2078
 	 * @return string
2080 2079
 	 */
2081
-	public function get_serial_code( $args = array() ) {
2082
-		return Give()->seq_donation_number->get_serial_code( $this, $args );
2080
+	public function get_serial_code($args = array()) {
2081
+		return Give()->seq_donation_number->get_serial_code($this, $args);
2083 2082
 	}
2084 2083
 }
Please login to merge, or discard this patch.
includes/shortcodes.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -789,7 +789,7 @@
 block discarded – undo
789 789
  * @type string $display_style       How the form is displayed, either in new page or modal popup.
790 790
  *                                       Default 'redirect'. Accepts 'redirect', 'modal'.
791 791
  * }
792
- * @return string|bool The markup of the form grid or false.
792
+ * @return string|null The markup of the form grid or false.
793 793
  */
794 794
 function give_form_grid_shortcode( $atts ) {
795 795
 
Please login to merge, or discard this patch.
Spacing   +213 added lines, -213 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,42 +26,42 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return string|bool
28 28
  */
29
-function give_donation_history( $atts, $content = false ) {
29
+function give_donation_history($atts, $content = false) {
30 30
 
31
-	$donation_history_args = shortcode_atts( array(
31
+	$donation_history_args = shortcode_atts(array(
32 32
 		'id'             => true,
33 33
 		'date'           => true,
34 34
 		'donor'          => false,
35 35
 		'amount'         => true,
36 36
 		'status'         => false,
37 37
 		'payment_method' => false,
38
-	), $atts, 'donation_history' );
38
+	), $atts, 'donation_history');
39 39
 
40 40
 	// Always show receipt link.
41 41
 	$donation_history_args['details'] = true;
42 42
 
43 43
 	// Set Donation History Shortcode Arguments in session variable.
44
-	Give()->session->set( 'give_donation_history_args', $donation_history_args );
44
+	Give()->session->set('give_donation_history_args', $donation_history_args);
45 45
 
46 46
 	// If payment_key query arg exists, return receipt instead of donation history.
47
-	if ( isset( $_GET['payment_key'] ) ) {
47
+	if (isset($_GET['payment_key'])) {
48 48
 		ob_start();
49 49
 
50
-		echo give_receipt_shortcode( array() );
50
+		echo give_receipt_shortcode(array());
51 51
 
52 52
 		// Display donation history link only if Receipt Access Session is available.
53
-		if ( give_get_receipt_session() ) {
53
+		if (give_get_receipt_session()) {
54 54
 			echo sprintf(
55 55
 				'<a href="%s">%s</a>',
56
-				esc_url( give_get_history_page_uri() ),
57
-				__( '&laquo; Return to All Donations', 'give' )
56
+				esc_url(give_get_history_page_uri()),
57
+				__('&laquo; Return to All Donations', 'give')
58 58
 			);
59 59
 		}
60 60
 
61 61
 		return ob_get_clean();
62 62
 	}
63 63
 
64
-	$email_access = give_get_option( 'email_access' );
64
+	$email_access = give_get_option('email_access');
65 65
 
66 66
 	ob_start();
67 67
 
@@ -74,23 +74,23 @@  discard block
 block discarded – undo
74 74
 	if (
75 75
 		is_user_logged_in()
76 76
 		|| false !== Give()->session->get_session_expiration()
77
-		|| ( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists )
77
+		|| (give_is_setting_enabled($email_access) && Give()->email_access->token_exists)
78 78
 		|| true === give_get_history_session()
79 79
 	) {
80
-		give_get_template_part( 'history', 'donations' );
80
+		give_get_template_part('history', 'donations');
81 81
 
82
-		if ( ! empty( $content ) ) {
83
-			echo do_shortcode( $content );
82
+		if ( ! empty($content)) {
83
+			echo do_shortcode($content);
84 84
 		}
85 85
 
86
-	} elseif ( give_is_setting_enabled( $email_access ) ) {
86
+	} elseif (give_is_setting_enabled($email_access)) {
87 87
 		// Is Email-based access enabled?
88
-		give_get_template_part( 'email', 'login-form' );
88
+		give_get_template_part('email', 'login-form');
89 89
 
90 90
 	} else {
91 91
 
92
-		echo apply_filters( 'give_donation_history_nonuser_message', Give()->notices->print_frontend_notice( __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ), false ) );
93
-		echo do_shortcode( '[give_login]' );
92
+		echo apply_filters('give_donation_history_nonuser_message', Give()->notices->print_frontend_notice(__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'), false));
93
+		echo do_shortcode('[give_login]');
94 94
 	}
95 95
 
96 96
 	/**
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return string HTML content
106 106
 	 */
107
-	return apply_filters( 'give_donation_history_shortcode_html', ob_get_clean(), $atts, $content );
107
+	return apply_filters('give_donation_history_shortcode_html', ob_get_clean(), $atts, $content);
108 108
 }
109 109
 
110
-add_shortcode( 'donation_history', 'give_donation_history' );
110
+add_shortcode('donation_history', 'give_donation_history');
111 111
 
112 112
 /**
113 113
  * Donation Form Shortcode
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string
122 122
  */
123
-function give_form_shortcode( $atts ) {
124
-	$atts = shortcode_atts( array(
123
+function give_form_shortcode($atts) {
124
+	$atts = shortcode_atts(array(
125 125
 		'id'                    => '',
126 126
 		'show_title'            => true,
127 127
 		'show_goal'             => true,
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 		'float_labels'          => '',
130 130
 		'display_style'         => '',
131 131
 		'continue_button_title' => '',
132
-	), $atts, 'give_form' );
132
+	), $atts, 'give_form');
133 133
 
134 134
 	// Convert string to bool.
135
-	$atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN );
136
-	$atts['show_goal']  = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN );
135
+	$atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN);
136
+	$atts['show_goal']  = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN);
137 137
 
138 138
 	// get the Give Form
139 139
 	ob_start();
140
-	give_get_donation_form( $atts );
140
+	give_get_donation_form($atts);
141 141
 	$final_output = ob_get_clean();
142 142
 
143
-	return apply_filters( 'give_donate_form', $final_output, $atts );
143
+	return apply_filters('give_donate_form', $final_output, $atts);
144 144
 }
145 145
 
146
-add_shortcode( 'give_form', 'give_form_shortcode' );
146
+add_shortcode('give_form', 'give_form_shortcode');
147 147
 
148 148
 /**
149 149
  * Donation Form Goal Shortcode.
@@ -156,36 +156,36 @@  discard block
 block discarded – undo
156 156
  *
157 157
  * @return string
158 158
  */
159
-function give_goal_shortcode( $atts ) {
160
-	$atts = shortcode_atts( array(
159
+function give_goal_shortcode($atts) {
160
+	$atts = shortcode_atts(array(
161 161
 		'id'        => '',
162 162
 		'show_text' => true,
163 163
 		'show_bar'  => true,
164
-	), $atts, 'give_goal' );
164
+	), $atts, 'give_goal');
165 165
 
166 166
 	// get the Give Form.
167 167
 	ob_start();
168 168
 
169 169
 	// Sanity check 1: ensure there is an ID Provided.
170
-	if ( empty( $atts['id'] ) ) {
171
-		Give()->notices->print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true );
170
+	if (empty($atts['id'])) {
171
+		Give()->notices->print_frontend_notice(__('The shortcode is missing Donation Form ID attribute.', 'give'), true);
172 172
 	}
173 173
 
174 174
 	// Sanity check 2: Check the form even has Goals enabled.
175
-	if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) {
175
+	if ( ! give_is_setting_enabled(give_get_meta($atts['id'], '_give_goal_option', true))) {
176 176
 
177
-		Give()->notices->print_frontend_notice( __( 'The form does not have Goals enabled.', 'give' ), true );
177
+		Give()->notices->print_frontend_notice(__('The form does not have Goals enabled.', 'give'), true);
178 178
 	} else {
179 179
 		// Passed all sanity checks: output Goal.
180
-		give_show_goal_progress( $atts['id'], $atts );
180
+		give_show_goal_progress($atts['id'], $atts);
181 181
 	}
182 182
 
183 183
 	$final_output = ob_get_clean();
184 184
 
185
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
185
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
186 186
 }
187 187
 
188
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
188
+add_shortcode('give_goal', 'give_goal_shortcode');
189 189
 
190 190
 
191 191
 /**
@@ -202,22 +202,22 @@  discard block
 block discarded – undo
202 202
  *
203 203
  * @return string
204 204
  */
205
-function give_login_form_shortcode( $atts ) {
205
+function give_login_form_shortcode($atts) {
206 206
 
207
-	$atts = shortcode_atts( array(
207
+	$atts = shortcode_atts(array(
208 208
 		// Add backward compatibility for redirect attribute.
209 209
 		'redirect'        => '',
210 210
 		'login-redirect'  => '',
211 211
 		'logout-redirect' => '',
212
-	), $atts, 'give_login' );
212
+	), $atts, 'give_login');
213 213
 
214 214
 	// Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
215
-	$atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' );
215
+	$atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : '');
216 216
 
217
-	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
217
+	return give_login_form($atts['login-redirect'], $atts['logout-redirect']);
218 218
 }
219 219
 
220
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
220
+add_shortcode('give_login', 'give_login_form_shortcode');
221 221
 
222 222
 /**
223 223
  * Register Shortcode.
@@ -232,15 +232,15 @@  discard block
 block discarded – undo
232 232
  *
233 233
  * @return string
234 234
  */
235
-function give_register_form_shortcode( $atts ) {
236
-	$atts = shortcode_atts( array(
235
+function give_register_form_shortcode($atts) {
236
+	$atts = shortcode_atts(array(
237 237
 		'redirect' => '',
238
-	), $atts, 'give_register' );
238
+	), $atts, 'give_register');
239 239
 
240
-	return give_register_form( $atts['redirect'] );
240
+	return give_register_form($atts['redirect']);
241 241
 }
242 242
 
243
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
243
+add_shortcode('give_register', 'give_register_form_shortcode');
244 244
 
245 245
 /**
246 246
  * Receipt Shortcode.
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string
255 255
  */
256
-function give_receipt_shortcode( $atts ) {
256
+function give_receipt_shortcode($atts) {
257 257
 
258 258
 	global $give_receipt_args;
259 259
 
260
-	$give_receipt_args = shortcode_atts( array(
261
-		'error'          => __( 'You are missing the payment key to view this donation receipt.', 'give' ),
260
+	$give_receipt_args = shortcode_atts(array(
261
+		'error'          => __('You are missing the payment key to view this donation receipt.', 'give'),
262 262
 		'price'          => true,
263 263
 		'donor'          => true,
264 264
 		'date'           => true,
@@ -268,16 +268,16 @@  discard block
 block discarded – undo
268 268
 		'payment_status' => false,
269 269
 		'company_name'   => false,
270 270
 		'status_notice'  => true,
271
-	), $atts, 'give_receipt' );
271
+	), $atts, 'give_receipt');
272 272
 
273
-	if( ! wp_doing_ajax() ) {
273
+	if ( ! wp_doing_ajax()) {
274 274
 		ob_start();
275
-		give_get_template_part( 'receipt/placeholder' );
275
+		give_get_template_part('receipt/placeholder');
276 276
 		$placeholder = ob_get_clean();
277 277
 
278 278
 		return sprintf(
279 279
 			'<div id="give-receipt" data-shortcode="%s">%s</div>',
280
-			urlencode_deep( wp_json_encode( $atts ) ),
280
+			urlencode_deep(wp_json_encode($atts)),
281 281
 			$placeholder
282 282
 		);
283 283
 	}
@@ -286,43 +286,43 @@  discard block
 block discarded – undo
286 286
 	$session = give_get_purchase_session();
287 287
 
288 288
 	// set payment key var
289
-	if ( isset( $_GET['payment_key'] ) ) {
290
-		$payment_key = urldecode( $_GET['payment_key'] );
291
-	} elseif ( $session ) {
289
+	if (isset($_GET['payment_key'])) {
290
+		$payment_key = urldecode($_GET['payment_key']);
291
+	} elseif ($session) {
292 292
 		$payment_key = $session['purchase_key'];
293
-	} elseif ( $give_receipt_args['payment_key'] ) {
293
+	} elseif ($give_receipt_args['payment_key']) {
294 294
 		$payment_key = $give_receipt_args['payment_key'];
295 295
 	}
296 296
 
297
-	$email_access = give_get_option( 'email_access' );
297
+	$email_access = give_get_option('email_access');
298 298
 
299 299
 	// No payment_key found & Email Access is Turned on.
300
-	if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
300
+	if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
301 301
 
302 302
 		ob_start();
303 303
 
304
-		give_get_template_part( 'email-login-form' );
304
+		give_get_template_part('email-login-form');
305 305
 
306 306
 		return ob_get_clean();
307 307
 
308
-	} elseif ( ! isset( $payment_key ) ) {
308
+	} elseif ( ! isset($payment_key)) {
309 309
 
310
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
310
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
311 311
 
312 312
 	}
313 313
 
314
-	$user_can_view = give_can_view_receipt( $payment_key );
314
+	$user_can_view = give_can_view_receipt($payment_key);
315 315
 
316 316
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt.
317
-	if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
317
+	if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
318 318
 
319 319
 		ob_start();
320 320
 
321
-		give_get_template_part( 'email-login-form' );
321
+		give_get_template_part('email-login-form');
322 322
 
323 323
 		return ob_get_clean();
324 324
 
325
-	} elseif ( ! $user_can_view ) {
325
+	} elseif ( ! $user_can_view) {
326 326
 
327 327
 		global $give_login_redirect;
328 328
 
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
 
331 331
 		ob_start();
332 332
 
333
-		Give()->notices->print_frontend_notice( apply_filters( 'give_must_be_logged_in_error_message', __( 'You must be logged in to view this donation receipt.', 'give' ) ) );
333
+		Give()->notices->print_frontend_notice(apply_filters('give_must_be_logged_in_error_message', __('You must be logged in to view this donation receipt.', 'give')));
334 334
 
335
-		give_get_template_part( 'shortcode', 'login' );
335
+		give_get_template_part('shortcode', 'login');
336 336
 
337 337
 		$login_form = ob_get_clean();
338 338
 
@@ -346,20 +346,20 @@  discard block
 block discarded – undo
346 346
 	 * or if user is logged out and donation was made as a guest, the donation session is checked for
347 347
 	 * or if user is logged in and the user can view sensitive shop data.
348 348
 	 */
349
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
350
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
349
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
350
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
351 351
 	}
352 352
 
353 353
 	ob_start();
354 354
 
355
-	give_get_template_part( 'shortcode', 'receipt' );
355
+	give_get_template_part('shortcode', 'receipt');
356 356
 
357 357
 	$display = ob_get_clean();
358 358
 
359 359
 	return $display;
360 360
 }
361 361
 
362
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
362
+add_shortcode('give_receipt', 'give_receipt_shortcode');
363 363
 
364 364
 /**
365 365
  * Profile Editor Shortcode.
@@ -378,26 +378,26 @@  discard block
 block discarded – undo
378 378
  *
379 379
  * @return string Output generated from the profile editor
380 380
  */
381
-function give_profile_editor_shortcode( $atts ) {
381
+function give_profile_editor_shortcode($atts) {
382 382
 
383 383
 	ob_start();
384 384
 
385 385
 	// Restrict access to donor profile, if donor and user are disconnected.
386
-	$is_donor_disconnected = get_user_meta( get_current_user_id(), '_give_is_donor_disconnected', true );
387
-	if ( is_user_logged_in() && $is_donor_disconnected ) {
388
-		Give()->notices->print_frontend_notice( __( 'Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give' ), true, 'error' );
386
+	$is_donor_disconnected = get_user_meta(get_current_user_id(), '_give_is_donor_disconnected', true);
387
+	if (is_user_logged_in() && $is_donor_disconnected) {
388
+		Give()->notices->print_frontend_notice(__('Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give'), true, 'error');
389 389
 
390 390
 		return false;
391 391
 	}
392 392
 
393
-	give_get_template_part( 'shortcode', 'profile-editor' );
393
+	give_get_template_part('shortcode', 'profile-editor');
394 394
 
395 395
 	$display = ob_get_clean();
396 396
 
397 397
 	return $display;
398 398
 }
399 399
 
400
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
400
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
401 401
 
402 402
 /**
403 403
  * Process Profile Updater Form.
@@ -410,31 +410,31 @@  discard block
 block discarded – undo
410 410
  *
411 411
  * @return bool
412 412
  */
413
-function give_process_profile_editor_updates( $data ) {
413
+function give_process_profile_editor_updates($data) {
414 414
 	// Profile field change request.
415
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
415
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
416 416
 		return false;
417 417
 	}
418 418
 
419 419
 	// Nonce security.
420
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
420
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
421 421
 		return false;
422 422
 	}
423 423
 
424 424
 	$user_id       = get_current_user_id();
425
-	$old_user_data = get_userdata( $user_id );
425
+	$old_user_data = get_userdata($user_id);
426 426
 
427 427
 	/* @var Give_Donor $donor */
428
-	$donor            = new Give_Donor( $user_id, true );
428
+	$donor            = new Give_Donor($user_id, true);
429 429
 	$old_company_name = $donor->get_company_name();
430 430
 
431
-	$display_name     = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
432
-	$first_name       = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
433
-	$last_name        = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
434
-	$company_name     = ! empty( $data['give_company_name'] ) ? sanitize_text_field( $data['give_company_name'] ) : $old_company_name;
435
-	$email            = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
436
-	$password         = ! empty( $data['give_new_user_pass1'] ) ? $data['give_new_user_pass1'] : '';
437
-	$confirm_password = ! empty( $data['give_new_user_pass2'] ) ? $data['give_new_user_pass2'] : '';
431
+	$display_name     = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
432
+	$first_name       = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
433
+	$last_name        = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
434
+	$company_name     = ! empty($data['give_company_name']) ? sanitize_text_field($data['give_company_name']) : $old_company_name;
435
+	$email            = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
436
+	$password         = ! empty($data['give_new_user_pass1']) ? $data['give_new_user_pass1'] : '';
437
+	$confirm_password = ! empty($data['give_new_user_pass2']) ? $data['give_new_user_pass2'] : '';
438 438
 
439 439
 	$userdata = array(
440 440
 		'ID'           => $user_id,
@@ -454,60 +454,60 @@  discard block
 block discarded – undo
454 454
 	 * @param int   $user_id  The ID of the user.
455 455
 	 * @param array $userdata User info, including ID, first name, last name, display name and email.
456 456
 	 */
457
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
457
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
458 458
 
459 459
 	// Make sure to validate first name of existing donors.
460
-	if ( empty( $first_name ) ) {
460
+	if (empty($first_name)) {
461 461
 		// Empty First Name.
462
-		give_set_error( 'empty_first_name', __( 'Please enter your first name.', 'give' ) );
462
+		give_set_error('empty_first_name', __('Please enter your first name.', 'give'));
463 463
 	}
464 464
 
465 465
 	// Make sure to validate passwords for existing Donors.
466
-	give_validate_user_password( $password, $confirm_password );
466
+	give_validate_user_password($password, $confirm_password);
467 467
 
468
-	if ( empty( $email ) ) {
468
+	if (empty($email)) {
469 469
 		// Make sure email should not be empty.
470
-		give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) );
470
+		give_set_error('email_empty', __('The email you entered is empty.', 'give'));
471 471
 
472
-	} elseif ( ! is_email( $email ) ) {
472
+	} elseif ( ! is_email($email)) {
473 473
 		// Make sure email should be valid.
474
-		give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) );
474
+		give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give'));
475 475
 
476
-	} elseif ( $email != $old_user_data->user_email ) {
476
+	} elseif ($email != $old_user_data->user_email) {
477 477
 		// Make sure the new email doesn't belong to another user.
478
-		if ( email_exists( $email ) ) {
479
-			give_set_error( 'user_email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) );
480
-		} elseif ( Give()->donors->get_donor_by( 'email', $email ) ) {
478
+		if (email_exists($email)) {
479
+			give_set_error('user_email_exists', __('The email you entered belongs to another user. Please use another.', 'give'));
480
+		} elseif (Give()->donors->get_donor_by('email', $email)) {
481 481
 			// Make sure the new email doesn't belong to another user.
482
-			give_set_error( 'donor_email_exists', __( 'The email you entered belongs to another donor. Please use another.', 'give' ) );
482
+			give_set_error('donor_email_exists', __('The email you entered belongs to another donor. Please use another.', 'give'));
483 483
 		}
484 484
 	}
485 485
 
486 486
 	// Check for errors.
487 487
 	$errors = give_get_errors();
488 488
 
489
-	if ( $errors ) {
489
+	if ($errors) {
490 490
 		// Send back to the profile editor if there are errors.
491
-		wp_redirect( $data['give_redirect'] );
491
+		wp_redirect($data['give_redirect']);
492 492
 		give_die();
493 493
 	}
494 494
 
495 495
 	// Update Donor First Name and Last Name.
496
-	Give()->donors->update( $donor->id, array(
497
-		'name' => trim( "{$first_name} {$last_name}" ),
498
-	) );
499
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name );
500
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name );
501
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_company', $company_name );
496
+	Give()->donors->update($donor->id, array(
497
+		'name' => trim("{$first_name} {$last_name}"),
498
+	));
499
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name);
500
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name);
501
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_company', $company_name);
502 502
 
503 503
 	$current_user = wp_get_current_user();
504 504
 
505 505
 	// Compares new values with old values to detect change in values.
506
-	$email_update        = ( $email !== $current_user->user_email ) ? true : false;
507
-	$display_name_update = ( $display_name !== $current_user->display_name ) ? true : false;
508
-	$first_name_update   = ( $first_name !== $current_user->first_name ) ? true : false;
509
-	$last_name_update    = ( $last_name !== $current_user->last_name ) ? true : false;
510
-	$company_name_update = ( $company_name !== $old_company_name ) ? true : false;
506
+	$email_update        = ($email !== $current_user->user_email) ? true : false;
507
+	$display_name_update = ($display_name !== $current_user->display_name) ? true : false;
508
+	$first_name_update   = ($first_name !== $current_user->first_name) ? true : false;
509
+	$last_name_update    = ($last_name !== $current_user->last_name) ? true : false;
510
+	$company_name_update = ($company_name !== $old_company_name) ? true : false;
511 511
 	$update_code         = 0;
512 512
 
513 513
 	/**
@@ -515,35 +515,35 @@  discard block
 block discarded – undo
515 515
 	 *
516 516
 	 * @var boolean
517 517
 	 */
518
-	$profile_update = ( $email_update || $display_name_update || $first_name_update || $last_name_update || $company_name_update );
518
+	$profile_update = ($email_update || $display_name_update || $first_name_update || $last_name_update || $company_name_update);
519 519
 
520 520
 	/**
521 521
 	 * True if password fields are filled.
522 522
 	 *
523 523
 	 * @var boolean
524 524
 	 */
525
-	$password_update = ( ! empty( $password ) && ! empty( $confirm_password ) );
525
+	$password_update = ( ! empty($password) && ! empty($confirm_password));
526 526
 
527
-	if ( $profile_update ) {
527
+	if ($profile_update) {
528 528
 
529 529
 		// If only profile fields are updated.
530 530
 		$update_code = '1';
531 531
 
532
-		if ( $password_update ) {
532
+		if ($password_update) {
533 533
 
534 534
 			// If profile fields AND password both are updated.
535 535
 			$update_code = '2';
536 536
 		}
537
-	} elseif ( $password_update ) {
537
+	} elseif ($password_update) {
538 538
 
539 539
 		// If only password is updated.
540 540
 		$update_code = '3';
541 541
 	}
542 542
 
543 543
 	// Update the user.
544
-	$updated = wp_update_user( $userdata );
544
+	$updated = wp_update_user($userdata);
545 545
 
546
-	if ( $updated ) {
546
+	if ($updated) {
547 547
 
548 548
 		/**
549 549
 		 * Fires after updating user profile.
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 		 * @param int   $user_id  The ID of the user.
554 554
 		 * @param array $userdata User info, including ID, first name, last name, display name and email.
555 555
 		 */
556
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
556
+		do_action('give_user_profile_updated', $user_id, $userdata);
557 557
 
558 558
 		$profile_edit_redirect_args = array(
559 559
 			'updated'     => 'true',
@@ -564,10 +564,10 @@  discard block
 block discarded – undo
564 564
 		 * Update codes '2' and '3' indicate a password change.
565 565
 		 * If the password is changed, then logout and redirect to the same page.
566 566
 		 */
567
-		if ( '2' === $update_code || '3' === $update_code ) {
568
-			wp_logout( wp_redirect( add_query_arg( $profile_edit_redirect_args, $data['give_redirect'] ) ) );
567
+		if ('2' === $update_code || '3' === $update_code) {
568
+			wp_logout(wp_redirect(add_query_arg($profile_edit_redirect_args, $data['give_redirect'])));
569 569
 		} else {
570
-			wp_redirect( add_query_arg( $profile_edit_redirect_args, $data['give_redirect'] ) );
570
+			wp_redirect(add_query_arg($profile_edit_redirect_args, $data['give_redirect']));
571 571
 		}
572 572
 
573 573
 		give_die();
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	return false;
577 577
 }
578 578
 
579
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
579
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
580 580
 
581 581
 /**
582 582
  * Give totals Shortcode.
@@ -589,24 +589,24 @@  discard block
 block discarded – undo
589 589
  *
590 590
  * @return string
591 591
  */
592
-function give_totals_shortcode( $atts ) {
593
-	$total = get_option( 'give_earnings_total', false );
592
+function give_totals_shortcode($atts) {
593
+	$total = get_option('give_earnings_total', false);
594 594
 
595
-	$message = apply_filters( 'give_totals_message', __( 'Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give' ) );
595
+	$message = apply_filters('give_totals_message', __('Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give'));
596 596
 
597
-	$atts = shortcode_atts( array(
597
+	$atts = shortcode_atts(array(
598 598
 		'total_goal'   => 0, // integer
599 599
 		'ids'          => 0, // integer|array
600 600
 		'cats'         => 0, // integer|array
601 601
 		'tags'         => 0, // integer|array
602 602
 		'message'      => $message,
603 603
 		'link'         => '', // URL
604
-		'link_text'    => __( 'Donate Now', 'give' ), // string,
604
+		'link_text'    => __('Donate Now', 'give'), // string,
605 605
 		'progress_bar' => true, // boolean
606
-	), $atts, 'give_totals' );
606
+	), $atts, 'give_totals');
607 607
 
608 608
 	// Total Goal.
609
-	$total_goal = give_maybe_sanitize_amount( $atts['total_goal'] );
609
+	$total_goal = give_maybe_sanitize_amount($atts['total_goal']);
610 610
 
611 611
 	/**
612 612
 	 * Give Action fire before the shortcode is rendering is started.
@@ -615,14 +615,14 @@  discard block
 block discarded – undo
615 615
 	 *
616 616
 	 * @param array $atts shortcode attribute.
617 617
 	 */
618
-	do_action( 'give_totals_goal_shortcode_before_render', $atts );
618
+	do_action('give_totals_goal_shortcode_before_render', $atts);
619 619
 
620 620
 	// Build query based on cat, tag and Form ids.
621
-	if ( ! empty( $atts['cats'] ) || ! empty( $atts['tags'] ) || ! empty( $atts['ids'] ) ) {
621
+	if ( ! empty($atts['cats']) || ! empty($atts['tags']) || ! empty($atts['ids'])) {
622 622
 
623 623
 		$form_ids = array();
624
-		if ( ! empty( $atts['ids'] ) ) {
625
-			$form_ids = array_filter( array_map( 'trim', explode( ',', $atts['ids'] ) ) );
624
+		if ( ! empty($atts['ids'])) {
625
+			$form_ids = array_filter(array_map('trim', explode(',', $atts['ids'])));
626 626
 		}
627 627
 
628 628
 		/**
@@ -636,23 +636,23 @@  discard block
 block discarded – undo
636 636
 			'post_type'        => 'give_forms',
637 637
 			'post_status'      => 'publish',
638 638
 			'post__in'         => $form_ids,
639
-			'posts_per_page'   => - 1,
639
+			'posts_per_page'   => -1,
640 640
 			'fields'           => 'ids',
641 641
 			'tax_query'        => array(
642 642
 				'relation' => 'AND',
643 643
 			),
644 644
 		);
645 645
 
646
-		if ( ! empty( $atts['cats'] ) ) {
647
-			$cats                     = array_filter( array_map( 'trim', explode( ',', $atts['cats'] ) ) );
646
+		if ( ! empty($atts['cats'])) {
647
+			$cats                     = array_filter(array_map('trim', explode(',', $atts['cats'])));
648 648
 			$form_args['tax_query'][] = array(
649 649
 				'taxonomy' => 'give_forms_category',
650 650
 				'terms'    => $cats,
651 651
 			);
652 652
 		}
653 653
 
654
-		if ( ! empty( $atts['tags'] ) ) {
655
-			$tags                     = array_filter( array_map( 'trim', explode( ',', $atts['tags'] ) ) );
654
+		if ( ! empty($atts['tags'])) {
655
+			$tags                     = array_filter(array_map('trim', explode(',', $atts['tags'])));
656 656
 			$form_args['tax_query'][] = array(
657 657
 				'taxonomy' => 'give_forms_tag',
658 658
 				'terms'    => $tags,
@@ -668,15 +668,15 @@  discard block
 block discarded – undo
668 668
 		 *
669 669
 		 * @return array $form_args WP query argument for Total Goal.
670 670
 		 */
671
-		$form_args = (array) apply_filters( 'give_totals_goal_shortcode_query_args', $form_args );
671
+		$form_args = (array) apply_filters('give_totals_goal_shortcode_query_args', $form_args);
672 672
 
673
-		$forms = new WP_Query( $form_args );
673
+		$forms = new WP_Query($form_args);
674 674
 
675
-		if ( isset( $forms->posts ) ) {
675
+		if (isset($forms->posts)) {
676 676
 			$total = 0;
677
-			foreach ( $forms->posts as $post ) {
678
-				$form_earning = give_get_meta( $post, '_give_form_earnings', true );
679
-				$form_earning = ! empty( $form_earning ) ? $form_earning : 0;
677
+			foreach ($forms->posts as $post) {
678
+				$form_earning = give_get_meta($post, '_give_form_earnings', true);
679
+				$form_earning = ! empty($form_earning) ? $form_earning : 0;
680 680
 
681 681
 				/**
682 682
 				 * Update Form earnings.
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 				 * @param int $post Form ID.
687 687
 				 * @param string $form_earning Total earning of Form.
688 688
 				 */
689
-				$total += apply_filters( 'give_totals_form_earning', $form_earning, $post );
689
+				$total += apply_filters('give_totals_form_earning', $form_earning, $post);
690 690
 			}
691 691
 		}
692 692
 
@@ -694,23 +694,23 @@  discard block
 block discarded – undo
694 694
 
695 695
 	// Append link with text.
696 696
 	$donate_link = '';
697
-	if ( ! empty( $atts['link'] ) ) {
698
-		$donate_link = sprintf( ' <a class="give-totals-text-link" href="%1$s">%2$s</a>', esc_url( $atts['link'] ), esc_html( $atts['link_text'] ) );
697
+	if ( ! empty($atts['link'])) {
698
+		$donate_link = sprintf(' <a class="give-totals-text-link" href="%1$s">%2$s</a>', esc_url($atts['link']), esc_html($atts['link_text']));
699 699
 	}
700 700
 
701 701
 	// Replace {total} in message.
702
-	$message = str_replace( '{total}', give_currency_filter(
703
-		give_format_amount( $total,
704
-			array( 'sanitize' => false )
702
+	$message = str_replace('{total}', give_currency_filter(
703
+		give_format_amount($total,
704
+			array('sanitize' => false)
705 705
 		)
706
-	), esc_html( $atts['message'] ) );
706
+	), esc_html($atts['message']));
707 707
 
708 708
 	// Replace {total_goal} in message.
709
-	$message = str_replace( '{total_goal}', give_currency_filter(
710
-		give_format_amount( $total_goal,
711
-			array( 'sanitize' => true )
709
+	$message = str_replace('{total_goal}', give_currency_filter(
710
+		give_format_amount($total_goal,
711
+			array('sanitize' => true)
712 712
 		)
713
-	), $message );
713
+	), $message);
714 714
 
715 715
 	/**
716 716
 	 * Update Give totals shortcode output.
@@ -720,19 +720,19 @@  discard block
 block discarded – undo
720 720
 	 * @param string $message Shortcode Message.
721 721
 	 * @param array $atts ShortCode attributes.
722 722
 	 */
723
-	$message = apply_filters( 'give_totals_shortcode_message', $message, $atts );
723
+	$message = apply_filters('give_totals_shortcode_message', $message, $atts);
724 724
 
725 725
 	ob_start();
726 726
 	?>
727 727
 	<div class="give-totals-shortcode-wrap">
728 728
 		<?php
729 729
 		// Show Progress Bar if progress_bar set true.
730
-		$show_progress_bar = isset( $atts['progress_bar'] ) ? filter_var( $atts['progress_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
731
-		if ( $show_progress_bar ) {
732
-			give_show_goal_totals_progress( $total, $total_goal );
730
+		$show_progress_bar = isset($atts['progress_bar']) ? filter_var($atts['progress_bar'], FILTER_VALIDATE_BOOLEAN) : true;
731
+		if ($show_progress_bar) {
732
+			give_show_goal_totals_progress($total, $total_goal);
733 733
 		}
734 734
 
735
-		echo sprintf( $message ) . $donate_link;
735
+		echo sprintf($message).$donate_link;
736 736
 		?>
737 737
 	</div>
738 738
 	<?php
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 	 * @param array  $atts               shortcode attribute.
748 748
 	 * @param string $give_totals_output shortcode output.
749 749
 	 */
750
-	do_action( 'give_totals_goal_shortcode_after_render', $atts, $give_totals_output );
750
+	do_action('give_totals_goal_shortcode_after_render', $atts, $give_totals_output);
751 751
 
752 752
 	/**
753 753
 	 * Give Totals Shortcode output.
@@ -756,11 +756,11 @@  discard block
 block discarded – undo
756 756
 	 *
757 757
 	 * @param string $give_totals_output
758 758
 	 */
759
-	return apply_filters( 'give_totals_shortcode_output', $give_totals_output );
759
+	return apply_filters('give_totals_shortcode_output', $give_totals_output);
760 760
 
761 761
 }
762 762
 
763
-add_shortcode( 'give_totals', 'give_totals_shortcode' );
763
+add_shortcode('give_totals', 'give_totals_shortcode');
764 764
 
765 765
 
766 766
 /**
@@ -791,11 +791,11 @@  discard block
 block discarded – undo
791 791
  * }
792 792
  * @return string|bool The markup of the form grid or false.
793 793
  */
794
-function give_form_grid_shortcode( $atts ) {
794
+function give_form_grid_shortcode($atts) {
795 795
 
796 796
 	$give_settings = give_get_settings();
797 797
 
798
-	$atts = shortcode_atts( array(
798
+	$atts = shortcode_atts(array(
799 799
 		'forms_per_page'      => 12,
800 800
 		'paged'               => true,
801 801
 		'ids'                 => '',
@@ -812,11 +812,11 @@  discard block
 block discarded – undo
812 812
 		'excerpt_length'      => 16,
813 813
 		'display_style'       => 'modal_reveal',
814 814
 		'status'              => '', // open or closed
815
-	), $atts );
815
+	), $atts);
816 816
 
817 817
 	// Validate integer attributes.
818
-	$atts['forms_per_page'] = intval( $atts['forms_per_page'] );
819
-	$atts['excerpt_length'] = intval( $atts['excerpt_length'] );
818
+	$atts['forms_per_page'] = intval($atts['forms_per_page']);
819
+	$atts['excerpt_length'] = intval($atts['excerpt_length']);
820 820
 
821 821
 	// Validate boolean attributes.
822 822
 	$boolean_attributes = array(
@@ -827,8 +827,8 @@  discard block
 block discarded – undo
827 827
 		'show_featured_image',
828 828
 	);
829 829
 
830
-	foreach ( $boolean_attributes as $att ) {
831
-		$atts[ $att ] = filter_var( $atts[ $att ], FILTER_VALIDATE_BOOLEAN );
830
+	foreach ($boolean_attributes as $att) {
831
+		$atts[$att] = filter_var($atts[$att], FILTER_VALIDATE_BOOLEAN);
832 832
 	}
833 833
 
834 834
 	// Set default form query args.
@@ -842,9 +842,9 @@  discard block
 block discarded – undo
842 842
 	);
843 843
 
844 844
 	// Filter results of form grid based on form status.
845
-	$form_closed_status = trim( $atts['status'] );
845
+	$form_closed_status = trim($atts['status']);
846 846
 
847
-	if ( ! empty( $form_closed_status ) ) {
847
+	if ( ! empty($form_closed_status)) {
848 848
 		$form_args['meta_query'] = array(
849 849
 			array(
850 850
 				'key'   => '_give_form_status',
@@ -854,25 +854,25 @@  discard block
 block discarded – undo
854 854
 	}
855 855
 
856 856
 	// Maybe add pagination.
857
-	if ( true === $atts['paged'] ) {
858
-		$form_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
857
+	if (true === $atts['paged']) {
858
+		$form_args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1;
859 859
 	}
860 860
 
861 861
 	// Maybe filter forms by IDs.
862
-	if ( ! empty( $atts['ids'] ) ) {
863
-		$form_args['post__in'] = array_filter( array_map( 'trim', explode( ',', $atts['ids'] ) ) );
862
+	if ( ! empty($atts['ids'])) {
863
+		$form_args['post__in'] = array_filter(array_map('trim', explode(',', $atts['ids'])));
864 864
 	}
865 865
 
866 866
 	// Convert comma-separated form IDs into array.
867
-	if ( ! empty( $atts['exclude'] ) ) {
868
-		$form_args['post__not_in'] = array_filter( array_map( function( $item ) {
869
-			return intval( trim( $item ) );
870
-		}, explode( ',', $atts['exclude'] ) ) );
867
+	if ( ! empty($atts['exclude'])) {
868
+		$form_args['post__not_in'] = array_filter(array_map(function($item) {
869
+			return intval(trim($item));
870
+		}, explode(',', $atts['exclude'])));
871 871
 	}
872 872
 
873 873
 	// Maybe filter by form category.
874
-	if ( ! empty( $atts['cats'] ) ) {
875
-		$cats                     = array_filter( array_map( 'trim', explode( ',', $atts['cats'] ) ) );
874
+	if ( ! empty($atts['cats'])) {
875
+		$cats                     = array_filter(array_map('trim', explode(',', $atts['cats'])));
876 876
 		$tax_query                = array(
877 877
 			'taxonomy' => 'give_forms_category',
878 878
 			'terms'    => $cats,
@@ -881,8 +881,8 @@  discard block
 block discarded – undo
881 881
 	}
882 882
 
883 883
 	// Maybe filter by form tag.
884
-	if ( ! empty( $atts['tags'] ) ) {
885
-		$tags                     = array_filter( array_map( 'trim', explode( ',', $atts['tags'] ) ) );
884
+	if ( ! empty($atts['tags'])) {
885
+		$tags                     = array_filter(array_map('trim', explode(',', $atts['tags'])));
886 886
 		$tax_query                = array(
887 887
 			'taxonomy' => 'give_forms_tag',
888 888
 			'terms'    => $tags,
@@ -891,24 +891,24 @@  discard block
 block discarded – undo
891 891
 	}
892 892
 
893 893
 	// Query to output donation forms.
894
-	$form_query = new WP_Query( $form_args );
894
+	$form_query = new WP_Query($form_args);
895 895
 
896
-	if ( $form_query->have_posts() ) {
896
+	if ($form_query->have_posts()) {
897 897
 		ob_start();
898 898
 
899
-		add_filter( 'add_give_goal_progress_class', 'add_give_goal_progress_class', 10, 1 );
900
-		add_filter( 'add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class', 10, 1 );
901
-		add_filter( 'give_form_wrap_classes', 'add_class_for_form_grid', 10, 3 );
902
-		add_action( 'give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10, 3 );
899
+		add_filter('add_give_goal_progress_class', 'add_give_goal_progress_class', 10, 1);
900
+		add_filter('add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class', 10, 1);
901
+		add_filter('give_form_wrap_classes', 'add_class_for_form_grid', 10, 3);
902
+		add_action('give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10, 3);
903 903
 
904 904
 		echo '<div class="give-wrap">';
905
-		echo '<div class="give-grid give-grid--' . esc_attr( $atts['columns'] ) . '">';
905
+		echo '<div class="give-grid give-grid--'.esc_attr($atts['columns']).'">';
906 906
 
907
-		while ( $form_query->have_posts() ) {
907
+		while ($form_query->have_posts()) {
908 908
 			$form_query->the_post();
909 909
 
910 910
 			// Give/templates/shortcode-form-grid.php.
911
-			give_get_template( 'shortcode-form-grid', array( $give_settings, $atts ) );
911
+			give_get_template('shortcode-form-grid', array($give_settings, $atts));
912 912
 
913 913
 		}
914 914
 
@@ -916,28 +916,28 @@  discard block
 block discarded – undo
916 916
 
917 917
 		echo '</div><!-- .give-grid -->';
918 918
 
919
-		remove_filter( 'add_give_goal_progress_class', 'add_give_goal_progress_class' );
920
-		remove_filter( 'add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class' );
921
-		remove_filter( 'give_form_wrap_classes', 'add_class_for_form_grid', 10 );
922
-		remove_action( 'give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10 );
919
+		remove_filter('add_give_goal_progress_class', 'add_give_goal_progress_class');
920
+		remove_filter('add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class');
921
+		remove_filter('give_form_wrap_classes', 'add_class_for_form_grid', 10);
922
+		remove_action('give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10);
923 923
 
924
-		if ( false !== $atts['paged'] ) {
924
+		if (false !== $atts['paged']) {
925 925
 			$paginate_args = array(
926
-				'current'   => max( 1, get_query_var( 'paged' ) ),
926
+				'current'   => max(1, get_query_var('paged')),
927 927
 				'total'     => $form_query->max_num_pages,
928 928
 				'show_all'  => false,
929 929
 				'end_size'  => 1,
930 930
 				'mid_size'  => 2,
931 931
 				'prev_next' => true,
932
-				'prev_text' => __( '« Previous', 'give' ),
933
-				'next_text' => __( 'Next »', 'give' ),
932
+				'prev_text' => __('« Previous', 'give'),
933
+				'next_text' => __('Next »', 'give'),
934 934
 				'type'      => 'plain',
935 935
 				'add_args'  => false,
936 936
 			);
937 937
 
938 938
 			printf(
939 939
 				'<div class="give-page-numbers">%s</div>',
940
-				paginate_links( $paginate_args )
940
+				paginate_links($paginate_args)
941 941
 			);
942 942
 		}
943 943
 		echo '</div><!-- .give-wrap -->';
@@ -946,4 +946,4 @@  discard block
 block discarded – undo
946 946
 	}
947 947
 }
948 948
 
949
-add_shortcode( 'give_form_grid', 'give_form_grid_shortcode' );
949
+add_shortcode('give_form_grid', 'give_form_grid_shortcode');
Please login to merge, or discard this patch.