Test Failed
Pull Request — master (#3324)
by Devin
07:59
created
give.php 1 patch
Spacing   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
  */
40 40
 
41 41
 // Exit if accessed directly.
42
-if ( ! defined( 'ABSPATH' ) ) {
42
+if ( ! defined('ABSPATH')) {
43 43
 	exit;
44 44
 }
45 45
 
46
-if ( ! class_exists( 'Give' ) ) :
46
+if ( ! class_exists('Give')) :
47 47
 
48 48
 	/**
49 49
 	 * Main Give Class
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		 * @return    Give
262 262
 		 */
263 263
 		public static function instance() {
264
-			if ( is_null( self::$_instance ) ) {
264
+			if (is_null(self::$_instance)) {
265 265
 				self::$_instance = new self();
266 266
 			}
267 267
 
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
 		 */
274 274
 		public function __construct() {
275 275
 			// PHP version
276
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
277
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
276
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
277
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
278 278
 			}
279 279
 
280 280
 			// Bailout: Need minimum php version to load plugin.
281
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
282
-				add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) );
281
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
282
+				add_action('admin_notices', array($this, 'minimum_phpversion_notice'));
283 283
 
284 284
 				return;
285 285
 			}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 			$this->includes();
289 289
 			$this->init_hooks();
290 290
 
291
-			do_action( 'give_loaded' );
291
+			do_action('give_loaded');
292 292
 		}
293 293
 
294 294
 		/**
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 		 * @since  1.8.9
298 298
 		 */
299 299
 		private function init_hooks() {
300
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
301
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
300
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
301
+			add_action('plugins_loaded', array($this, 'init'), 0);
302 302
 
303 303
 			// Set up localization on init Hook.
304
-			add_action( 'init', array( $this, 'load_textdomain' ), 0 );
304
+			add_action('init', array($this, 'load_textdomain'), 0);
305 305
 		}
306 306
 
307 307
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 			 *
318 318
 			 * @since 1.8.9
319 319
 			 */
320
-			do_action( 'before_give_init' );
320
+			do_action('before_give_init');
321 321
 
322 322
 			// Set up localization.
323 323
 			$this->load_textdomain();
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 			 *
351 351
 			 * @since 1.8.7
352 352
 			 */
353
-			do_action( 'give_init', $this );
353
+			do_action('give_init', $this);
354 354
 
355 355
 		}
356 356
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 		 */
368 368
 		public function __clone() {
369 369
 			// Cloning instances of the class is forbidden.
370
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
370
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
371 371
 		}
372 372
 
373 373
 		/**
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 		 */
381 381
 		public function __wakeup() {
382 382
 			// Unserializing instances of the class is forbidden.
383
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
383
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
384 384
 		}
385 385
 
386 386
 		/**
@@ -394,33 +394,33 @@  discard block
 block discarded – undo
394 394
 		private function setup_constants() {
395 395
 
396 396
 			// Plugin version
397
-			if ( ! defined( 'GIVE_VERSION' ) ) {
398
-				define( 'GIVE_VERSION', '2.1.4' );
397
+			if ( ! defined('GIVE_VERSION')) {
398
+				define('GIVE_VERSION', '2.1.4');
399 399
 			}
400 400
 
401 401
 			// Plugin Root File
402
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
403
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
402
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
403
+				define('GIVE_PLUGIN_FILE', __FILE__);
404 404
 			}
405 405
 
406 406
 			// Plugin Folder Path
407
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
408
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
407
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
408
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
409 409
 			}
410 410
 
411 411
 			// Plugin Folder URL
412
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
413
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
412
+			if ( ! defined('GIVE_PLUGIN_URL')) {
413
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
414 414
 			}
415 415
 
416 416
 			// Plugin Basename aka: "give/give.php"
417
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
418
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
417
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
418
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
419 419
 			}
420 420
 
421 421
 			// Make sure CAL_GREGORIAN is defined
422
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
423
-				define( 'CAL_GREGORIAN', 1 );
422
+			if ( ! defined('CAL_GREGORIAN')) {
423
+				define('CAL_GREGORIAN', 1);
424 424
 			}
425 425
 		}
426 426
 
@@ -438,161 +438,161 @@  discard block
 block discarded – undo
438 438
 			/**
439 439
 			 * Load libraries.
440 440
 			 */
441
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
442
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
441
+			if ( ! class_exists('WP_Async_Request')) {
442
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
443 443
 			}
444 444
 
445
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
446
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
445
+			if ( ! class_exists('WP_Background_Process')) {
446
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
447 447
 			}
448 448
 
449 449
 			/**
450 450
 			 * Load plugin files
451 451
 			 */
452
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
453
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
452
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
453
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
454 454
 			$give_options = give_get_settings();
455 455
 
456
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
457
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
458
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
459
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
460
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
461
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
462
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
463
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
464
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
465
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php';
466
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
467
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
468
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
469
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-readme-parser.php';
470
-
471
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php';
472
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
473
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
474
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
475
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
476
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
477
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
478
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
479
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
480
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
481
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
482
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
484
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
485
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
486
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
488
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php';
489
-
490
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
491
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
492
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
497
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
498
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
499
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
500
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
501
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
502
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
503
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
504
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
505
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
506
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
507
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
508
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
509
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
510
-
511
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
512
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
513
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
514
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
515
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
516
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
517
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php';
518
-
519
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
520
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
521
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
522
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
523
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
524
-
525
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
526
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
527
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
528
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
529
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
530
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
531
-
532
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
533
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
534
-
535
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
536
-
537
-			require_once GIVE_PLUGIN_DIR . 'blocks/load.php';
538
-
539
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
540
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
456
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
457
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
458
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
459
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
460
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
461
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
462
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
463
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
464
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
465
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php';
466
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
467
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
468
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
469
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-readme-parser.php';
470
+
471
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php';
472
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
473
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
474
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
475
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
476
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
477
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
478
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
479
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
480
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
481
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
484
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
485
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
486
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
488
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php';
489
+
490
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
491
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
492
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
497
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
498
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
499
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
500
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
501
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
502
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
503
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
504
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
505
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
506
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
507
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
508
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
509
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
510
+
511
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
512
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
513
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
514
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
515
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
516
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
517
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php';
518
+
519
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
520
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
521
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
522
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
523
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
524
+
525
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
526
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
527
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
528
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
529
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
530
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
531
+
532
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
533
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
534
+
535
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
536
+
537
+			require_once GIVE_PLUGIN_DIR.'blocks/load.php';
538
+
539
+			if (defined('WP_CLI') && WP_CLI) {
540
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
541 541
 			}
542 542
 
543
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
544
-
545
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
546
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
547
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
548
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
549
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
550
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
551
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
552
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
553
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
554
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
555
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
556
-
557
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
558
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
559
-
560
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
561
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
562
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
563
-
564
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
565
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
566
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
567
-
568
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
569
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
570
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
571
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
572
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php';
573
-
574
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
575
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
576
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
577
-
578
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
579
-
580
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
581
-
582
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
583
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
584
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
585
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
586
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
587
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
588
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
589
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php';
590
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
591
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
592
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php';
543
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
544
+
545
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
546
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
547
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
548
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
549
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
550
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
551
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
552
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
553
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
554
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
555
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
556
+
557
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
558
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
559
+
560
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
561
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
562
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
563
+
564
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
565
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
566
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
567
+
568
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
569
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
570
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
571
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
572
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php';
573
+
574
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
575
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
576
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
577
+
578
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
579
+
580
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
581
+
582
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
583
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
584
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
585
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
586
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
587
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
588
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
589
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php';
590
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
591
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
592
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php';
593 593
 			}// End if().
594 594
 
595
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
595
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
596 596
 
597 597
 		}
598 598
 
@@ -607,16 +607,16 @@  discard block
 block discarded – undo
607 607
 		public function load_textdomain() {
608 608
 
609 609
 			// Set filter for Give's languages directory
610
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
611
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
610
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
611
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
612 612
 
613 613
 			// Traditional WordPress plugin locale filter.
614
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
615
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
614
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
615
+			$locale = apply_filters('plugin_locale', $locale, 'give');
616 616
 
617
-			unload_textdomain( 'give' );
618
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
619
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
617
+			unload_textdomain('give');
618
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
619
+			load_plugin_textdomain('give', false, $give_lang_dir);
620 620
 
621 621
 		}
622 622
 
@@ -629,21 +629,21 @@  discard block
 block discarded – undo
629 629
 		 */
630 630
 		public function minimum_phpversion_notice() {
631 631
 			// Bailout.
632
-			if ( ! is_admin() ) {
632
+			if ( ! is_admin()) {
633 633
 				return;
634 634
 			}
635 635
 
636
-			$notice_desc  = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
637
-			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
638
-			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
639
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
640
-			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
641
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
642
-			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
636
+			$notice_desc  = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
637
+			$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
638
+			$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
639
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
640
+			$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
641
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
642
+			$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
643 643
 
644 644
 			echo sprintf(
645 645
 				'<div class="notice notice-error">%1$s</div>',
646
-				wp_kses_post( $notice_desc )
646
+				wp_kses_post($notice_desc)
647 647
 			);
648 648
 		}
649 649
 
Please login to merge, or discard this patch.
includes/payments/class-give-payment.php 1 patch
Spacing   +274 added lines, -275 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
 
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
 	 *
396 396
 	 * @return mixed void|false
397 397
 	 */
398
-	public function __construct( $payment_id = false ) {
398
+	public function __construct($payment_id = false) {
399 399
 
400
-		if ( empty( $payment_id ) ) {
400
+		if (empty($payment_id)) {
401 401
 			return false;
402 402
 		}
403 403
 
404
-		$this->setup_payment( $payment_id );
404
+		$this->setup_payment($payment_id);
405 405
 	}
406 406
 
407 407
 	/**
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @return mixed        The value.
416 416
 	 */
417
-	public function __get( $key ) {
417
+	public function __get($key) {
418 418
 
419
-		if ( method_exists( $this, 'get_' . $key ) ) {
419
+		if (method_exists($this, 'get_'.$key)) {
420 420
 
421
-			$value = call_user_func( array( $this, 'get_' . $key ) );
421
+			$value = call_user_func(array($this, 'get_'.$key));
422 422
 
423 423
 		} else {
424 424
 
@@ -440,18 +440,18 @@  discard block
 block discarded – undo
440 440
 	 * @param  string $key   The property name
441 441
 	 * @param  mixed  $value The value of the property
442 442
 	 */
443
-	public function __set( $key, $value ) {
444
-		$ignore = array( '_ID' );
443
+	public function __set($key, $value) {
444
+		$ignore = array('_ID');
445 445
 
446
-		if ( 'status' === $key ) {
446
+		if ('status' === $key) {
447 447
 			$this->old_status = $this->status;
448 448
 		}
449 449
 
450
-		if ( ! in_array( $key, $ignore ) ) {
451
-			$this->pending[ $key ] = $value;
450
+		if ( ! in_array($key, $ignore)) {
451
+			$this->pending[$key] = $value;
452 452
 		}
453 453
 
454
-		if ( '_ID' !== $key ) {
454
+		if ('_ID' !== $key) {
455 455
 			$this->$key = $value;
456 456
 		}
457 457
 	}
@@ -466,9 +466,9 @@  discard block
 block discarded – undo
466 466
 	 *
467 467
 	 * @return boolean|null       If the item is set or not
468 468
 	 */
469
-	public function __isset( $name ) {
470
-		if ( property_exists( $this, $name ) ) {
471
-			return false === empty( $this->$name );
469
+	public function __isset($name) {
470
+		if (property_exists($this, $name)) {
471
+			return false === empty($this->$name);
472 472
 		} else {
473 473
 			return null;
474 474
 		}
@@ -484,20 +484,20 @@  discard block
 block discarded – undo
484 484
 	 *
485 485
 	 * @return bool            If the setup was successful or not
486 486
 	 */
487
-	private function setup_payment( $payment_id ) {
487
+	private function setup_payment($payment_id) {
488 488
 		$this->pending = array();
489 489
 
490
-		if ( empty( $payment_id ) ) {
490
+		if (empty($payment_id)) {
491 491
 			return false;
492 492
 		}
493 493
 
494
-		$payment = get_post( absint( $payment_id ) );
494
+		$payment = get_post(absint($payment_id));
495 495
 
496
-		if ( ! $payment || is_wp_error( $payment ) ) {
496
+		if ( ! $payment || is_wp_error($payment)) {
497 497
 			return false;
498 498
 		}
499 499
 
500
-		if ( 'give_payment' !== $payment->post_type ) {
500
+		if ('give_payment' !== $payment->post_type) {
501 501
 			return false;
502 502
 		}
503 503
 
@@ -511,17 +511,17 @@  discard block
 block discarded – undo
511 511
 		 * @param Give_Payment $this       Payment object.
512 512
 		 * @param int          $payment_id The ID of the payment.
513 513
 		 */
514
-		do_action( 'give_pre_setup_payment', $this, $payment_id );
514
+		do_action('give_pre_setup_payment', $this, $payment_id);
515 515
 
516 516
 		// Get payment from cache.
517
-		$donation_vars = Give_Cache::get_group( $payment_id, 'give-donations' );
517
+		$donation_vars = Give_Cache::get_group($payment_id, 'give-donations');
518 518
 
519
-		if ( is_null( $donation_vars ) ) {
519
+		if (is_null($donation_vars)) {
520 520
 			// Primary Identifier.
521
-			$this->ID = absint( $payment_id );
521
+			$this->ID = absint($payment_id);
522 522
 
523 523
 			// Protected ID that can never be changed.
524
-			$this->_ID = absint( $payment_id );
524
+			$this->_ID = absint($payment_id);
525 525
 
526 526
 			// We have a payment, get the generic payment_meta item to reduce calls to it.
527 527
 			$this->payment_meta = $this->get_meta();
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 			$this->parent_payment = $payment->post_parent;
538 538
 
539 539
 			$all_payment_statuses  = give_get_payment_statuses();
540
-			$this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status );
540
+			$this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status);
541 541
 
542 542
 			// Currency Based.
543 543
 			$this->total    = $this->setup_total();
@@ -566,10 +566,10 @@  discard block
 block discarded – undo
566 566
 			$this->key        = $this->setup_payment_key();
567 567
 			$this->number     = $this->setup_payment_number();
568 568
 
569
-			Give_Cache::set_group( $this->ID, get_object_vars( $this ), 'give-donations' );
569
+			Give_Cache::set_group($this->ID, get_object_vars($this), 'give-donations');
570 570
 		} else {
571 571
 
572
-			foreach ( $donation_vars as $donation_var => $value ) {
572
+			foreach ($donation_vars as $donation_var => $value) {
573 573
 				$this->$donation_var = $value;
574 574
 			}
575 575
 		}
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 		 * @param Give_Payment $this       Payment object.
585 585
 		 * @param int          $payment_id The ID of the payment.
586 586
 		 */
587
-		do_action( 'give_setup_payment', $this, $payment_id );
587
+		do_action('give_setup_payment', $this, $payment_id);
588 588
 
589 589
 		return true;
590 590
 	}
@@ -603,11 +603,11 @@  discard block
 block discarded – undo
603 603
 	 *
604 604
 	 * @return void
605 605
 	 */
606
-	public function update_payment_setup( $payment_id ) {
606
+	public function update_payment_setup($payment_id) {
607 607
 		// Delete cache.
608
-		Give_Cache::delete_group( $this->ID,'give-donations' );
608
+		Give_Cache::delete_group($this->ID, 'give-donations');
609 609
 
610
-		$this->setup_payment( $payment_id );
610
+		$this->setup_payment($payment_id);
611 611
 	}
612 612
 
613 613
 	/**
@@ -622,24 +622,24 @@  discard block
 block discarded – undo
622 622
 
623 623
 		// Construct the payment title.
624 624
 		$payment_title = '';
625
-		if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) {
626
-			$payment_title = $this->first_name . ' ' . $this->last_name;
627
-		} elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) {
625
+		if ( ! empty($this->first_name) && ! empty($this->last_name)) {
626
+			$payment_title = $this->first_name.' '.$this->last_name;
627
+		} elseif ( ! empty($this->first_name) && empty($this->last_name)) {
628 628
 			$payment_title = $this->first_name;
629
-		} elseif ( ! empty( $this->email ) && is_email( $this->email ) ) {
629
+		} elseif ( ! empty($this->email) && is_email($this->email)) {
630 630
 			$payment_title = $this->email;
631 631
 		}
632 632
 
633 633
 		// Set Key.
634
-		if ( empty( $this->key ) ) {
634
+		if (empty($this->key)) {
635 635
 
636
-			$auth_key             = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
637
-			$this->key            = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );  // Unique key
636
+			$auth_key             = defined('AUTH_KEY') ? AUTH_KEY : '';
637
+			$this->key            = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key
638 638
 			$this->pending['key'] = $this->key;
639 639
 		}
640 640
 
641 641
 		// Set IP.
642
-		if ( empty( $this->ip ) ) {
642
+		if (empty($this->ip)) {
643 643
 
644 644
 			$this->ip            = give_get_ip();
645 645
 			$this->pending['ip'] = $this->ip;
@@ -668,19 +668,19 @@  discard block
 block discarded – undo
668 668
 			'status'       => $this->status,
669 669
 		);
670 670
 
671
-		$args = apply_filters( 'give_insert_payment_args', array(
671
+		$args = apply_filters('give_insert_payment_args', array(
672 672
 			'post_title'    => $payment_title,
673 673
 			'post_status'   => $this->status,
674 674
 			'post_type'     => 'give_payment',
675
-			'post_date'     => ! empty( $this->date ) ? $this->date : null,
676
-			'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null,
675
+			'post_date'     => ! empty($this->date) ? $this->date : null,
676
+			'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null,
677 677
 			'post_parent'   => $this->parent_payment,
678
-		), $payment_data );
678
+		), $payment_data);
679 679
 
680 680
 		// Create a blank payment
681
-		$payment_id = wp_insert_post( $args );
681
+		$payment_id = wp_insert_post($args);
682 682
 
683
-		if ( ! empty( $payment_id ) ) {
683
+		if ( ! empty($payment_id)) {
684 684
 
685 685
 			$this->ID  = $payment_id;
686 686
 			$this->_ID = $payment_id;
@@ -692,42 +692,42 @@  discard block
 block discarded – undo
692 692
 			 *
693 693
 			 * @since 1.8.13
694 694
 			 */
695
-			$donor = apply_filters( 'give_update_donor_information', $donor, $payment_id, $payment_data, $args );
695
+			$donor = apply_filters('give_update_donor_information', $donor, $payment_id, $payment_data, $args);
696 696
 
697
-			if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) {
698
-				$donor = new Give_Donor( get_current_user_id(), true );
697
+			if (did_action('give_pre_process_donation') && is_user_logged_in()) {
698
+				$donor = new Give_Donor(get_current_user_id(), true);
699 699
 
700 700
 				// Donor is logged in but used a different email to purchase with so assign to their donor record.
701
-				if ( ! empty( $donor->id ) && $this->email !== $donor->email ) {
702
-					$donor->add_email( $this->email );
701
+				if ( ! empty($donor->id) && $this->email !== $donor->email) {
702
+					$donor->add_email($this->email);
703 703
 				}
704 704
 			}
705 705
 
706
-			if ( empty( $donor->id ) ) {
707
-				$donor = new Give_Donor( $this->email );
706
+			if (empty($donor->id)) {
707
+				$donor = new Give_Donor($this->email);
708 708
 			}
709 709
 
710
-			if ( empty( $donor->id ) ) {
710
+			if (empty($donor->id)) {
711 711
 
712 712
 				$donor_data = array(
713
-					'name'    => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '',
713
+					'name'    => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '',
714 714
 					'email'   => $this->email,
715 715
 					'user_id' => $this->user_id,
716 716
 				);
717 717
 
718
-				$donor->create( $donor_data );
718
+				$donor->create($donor_data);
719 719
 
720 720
 			}
721 721
 
722 722
 			// Update Donor Meta once donor is created.
723
-			$donor->update_meta( '_give_donor_first_name', $this->first_name );
724
-			$donor->update_meta( '_give_donor_last_name', $this->last_name );
723
+			$donor->update_meta('_give_donor_first_name', $this->first_name);
724
+			$donor->update_meta('_give_donor_last_name', $this->last_name);
725 725
 
726 726
 			$this->customer_id            = $donor->id;
727 727
 			$this->pending['customer_id'] = $this->customer_id;
728
-			$donor->attach_payment( $this->ID, false );
728
+			$donor->attach_payment($this->ID, false);
729 729
 
730
-			$this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data );
730
+			$this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data);
731 731
 
732 732
 			/*
733 733
 			 * _give_payment_meta backward compatibility.
@@ -735,25 +735,25 @@  discard block
 block discarded – undo
735 735
 			 * @since 2.0.1
736 736
 			 */
737 737
 			$custom_payment_meta = array_diff(
738
-				array_map( 'maybe_serialize', $this->payment_meta ),
739
-				array_map( 'maybe_serialize', $payment_data )
738
+				array_map('maybe_serialize', $this->payment_meta),
739
+				array_map('maybe_serialize', $payment_data)
740 740
 			);
741 741
 
742
-			if( ! empty( $custom_payment_meta ) ) {
743
-				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' );
742
+			if ( ! empty($custom_payment_meta)) {
743
+				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');
744 744
 
745
-				$this->update_meta( '_give_payment_meta', array_map( 'maybe_unserialize', $custom_payment_meta ) );
745
+				$this->update_meta('_give_payment_meta', array_map('maybe_unserialize', $custom_payment_meta));
746 746
 			}
747 747
 
748
-			$give_company = ( ! empty( $_REQUEST['give_company_name'] ) ? give_clean( $_REQUEST['give_company_name'] ) : '' );
748
+			$give_company = ( ! empty($_REQUEST['give_company_name']) ? give_clean($_REQUEST['give_company_name']) : '');
749 749
 
750 750
 			// Check $page_url is not empty.
751
-			if ( $give_company ) {
752
-				give_update_meta( $payment_id, '_give_donation_company', $give_company );
751
+			if ($give_company) {
752
+				give_update_meta($payment_id, '_give_donation_company', $give_company);
753 753
 
754
-				$donor_id = absint( $donor->id );
755
-				if ( ! empty( $donor_id ) ) {
756
-					Give()->donor_meta->update_meta( $donor_id, '_give_donor_company', $give_company );
754
+				$donor_id = absint($donor->id);
755
+				if ( ! empty($donor_id)) {
756
+					Give()->donor_meta->update_meta($donor_id, '_give_donor_company', $give_company);
757 757
 				}
758 758
 			}
759 759
 
@@ -777,11 +777,11 @@  discard block
 block discarded – undo
777 777
 		$saved = false;
778 778
 
779 779
 		// Must have an ID.
780
-		if ( empty( $this->ID ) ) {
780
+		if (empty($this->ID)) {
781 781
 
782 782
 			$payment_id = $this->insert_payment();
783 783
 
784
-			if ( false === $payment_id ) {
784
+			if (false === $payment_id) {
785 785
 				$saved = false;
786 786
 			} else {
787 787
 				$this->ID = $payment_id;
@@ -789,42 +789,42 @@  discard block
 block discarded – undo
789 789
 		}
790 790
 
791 791
 		// Set ID if not matching.
792
-		if ( $this->ID !== $this->_ID ) {
792
+		if ($this->ID !== $this->_ID) {
793 793
 			$this->ID = $this->_ID;
794 794
 		}
795 795
 
796 796
 		// If we have something pending, let's save it.
797
-		if ( ! empty( $this->pending ) ) {
797
+		if ( ! empty($this->pending)) {
798 798
 
799 799
 			$total_increase = 0;
800 800
 			$total_decrease = 0;
801 801
 
802
-			foreach ( $this->pending as $key => $value ) {
802
+			foreach ($this->pending as $key => $value) {
803 803
 
804
-				switch ( $key ) {
804
+				switch ($key) {
805 805
 
806 806
 					case 'donations':
807 807
 						// Update totals for pending donations.
808
-						foreach ( $this->pending[ $key ] as $item ) {
808
+						foreach ($this->pending[$key] as $item) {
809 809
 
810
-							$quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1;
811
-							$price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0;
810
+							$quantity = isset($item['quantity']) ? $item['quantity'] : 1;
811
+							$price_id = isset($item['price_id']) ? $item['price_id'] : 0;
812 812
 
813
-							switch ( $item['action'] ) {
813
+							switch ($item['action']) {
814 814
 
815 815
 								case 'add':
816 816
 
817 817
 									$price = $item['price'];
818 818
 
819
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
819
+									if ('publish' === $this->status || 'complete' === $this->status) {
820 820
 
821 821
 										// Add donation to logs.
822
-										$log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) );
823
-										give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date );
822
+										$log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp'));
823
+										give_record_donation_in_log($item['id'], $this->ID, $price_id, $log_date);
824 824
 
825
-										$form = new Give_Donate_Form( $item['id'] );
826
-										$form->increase_sales( $quantity );
827
-										$form->increase_earnings( $price, $this->ID );
825
+										$form = new Give_Donate_Form($item['id']);
826
+										$form->increase_sales($quantity);
827
+										$form->increase_earnings($price, $this->ID);
828 828
 
829 829
 										$total_increase += $price;
830 830
 									}
@@ -832,10 +832,10 @@  discard block
 block discarded – undo
832 832
 
833 833
 								case 'remove':
834 834
 									$this->delete_sales_logs();
835
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
836
-										$form = new Give_Donate_Form( $item['id'] );
837
-										$form->decrease_sales( $quantity );
838
-										$form->decrease_earnings( $item['amount'], $this->ID );
835
+									if ('publish' === $this->status || 'complete' === $this->status) {
836
+										$form = new Give_Donate_Form($item['id']);
837
+										$form->decrease_sales($quantity);
838
+										$form->decrease_earnings($item['amount'], $this->ID);
839 839
 
840 840
 										$total_decrease += $item['amount'];
841 841
 									}
@@ -846,27 +846,27 @@  discard block
 block discarded – undo
846 846
 						break;
847 847
 
848 848
 					case 'status':
849
-						$this->update_status( $this->status );
849
+						$this->update_status($this->status);
850 850
 						break;
851 851
 
852 852
 					case 'gateway':
853
-						$this->update_meta( '_give_payment_gateway', $this->gateway );
853
+						$this->update_meta('_give_payment_gateway', $this->gateway);
854 854
 						break;
855 855
 
856 856
 					case 'mode':
857
-						$this->update_meta( '_give_payment_mode', $this->mode );
857
+						$this->update_meta('_give_payment_mode', $this->mode);
858 858
 						break;
859 859
 
860 860
 					case 'transaction_id':
861
-						$this->update_meta( '_give_payment_transaction_id', $this->transaction_id );
861
+						$this->update_meta('_give_payment_transaction_id', $this->transaction_id);
862 862
 						break;
863 863
 
864 864
 					case 'ip':
865
-						$this->update_meta( '_give_payment_donor_ip', $this->ip );
865
+						$this->update_meta('_give_payment_donor_ip', $this->ip);
866 866
 						break;
867 867
 
868 868
 					case 'customer_id':
869
-						$this->update_meta( '_give_payment_donor_id', $this->customer_id );
869
+						$this->update_meta('_give_payment_donor_id', $this->customer_id);
870 870
 						break;
871 871
 
872 872
 					// case 'user_id':
@@ -874,61 +874,61 @@  discard block
 block discarded – undo
874 874
 					// 	break;
875 875
 
876 876
 					case 'form_title':
877
-						$this->update_meta( '_give_payment_form_title', $this->form_title );
877
+						$this->update_meta('_give_payment_form_title', $this->form_title);
878 878
 						break;
879 879
 
880 880
 					case 'form_id':
881
-						$this->update_meta( '_give_payment_form_id', $this->form_id );
881
+						$this->update_meta('_give_payment_form_id', $this->form_id);
882 882
 						break;
883 883
 
884 884
 					case 'price_id':
885
-						$this->update_meta( '_give_payment_price_id', $this->price_id );
885
+						$this->update_meta('_give_payment_price_id', $this->price_id);
886 886
 						break;
887 887
 
888 888
 					case 'first_name':
889
-						$this->update_meta( '_give_donor_billing_first_name', $this->first_name );
889
+						$this->update_meta('_give_donor_billing_first_name', $this->first_name);
890 890
 						break;
891 891
 
892 892
 					case 'last_name':
893
-						$this->update_meta( '_give_donor_billing_last_name', $this->last_name );
893
+						$this->update_meta('_give_donor_billing_last_name', $this->last_name);
894 894
 						break;
895 895
 
896 896
 					case 'currency':
897
-						$this->update_meta( '_give_payment_currency', $this->currency );
897
+						$this->update_meta('_give_payment_currency', $this->currency);
898 898
 						break;
899 899
 
900 900
 					case 'address':
901
-						if ( ! empty( $this->address ) ) {
902
-							foreach ( $this->address as $address_name => $address ) {
903
-								switch ( $address_name ) {
901
+						if ( ! empty($this->address)) {
902
+							foreach ($this->address as $address_name => $address) {
903
+								switch ($address_name) {
904 904
 									case 'line1':
905
-										$this->update_meta( '_give_donor_billing_address1', $address );
905
+										$this->update_meta('_give_donor_billing_address1', $address);
906 906
 										break;
907 907
 
908 908
 									case 'line2':
909
-										$this->update_meta( '_give_donor_billing_address2', $address );
909
+										$this->update_meta('_give_donor_billing_address2', $address);
910 910
 										break;
911 911
 
912 912
 									default:
913
-										$this->update_meta( "_give_donor_billing_{$address_name}", $address );
913
+										$this->update_meta("_give_donor_billing_{$address_name}", $address);
914 914
 								}
915 915
 							}
916 916
 						}
917 917
 						break;
918 918
 
919 919
 					case 'email':
920
-						$this->update_meta( '_give_payment_donor_email', $this->email );
920
+						$this->update_meta('_give_payment_donor_email', $this->email);
921 921
 						break;
922 922
 
923 923
 					case 'key':
924
-						$this->update_meta( '_give_payment_purchase_key', $this->key );
924
+						$this->update_meta('_give_payment_purchase_key', $this->key);
925 925
 						break;
926 926
 
927 927
 					case 'number':
928 928
 						// @todo: remove unused meta data.
929 929
 						// Core is using post_title to store donation serial code ( fi enabled ) instead this meta key.
930 930
 						// Do not use this meta key in your logic, can be remove in future
931
-						$this->update_meta( '_give_payment_number', $this->number );
931
+						$this->update_meta('_give_payment_number', $this->number);
932 932
 						break;
933 933
 
934 934
 					case 'date':
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
 							'edit_date' => true,
939 939
 						);
940 940
 
941
-						wp_update_post( $args );
941
+						wp_update_post($args);
942 942
 						break;
943 943
 
944 944
 					case 'completed_date':
945
-						$this->update_meta( '_give_completed_date', $this->completed_date );
945
+						$this->update_meta('_give_completed_date', $this->completed_date);
946 946
 						break;
947 947
 
948 948
 					case 'parent_payment':
@@ -951,11 +951,11 @@  discard block
 block discarded – undo
951 951
 							'post_parent' => $this->parent_payment,
952 952
 						);
953 953
 
954
-						wp_update_post( $args );
954
+						wp_update_post($args);
955 955
 						break;
956 956
 
957 957
 					case 'total':
958
-						$this->update_meta( '_give_payment_total', give_sanitize_amount_for_db( $this->total ) );
958
+						$this->update_meta('_give_payment_total', give_sanitize_amount_for_db($this->total));
959 959
 						break;
960 960
 
961 961
 					default:
@@ -966,46 +966,46 @@  discard block
 block discarded – undo
966 966
 						 *
967 967
 						 * @param Give_Payment $this Payment object.
968 968
 						 */
969
-						do_action( 'give_payment_save', $this, $key );
969
+						do_action('give_payment_save', $this, $key);
970 970
 						break;
971 971
 				}// End switch().
972 972
 			}// End foreach().
973 973
 
974
-			if ( 'pending' !== $this->status ) {
974
+			if ('pending' !== $this->status) {
975 975
 
976
-				$donor = new Give_Donor( $this->customer_id );
976
+				$donor = new Give_Donor($this->customer_id);
977 977
 
978 978
 				$total_change = $total_increase - $total_decrease;
979
-				if ( $total_change < 0 ) {
979
+				if ($total_change < 0) {
980 980
 
981
-					$total_change = - ( $total_change );
981
+					$total_change = - ($total_change);
982 982
 
983 983
 					// Decrease the donor's donation stats.
984
-					$donor->decrease_value( $total_change );
985
-					give_decrease_total_earnings( $total_change );
984
+					$donor->decrease_value($total_change);
985
+					give_decrease_total_earnings($total_change);
986 986
 
987 987
 					$donor->decrease_donation_count();
988 988
 
989
-				} elseif ( $total_change > 0 ) {
989
+				} elseif ($total_change > 0) {
990 990
 
991 991
 					// Increase the donor's donation stats.
992
-					$donor->increase_value( $total_change );
993
-					give_increase_total_earnings( $total_change );
992
+					$donor->increase_value($total_change);
993
+					give_increase_total_earnings($total_change);
994 994
 
995 995
 					$donor->increase_purchase_count();
996 996
 
997 997
 				}
998 998
 
999 999
 				// Verify and update form meta based on the form status.
1000
-				give_set_form_closed_status( $this->form_id );
1000
+				give_set_form_closed_status($this->form_id);
1001 1001
 			}
1002 1002
 
1003 1003
 			$this->pending = array();
1004 1004
 			$saved         = true;
1005 1005
 		}// End if().
1006 1006
 
1007
-		if ( true === $saved ) {
1008
-			$this->setup_payment( $this->ID );
1007
+		if (true === $saved) {
1008
+			$this->setup_payment($this->ID);
1009 1009
 		}
1010 1010
 
1011 1011
 		return $saved;
@@ -1023,12 +1023,12 @@  discard block
 block discarded – undo
1023 1023
 	 *
1024 1024
 	 * @return bool           True when successful, false otherwise
1025 1025
 	 */
1026
-	public function add_donation( $form_id = 0, $args = array(), $options = array() ) {
1026
+	public function add_donation($form_id = 0, $args = array(), $options = array()) {
1027 1027
 
1028
-		$donation = new Give_Donate_Form( $form_id );
1028
+		$donation = new Give_Donate_Form($form_id);
1029 1029
 
1030 1030
 		// Bail if this post isn't a give donation form.
1031
-		if ( ! $donation || $donation->post_type !== 'give_forms' ) {
1031
+		if ( ! $donation || $donation->post_type !== 'give_forms') {
1032 1032
 			return false;
1033 1033
 		}
1034 1034
 
@@ -1038,59 +1038,59 @@  discard block
 block discarded – undo
1038 1038
 			'price_id' => false,
1039 1039
 		);
1040 1040
 
1041
-		$args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults );
1041
+		$args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults);
1042 1042
 
1043 1043
 		// Allow overriding the price.
1044
-		if ( false !== $args['price'] ) {
1044
+		if (false !== $args['price']) {
1045 1045
 			$donation_amount = $args['price'];
1046 1046
 		} else {
1047 1047
 
1048 1048
 			// Deal with variable pricing.
1049
-			if ( give_has_variable_prices( $donation->ID ) ) {
1050
-				$prices          = give_get_meta( $form_id, '_give_donation_levels', true );
1049
+			if (give_has_variable_prices($donation->ID)) {
1050
+				$prices          = give_get_meta($form_id, '_give_donation_levels', true);
1051 1051
 				$donation_amount = '';
1052 1052
 				// Loop through prices.
1053
-				foreach ( $prices as $price ) {
1053
+				foreach ($prices as $price) {
1054 1054
 					// Find a match between price_id and level_id.
1055 1055
 					// First verify array keys exists THEN make the match.
1056
-					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1056
+					if ((isset($args['price_id']) && isset($price['_give_id']['level_id']))
1057 1057
 					     && $args['price_id'] == $price['_give_id']['level_id']
1058 1058
 					) {
1059 1059
 						$donation_amount = $price['_give_amount'];
1060 1060
 					}
1061 1061
 				}
1062 1062
 				// Fallback to the lowest price point.
1063
-				if ( $donation_amount == '' ) {
1064
-					$donation_amount  = give_get_lowest_price_option( $donation->ID );
1065
-					$args['price_id'] = give_get_lowest_price_id( $donation->ID );
1063
+				if ($donation_amount == '') {
1064
+					$donation_amount  = give_get_lowest_price_option($donation->ID);
1065
+					$args['price_id'] = give_get_lowest_price_id($donation->ID);
1066 1066
 				}
1067 1067
 			} else {
1068 1068
 				// Simple form price.
1069
-				$donation_amount = give_get_form_price( $donation->ID );
1069
+				$donation_amount = give_get_form_price($donation->ID);
1070 1070
 			}
1071 1071
 		}
1072 1072
 
1073 1073
 		// Sanitizing the price here so we don't have a dozen calls later.
1074
-		$donation_amount = give_maybe_sanitize_amount( $donation_amount );
1075
-		$total           = round( $donation_amount, give_get_price_decimals( $this->ID ) );
1074
+		$donation_amount = give_maybe_sanitize_amount($donation_amount);
1075
+		$total           = round($donation_amount, give_get_price_decimals($this->ID));
1076 1076
 
1077 1077
 		// Add Options.
1078 1078
 		$default_options = array();
1079
-		if ( false !== $args['price_id'] ) {
1079
+		if (false !== $args['price_id']) {
1080 1080
 			$default_options['price_id'] = (int) $args['price_id'];
1081 1081
 		}
1082
-		$options = wp_parse_args( $options, $default_options );
1082
+		$options = wp_parse_args($options, $default_options);
1083 1083
 
1084 1084
 		// Do not allow totals to go negative.
1085
-		if ( $total < 0 ) {
1085
+		if ($total < 0) {
1086 1086
 			$total = 0;
1087 1087
 		}
1088 1088
 
1089 1089
 		$donation = array(
1090 1090
 			'name'     => $donation->post_title,
1091 1091
 			'id'       => $donation->ID,
1092
-			'price'    => round( $total, give_get_price_decimals( $this->ID ) ),
1093
-			'subtotal' => round( $total, give_get_price_decimals( $this->ID ) ),
1092
+			'price'    => round($total, give_get_price_decimals($this->ID)),
1093
+			'subtotal' => round($total, give_get_price_decimals($this->ID)),
1094 1094
 			'price_id' => $args['price_id'],
1095 1095
 			'action'   => 'add',
1096 1096
 			'options'  => $options,
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 
1099 1099
 		$this->pending['donations'][] = $donation;
1100 1100
 
1101
-		$this->increase_subtotal( $total );
1101
+		$this->increase_subtotal($total);
1102 1102
 
1103 1103
 		return true;
1104 1104
 
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 	 *
1116 1116
 	 * @return bool           If the item was removed or not
1117 1117
 	 */
1118
-	public function remove_donation( $form_id, $args = array() ) {
1118
+	public function remove_donation($form_id, $args = array()) {
1119 1119
 
1120 1120
 		// Set some defaults.
1121 1121
 		$defaults = array(
@@ -1123,12 +1123,12 @@  discard block
 block discarded – undo
1123 1123
 			'price'    => false,
1124 1124
 			'price_id' => false,
1125 1125
 		);
1126
-		$args     = wp_parse_args( $args, $defaults );
1126
+		$args = wp_parse_args($args, $defaults);
1127 1127
 
1128
-		$form = new Give_Donate_Form( $form_id );
1128
+		$form = new Give_Donate_Form($form_id);
1129 1129
 
1130 1130
 		// Bail if this post isn't a valid give donation form.
1131
-		if ( ! $form || $form->post_type !== 'give_forms' ) {
1131
+		if ( ! $form || $form->post_type !== 'give_forms') {
1132 1132
 			return false;
1133 1133
 		}
1134 1134
 
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 
1142 1142
 		$this->pending['donations'][] = $pending_args;
1143 1143
 
1144
-		$this->decrease_subtotal( $this->total );
1144
+		$this->decrease_subtotal($this->total);
1145 1145
 
1146 1146
 		return true;
1147 1147
 	}
@@ -1157,13 +1157,13 @@  discard block
 block discarded – undo
1157 1157
 	 *
1158 1158
 	 * @return bool           If the note was specified or not
1159 1159
 	 */
1160
-	public function add_note( $note = false ) {
1160
+	public function add_note($note = false) {
1161 1161
 		// Bail if no note specified.
1162
-		if ( ! $note ) {
1162
+		if ( ! $note) {
1163 1163
 			return false;
1164 1164
 		}
1165 1165
 
1166
-		give_insert_payment_note( $this->ID, $note );
1166
+		give_insert_payment_note($this->ID, $note);
1167 1167
 	}
1168 1168
 
1169 1169
 	/**
@@ -1176,8 +1176,8 @@  discard block
 block discarded – undo
1176 1176
 	 *
1177 1177
 	 * @return void
1178 1178
 	 */
1179
-	private function increase_subtotal( $amount = 0.00 ) {
1180
-		$amount         = (float) $amount;
1179
+	private function increase_subtotal($amount = 0.00) {
1180
+		$amount = (float) $amount;
1181 1181
 		$this->subtotal += $amount;
1182 1182
 
1183 1183
 		$this->recalculate_total();
@@ -1193,11 +1193,11 @@  discard block
 block discarded – undo
1193 1193
 	 *
1194 1194
 	 * @return void
1195 1195
 	 */
1196
-	private function decrease_subtotal( $amount = 0.00 ) {
1197
-		$amount         = (float) $amount;
1196
+	private function decrease_subtotal($amount = 0.00) {
1197
+		$amount = (float) $amount;
1198 1198
 		$this->subtotal -= $amount;
1199 1199
 
1200
-		if ( $this->subtotal < 0 ) {
1200
+		if ($this->subtotal < 0) {
1201 1201
 			$this->subtotal = 0;
1202 1202
 		}
1203 1203
 
@@ -1227,24 +1227,24 @@  discard block
 block discarded – undo
1227 1227
 	 *
1228 1228
 	 * @return bool   $updated Returns if the status was successfully updated.
1229 1229
 	 */
1230
-	public function update_status( $status = false ) {
1230
+	public function update_status($status = false) {
1231 1231
 
1232 1232
 		// standardize the 'complete(d)' status.
1233
-		if ( $status == 'completed' || $status == 'complete' ) {
1233
+		if ($status == 'completed' || $status == 'complete') {
1234 1234
 			$status = 'publish';
1235 1235
 		}
1236 1236
 
1237
-		$old_status = ! empty( $this->old_status ) ? $this->old_status : false;
1237
+		$old_status = ! empty($this->old_status) ? $this->old_status : false;
1238 1238
 
1239
-		if ( $old_status === $status ) {
1239
+		if ($old_status === $status) {
1240 1240
 			return false; // Don't permit status changes that aren't changes.
1241 1241
 		}
1242 1242
 
1243
-		$do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status );
1243
+		$do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
1244 1244
 
1245 1245
 		$updated = false;
1246 1246
 
1247
-		if ( $do_change ) {
1247
+		if ($do_change) {
1248 1248
 
1249 1249
 			/**
1250 1250
 			 * Fires before changing payment status.
@@ -1255,21 +1255,21 @@  discard block
 block discarded – undo
1255 1255
 			 * @param string $status     The new status.
1256 1256
 			 * @param string $old_status The old status.
1257 1257
 			 */
1258
-			do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status );
1258
+			do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
1259 1259
 
1260 1260
 			$update_fields = array(
1261 1261
 				'ID'          => $this->ID,
1262 1262
 				'post_status' => $status,
1263
-				'edit_date'   => current_time( 'mysql' ),
1263
+				'edit_date'   => current_time('mysql'),
1264 1264
 			);
1265 1265
 
1266
-			$updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) );
1266
+			$updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
1267 1267
 
1268 1268
 			$all_payment_statuses  = give_get_payment_statuses();
1269
-			$this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status );
1269
+			$this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
1270 1270
 
1271 1271
 			// Process any specific status functions.
1272
-			$this->process_status( $status );
1272
+			$this->process_status($status);
1273 1273
 
1274 1274
 			/**
1275 1275
 			 * Fires after changing payment status.
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 			 * @param string $status     The new status.
1281 1281
 			 * @param string $old_status The old status.
1282 1282
 			 */
1283
-			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
1283
+			do_action('give_update_payment_status', $this->ID, $status, $old_status);
1284 1284
 
1285 1285
 		}// End if().
1286 1286
 
@@ -1315,24 +1315,24 @@  discard block
 block discarded – undo
1315 1315
 	 *
1316 1316
 	 * @return mixed             The value from the post meta
1317 1317
 	 */
1318
-	public function get_meta( $meta_key = '_give_payment_meta', $single = true ) {
1319
-		if( ! has_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta' ) && ! doing_filter( 'get_post_metadata' ) ) {
1320
-			add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
1318
+	public function get_meta($meta_key = '_give_payment_meta', $single = true) {
1319
+		if ( ! has_filter('get_post_metadata', 'give_bc_v20_get_payment_meta') && ! doing_filter('get_post_metadata')) {
1320
+			add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4);
1321 1321
 		}
1322 1322
 
1323
-		$meta = give_get_meta( $this->ID, $meta_key, $single );
1323
+		$meta = give_get_meta($this->ID, $meta_key, $single);
1324 1324
 
1325 1325
 		/**
1326 1326
 		 * Filter the specific meta key value.
1327 1327
 		 *
1328 1328
 		 * @since 1.5
1329 1329
 		 */
1330
-		$meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID );
1330
+		$meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID);
1331 1331
 
1332 1332
 		// Security check.
1333
-		if ( is_serialized( $meta ) ) {
1334
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches );
1335
-			if ( ! empty( $matches ) ) {
1333
+		if (is_serialized($meta)) {
1334
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches);
1335
+			if ( ! empty($matches)) {
1336 1336
 				$meta = array();
1337 1337
 			}
1338 1338
 		}
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
 		 *
1343 1343
 		 * @since 1.5
1344 1344
 		 */
1345
-		return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key );
1345
+		return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key);
1346 1346
 	}
1347 1347
 
1348 1348
 	/**
@@ -1357,8 +1357,8 @@  discard block
 block discarded – undo
1357 1357
 	 *
1358 1358
 	 * @return int|bool           Meta ID if the key didn't exist, true on successful update, false on failure
1359 1359
 	 */
1360
-	public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1361
-		if ( empty( $meta_key ) ) {
1360
+	public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') {
1361
+		if (empty($meta_key)) {
1362 1362
 			return false;
1363 1363
 		}
1364 1364
 
@@ -1368,9 +1368,9 @@  discard block
 block discarded – undo
1368 1368
 		 *
1369 1369
 		 * @since 1.5
1370 1370
 		 */
1371
-		$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1371
+		$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1372 1372
 
1373
-		return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value );
1373
+		return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value);
1374 1374
 	}
1375 1375
 
1376 1376
 	/**
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 	 *
1384 1384
 	 * @return void
1385 1385
 	 */
1386
-	private function process_status( $status ) {
1386
+	private function process_status($status) {
1387 1387
 		$process = true;
1388 1388
 
1389 1389
 		// Bailout, if changed from completed to preapproval/processing.
@@ -1398,9 +1398,9 @@  discard block
 block discarded – undo
1398 1398
 		}
1399 1399
 
1400 1400
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1401
-		$process = apply_filters( "give_should_process_{$status}", $process, $this );
1401
+		$process = apply_filters("give_should_process_{$status}", $process, $this);
1402 1402
 
1403
-		if ( false === $process ) {
1403
+		if (false === $process) {
1404 1404
 			return;
1405 1405
 		}
1406 1406
 
@@ -1411,13 +1411,13 @@  discard block
 block discarded – undo
1411 1411
 		 *
1412 1412
 		 * @since 1.5
1413 1413
 		 */
1414
-		do_action( "give_pre_{$status}_payment", $this );
1414
+		do_action("give_pre_{$status}_payment", $this);
1415 1415
 
1416
-		$decrease_earnings       = apply_filters( "give_decrease_earnings_on_{$status}", true, $this );
1417
-		$decrease_donor_value    = apply_filters( "give_decrease_donor_value_on_{$status}", true, $this );
1418
-		$decrease_donation_count = apply_filters( "give_decrease_donors_donation_count_on_{$status}", true, $this );
1416
+		$decrease_earnings       = apply_filters("give_decrease_earnings_on_{$status}", true, $this);
1417
+		$decrease_donor_value    = apply_filters("give_decrease_donor_value_on_{$status}", true, $this);
1418
+		$decrease_donation_count = apply_filters("give_decrease_donors_donation_count_on_{$status}", true, $this);
1419 1419
 
1420
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1420
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1421 1421
 		$this->delete_sales_logs();
1422 1422
 
1423 1423
 		// @todo: Refresh only range related stat cache
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
 		 *
1431 1431
 		 * @since 1.5
1432 1432
 		 */
1433
-		do_action( "give_post_{$status}_payment", $this );
1433
+		do_action("give_post_{$status}_payment", $this);
1434 1434
 	}
1435 1435
 
1436 1436
 	/**
@@ -1445,25 +1445,25 @@  discard block
 block discarded – undo
1445 1445
 	 *
1446 1446
 	 * @return void
1447 1447
 	 */
1448
-	private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) {
1448
+	private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) {
1449 1449
 
1450
-		give_undo_donation( $this->ID );
1450
+		give_undo_donation($this->ID);
1451 1451
 
1452 1452
 		// Decrease store earnings.
1453
-		if ( true === $alter_store_earnings ) {
1454
-			give_decrease_total_earnings( $this->total );
1453
+		if (true === $alter_store_earnings) {
1454
+			give_decrease_total_earnings($this->total);
1455 1455
 		}
1456 1456
 
1457 1457
 		// Decrement the stats for the donor.
1458
-		if ( ! empty( $this->customer_id ) ) {
1458
+		if ( ! empty($this->customer_id)) {
1459 1459
 
1460
-			$donor = new Give_Donor( $this->customer_id );
1460
+			$donor = new Give_Donor($this->customer_id);
1461 1461
 
1462
-			if ( true === $alter_customer_value ) {
1463
-				$donor->decrease_value( $this->total );
1462
+			if (true === $alter_customer_value) {
1463
+				$donor->decrease_value($this->total);
1464 1464
 			}
1465 1465
 
1466
-			if ( true === $alter_customer_purchase_count ) {
1466
+			if (true === $alter_customer_purchase_count) {
1467 1467
 				$donor->decrease_donation_count();
1468 1468
 			}
1469 1469
 		}
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
 	 */
1481 1481
 	private function delete_sales_logs() {
1482 1482
 		// Remove related sale log entries.
1483
-		Give()->logs->delete_logs( $this->ID );
1483
+		Give()->logs->delete_logs($this->ID);
1484 1484
 	}
1485 1485
 
1486 1486
 	/**
@@ -1501,13 +1501,13 @@  discard block
 block discarded – undo
1501 1501
 	 * @return string The date the payment was completed
1502 1502
 	 */
1503 1503
 	private function setup_completed_date() {
1504
-		$payment = get_post( $this->ID );
1504
+		$payment = get_post($this->ID);
1505 1505
 
1506
-		if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) {
1506
+		if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) {
1507 1507
 			return false; // This payment was never completed.
1508 1508
 		}
1509 1509
 
1510
-		$date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date;
1510
+		$date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date;
1511 1511
 
1512 1512
 		return $date;
1513 1513
 	}
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 	 * @return string The payment mode
1522 1522
 	 */
1523 1523
 	private function setup_mode() {
1524
-		return $this->get_meta( '_give_payment_mode' );
1524
+		return $this->get_meta('_give_payment_mode');
1525 1525
 	}
1526 1526
 
1527 1527
 	/**
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 	 * @return bool The payment import
1534 1534
 	 */
1535 1535
 	private function setup_import() {
1536
-		return (bool) $this->get_meta( '_give_payment_import' );
1536
+		return (bool) $this->get_meta('_give_payment_import');
1537 1537
 	}
1538 1538
 
1539 1539
 	/**
@@ -1545,9 +1545,9 @@  discard block
 block discarded – undo
1545 1545
 	 * @return float The payment total
1546 1546
 	 */
1547 1547
 	private function setup_total() {
1548
-		$amount = $this->get_meta( '_give_payment_total', true );
1548
+		$amount = $this->get_meta('_give_payment_total', true);
1549 1549
 
1550
-		return round( floatval( $amount ), give_get_price_decimals( $this->ID ) );
1550
+		return round(floatval($amount), give_get_price_decimals($this->ID));
1551 1551
 	}
1552 1552
 
1553 1553
 	/**
@@ -1574,17 +1574,16 @@  discard block
 block discarded – undo
1574 1574
 	 * @return string The currency for the payment
1575 1575
 	 */
1576 1576
 	private function setup_currency() {
1577
-		$currency = $this->get_meta( '_give_payment_currency', true );
1578
-		$currency = ! empty( $currency ) ?
1579
-			$currency :
1580
-			/**
1577
+		$currency = $this->get_meta('_give_payment_currency', true);
1578
+		$currency = ! empty($currency) ?
1579
+			$currency : /**
1581 1580
 			 * Filter the default donation currency
1582 1581
 			 *
1583 1582
 			 * @since 1.5
1584 1583
 			 */
1585 1584
 			apply_filters(
1586 1585
 				'give_payment_currency_default',
1587
-				give_get_currency( $this->form_id, $this ),
1586
+				give_get_currency($this->form_id, $this),
1588 1587
 				$this
1589 1588
 			);
1590 1589
 
@@ -1600,7 +1599,7 @@  discard block
 block discarded – undo
1600 1599
 	 * @return string The gateway
1601 1600
 	 */
1602 1601
 	private function setup_gateway() {
1603
-		$gateway = $this->get_meta( '_give_payment_gateway', true );
1602
+		$gateway = $this->get_meta('_give_payment_gateway', true);
1604 1603
 
1605 1604
 		return $gateway;
1606 1605
 	}
@@ -1614,11 +1613,11 @@  discard block
 block discarded – undo
1614 1613
 	 * @return string The donation ID
1615 1614
 	 */
1616 1615
 	private function setup_transaction_id() {
1617
-		$transaction_id = $this->get_meta( '_give_payment_transaction_id', true );
1616
+		$transaction_id = $this->get_meta('_give_payment_transaction_id', true);
1618 1617
 
1619
-		if ( empty( $transaction_id ) ) {
1618
+		if (empty($transaction_id)) {
1620 1619
 			$gateway        = $this->gateway;
1621
-			$transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID );
1620
+			$transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID);
1622 1621
 		}
1623 1622
 
1624 1623
 		return $transaction_id;
@@ -1634,7 +1633,7 @@  discard block
 block discarded – undo
1634 1633
 	 * @return string The IP address for the payment
1635 1634
 	 */
1636 1635
 	private function setup_ip() {
1637
-		$ip = $this->get_meta( '_give_payment_donor_ip', true );
1636
+		$ip = $this->get_meta('_give_payment_donor_ip', true);
1638 1637
 
1639 1638
 		return $ip;
1640 1639
 	}
@@ -1649,7 +1648,7 @@  discard block
 block discarded – undo
1649 1648
 	 * @return int The Donor ID.
1650 1649
 	 */
1651 1650
 	private function setup_donor_id() {
1652
-		$donor_id = $this->get_meta( '_give_payment_donor_id', true );
1651
+		$donor_id = $this->get_meta('_give_payment_donor_id', true);
1653 1652
 
1654 1653
 		return $donor_id;
1655 1654
 	}
@@ -1666,8 +1665,8 @@  discard block
 block discarded – undo
1666 1665
 	 */
1667 1666
 	private function setup_user_id() {
1668 1667
 
1669
-		$donor   = Give()->customers->get_customer_by( 'id', $this->customer_id );
1670
-		$user_id = $donor ? absint( $donor->user_id ) : 0;
1668
+		$donor   = Give()->customers->get_customer_by('id', $this->customer_id);
1669
+		$user_id = $donor ? absint($donor->user_id) : 0;
1671 1670
 
1672 1671
 
1673 1672
 		return $user_id;
@@ -1684,10 +1683,10 @@  discard block
 block discarded – undo
1684 1683
 	 * @return string The email address for the payment.
1685 1684
 	 */
1686 1685
 	private function setup_email() {
1687
-		$email = $this->get_meta( '_give_payment_donor_email', true );
1686
+		$email = $this->get_meta('_give_payment_donor_email', true);
1688 1687
 
1689
-		if ( empty( $email ) && $this->customer_id ) {
1690
-			$email = Give()->donors->get_column( 'email', $this->customer_id );
1688
+		if (empty($email) && $this->customer_id) {
1689
+			$email = Give()->donors->get_column('email', $this->customer_id);
1691 1690
 		}
1692 1691
 
1693 1692
 		return $email;
@@ -1707,22 +1706,22 @@  discard block
 block discarded – undo
1707 1706
 			'last_name'  => $this->last_name,
1708 1707
 		);
1709 1708
 
1710
-		$user_info = isset( $this->payment_meta['user_info'] ) ? $this->payment_meta['user_info'] : array();
1709
+		$user_info = isset($this->payment_meta['user_info']) ? $this->payment_meta['user_info'] : array();
1711 1710
 
1712
-		if ( is_serialized( $user_info ) ) {
1713
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
1714
-			if ( ! empty( $matches ) ) {
1711
+		if (is_serialized($user_info)) {
1712
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
1713
+			if ( ! empty($matches)) {
1715 1714
 				$user_info = array();
1716 1715
 			}
1717 1716
 		}
1718 1717
 
1719
-		$user_info = wp_parse_args( $user_info, $defaults );
1718
+		$user_info = wp_parse_args($user_info, $defaults);
1720 1719
 
1721
-		if ( empty( $user_info ) ) {
1720
+		if (empty($user_info)) {
1722 1721
 			// Get the donor, but only if it's been created.
1723
-			$donor = new Give_Donor( $this->customer_id );
1722
+			$donor = new Give_Donor($this->customer_id);
1724 1723
 
1725
-			if ( $donor->id > 0 ) {
1724
+			if ($donor->id > 0) {
1726 1725
 				$user_info = array(
1727 1726
 					'first_name' => $donor->get_first_name(),
1728 1727
 					'last_name'  => $donor->get_last_name(),
@@ -1732,25 +1731,25 @@  discard block
 block discarded – undo
1732 1731
 			}
1733 1732
 		} else {
1734 1733
 			// Get the donor, but only if it's been created.
1735
-			$donor = new Give_Donor( $this->customer_id );
1734
+			$donor = new Give_Donor($this->customer_id);
1736 1735
 
1737
-			if ( $donor->id > 0 ) {
1738
-				foreach ( $user_info as $key => $value ) {
1739
-					if ( ! empty( $value ) ) {
1736
+			if ($donor->id > 0) {
1737
+				foreach ($user_info as $key => $value) {
1738
+					if ( ! empty($value)) {
1740 1739
 						continue;
1741 1740
 					}
1742 1741
 
1743
-					switch ( $key ) {
1742
+					switch ($key) {
1744 1743
 						case 'first_name':
1745
-							$user_info[ $key ] = $donor->get_first_name();
1744
+							$user_info[$key] = $donor->get_first_name();
1746 1745
 							break;
1747 1746
 
1748 1747
 						case 'last_name':
1749
-							$user_info[ $key ] = $donor->get_last_name();
1748
+							$user_info[$key] = $donor->get_last_name();
1750 1749
 							break;
1751 1750
 
1752 1751
 						case 'email':
1753
-							$user_info[ $key ] = $donor->email;
1752
+							$user_info[$key] = $donor->email;
1754 1753
 							break;
1755 1754
 					}
1756 1755
 				}
@@ -1770,12 +1769,12 @@  discard block
 block discarded – undo
1770 1769
 	 * @return array The Address information for the payment.
1771 1770
 	 */
1772 1771
 	private function setup_address() {
1773
-		$address['line1']   = give_get_meta( $this->ID, '_give_donor_billing_address1', true, '' );
1774
-		$address['line2']   = give_get_meta( $this->ID, '_give_donor_billing_address2', true, '' );
1775
-		$address['city']    = give_get_meta( $this->ID, '_give_donor_billing_city', true, '' );
1776
-		$address['state']   = give_get_meta( $this->ID, '_give_donor_billing_state', true, '' );
1777
-		$address['zip']     = give_get_meta( $this->ID, '_give_donor_billing_zip', true, '' );
1778
-		$address['country'] = give_get_meta( $this->ID, '_give_donor_billing_country', true, '' );
1772
+		$address['line1']   = give_get_meta($this->ID, '_give_donor_billing_address1', true, '');
1773
+		$address['line2']   = give_get_meta($this->ID, '_give_donor_billing_address2', true, '');
1774
+		$address['city']    = give_get_meta($this->ID, '_give_donor_billing_city', true, '');
1775
+		$address['state']   = give_get_meta($this->ID, '_give_donor_billing_state', true, '');
1776
+		$address['zip']     = give_get_meta($this->ID, '_give_donor_billing_zip', true, '');
1777
+		$address['country'] = give_get_meta($this->ID, '_give_donor_billing_country', true, '');
1779 1778
 
1780 1779
 		return $address;
1781 1780
 	}
@@ -1790,7 +1789,7 @@  discard block
 block discarded – undo
1790 1789
 	 */
1791 1790
 	private function setup_form_title() {
1792 1791
 
1793
-		$form_id = $this->get_meta( '_give_payment_form_title', true );
1792
+		$form_id = $this->get_meta('_give_payment_form_title', true);
1794 1793
 
1795 1794
 		return $form_id;
1796 1795
 	}
@@ -1805,7 +1804,7 @@  discard block
 block discarded – undo
1805 1804
 	 */
1806 1805
 	private function setup_form_id() {
1807 1806
 
1808
-		$form_id = $this->get_meta( '_give_payment_form_id', true );
1807
+		$form_id = $this->get_meta('_give_payment_form_id', true);
1809 1808
 
1810 1809
 		return $form_id;
1811 1810
 	}
@@ -1819,7 +1818,7 @@  discard block
 block discarded – undo
1819 1818
 	 * @return int The Form Price ID.
1820 1819
 	 */
1821 1820
 	private function setup_price_id() {
1822
-		$price_id = $this->get_meta( '_give_payment_price_id', true );
1821
+		$price_id = $this->get_meta('_give_payment_price_id', true);
1823 1822
 
1824 1823
 		return $price_id;
1825 1824
 	}
@@ -1833,7 +1832,7 @@  discard block
 block discarded – undo
1833 1832
 	 * @return string The Payment Key.
1834 1833
 	 */
1835 1834
 	private function setup_payment_key() {
1836
-		$key = $this->get_meta( '_give_payment_purchase_key', true );
1835
+		$key = $this->get_meta('_give_payment_purchase_key', true);
1837 1836
 
1838 1837
 		return $key;
1839 1838
 	}
@@ -1858,7 +1857,7 @@  discard block
 block discarded – undo
1858 1857
 	 * @return array The payment object as an array.
1859 1858
 	 */
1860 1859
 	public function array_convert() {
1861
-		return get_object_vars( $this );
1860
+		return get_object_vars($this);
1862 1861
 	}
1863 1862
 
1864 1863
 
@@ -1871,7 +1870,7 @@  discard block
 block discarded – undo
1871 1870
 	 * @return bool
1872 1871
 	 */
1873 1872
 	public function is_completed() {
1874
-		return ( 'publish' === $this->status && $this->completed_date );
1873
+		return ('publish' === $this->status && $this->completed_date);
1875 1874
 	}
1876 1875
 
1877 1876
 	/**
@@ -1883,7 +1882,7 @@  discard block
 block discarded – undo
1883 1882
 	 * @return string Date payment was completed.
1884 1883
 	 */
1885 1884
 	private function get_completed_date() {
1886
-		return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this );
1885
+		return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this);
1887 1886
 	}
1888 1887
 
1889 1888
 	/**
@@ -1895,7 +1894,7 @@  discard block
 block discarded – undo
1895 1894
 	 * @return float Payment subtotal.
1896 1895
 	 */
1897 1896
 	private function get_subtotal() {
1898
-		return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this );
1897
+		return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this);
1899 1898
 	}
1900 1899
 
1901 1900
 	/**
@@ -1907,7 +1906,7 @@  discard block
 block discarded – undo
1907 1906
 	 * @return string Payment currency code.
1908 1907
 	 */
1909 1908
 	private function get_currency() {
1910
-		return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this );
1909
+		return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this);
1911 1910
 	}
1912 1911
 
1913 1912
 	/**
@@ -1919,7 +1918,7 @@  discard block
 block discarded – undo
1919 1918
 	 * @return string Gateway used.
1920 1919
 	 */
1921 1920
 	private function get_gateway() {
1922
-		return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this );
1921
+		return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this);
1923 1922
 	}
1924 1923
 
1925 1924
 	/**
@@ -1931,7 +1930,7 @@  discard block
 block discarded – undo
1931 1930
 	 * @return string Donation ID from merchant processor.
1932 1931
 	 */
1933 1932
 	private function get_transaction_id() {
1934
-		return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this );
1933
+		return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this);
1935 1934
 	}
1936 1935
 
1937 1936
 	/**
@@ -1943,7 +1942,7 @@  discard block
 block discarded – undo
1943 1942
 	 * @return string Payment IP address
1944 1943
 	 */
1945 1944
 	private function get_ip() {
1946
-		return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this );
1945
+		return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this);
1947 1946
 	}
1948 1947
 
1949 1948
 	/**
@@ -1955,7 +1954,7 @@  discard block
 block discarded – undo
1955 1954
 	 * @return int Payment donor ID.
1956 1955
 	 */
1957 1956
 	private function get_donor_id() {
1958
-		return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this );
1957
+		return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this);
1959 1958
 	}
1960 1959
 
1961 1960
 	/**
@@ -1967,7 +1966,7 @@  discard block
 block discarded – undo
1967 1966
 	 * @return int Payment user ID.
1968 1967
 	 */
1969 1968
 	private function get_user_id() {
1970
-		return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this );
1969
+		return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this);
1971 1970
 	}
1972 1971
 
1973 1972
 	/**
@@ -1979,7 +1978,7 @@  discard block
 block discarded – undo
1979 1978
 	 * @return string Payment donor email.
1980 1979
 	 */
1981 1980
 	private function get_email() {
1982
-		return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this );
1981
+		return apply_filters('give_payment_user_email', $this->email, $this->ID, $this);
1983 1982
 	}
1984 1983
 
1985 1984
 	/**
@@ -1991,7 +1990,7 @@  discard block
 block discarded – undo
1991 1990
 	 * @return array Payment user info.
1992 1991
 	 */
1993 1992
 	private function get_user_info() {
1994
-		return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this );
1993
+		return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this);
1995 1994
 	}
1996 1995
 
1997 1996
 	/**
@@ -2003,7 +2002,7 @@  discard block
 block discarded – undo
2003 2002
 	 * @return array Payment billing address.
2004 2003
 	 */
2005 2004
 	private function get_address() {
2006
-		return apply_filters( 'give_payment_address', $this->address, $this->ID, $this );
2005
+		return apply_filters('give_payment_address', $this->address, $this->ID, $this);
2007 2006
 	}
2008 2007
 
2009 2008
 	/**
@@ -2015,7 +2014,7 @@  discard block
 block discarded – undo
2015 2014
 	 * @return string Payment key.
2016 2015
 	 */
2017 2016
 	private function get_key() {
2018
-		return apply_filters( 'give_payment_key', $this->key, $this->ID, $this );
2017
+		return apply_filters('give_payment_key', $this->key, $this->ID, $this);
2019 2018
 	}
2020 2019
 
2021 2020
 	/**
@@ -2027,7 +2026,7 @@  discard block
 block discarded – undo
2027 2026
 	 * @return string Payment form id
2028 2027
 	 */
2029 2028
 	private function get_form_id() {
2030
-		return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this );
2029
+		return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this);
2031 2030
 	}
2032 2031
 
2033 2032
 	/**
@@ -2039,7 +2038,7 @@  discard block
 block discarded – undo
2039 2038
 	 * @return int|string Payment number
2040 2039
 	 */
2041 2040
 	private function get_number() {
2042
-		return apply_filters( 'give_payment_number', $this->number, $this->ID, $this );
2041
+		return apply_filters('give_payment_number', $this->number, $this->ID, $this);
2043 2042
 	}
2044 2043
 
2045 2044
 	/**
@@ -2051,7 +2050,7 @@  discard block
 block discarded – undo
2051 2050
 	 *
2052 2051
 	 * @return string
2053 2052
 	 */
2054
-	public function get_serial_code( $args = array() ) {
2055
-		return Give()->seq_donation_number->get_serial_code( $this, $args );
2053
+	public function get_serial_code($args = array()) {
2054
+		return Give()->seq_donation_number->get_serial_code($this, $args);
2056 2055
 	}
2057 2056
 }
Please login to merge, or discard this patch.
includes/misc-functions.php 1 patch
Spacing   +383 added lines, -383 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 );
177
-	} else{
178
-		$ip = give_clean( $ip );
173
+	if (false !== strpos($ip, ',')) {
174
+		$ip = give_clean(explode(',', $ip));
175
+		$ip = array_filter($ip);
176
+		$ip = implode(',', $ip);
177
+	} else {
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,17 +243,17 @@  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
 
253 253
 	// Verify has variable prices.
254
-	if ( give_has_variable_prices( $form_id ) && ! empty( $price_id ) ) {
254
+	if (give_has_variable_prices($form_id) && ! empty($price_id)) {
255 255
 
256
-		$item_price_level_text = give_get_price_option_name( $form_id, $price_id, 0, false );
256
+		$item_price_level_text = give_get_price_option_name($form_id, $price_id, 0, false);
257 257
 
258 258
 		/**
259 259
 		 * Output donation level text if:
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 		 */
264 264
 		if (
265 265
 			'custom' !== $price_id
266
-			&& ! empty( $item_price_level_text )
266
+			&& ! empty($item_price_level_text)
267 267
 		) {
268 268
 			// Matches a donation level - append level text.
269
-			$item_name .= ' - ' . $item_price_level_text;
269
+			$item_name .= ' - '.$item_price_level_text;
270 270
 		}
271 271
 	}
272 272
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 *
282 282
 	 * @return string
283 283
 	 */
284
-	return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data );
284
+	return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data);
285 285
 }
286 286
 
287 287
 /**
@@ -297,38 +297,38 @@  discard block
 block discarded – undo
297 297
  *
298 298
  * @return string
299 299
  */
300
-function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) {
300
+function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) {
301 301
 
302
-	$form_id  = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : '';
303
-	$price_id = isset( $donation_data['post_data']['give-price-id'] ) ? $donation_data['post_data']['give-price-id'] : '';
302
+	$form_id  = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : '';
303
+	$price_id = isset($donation_data['post_data']['give-price-id']) ? $donation_data['post_data']['give-price-id'] : '';
304 304
 
305 305
 	// Form title.
306
-	$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' ) ) );
306
+	$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')));
307 307
 
308 308
 	// Form multilevel if applicable.
309
-	if ( ! empty( $price_id ) && 'custom' !== $price_id ) {
310
-		$summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] );
309
+	if ( ! empty($price_id) && 'custom' !== $price_id) {
310
+		$summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']);
311 311
 	}
312 312
 
313 313
 	// Add Donor's name + email if requested.
314
-	if ( $name_and_email ) {
314
+	if ($name_and_email) {
315 315
 
316 316
 		// First name
317
-		if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) {
318
-			$summary .= ' - ' . $donation_data['user_info']['first_name'];
317
+		if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) {
318
+			$summary .= ' - '.$donation_data['user_info']['first_name'];
319 319
 		}
320 320
 
321
-		if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) {
322
-			$summary .= ' ' . $donation_data['user_info']['last_name'];
321
+		if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) {
322
+			$summary .= ' '.$donation_data['user_info']['last_name'];
323 323
 		}
324 324
 
325
-		$summary .= ' (' . $donation_data['user_email'] . ')';
325
+		$summary .= ' ('.$donation_data['user_email'].')';
326 326
 	}
327 327
 
328 328
 	// Cut the length
329
-	$summary = substr( $summary, 0, $length );
329
+	$summary = substr($summary, 0, $length);
330 330
 
331
-	return apply_filters( 'give_payment_gateway_donation_summary', $summary );
331
+	return apply_filters('give_payment_gateway_donation_summary', $summary);
332 332
 }
333 333
 
334 334
 
@@ -343,31 +343,31 @@  discard block
 block discarded – undo
343 343
 function give_get_host() {
344 344
 	$host = false;
345 345
 
346
-	if ( defined( 'WPE_APIKEY' ) ) {
346
+	if (defined('WPE_APIKEY')) {
347 347
 		$host = 'WP Engine';
348
-	} elseif ( defined( 'PAGELYBIN' ) ) {
348
+	} elseif (defined('PAGELYBIN')) {
349 349
 		$host = 'Pagely';
350
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
350
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
351 351
 		$host = 'ICDSoft';
352
-	} elseif ( DB_HOST == 'mysqlv5' ) {
352
+	} elseif (DB_HOST == 'mysqlv5') {
353 353
 		$host = 'NetworkSolutions';
354
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
354
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
355 355
 		$host = 'iPage';
356
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
356
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
357 357
 		$host = 'IPower';
358
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
358
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
359 359
 		$host = 'MediaTemple Grid';
360
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
360
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
361 361
 		$host = 'pair Networks';
362
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
362
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
363 363
 		$host = 'Rackspace Cloud';
364
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
364
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
365 365
 		$host = 'SysFix.eu Power Hosting';
366
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
366
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
367 367
 		$host = 'Flywheel';
368 368
 	} else {
369 369
 		// Adding a general fallback for data gathering
370
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
370
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
371 371
 	}
372 372
 
373 373
 	return $host;
@@ -383,67 +383,67 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return bool true if host matches, false if not
385 385
  */
386
-function give_is_host( $host = false ) {
386
+function give_is_host($host = false) {
387 387
 
388 388
 	$return = false;
389 389
 
390
-	if ( $host ) {
391
-		$host = str_replace( ' ', '', strtolower( $host ) );
390
+	if ($host) {
391
+		$host = str_replace(' ', '', strtolower($host));
392 392
 
393
-		switch ( $host ) {
393
+		switch ($host) {
394 394
 			case 'wpengine':
395
-				if ( defined( 'WPE_APIKEY' ) ) {
395
+				if (defined('WPE_APIKEY')) {
396 396
 					$return = true;
397 397
 				}
398 398
 				break;
399 399
 			case 'pagely':
400
-				if ( defined( 'PAGELYBIN' ) ) {
400
+				if (defined('PAGELYBIN')) {
401 401
 					$return = true;
402 402
 				}
403 403
 				break;
404 404
 			case 'icdsoft':
405
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
405
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
406 406
 					$return = true;
407 407
 				}
408 408
 				break;
409 409
 			case 'networksolutions':
410
-				if ( DB_HOST == 'mysqlv5' ) {
410
+				if (DB_HOST == 'mysqlv5') {
411 411
 					$return = true;
412 412
 				}
413 413
 				break;
414 414
 			case 'ipage':
415
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
415
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
416 416
 					$return = true;
417 417
 				}
418 418
 				break;
419 419
 			case 'ipower':
420
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
420
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
421 421
 					$return = true;
422 422
 				}
423 423
 				break;
424 424
 			case 'mediatemplegrid':
425
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
425
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
426 426
 					$return = true;
427 427
 				}
428 428
 				break;
429 429
 			case 'pairnetworks':
430
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
430
+				if (strpos(DB_HOST, '.pair.com') !== false) {
431 431
 					$return = true;
432 432
 				}
433 433
 				break;
434 434
 			case 'rackspacecloud':
435
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
435
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
436 436
 					$return = true;
437 437
 				}
438 438
 				break;
439 439
 			case 'sysfix.eu':
440 440
 			case 'sysfix.eupowerhosting':
441
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
441
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
442 442
 					$return = true;
443 443
 				}
444 444
 				break;
445 445
 			case 'flywheel':
446
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
446
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
447 447
 					$return = true;
448 448
 				}
449 449
 				break;
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
  * @param string $replacement Optional. The function that should have been called.
477 477
  * @param array  $backtrace   Optional. Contains stack backtrace of deprecated function.
478 478
  */
479
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
479
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
480 480
 
481 481
 	/**
482 482
 	 * Fires while give deprecated function call occurs.
@@ -489,19 +489,19 @@  discard block
 block discarded – undo
489 489
 	 * @param string $replacement Optional. The function that should have been called.
490 490
 	 * @param string $version     The plugin version that deprecated the function.
491 491
 	 */
492
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
492
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
493 493
 
494
-	$show_errors = current_user_can( 'manage_options' );
494
+	$show_errors = current_user_can('manage_options');
495 495
 
496 496
 	// Allow plugin to filter the output error trigger.
497
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
498
-		if ( ! is_null( $replacement ) ) {
499
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
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.
497
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
498
+		if ( ! is_null($replacement)) {
499
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
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
 		} else {
503
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
504
-			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.
503
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
504
+			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.
505 505
 			// Alternatively we could dump this to a file.
506 506
 		}
507 507
 	}
@@ -515,17 +515,17 @@  discard block
 block discarded – undo
515 515
  * @return string $post_id
516 516
  */
517 517
 function give_get_admin_post_id() {
518
-	$post_id = isset( $_REQUEST['post'] )
519
-		? absint( $_REQUEST['post'] )
518
+	$post_id = isset($_REQUEST['post'])
519
+		? absint($_REQUEST['post'])
520 520
 		: null;
521 521
 
522
-	$post_id = ! empty( $post_id )
522
+	$post_id = ! empty($post_id)
523 523
 		? $post_id
524
-		: ( isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : null );
524
+		: (isset($_REQUEST['post_id']) ? absint($_REQUEST['post_id']) : null);
525 525
 
526
-	$post_id = ! empty( $post_id )
526
+	$post_id = ! empty($post_id)
527 527
 		? $post_id
528
-		: ( isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : null );
528
+		: (isset($_REQUEST['post_ID']) ? absint($_REQUEST['post_ID']) : null);
529 529
 
530 530
 	return $post_id;
531 531
 }
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
  * @return string Arg separator output
538 538
  */
539 539
 function give_get_php_arg_separator_output() {
540
-	return ini_get( 'arg_separator.output' );
540
+	return ini_get('arg_separator.output');
541 541
 }
542 542
 
543 543
 
@@ -552,10 +552,10 @@  discard block
 block discarded – undo
552 552
  *
553 553
  * @return string Short month name
554 554
  */
555
-function give_month_num_to_name( $n ) {
556
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
555
+function give_month_num_to_name($n) {
556
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
557 557
 
558
-	return date_i18n( 'M', $timestamp );
558
+	return date_i18n('M', $timestamp);
559 559
 }
560 560
 
561 561
 
@@ -568,10 +568,10 @@  discard block
 block discarded – undo
568 568
  *
569 569
  * @return bool Whether or not function is disabled.
570 570
  */
571
-function give_is_func_disabled( $function ) {
572
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
571
+function give_is_func_disabled($function) {
572
+	$disabled = explode(',', ini_get('disable_functions'));
573 573
 
574
-	return in_array( $function, $disabled );
574
+	return in_array($function, $disabled);
575 575
 }
576 576
 
577 577
 
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 function give_get_newsletter() {
584 584
 	?>
585 585
 
586
-	<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>
586
+	<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>
587 587
 
588 588
 	<div class="give-newsletter-form-wrap">
589 589
 
@@ -591,33 +591,33 @@  discard block
 block discarded – undo
591 591
 		      method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"
592 592
 		      target="_blank" novalidate>
593 593
 			<div class="give-newsletter-confirmation">
594
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
594
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
595 595
 			</div>
596 596
 
597 597
 			<table class="form-table give-newsletter-form">
598 598
 				<tr valign="middle">
599 599
 					<td>
600 600
 						<label for="mce-EMAIL"
601
-						       class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>
601
+						       class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label>
602 602
 						<input type="email" name="EMAIL" id="mce-EMAIL"
603
-						       placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>"
603
+						       placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>"
604 604
 						       class="required email" value="">
605 605
 					</td>
606 606
 					<td>
607 607
 						<label for="mce-FNAME"
608
-						       class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>
608
+						       class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label>
609 609
 						<input type="text" name="FNAME" id="mce-FNAME"
610
-						       placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="">
610
+						       placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="">
611 611
 					</td>
612 612
 					<td>
613 613
 						<label for="mce-LNAME"
614
-						       class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
614
+						       class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label>
615 615
 						<input type="text" name="LNAME" id="mce-LNAME"
616
-						       placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value="">
616
+						       placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value="">
617 617
 					</td>
618 618
 					<td>
619 619
 						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button"
620
-						       value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">
620
+						       value="<?php esc_attr_e('Subscribe', 'give'); ?>">
621 621
 					</td>
622 622
 				</tr>
623 623
 			</table>
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
  *
671 671
  * @return string
672 672
  */
673
-function give_svg_icons( $icon ) {
673
+function give_svg_icons($icon) {
674 674
 
675 675
 	// Store your SVGs in an associative array
676 676
 	$svgs = array(
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 	);
683 683
 
684 684
 	// Return the chosen icon's SVG string
685
-	return $svgs[ $icon ];
685
+	return $svgs[$icon];
686 686
 }
687 687
 
688 688
 /**
@@ -694,15 +694,15 @@  discard block
 block discarded – undo
694 694
  *
695 695
  * @return mixed
696 696
  */
697
-function modify_nav_menu_meta_box_object( $post_type ) {
698
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
699
-		$post_type->labels->name = esc_html__( 'Donation Forms', 'give' );
697
+function modify_nav_menu_meta_box_object($post_type) {
698
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
699
+		$post_type->labels->name = esc_html__('Donation Forms', 'give');
700 700
 	}
701 701
 
702 702
 	return $post_type;
703 703
 }
704 704
 
705
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
705
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
706 706
 
707 707
 /**
708 708
  * Show Donation Forms Post Type in Appearance > Menus by default on fresh install.
@@ -721,35 +721,35 @@  discard block
 block discarded – undo
721 721
 	// Proceed, if current screen is navigation menus.
722 722
 	if (
723 723
 		'nav-menus' === $screen->id &&
724
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) ) &&
725
-		! get_user_option( 'give_is_donation_forms_menu_updated' )
724
+		give_is_setting_enabled(give_get_option('forms_singular')) &&
725
+		! get_user_option('give_is_donation_forms_menu_updated')
726 726
 	) {
727 727
 
728 728
 		// Return false, if it fails to retrieve hidden meta box list and is not admin.
729 729
 		if (
730 730
 			! is_admin() ||
731
-			( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) )
731
+			( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus'))
732 732
 		) {
733 733
 			return false;
734 734
 		}
735 735
 
736 736
 		// Return false, In case, we don't find 'Donation Form' in hidden meta box list.
737
-		if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) {
737
+		if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) {
738 738
 			return false;
739 739
 		}
740 740
 
741 741
 		// Exclude 'Donation Form' value from hidden meta box's list.
742
-		$hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) );
742
+		$hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms'));
743 743
 
744 744
 		// Get current user ID.
745 745
 		$user = wp_get_current_user();
746 746
 
747
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
748
-		update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true );
747
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
748
+		update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true);
749 749
 	}
750 750
 }
751 751
 
752
-add_action( 'current_screen', 'give_donation_metabox_menu' );
752
+add_action('current_screen', 'give_donation_metabox_menu');
753 753
 
754 754
 /**
755 755
  * Array_column backup usage
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
  * @license    https://opensource.org/licenses/MIT MIT
763 763
  */
764 764
 
765
-if ( ! function_exists( 'array_column' ) ) {
765
+if ( ! function_exists('array_column')) {
766 766
 	/**
767 767
 	 * Returns the values from a single column of the input array, identified by
768 768
 	 * the $columnKey.
@@ -781,53 +781,53 @@  discard block
 block discarded – undo
781 781
 	 *
782 782
 	 * @return array
783 783
 	 */
784
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
784
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
785 785
 		// Using func_get_args() in order to check for proper number of
786 786
 		// parameters and trigger errors exactly as the built-in array_column()
787 787
 		// does in PHP 5.5.
788 788
 		$argc   = func_num_args();
789 789
 		$params = func_get_args();
790 790
 
791
-		if ( $argc < 2 ) {
792
-			trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING );
791
+		if ($argc < 2) {
792
+			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING);
793 793
 
794 794
 			return null;
795 795
 		}
796 796
 
797
-		if ( ! is_array( $params[0] ) ) {
798
-			trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING );
797
+		if ( ! is_array($params[0])) {
798
+			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING);
799 799
 
800 800
 			return null;
801 801
 		}
802 802
 
803
-		if ( ! is_int( $params[1] )
804
-		     && ! is_float( $params[1] )
805
-		     && ! is_string( $params[1] )
803
+		if ( ! is_int($params[1])
804
+		     && ! is_float($params[1])
805
+		     && ! is_string($params[1])
806 806
 		     && $params[1] !== null
807
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
807
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
808 808
 		) {
809
-			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
809
+			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING);
810 810
 
811 811
 			return false;
812 812
 		}
813 813
 
814
-		if ( isset( $params[2] )
815
-		     && ! is_int( $params[2] )
816
-		     && ! is_float( $params[2] )
817
-		     && ! is_string( $params[2] )
818
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
814
+		if (isset($params[2])
815
+		     && ! is_int($params[2])
816
+		     && ! is_float($params[2])
817
+		     && ! is_string($params[2])
818
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
819 819
 		) {
820
-			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
820
+			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING);
821 821
 
822 822
 			return false;
823 823
 		}
824 824
 
825 825
 		$paramsInput     = $params[0];
826
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
826
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
827 827
 
828 828
 		$paramsIndexKey = null;
829
-		if ( isset( $params[2] ) ) {
830
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
829
+		if (isset($params[2])) {
830
+			if (is_float($params[2]) || is_int($params[2])) {
831 831
 				$paramsIndexKey = (int) $params[2];
832 832
 			} else {
833 833
 				$paramsIndexKey = (string) $params[2];
@@ -836,26 +836,26 @@  discard block
 block discarded – undo
836 836
 
837 837
 		$resultArray = array();
838 838
 
839
-		foreach ( $paramsInput as $row ) {
839
+		foreach ($paramsInput as $row) {
840 840
 			$key    = $value = null;
841 841
 			$keySet = $valueSet = false;
842 842
 
843
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
843
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
844 844
 				$keySet = true;
845
-				$key    = (string) $row[ $paramsIndexKey ];
845
+				$key    = (string) $row[$paramsIndexKey];
846 846
 			}
847 847
 
848
-			if ( $paramsColumnKey === null ) {
848
+			if ($paramsColumnKey === null) {
849 849
 				$valueSet = true;
850 850
 				$value    = $row;
851
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
851
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
852 852
 				$valueSet = true;
853
-				$value    = $row[ $paramsColumnKey ];
853
+				$value    = $row[$paramsColumnKey];
854 854
 			}
855 855
 
856
-			if ( $valueSet ) {
857
-				if ( $keySet ) {
858
-					$resultArray[ $key ] = $value;
856
+			if ($valueSet) {
857
+				if ($keySet) {
858
+					$resultArray[$key] = $value;
859 859
 				} else {
860 860
 					$resultArray[] = $value;
861 861
 				}
@@ -875,54 +875,54 @@  discard block
 block discarded – undo
875 875
  *
876 876
  * @return bool Whether the receipt is visible or not.
877 877
  */
878
-function give_can_view_receipt( $payment_key = '' ) {
878
+function give_can_view_receipt($payment_key = '') {
879 879
 
880 880
 	$return = false;
881 881
 
882
-	if ( empty( $payment_key ) ) {
882
+	if (empty($payment_key)) {
883 883
 		return $return;
884 884
 	}
885 885
 
886 886
 	global $give_receipt_args;
887 887
 
888
-	$give_receipt_args['id'] = give_get_donation_id_by_key( $payment_key );
888
+	$give_receipt_args['id'] = give_get_donation_id_by_key($payment_key);
889 889
 
890
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
890
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
891 891
 
892
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
892
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
893 893
 
894
-	if ( is_user_logged_in() ) {
895
-		if ( $user_id === (int) get_current_user_id() ) {
894
+	if (is_user_logged_in()) {
895
+		if ($user_id === (int) get_current_user_id()) {
896 896
 			$return = true;
897
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
897
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
898 898
 			$return = true;
899
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
899
+		} elseif (current_user_can('view_give_sensitive_data')) {
900 900
 			$return = true;
901 901
 		}
902 902
 	}
903 903
 
904 904
 	// Check whether it is purchase session?
905 905
 	$purchase_session = give_get_purchase_session();
906
-	if ( ! empty( $purchase_session ) && ! is_user_logged_in() ) {
907
-		if ( $purchase_session['purchase_key'] === $payment_meta['key'] ) {
906
+	if ( ! empty($purchase_session) && ! is_user_logged_in()) {
907
+		if ($purchase_session['purchase_key'] === $payment_meta['key']) {
908 908
 			$return = true;
909 909
 		}
910 910
 	}
911 911
 
912 912
 	// Check whether it is receipt access session?
913 913
 	$receipt_session = give_get_receipt_session();
914
-	if ( ! empty( $receipt_session ) && ! is_user_logged_in() ) {
915
-		if ( $receipt_session === $payment_meta['key'] ) {
914
+	if ( ! empty($receipt_session) && ! is_user_logged_in()) {
915
+		if ($receipt_session === $payment_meta['key']) {
916 916
 			$return = true;
917 917
 		}
918 918
 	}
919 919
 
920 920
 	// Check whether it is history access session?
921
-	if ( true === give_get_history_session() ) {
921
+	if (true === give_get_history_session()) {
922 922
 		$return = true;
923 923
 	}
924 924
 
925
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
925
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
926 926
 
927 927
 }
928 928
 
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
  *
932 932
  * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
933 933
  */
934
-if ( ! function_exists( 'cal_days_in_month' ) ) {
934
+if ( ! function_exists('cal_days_in_month')) {
935 935
 	/**
936 936
 	 * cal_days_in_month
937 937
 	 *
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
 	 *
942 942
 	 * @return bool|string
943 943
 	 */
944
-	function cal_days_in_month( $calendar, $month, $year ) {
945
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
944
+	function cal_days_in_month($calendar, $month, $year) {
945
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
946 946
 	}
947 947
 }
948 948
 
@@ -961,40 +961,40 @@  discard block
 block discarded – undo
961 961
  */
962 962
 function give_get_plugins() {
963 963
 	$plugins             = get_plugins();
964
-	$active_plugin_paths = (array) get_option( 'active_plugins', array() );
964
+	$active_plugin_paths = (array) get_option('active_plugins', array());
965 965
 
966
-	if ( is_multisite() ) {
967
-		$network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
968
-		$active_plugin_paths            = array_merge( $active_plugin_paths, $network_activated_plugin_paths );
966
+	if (is_multisite()) {
967
+		$network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array()));
968
+		$active_plugin_paths            = array_merge($active_plugin_paths, $network_activated_plugin_paths);
969 969
 	}
970 970
 
971
-	foreach ( $plugins as $plugin_path => $plugin_data ) {
971
+	foreach ($plugins as $plugin_path => $plugin_data) {
972 972
 		// Is plugin active?
973
-		if ( in_array( $plugin_path, $active_plugin_paths ) ) {
974
-			$plugins[ $plugin_path ]['Status'] = 'active';
973
+		if (in_array($plugin_path, $active_plugin_paths)) {
974
+			$plugins[$plugin_path]['Status'] = 'active';
975 975
 		} else {
976
-			$plugins[ $plugin_path ]['Status'] = 'inactive';
976
+			$plugins[$plugin_path]['Status'] = 'inactive';
977 977
 		}
978 978
 
979
-		$dirname = strtolower( dirname( $plugin_path ) );
979
+		$dirname = strtolower(dirname($plugin_path));
980 980
 
981 981
 		// Is plugin a Give add-on by WordImpress?
982
-		if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) {
982
+		if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) {
983 983
 			// Plugin is a Give-addon.
984
-			$plugins[ $plugin_path ]['Type'] = 'add-on';
984
+			$plugins[$plugin_path]['Type'] = 'add-on';
985 985
 
986 986
 			/* @var stdClass $license_active */
987
-			$license_active = __give_get_active_license_info( Give_License::get_short_name( $plugin_data['Name'] ) );
987
+			$license_active = __give_get_active_license_info(Give_License::get_short_name($plugin_data['Name']));
988 988
 
989 989
 			// Does a valid license exist?
990
-			if ( ! empty( $license_active ) && 'valid' === $license_active->license ) {
991
-				$plugins[ $plugin_path ]['License'] = true;
990
+			if ( ! empty($license_active) && 'valid' === $license_active->license) {
991
+				$plugins[$plugin_path]['License'] = true;
992 992
 			} else {
993
-				$plugins[ $plugin_path ]['License'] = false;
993
+				$plugins[$plugin_path]['License'] = false;
994 994
 			}
995 995
 		} else {
996 996
 			// Plugin is not a Give add-on.
997
-			$plugins[ $plugin_path ]['Type'] = 'other';
997
+			$plugins[$plugin_path]['Type'] = 'other';
998 998
 		}
999 999
 	}
1000 1000
 
@@ -1010,16 +1010,16 @@  discard block
 block discarded – undo
1010 1010
  *
1011 1011
  * @return bool
1012 1012
  */
1013
-function give_is_terms_enabled( $form_id ) {
1014
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1013
+function give_is_terms_enabled($form_id) {
1014
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1015 1015
 
1016 1016
 	if (
1017
-		give_is_setting_enabled( $form_option, 'global' )
1018
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1017
+		give_is_setting_enabled($form_option, 'global')
1018
+		&& give_is_setting_enabled(give_get_option('terms'))
1019 1019
 	) {
1020 1020
 		return true;
1021 1021
 
1022
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1022
+	} elseif (give_is_setting_enabled($form_option)) {
1023 1023
 		return true;
1024 1024
 
1025 1025
 	} else {
@@ -1043,10 +1043,10 @@  discard block
 block discarded – undo
1043 1043
  *
1044 1044
  * @return WP_Error|bool
1045 1045
  */
1046
-function give_delete_donation_stats( $date_range = '', $args = array() ) {
1046
+function give_delete_donation_stats($date_range = '', $args = array()) {
1047 1047
 
1048 1048
 	// Delete all cache.
1049
-	$status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) );
1049
+	$status = Give_Cache::delete(Give_Cache::get_options_like('give_stats'));
1050 1050
 
1051 1051
 	/**
1052 1052
 	 * Fire the action when donation stats delete.
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	 * @param string|array $date_range
1057 1057
 	 * @param array        $args
1058 1058
 	 */
1059
-	do_action( 'give_delete_donation_stats', $status, $date_range, $args );
1059
+	do_action('give_delete_donation_stats', $status, $date_range, $args);
1060 1060
 
1061 1061
 	return $status;
1062 1062
 }
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 function give_is_add_new_form_page() {
1071 1071
 	$status = false;
1072 1072
 
1073
-	if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) {
1073
+	if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) {
1074 1074
 		$status = true;
1075 1075
 	}
1076 1076
 
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
  *
1094 1094
  * @return mixed
1095 1095
  */
1096
-function give_get_meta( $id, $meta_key = '', $single = false, $default = false ) {
1096
+function give_get_meta($id, $meta_key = '', $single = false, $default = false) {
1097 1097
 	/**
1098 1098
 	 * Filter the meta value
1099 1099
 	 *
@@ -1101,14 +1101,14 @@  discard block
 block discarded – undo
1101 1101
 	 */
1102 1102
 	$meta_value = apply_filters(
1103 1103
 		'give_get_meta',
1104
-		get_post_meta( $id, $meta_key, $single ),
1104
+		get_post_meta($id, $meta_key, $single),
1105 1105
 		$id,
1106 1106
 		$meta_key,
1107 1107
 		$default
1108 1108
 	);
1109 1109
 
1110 1110
 	if (
1111
-		( empty( $meta_key ) || empty( $meta_value ) )
1111
+		(empty($meta_key) || empty($meta_value))
1112 1112
 		&& $default
1113 1113
 	) {
1114 1114
 		$meta_value = $default;
@@ -1129,15 +1129,15 @@  discard block
 block discarded – undo
1129 1129
  *
1130 1130
  * @return mixed
1131 1131
  */
1132
-function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) {
1133
-	$status = update_post_meta( $id, $meta_key, $meta_value, $prev_value );
1132
+function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') {
1133
+	$status = update_post_meta($id, $meta_key, $meta_value, $prev_value);
1134 1134
 
1135 1135
 	/**
1136 1136
 	 * Filter the meta value update status
1137 1137
 	 *
1138 1138
 	 * @since 1.8.8
1139 1139
 	 */
1140
-	return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value );
1140
+	return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value);
1141 1141
 }
1142 1142
 
1143 1143
 /**
@@ -1151,15 +1151,15 @@  discard block
 block discarded – undo
1151 1151
  *
1152 1152
  * @return mixed
1153 1153
  */
1154
-function give_delete_meta( $id, $meta_key, $meta_value = '' ) {
1155
-	$status = delete_post_meta( $id, $meta_key, $meta_value );
1154
+function give_delete_meta($id, $meta_key, $meta_value = '') {
1155
+	$status = delete_post_meta($id, $meta_key, $meta_value);
1156 1156
 
1157 1157
 	/**
1158 1158
 	 * Filter the meta value delete status
1159 1159
 	 *
1160 1160
 	 * @since 1.8.8
1161 1161
 	 */
1162
-	return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value );
1162
+	return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value);
1163 1163
 }
1164 1164
 
1165 1165
 /**
@@ -1171,23 +1171,23 @@  discard block
 block discarded – undo
1171 1171
  *
1172 1172
  * @return bool                   If the action has been added to the completed actions array
1173 1173
  */
1174
-function give_has_upgrade_completed( $upgrade_action = '' ) {
1174
+function give_has_upgrade_completed($upgrade_action = '') {
1175 1175
 	// Bailout.
1176
-	if ( empty( $upgrade_action ) ) {
1176
+	if (empty($upgrade_action)) {
1177 1177
 		return false;
1178 1178
 	}
1179 1179
 
1180 1180
 	// Fresh install?
1181 1181
 	// If fresh install then all upgrades will be consider as completed.
1182
-	$is_fresh_install = ! get_option( 'give_version' );
1183
-	if ( $is_fresh_install ) {
1182
+	$is_fresh_install = ! get_option('give_version');
1183
+	if ($is_fresh_install) {
1184 1184
 		return true;
1185 1185
 	}
1186 1186
 
1187 1187
 
1188 1188
 	$completed_upgrades = give_get_completed_upgrades();
1189 1189
 
1190
-	return in_array( $upgrade_action, $completed_upgrades );
1190
+	return in_array($upgrade_action, $completed_upgrades);
1191 1191
 
1192 1192
 }
1193 1193
 
@@ -1199,8 +1199,8 @@  discard block
 block discarded – undo
1199 1199
  * @return mixed   When nothing to resume returns false, otherwise starts the upgrade where it left off
1200 1200
  */
1201 1201
 function give_maybe_resume_upgrade() {
1202
-	$doing_upgrade = get_option( 'give_doing_upgrade', false );
1203
-	if ( empty( $doing_upgrade ) ) {
1202
+	$doing_upgrade = get_option('give_doing_upgrade', false);
1203
+	if (empty($doing_upgrade)) {
1204 1204
 		return false;
1205 1205
 	}
1206 1206
 
@@ -1216,9 +1216,9 @@  discard block
 block discarded – undo
1216 1216
  *
1217 1217
  * @return bool                   If the function was successfully added
1218 1218
  */
1219
-function give_set_upgrade_complete( $upgrade_action = '' ) {
1219
+function give_set_upgrade_complete($upgrade_action = '') {
1220 1220
 
1221
-	if ( empty( $upgrade_action ) ) {
1221
+	if (empty($upgrade_action)) {
1222 1222
 		return false;
1223 1223
 	}
1224 1224
 
@@ -1226,16 +1226,16 @@  discard block
 block discarded – undo
1226 1226
 	$completed_upgrades[] = $upgrade_action;
1227 1227
 
1228 1228
 	// Remove any blanks, and only show uniques.
1229
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
1229
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
1230 1230
 
1231 1231
 	/**
1232 1232
 	 * Fire the action when any upgrade set to complete.
1233 1233
 	 *
1234 1234
 	 * @since 1.8.12
1235 1235
 	 */
1236
-	do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades );
1236
+	do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades);
1237 1237
 
1238
-	return update_option( 'give_completed_upgrades', $completed_upgrades, 'no' );
1238
+	return update_option('give_completed_upgrades', $completed_upgrades, 'no');
1239 1239
 }
1240 1240
 
1241 1241
 /**
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
  * @return array The array of completed upgrades
1246 1246
  */
1247 1247
 function give_get_completed_upgrades() {
1248
-	return (array) get_option( 'give_completed_upgrades' );
1248
+	return (array) get_option('give_completed_upgrades');
1249 1249
 }
1250 1250
 
1251 1251
 /**
@@ -1260,16 +1260,16 @@  discard block
 block discarded – undo
1260 1260
  *
1261 1261
  * @return null|array
1262 1262
  */
1263
-function __give_v20_bc_table_details( $type ) {
1263
+function __give_v20_bc_table_details($type) {
1264 1264
 	global $wpdb;
1265 1265
 	$table = array();
1266 1266
 
1267 1267
 	// Bailout.
1268
-	if ( empty( $type ) ) {
1268
+	if (empty($type)) {
1269 1269
 		return null;
1270 1270
 	}
1271 1271
 
1272
-	switch ( $type ) {
1272
+	switch ($type) {
1273 1273
 		case 'form':
1274 1274
 			$table['name']         = $wpdb->formmeta;
1275 1275
 			$table['column']['id'] = 'form_id';
@@ -1282,7 +1282,7 @@  discard block
 block discarded – undo
1282 1282
 	}
1283 1283
 
1284 1284
 	// Backward compatibility.
1285
-	if ( ! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) ) {
1285
+	if ( ! give_has_upgrade_completed('v20_move_metadata_into_new_table')) {
1286 1286
 		$table['name']         = $wpdb->postmeta;
1287 1287
 		$table['column']['id'] = 'post_id';
1288 1288
 	}
@@ -1298,12 +1298,12 @@  discard block
 block discarded – undo
1298 1298
  *
1299 1299
  * @param WP_Query $query
1300 1300
  */
1301
-function give_remove_pages_from_search( $query ) {
1301
+function give_remove_pages_from_search($query) {
1302 1302
 
1303
-	if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
1303
+	if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) {
1304 1304
 
1305
-		$transaction_failed = give_get_option( 'failure_page', 0 );
1306
-		$success_page       = give_get_option( 'success_page', 0 );
1305
+		$transaction_failed = give_get_option('failure_page', 0);
1306
+		$success_page       = give_get_option('success_page', 0);
1307 1307
 
1308 1308
 		$args               = apply_filters(
1309 1309
 			'give_remove_pages_from_search', array(
@@ -1311,11 +1311,11 @@  discard block
 block discarded – undo
1311 1311
 			$success_page,
1312 1312
 		), $query
1313 1313
 		);
1314
-		$query->set( 'post__not_in', $args );
1314
+		$query->set('post__not_in', $args);
1315 1315
 	}
1316 1316
 }
1317 1317
 
1318
-add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 );
1318
+add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1);
1319 1319
 
1320 1320
 /**
1321 1321
  * Inserts a new key/value before a key in the array.
@@ -1331,14 +1331,14 @@  discard block
 block discarded – undo
1331 1331
  *
1332 1332
  * @see   array_insert_before()
1333 1333
  */
1334
-function give_array_insert_before( $key, array &$array, $new_key, $new_value ) {
1335
-	if ( array_key_exists( $key, $array ) ) {
1334
+function give_array_insert_before($key, array &$array, $new_key, $new_value) {
1335
+	if (array_key_exists($key, $array)) {
1336 1336
 		$new = array();
1337
-		foreach ( $array as $k => $value ) {
1338
-			if ( $k === $key ) {
1339
-				$new[ $new_key ] = $new_value;
1337
+		foreach ($array as $k => $value) {
1338
+			if ($k === $key) {
1339
+				$new[$new_key] = $new_value;
1340 1340
 			}
1341
-			$new[ $k ] = $value;
1341
+			$new[$k] = $value;
1342 1342
 		}
1343 1343
 
1344 1344
 		return $new;
@@ -1361,13 +1361,13 @@  discard block
 block discarded – undo
1361 1361
  *
1362 1362
  * @see   array_insert_before()
1363 1363
  */
1364
-function give_array_insert_after( $key, array &$array, $new_key, $new_value ) {
1365
-	if ( array_key_exists( $key, $array ) ) {
1364
+function give_array_insert_after($key, array &$array, $new_key, $new_value) {
1365
+	if (array_key_exists($key, $array)) {
1366 1366
 		$new = array();
1367
-		foreach ( $array as $k => $value ) {
1368
-			$new[ $k ] = $value;
1369
-			if ( $k === $key ) {
1370
-				$new[ $new_key ] = $new_value;
1367
+		foreach ($array as $k => $value) {
1368
+			$new[$k] = $value;
1369
+			if ($k === $key) {
1370
+				$new[$new_key] = $new_value;
1371 1371
 			}
1372 1372
 		}
1373 1373
 
@@ -1394,21 +1394,21 @@  discard block
 block discarded – undo
1394 1394
  *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
1395 1395
  *               `$list` will be preserved in the results.
1396 1396
  */
1397
-function give_list_pluck( $list, $field, $index_key = null ) {
1397
+function give_list_pluck($list, $field, $index_key = null) {
1398 1398
 
1399
-	if ( ! $index_key ) {
1399
+	if ( ! $index_key) {
1400 1400
 		/**
1401 1401
 		 * This is simple. Could at some point wrap array_column()
1402 1402
 		 * if we knew we had an array of arrays.
1403 1403
 		 */
1404
-		foreach ( $list as $key => $value ) {
1405
-			if ( is_object( $value ) ) {
1406
-				if ( isset( $value->$field ) ) {
1407
-					$list[ $key ] = $value->$field;
1404
+		foreach ($list as $key => $value) {
1405
+			if (is_object($value)) {
1406
+				if (isset($value->$field)) {
1407
+					$list[$key] = $value->$field;
1408 1408
 				}
1409 1409
 			} else {
1410
-				if ( isset( $value[ $field ] ) ) {
1411
-					$list[ $key ] = $value[ $field ];
1410
+				if (isset($value[$field])) {
1411
+					$list[$key] = $value[$field];
1412 1412
 				}
1413 1413
 			}
1414 1414
 		}
@@ -1421,18 +1421,18 @@  discard block
 block discarded – undo
1421 1421
 	 * to the end of the stack. This is how array_column() behaves.
1422 1422
 	 */
1423 1423
 	$newlist = array();
1424
-	foreach ( $list as $value ) {
1425
-		if ( is_object( $value ) ) {
1426
-			if ( isset( $value->$index_key ) ) {
1427
-				$newlist[ $value->$index_key ] = $value->$field;
1424
+	foreach ($list as $value) {
1425
+		if (is_object($value)) {
1426
+			if (isset($value->$index_key)) {
1427
+				$newlist[$value->$index_key] = $value->$field;
1428 1428
 			} else {
1429 1429
 				$newlist[] = $value->$field;
1430 1430
 			}
1431 1431
 		} else {
1432
-			if ( isset( $value[ $index_key ] ) ) {
1433
-				$newlist[ $value[ $index_key ] ] = $value[ $field ];
1432
+			if (isset($value[$index_key])) {
1433
+				$newlist[$value[$index_key]] = $value[$field];
1434 1434
 			} else {
1435
-				$newlist[] = $value[ $field ];
1435
+				$newlist[] = $value[$field];
1436 1436
 			}
1437 1437
 		}
1438 1438
 	}
@@ -1455,8 +1455,8 @@  discard block
 block discarded – undo
1455 1455
  *
1456 1456
  * @return int|false Meta ID on success, false on failure.
1457 1457
  */
1458
-function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) {
1459
-	return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique );
1458
+function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) {
1459
+	return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique);
1460 1460
 }
1461 1461
 
1462 1462
 /**
@@ -1474,8 +1474,8 @@  discard block
 block discarded – undo
1474 1474
  *
1475 1475
  * @return bool True on success, false on failure.
1476 1476
  */
1477
-function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) {
1478
-	return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value );
1477
+function delete_donor_meta($donor_id, $meta_key, $meta_value = '') {
1478
+	return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value);
1479 1479
 }
1480 1480
 
1481 1481
 /**
@@ -1490,8 +1490,8 @@  discard block
 block discarded – undo
1490 1490
  * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
1491 1491
  *  is true.
1492 1492
  */
1493
-function get_donor_meta( $donor_id, $key = '', $single = false ) {
1494
-	return get_metadata( 'give_customer', $donor_id, $key, $single );
1493
+function get_donor_meta($donor_id, $key = '', $single = false) {
1494
+	return get_metadata('give_customer', $donor_id, $key, $single);
1495 1495
 }
1496 1496
 
1497 1497
 /**
@@ -1508,8 +1508,8 @@  discard block
 block discarded – undo
1508 1508
  *
1509 1509
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
1510 1510
  */
1511
-function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) {
1512
-	return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value );
1511
+function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') {
1512
+	return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value);
1513 1513
 }
1514 1514
 
1515 1515
 
@@ -1522,15 +1522,15 @@  discard block
 block discarded – undo
1522 1522
  *
1523 1523
  * @return void
1524 1524
  */
1525
-function give_recount_form_income_donation( $form_id = 0 ) {
1525
+function give_recount_form_income_donation($form_id = 0) {
1526 1526
 	// Check if form id is not empty.
1527
-	if ( ! empty( $form_id ) ) {
1527
+	if ( ! empty($form_id)) {
1528 1528
 		/**
1529 1529
 		 * Filter to modify payment status.
1530 1530
 		 *
1531 1531
 		 * @since 1.8.13
1532 1532
 		 */
1533
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
1533
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
1534 1534
 
1535 1535
 		/**
1536 1536
 		 * Filter to modify args of payment query before recalculating the form total
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
 			'give_recount_form_stats_args', array(
1542 1542
 				'give_forms'     => $form_id,
1543 1543
 				'status'         => $accepted_statuses,
1544
-				'posts_per_page' => - 1,
1544
+				'posts_per_page' => -1,
1545 1545
 				'fields'         => 'ids',
1546 1546
 			)
1547 1547
 		);
@@ -1551,28 +1551,28 @@  discard block
 block discarded – undo
1551 1551
 			'earnings' => 0,
1552 1552
 		);
1553 1553
 
1554
-		$payments = new Give_Payments_Query( $args );
1554
+		$payments = new Give_Payments_Query($args);
1555 1555
 		$payments = $payments->get_payments();
1556 1556
 
1557
-		if ( $payments ) {
1558
-			foreach ( $payments as $payment ) {
1557
+		if ($payments) {
1558
+			foreach ($payments as $payment) {
1559 1559
 				// Ensure acceptible status only
1560
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
1560
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
1561 1561
 					continue;
1562 1562
 				}
1563 1563
 
1564 1564
 				// Ensure only payments for this form are counted
1565
-				if ( $payment->form_id != $form_id ) {
1565
+				if ($payment->form_id != $form_id) {
1566 1566
 					continue;
1567 1567
 				}
1568 1568
 
1569
-				$totals['sales'] ++;
1569
+				$totals['sales']++;
1570 1570
 				$totals['earnings'] += $payment->total;
1571 1571
 
1572 1572
 			}
1573 1573
 		}
1574
-		give_update_meta( $form_id, '_give_form_sales', $totals['sales'] );
1575
-		give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
1574
+		give_update_meta($form_id, '_give_form_sales', $totals['sales']);
1575
+		give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
1576 1576
 	}// End if().
1577 1577
 }
1578 1578
 
@@ -1586,18 +1586,18 @@  discard block
 block discarded – undo
1586 1586
  *
1587 1587
  * @return string
1588 1588
  */
1589
-function give_get_attribute_str( $attributes ) {
1589
+function give_get_attribute_str($attributes) {
1590 1590
 	$attribute_str = '';
1591 1591
 
1592
-	if ( empty( $attributes ) ) {
1592
+	if (empty($attributes)) {
1593 1593
 		return $attribute_str;
1594 1594
 	}
1595 1595
 
1596
-	foreach ( $attributes as $tag => $value ) {
1596
+	foreach ($attributes as $tag => $value) {
1597 1597
 		$attribute_str .= " {$tag}=\"{$value}\"";
1598 1598
 	}
1599 1599
 
1600
-	return trim( $attribute_str );
1600
+	return trim($attribute_str);
1601 1601
 }
1602 1602
 
1603 1603
 /**
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 function give_get_wp_upload_dir() {
1611 1611
 	$wp_upload_dir = wp_upload_dir();
1612 1612
 
1613
-	return ( ! empty( $wp_upload_dir['path'] ) ? $wp_upload_dir['path'] : false );
1613
+	return ( ! empty($wp_upload_dir['path']) ? $wp_upload_dir['path'] : false);
1614 1614
 }
1615 1615
 
1616 1616
 /**
@@ -1622,15 +1622,15 @@  discard block
 block discarded – undo
1622 1622
  *
1623 1623
  * @return string|bool $file_contents File content
1624 1624
  */
1625
-function give_get_core_settings_json( $file_name ) {
1625
+function give_get_core_settings_json($file_name) {
1626 1626
 	$upload_dir = give_get_wp_upload_dir();
1627
-	$file_path  = $upload_dir . '/' . $file_name;
1627
+	$file_path  = $upload_dir.'/'.$file_name;
1628 1628
 
1629
-	if ( is_wp_error( $file_path ) || empty( $file_path ) ) {
1630
-		Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
1629
+	if (is_wp_error($file_path) || empty($file_path)) {
1630
+		Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
1631 1631
 	}
1632 1632
 
1633
-	$file_contents = file_get_contents( $file_path );
1633
+	$file_contents = file_get_contents($file_path);
1634 1634
 
1635 1635
 	return $file_contents;
1636 1636
 }
@@ -1643,7 +1643,7 @@  discard block
 block discarded – undo
1643 1643
  * @return int $country The two letter country code for the site's base country
1644 1644
  */
1645 1645
 function give_get_limit_display_donations() {
1646
-	return give_get_option( 'limit_display_donations', 1 );
1646
+	return give_get_option('limit_display_donations', 1);
1647 1647
 }
1648 1648
 
1649 1649
 /**
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
  * @since 1.8.17
1653 1653
  */
1654 1654
 function give_donation_history_table_end() {
1655
-	$email = Give()->session->get( 'give_email' );
1655
+	$email = Give()->session->get('give_email');
1656 1656
 	?>
1657 1657
 	<tfoot>
1658 1658
 	<tr>
@@ -1661,16 +1661,16 @@  discard block
 block discarded – undo
1661 1661
 				<div class="give-security-column give-security-description-wrap">
1662 1662
 					<?php
1663 1663
 					echo sprintf(
1664
-						__( 'For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give' ),
1664
+						__('For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give'),
1665 1665
 						$email
1666 1666
 					);
1667 1667
 					?>
1668 1668
 				</div>
1669 1669
 				<div class="give-security-column give-security-button-wrap">
1670 1670
 					<a href="#" data-email="<?php echo $email; ?>" id="give-confirm-email-btn" class="give-confirm-email-btn give-btn">
1671
-						<?php _e( 'Confirm Email', 'give' ); ?>
1671
+						<?php _e('Confirm Email', 'give'); ?>
1672 1672
 					</a>
1673
-					<span><?php _e( 'Email Sent!', 'give' ); ?></span>
1673
+					<span><?php _e('Email Sent!', 'give'); ?></span>
1674 1674
 				</div>
1675 1675
 			</div>
1676 1676
 		</td>
@@ -1690,10 +1690,10 @@  discard block
 block discarded – undo
1690 1690
  *
1691 1691
  * @return void
1692 1692
  */
1693
-function give_doing_it_wrong( $function, $message, $version ) {
1694
-	$message .= "\nBacktrace:" . wp_debug_backtrace_summary();
1693
+function give_doing_it_wrong($function, $message, $version) {
1694
+	$message .= "\nBacktrace:".wp_debug_backtrace_summary();
1695 1695
 
1696
-	_doing_it_wrong( $function, $message , $version );
1696
+	_doing_it_wrong($function, $message, $version);
1697 1697
 }
1698 1698
 
1699 1699
 
@@ -1702,11 +1702,11 @@  discard block
 block discarded – undo
1702 1702
  *
1703 1703
  * @since 1.8.18
1704 1704
  */
1705
-function give_ignore_user_abort(){
1706
-	ignore_user_abort( true );
1705
+function give_ignore_user_abort() {
1706
+	ignore_user_abort(true);
1707 1707
 
1708
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
1709
-		set_time_limit( 0 );
1708
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
1709
+		set_time_limit(0);
1710 1710
 	}
1711 1711
 }
1712 1712
 
@@ -1720,28 +1720,28 @@  discard block
 block discarded – undo
1720 1720
  *
1721 1721
  * @return int
1722 1722
  */
1723
-function give_get_total_post_type_count( $post_type = '', $args = array() ){
1723
+function give_get_total_post_type_count($post_type = '', $args = array()) {
1724 1724
 	global $wpdb;
1725 1725
 	$where = '';
1726 1726
 
1727
-	if( ! $post_type ) {
1727
+	if ( ! $post_type) {
1728 1728
 		return 0;
1729 1729
 	}
1730 1730
 
1731 1731
 	// Bulit where query
1732
-	if( ! empty( $post_type ) ) {
1733
-		$where.=' WHERE';
1732
+	if ( ! empty($post_type)) {
1733
+		$where .= ' WHERE';
1734 1734
 
1735
-		if( is_array( $post_type ) ) {
1736
-			$where .= " post_type='" . implode( "' OR post_type='", $post_type ) . "'";
1737
-		}else{
1735
+		if (is_array($post_type)) {
1736
+			$where .= " post_type='".implode("' OR post_type='", $post_type)."'";
1737
+		} else {
1738 1738
 			$where .= " post_type='{$post_type}'";
1739 1739
 		}
1740 1740
 	}
1741 1741
 
1742 1742
 	$result = $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts}{$where}");
1743 1743
 
1744
-	return absint( $result );
1744
+	return absint($result);
1745 1745
 }
1746 1746
 
1747 1747
 /**
@@ -1753,9 +1753,9 @@  discard block
 block discarded – undo
1753 1753
  *
1754 1754
  * @credit WooCommerce
1755 1755
  */
1756
-function give_maybe_define_constant( $name, $value ) {
1757
-	if ( ! defined( $name ) ) {
1758
-		define( $name, $value );
1756
+function give_maybe_define_constant($name, $value) {
1757
+	if ( ! defined($name)) {
1758
+		define($name, $value);
1759 1759
 	}
1760 1760
 }
1761 1761
 
@@ -1769,8 +1769,8 @@  discard block
 block discarded – undo
1769 1769
  *
1770 1770
  * @return string
1771 1771
  */
1772
-function give_time_do_tags( $string, $timestamp = 0 ) {
1773
-	$current_time = ! empty( $timestamp ) ? $timestamp : current_time( 'timestamp' );
1772
+function give_time_do_tags($string, $timestamp = 0) {
1773
+	$current_time = ! empty($timestamp) ? $timestamp : current_time('timestamp');
1774 1774
 
1775 1775
 	$formatted_string = str_replace(
1776 1776
 		array(
@@ -1786,15 +1786,15 @@  discard block
 block discarded – undo
1786 1786
 			'{S}'
1787 1787
 		),
1788 1788
 		array(
1789
-			date( 'j', $current_time ),
1790
-			date( 'd', $current_time ),
1791
-			date( 'n', $current_time ),
1792
-			date( 'm', $current_time ),
1793
-			date( 'Y', $current_time ),
1794
-			date( 'Y', $current_time ),
1795
-			date( 'G', $current_time ),
1796
-			date( 'H', $current_time ),
1797
-			date( 's', $current_time )
1789
+			date('j', $current_time),
1790
+			date('d', $current_time),
1791
+			date('n', $current_time),
1792
+			date('m', $current_time),
1793
+			date('Y', $current_time),
1794
+			date('Y', $current_time),
1795
+			date('G', $current_time),
1796
+			date('H', $current_time),
1797
+			date('s', $current_time)
1798 1798
 		),
1799 1799
 		$string
1800 1800
 	);
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
 	 *
1805 1805
 	 * @since 2.1.0
1806 1806
 	 */
1807
-	return apply_filters( 'give_time_do_tags', $formatted_string, $string, $timestamp );
1807
+	return apply_filters('give_time_do_tags', $formatted_string, $string, $timestamp);
1808 1808
 }
1809 1809
 
1810 1810
 
@@ -1817,20 +1817,20 @@  discard block
 block discarded – undo
1817 1817
  *
1818 1818
  * @return bool
1819 1819
  */
1820
-function give_is_company_field_enabled( $form_id ) {
1821
-	$form_setting_val           = give_get_meta( $form_id, '_give_company_field', true );
1822
-	$global_setting_val = give_get_option( 'company_field' );
1820
+function give_is_company_field_enabled($form_id) {
1821
+	$form_setting_val = give_get_meta($form_id, '_give_company_field', true);
1822
+	$global_setting_val = give_get_option('company_field');
1823 1823
 
1824
-	if ( ! empty( $form_setting_val ) ) {
1825
-		if( give_is_setting_enabled( $form_setting_val, array( 'required', 'optional' ) ) ) {
1824
+	if ( ! empty($form_setting_val)) {
1825
+		if (give_is_setting_enabled($form_setting_val, array('required', 'optional'))) {
1826 1826
 			return true;
1827
-		} elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val, array( 'required', 'optional' ) ) ) {
1827
+		} elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val, array('required', 'optional'))) {
1828 1828
 			return true;
1829
-		} else{
1829
+		} else {
1830 1830
 			return false;
1831 1831
 		}
1832 1832
 
1833
-	} elseif ( give_is_setting_enabled( $global_setting_val, array( 'required', 'optional' ) ) ) {
1833
+	} elseif (give_is_setting_enabled($global_setting_val, array('required', 'optional'))) {
1834 1834
 		return true;
1835 1835
 
1836 1836
 	} else {
@@ -1848,13 +1848,13 @@  discard block
 block discarded – undo
1848 1848
  *
1849 1849
  * @return array
1850 1850
  */
1851
-function __give_get_active_license_info( $license_id ) {
1851
+function __give_get_active_license_info($license_id) {
1852 1852
 	global $wpdb;
1853 1853
 	$option_name = "{$license_id}_license_active";
1854 1854
 	$data        = array();
1855 1855
 
1856
-	if ( ! isset( $GLOBALS['give_active_licenses_info'] ) ) {
1857
-		$GLOBALS['give_active_licenses_info']  = array();
1856
+	if ( ! isset($GLOBALS['give_active_licenses_info'])) {
1857
+		$GLOBALS['give_active_licenses_info'] = array();
1858 1858
 
1859 1859
 		$licenses_info = $wpdb->get_results(
1860 1860
 			"
@@ -1866,16 +1866,16 @@  discard block
 block discarded – undo
1866 1866
 			ARRAY_A
1867 1867
 		);
1868 1868
 
1869
-		if ( ! empty( $licenses_info ) ) {
1869
+		if ( ! empty($licenses_info)) {
1870 1870
 			$GLOBALS['give_active_licenses_info'] = array_combine(
1871
-				wp_list_pluck( $licenses_info, 'option_name' ),
1872
-				wp_list_pluck( $licenses_info, 'option_value' )
1871
+				wp_list_pluck($licenses_info, 'option_name'),
1872
+				wp_list_pluck($licenses_info, 'option_value')
1873 1873
 			);
1874 1874
 		}
1875 1875
 	}
1876 1876
 
1877
-	if ( in_array( $option_name, array_keys( $GLOBALS['give_active_licenses_info'] ) ) ) {
1878
-		$data = maybe_unserialize( $GLOBALS['give_active_licenses_info'][ $option_name ] );
1877
+	if (in_array($option_name, array_keys($GLOBALS['give_active_licenses_info']))) {
1878
+		$data = maybe_unserialize($GLOBALS['give_active_licenses_info'][$option_name]);
1879 1879
 	}
1880 1880
 
1881 1881
 	return $data;
@@ -1891,18 +1891,18 @@  discard block
 block discarded – undo
1891 1891
  *
1892 1892
  * @return array
1893 1893
  */
1894
-function __give_get_active_by_user_meta( $banner_addon_name ) {
1894
+function __give_get_active_by_user_meta($banner_addon_name) {
1895 1895
 	global $wpdb;
1896 1896
 
1897 1897
 	// Get the option key.
1898
-	$option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key( $banner_addon_name );
1898
+	$option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key($banner_addon_name);
1899 1899
 	$data        = array();
1900 1900
 
1901 1901
 	if (
1902
-		! isset( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] )
1903
-		|| empty( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] )
1902
+		! isset($GLOBALS['give_addon_activated_by_user'][$banner_addon_name])
1903
+		|| empty($GLOBALS['give_addon_activated_by_user'][$banner_addon_name])
1904 1904
 	) {
1905
-		$GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] = array();
1905
+		$GLOBALS['give_addon_activated_by_user'][$banner_addon_name] = array();
1906 1906
 
1907 1907
 		// Get the meta of activation banner by user.
1908 1908
 		$activation_banners = $wpdb->get_results(
@@ -1915,16 +1915,16 @@  discard block
 block discarded – undo
1915 1915
 			ARRAY_A
1916 1916
 		);
1917 1917
 
1918
-		if ( ! empty( $activation_banners ) ) {
1918
+		if ( ! empty($activation_banners)) {
1919 1919
 			$GLOBALS['give_addon_activated_by_user'] = array_combine(
1920
-				wp_list_pluck( $activation_banners, 'option_name' ),
1921
-				wp_list_pluck( $activation_banners, 'option_value' )
1920
+				wp_list_pluck($activation_banners, 'option_name'),
1921
+				wp_list_pluck($activation_banners, 'option_value')
1922 1922
 			);
1923 1923
 		}
1924 1924
 	}
1925 1925
 
1926
-	if ( in_array( $option_name, array_keys( $GLOBALS['give_addon_activated_by_user'] ) ) ) {
1927
-		$data = maybe_unserialize( $GLOBALS['give_addon_activated_by_user'][ $option_name ] );
1926
+	if (in_array($option_name, array_keys($GLOBALS['give_addon_activated_by_user']))) {
1927
+		$data = maybe_unserialize($GLOBALS['give_addon_activated_by_user'][$option_name]);
1928 1928
 	}
1929 1929
 
1930 1930
 	return $data;
@@ -1937,13 +1937,13 @@  discard block
 block discarded – undo
1937 1937
  *
1938 1938
  * @return int
1939 1939
  */
1940
-function give_get_nonce_life(){
1940
+function give_get_nonce_life() {
1941 1941
 	/**
1942 1942
 	 * Filters the lifespan of nonces in seconds.
1943 1943
 	 *
1944 1944
 	 * @see wp-inlucdes/pluggable.php:wp_nonce_tick
1945 1945
 	 */
1946
-	return (int) apply_filters( 'nonce_life', DAY_IN_SECONDS );
1946
+	return (int) apply_filters('nonce_life', DAY_IN_SECONDS);
1947 1947
 }
1948 1948
 
1949 1949
 /**
@@ -1957,11 +1957,11 @@  discard block
 block discarded – undo
1957 1957
  *
1958 1958
  * @return string
1959 1959
  */
1960
-function give_get_nonce_field( $action, $name, $referer = false ) {
1960
+function give_get_nonce_field($action, $name, $referer = false) {
1961 1961
 	return str_replace(
1962 1962
 		"id=\"{$name}\"",
1963 1963
 		'',
1964
-		wp_nonce_field( $action, $name, $referer, false )
1964
+		wp_nonce_field($action, $name, $referer, false)
1965 1965
 	);
1966 1966
 }
1967 1967
 
@@ -1974,31 +1974,31 @@  discard block
 block discarded – undo
1974 1974
  *
1975 1975
  * @return array
1976 1976
  */
1977
-function give_goal_progress_stats( $form ) {
1977
+function give_goal_progress_stats($form) {
1978 1978
 
1979
-	if ( ! $form instanceof Give_Donate_Form ) {
1980
-		$form = new Give_Donate_Form( $form );
1979
+	if ( ! $form instanceof Give_Donate_Form) {
1980
+		$form = new Give_Donate_Form($form);
1981 1981
 	}
1982 1982
 
1983 1983
 	$donors = '';
1984 1984
 
1985
-	$goal_format = give_get_form_goal_format( $form->ID );
1985
+	$goal_format = give_get_form_goal_format($form->ID);
1986 1986
 
1987 1987
 	/**
1988 1988
 	 * Filter the form.
1989 1989
 	 *
1990 1990
 	 * @since 1.8.8
1991 1991
 	 */
1992
-	$total_goal = apply_filters( 'give_goal_amount_target_output', round( give_maybe_sanitize_amount( $form->goal ) ), $form->ID, $form );
1992
+	$total_goal = apply_filters('give_goal_amount_target_output', round(give_maybe_sanitize_amount($form->goal)), $form->ID, $form);
1993 1993
 
1994
-	switch ( $goal_format ) {
1994
+	switch ($goal_format) {
1995 1995
 		case  'donation':
1996 1996
 			/**
1997 1997
 			 * Filter the form donations.
1998 1998
 			 *
1999 1999
 			 * @since 2.1
2000 2000
 			 */
2001
-			$actual = $donations = apply_filters( 'give_goal_donations_raised_output', $form->sales, $form->ID, $form );
2001
+			$actual = $donations = apply_filters('give_goal_donations_raised_output', $form->sales, $form->ID, $form);
2002 2002
 			break;
2003 2003
 		case 'donors':
2004 2004
 			/**
@@ -2012,7 +2012,7 @@  discard block
 block discarded – undo
2012 2012
 			 *
2013 2013
 			 * @return int $donors Total number of donors that donated to the form.
2014 2014
 			 */
2015
-			$actual = $donors = apply_filters( 'give_goal_donors_target_output', give_get_form_donor_count( $form->ID ), $form->ID, $form );
2015
+			$actual = $donors = apply_filters('give_goal_donors_target_output', give_get_form_donor_count($form->ID), $form->ID, $form);
2016 2016
 			break;
2017 2017
 		default :
2018 2018
 			/**
@@ -2020,11 +2020,11 @@  discard block
 block discarded – undo
2020 2020
 			 *
2021 2021
 			 * @since 1.8.8
2022 2022
 			 */
2023
-			$actual = $income = apply_filters( 'give_goal_amount_raised_output', $form->earnings, $form->ID, $form );
2023
+			$actual = $income = apply_filters('give_goal_amount_raised_output', $form->earnings, $form->ID, $form);
2024 2024
 			break;
2025 2025
 	}
2026 2026
 
2027
-	$progress = round( ( $actual / $total_goal ) * 100, 2 );
2027
+	$progress = round(($actual / $total_goal) * 100, 2);
2028 2028
 
2029 2029
 	$stats_array = array(
2030 2030
 		'raw_actual' => $actual,
@@ -2036,20 +2036,20 @@  discard block
 block discarded – undo
2036 2036
 	 *
2037 2037
 	 * @since 1.8.8
2038 2038
 	 */
2039
-	$progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form->ID, $form );
2039
+	$progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form->ID, $form);
2040 2040
 
2041 2041
 	// Define Actual Goal based on the goal format.
2042
-	if ( 'percentage' === $goal_format ) {
2042
+	if ('percentage' === $goal_format) {
2043 2043
 		$actual = "{$actual}%";
2044
-	} else if ( 'amount' === $goal_format ) {
2045
-		$actual = give_currency_filter( give_format_amount( $actual ) );
2044
+	} else if ('amount' === $goal_format) {
2045
+		$actual = give_currency_filter(give_format_amount($actual));
2046 2046
 	}
2047 2047
 
2048 2048
 	// Define Total Goal based on the goal format.
2049
-	if ( 'percentage' === $goal_format ) {
2049
+	if ('percentage' === $goal_format) {
2050 2050
 		$total_goal = '';
2051
-	} else if ( 'amount' === $goal_format ) {
2052
-		$total_goal = give_currency_filter( give_format_amount( $total_goal ) );
2051
+	} else if ('amount' === $goal_format) {
2052
+		$total_goal = give_currency_filter(give_format_amount($total_goal));
2053 2053
 	}
2054 2054
 
2055 2055
 	$stats_array = array_merge(
@@ -2067,7 +2067,7 @@  discard block
 block discarded – undo
2067 2067
 	 *
2068 2068
 	 * @since 2.1
2069 2069
 	 */
2070
-	return apply_filters( 'give_goal_progress_stats', $stats_array );
2070
+	return apply_filters('give_goal_progress_stats', $stats_array);
2071 2071
 
2072 2072
 }
2073 2073
 
@@ -2079,11 +2079,11 @@  discard block
 block discarded – undo
2079 2079
  * @return array $message admin message key.
2080 2080
  */
2081 2081
 function give_get_admin_messages_key() {
2082
-	$messages = empty( $_GET['give-messages'] ) ? array() : give_clean( $_GET['give-messages'] );
2082
+	$messages = empty($_GET['give-messages']) ? array() : give_clean($_GET['give-messages']);
2083 2083
 
2084 2084
 	// backward compatibility.
2085
-	if ( ! empty( $_GET['give-message'] ) ) {
2086
-		$messages[] = give_clean( $_GET['give-message'] );
2085
+	if ( ! empty($_GET['give-message'])) {
2086
+		$messages[] = give_clean($_GET['give-message']);
2087 2087
 	}
2088 2088
 
2089 2089
 	/**
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
 	 *
2096 2096
 	 * @return array $message admin message key.
2097 2097
 	 */
2098
-	return (array) apply_filters( 'give_get_admin_messages_key', $messages );
2098
+	return (array) apply_filters('give_get_admin_messages_key', $messages);
2099 2099
 }
2100 2100
 
2101 2101
 /**
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
 function give_get_user_agent() {
2109 2109
 
2110 2110
 	// Get User Agent.
2111
-	$user_agent = ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? give_clean( $_SERVER['HTTP_USER_AGENT'] ) : ''; // WPCS: input var ok.
2111
+	$user_agent = ! empty($_SERVER['HTTP_USER_AGENT']) ? give_clean($_SERVER['HTTP_USER_AGENT']) : ''; // WPCS: input var ok.
2112 2112
 
2113 2113
 	return $user_agent;
2114 2114
 
Please login to merge, or discard this patch.
includes/forms/template.php 1 patch
Spacing   +454 added lines, -456 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,35 +23,35 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 	static $count = 1;
30 30
 
31
-	$form_id = is_object( $post ) ? $post->ID : 0;
31
+	$form_id = is_object($post) ? $post->ID : 0;
32 32
 
33
-	if ( isset( $args['id'] ) ) {
33
+	if (isset($args['id'])) {
34 34
 		$form_id = $args['id'];
35 35
 	}
36 36
 
37
-	$defaults = apply_filters( 'give_form_args_defaults', array(
37
+	$defaults = apply_filters('give_form_args_defaults', array(
38 38
 		'form_id' => $form_id,
39
-	) );
39
+	));
40 40
 
41
-	$args = wp_parse_args( $args, $defaults );
41
+	$args = wp_parse_args($args, $defaults);
42 42
 
43
-	$form = new Give_Donate_Form( $args['form_id'] );
43
+	$form = new Give_Donate_Form($args['form_id']);
44 44
 
45 45
 	// Bail out, if no form ID.
46
-	if ( empty( $form->ID ) ) {
46
+	if (empty($form->ID)) {
47 47
 		return false;
48 48
 	}
49 49
 
50 50
 	$args['id_prefix'] = "{$form_id}-{$count}";
51
-	$payment_mode      = give_get_chosen_gateway( $form->ID );
51
+	$payment_mode      = give_get_chosen_gateway($form->ID);
52 52
 
53 53
 	$form_action = add_query_arg(
54
-		apply_filters( 'give_form_action_args', array(
54
+		apply_filters('give_form_action_args', array(
55 55
 				'payment-mode' => $payment_mode,
56 56
 			)
57 57
 		),
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
 
61 61
 	// Sanity Check: Donation form not published or user doesn't have permission to view drafts.
62 62
 	if (
63
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
64
-		|| ( 'trash' === $form->post_status )
63
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
64
+		|| ('trash' === $form->post_status)
65 65
 	) {
66 66
 		return false;
67 67
 	}
68 68
 
69 69
 	// Get the form wrap CSS classes.
70
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
70
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
71 71
 
72 72
 	// Get the <form> tag wrap CSS classes.
73
-	$form_classes = $form->get_form_classes( $args );
73
+	$form_classes = $form->get_form_classes($args);
74 74
 
75 75
 	ob_start();
76 76
 
@@ -82,21 +82,21 @@  discard block
 block discarded – undo
82 82
 	 * @param int   $form_id The form ID.
83 83
 	 * @param array $args    An array of form arguments.
84 84
 	 */
85
-	do_action( 'give_pre_form_output', $form->ID, $args, $form );
85
+	do_action('give_pre_form_output', $form->ID, $args, $form);
86 86
 
87 87
 	?>
88 88
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
89 89
 		<?php
90
-		if ( $form->is_close_donation_form() ) {
90
+		if ($form->is_close_donation_form()) {
91 91
 
92
-			$form_title = ! is_singular( 'give_forms' ) ? apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ) : '';
92
+			$form_title = ! is_singular('give_forms') ? apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>') : '';
93 93
 
94 94
 			// Get Goal thank you message.
95
-			$goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
96
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? $form_title . apply_filters( 'the_content', $goal_achieved_message ) : '';
95
+			$goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
96
+			$goal_achieved_message = ! empty($goal_achieved_message) ? $form_title.apply_filters('the_content', $goal_achieved_message) : '';
97 97
 
98 98
 			// Print thank you message.
99
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form );
99
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form);
100 100
 
101 101
 		} else {
102 102
 			/**
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 			 * 1. if show_title params set to true
105 105
 			 * 2. if admin set form display_style to button
106 106
 			 */
107
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
107
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
108 108
 			if (
109 109
 				(
110
-					( isset( $args['show_title'] ) && $args['show_title'] == true )
111
-					|| ( 'button' === get_post_meta( $form_id, '_give_payment_display', true ) )
110
+					(isset($args['show_title']) && $args['show_title'] == true)
111
+					|| ('button' === get_post_meta($form_id, '_give_payment_display', true))
112 112
 				)
113
-				&& ! doing_action( 'give_single_form_summary' )
113
+				&& ! doing_action('give_single_form_summary')
114 114
 			) {
115 115
 				echo $form_title;
116 116
 			}
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
 			 * @param array            $args    An array of form arguments.
125 125
 			 * @param Give_Donate_Form $form    Form object.
126 126
 			 */
127
-			do_action( 'give_pre_form', $form->ID, $args, $form );
127
+			do_action('give_pre_form', $form->ID, $args, $form);
128 128
 
129 129
 			// Set form html tags.
130 130
 			$form_html_tags = array(
131 131
 				'id'      => "give-form-{$args['id_prefix']}",
132 132
 				'class'   => $form_classes,
133
-				'action'  => esc_url_raw( $form_action ),
133
+				'action'  => esc_url_raw($form_action),
134 134
 				'data-id' => $args['id_prefix'],
135 135
 			);
136 136
 
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 			 * @param array            $form_html_tags Array of form html tags.
143 143
 			 * @param Give_Donate_Form $form           Form object.
144 144
 			 */
145
-			$form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form );
145
+			$form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form);
146 146
 			?>
147
-			<form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post">
147
+			<form <?php echo give_get_attribute_str($form_html_tags); ?> method="post">
148 148
 				<!-- The following field is for robots only, invisible to humans: -->
149 149
 				<span class="give-hidden" style="display: none !important;">
150 150
 					<label for="give-form-honeypot-<?php echo $form_id; ?>"></label>
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 				 * @param array            $args    An array of form arguments.
163 163
 				 * @param Give_Donate_Form $form    Form object.
164 164
 				 */
165
-				do_action( 'give_donation_form_top', $form->ID, $args, $form );
165
+				do_action('give_donation_form_top', $form->ID, $args, $form);
166 166
 
167 167
 				/**
168 168
 				 * Fires while outputting donation form, for payment gateway fields.
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 				 * @param array            $args    An array of form arguments.
174 174
 				 * @param Give_Donate_Form $form    Form object.
175 175
 				 */
176
-				do_action( 'give_payment_mode_select', $form->ID, $args, $form );
176
+				do_action('give_payment_mode_select', $form->ID, $args, $form);
177 177
 
178 178
 				/**
179 179
 				 * Fires while outputting donation form, after all other fields.
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 				 * @param array            $args    An array of form arguments.
185 185
 				 * @param Give_Donate_Form $form    Form object.
186 186
 				 */
187
-				do_action( 'give_donation_form_bottom', $form->ID, $args, $form );
187
+				do_action('give_donation_form_bottom', $form->ID, $args, $form);
188 188
 
189 189
 				?>
190 190
 			</form>
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 			 * @param array            $args    An array of form arguments.
200 200
 			 * @param Give_Donate_Form $form    Form object.
201 201
 			 */
202
-			do_action( 'give_post_form', $form->ID, $args, $form );
202
+			do_action('give_post_form', $form->ID, $args, $form);
203 203
 
204 204
 		}
205 205
 		?>
206 206
 
207
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
207
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
208 208
 	<?php
209 209
 
210 210
 	/**
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 	 * @param int   $form_id The form ID.
216 216
 	 * @param array $args    An array of form arguments.
217 217
 	 */
218
-	do_action( 'give_post_form_output', $form->ID, $args );
218
+	do_action('give_post_form_output', $form->ID, $args);
219 219
 
220 220
 	$final_output = ob_get_clean();
221
-	$count ++;
221
+	$count++;
222 222
 
223
-	echo apply_filters( 'give_donate_form', $final_output, $args );
223
+	echo apply_filters('give_donate_form', $final_output, $args);
224 224
 }
225 225
 
226 226
 /**
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
  *
238 238
  * @return string
239 239
  */
240
-function give_show_purchase_form( $form_id, $args ) {
240
+function give_show_purchase_form($form_id, $args) {
241 241
 
242
-	$payment_mode = give_get_chosen_gateway( $form_id );
242
+	$payment_mode = give_get_chosen_gateway($form_id);
243 243
 
244
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
244
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
245 245
 		$form_id = $_POST['give_form_id'];
246 246
 	}
247 247
 
@@ -250,33 +250,33 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @since 1.7
252 252
 	 */
253
-	do_action( 'give_payment_fields_top', $form_id );
253
+	do_action('give_payment_fields_top', $form_id);
254 254
 
255
-	if ( give_can_checkout() && isset( $form_id ) ) {
255
+	if (give_can_checkout() && isset($form_id)) {
256 256
 
257 257
 		/**
258 258
 		 * Fires while displaying donation form, before registration login.
259 259
 		 *
260 260
 		 * @since 1.7
261 261
 		 */
262
-		do_action( 'give_donation_form_before_register_login', $form_id, $args );
262
+		do_action('give_donation_form_before_register_login', $form_id, $args);
263 263
 
264 264
 		/**
265 265
 		 * Fire when register/login form fields render.
266 266
 		 *
267 267
 		 * @since 1.7
268 268
 		 */
269
-		do_action( 'give_donation_form_register_login_fields', $form_id, $args );
269
+		do_action('give_donation_form_register_login_fields', $form_id, $args);
270 270
 
271 271
 		/**
272 272
 		 * Fire when credit card form fields render.
273 273
 		 *
274 274
 		 * @since 1.7
275 275
 		 */
276
-		do_action( 'give_donation_form_before_cc_form', $form_id, $args );
276
+		do_action('give_donation_form_before_cc_form', $form_id, $args);
277 277
 
278 278
 		// Load the credit card form and allow gateways to load their own if they wish.
279
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
279
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
280 280
 			/**
281 281
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
282 282
 			 *
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 			 *
285 285
 			 * @param int $form_id The form ID.
286 286
 			 */
287
-			do_action( "give_{$payment_mode}_cc_form", $form_id, $args );
287
+			do_action("give_{$payment_mode}_cc_form", $form_id, $args);
288 288
 		} else {
289 289
 			/**
290 290
 			 * Fires while displaying donation form, credit card form fields.
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 			 *
294 294
 			 * @param int $form_id The form ID.
295 295
 			 */
296
-			do_action( 'give_cc_form', $form_id, $args );
296
+			do_action('give_cc_form', $form_id, $args);
297 297
 		}
298 298
 
299 299
 		/**
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		 *
302 302
 		 * @since 1.7
303 303
 		 */
304
-		do_action( 'give_donation_form_after_cc_form', $form_id, $args );
304
+		do_action('give_donation_form_after_cc_form', $form_id, $args);
305 305
 
306 306
 	} else {
307 307
 		/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		 *
310 310
 		 * @since 1.7
311 311
 		 */
312
-		do_action( 'give_donation_form_no_access', $form_id );
312
+		do_action('give_donation_form_no_access', $form_id);
313 313
 
314 314
 	}
315 315
 
@@ -318,10 +318,10 @@  discard block
 block discarded – undo
318 318
 	 *
319 319
 	 * @since 1.7
320 320
 	 */
321
-	do_action( 'give_payment_fields_bottom', $form_id, $args );
321
+	do_action('give_payment_fields_bottom', $form_id, $args);
322 322
 }
323 323
 
324
-add_action( 'give_donation_form', 'give_show_purchase_form', 10, 2 );
324
+add_action('give_donation_form', 'give_show_purchase_form', 10, 2);
325 325
 
326 326
 /**
327 327
  * Give Show Login/Register Form Fields.
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
  *
333 333
  * @return void
334 334
  */
335
-function give_show_register_login_fields( $form_id ) {
335
+function give_show_register_login_fields($form_id) {
336 336
 
337
-	$show_register_form = give_show_login_register_option( $form_id );
337
+	$show_register_form = give_show_login_register_option($form_id);
338 338
 
339
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
339
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
340 340
 		?>
341 341
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
342 342
 			<?php
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 			 *
346 346
 			 * @since 1.7
347 347
 			 */
348
-			do_action( 'give_donation_form_register_fields', $form_id );
348
+			do_action('give_donation_form_register_fields', $form_id);
349 349
 			?>
350 350
 		</div>
351 351
 		<?php
352
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
352
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
353 353
 		?>
354 354
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
355 355
 			<?php
@@ -358,23 +358,23 @@  discard block
 block discarded – undo
358 358
 			 *
359 359
 			 * @since 1.7
360 360
 			 */
361
-			do_action( 'give_donation_form_login_fields', $form_id );
361
+			do_action('give_donation_form_login_fields', $form_id);
362 362
 			?>
363 363
 		</div>
364 364
 		<?php
365 365
 	endif;
366 366
 
367
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
367
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
368 368
 		/**
369 369
 		 * Fire when user info render.
370 370
 		 *
371 371
 		 * @since 1.7
372 372
 		 */
373
-		do_action( 'give_donation_form_after_user_info', $form_id );
373
+		do_action('give_donation_form_after_user_info', $form_id);
374 374
 	}
375 375
 }
376 376
 
377
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
377
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
378 378
 
379 379
 /**
380 380
  * Donation Amount Field.
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
  *
390 390
  * @return void
391 391
  */
392
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
392
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
393 393
 
394 394
 	$give_options        = give_get_settings();
395
-	$variable_pricing    = give_has_variable_prices( $form_id );
396
-	$allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
397
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
398
-	$symbol              = give_currency_symbol( give_get_currency( $form_id, $args ) );
399
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
400
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false, 'currency' => give_get_currency( $form_id ) ) );
401
-	$custom_amount_text  = give_get_meta( $form_id, '_give_custom_amount_text', true );
395
+	$variable_pricing    = give_has_variable_prices($form_id);
396
+	$allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
397
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
398
+	$symbol              = give_currency_symbol(give_get_currency($form_id, $args));
399
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
400
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false, 'currency' => give_get_currency($form_id)));
401
+	$custom_amount_text  = give_get_meta($form_id, '_give_custom_amount_text', true);
402 402
 
403 403
 	/**
404 404
 	 * Fires while displaying donation form, before donation level fields.
@@ -408,20 +408,20 @@  discard block
 block discarded – undo
408 408
 	 * @param int   $form_id The form ID.
409 409
 	 * @param array $args    An array of form arguments.
410 410
 	 */
411
-	do_action( 'give_before_donation_levels', $form_id, $args );
411
+	do_action('give_before_donation_levels', $form_id, $args);
412 412
 
413 413
 	//Set Price, No Custom Amount Allowed means hidden price field
414
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
414
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
415 415
 		?>
416
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
416
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
417 417
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
418 418
 			   value="<?php echo $default_amount; ?>" required aria-required="true"/>
419 419
 		<div class="set-price give-donation-amount form-row-wide">
420
-			<?php if ( $currency_position == 'before' ) {
420
+			<?php if ($currency_position == 'before') {
421 421
 				echo $currency_output;
422 422
 			} ?>
423 423
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
424
-			<?php if ( $currency_position == 'after' ) {
424
+			<?php if ($currency_position == 'after') {
425 425
 				echo $currency_output;
426 426
 			} ?>
427 427
 		</div>
@@ -431,13 +431,13 @@  discard block
 block discarded – undo
431 431
 		?>
432 432
 		<div class="give-total-wrap">
433 433
 			<div class="give-donation-amount form-row-wide">
434
-				<?php if ( $currency_position == 'before' ) {
434
+				<?php if ($currency_position == 'before') {
435 435
 					echo $currency_output;
436 436
 				} ?>
437
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
437
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
438 438
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
439 439
 					   placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
440
-				<?php if ( $currency_position == 'after' ) {
440
+				<?php if ($currency_position == 'after') {
441 441
 					echo $currency_output;
442 442
 				} ?>
443 443
 			</div>
@@ -452,16 +452,16 @@  discard block
 block discarded – undo
452 452
 	 * @param int   $form_id The form ID.
453 453
 	 * @param array $args    An array of form arguments.
454 454
 	 */
455
-	do_action( 'give_after_donation_amount', $form_id, $args );
455
+	do_action('give_after_donation_amount', $form_id, $args);
456 456
 
457 457
 	//Custom Amount Text
458
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?>
458
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?>
459 459
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
460 460
 	<?php }
461 461
 
462 462
 	//Output Variable Pricing Levels.
463
-	if ( $variable_pricing ) {
464
-		give_output_levels( $form_id );
463
+	if ($variable_pricing) {
464
+		give_output_levels($form_id);
465 465
 	}
466 466
 
467 467
 	/**
@@ -472,10 +472,10 @@  discard block
 block discarded – undo
472 472
 	 * @param int   $form_id The form ID.
473 473
 	 * @param array $args    An array of form arguments.
474 474
 	 */
475
-	do_action( 'give_after_donation_levels', $form_id, $args );
475
+	do_action('give_after_donation_levels', $form_id, $args);
476 476
 }
477 477
 
478
-add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 );
478
+add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2);
479 479
 
480 480
 /**
481 481
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -486,33 +486,33 @@  discard block
 block discarded – undo
486 486
  *
487 487
  * @return string Donation levels.
488 488
  */
489
-function give_output_levels( $form_id ) {
489
+function give_output_levels($form_id) {
490 490
 
491 491
 	//Get variable pricing.
492
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
493
-	$display_style      = give_get_meta( $form_id, '_give_display_style', true );
494
-	$custom_amount      = give_get_meta( $form_id, '_give_custom_amount', true );
495
-	$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
492
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
493
+	$display_style      = give_get_meta($form_id, '_give_display_style', true);
494
+	$custom_amount      = give_get_meta($form_id, '_give_custom_amount', true);
495
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
496 496
 
497
-	if ( empty( $custom_amount_text ) ) {
498
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
497
+	if (empty($custom_amount_text)) {
498
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
499 499
 	}
500 500
 
501 501
 	$output = '';
502 502
 
503
-	switch ( $display_style ) {
503
+	switch ($display_style) {
504 504
 		case 'buttons':
505 505
 
506 506
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
507 507
 
508
-			foreach ( $prices as $price ) {
509
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
510
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
508
+			foreach ($prices as $price) {
509
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
510
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
511 511
 
512
-				$formatted_amount = give_format_amount( $price['_give_amount'], array(
512
+				$formatted_amount = give_format_amount($price['_give_amount'], array(
513 513
 					'sanitize' => false,
514
-					'currency' => give_get_currency( $form_id ),
515
-				) );
514
+					'currency' => give_get_currency($form_id),
515
+				));
516 516
 
517 517
 				$output .= sprintf(
518 518
 					'<li><button type="button" data-price-id="%1$s" class="%2$s" value="%3$s">%4$s</button></li>',
@@ -525,8 +525,8 @@  discard block
 block discarded – undo
525 525
 
526 526
 			//Custom Amount.
527 527
 			if (
528
-				give_is_setting_enabled( $custom_amount )
529
-				&& ! empty( $custom_amount_text )
528
+				give_is_setting_enabled($custom_amount)
529
+				&& ! empty($custom_amount_text)
530 530
 			) {
531 531
 
532 532
 				$output .= sprintf(
@@ -543,29 +543,29 @@  discard block
 block discarded – undo
543 543
 
544 544
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
545 545
 
546
-			foreach ( $prices as $price ) {
547
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
548
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
546
+			foreach ($prices as $price) {
547
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
548
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
549 549
 
550
-				$formatted_amount = give_format_amount( $price['_give_amount'], array(
550
+				$formatted_amount = give_format_amount($price['_give_amount'], array(
551 551
 					'sanitize' => false,
552
-					'currency' => give_get_currency( $form_id ),
553
-				) );
552
+					'currency' => give_get_currency($form_id),
553
+				));
554 554
 
555 555
 				$output .= sprintf(
556 556
 					'<li><input type="radio" data-price-id="%1$s" class="%2$s" value="%3$s" name="give-radio-donation-level" id="give-radio-level-%1$s" %4$s ><label for="give-radio-level-%1$s">%5$s</label></li>',
557 557
 					$price['_give_id']['level_id'],
558 558
 					$level_classes,
559 559
 					$formatted_amount,
560
-					( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ),
560
+					((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : ''),
561 561
 					$level_text
562 562
 				);
563 563
 			}
564 564
 
565 565
 			//Custom Amount.
566 566
 			if (
567
-				give_is_setting_enabled( $custom_amount )
568
-				&& ! empty( $custom_amount_text )
567
+				give_is_setting_enabled($custom_amount)
568
+				&& ! empty($custom_amount_text)
569 569
 			) {
570 570
 				$output .= sprintf(
571 571
 					'<li><input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom"><label for="give-radio-level-custom">%1$s</label></li>',
@@ -579,31 +579,31 @@  discard block
 block discarded – undo
579 579
 
580 580
 		case 'dropdown':
581 581
 
582
-			$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
583
-			$output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
582
+			$output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
583
+			$output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
584 584
 
585 585
 			//first loop through prices.
586
-			foreach ( $prices as $price ) {
587
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
588
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
586
+			foreach ($prices as $price) {
587
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
588
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
589 589
 
590
-				$formatted_amount = give_format_amount( $price['_give_amount'], array(
590
+				$formatted_amount = give_format_amount($price['_give_amount'], array(
591 591
 					'sanitize' => false,
592
-					'currency' => give_get_currency( $form_id ),
593
-				) );
592
+					'currency' => give_get_currency($form_id),
593
+				));
594 594
 
595 595
 				$output .= sprintf(
596 596
 					'<option data-price-id="%1$s" class="%2$s" value="%3$s" %4$s >%5$s</option>',
597 597
 					$price['_give_id']['level_id'],
598 598
 					$level_classes,
599 599
 					$formatted_amount,
600
-					( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ),
600
+					((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : ''),
601 601
 					$level_text
602 602
 				);
603 603
 			}
604 604
 
605 605
 			//Custom Amount.
606
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
606
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
607 607
 				$output .= sprintf(
608 608
 					'<option data-price-id="custom" class="give-donation-level-custom" value="custom">%1$s</option>',
609 609
 					$custom_amount_text
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 			break;
616 616
 	}
617 617
 
618
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
618
+	echo apply_filters('give_form_level_output', $output, $form_id);
619 619
 }
620 620
 
621 621
 /**
@@ -630,27 +630,27 @@  discard block
 block discarded – undo
630 630
  *
631 631
  * @return string Checkout button.
632 632
  */
633
-function give_display_checkout_button( $form_id, $args ) {
633
+function give_display_checkout_button($form_id, $args) {
634 634
 
635
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
635
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
636 636
 		? $args['display_style']
637
-		: give_get_meta( $form_id, '_give_payment_display', true );
637
+		: give_get_meta($form_id, '_give_payment_display', true);
638 638
 
639
-	if ( 'button' === $display_option ) {
639
+	if ('button' === $display_option) {
640 640
 		$display_option = 'modal';
641
-	} elseif ( $display_option === 'onpage' ) {
641
+	} elseif ($display_option === 'onpage') {
642 642
 		return '';
643 643
 	}
644 644
 
645
-	$display_label_field = give_get_meta( $form_id, '_give_reveal_label', true );
646
-	$display_label       = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
645
+	$display_label_field = give_get_meta($form_id, '_give_reveal_label', true);
646
+	$display_label       = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
647 647
 
648
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
648
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
649 649
 
650
-	echo apply_filters( 'give_display_checkout_button', $output );
650
+	echo apply_filters('give_display_checkout_button', $output);
651 651
 }
652 652
 
653
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
653
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
654 654
 
655 655
 /**
656 656
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -663,79 +663,79 @@  discard block
 block discarded – undo
663 663
  *
664 664
  * @return void
665 665
  */
666
-function give_user_info_fields( $form_id ) {
666
+function give_user_info_fields($form_id) {
667 667
 	// Get user info.
668
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
668
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
669 669
 
670 670
 	/**
671 671
 	 * Fire before user personal information fields
672 672
 	 *
673 673
 	 * @since 1.7
674 674
 	 */
675
-	do_action( 'give_donation_form_before_personal_info', $form_id );
675
+	do_action('give_donation_form_before_personal_info', $form_id);
676 676
 	?>
677 677
 	<fieldset id="give_checkout_user_info">
678
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
678
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
679 679
 		<p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
680 680
 			<label class="give-label" for="give-first">
681
-				<?php _e( 'First Name', 'give' ); ?>
682
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
681
+				<?php _e('First Name', 'give'); ?>
682
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
683 683
 					<span class="give-required-indicator">*</span>
684 684
 				<?php endif ?>
685
-				<?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?>
685
+				<?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?>
686 686
 			</label>
687 687
 			<input
688 688
 					class="give-input required"
689 689
 					type="text"
690 690
 					name="give_first"
691 691
 					autocomplete="given-name"
692
-					placeholder="<?php _e( 'First Name', 'give' ); ?>"
692
+					placeholder="<?php _e('First Name', 'give'); ?>"
693 693
 					id="give-first"
694
-					value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
695
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
694
+					value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
695
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
696 696
 			/>
697 697
 		</p>
698 698
 
699 699
 		<p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
700 700
 			<label class="give-label" for="give-last">
701
-				<?php _e( 'Last Name', 'give' ); ?>
702
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
701
+				<?php _e('Last Name', 'give'); ?>
702
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
703 703
 					<span class="give-required-indicator">*</span>
704 704
 				<?php endif ?>
705
-				<?php echo Give()->tooltips->render_help( __( 'We will use this as well to personalize your account experience.', 'give' ) ); ?>
705
+				<?php echo Give()->tooltips->render_help(__('We will use this as well to personalize your account experience.', 'give')); ?>
706 706
 			</label>
707 707
 
708 708
 			<input
709
-					class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
709
+					class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
710 710
 					type="text"
711 711
 					name="give_last"
712 712
 					autocomplete="family-name"
713 713
 					id="give-last"
714
-					placeholder="<?php _e( 'Last Name', 'give' ); ?>"
715
-					value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
716
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
714
+					placeholder="<?php _e('Last Name', 'give'); ?>"
715
+					value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
716
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
717 717
 			/>
718 718
 		</p>
719 719
 
720
-		<?php if ( give_is_company_field_enabled( $form_id ) ) : ?>
721
-			<?php $give_company = give_field_is_required( 'give_company_name', $form_id ); ?>
720
+		<?php if (give_is_company_field_enabled($form_id)) : ?>
721
+			<?php $give_company = give_field_is_required('give_company_name', $form_id); ?>
722 722
 			<p id="give-company-wrap" class="form-row form-row-wide">
723 723
 				<label class="give-label" for="give-company">
724
-					<?php _e( 'Company Name', 'give' ); ?>
725
-					<?php if ( $give_company ) : ?>
724
+					<?php _e('Company Name', 'give'); ?>
725
+					<?php if ($give_company) : ?>
726 726
 						<span class="give-required-indicator">*</span>
727 727
 					<?php endif; ?>
728
-					<?php echo Give()->tooltips->render_help( __( 'Donate on behalf of Company', 'give' ) ); ?>
728
+					<?php echo Give()->tooltips->render_help(__('Donate on behalf of Company', 'give')); ?>
729 729
 				</label>
730 730
 
731 731
 				<input
732
-					class="give-input<?php echo( $give_company ? ' required' : '' ); ?>"
732
+					class="give-input<?php echo($give_company ? ' required' : ''); ?>"
733 733
 					type="text"
734 734
 					name="give_company_name"
735
-					placeholder="<?php _e( 'Company Name', 'give' ); ?>"
735
+					placeholder="<?php _e('Company Name', 'give'); ?>"
736 736
 					id="give-company"
737
-					value="<?php echo isset( $give_user_info['company_name'] ) ? $give_user_info['company_name'] : ''; ?>"
738
-					<?php echo( $give_company ? ' required aria-required="true" ' : '' ); ?>
737
+					value="<?php echo isset($give_user_info['company_name']) ? $give_user_info['company_name'] : ''; ?>"
738
+					<?php echo($give_company ? ' required aria-required="true" ' : ''); ?>
739 739
 				/>
740 740
 
741 741
 			</p>
@@ -747,15 +747,15 @@  discard block
 block discarded – undo
747 747
 		 *
748 748
 		 * @since 1.7
749 749
 		 */
750
-		do_action( 'give_donation_form_before_email', $form_id );
750
+		do_action('give_donation_form_before_email', $form_id);
751 751
 		?>
752 752
 		<p id="give-email-wrap" class="form-row form-row-wide">
753 753
 			<label class="give-label" for="give-email">
754
-				<?php _e( 'Email Address', 'give' ); ?>
755
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
754
+				<?php _e('Email Address', 'give'); ?>
755
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
756 756
 					<span class="give-required-indicator">*</span>
757 757
 				<?php } ?>
758
-				<?php echo Give()->tooltips->render_help( __( 'We will send the donation receipt to this address.', 'give' ) ); ?>
758
+				<?php echo Give()->tooltips->render_help(__('We will send the donation receipt to this address.', 'give')); ?>
759 759
 			</label>
760 760
 
761 761
 			<input
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
 					type="email"
764 764
 					name="give_email"
765 765
 					autocomplete="email"
766
-					placeholder="<?php _e( 'Email Address', 'give' ); ?>"
766
+					placeholder="<?php _e('Email Address', 'give'); ?>"
767 767
 					id="give-email"
768
-					value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
769
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
768
+					value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
769
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
770 770
 			/>
771 771
 
772 772
 		</p>
@@ -776,14 +776,14 @@  discard block
 block discarded – undo
776 776
 		 *
777 777
 		 * @since 1.7
778 778
 		 */
779
-		do_action( 'give_donation_form_after_email', $form_id );
779
+		do_action('give_donation_form_after_email', $form_id);
780 780
 
781 781
 		/**
782 782
 		 * Fire after personal email field
783 783
 		 *
784 784
 		 * @since 1.7
785 785
 		 */
786
-		do_action( 'give_donation_form_user_info', $form_id );
786
+		do_action('give_donation_form_user_info', $form_id);
787 787
 		?>
788 788
 	</fieldset>
789 789
 	<?php
@@ -792,11 +792,11 @@  discard block
 block discarded – undo
792 792
 	 *
793 793
 	 * @since 1.7
794 794
 	 */
795
-	do_action( 'give_donation_form_after_personal_info', $form_id );
795
+	do_action('give_donation_form_after_personal_info', $form_id);
796 796
 }
797 797
 
798
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
799
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
798
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
799
+add_action('give_register_fields_before', 'give_user_info_fields');
800 800
 
801 801
 /**
802 802
  * Renders the credit card info form.
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
  *
808 808
  * @return void
809 809
  */
810
-function give_get_cc_form( $form_id ) {
810
+function give_get_cc_form($form_id) {
811 811
 
812 812
 	ob_start();
813 813
 
@@ -818,50 +818,50 @@  discard block
 block discarded – undo
818 818
 	 *
819 819
 	 * @param int $form_id The form ID.
820 820
 	 */
821
-	do_action( 'give_before_cc_fields', $form_id );
821
+	do_action('give_before_cc_fields', $form_id);
822 822
 	?>
823 823
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
824
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
825
-		<?php if ( is_ssl() ) : ?>
824
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
825
+		<?php if (is_ssl()) : ?>
826 826
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
827 827
 				<span class="give-icon padlock"></span>
828
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
828
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
829 829
 			</div>
830 830
 		<?php endif; ?>
831 831
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
832 832
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
833
-				<?php _e( 'Card Number', 'give' ); ?>
833
+				<?php _e('Card Number', 'give'); ?>
834 834
 				<span class="give-required-indicator">*</span>
835
-				<?php echo Give()->tooltips->render_help( __( 'The (typically) 16 digits on the front of your credit card.', 'give' ) ); ?>
835
+				<?php echo Give()->tooltips->render_help(__('The (typically) 16 digits on the front of your credit card.', 'give')); ?>
836 836
 				<span class="card-type"></span>
837 837
 			</label>
838 838
 
839 839
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
840
-				   class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>"
840
+				   class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>"
841 841
 				   required aria-required="true"/>
842 842
 		</p>
843 843
 
844 844
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive">
845 845
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
846
-				<?php _e( 'CVC', 'give' ); ?>
846
+				<?php _e('CVC', 'give'); ?>
847 847
 				<span class="give-required-indicator">*</span>
848
-				<?php echo Give()->tooltips->render_help( __( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ) ); ?>
848
+				<?php echo Give()->tooltips->render_help(__('The 3 digit (back) or 4 digit (front) value on your card.', 'give')); ?>
849 849
 			</label>
850 850
 
851 851
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
852
-				   class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>"
852
+				   class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>"
853 853
 				   required aria-required="true"/>
854 854
 		</p>
855 855
 
856 856
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
857 857
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
858
-				<?php _e( 'Name on the Card', 'give' ); ?>
858
+				<?php _e('Name on the Card', 'give'); ?>
859 859
 				<span class="give-required-indicator">*</span>
860
-				<?php echo Give()->tooltips->render_help( __( 'The name printed on the front of your credit card.', 'give' ) ); ?>
860
+				<?php echo Give()->tooltips->render_help(__('The name printed on the front of your credit card.', 'give')); ?>
861 861
 			</label>
862 862
 
863 863
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
864
-				   class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
864
+				   class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
865 865
 				   required aria-required="true"/>
866 866
 		</p>
867 867
 		<?php
@@ -872,19 +872,19 @@  discard block
 block discarded – undo
872 872
 		 *
873 873
 		 * @param int $form_id The form ID.
874 874
 		 */
875
-		do_action( 'give_before_cc_expiration' );
875
+		do_action('give_before_cc_expiration');
876 876
 		?>
877 877
 		<p class="card-expiration form-row form-row-one-third form-row-responsive">
878 878
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
879
-				<?php _e( 'Expiration', 'give' ); ?>
879
+				<?php _e('Expiration', 'give'); ?>
880 880
 				<span class="give-required-indicator">*</span>
881
-				<?php echo Give()->tooltips->render_help( __( 'The date your credit card expires, typically on the front of the card.', 'give' ) ); ?>
881
+				<?php echo Give()->tooltips->render_help(__('The date your credit card expires, typically on the front of the card.', 'give')); ?>
882 882
 			</label>
883 883
 
884 884
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
885 885
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
886 886
 
887
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required aria-required="true"/>
887
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required aria-required="true"/>
888 888
 		</p>
889 889
 		<?php
890 890
 		/**
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
 		 *
895 895
 		 * @param int $form_id The form ID.
896 896
 		 */
897
-		do_action( 'give_after_cc_expiration', $form_id );
897
+		do_action('give_after_cc_expiration', $form_id);
898 898
 		?>
899 899
 	</fieldset>
900 900
 	<?php
@@ -905,12 +905,12 @@  discard block
 block discarded – undo
905 905
 	 *
906 906
 	 * @param int $form_id The form ID.
907 907
 	 */
908
-	do_action( 'give_after_cc_fields', $form_id );
908
+	do_action('give_after_cc_fields', $form_id);
909 909
 
910 910
 	echo ob_get_clean();
911 911
 }
912 912
 
913
-add_action( 'give_cc_form', 'give_get_cc_form' );
913
+add_action('give_cc_form', 'give_get_cc_form');
914 914
 
915 915
 /**
916 916
  * Outputs the default credit card address fields.
@@ -921,20 +921,20 @@  discard block
 block discarded – undo
921 921
  *
922 922
  * @return void
923 923
  */
924
-function give_default_cc_address_fields( $form_id ) {
924
+function give_default_cc_address_fields($form_id) {
925 925
 	// Get user info.
926
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
926
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
927 927
 
928 928
 	$logged_in = is_user_logged_in();
929 929
 
930
-	if ( $logged_in ) {
931
-		$user_address = give_get_donor_address( get_current_user_id() );
930
+	if ($logged_in) {
931
+		$user_address = give_get_donor_address(get_current_user_id());
932 932
 	}
933 933
 
934 934
 	ob_start();
935 935
 	?>
936 936
 	<fieldset id="give_cc_address" class="cc-address">
937
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
937
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
938 938
 		<?php
939 939
 		/**
940 940
 		 * Fires while rendering credit card billing form, before address fields.
@@ -943,36 +943,36 @@  discard block
 block discarded – undo
943 943
 		 *
944 944
 		 * @param int $form_id The form ID.
945 945
 		 */
946
-		do_action( 'give_cc_billing_top' );
946
+		do_action('give_cc_billing_top');
947 947
 
948 948
 		// For Country.
949 949
 		$selected_country = give_get_country();
950
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
950
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
951 951
 			$selected_country = $give_user_info['billing_country'];
952 952
 		}
953 953
 		$countries = give_get_country_list();
954 954
 
955 955
 		// For state
956 956
 		$selected_state = '';
957
-		if ( $selected_country === give_get_country() ) {
957
+		if ($selected_country === give_get_country()) {
958 958
 			// Get defalut selected state by admin.
959 959
 			$selected_state = give_get_state();
960 960
 		}
961 961
 		// Get the last payment made by user states.
962
-		if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) {
962
+		if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) {
963 963
 			$selected_state = $give_user_info['card_state'];
964 964
 		}
965 965
 		// Get the country code
966
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
966
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
967 967
 			$selected_country = $give_user_info['billing_country'];
968 968
 		}
969
-		$label        = __( 'State', 'give' );
969
+		$label        = __('State', 'give');
970 970
 		$states_label = give_get_states_label();
971 971
 		// Check if $country code exists in the array key for states label.
972
-		if ( array_key_exists( $selected_country, $states_label ) ) {
973
-			$label = $states_label[ $selected_country ];
972
+		if (array_key_exists($selected_country, $states_label)) {
973
+			$label = $states_label[$selected_country];
974 974
 		}
975
-		$states = give_get_states( $selected_country );
975
+		$states = give_get_states($selected_country);
976 976
 		// Get the country list that do not have any states init.
977 977
 		$no_states_country = give_no_states_country_list();
978 978
 		// Get the country list that does not require states.
@@ -980,24 +980,24 @@  discard block
 block discarded – undo
980 980
 		?>
981 981
 	    <p id="give-card-country-wrap" class="form-row form-row-wide">
982 982
 		    <label for="billing_country" class="give-label">
983
-			    <?php esc_html_e( 'Country', 'give' ); ?>
984
-			    <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
983
+			    <?php esc_html_e('Country', 'give'); ?>
984
+			    <?php if (give_field_is_required('billing_country', $form_id)) : ?>
985 985
 				    <span class="give-required-indicator">*</span>
986 986
 			    <?php endif; ?>
987 987
 			    <span class="give-tooltip give-icon give-icon-question"
988
-			          data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
988
+			          data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
989 989
 		    </label>
990 990
 
991 991
 		    <select
992 992
 				    name="billing_country"
993 993
 				    autocomplete="country-name"
994 994
 				    id="billing_country"
995
-				    class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
996
-			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
995
+				    class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
996
+			    <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
997 997
 		    >
998 998
 			    <?php
999
-			    foreach ( $countries as $country_code => $country ) {
1000
-				    echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
999
+			    foreach ($countries as $country_code => $country) {
1000
+				    echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
1001 1001
 			    }
1002 1002
 			    ?>
1003 1003
 		    </select>
@@ -1005,12 +1005,12 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 		<p id="give-card-address-wrap" class="form-row form-row-wide">
1007 1007
 			<label for="card_address" class="give-label">
1008
-				<?php _e( 'Address 1', 'give' ); ?>
1008
+				<?php _e('Address 1', 'give'); ?>
1009 1009
 				<?php
1010
-				if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
1010
+				if (give_field_is_required('card_address', $form_id)) : ?>
1011 1011
 					<span class="give-required-indicator">*</span>
1012 1012
 				<?php endif; ?>
1013
-				<?php echo Give()->tooltips->render_help( __( 'The primary billing address for your credit card.', 'give' ) ); ?>
1013
+				<?php echo Give()->tooltips->render_help(__('The primary billing address for your credit card.', 'give')); ?>
1014 1014
 			</label>
1015 1015
 
1016 1016
 			<input
@@ -1018,20 +1018,20 @@  discard block
 block discarded – undo
1018 1018
 					id="card_address"
1019 1019
 					name="card_address"
1020 1020
 					autocomplete="address-line1"
1021
-					class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
1022
-					placeholder="<?php _e( 'Address line 1', 'give' ); ?>"
1023
-					value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
1024
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
1021
+					class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
1022
+					placeholder="<?php _e('Address line 1', 'give'); ?>"
1023
+					value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
1024
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
1025 1025
 			/>
1026 1026
 		</p>
1027 1027
 
1028 1028
 		<p id="give-card-address-2-wrap" class="form-row form-row-wide">
1029 1029
 			<label for="card_address_2" class="give-label">
1030
-				<?php _e( 'Address 2', 'give' ); ?>
1031
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
1030
+				<?php _e('Address 2', 'give'); ?>
1031
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
1032 1032
 					<span class="give-required-indicator">*</span>
1033 1033
 				<?php endif; ?>
1034
-				<?php echo Give()->tooltips->render_help( __( '(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give' ) ); ?>
1034
+				<?php echo Give()->tooltips->render_help(__('(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give')); ?>
1035 1035
 			</label>
1036 1036
 
1037 1037
 			<input
@@ -1039,56 +1039,56 @@  discard block
 block discarded – undo
1039 1039
 					id="card_address_2"
1040 1040
 					name="card_address_2"
1041 1041
 					autocomplete="address-line2"
1042
-					class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
1043
-					placeholder="<?php _e( 'Address line 2', 'give' ); ?>"
1044
-					value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
1045
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1042
+					class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
1043
+					placeholder="<?php _e('Address line 2', 'give'); ?>"
1044
+					value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
1045
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
1046 1046
 			/>
1047 1047
 		</p>
1048 1048
 
1049 1049
 		<p id="give-card-city-wrap" class="form-row form-row-wide">
1050 1050
 			<label for="card_city" class="give-label">
1051
-				<?php _e( 'City', 'give' ); ?>
1052
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
1051
+				<?php _e('City', 'give'); ?>
1052
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
1053 1053
 					<span class="give-required-indicator">*</span>
1054 1054
 				<?php endif; ?>
1055
-				<?php echo Give()->tooltips->render_help( __( 'The city for your billing address.', 'give' ) ); ?>
1055
+				<?php echo Give()->tooltips->render_help(__('The city for your billing address.', 'give')); ?>
1056 1056
 			</label>
1057 1057
 			<input
1058 1058
 					type="text"
1059 1059
 					id="card_city"
1060 1060
 					name="card_city"
1061 1061
 					autocomplete="address-level3"
1062
-					class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
1063
-					placeholder="<?php _e( 'City', 'give' ); ?>"
1064
-					value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
1065
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1062
+					class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
1063
+					placeholder="<?php _e('City', 'give'); ?>"
1064
+					value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
1065
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
1066 1066
 			/>
1067 1067
 		</p>
1068 1068
 
1069 1069
 	    <p id="give-card-state-wrap"
1070
-	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> ">
1070
+	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> ">
1071 1071
 		    <label for="card_state" class="give-label">
1072 1072
 			    <span class="state-label-text"><?php echo $label; ?></span>
1073
-			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1073
+			    <?php if (give_field_is_required('card_state', $form_id)) :
1074 1074
 				    ?>
1075
-				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
1075
+				    <span class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : '') ?> ">*</span>
1076 1076
 			    <?php endif; ?>
1077 1077
 			    <span class="give-tooltip give-icon give-icon-question"
1078
-			          data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span>
1078
+			          data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span>
1079 1079
 		    </label>
1080 1080
 		    <?php
1081 1081
 
1082
-		    if ( ! empty( $states ) ) : ?>
1082
+		    if ( ! empty($states)) : ?>
1083 1083
 			    <select
1084 1084
 					    name="card_state"
1085 1085
 					    autocomplete="address-level4"
1086 1086
 					    id="card_state"
1087
-					    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1088
-				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1087
+					    class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1088
+				    <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>>
1089 1089
 				    <?php
1090
-				    foreach ( $states as $state_code => $state ) {
1091
-					    echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1090
+				    foreach ($states as $state_code => $state) {
1091
+					    echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1092 1092
 				    }
1093 1093
 				    ?>
1094 1094
 			    </select>
@@ -1100,11 +1100,11 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
 		<p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive">
1102 1102
 			<label for="card_zip" class="give-label">
1103
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
1104
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
1103
+				<?php _e('Zip / Postal Code', 'give'); ?>
1104
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
1105 1105
 					<span class="give-required-indicator">*</span>
1106 1106
 				<?php endif; ?>
1107
-				<?php echo Give()->tooltips->render_help( __( 'The ZIP Code or postal code for your billing address.', 'give' ) ); ?>
1107
+				<?php echo Give()->tooltips->render_help(__('The ZIP Code or postal code for your billing address.', 'give')); ?>
1108 1108
 			</label>
1109 1109
 
1110 1110
 			<input
@@ -1113,10 +1113,10 @@  discard block
 block discarded – undo
1113 1113
 					id="card_zip"
1114 1114
 					name="card_zip"
1115 1115
 					autocomplete="postal-code"
1116
-					class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
1117
-					placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>"
1118
-					value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
1119
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1116
+					class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
1117
+					placeholder="<?php _e('Zip / Postal Code', 'give'); ?>"
1118
+					value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
1119
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
1120 1120
 			/>
1121 1121
 		</p>
1122 1122
 		<?php
@@ -1127,14 +1127,14 @@  discard block
 block discarded – undo
1127 1127
 		 *
1128 1128
 		 * @param int $form_id The form ID.
1129 1129
 		 */
1130
-		do_action( 'give_cc_billing_bottom' );
1130
+		do_action('give_cc_billing_bottom');
1131 1131
 		?>
1132 1132
 	</fieldset>
1133 1133
 	<?php
1134 1134
 	echo ob_get_clean();
1135 1135
 }
1136 1136
 
1137
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1137
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1138 1138
 
1139 1139
 
1140 1140
 /**
@@ -1147,15 +1147,15 @@  discard block
 block discarded – undo
1147 1147
  *
1148 1148
  * @return string
1149 1149
  */
1150
-function give_get_register_fields( $form_id ) {
1150
+function give_get_register_fields($form_id) {
1151 1151
 
1152 1152
 	global $user_ID;
1153 1153
 
1154
-	if ( is_user_logged_in() ) {
1155
-		$user_data = get_userdata( $user_ID );
1154
+	if (is_user_logged_in()) {
1155
+		$user_data = get_userdata($user_ID);
1156 1156
 	}
1157 1157
 
1158
-	$show_register_form = give_show_login_register_option( $form_id );
1158
+	$show_register_form = give_show_login_register_option($form_id);
1159 1159
 
1160 1160
 	ob_start(); ?>
1161 1161
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 		 *
1169 1169
 		 * @param int $form_id The form ID.
1170 1170
 		 */
1171
-		do_action( 'give_register_fields_before', $form_id );
1171
+		do_action('give_register_fields_before', $form_id);
1172 1172
 		?>
1173 1173
 
1174 1174
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
@@ -1180,22 +1180,22 @@  discard block
 block discarded – undo
1180 1180
 			 *
1181 1181
 			 * @param int $form_id The form ID.
1182 1182
 			 */
1183
-			do_action( 'give_register_account_fields_before', $form_id );
1183
+			do_action('give_register_account_fields_before', $form_id);
1184 1184
 			?>
1185 1185
 			<div id="give-create-account-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1186 1186
 				<label for="give-create-account-<?php echo $form_id; ?>">
1187 1187
 					<?php
1188 1188
 					// Add attributes to checkbox, if Guest Checkout is disabled.
1189
-					$is_guest_checkout = give_get_meta( $form_id, '_give_logged_in_only', true );
1190
-					$id                = 'give-create-account-' . $form_id;
1191
-					if ( ! give_is_setting_enabled( $is_guest_checkout ) ) {
1189
+					$is_guest_checkout = give_get_meta($form_id, '_give_logged_in_only', true);
1190
+					$id                = 'give-create-account-'.$form_id;
1191
+					if ( ! give_is_setting_enabled($is_guest_checkout)) {
1192 1192
 						echo Give()->tooltips->render(
1193 1193
 							array(
1194 1194
 								'tag_content' => sprintf(
1195 1195
 									'<input type="checkbox" name="give_create_account" value="on" id="%s" class="give-input give-disabled" checked />',
1196 1196
 									$id
1197 1197
 								),
1198
-								'label'       => __( 'Registration is required to donate.', 'give' ),
1198
+								'label'       => __('Registration is required to donate.', 'give'),
1199 1199
 							) );
1200 1200
 					} else {
1201 1201
 						?>
@@ -1203,17 +1203,17 @@  discard block
 block discarded – undo
1203 1203
 						<?php
1204 1204
 					}
1205 1205
 					?>
1206
-					<?php _e( 'Create an account', 'give' ); ?>
1207
-					<?php echo Give()->tooltips->render_help( __( 'Create an account on the site to see and manage donation history.', 'give' ) ); ?>
1208
-					<?php wp_nonce_field( 'give_form_create_user_nonce', 'give-form-user-register-hash', false, true );?>
1206
+					<?php _e('Create an account', 'give'); ?>
1207
+					<?php echo Give()->tooltips->render_help(__('Create an account on the site to see and manage donation history.', 'give')); ?>
1208
+					<?php wp_nonce_field('give_form_create_user_nonce', 'give-form-user-register-hash', false, true); ?>
1209 1209
 				</label>
1210 1210
 			</div>
1211 1211
 
1212
-			<?php if ( 'both' === $show_register_form ) { ?>
1212
+			<?php if ('both' === $show_register_form) { ?>
1213 1213
 				<div class="give-login-account-wrap form-row form-row-last form-row-responsive">
1214
-					<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1215
-						<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1216
-						   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1214
+					<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1215
+						<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1216
+						   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1217 1217
 					</p>
1218 1218
 					<p class="give-loading-text">
1219 1219
 						<span class="give-loading-animation"></span>
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 			 *
1230 1230
 			 * @param int $form_id The form ID.
1231 1231
 			 */
1232
-			do_action( 'give_register_account_fields_after', $form_id );
1232
+			do_action('give_register_account_fields_after', $form_id);
1233 1233
 			?>
1234 1234
 		</fieldset>
1235 1235
 
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 		 *
1242 1242
 		 * @param int $form_id The form ID.
1243 1243
 		 */
1244
-		do_action( 'give_register_fields_after', $form_id );
1244
+		do_action('give_register_fields_after', $form_id);
1245 1245
 		?>
1246 1246
 
1247 1247
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
 		 *
1253 1253
 		 * @since 1.7
1254 1254
 		 */
1255
-		do_action( 'give_donation_form_user_info', $form_id );
1255
+		do_action('give_donation_form_user_info', $form_id);
1256 1256
 		?>
1257 1257
 
1258 1258
 	</fieldset>
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 	echo ob_get_clean();
1261 1261
 }
1262 1262
 
1263
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1263
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1264 1264
 
1265 1265
 /**
1266 1266
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1273,28 +1273,28 @@  discard block
 block discarded – undo
1273 1273
  *
1274 1274
  * @return string
1275 1275
  */
1276
-function give_get_login_fields( $form_id ) {
1276
+function give_get_login_fields($form_id) {
1277 1277
 
1278
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1279
-	$show_register_form = give_show_login_register_option( $form_id );
1278
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1279
+	$show_register_form = give_show_login_register_option($form_id);
1280 1280
 
1281 1281
 	ob_start();
1282 1282
 	?>
1283 1283
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1284
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
1285
-			if ( ! give_logged_in_only( $form_id ) ) {
1286
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
1284
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
1285
+			if ( ! give_logged_in_only($form_id)) {
1286
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
1287 1287
 			} ?>
1288 1288
 		</legend>
1289
-		<?php if ( $show_register_form == 'both' ) { ?>
1289
+		<?php if ($show_register_form == 'both') { ?>
1290 1290
 			<p class="give-new-account-link">
1291
-				<?php _e( 'Don\'t have an account?', 'give' ); ?>&nbsp;
1292
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1291
+				<?php _e('Don\'t have an account?', 'give'); ?>&nbsp;
1292
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1293 1293
 				   data-action="give_checkout_register">
1294
-					<?php if ( give_logged_in_only( $form_id ) ) {
1295
-					    _e( 'Register as a part of your donation &raquo;', 'give' );
1294
+					<?php if (give_logged_in_only($form_id)) {
1295
+					    _e('Register as a part of your donation &raquo;', 'give');
1296 1296
                     } else {
1297
-						 _e( 'Register or donate as a guest &raquo;', 'give' );
1297
+						 _e('Register or donate as a guest &raquo;', 'give');
1298 1298
 					} ?>
1299 1299
 				</a>
1300 1300
 			</p>
@@ -1310,49 +1310,49 @@  discard block
 block discarded – undo
1310 1310
 		 *
1311 1311
 		 * @param int $form_id The form ID.
1312 1312
 		 */
1313
-		do_action( 'give_checkout_login_fields_before', $form_id );
1313
+		do_action('give_checkout_login_fields_before', $form_id);
1314 1314
 		?>
1315 1315
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1316 1316
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1317
-				<?php _e( 'Username', 'give' ); ?>
1318
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1317
+				<?php _e('Username', 'give'); ?>
1318
+				<?php if (give_logged_in_only($form_id)) { ?>
1319 1319
 					<span class="give-required-indicator">*</span>
1320 1320
 				<?php } ?>
1321 1321
 			</label>
1322 1322
 
1323
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1323
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1324 1324
 				   name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1325
-				   placeholder="<?php _e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1325
+				   placeholder="<?php _e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1326 1326
 		</div>
1327 1327
 
1328 1328
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1329 1329
 			 class="give_login_password form-row form-row-last form-row-responsive">
1330 1330
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1331
-				<?php _e( 'Password', 'give' ); ?>
1332
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1331
+				<?php _e('Password', 'give'); ?>
1332
+				<?php if (give_logged_in_only($form_id)) { ?>
1333 1333
 					<span class="give-required-indicator">*</span>
1334 1334
 				<?php } ?>
1335 1335
 			</label>
1336
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1336
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1337 1337
 				   type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1338
-				   placeholder="<?php _e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1338
+				   placeholder="<?php _e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1339 1339
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1340 1340
 		</div>
1341 1341
 
1342 1342
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1343 1343
 			 <span class="give-forgot-password ">
1344 1344
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1345
-					target="_blank"><?php _e( 'Reset Password', 'give' ) ?></a>
1345
+					target="_blank"><?php _e('Reset Password', 'give') ?></a>
1346 1346
 			 </span>
1347 1347
 		</div>
1348 1348
 
1349 1349
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1350 1350
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1351
-				   value="<?php _e( 'Login', 'give' ); ?>"/>
1352
-			<?php if ( $show_register_form !== 'login' ) { ?>
1351
+				   value="<?php _e('Login', 'give'); ?>"/>
1352
+			<?php if ($show_register_form !== 'login') { ?>
1353 1353
 				<input type="button" data-action="give_cancel_login"
1354 1354
 					   class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1355
-					   value="<?php _e( 'Cancel', 'give' ); ?>"/>
1355
+					   value="<?php _e('Cancel', 'give'); ?>"/>
1356 1356
 			<?php } ?>
1357 1357
 			<span class="give-loading-animation"></span>
1358 1358
 		</div>
@@ -1364,14 +1364,14 @@  discard block
 block discarded – undo
1364 1364
 		 *
1365 1365
 		 * @param int $form_id The form ID.
1366 1366
 		 */
1367
-		do_action( 'give_checkout_login_fields_after', $form_id );
1367
+		do_action('give_checkout_login_fields_after', $form_id);
1368 1368
 		?>
1369 1369
 	</fieldset><!--end #give-login-fields-->
1370 1370
 	<?php
1371 1371
 	echo ob_get_clean();
1372 1372
 }
1373 1373
 
1374
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1374
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1375 1375
 
1376 1376
 /**
1377 1377
  * Payment Mode Select.
@@ -1387,10 +1387,10 @@  discard block
 block discarded – undo
1387 1387
  *
1388 1388
  * @return void
1389 1389
  */
1390
-function give_payment_mode_select( $form_id, $args ) {
1390
+function give_payment_mode_select($form_id, $args) {
1391 1391
 
1392
-	$gateways  = give_get_enabled_payment_gateways( $form_id );
1393
-	$id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : '';
1392
+	$gateways  = give_get_enabled_payment_gateways($form_id);
1393
+	$id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : '';
1394 1394
 
1395 1395
 	/**
1396 1396
 	 * Fires while selecting payment gateways, before the fields.
@@ -1399,10 +1399,10 @@  discard block
 block discarded – undo
1399 1399
 	 *
1400 1400
 	 * @param int $form_id The form ID.
1401 1401
 	 */
1402
-	do_action( 'give_payment_mode_top', $form_id );
1402
+	do_action('give_payment_mode_top', $form_id);
1403 1403
 	?>
1404 1404
 
1405
-	<fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1405
+	<fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1406 1406
 		echo 'style="display: none;"';
1407 1407
 	} ?>>
1408 1408
 		<?php
@@ -1413,10 +1413,10 @@  discard block
 block discarded – undo
1413 1413
 		 *
1414 1414
 		 * @param int $form_id The form ID.
1415 1415
 		 */
1416
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1416
+		do_action('give_payment_mode_before_gateways_wrap');
1417 1417
 		?>
1418 1418
 		<legend
1419
-				class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1419
+				class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1420 1420
 			<span class="give-loading-text"><span
1421 1421
 						class="give-loading-animation"></span>
1422 1422
             </span>
@@ -1429,37 +1429,36 @@  discard block
 block discarded – undo
1429 1429
 			 *
1430 1430
 			 * @since 1.7
1431 1431
 			 */
1432
-			do_action( 'give_payment_mode_before_gateways' )
1432
+			do_action('give_payment_mode_before_gateways')
1433 1433
 			?>
1434 1434
 			<ul id="give-gateway-radio-list">
1435 1435
 				<?php
1436 1436
 				/**
1437 1437
 				 * Loop through the active payment gateways.
1438 1438
 				 */
1439
-				$selected_gateway = give_get_chosen_gateway( $form_id );
1439
+				$selected_gateway = give_get_chosen_gateway($form_id);
1440 1440
 				$give_settings    = give_get_settings();
1441
-				$gateways_label   = array_key_exists( 'gateways_label', $give_settings ) ?
1442
-					$give_settings['gateways_label'] :
1443
-					array();
1441
+				$gateways_label   = array_key_exists('gateways_label', $give_settings) ?
1442
+					$give_settings['gateways_label'] : array();
1444 1443
 
1445
-				foreach ( $gateways as $gateway_id => $gateway ) :
1444
+				foreach ($gateways as $gateway_id => $gateway) :
1446 1445
 					//Determine the default gateway.
1447
-					$checked = checked( $gateway_id, $selected_gateway, false );
1446
+					$checked = checked($gateway_id, $selected_gateway, false);
1448 1447
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?>
1449 1448
 					<li<?php echo $checked_class ?>>
1450 1449
 						<input type="radio" name="payment-mode" class="give-gateway"
1451
-							   id="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>"
1452
-							   value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1450
+							   id="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>"
1451
+							   value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1453 1452
 
1454 1453
 						<?php
1455 1454
 						$label = $gateway['checkout_label'];
1456
-						if ( ! empty( $gateways_label[ $gateway_id  ] ) ) {
1457
-							$label = $gateways_label[ $gateway_id ];
1455
+						if ( ! empty($gateways_label[$gateway_id])) {
1456
+							$label = $gateways_label[$gateway_id];
1458 1457
 						}
1459 1458
 						?>
1460
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>"
1459
+						<label for="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>"
1461 1460
 							   class="give-gateway-option"
1462
-							   id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $label ); ?></label>
1461
+							   id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($label); ?></label>
1463 1462
 					</li>
1464 1463
 					<?php
1465 1464
 				endforeach;
@@ -1471,7 +1470,7 @@  discard block
 block discarded – undo
1471 1470
 			 *
1472 1471
 			 * @since 1.7
1473 1472
 			 */
1474
-			do_action( 'give_payment_mode_after_gateways' );
1473
+			do_action('give_payment_mode_after_gateways');
1475 1474
 			?>
1476 1475
 		</div>
1477 1476
 		<?php
@@ -1482,7 +1481,7 @@  discard block
 block discarded – undo
1482 1481
 		 *
1483 1482
 		 * @param int $form_id The form ID.
1484 1483
 		 */
1485
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1484
+		do_action('give_payment_mode_after_gateways_wrap');
1486 1485
 		?>
1487 1486
 	</fieldset>
1488 1487
 
@@ -1494,7 +1493,7 @@  discard block
 block discarded – undo
1494 1493
 	 *
1495 1494
 	 * @param int $form_id The form ID.
1496 1495
 	 */
1497
-	do_action( 'give_payment_mode_bottom', $form_id );
1496
+	do_action('give_payment_mode_bottom', $form_id);
1498 1497
 	?>
1499 1498
 
1500 1499
 	<div id="give_purchase_form_wrap">
@@ -1505,7 +1504,7 @@  discard block
 block discarded – undo
1505 1504
 		 *
1506 1505
 		 * @since 1.7
1507 1506
 		 */
1508
-		do_action( 'give_donation_form', $form_id, $args );
1507
+		do_action('give_donation_form', $form_id, $args);
1509 1508
 		?>
1510 1509
 
1511 1510
 	</div>
@@ -1516,10 +1515,10 @@  discard block
 block discarded – undo
1516 1515
 	 *
1517 1516
 	 * @since 1.7
1518 1517
 	 */
1519
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1518
+	do_action('give_donation_form_wrap_bottom', $form_id);
1520 1519
 }
1521 1520
 
1522
-add_action( 'give_payment_mode_select', 'give_payment_mode_select', 10, 2 );
1521
+add_action('give_payment_mode_select', 'give_payment_mode_select', 10, 2);
1523 1522
 
1524 1523
 /**
1525 1524
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1532,31 +1531,31 @@  discard block
 block discarded – undo
1532 1531
  *
1533 1532
  * @return bool
1534 1533
  */
1535
-function give_terms_agreement( $form_id ) {
1536
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1534
+function give_terms_agreement($form_id) {
1535
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1537 1536
 
1538 1537
 	// Bailout if per form and global term and conditions is not setup.
1539 1538
 	if (
1540
-		give_is_setting_enabled( $form_option, 'global' )
1541
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1539
+		give_is_setting_enabled($form_option, 'global')
1540
+		&& give_is_setting_enabled(give_get_option('terms'))
1542 1541
 	) {
1543
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1544
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1545
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1542
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1543
+		$terms         = $terms = give_get_option('agreement_text', '');
1544
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1546 1545
 
1547
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1548
-		$label         = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1549
-		$terms         = give_get_meta( $form_id, '_give_agree_text', true );
1550
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1546
+	} elseif (give_is_setting_enabled($form_option)) {
1547
+		$label         = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1548
+		$terms         = give_get_meta($form_id, '_give_agree_text', true);
1549
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1551 1550
 
1552 1551
 	} else {
1553 1552
 		return false;
1554 1553
 	}
1555 1554
 
1556 1555
 	// Bailout: Check if term and conditions text is empty or not.
1557
-	if ( empty( $terms ) ) {
1558
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1559
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1556
+	if (empty($terms)) {
1557
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1558
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1560 1559
 		}
1561 1560
 
1562 1561
 		return false;
@@ -1564,7 +1563,7 @@  discard block
 block discarded – undo
1564 1563
 
1565 1564
 	?>
1566 1565
 	<fieldset id="give_terms_agreement">
1567
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1566
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1568 1567
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1569 1568
 			<?php
1570 1569
 			/**
@@ -1572,22 +1571,22 @@  discard block
 block discarded – undo
1572 1571
 			 *
1573 1572
 			 * @since 1.0
1574 1573
 			 */
1575
-			do_action( 'give_before_terms' );
1574
+			do_action('give_before_terms');
1576 1575
 
1577
-			echo wpautop( stripslashes( $terms ) );
1576
+			echo wpautop(stripslashes($terms));
1578 1577
 			/**
1579 1578
 			 * Fires while rendering terms of agreement, after the fields.
1580 1579
 			 *
1581 1580
 			 * @since 1.0
1582 1581
 			 */
1583
-			do_action( 'give_after_terms' );
1582
+			do_action('give_after_terms');
1584 1583
 			?>
1585 1584
 		</div>
1586 1585
 		<div id="give_show_terms">
1587 1586
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1588
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1587
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1589 1588
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1590
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1589
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1591 1590
 		</div>
1592 1591
 
1593 1592
 		<input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1598,7 +1597,7 @@  discard block
 block discarded – undo
1598 1597
 	<?php
1599 1598
 }
1600 1599
 
1601
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1600
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1602 1601
 
1603 1602
 /**
1604 1603
  * Checkout Final Total.
@@ -1611,15 +1610,14 @@  discard block
 block discarded – undo
1611 1610
  *
1612 1611
  * @return void
1613 1612
  */
1614
-function give_checkout_final_total( $form_id ) {
1613
+function give_checkout_final_total($form_id) {
1615 1614
 
1616
-	$total = isset( $_POST['give_total'] ) ?
1617
-		apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) :
1618
-		give_get_default_form_amount( $form_id );
1615
+	$total = isset($_POST['give_total']) ?
1616
+		apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id);
1619 1617
 
1620 1618
 
1621 1619
 	// Only proceed if give_total available.
1622
-	if ( empty( $total ) ) {
1620
+	if (empty($total)) {
1623 1621
 		return;
1624 1622
 	}
1625 1623
 	?>
@@ -1630,19 +1628,19 @@  discard block
 block discarded – undo
1630 1628
 		 *
1631 1629
 		 * @since 2.0.5
1632 1630
 		 */
1633
-		do_action( 'give_donation_final_total_label_before', $form_id );
1631
+		do_action('give_donation_final_total_label_before', $form_id);
1634 1632
 		?>
1635 1633
 		<span class="give-donation-total-label">
1636
-			<?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?>
1634
+			<?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?>
1637 1635
 		</span>
1638 1636
 		<span class="give-final-total-amount"
1639
-			  data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>">
1637
+			  data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>">
1640 1638
 			<?php
1641 1639
 
1642
-			echo give_currency_filter( give_format_amount( $total, array(
1640
+			echo give_currency_filter(give_format_amount($total, array(
1643 1641
 				'sanitize' => false,
1644
-				'currency' => give_get_currency( $form_id ),
1645
-			) ), array( 'currency_code' => give_get_currency( $form_id ) ) ); ?>
1642
+				'currency' => give_get_currency($form_id),
1643
+			)), array('currency_code' => give_get_currency($form_id))); ?>
1646 1644
 		</span>
1647 1645
 		<?php
1648 1646
 		/**
@@ -1650,13 +1648,13 @@  discard block
 block discarded – undo
1650 1648
 		 *
1651 1649
 		 * @since 2.0.5
1652 1650
 		 */
1653
-		do_action( 'give_donation_final_total_label_after', $form_id );
1651
+		do_action('give_donation_final_total_label_after', $form_id);
1654 1652
 		?>
1655 1653
 	</p>
1656 1654
 	<?php
1657 1655
 }
1658 1656
 
1659
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1657
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1660 1658
 
1661 1659
 /**
1662 1660
  * Renders the Checkout Submit section.
@@ -1668,7 +1666,7 @@  discard block
 block discarded – undo
1668 1666
  *
1669 1667
  * @return void
1670 1668
  */
1671
-function give_checkout_submit( $form_id, $args ) {
1669
+function give_checkout_submit($form_id, $args) {
1672 1670
 	?>
1673 1671
 	<fieldset id="give_purchase_submit" class="give-donation-submit">
1674 1672
 		<?php
@@ -1677,24 +1675,24 @@  discard block
 block discarded – undo
1677 1675
 		 *
1678 1676
 		 * @since 1.7
1679 1677
 		 */
1680
-		do_action( 'give_donation_form_before_submit', $form_id, $args );
1678
+		do_action('give_donation_form_before_submit', $form_id, $args);
1681 1679
 
1682
-		give_checkout_hidden_fields( $form_id );
1680
+		give_checkout_hidden_fields($form_id);
1683 1681
 
1684
-		echo give_get_donation_form_submit_button( $form_id );
1682
+		echo give_get_donation_form_submit_button($form_id);
1685 1683
 
1686 1684
 		/**
1687 1685
 		 * Fire after donation form submit.
1688 1686
 		 *
1689 1687
 		 * @since 1.7
1690 1688
 		 */
1691
-		do_action( 'give_donation_form_after_submit', $form_id, $args );
1689
+		do_action('give_donation_form_after_submit', $form_id, $args);
1692 1690
 		?>
1693 1691
 	</fieldset>
1694 1692
 	<?php
1695 1693
 }
1696 1694
 
1697
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2 );
1695
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2);
1698 1696
 
1699 1697
 /**
1700 1698
  * Give Donation form submit button.
@@ -1705,10 +1703,10 @@  discard block
 block discarded – undo
1705 1703
  *
1706 1704
  * @return string
1707 1705
  */
1708
-function give_get_donation_form_submit_button( $form_id ) {
1706
+function give_get_donation_form_submit_button($form_id) {
1709 1707
 
1710
-	$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
1711
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1708
+	$display_label_field = give_get_meta($form_id, '_give_checkout_label', true);
1709
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1712 1710
 	ob_start();
1713 1711
 	?>
1714 1712
 	<div class="give-submit-button-wrap give-clearfix">
@@ -1717,7 +1715,7 @@  discard block
 block discarded – undo
1717 1715
 		<span class="give-loading-animation"></span>
1718 1716
 	</div>
1719 1717
 	<?php
1720
-	return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id );
1718
+	return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id);
1721 1719
 }
1722 1720
 
1723 1721
 /**
@@ -1732,22 +1730,22 @@  discard block
 block discarded – undo
1732 1730
  *
1733 1731
  * @return mixed
1734 1732
  */
1735
-function give_show_goal_progress( $form_id, $args = array() ) {
1733
+function give_show_goal_progress($form_id, $args = array()) {
1736 1734
 
1737 1735
 	ob_start();
1738
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1736
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1739 1737
 
1740 1738
 	/**
1741 1739
 	 * Filter progress bar output
1742 1740
 	 *
1743 1741
 	 * @since 2.0
1744 1742
 	 */
1745
-	echo apply_filters( 'give_goal_output', ob_get_clean(), $form_id, $args );
1743
+	echo apply_filters('give_goal_output', ob_get_clean(), $form_id, $args);
1746 1744
 
1747 1745
 	return true;
1748 1746
 }
1749 1747
 
1750
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1748
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1751 1749
 
1752 1750
 /**
1753 1751
  * Show Give Totals Progress.
@@ -1759,22 +1757,22 @@  discard block
 block discarded – undo
1759 1757
  *
1760 1758
  * @return mixed
1761 1759
  */
1762
-function give_show_goal_totals_progress( $total, $total_goal ) {
1760
+function give_show_goal_totals_progress($total, $total_goal) {
1763 1761
 
1764 1762
 	// Bail out if total goal is set as an array.
1765
-	if ( isset( $total_goal ) && is_array( $total_goal ) ) {
1763
+	if (isset($total_goal) && is_array($total_goal)) {
1766 1764
 		return false;
1767 1765
 	}
1768 1766
 
1769 1767
 	ob_start();
1770
-	give_get_template( 'shortcode-totals-progress', array( 'total' => $total, 'total_goal' => $total_goal ) );
1768
+	give_get_template('shortcode-totals-progress', array('total' => $total, 'total_goal' => $total_goal));
1771 1769
 
1772
-	echo apply_filters( 'give_total_progress_output', ob_get_clean() );
1770
+	echo apply_filters('give_total_progress_output', ob_get_clean());
1773 1771
 
1774 1772
 	return true;
1775 1773
 }
1776 1774
 
1777
-add_action( 'give_pre_form', 'give_show_goal_totals_progress', 10, 2 );
1775
+add_action('give_pre_form', 'give_show_goal_totals_progress', 10, 2);
1778 1776
 
1779 1777
 /**
1780 1778
  * Get form content position.
@@ -1786,10 +1784,10 @@  discard block
 block discarded – undo
1786 1784
  *
1787 1785
  * @return mixed|string
1788 1786
  */
1789
-function give_get_form_content_placement( $form_id, $args ) {
1787
+function give_get_form_content_placement($form_id, $args) {
1790 1788
 	$show_content = '';
1791 1789
 
1792
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1790
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1793 1791
 		// Content positions.
1794 1792
 		$content_placement = array(
1795 1793
 			'above' => 'give_pre_form',
@@ -1797,18 +1795,18 @@  discard block
 block discarded – undo
1797 1795
 		);
1798 1796
 
1799 1797
 		// Check if content position already decoded.
1800
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1798
+		if (in_array($args['show_content'], $content_placement)) {
1801 1799
 			return $args['show_content'];
1802 1800
 		}
1803 1801
 
1804
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1802
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1805 1803
 
1806
-	} elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) {
1807
-		$show_content = give_get_meta( $form_id, '_give_content_placement', true );
1804
+	} elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) {
1805
+		$show_content = give_get_meta($form_id, '_give_content_placement', true);
1808 1806
 
1809
-	} elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) {
1807
+	} elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) {
1810 1808
 		// Backward compatibility for _give_content_option for v18.
1811
-		$show_content = give_get_meta( $form_id, '_give_content_option', true );
1809
+		$show_content = give_get_meta($form_id, '_give_content_option', true);
1812 1810
 	}
1813 1811
 
1814 1812
 	return $show_content;
@@ -1824,20 +1822,20 @@  discard block
 block discarded – undo
1824 1822
  *
1825 1823
  * @return void|bool
1826 1824
  */
1827
-function give_form_content( $form_id, $args ) {
1825
+function give_form_content($form_id, $args) {
1828 1826
 
1829
-	$show_content = give_get_form_content_placement( $form_id, $args );
1827
+	$show_content = give_get_form_content_placement($form_id, $args);
1830 1828
 
1831 1829
 	// Bailout.
1832
-	if ( empty( $show_content ) ) {
1830
+	if (empty($show_content)) {
1833 1831
 		return false;
1834 1832
 	}
1835 1833
 
1836 1834
 	// Add action according to value.
1837
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
1835
+	add_action($show_content, 'give_form_display_content', 10, 2);
1838 1836
 }
1839 1837
 
1840
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1838
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1841 1839
 
1842 1840
 /**
1843 1841
  * Renders Post Form Content.
@@ -1851,22 +1849,22 @@  discard block
 block discarded – undo
1851 1849
  *
1852 1850
  * @return void
1853 1851
  */
1854
-function give_form_display_content( $form_id, $args ) {
1852
+function give_form_display_content($form_id, $args) {
1855 1853
 
1856
-	$content      = wpautop( give_get_meta( $form_id, '_give_form_content', true ) );
1857
-	$show_content = give_get_form_content_placement( $form_id, $args );
1854
+	$content      = wpautop(give_get_meta($form_id, '_give_form_content', true));
1855
+	$show_content = give_get_form_content_placement($form_id, $args);
1858 1856
 
1859
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
1860
-		$content = apply_filters( 'the_content', $content );
1857
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
1858
+		$content = apply_filters('the_content', $content);
1861 1859
 	}
1862 1860
 
1863
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>';
1861
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>';
1864 1862
 
1865
-	echo apply_filters( 'give_form_content_output', $output );
1863
+	echo apply_filters('give_form_content_output', $output);
1866 1864
 
1867 1865
 	// remove action to prevent content output on addition forms on page.
1868 1866
 	// @see: https://github.com/WordImpress/Give/issues/634.
1869
-	remove_action( $show_content, 'give_form_display_content' );
1867
+	remove_action($show_content, 'give_form_display_content');
1870 1868
 }
1871 1869
 
1872 1870
 /**
@@ -1878,7 +1876,7 @@  discard block
 block discarded – undo
1878 1876
  *
1879 1877
  * @return void
1880 1878
  */
1881
-function give_checkout_hidden_fields( $form_id ) {
1879
+function give_checkout_hidden_fields($form_id) {
1882 1880
 
1883 1881
 	/**
1884 1882
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1887,13 +1885,13 @@  discard block
 block discarded – undo
1887 1885
 	 *
1888 1886
 	 * @param int $form_id The form ID.
1889 1887
 	 */
1890
-	do_action( 'give_hidden_fields_before', $form_id );
1888
+	do_action('give_hidden_fields_before', $form_id);
1891 1889
 
1892
-	if ( is_user_logged_in() ) { ?>
1890
+	if (is_user_logged_in()) { ?>
1893 1891
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1894 1892
 	<?php } ?>
1895 1893
 	<input type="hidden" name="give_action" value="purchase"/>
1896
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1894
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1897 1895
 	<?php
1898 1896
 	/**
1899 1897
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1902,7 +1900,7 @@  discard block
 block discarded – undo
1902 1900
 	 *
1903 1901
 	 * @param int $form_id The form ID.
1904 1902
 	 */
1905
-	do_action( 'give_hidden_fields_after', $form_id );
1903
+	do_action('give_hidden_fields_after', $form_id);
1906 1904
 
1907 1905
 }
1908 1906
 
@@ -1917,20 +1915,20 @@  discard block
 block discarded – undo
1917 1915
  *
1918 1916
  * @return string $content Filtered content.
1919 1917
  */
1920
-function give_filter_success_page_content( $content ) {
1918
+function give_filter_success_page_content($content) {
1921 1919
 
1922 1920
 	$give_options = give_get_settings();
1923 1921
 
1924
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1925
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1926
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1922
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1923
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1924
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1927 1925
 		}
1928 1926
 	}
1929 1927
 
1930 1928
 	return $content;
1931 1929
 }
1932 1930
 
1933
-add_filter( 'the_content', 'give_filter_success_page_content' );
1931
+add_filter('the_content', 'give_filter_success_page_content');
1934 1932
 
1935 1933
 /**
1936 1934
  * Test Mode Frontend Warning.
@@ -1941,12 +1939,12 @@  discard block
 block discarded – undo
1941 1939
  */
1942 1940
 function give_test_mode_frontend_warning() {
1943 1941
 
1944
-	if ( give_is_test_mode() ) {
1945
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
1942
+	if (give_is_test_mode()) {
1943
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
1946 1944
 	}
1947 1945
 }
1948 1946
 
1949
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1947
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1950 1948
 
1951 1949
 /**
1952 1950
  * Members-only Form.
@@ -1960,21 +1958,21 @@  discard block
 block discarded – undo
1960 1958
  *
1961 1959
  * @return string
1962 1960
  */
1963
-function give_members_only_form( $final_output, $args ) {
1961
+function give_members_only_form($final_output, $args) {
1964 1962
 
1965
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1963
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1966 1964
 
1967 1965
 	//Sanity Check: Must have form_id & not be logged in.
1968
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1966
+	if (empty($form_id) || is_user_logged_in()) {
1969 1967
 		return $final_output;
1970 1968
 	}
1971 1969
 
1972 1970
 	//Logged in only and Register / Login set to none.
1973
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1971
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1974 1972
 
1975
-		$final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1973
+		$final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1976 1974
 
1977
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1975
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1978 1976
 
1979 1977
 	}
1980 1978
 
@@ -1982,7 +1980,7 @@  discard block
 block discarded – undo
1982 1980
 
1983 1981
 }
1984 1982
 
1985
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1983
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
1986 1984
 
1987 1985
 
1988 1986
 /**
@@ -1994,45 +1992,45 @@  discard block
 block discarded – undo
1994 1992
  * @param array            $args
1995 1993
  * @param Give_Donate_Form $form
1996 1994
  */
1997
-function __give_form_add_donation_hidden_field( $form_id, $args, $form ) {
1998
-	$id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : '';
1995
+function __give_form_add_donation_hidden_field($form_id, $args, $form) {
1996
+	$id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : '';
1999 1997
 	?>
2000 1998
 	<input type="hidden" name="give-form-id-prefix" value="<?php echo $id_prefix; ?>"/>
2001
-	<input type="hidden" name="give-form-id" value="<?php echo intval( $form_id ); ?>"/>
2002
-	<input type="hidden" name="give-form-title" value="<?php echo esc_html( $form->post_title ); ?>"/>
2003
-	<input type="hidden" name="give-current-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/>
2004
-	<input type="hidden" name="give-form-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/>
1999
+	<input type="hidden" name="give-form-id" value="<?php echo intval($form_id); ?>"/>
2000
+	<input type="hidden" name="give-form-title" value="<?php echo esc_html($form->post_title); ?>"/>
2001
+	<input type="hidden" name="give-current-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/>
2002
+	<input type="hidden" name="give-form-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/>
2005 2003
 	<?php
2006 2004
 	// Get the custom option amount.
2007
-	$custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
2005
+	$custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
2008 2006
 
2009 2007
 	// If custom amount enabled.
2010
-	if ( give_is_setting_enabled( $custom_amount ) ) {
2008
+	if (give_is_setting_enabled($custom_amount)) {
2011 2009
 		?>
2012 2010
 		<input type="hidden" name="give-form-minimum"
2013
-		       value="<?php echo give_maybe_sanitize_amount( give_get_form_minimum_price( $form_id ) ); ?>"/>
2011
+		       value="<?php echo give_maybe_sanitize_amount(give_get_form_minimum_price($form_id)); ?>"/>
2014 2012
 		<input type="hidden" name="give-form-maximum"
2015
-		       value="<?php echo give_maybe_sanitize_amount( give_get_form_maximum_price( $form_id ) ); ?>"/>
2013
+		       value="<?php echo give_maybe_sanitize_amount(give_get_form_maximum_price($form_id)); ?>"/>
2016 2014
 		<?php
2017 2015
 	}
2018 2016
 
2019 2017
 	// WP nonce field.
2020 2018
 	echo str_replace(
2021 2019
 		'/>',
2022
-		'data-time="' . time() . '" data-nonce-life="' . give_get_nonce_life() . '"/>',
2023
-		give_get_nonce_field( "give_donation_form_nonce_{$form_id}", 'give-form-hash', false )
2020
+		'data-time="'.time().'" data-nonce-life="'.give_get_nonce_life().'"/>',
2021
+		give_get_nonce_field("give_donation_form_nonce_{$form_id}", 'give-form-hash', false)
2024 2022
 	);
2025 2023
 
2026 2024
 	// Price ID hidden field for variable (multi-level) donation forms.
2027
-	if ( give_has_variable_prices( $form_id ) ) {
2025
+	if (give_has_variable_prices($form_id)) {
2028 2026
 
2029 2027
 		// Get default selected price ID.
2030
-		$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
2028
+		$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
2031 2029
 		$price_id = 0;
2032 2030
 
2033 2031
 		// Loop through prices.
2034
-		foreach ( $prices as $price ) {
2035
-			if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
2032
+		foreach ($prices as $price) {
2033
+			if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
2036 2034
 				$price_id = $price['_give_id']['level_id'];
2037 2035
 			};
2038 2036
 		}
@@ -2045,7 +2043,7 @@  discard block
 block discarded – undo
2045 2043
 	}
2046 2044
 }
2047 2045
 
2048
-add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 );
2046
+add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3);
2049 2047
 
2050 2048
 /**
2051 2049
  * Add currency settings on donation form.
@@ -2057,20 +2055,20 @@  discard block
 block discarded – undo
2057 2055
  *
2058 2056
  * @return array
2059 2057
  */
2060
-function __give_form_add_currency_settings( $form_html_tags, $form ) {
2061
-	$form_currency     = give_get_currency( $form->ID );
2062
-	$currency_settings = give_get_currency_formatting_settings( $form_currency );
2058
+function __give_form_add_currency_settings($form_html_tags, $form) {
2059
+	$form_currency     = give_get_currency($form->ID);
2060
+	$currency_settings = give_get_currency_formatting_settings($form_currency);
2063 2061
 
2064 2062
 	// Check if currency exist.
2065
-	if ( empty( $currency_settings ) ) {
2063
+	if (empty($currency_settings)) {
2066 2064
 		return $form_html_tags;
2067 2065
 	}
2068 2066
 
2069
-	$form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency );
2067
+	$form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency);
2070 2068
 	$form_html_tags['data-currency_code']   = $form_currency;
2071 2069
 
2072
-	if ( ! empty( $currency_settings ) ) {
2073
-		foreach ( $currency_settings as $key => $value ) {
2070
+	if ( ! empty($currency_settings)) {
2071
+		foreach ($currency_settings as $key => $value) {
2074 2072
 			$form_html_tags["data-{$key}"] = $value;
2075 2073
 		}
2076 2074
 	}
@@ -2078,7 +2076,7 @@  discard block
 block discarded – undo
2078 2076
 	return $form_html_tags;
2079 2077
 }
2080 2078
 
2081
-add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 );
2079
+add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2);
2082 2080
 
2083 2081
 /**
2084 2082
  * Adds classes to progress bar container.
@@ -2089,7 +2087,7 @@  discard block
 block discarded – undo
2089 2087
  *
2090 2088
  * @return string
2091 2089
  */
2092
-function add_give_goal_progress_class( $class_goal ) {
2090
+function add_give_goal_progress_class($class_goal) {
2093 2091
 	$class_goal = 'progress progress-striped active';
2094 2092
 
2095 2093
 	return $class_goal;
@@ -2104,7 +2102,7 @@  discard block
 block discarded – undo
2104 2102
  *
2105 2103
  * @return string
2106 2104
  */
2107
-function add_give_goal_progress_bar_class( $class_bar ) {
2105
+function add_give_goal_progress_bar_class($class_bar) {
2108 2106
 	$class_bar = 'bar';
2109 2107
 
2110 2108
 	return $class_bar;
@@ -2121,12 +2119,12 @@  discard block
 block discarded – undo
2121 2119
  *
2122 2120
  * @return array
2123 2121
  */
2124
-function add_class_for_form_grid( $class, $id, $args ) {
2122
+function add_class_for_form_grid($class, $id, $args) {
2125 2123
 	$class[] = 'give-form-grid-wrap';
2126 2124
 
2127
-	foreach ( $class as $index => $item ) {
2128
-		if( false !== strpos( $item, 'give-display-' ) ) {
2129
-			unset( $class[$index] );
2125
+	foreach ($class as $index => $item) {
2126
+		if (false !== strpos($item, 'give-display-')) {
2127
+			unset($class[$index]);
2130 2128
 		}
2131 2129
 	}
2132 2130
 
@@ -2142,7 +2140,7 @@  discard block
 block discarded – undo
2142 2140
  *
2143 2141
  * @since 2.1
2144 2142
  */
2145
-function give_is_form_grid_page_hidden_field( $id, $args, $form ) {
2143
+function give_is_form_grid_page_hidden_field($id, $args, $form) {
2146 2144
 	echo '<input type="hidden" name="is-form-grid" value="true" />';
2147 2145
 }
2148 2146
 
@@ -2157,28 +2155,28 @@  discard block
 block discarded – undo
2157 2155
  * @since 2.1
2158 2156
  * @return string
2159 2157
  */
2160
-function give_redirect_and_popup_form( $redirect, $args ) {
2158
+function give_redirect_and_popup_form($redirect, $args) {
2161 2159
 
2162 2160
 	// Check the page has Form Grid.
2163
-	$is_form_grid = isset( $_POST['is-form-grid'] ) ? give_clean( $_POST['is-form-grid'] ) : '';
2161
+	$is_form_grid = isset($_POST['is-form-grid']) ? give_clean($_POST['is-form-grid']) : '';
2164 2162
 
2165
-	if ( 'true' === $is_form_grid ) {
2163
+	if ('true' === $is_form_grid) {
2166 2164
 
2167
-		$payment_mode = give_clean( $_POST['payment-mode'] );
2165
+		$payment_mode = give_clean($_POST['payment-mode']);
2168 2166
 		$form_id = $args['form-id'];
2169 2167
 
2170 2168
 		// Get the URL without Query parameters.
2171
-		$redirect = strtok( $redirect, '?' );
2169
+		$redirect = strtok($redirect, '?');
2172 2170
 
2173 2171
 		// Add query parameters 'form-id' and 'payment-mode'.
2174
-		$redirect = add_query_arg( array(
2172
+		$redirect = add_query_arg(array(
2175 2173
 			'form-id'      => $form_id,
2176 2174
 			'payment-mode' => $payment_mode,
2177
-		), $redirect );
2175
+		), $redirect);
2178 2176
 	}
2179 2177
 
2180 2178
 	// Return the modified URL.
2181 2179
 	return $redirect;
2182 2180
 }
2183 2181
 
2184
-add_filter( 'give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2 );
2182
+add_filter('give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2);
Please login to merge, or discard this patch.
includes/class-give-scripts.php 1 patch
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @since 2.1.0
38 38
 	 */
39 39
 	public function __construct() {
40
-		$this->direction      = ( is_rtl() || isset( $_GET['d'] ) && 'rtl' === $_GET['d'] ) ? '.rtl' : '';
41
-		$this->scripts_footer = give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ? true : false;
40
+		$this->direction      = (is_rtl() || isset($_GET['d']) && 'rtl' === $_GET['d']) ? '.rtl' : '';
41
+		$this->scripts_footer = give_is_setting_enabled(give_get_option('scripts_footer')) ? true : false;
42 42
 		$this->init();
43 43
 	}
44 44
 
@@ -49,20 +49,20 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function init() {
51 51
 
52
-		add_action( 'admin_enqueue_scripts', array( $this, 'register_styles' ) );
53
-		add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) );
54
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_styles' ) );
55
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
52
+		add_action('admin_enqueue_scripts', array($this, 'register_styles'));
53
+		add_action('admin_enqueue_scripts', array($this, 'register_scripts'));
54
+		add_action('wp_enqueue_scripts', array($this, 'register_styles'));
55
+		add_action('wp_enqueue_scripts', array($this, 'register_scripts'));
56 56
 
57
-		if ( is_admin() ) {
58
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
59
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_styles' ) );
60
-			add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_admin_scripts' ) );
61
-			add_action( 'admin_head', array( $this, 'global_admin_head' ) );
57
+		if (is_admin()) {
58
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
59
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_styles'));
60
+			add_action('enqueue_block_editor_assets', array($this, 'gutenberg_admin_scripts'));
61
+			add_action('admin_head', array($this, 'global_admin_head'));
62 62
 
63 63
 		} else {
64
-			add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_styles' ) );
65
-			add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_scripts' ) );
64
+			add_action('wp_enqueue_scripts', array($this, 'public_enqueue_styles'));
65
+			add_action('wp_enqueue_scripts', array($this, 'public_enqueue_scripts'));
66 66
 		}
67 67
 	}
68 68
 
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	public function register_styles() {
75 75
 
76 76
 		// WP-admin.
77
-		wp_register_style( 'give-admin-styles', GIVE_PLUGIN_URL . 'assets/dist/css/admin' . $this->direction . '.css', array(), GIVE_VERSION );
77
+		wp_register_style('give-admin-styles', GIVE_PLUGIN_URL.'assets/dist/css/admin'.$this->direction.'.css', array(), GIVE_VERSION);
78 78
 
79 79
 		// Frontend.
80
-		if ( give_is_setting_enabled( give_get_option( 'css' ) ) ) {
81
-			wp_register_style( 'give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all' );
80
+		if (give_is_setting_enabled(give_get_option('css'))) {
81
+			wp_register_style('give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all');
82 82
 		}
83 83
 	}
84 84
 
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 	public function register_scripts() {
91 91
 
92 92
 		// WP-Admin.
93
-		wp_register_script( 'give-admin-scripts', GIVE_PLUGIN_URL . 'assets/dist/js/admin.js', array(
93
+		wp_register_script('give-admin-scripts', GIVE_PLUGIN_URL.'assets/dist/js/admin.js', array(
94 94
 			'jquery',
95 95
 			'jquery-ui-datepicker',
96 96
 			'wp-color-picker',
97 97
 			'jquery-query',
98
-		), GIVE_VERSION );
98
+		), GIVE_VERSION);
99 99
 
100 100
 		// Frontend.
101
-		wp_register_script( 'give', GIVE_PLUGIN_URL . 'assets/dist/js/give.js', array( 'jquery' ), GIVE_VERSION, $this->scripts_footer );
101
+		wp_register_script('give', GIVE_PLUGIN_URL.'assets/dist/js/give.js', array('jquery'), GIVE_VERSION, $this->scripts_footer);
102 102
 	}
103 103
 
104 104
 	/**
@@ -108,20 +108,20 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param string $hook Page hook.
110 110
 	 */
111
-	public function admin_enqueue_styles( $hook ) {
111
+	public function admin_enqueue_styles($hook) {
112 112
 
113 113
 		// Give Admin Only.
114
-		if ( ! apply_filters( 'give_load_admin_styles', give_is_admin_page(), $hook ) ) {
114
+		if ( ! apply_filters('give_load_admin_styles', give_is_admin_page(), $hook)) {
115 115
 			return;
116 116
 		}
117 117
 
118 118
 		// Give enqueues.
119
-		wp_enqueue_style( 'give-admin-styles' );
120
-		wp_enqueue_style( 'give-admin-bar-notification' );
119
+		wp_enqueue_style('give-admin-styles');
120
+		wp_enqueue_style('give-admin-bar-notification');
121 121
 
122 122
 		// WP Core enqueues.
123
-		wp_enqueue_style( 'wp-color-picker' );
124
-		wp_enqueue_style( 'thickbox' ); // @TODO remove once we have modal API.
123
+		wp_enqueue_style('wp-color-picker');
124
+		wp_enqueue_style('thickbox'); // @TODO remove once we have modal API.
125 125
 
126 126
 	}
127 127
 
@@ -132,21 +132,21 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @param string $hook Page hook.
134 134
 	 */
135
-	public function admin_enqueue_scripts( $hook ) {
135
+	public function admin_enqueue_scripts($hook) {
136 136
 
137 137
 		// Give Admin Only.
138
-		if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
138
+		if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
139 139
 			return;
140 140
 		}
141 141
 
142 142
 		// WP Scripts.
143
-		wp_enqueue_script( 'wp-color-picker' );
144
-		wp_enqueue_script( 'jquery-ui-datepicker' );
145
-		wp_enqueue_script( 'thickbox' );
143
+		wp_enqueue_script('wp-color-picker');
144
+		wp_enqueue_script('jquery-ui-datepicker');
145
+		wp_enqueue_script('thickbox');
146 146
 		wp_enqueue_media();
147 147
 
148 148
 		// Give admin scripts.
149
-		wp_enqueue_script( 'give-admin-scripts' );
149
+		wp_enqueue_script('give-admin-scripts');
150 150
 
151 151
 		// Localize admin scripts
152 152
 		$this->admin_localize_scripts();
@@ -166,112 +166,112 @@  discard block
 block discarded – undo
166 166
 		$decimal_separator  = give_get_price_decimal_separator();
167 167
 
168 168
 		// Localize strings & variables for JS.
169
-		wp_localize_script( 'give-admin-scripts', 'give_vars', array(
170
-			'post_id'                           => isset( $post->ID ) ? $post->ID : null,
169
+		wp_localize_script('give-admin-scripts', 'give_vars', array(
170
+			'post_id'                           => isset($post->ID) ? $post->ID : null,
171 171
 			'give_version'                      => GIVE_VERSION,
172 172
 			'thousands_separator'               => $thousand_separator,
173 173
 			'decimal_separator'                 => $decimal_separator,
174
-			'quick_edit_warning'                => __( 'Not available for variable priced forms.', 'give' ),
175
-			'delete_payment'                    => __( 'Are you sure you want to <strong>permanently</strong> delete this donation?', 'give' ),
176
-			'delete_payment_note'               => __( 'Are you sure you want to delete this note?', 'give' ),
177
-			'revoke_api_key'                    => __( 'Are you sure you want to revoke this API key?', 'give' ),
178
-			'regenerate_api_key'                => __( 'Are you sure you want to regenerate this API key?', 'give' ),
179
-			'resend_receipt'                    => __( 'Are you sure you want to resend the donation receipt?', 'give' ),
180
-			'disconnect_user'                   => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ),
181
-			'one_option'                        => __( 'Choose a form', 'give' ),
182
-			'one_or_more_option'                => __( 'Choose one or more forms', 'give' ),
183
-			'currency_sign'                     => give_currency_filter( '' ),
184
-			'currency_pos'                      => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
174
+			'quick_edit_warning'                => __('Not available for variable priced forms.', 'give'),
175
+			'delete_payment'                    => __('Are you sure you want to <strong>permanently</strong> delete this donation?', 'give'),
176
+			'delete_payment_note'               => __('Are you sure you want to delete this note?', 'give'),
177
+			'revoke_api_key'                    => __('Are you sure you want to revoke this API key?', 'give'),
178
+			'regenerate_api_key'                => __('Are you sure you want to regenerate this API key?', 'give'),
179
+			'resend_receipt'                    => __('Are you sure you want to resend the donation receipt?', 'give'),
180
+			'disconnect_user'                   => __('Are you sure you want to disconnect the user from this donor?', 'give'),
181
+			'one_option'                        => __('Choose a form', 'give'),
182
+			'one_or_more_option'                => __('Choose one or more forms', 'give'),
183
+			'currency_sign'                     => give_currency_filter(''),
184
+			'currency_pos'                      => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
185 185
 			'currency_decimals'                 => give_get_price_decimals(),
186
-			'ok'                                => __( 'Ok', 'give' ),
187
-			'cancel'                            => __( 'Cancel', 'give' ),
188
-			'close'                             => __( 'Close', 'give' ),
189
-			'confirm'                           => __( 'Confirm', 'give' ),
190
-			'confirm_action'                    => __( 'Confirm Action', 'give' ),
191
-			'confirm_deletion'                  => __( 'Confirm Deletion', 'give' ),
192
-			'confirm_delete_donation'           => __( 'Confirm Delete Donation', 'give' ),
193
-			'confirm_resend'                    => __( 'Confirm re-send', 'give' ),
194
-			'confirm_bulk_action'               => __( 'Confirm bulk action', 'give' ),
195
-			'restart_upgrade'                   => __( 'Do you want to restart the update process?', 'give' ),
196
-			'restart_update'                    => __( 'It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ),
197
-			'stop_upgrade'                      => __( 'Do you want to stop the update process now?', 'give' ),
198
-			'import_failed'                     => __( 'Import failed', 'give' ),
199
-			'flush_success'                     => __( 'Flush success', 'give' ),
200
-			'flush_error'                       => __( 'Flush error', 'give' ),
201
-			'no_form_selected'                  => __( 'No form selected', 'give' ),
202
-			'batch_export_no_class'             => __( 'You must choose a method.', 'give' ),
203
-			'batch_export_no_reqs'              => __( 'Required fields not completed.', 'give' ),
204
-			'reset_stats_warn'                  => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
205
-			'delete_test_donor'                 => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ),
206
-			'delete_import_donor'               => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ),
207
-			'price_format_guide'                => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ),
186
+			'ok'                                => __('Ok', 'give'),
187
+			'cancel'                            => __('Cancel', 'give'),
188
+			'close'                             => __('Close', 'give'),
189
+			'confirm'                           => __('Confirm', 'give'),
190
+			'confirm_action'                    => __('Confirm Action', 'give'),
191
+			'confirm_deletion'                  => __('Confirm Deletion', 'give'),
192
+			'confirm_delete_donation'           => __('Confirm Delete Donation', 'give'),
193
+			'confirm_resend'                    => __('Confirm re-send', 'give'),
194
+			'confirm_bulk_action'               => __('Confirm bulk action', 'give'),
195
+			'restart_upgrade'                   => __('Do you want to restart the update process?', 'give'),
196
+			'restart_update'                    => __('It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give'),
197
+			'stop_upgrade'                      => __('Do you want to stop the update process now?', 'give'),
198
+			'import_failed'                     => __('Import failed', 'give'),
199
+			'flush_success'                     => __('Flush success', 'give'),
200
+			'flush_error'                       => __('Flush error', 'give'),
201
+			'no_form_selected'                  => __('No form selected', 'give'),
202
+			'batch_export_no_class'             => __('You must choose a method.', 'give'),
203
+			'batch_export_no_reqs'              => __('Required fields not completed.', 'give'),
204
+			'reset_stats_warn'                  => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'),
205
+			'delete_test_donor'                 => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'),
206
+			'delete_import_donor'               => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'),
207
+			'price_format_guide'                => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator),
208 208
 			/* translators : %s: Donation form options metabox */
209
-			'confirm_before_remove_row_text'    => __( 'Do you want to delete this item?', 'give' ),
210
-			'matched_success_failure_page'      => __( 'You cannot set the success and failed pages to the same page', 'give' ),
211
-			'dismiss_notice_text'               => __( 'Dismiss this notice.', 'give' ),
212
-			'search_placeholder'                => __( 'Type to search all forms', 'give' ),
213
-			'search_placeholder_donor'          => __( 'Type to search all donors', 'give' ),
214
-			'search_placeholder_country'        => __( 'Type to search all countries', 'give' ),
215
-			'search_placeholder_state'          => __( 'Type to search all states/provinces', 'give' ),
216
-			'unlock_donor_fields_title'         => __( 'Action forbidden', 'give' ),
217
-			'unlock_donor_fields_message'               => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ),
218
-			'remove_from_bulk_delete'           => __( 'Remove from Bulk Delete', 'give' ),
209
+			'confirm_before_remove_row_text'    => __('Do you want to delete this item?', 'give'),
210
+			'matched_success_failure_page'      => __('You cannot set the success and failed pages to the same page', 'give'),
211
+			'dismiss_notice_text'               => __('Dismiss this notice.', 'give'),
212
+			'search_placeholder'                => __('Type to search all forms', 'give'),
213
+			'search_placeholder_donor'          => __('Type to search all donors', 'give'),
214
+			'search_placeholder_country'        => __('Type to search all countries', 'give'),
215
+			'search_placeholder_state'          => __('Type to search all states/provinces', 'give'),
216
+			'unlock_donor_fields_title'         => __('Action forbidden', 'give'),
217
+			'unlock_donor_fields_message'               => __('To edit first name and last name, please go to user profile of the donor.', 'give'),
218
+			'remove_from_bulk_delete'           => __('Remove from Bulk Delete', 'give'),
219 219
 			'donors_bulk_action'                => array(
220 220
 				'no_donor_selected'  => array(
221
-					'title' => __( 'No donors selected', 'give' ),
222
-					'desc'  => __( 'You must choose at least one or more donors to delete.', 'give' )
221
+					'title' => __('No donors selected', 'give'),
222
+					'desc'  => __('You must choose at least one or more donors to delete.', 'give')
223 223
 				),
224 224
 				'no_action_selected' => array(
225
-					'title' => __( 'No action selected', 'give' ),
226
-					'desc'  => __( 'You must select a bulk action to proceed.', 'give' ),
225
+					'title' => __('No action selected', 'give'),
226
+					'desc'  => __('You must select a bulk action to proceed.', 'give'),
227 227
 				),
228 228
 			),
229 229
 			'donations_bulk_action'             => array(
230 230
 				'titles'         => array(
231
-					'zero' => __( 'No payments selected', 'give' ),
231
+					'zero' => __('No payments selected', 'give'),
232 232
 				),
233 233
 				'delete'         => array(
234
-					'zero'     => __( 'You must choose at least one or more donations to delete.', 'give' ),
235
-					'single'   => __( 'Are you sure you want to permanently delete this donation?', 'give' ),
236
-					'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ),
234
+					'zero'     => __('You must choose at least one or more donations to delete.', 'give'),
235
+					'single'   => __('Are you sure you want to permanently delete this donation?', 'give'),
236
+					'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'),
237 237
 				),
238 238
 				'resend-receipt' => array(
239
-					'zero'     => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ),
240
-					'single'   => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ),
241
-					'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ),
239
+					'zero'     => __('You must choose at least one or more recipients to resend the email receipt.', 'give'),
240
+					'single'   => __('Are you sure you want to resend the email receipt to this recipient?', 'give'),
241
+					'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'),
242 242
 				),
243 243
 				'set-to-status'  => array(
244
-					'zero'     => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ),
245
-					'single'   => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ),
246
-					'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ),
244
+					'zero'     => __('You must choose at least one or more donations to set status to {status}.', 'give'),
245
+					'single'   => __('Are you sure you want to set status of this donation to {status}?', 'give'),
246
+					'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'),
247 247
 				),
248 248
 			),
249 249
 			'updates'                           => array(
250
-				'ajax_error' => __( 'Please reload this page and try again', 'give' ),
250
+				'ajax_error' => __('Please reload this page and try again', 'give'),
251 251
 			),
252 252
 			'metabox_fields'                    => array(
253 253
 				'media' => array(
254
-					'button_title' => __( 'Choose Image', 'give' ),
254
+					'button_title' => __('Choose Image', 'give'),
255 255
 				),
256 256
 				'file'  => array(
257
-					'button_title' => __( 'Choose File', 'give' ),
257
+					'button_title' => __('Choose File', 'give'),
258 258
 				),
259 259
 			),
260 260
 			'chosen'                            => array(
261
-				'no_results_msg'  => __( 'No results match {search_term}', 'give' ),
262
-				'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ),
261
+				'no_results_msg'  => __('No results match {search_term}', 'give'),
262
+				'ajax_search_msg' => __('Searching results for match {search_term}', 'give'),
263 263
 			),
264
-			'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ),
265
-			'db_update_confirmation_msg'        => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ),
266
-			'error_message'                     => __( 'Something went wrong kindly try again!', 'give' ),
264
+			'db_update_confirmation_msg_button' => __('Run Updates', 'give'),
265
+			'db_update_confirmation_msg'        => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'),
266
+			'error_message'                     => __('Something went wrong kindly try again!', 'give'),
267 267
 			'give_donation_import'              => 'give_donation_import',
268 268
 			'core_settings_import'              => 'give_core_settings_import',
269
-			'setting_not_save_message'          => __( 'Changes you made may not be saved.', 'give' ),
269
+			'setting_not_save_message'          => __('Changes you made may not be saved.', 'give'),
270 270
 			'give_donation_amounts'             => array(
271
-				'minimum' => apply_filters( 'give_donation_minimum_limit', 1 ),
272
-				'maximum' => apply_filters( 'give_donation_maximum_limit', 999999.99 ),
271
+				'minimum' => apply_filters('give_donation_minimum_limit', 1),
272
+				'maximum' => apply_filters('give_donation_maximum_limit', 999999.99),
273 273
 			),
274
-		) );
274
+		));
275 275
 	}
276 276
 
277 277
 	/**
@@ -282,10 +282,10 @@  discard block
 block discarded – undo
282 282
 		<style type="text/css" media="screen">
283 283
 			@font-face {
284 284
 				font-family: 'give-icomoon';
285
-				src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?ngjl88'; ?>');
286
-				src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
287
-				url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
288
-				url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
285
+				src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?ngjl88'; ?>');
286
+				src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
287
+				url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
288
+				url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
289 289
 				font-weight: normal;
290 290
 				font-style: normal;
291 291
 			}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 * @since 2.1.0
309 309
 	 */
310 310
 	public function public_enqueue_styles() {
311
-		wp_enqueue_style( 'give-styles' );
311
+		wp_enqueue_style('give-styles');
312 312
 	}
313 313
 
314 314
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * @since 2.1.0
319 319
 	 */
320 320
 	public function public_enqueue_scripts() {
321
-		wp_enqueue_script( 'give' );
321
+		wp_enqueue_script('give');
322 322
 
323 323
 		$this->public_localize_scripts();
324 324
 	}
@@ -337,22 +337,22 @@  discard block
 block discarded – undo
337 337
 		 *
338 338
 		 * @return  string $message Send notice message for email access.
339 339
 		 */
340
-		$message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) );
340
+		$message = (string) apply_filters('give_email_access_mail_send_notice', __('Please check your email and click on the link to access your complete donation history.', 'give'));
341 341
 
342
-		$localize_give_vars = apply_filters( 'give_global_script_vars', array(
342
+		$localize_give_vars = apply_filters('give_global_script_vars', array(
343 343
 			'ajaxurl'                    => give_get_ajax_url(),
344
-			'checkout_nonce'             => wp_create_nonce( 'give_checkout_nonce' ),
344
+			'checkout_nonce'             => wp_create_nonce('give_checkout_nonce'),
345 345
 			// Do not use this nonce. Its deprecated.
346 346
 			'currency'                   => give_get_currency(),
347
-			'currency_sign'              => give_currency_filter( '' ),
347
+			'currency_sign'              => give_currency_filter(''),
348 348
 			'currency_pos'               => give_get_currency_position(),
349 349
 			'thousands_separator'        => give_get_price_thousand_separator(),
350 350
 			'decimal_separator'          => give_get_price_decimal_separator(),
351
-			'no_gateway'                 => __( 'Please select a payment method.', 'give' ),
352
-			'bad_minimum'                => __( 'The minimum custom donation amount for this form is', 'give' ),
353
-			'bad_maximum'                => __( 'The maximum custom donation amount for this form is', 'give' ),
354
-			'general_loading'            => __( 'Loading...', 'give' ),
355
-			'purchase_loading'           => __( 'Please Wait...', 'give' ),
351
+			'no_gateway'                 => __('Please select a payment method.', 'give'),
352
+			'bad_minimum'                => __('The minimum custom donation amount for this form is', 'give'),
353
+			'bad_maximum'                => __('The maximum custom donation amount for this form is', 'give'),
354
+			'general_loading'            => __('Loading...', 'give'),
355
+			'purchase_loading'           => __('Please Wait...', 'give'),
356 356
 			'number_decimals'            => give_get_price_decimals(),
357 357
 			'give_version'               => GIVE_VERSION,
358 358
 			'magnific_options'           => apply_filters(
@@ -366,30 +366,30 @@  discard block
 block discarded – undo
366 366
 				'give_form_translation_js',
367 367
 				array(
368 368
 					// Field name               Validation message.
369
-					'payment-mode'           => __( 'Please select payment mode.', 'give' ),
370
-					'give_first'             => __( 'Please enter your first name.', 'give' ),
371
-					'give_email'             => __( 'Please enter a valid email address.', 'give' ),
372
-					'give_user_login'        => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ),
373
-					'give_user_pass'         => __( 'Enter a password.', 'give' ),
374
-					'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ),
375
-					'give_agree_to_terms'    => __( 'You must agree to the terms and conditions.', 'give' ),
369
+					'payment-mode'           => __('Please select payment mode.', 'give'),
370
+					'give_first'             => __('Please enter your first name.', 'give'),
371
+					'give_email'             => __('Please enter a valid email address.', 'give'),
372
+					'give_user_login'        => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'),
373
+					'give_user_pass'         => __('Enter a password.', 'give'),
374
+					'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'),
375
+					'give_agree_to_terms'    => __('You must agree to the terms and conditions.', 'give'),
376 376
 				)
377 377
 			),
378 378
 			'confirm_email_sent_message' => $message,
379
-			'ajax_vars'                  => apply_filters( 'give_global_ajax_vars', array(
379
+			'ajax_vars'                  => apply_filters('give_global_ajax_vars', array(
380 380
 				'ajaxurl'         => give_get_ajax_url(),
381
-				'ajaxNonce'       => wp_create_nonce( 'give_ajax_nonce' ),
382
-				'loading'         => __( 'Loading', 'give' ),
381
+				'ajaxNonce'       => wp_create_nonce('give_ajax_nonce'),
382
+				'loading'         => __('Loading', 'give'),
383 383
 				// General loading message.
384
-				'select_option'   => __( 'Please select an option', 'give' ),
384
+				'select_option'   => __('Please select an option', 'give'),
385 385
 				// Variable pricing error with multi-donation option enabled.
386
-				'default_gateway' => give_get_default_gateway( null ),
387
-				'permalinks'      => get_option( 'permalink_structure' ) ? '1' : '0',
386
+				'default_gateway' => give_get_default_gateway(null),
387
+				'permalinks'      => get_option('permalink_structure') ? '1' : '0',
388 388
 				'number_decimals' => give_get_price_decimals(),
389
-			) ),
390
-		) );
389
+			)),
390
+		));
391 391
 
392
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_vars );
392
+		wp_localize_script('give', 'give_global_vars', $localize_give_vars);
393 393
 
394 394
 	}
395 395
 
@@ -403,15 +403,15 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	public function get_frontend_stylesheet_uri() {
405 405
 
406
-		$file          = 'give' . $this->direction . '.css';
406
+		$file          = 'give'.$this->direction.'.css';
407 407
 		$templates_dir = give_get_theme_template_dir_name();
408 408
 
409 409
 		// Directory paths to CSS files to support checking via file_exists().
410
-		$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
411
-		$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $this->direction . '.css';
412
-		$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
413
-		$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $this->direction . '.css';
414
-		$give_plugin_style_sheet    = trailingslashit( GIVE_PLUGIN_DIR ) . 'assets/dist/css/' . $file;
410
+		$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
411
+		$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$this->direction.'.css';
412
+		$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
413
+		$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$this->direction.'.css';
414
+		$give_plugin_style_sheet    = trailingslashit(GIVE_PLUGIN_DIR).'assets/dist/css/'.$file;
415 415
 		$uri                        = false;
416 416
 
417 417
 		/**
@@ -422,23 +422,23 @@  discard block
 block discarded – undo
422 422
 		 * c. followed by non minified version, even if SCRIPT_DEBUG is not enabled. This allows users to copy just give.css to their theme.
423 423
 		 * d. Finally, fallback to the standard Give version. This is the default styles included within the plugin.
424 424
 		 */
425
-		if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
426
-			if ( ! empty( $nonmin ) ) {
427
-				$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css';
425
+		if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
426
+			if ( ! empty($nonmin)) {
427
+				$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$this->direction.'.css';
428 428
 			} else {
429
-				$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
429
+				$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
430 430
 			}
431
-		} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
432
-			if ( ! empty( $nonmin ) ) {
433
-				$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css';
431
+		} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
432
+			if ( ! empty($nonmin)) {
433
+				$uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$this->direction.'.css';
434 434
 			} else {
435
-				$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
435
+				$uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
436 436
 			}
437
-		} elseif ( file_exists( $give_plugin_style_sheet ) ) {
438
-			$uri = trailingslashit( GIVE_PLUGIN_URL ) . 'assets/dist/css/' . $file;
437
+		} elseif (file_exists($give_plugin_style_sheet)) {
438
+			$uri = trailingslashit(GIVE_PLUGIN_URL).'assets/dist/css/'.$file;
439 439
 		}
440 440
 
441
-		return apply_filters( 'give_get_stylesheet_uri', $uri );
441
+		return apply_filters('give_get_stylesheet_uri', $uri);
442 442
 
443 443
 	}
444 444
 
@@ -450,19 +450,19 @@  discard block
 block discarded – undo
450 450
 		// Enqueue the bundled block JS file
451 451
 		wp_enqueue_script(
452 452
 			'give-blocks-js',
453
-			GIVE_PLUGIN_URL . 'assets/dist/js/gutenberg.js',
454
-			array( 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api' ),
453
+			GIVE_PLUGIN_URL.'assets/dist/js/gutenberg.js',
454
+			array('wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api'),
455 455
 			GIVE_VERSION
456 456
 		);
457 457
 
458 458
 		// Enqueue public styles
459
-		wp_enqueue_style( 'give-styles' );
459
+		wp_enqueue_style('give-styles');
460 460
 
461 461
 		// Enqueue the bundled block css file
462 462
 		wp_enqueue_style(
463 463
 			'give-blocks-css',
464
-			GIVE_PLUGIN_URL . 'assets/dist/css/gutenberg.css',
465
-			array( 'wp-blocks' ),
464
+			GIVE_PLUGIN_URL.'assets/dist/css/gutenberg.css',
465
+			array('wp-blocks'),
466 466
 			GIVE_VERSION
467 467
 		);
468 468
 
Please login to merge, or discard this patch.
includes/class-give-license-handler.php 1 patch
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! class_exists( 'Give_License' ) ) :
17
+if ( ! class_exists('Give_License')) :
18 18
 
19 19
 	/**
20 20
 	 * Give_License Class
@@ -153,31 +153,31 @@  discard block
 block discarded – undo
153 153
 		 * @param string $_checkout_url
154 154
 		 * @param string $_account_url
155 155
 		 */
156
-		public function __construct( $_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null, $_checkout_url = null, $_account_url = null ) {
156
+		public function __construct($_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null, $_checkout_url = null, $_account_url = null) {
157 157
 
158 158
 			$give_options = give_get_settings();
159 159
 
160 160
 			$this->file             = $_file;
161 161
 			$this->item_name        = $_item_name;
162
-			$this->item_shortname   = self::get_short_name( $this->item_name );
162
+			$this->item_shortname   = self::get_short_name($this->item_name);
163 163
 			$this->version          = $_version;
164
-			$this->license          = isset( $give_options[ $this->item_shortname . '_license_key' ] ) ? trim( $give_options[ $this->item_shortname . '_license_key' ] ) : '';
165
-			$this->license_data     = __give_get_active_license_info( $this->item_shortname );
164
+			$this->license          = isset($give_options[$this->item_shortname.'_license_key']) ? trim($give_options[$this->item_shortname.'_license_key']) : '';
165
+			$this->license_data     = __give_get_active_license_info($this->item_shortname);
166 166
 			$this->author           = $_author;
167
-			$this->api_url          = is_null( $_api_url ) ? $this->api_url : $_api_url;
168
-			$this->checkout_url     = is_null( $_checkout_url ) ? $this->checkout_url : $_checkout_url;
169
-			$this->account_url      = is_null( $_account_url ) ? $this->account_url : $_account_url;
167
+			$this->api_url          = is_null($_api_url) ? $this->api_url : $_api_url;
168
+			$this->checkout_url     = is_null($_checkout_url) ? $this->checkout_url : $_checkout_url;
169
+			$this->account_url      = is_null($_account_url) ? $this->account_url : $_account_url;
170 170
 			$this->auto_updater_obj = null;
171 171
 
172 172
 			// Add Setting for Give Add-on activation status.
173
-			$is_addon_activated = get_option( 'give_is_addon_activated' );
174
-			if ( ! $is_addon_activated && is_object( $this ) ) {
175
-				update_option( 'give_is_addon_activated', true );
176
-				Give_Cache::set( 'give_cache_hide_license_notice_after_activation', true, DAY_IN_SECONDS );
173
+			$is_addon_activated = get_option('give_is_addon_activated');
174
+			if ( ! $is_addon_activated && is_object($this)) {
175
+				update_option('give_is_addon_activated', true);
176
+				Give_Cache::set('give_cache_hide_license_notice_after_activation', true, DAY_IN_SECONDS);
177 177
 			}
178 178
 
179 179
 			// Add plugin to registered licenses list.
180
-			array_push( self::$licensed_addons, plugin_basename( $this->file ) );
180
+			array_push(self::$licensed_addons, plugin_basename($this->file));
181 181
 
182 182
 			// Setup hooks
183 183
 			$this->includes();
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 		 *
197 197
 		 * @return string
198 198
 		 */
199
-		public static function get_short_name( $plugin_name ) {
200
-			$plugin_name = trim( str_replace( 'Give - ', '', $plugin_name ) );
201
-			$plugin_name = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) );
199
+		public static function get_short_name($plugin_name) {
200
+			$plugin_name = trim(str_replace('Give - ', '', $plugin_name));
201
+			$plugin_name = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name)));
202 202
 
203 203
 			return $plugin_name;
204 204
 		}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		 */
216 216
 		private function includes() {
217 217
 
218
-			if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
218
+			if ( ! class_exists('EDD_SL_Plugin_Updater')) {
219 219
 				require_once 'admin/EDD_SL_Plugin_Updater.php';
220 220
 			}
221 221
 		}
@@ -233,30 +233,30 @@  discard block
 block discarded – undo
233 233
 		private function hooks() {
234 234
 
235 235
 			// Register settings.
236
-			add_filter( 'give_settings_licenses', array( $this, 'settings' ), 1 );
236
+			add_filter('give_settings_licenses', array($this, 'settings'), 1);
237 237
 
238 238
 			// Activate license key on settings save.
239
-			add_action( 'admin_init', array( $this, 'activate_license' ), 10 );
239
+			add_action('admin_init', array($this, 'activate_license'), 10);
240 240
 
241 241
 			// Deactivate license key.
242
-			add_action( 'admin_init', array( $this, 'deactivate_license' ), 11 );
242
+			add_action('admin_init', array($this, 'deactivate_license'), 11);
243 243
 
244 244
 			// Updater.
245
-			add_action( 'admin_init', array( $this, 'auto_updater' ), 0 );
246
-			add_action( 'admin_notices', array( $this, 'notices' ) );
245
+			add_action('admin_init', array($this, 'auto_updater'), 0);
246
+			add_action('admin_notices', array($this, 'notices'));
247 247
 
248 248
 			// Check license weekly.
249
-			Give_Cron::add_weekly_event( array( $this, 'weekly_license_check' ) );
250
-			add_action( 'give_validate_license_when_site_migrated', array( $this, 'weekly_license_check' ) );
249
+			Give_Cron::add_weekly_event(array($this, 'weekly_license_check'));
250
+			add_action('give_validate_license_when_site_migrated', array($this, 'weekly_license_check'));
251 251
 
252 252
 			// Check subscription weekly.
253
-			Give_Cron::add_weekly_event( array( $this, 'weekly_subscription_check' ) );
254
-			add_action( 'give_validate_license_when_site_migrated', array( $this, 'weekly_subscription_check' ) );
253
+			Give_Cron::add_weekly_event(array($this, 'weekly_subscription_check'));
254
+			add_action('give_validate_license_when_site_migrated', array($this, 'weekly_subscription_check'));
255 255
 
256 256
 			// Show addon notice on plugin page.
257
-			$plugin_name = explode( 'plugins/', $this->file );
258
-			$plugin_name = end( $plugin_name );
259
-			add_action( "after_plugin_row_{$plugin_name}", array( $this, 'plugin_page_notices' ), 10, 3 );
257
+			$plugin_name = explode('plugins/', $this->file);
258
+			$plugin_name = end($plugin_name);
259
+			add_action("after_plugin_row_{$plugin_name}", array($this, 'plugin_page_notices'), 10, 3);
260 260
 
261 261
 		}
262 262
 
@@ -296,16 +296,16 @@  discard block
 block discarded – undo
296 296
 		 *
297 297
 		 * @return array           License settings.
298 298
 		 */
299
-		public function settings( $settings ) {
299
+		public function settings($settings) {
300 300
 
301 301
 			$give_license_settings = array(
302 302
 				array(
303 303
 					'name'    => $this->item_name,
304
-					'id'      => $this->item_shortname . '_license_key',
304
+					'id'      => $this->item_shortname.'_license_key',
305 305
 					'desc'    => '',
306 306
 					'type'    => 'license_key',
307 307
 					'options' => array(
308
-						'license'      => get_option( $this->item_shortname . '_license_active' ),
308
+						'license'      => get_option($this->item_shortname.'_license_active'),
309 309
 						'shortname'    => $this->item_shortname,
310 310
 						'item_name'    => $this->item_name,
311 311
 						'api_url'      => $this->api_url,
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 				),
317 317
 			);
318 318
 
319
-			return array_merge( $settings, $give_license_settings );
319
+			return array_merge($settings, $give_license_settings);
320 320
 		}
321 321
 
322 322
 		/**
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
 		 *
332 332
 		 * @return array           License settings content.
333 333
 		 */
334
-		public function license_settings_content( $settings ) {
334
+		public function license_settings_content($settings) {
335 335
 
336 336
 			$give_license_settings = array(
337 337
 				array(
338
-					'name' => __( 'Add-on Licenses', 'give' ),
338
+					'name' => __('Add-on Licenses', 'give'),
339 339
 					'desc' => '<hr>',
340 340
 					'type' => 'give_title',
341 341
 					'id'   => 'give_title',
342 342
 				),
343 343
 			);
344 344
 
345
-			return array_merge( $settings, $give_license_settings );
345
+			return array_merge($settings, $give_license_settings);
346 346
 		}
347 347
 
348 348
 		/**
@@ -357,62 +357,62 @@  discard block
 block discarded – undo
357 357
 		 */
358 358
 		public function activate_license() {
359 359
 			// Bailout.
360
-			if ( ! $this->__is_user_can_edit_license() ) {
360
+			if ( ! $this->__is_user_can_edit_license()) {
361 361
 				return;
362 362
 			}
363 363
 
364 364
 			// Allow third party addon developers to handle license activation.
365
-			if ( $this->__is_third_party_addon() ) {
366
-				do_action( 'give_activate_license', $this );
365
+			if ($this->__is_third_party_addon()) {
366
+				do_action('give_activate_license', $this);
367 367
 
368 368
 				return;
369 369
 			}
370 370
 
371 371
 			// Delete previous license setting if a empty license key submitted.
372
-			if ( empty( $_POST["{$this->item_shortname}_license_key"] ) ) {
372
+			if (empty($_POST["{$this->item_shortname}_license_key"])) {
373 373
 				$this->unset_license();
374 374
 
375 375
 				return;
376 376
 			}
377 377
 
378 378
 			// Do not simultaneously activate add-ons if the user want to deactivate a specific add-on.
379
-			if( $this->is_deactivating_license() ) {
379
+			if ($this->is_deactivating_license()) {
380 380
 				return;
381 381
 			}
382 382
 
383 383
 			// Check if plugin previously installed.
384
-			if ( $this->is_valid_license() ) {
384
+			if ($this->is_valid_license()) {
385 385
 				return;
386 386
 			}
387 387
 
388 388
 			// Get license key.
389
-			$this->license = sanitize_text_field( $_POST[ $this->item_shortname . '_license_key' ] );
389
+			$this->license = sanitize_text_field($_POST[$this->item_shortname.'_license_key']);
390 390
 
391 391
 			// Delete previous license key from subscription if previously added.
392 392
 			$this->__remove_license_key_from_subscriptions();
393 393
 
394 394
 			// Make sure there are no api errors.
395
-			if ( ! ( $license_data = $this->get_license_info( 'activate_license' ) ) ) {
395
+			if ( ! ($license_data = $this->get_license_info('activate_license'))) {
396 396
 				return;
397 397
 			}
398 398
 
399 399
 			// Make sure license is valid.
400 400
 			// return because admin will want to activate license again.
401
-			if ( ! $this->is_license( $license_data ) ) {
401
+			if ( ! $this->is_license($license_data)) {
402 402
 				// Add license key.
403
-				give_update_option( "{$this->item_shortname}_license_key", $this->license );
403
+				give_update_option("{$this->item_shortname}_license_key", $this->license);
404 404
 
405 405
 				return;
406 406
 			}
407 407
 
408 408
 			// Tell WordPress to look for updates.
409
-			set_site_transient( 'update_plugins', null );
409
+			set_site_transient('update_plugins', null);
410 410
 
411 411
 			// Add license data.
412
-			update_option( "{$this->item_shortname}_license_active", $license_data );
412
+			update_option("{$this->item_shortname}_license_active", $license_data);
413 413
 
414 414
 			// Add license key.
415
-			give_update_option( "{$this->item_shortname}_license_key", $this->license );
415
+			give_update_option("{$this->item_shortname}_license_key", $this->license);
416 416
 
417 417
 			// Check subscription for license key and store this to db (if any).
418 418
 			$this->__single_subscription_check();
@@ -430,19 +430,19 @@  discard block
 block discarded – undo
430 430
 		 */
431 431
 		public function deactivate_license() {
432 432
 			// Bailout.
433
-			if ( ! $this->__is_user_can_edit_license() ) {
433
+			if ( ! $this->__is_user_can_edit_license()) {
434 434
 				return;
435 435
 			}
436 436
 
437 437
 			// Allow third party add-on developers to handle license deactivation.
438
-			if ( $this->__is_third_party_addon() ) {
439
-				do_action( 'give_deactivate_license', $this );
438
+			if ($this->__is_third_party_addon()) {
439
+				do_action('give_deactivate_license', $this);
440 440
 
441 441
 				return;
442 442
 			}
443 443
 
444 444
 			// Run on deactivate button press.
445
-			if ( isset( $_POST[ $this->item_shortname . '_license_key_deactivate' ] ) ) {
445
+			if (isset($_POST[$this->item_shortname.'_license_key_deactivate'])) {
446 446
 				$this->unset_license();
447 447
 			}
448 448
 		}
@@ -458,30 +458,30 @@  discard block
 block discarded – undo
458 458
 		public function weekly_license_check() {
459 459
 
460 460
 			if (
461
-				! empty( $_POST['give_settings'] ) ||
462
-				empty( $this->license )
461
+				! empty($_POST['give_settings']) ||
462
+				empty($this->license)
463 463
 			) {
464 464
 				return;
465 465
 			}
466 466
 
467 467
 			// Allow third party add-on developers to handle their license check.
468
-			if ( $this->__is_third_party_addon() ) {
469
-				do_action( 'give_weekly_license_check', $this );
468
+			if ($this->__is_third_party_addon()) {
469
+				do_action('give_weekly_license_check', $this);
470 470
 
471 471
 				return;
472 472
 			}
473 473
 
474 474
 			// Make sure there are no api errors.
475
-			if ( ! ( $license_data = $this->get_license_info( 'check_license' ) ) ) {
475
+			if ( ! ($license_data = $this->get_license_info('check_license'))) {
476 476
 				return;
477 477
 			}
478 478
 
479 479
 			// Bailout.
480
-			if ( ! $this->is_license( $license_data ) ) {
480
+			if ( ! $this->is_license($license_data)) {
481 481
 				return;
482 482
 			}
483 483
 
484
-			update_option( $this->item_shortname . '_license_active', $license_data );
484
+			update_option($this->item_shortname.'_license_active', $license_data);
485 485
 
486 486
 			return;
487 487
 		}
@@ -497,21 +497,21 @@  discard block
 block discarded – undo
497 497
 		public function weekly_subscription_check() {
498 498
 			// Bailout.
499 499
 			if (
500
-				! empty( $_POST['give_settings'] ) ||
501
-				empty( $this->license )
500
+				! empty($_POST['give_settings']) ||
501
+				empty($this->license)
502 502
 			) {
503 503
 				return;
504 504
 			}
505 505
 
506 506
 			// Remove old subscription data.
507
-			if ( absint( get_option( '_give_subscriptions_edit_last', true ) ) < current_time( 'timestamp', 1 ) ) {
508
-				delete_option( 'give_subscriptions' );
509
-				update_option( '_give_subscriptions_edit_last', strtotime( '+ 1 day', current_time( 'timestamp', 1 ) ) );
507
+			if (absint(get_option('_give_subscriptions_edit_last', true)) < current_time('timestamp', 1)) {
508
+				delete_option('give_subscriptions');
509
+				update_option('_give_subscriptions_edit_last', strtotime('+ 1 day', current_time('timestamp', 1)));
510 510
 			}
511 511
 
512 512
 			// Allow third party add-on developers to handle their subscription check.
513
-			if ( $this->__is_third_party_addon() ) {
514
-				do_action( 'give_weekly_subscription_check', $this );
513
+			if ($this->__is_third_party_addon()) {
514
+				do_action('give_weekly_subscription_check', $this);
515 515
 
516 516
 				return;
517 517
 			}
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 		 * @return void
529 529
 		 */
530 530
 		private function __single_subscription_check() {
531
-			if ( empty( $this->license ) ) {
531
+			if (empty($this->license)) {
532 532
 				return;
533 533
 			}
534 534
 
@@ -539,26 +539,26 @@  discard block
 block discarded – undo
539 539
 			 * By default edd software licensing api does not have api to check subscription.
540 540
 			 * This is a custom feature to check subscriptions.
541 541
 			 */
542
-			$subscription_data = $this->get_license_info( 'check_subscription', true );
542
+			$subscription_data = $this->get_license_info('check_subscription', true);
543 543
 
544
-			if ( ! empty( $subscription_data['success'] ) && absint( $subscription_data['success'] ) ) {
544
+			if ( ! empty($subscription_data['success']) && absint($subscription_data['success'])) {
545 545
 
546
-				$subscriptions = get_option( 'give_subscriptions', array() );
546
+				$subscriptions = get_option('give_subscriptions', array());
547 547
 
548 548
 				// Update subscription data only if subscription does not exist already.
549
-				$subscriptions[ $subscription_data['id'] ] = $subscription_data;
549
+				$subscriptions[$subscription_data['id']] = $subscription_data;
550 550
 
551 551
 				// Initiate default set of license for subscription.
552
-				if ( ! isset( $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) {
553
-					$subscriptions[ $subscription_data['id'] ]['licenses'] = array();
552
+				if ( ! isset($subscriptions[$subscription_data['id']]['licenses'])) {
553
+					$subscriptions[$subscription_data['id']]['licenses'] = array();
554 554
 				}
555 555
 
556 556
 				// Store licenses for subscription.
557
-				if ( ! in_array( $this->license, $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) {
558
-					$subscriptions[ $subscription_data['id'] ]['licenses'][] = $this->license;
557
+				if ( ! in_array($this->license, $subscriptions[$subscription_data['id']]['licenses'])) {
558
+					$subscriptions[$subscription_data['id']]['licenses'][] = $this->license;
559 559
 				}
560 560
 
561
-				update_option( 'give_subscriptions', $subscriptions );
561
+				update_option('give_subscriptions', $subscriptions);
562 562
 			}
563 563
 		}
564 564
 
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 		 */
573 573
 		public function notices() {
574 574
 
575
-			if ( ! current_user_can( 'manage_give_settings' ) ) {
575
+			if ( ! current_user_can('manage_give_settings')) {
576 576
 				return;
577 577
 			}
578 578
 
579 579
 			// Do not show licenses notices on license tab.
580
-			if ( 'licenses' === give_get_current_setting_tab() ) {
580
+			if ('licenses' === give_get_current_setting_tab()) {
581 581
 				return;
582 582
 			}
583 583
 
@@ -586,118 +586,118 @@  discard block
 block discarded – undo
586 586
 			static $addon_license_key_in_subscriptions;
587 587
 
588 588
 			// Set default value.
589
-			$addon_license_key_in_subscriptions = ! empty( $addon_license_key_in_subscriptions ) ? $addon_license_key_in_subscriptions : array();
589
+			$addon_license_key_in_subscriptions = ! empty($addon_license_key_in_subscriptions) ? $addon_license_key_in_subscriptions : array();
590 590
 			$messages                           = array();
591 591
 
592 592
 			// Check whether admin has Give Add-on activated since 24 hours?
593
-			$is_license_notice_hidden = Give_Cache::get( 'give_cache_hide_license_notice_after_activation' );
593
+			$is_license_notice_hidden = Give_Cache::get('give_cache_hide_license_notice_after_activation');
594 594
 
595 595
 			// Display Invalid License notice, if its more than 24 hours since first Give Add-on activation.
596 596
 			if (
597
-				empty( $this->license )
598
-				&& empty( $showed_invalid_message )
599
-				&& ( false === $is_license_notice_hidden )
597
+				empty($this->license)
598
+				&& empty($showed_invalid_message)
599
+				&& (false === $is_license_notice_hidden)
600 600
 			) {
601 601
 
602
-				Give()->notices->register_notice( array(
602
+				Give()->notices->register_notice(array(
603 603
 					'id'               => 'give-invalid-license',
604 604
 					'type'             => 'error',
605 605
 					'description'      => sprintf(
606
-						__( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ),
607
-						admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' )
606
+						__('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'),
607
+						admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')
608 608
 					),
609 609
 					'dismissible_type' => 'user',
610 610
 					'dismiss_interval' => 'shortly',
611
-				) );
611
+				));
612 612
 
613 613
 				$showed_invalid_message = true;
614 614
 
615 615
 			}
616 616
 
617 617
 			// Get subscriptions.
618
-			$subscriptions = get_option( 'give_subscriptions' );
618
+			$subscriptions = get_option('give_subscriptions');
619 619
 
620 620
 			// Show subscription messages.
621
-			if ( ! empty( $subscriptions ) && ! $showed_subscriptions_message ) {
621
+			if ( ! empty($subscriptions) && ! $showed_subscriptions_message) {
622 622
 
623
-				foreach ( $subscriptions as $subscription ) {
623
+				foreach ($subscriptions as $subscription) {
624 624
 					// Subscription expires timestamp.
625
-					$subscription_expires = strtotime( $subscription['expires'] );
625
+					$subscription_expires = strtotime($subscription['expires']);
626 626
 
627 627
 					// Start showing subscriptions message before one week of renewal date.
628
-					if ( strtotime( '- 7 days', $subscription_expires ) > current_time( 'timestamp', 1 ) ) {
628
+					if (strtotime('- 7 days', $subscription_expires) > current_time('timestamp', 1)) {
629 629
 						continue;
630 630
 					}
631 631
 
632 632
 					// Check if subscription message already exist in messages.
633
-					if ( array_key_exists( $subscription['id'], $messages ) ) {
633
+					if (array_key_exists($subscription['id'], $messages)) {
634 634
 						continue;
635 635
 					}
636 636
 
637 637
 					// Check if license already expired.
638
-					if ( strtotime( $subscription['expires'] ) < current_time( 'timestamp', 1 ) ) {
639
-						Give()->notices->register_notice( array(
638
+					if (strtotime($subscription['expires']) < current_time('timestamp', 1)) {
639
+						Give()->notices->register_notice(array(
640 640
 							'id'               => "give-expired-subscription-{$subscription['id']}",
641 641
 							'type'             => 'error',
642 642
 							'description'      => sprintf(
643
-								__( 'Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or %4$s.', 'give' ),
644
-								urldecode( $subscription['invoice_url'] ),
643
+								__('Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or %4$s.', 'give'),
644
+								urldecode($subscription['invoice_url']),
645 645
 								$subscription['payment_id'],
646 646
 								"{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired",
647
-								Give()->notices->get_dismiss_link( array(
648
-									'title'            => __( 'Click here if already renewed', 'give' ),
647
+								Give()->notices->get_dismiss_link(array(
648
+									'title'            => __('Click here if already renewed', 'give'),
649 649
 									'dismissible_type' => 'user',
650 650
 									'dismiss_interval' => 'permanent',
651
-								) )
651
+								))
652 652
 							),
653 653
 							'dismissible_type' => 'user',
654 654
 							'dismiss_interval' => 'shortly',
655
-						) );
655
+						));
656 656
 					} else {
657
-						Give()->notices->register_notice( array(
657
+						Give()->notices->register_notice(array(
658 658
 							'id'               => "give-expires-subscription-{$subscription['id']}",
659 659
 							'type'             => 'error',
660 660
 							'description'      => sprintf(
661
-								__( 'Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or %5$s.', 'give' ),
662
-								human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscription['expires'] ) ),
663
-								urldecode( $subscription['invoice_url'] ),
661
+								__('Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or %5$s.', 'give'),
662
+								human_time_diff(current_time('timestamp', 1), strtotime($subscription['expires'])),
663
+								urldecode($subscription['invoice_url']),
664 664
 								$subscription['payment_id'],
665 665
 								"{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired",
666
-								Give()->notices->get_dismiss_link( array(
667
-									'title'            => __( 'Click here if already renewed', 'give' ),
666
+								Give()->notices->get_dismiss_link(array(
667
+									'title'            => __('Click here if already renewed', 'give'),
668 668
 									'dismissible_type' => 'user',
669 669
 									'dismiss_interval' => 'permanent',
670
-								) )
670
+								))
671 671
 							),
672 672
 							'dismissible_type' => 'user',
673 673
 							'dismiss_interval' => 'shortly',
674
-						) );
674
+						));
675 675
 					}
676 676
 
677 677
 					// Stop validation for these license keys.
678
-					$addon_license_key_in_subscriptions = array_merge( $addon_license_key_in_subscriptions, $subscription['licenses'] );
678
+					$addon_license_key_in_subscriptions = array_merge($addon_license_key_in_subscriptions, $subscription['licenses']);
679 679
 				}// End foreach().
680 680
 				$showed_subscriptions_message = true;
681 681
 			}// End if().
682 682
 
683 683
 			// Show Non Subscription Give Add-on messages.
684 684
 			if (
685
-				! in_array( $this->license, $addon_license_key_in_subscriptions )
686
-				&& ! empty( $this->license )
687
-				&& empty( $showed_invalid_message )
685
+				! in_array($this->license, $addon_license_key_in_subscriptions)
686
+				&& ! empty($this->license)
687
+				&& empty($showed_invalid_message)
688 688
 				&& ! $this->is_valid_license()
689 689
 			) {
690 690
 
691
-				Give()->notices->register_notice( array(
691
+				Give()->notices->register_notice(array(
692 692
 					'id'               => 'give-invalid-license',
693 693
 					'type'             => 'error',
694 694
 					'description'      => sprintf(
695
-						__( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ),
696
-						admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' )
695
+						__('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'),
696
+						admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')
697 697
 					),
698 698
 					'dismissible_type' => 'user',
699 699
 					'dismiss_interval' => 'shortly',
700
-				) );
700
+				));
701 701
 
702 702
 				$showed_invalid_message = true;
703 703
 
@@ -714,10 +714,10 @@  discard block
 block discarded – undo
714 714
 		 *
715 715
 		 * @return bool
716 716
 		 */
717
-		public function is_valid_license( $licence_data = null ) {
718
-			$license_data = empty( $licence_data ) ? $this->license_data : $licence_data;
717
+		public function is_valid_license($licence_data = null) {
718
+			$license_data = empty($licence_data) ? $this->license_data : $licence_data;
719 719
 
720
-			if ( apply_filters( 'give_is_valid_license', ( $this->is_license( $license_data ) && 'valid' === $license_data->license ) ) ) {
720
+			if (apply_filters('give_is_valid_license', ($this->is_license($license_data) && 'valid' === $license_data->license))) {
721 721
 				return true;
722 722
 			}
723 723
 
@@ -735,10 +735,10 @@  discard block
 block discarded – undo
735 735
 		 *
736 736
 		 * @return bool
737 737
 		 */
738
-		public function is_license( $licence_data = null ) {
739
-			$license_data = empty( $licence_data ) ? $this->license_data : $licence_data;
738
+		public function is_license($licence_data = null) {
739
+			$license_data = empty($licence_data) ? $this->license_data : $licence_data;
740 740
 
741
-			if ( apply_filters( 'give_is_license', ( is_object( $license_data ) && ! empty( $license_data ) && property_exists( $license_data, 'license' ) ) ) ) {
741
+			if (apply_filters('give_is_license', (is_object($license_data) && ! empty($license_data) && property_exists($license_data, 'license')))) {
742 742
 				return true;
743 743
 			}
744 744
 
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 		 * @return bool
755 755
 		 */
756 756
 		private function __is_third_party_addon() {
757
-			return ( false === strpos( $this->api_url, 'givewp.com/' ) );
757
+			return (false === strpos($this->api_url, 'givewp.com/'));
758 758
 		}
759 759
 
760 760
 		/**
@@ -769,25 +769,25 @@  discard block
 block discarded – undo
769 769
 		 * @return bool
770 770
 		 */
771 771
 		private function __remove_license_key_from_subscriptions() {
772
-			$subscriptions = get_option( 'give_subscriptions', array() );
772
+			$subscriptions = get_option('give_subscriptions', array());
773 773
 
774 774
 			// Bailout.
775
-			if ( empty( $this->license ) ) {
775
+			if (empty($this->license)) {
776 776
 				return false;
777 777
 			}
778 778
 
779
-			if ( ! empty( $subscriptions ) ) {
780
-				foreach ( $subscriptions as $subscription_id => $subscription ) {
781
-					$license_index = array_search( $this->license, $subscription['licenses'] );
782
-					if ( false !== $license_index ) {
779
+			if ( ! empty($subscriptions)) {
780
+				foreach ($subscriptions as $subscription_id => $subscription) {
781
+					$license_index = array_search($this->license, $subscription['licenses']);
782
+					if (false !== $license_index) {
783 783
 						// Remove license key.
784
-						unset( $subscriptions[ $subscription_id ]['licenses'][ $license_index ] );
784
+						unset($subscriptions[$subscription_id]['licenses'][$license_index]);
785 785
 
786 786
 						// Rearrange license keys.
787
-						$subscriptions[ $subscription_id ]['licenses'] = array_values( $subscriptions[ $subscription_id ]['licenses'] );
787
+						$subscriptions[$subscription_id]['licenses'] = array_values($subscriptions[$subscription_id]['licenses']);
788 788
 
789 789
 						// Update subscription information.
790
-						update_option( 'give_subscriptions', $subscriptions );
790
+						update_option('give_subscriptions', $subscriptions);
791 791
 						break;
792 792
 					}
793 793
 				}
@@ -801,17 +801,17 @@  discard block
 block discarded – undo
801 801
 		 *
802 802
 		 * @return bool
803 803
 		 */
804
-		public function plugin_page_notices( $plugin_file, $plugin_data, $status ) {
804
+		public function plugin_page_notices($plugin_file, $plugin_data, $status) {
805 805
 			// Bailout.
806
-			if ( $this->is_valid_license() ) {
806
+			if ($this->is_valid_license()) {
807 807
 				return false;
808 808
 			}
809 809
 
810 810
 			$update_notice_wrap = '<tr class="give-addon-notice-tr active"><td colspan="3" class="colspanchange"><div class="notice inline notice-warning notice-alt give-invalid-license"><p><span class="dashicons dashicons-info"></span> %s</p></div></td></tr>';
811 811
 			$message            = $this->license_state_message();
812 812
 
813
-			if ( ! empty( $message['message'] ) ) {
814
-				echo sprintf( $update_notice_wrap, $message['message'] );
813
+			if ( ! empty($message['message'])) {
814
+				echo sprintf($update_notice_wrap, $message['message']);
815 815
 			}
816 816
 		}
817 817
 
@@ -826,11 +826,11 @@  discard block
 block discarded – undo
826 826
 		public function license_state_message() {
827 827
 			$message_data = array();
828 828
 
829
-			if ( ! $this->is_valid_license() ) {
829
+			if ( ! $this->is_valid_license()) {
830 830
 
831 831
 				$message_data['message'] = sprintf(
832 832
 					'Please <a href="%1$s">activate your license</a> to receive updates and support for the %2$s add-on.',
833
-					esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) ),
833
+					esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')),
834 834
 					$this->item_name
835 835
 				);
836 836
 			}
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 			// Bailout.
850 850
 			if (
851 851
 				! Give_Admin_Settings::verify_nonce() ||
852
-				! current_user_can( 'manage_give_settings' ) ||
852
+				! current_user_can('manage_give_settings') ||
853 853
 				'licenses' !== give_get_current_setting_tab()
854 854
 			) {
855 855
 				return false;
@@ -857,10 +857,10 @@  discard block
 block discarded – undo
857 857
 
858 858
 			// Security check.
859 859
 			if (
860
-				isset( $_POST[ $this->item_shortname . '_license_key-nonce' ] ) &&
861
-				! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' )
860
+				isset($_POST[$this->item_shortname.'_license_key-nonce']) &&
861
+				! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')
862 862
 			) {
863
-				wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
863
+				wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
864 864
 			}
865 865
 
866 866
 			return true;
@@ -878,9 +878,9 @@  discard block
 block discarded – undo
878 878
 		 *
879 879
 		 * @return mixed
880 880
 		 */
881
-		public function get_license_info( $edd_action = '', $response_in_array = false ) {
881
+		public function get_license_info($edd_action = '', $response_in_array = false) {
882 882
 
883
-			if ( empty( $edd_action ) ) {
883
+			if (empty($edd_action)) {
884 884
 				return false;
885 885
 			}
886 886
 
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 			$api_params = array(
889 889
 				'edd_action' => $edd_action, // never change from "edd_" to "give_"!
890 890
 				'license'    => $this->license,
891
-				'item_name'  => urlencode( $this->item_name ),
891
+				'item_name'  => urlencode($this->item_name),
892 892
 				'url'        => home_url(),
893 893
 			);
894 894
 
@@ -903,11 +903,11 @@  discard block
 block discarded – undo
903 903
 			);
904 904
 
905 905
 			// Make sure there are no errors.
906
-			if ( is_wp_error( $response ) ) {
906
+			if (is_wp_error($response)) {
907 907
 				return false;
908 908
 			}
909 909
 
910
-			return json_decode( wp_remote_retrieve_body( $response ), $response_in_array );
910
+			return json_decode(wp_remote_retrieve_body($response), $response_in_array);
911 911
 		}
912 912
 
913 913
 
@@ -923,9 +923,9 @@  discard block
 block discarded – undo
923 923
 			$this->__remove_license_key_from_subscriptions();
924 924
 
925 925
 			// Remove license from database.
926
-			delete_option( "{$this->item_shortname}_license_active" );
927
-			give_delete_option( "{$this->item_shortname}_license_key" );
928
-			unset( $_POST["{$this->item_shortname}_license_key"] );
926
+			delete_option("{$this->item_shortname}_license_active");
927
+			give_delete_option("{$this->item_shortname}_license_key");
928
+			unset($_POST["{$this->item_shortname}_license_key"]);
929 929
 
930 930
 			// Unset license param.
931 931
 			$this->license = '';
@@ -943,8 +943,8 @@  discard block
 block discarded – undo
943 943
 		private function is_deactivating_license() {
944 944
 			$status = false;
945 945
 
946
-			foreach ( $_POST as $key => $value ) {
947
-				if ( false !== strpos( $key, 'license_key_deactivate' ) ) {
946
+			foreach ($_POST as $key => $value) {
947
+				if (false !== strpos($key, 'license_key_deactivate')) {
948 948
 					$status = true;
949 949
 					break;
950 950
 				}
Please login to merge, or discard this patch.
includes/actions.php 1 patch
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_get_actions() {
27 27
 
28
-	$_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null;
28
+	$_get_action = ! empty($_GET['give_action']) ? $_GET['give_action'] : null;
29 29
 
30 30
 	// Add backward compatibility to give-action param ( $_GET )
31
-	if ( empty( $_get_action ) ) {
32
-		$_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null;
31
+	if (empty($_get_action)) {
32
+		$_get_action = ! empty($_GET['give-action']) ? $_GET['give-action'] : null;
33 33
 	}
34 34
 
35
-	if ( isset( $_get_action ) ) {
35
+	if (isset($_get_action)) {
36 36
 		/**
37 37
 		 * Fires in WordPress init or admin init, when give_action is present in $_GET.
38 38
 		 *
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 		 *
41 41
 		 * @param array $_GET Array of HTTP GET variables.
42 42
 		 */
43
-		do_action( "give_{$_get_action}", $_GET );
43
+		do_action("give_{$_get_action}", $_GET);
44 44
 	}
45 45
 
46 46
 }
47 47
 
48
-add_action( 'init', 'give_get_actions' );
48
+add_action('init', 'give_get_actions');
49 49
 
50 50
 /**
51 51
  * Hooks Give actions, when present in the $_POST super global. Every give_action
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
  */
59 59
 function give_post_actions() {
60 60
 
61
-	$_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null;
61
+	$_post_action = ! empty($_POST['give_action']) ? $_POST['give_action'] : null;
62 62
 
63 63
 	// Add backward compatibility to give-action param ( $_POST ).
64
-	if ( empty( $_post_action ) ) {
65
-		$_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null;
64
+	if (empty($_post_action)) {
65
+		$_post_action = ! empty($_POST['give-action']) ? $_POST['give-action'] : null;
66 66
 	}
67 67
 
68
-	if ( isset( $_post_action ) ) {
68
+	if (isset($_post_action)) {
69 69
 		/**
70 70
 		 * Fires in WordPress init or admin init, when give_action is present in $_POST.
71 71
 		 *
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 		 *
74 74
 		 * @param array $_POST Array of HTTP POST variables.
75 75
 		 */
76
-		do_action( "give_{$_post_action}", $_POST );
76
+		do_action("give_{$_post_action}", $_POST);
77 77
 	}
78 78
 
79 79
 }
80 80
 
81
-add_action( 'init', 'give_post_actions' );
81
+add_action('init', 'give_post_actions');
82 82
 
83 83
 /**
84 84
  * Connect WordPress user with Donor.
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
  *
91 91
  * @return void
92 92
  */
93
-function give_connect_donor_to_wpuser( $user_id, $user_data ) {
93
+function give_connect_donor_to_wpuser($user_id, $user_data) {
94 94
 	/* @var Give_Donor $donor */
95
-	$donor = new Give_Donor( $user_data['user_email'] );
95
+	$donor = new Give_Donor($user_data['user_email']);
96 96
 
97 97
 	// Validate donor id and check if do nor is already connect to wp user or not.
98
-	if ( $donor->id && ! $donor->user_id ) {
98
+	if ($donor->id && ! $donor->user_id) {
99 99
 
100 100
 		// Update donor user_id.
101
-		if ( $donor->update( array( 'user_id' => $user_id ) ) ) {
102
-			$donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id );
103
-			$donor->add_note( $donor_note );
101
+		if ($donor->update(array('user_id' => $user_id))) {
102
+			$donor_note = sprintf(esc_html__('WordPress user #%d is connected to #%d', 'give'), $user_id, $donor->id);
103
+			$donor->add_note($donor_note);
104 104
 
105 105
 			// Update user_id meta in payments.
106 106
 			// if( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 }
115 115
 
116
-add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 );
116
+add_action('give_insert_user', 'give_connect_donor_to_wpuser', 10, 2);
117 117
 
118 118
 
119 119
 /**
@@ -127,45 +127,45 @@  discard block
 block discarded – undo
127 127
  */
128 128
 function give_validate_license_when_site_migrated() {
129 129
 	// Store current site address if not already stored.
130
-	$home_url_parts              = parse_url( home_url() );
131
-	$home_url                    = isset( $home_url_parts['host'] ) ? $home_url_parts['host'] : false;
132
-	$home_url                    .= isset( $home_url_parts['path'] ) ? $home_url_parts['path'] : '';
133
-	$site_address_before_migrate = get_option( 'give_site_address_before_migrate' );
130
+	$home_url_parts              = parse_url(home_url());
131
+	$home_url                    = isset($home_url_parts['host']) ? $home_url_parts['host'] : false;
132
+	$home_url .= isset($home_url_parts['path']) ? $home_url_parts['path'] : '';
133
+	$site_address_before_migrate = get_option('give_site_address_before_migrate');
134 134
 
135 135
 	// Need $home_url to proceed.
136
-	if ( ! $home_url ) {
136
+	if ( ! $home_url) {
137 137
 		return;
138 138
 	}
139 139
 
140 140
 	// Save site address.
141
-	if ( ! $site_address_before_migrate ) {
141
+	if ( ! $site_address_before_migrate) {
142 142
 		// Update site address.
143
-		update_option( 'give_site_address_before_migrate', $home_url );
143
+		update_option('give_site_address_before_migrate', $home_url);
144 144
 
145 145
 		return;
146 146
 	}
147 147
 
148 148
 	// Backwards compat. for before when we were storing URL scheme.
149
-	if ( strpos( $site_address_before_migrate, 'http' ) ) {
150
-		$site_address_before_migrate = parse_url( $site_address_before_migrate );
151
-		$site_address_before_migrate = isset( $site_address_before_migrate['host'] ) ? $site_address_before_migrate['host'] : false;
149
+	if (strpos($site_address_before_migrate, 'http')) {
150
+		$site_address_before_migrate = parse_url($site_address_before_migrate);
151
+		$site_address_before_migrate = isset($site_address_before_migrate['host']) ? $site_address_before_migrate['host'] : false;
152 152
 
153 153
 		// Add path for multisite installs.
154
-		$site_address_before_migrate .= isset( $site_address_before_migrate['path'] ) ? $site_address_before_migrate['path'] : '';
154
+		$site_address_before_migrate .= isset($site_address_before_migrate['path']) ? $site_address_before_migrate['path'] : '';
155 155
 	}
156 156
 
157 157
 	// If the two URLs don't match run CRON.
158
-	if ( $home_url !== $site_address_before_migrate ) {
158
+	if ($home_url !== $site_address_before_migrate) {
159 159
 		// Immediately run cron.
160
-		wp_schedule_single_event( time(), 'give_validate_license_when_site_migrated' );
160
+		wp_schedule_single_event(time(), 'give_validate_license_when_site_migrated');
161 161
 
162 162
 		// Update site address.
163
-		update_option( 'give_site_address_before_migrate', $home_url );
163
+		update_option('give_site_address_before_migrate', $home_url);
164 164
 	}
165 165
 
166 166
 }
167 167
 
168
-add_action( 'admin_init', 'give_validate_license_when_site_migrated' );
168
+add_action('admin_init', 'give_validate_license_when_site_migrated');
169 169
 
170 170
 
171 171
 /**
@@ -175,19 +175,19 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @param $data
177 177
  */
178
-function give_donor_batch_export_complete( $data ) {
178
+function give_donor_batch_export_complete($data) {
179 179
 	// Remove donor ids cache.
180 180
 	if (
181
-		isset( $data['class'] )
181
+		isset($data['class'])
182 182
 		&& 'Give_Batch_Donors_Export' === $data['class']
183
-		&& ! empty( $data['forms'] )
184
-		&& isset( $data['give_export_option']['query_id'] )
183
+		&& ! empty($data['forms'])
184
+		&& isset($data['give_export_option']['query_id'])
185 185
 	) {
186
-		Give_Cache::delete( Give_Cache::get_key( $data['give_export_option']['query_id'] ) );
186
+		Give_Cache::delete(Give_Cache::get_key($data['give_export_option']['query_id']));
187 187
 	}
188 188
 }
189 189
 
190
-add_action( 'give_file_export_complete', 'give_donor_batch_export_complete' );
190
+add_action('give_file_export_complete', 'give_donor_batch_export_complete');
191 191
 
192 192
 /**
193 193
  * Print css for wordpress setting pages.
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 	/* @var WP_Screen $screen */
199 199
 	$screen = get_current_screen();
200 200
 
201
-	if ( ! ( $screen instanceof WP_Screen ) ) {
201
+	if ( ! ($screen instanceof WP_Screen)) {
202 202
 		return false;
203 203
 	}
204 204
 
205
-	switch ( true ) {
206
-		case ( 'plugins' === $screen->base || 'plugins-network' === $screen->base ):
205
+	switch (true) {
206
+		case ('plugins' === $screen->base || 'plugins-network' === $screen->base):
207 207
 			?>
208 208
 			<style>
209 209
 				tr.active.update + tr.give-addon-notice-tr td {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 }
242 242
 
243
-add_action( 'admin_head', 'give_admin_quick_css' );
243
+add_action('admin_head', 'give_admin_quick_css');
244 244
 
245 245
 
246 246
 /**
@@ -252,31 +252,31 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return void
254 254
  */
255
-function give_set_donation_levels_max_min_amount( $form_id ) {
255
+function give_set_donation_levels_max_min_amount($form_id) {
256 256
 	if (
257
-		( 'set' === $_POST['_give_price_option'] ) ||
258
-		( in_array( '_give_donation_levels', $_POST ) && count( $_POST['_give_donation_levels'] ) <= 0 ) ||
259
-		! ( $donation_levels_amounts = wp_list_pluck( $_POST['_give_donation_levels'], '_give_amount' ) )
257
+		('set' === $_POST['_give_price_option']) ||
258
+		(in_array('_give_donation_levels', $_POST) && count($_POST['_give_donation_levels']) <= 0) ||
259
+		! ($donation_levels_amounts = wp_list_pluck($_POST['_give_donation_levels'], '_give_amount'))
260 260
 	) {
261 261
 		// Delete old meta.
262
-		give_delete_meta( $form_id, '_give_levels_minimum_amount' );
263
-		give_delete_meta( $form_id, '_give_levels_maximum_amount' );
262
+		give_delete_meta($form_id, '_give_levels_minimum_amount');
263
+		give_delete_meta($form_id, '_give_levels_maximum_amount');
264 264
 
265 265
 		return;
266 266
 	}
267 267
 
268 268
 	// Sanitize donation level amounts.
269
-	$donation_levels_amounts = array_map( 'give_maybe_sanitize_amount', $donation_levels_amounts );
269
+	$donation_levels_amounts = array_map('give_maybe_sanitize_amount', $donation_levels_amounts);
270 270
 
271
-	$min_amount = min( $donation_levels_amounts );
272
-	$max_amount = max( $donation_levels_amounts );
271
+	$min_amount = min($donation_levels_amounts);
272
+	$max_amount = max($donation_levels_amounts);
273 273
 
274 274
 	// Set Minimum and Maximum amount for Multi Level Donation Forms.
275
-	give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db( $min_amount ) : 0 );
276
-	give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db( $max_amount ) : 0 );
275
+	give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db($min_amount) : 0);
276
+	give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db($max_amount) : 0);
277 277
 }
278 278
 
279
-add_action( 'give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30 );
279
+add_action('give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30);
280 280
 
281 281
 
282 282
 /**
@@ -286,23 +286,23 @@  discard block
 block discarded – undo
286 286
  *
287 287
  * @param int $payment_id
288 288
  */
289
-function _give_save_donor_billing_address( $payment_id ) {
290
-	$donor_id  = absint( give_get_payment_donor_id( $payment_id ));
289
+function _give_save_donor_billing_address($payment_id) {
290
+	$donor_id = absint(give_get_payment_donor_id($payment_id));
291 291
 
292 292
 	// Bailout
293
-	if ( ! $donor_id ) {
293
+	if ( ! $donor_id) {
294 294
 		return;
295 295
 	}
296 296
 
297 297
 
298 298
 	/* @var Give_Donor $donor */
299
-	$donor = new Give_Donor( $donor_id );
299
+	$donor = new Give_Donor($donor_id);
300 300
 
301 301
 	// Save address.
302
-	$donor->add_address( 'billing[]', give_get_donation_address( $payment_id ) );
302
+	$donor->add_address('billing[]', give_get_donation_address($payment_id));
303 303
 }
304 304
 
305
-add_action( 'give_complete_donation', '_give_save_donor_billing_address', 9999 );
305
+add_action('give_complete_donation', '_give_save_donor_billing_address', 9999);
306 306
 
307 307
 
308 308
 /**
@@ -312,26 +312,26 @@  discard block
 block discarded – undo
312 312
  *
313 313
  * @param array $args
314 314
  */
315
-function give_update_log_form_id( $args ) {
316
-	$new_form_id = absint( $args[0] );
317
-	$payment_id  = absint( $args[1] );
318
-	$logs        = Give()->logs->get_logs( $payment_id );
315
+function give_update_log_form_id($args) {
316
+	$new_form_id = absint($args[0]);
317
+	$payment_id  = absint($args[1]);
318
+	$logs        = Give()->logs->get_logs($payment_id);
319 319
 
320 320
 	// Bailout.
321
-	if ( empty( $logs ) ) {
321
+	if (empty($logs)) {
322 322
 		return;
323 323
 	}
324 324
 
325 325
 	/* @var object $log */
326
-	foreach ( $logs as $log ) {
327
-		Give()->logs->logmeta_db->update_meta( $log->ID, '_give_log_form_id', $new_form_id );
326
+	foreach ($logs as $log) {
327
+		Give()->logs->logmeta_db->update_meta($log->ID, '_give_log_form_id', $new_form_id);
328 328
 	}
329 329
 
330 330
 	// Delete cache.
331 331
 	Give()->logs->delete_cache();
332 332
 }
333 333
 
334
-add_action( 'give_update_log_form_id', 'give_update_log_form_id' );
334
+add_action('give_update_log_form_id', 'give_update_log_form_id');
335 335
 
336 336
 /**
337 337
  * Verify addon dependency before addon update
@@ -343,22 +343,22 @@  discard block
 block discarded – undo
343 343
  *
344 344
  * @return WP_Error
345 345
  */
346
-function __give_verify_addon_dependency_before_update( $error, $hook_extra ) {
346
+function __give_verify_addon_dependency_before_update($error, $hook_extra) {
347 347
 	// Bailout.
348
-	if ( is_wp_error( $error ) ) {
348
+	if (is_wp_error($error)) {
349 349
 		return $error;
350 350
 	}
351 351
 
352
-	$plugin_base    = strtolower( $hook_extra['plugin'] );
353
-	$licensed_addon = array_map( 'strtolower', Give_License::get_licensed_addons() );
352
+	$plugin_base    = strtolower($hook_extra['plugin']);
353
+	$licensed_addon = array_map('strtolower', Give_License::get_licensed_addons());
354 354
 
355 355
 	// Skip if not a Give addon.
356
-	if ( ! in_array( $plugin_base, $licensed_addon ) ) {
356
+	if ( ! in_array($plugin_base, $licensed_addon)) {
357 357
 		return $error;
358 358
 	}
359 359
 
360
-	$plugin_base = strtolower( $plugin_base );
361
-	$plugin_slug = str_replace( '.php', '', basename( $plugin_base ) );
360
+	$plugin_base = strtolower($plugin_base);
361
+	$plugin_slug = str_replace('.php', '', basename($plugin_base));
362 362
 
363 363
 	/**
364 364
 	 * Filter the addon readme.txt url
@@ -371,15 +371,15 @@  discard block
 block discarded – undo
371 371
 		$plugin_slug
372 372
 	);
373 373
 
374
-	$parser           = new Give_Readme_Parser( $url );
374
+	$parser           = new Give_Readme_Parser($url);
375 375
 	$give_min_version = $parser->requires_at_least();
376 376
 
377 377
 
378
-	if ( version_compare( GIVE_VERSION, $give_min_version, '<' ) ) {
378
+	if (version_compare(GIVE_VERSION, $give_min_version, '<')) {
379 379
 		return new WP_Error(
380 380
 			'Give_Addon_Update_Error',
381 381
 			sprintf(
382
-				__( 'Give version %s is required to update this add-on.', 'give' ),
382
+				__('Give version %s is required to update this add-on.', 'give'),
383 383
 				$give_min_version
384 384
 			)
385 385
 		);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	return $error;
389 389
 }
390 390
 
391
-add_filter( 'upgrader_pre_install', '__give_verify_addon_dependency_before_update', 10, 2 );
391
+add_filter('upgrader_pre_install', '__give_verify_addon_dependency_before_update', 10, 2);
392 392
 
393 393
 /**
394 394
  * Function to add suppress_filters param if WPML add-on is activated.
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
  *
400 400
  * @return array WP query argument for Total Goal.
401 401
  */
402
-function __give_wpml_total_goal_shortcode_agrs( $args ) {
402
+function __give_wpml_total_goal_shortcode_agrs($args) {
403 403
 	$args['suppress_filters'] = true;
404 404
 
405 405
 	return $args;
@@ -434,19 +434,19 @@  discard block
 block discarded – undo
434 434
  * @since 2.1.4
435 435
  */
436 436
 function give_add_support_for_wpml() {
437
-	if ( ! function_exists( 'is_plugin_active' ) ) {
438
-		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
437
+	if ( ! function_exists('is_plugin_active')) {
438
+		include_once(ABSPATH.'wp-admin/includes/plugin.php');
439 439
 	}
440 440
 
441 441
 
442
-	if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
442
+	if (is_plugin_active('sitepress-multilingual-cms/sitepress.php')) {
443 443
 
444
-		add_filter( 'give_totals_goal_shortcode_query_args', '__give_wpml_total_goal_shortcode_agrs' );
444
+		add_filter('give_totals_goal_shortcode_query_args', '__give_wpml_total_goal_shortcode_agrs');
445 445
 
446 446
 		// @see https://wpml.org/forums/topic/problem-with-query-filter-in-get_posts-function/#post-271309
447
-		add_action( 'give_totals_goal_shortcode_before_render', '__give_remove_wpml_parse_query_filter', 99 );
448
-		add_action( 'give_totals_goal_shortcode_after_render', '__give_add_wpml_parse_query_filter', 99 );
447
+		add_action('give_totals_goal_shortcode_before_render', '__give_remove_wpml_parse_query_filter', 99);
448
+		add_action('give_totals_goal_shortcode_after_render', '__give_add_wpml_parse_query_filter', 99);
449 449
 	}
450 450
 }
451 451
 
452
-add_action( 'give_init', 'give_add_support_for_wpml', 1000 );
452
+add_action('give_init', 'give_add_support_for_wpml', 1000);
Please login to merge, or discard this patch.
includes/class-give-readme-parser.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @license     https://opensource.org/licenses/gpl-license GNU Public License
9 9
  * @since       2.1.4
10 10
  */
11
-class Give_Readme_Parser{
11
+class Give_Readme_Parser {
12 12
 	/**
13 13
 	 * Readme file url
14 14
 	 *
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param string $file_url
34 34
 	 */
35
-	function __construct( $file_url ) {
35
+	function __construct($file_url) {
36 36
 		$this->file_url     = $file_url;
37
-		$this->file_content = wp_remote_retrieve_body( wp_remote_get( $this->file_url ) );
37
+		$this->file_content = wp_remote_retrieve_body(wp_remote_get($this->file_url));
38 38
 	}
39 39
 
40 40
 	/**
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function requires_at_least() {
49 49
 		// Regex to extract Give core minimum version from the readme.txt file.
50
-		preg_match('|Requires Give:(.*)|i', $this->file_content, $_requires_at_least );
50
+		preg_match('|Requires Give:(.*)|i', $this->file_content, $_requires_at_least);
51 51
 
52
-		if( is_array( $_requires_at_least ) && 1 < count( $_requires_at_least ) ) {
53
-			$_requires_at_least = trim( $_requires_at_least[1] );
54
-		}else{
52
+		if (is_array($_requires_at_least) && 1 < count($_requires_at_least)) {
53
+			$_requires_at_least = trim($_requires_at_least[1]);
54
+		} else {
55 55
 			$_requires_at_least = null;
56 56
 		}
57 57
 
Please login to merge, or discard this patch.
includes/api/class-give-api.php 1 patch
Spacing   +531 added lines, -531 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -141,27 +141,27 @@  discard block
 block discarded – undo
141 141
 			'v1' => 'GIVE_API_V1',
142 142
 		);
143 143
 
144
-		foreach ( $this->get_versions() as $version => $class ) {
145
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-' . $version . '.php';
144
+		foreach ($this->get_versions() as $version => $class) {
145
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-'.$version.'.php';
146 146
 		}
147 147
 
148
-		add_action( 'init', array( $this, 'add_endpoint' ) );
149
-		add_action( 'wp', array( $this, 'process_query' ), - 1 );
150
-		add_filter( 'query_vars', array( $this, 'query_vars' ) );
151
-		add_action( 'show_user_profile', array( $this, 'user_key_field' ) );
152
-		add_action( 'edit_user_profile', array( $this, 'user_key_field' ) );
153
-		add_action( 'personal_options_update', array( $this, 'generate_api_key' ) );
154
-		add_action( 'edit_user_profile_update', array( $this, 'generate_api_key' ) );
155
-		add_action( 'give_process_api_key', array( $this, 'process_api_key' ) );
148
+		add_action('init', array($this, 'add_endpoint'));
149
+		add_action('wp', array($this, 'process_query'), - 1);
150
+		add_filter('query_vars', array($this, 'query_vars'));
151
+		add_action('show_user_profile', array($this, 'user_key_field'));
152
+		add_action('edit_user_profile', array($this, 'user_key_field'));
153
+		add_action('personal_options_update', array($this, 'generate_api_key'));
154
+		add_action('edit_user_profile_update', array($this, 'generate_api_key'));
155
+		add_action('give_process_api_key', array($this, 'process_api_key'));
156 156
 
157 157
 		// Setup a backwards compatibility check for user API Keys
158
-		add_filter( 'get_user_metadata', array( $this, 'api_key_backwards_compat' ), 10, 4 );
158
+		add_filter('get_user_metadata', array($this, 'api_key_backwards_compat'), 10, 4);
159 159
 
160 160
 		// Determine if JSON_PRETTY_PRINT is available
161
-		$this->pretty_print = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
161
+		$this->pretty_print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : null;
162 162
 
163 163
 		// Allow API request logging to be turned off
164
-		$this->log_requests = apply_filters( 'give_api_log_requests', $this->log_requests );
164
+		$this->log_requests = apply_filters('give_api_log_requests', $this->log_requests);
165 165
 
166 166
 		// Setup Give_Payment_Stats instance
167 167
 		$this->stats = new Give_Payment_Stats();
@@ -179,17 +179,17 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @return mixed
181 181
 	 */
182
-	public function __call( $name, $arguments ) {
182
+	public function __call($name, $arguments) {
183 183
 		$deprecated_function_arr = array(
184 184
 			'get_customers',
185 185
 		);
186 186
 
187
-		if ( in_array( $name, $deprecated_function_arr, true ) ) {
188
-			switch ( $name ) {
187
+		if (in_array($name, $deprecated_function_arr, true)) {
188
+			switch ($name) {
189 189
 				case 'get_customers':
190
-					$args = ! empty( $arguments[0] ) ? $arguments[0] : array();
190
+					$args = ! empty($arguments[0]) ? $arguments[0] : array();
191 191
 
192
-					return $this->get_donors( $args );
192
+					return $this->get_donors($args);
193 193
 			}
194 194
 		}
195 195
 	}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @since  1.1
203 203
 	 */
204 204
 	public function add_endpoint() {
205
-		add_rewrite_endpoint( 'give-api', EP_ALL );
205
+		add_rewrite_endpoint('give-api', EP_ALL);
206 206
 	}
207 207
 
208 208
 	/**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @return string[] $vars New query vars
217 217
 	 */
218
-	public function query_vars( $vars ) {
218
+	public function query_vars($vars) {
219 219
 
220 220
 		$vars[] = 'token';
221 221
 		$vars[] = 'key';
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	public function get_default_version() {
268 268
 
269
-		$version = get_option( 'give_default_api_version' );
269
+		$version = get_option('give_default_api_version');
270 270
 
271
-		if ( defined( 'GIVE_API_VERSION' ) ) {
271
+		if (defined('GIVE_API_VERSION')) {
272 272
 			$version = GIVE_API_VERSION;
273
-		} elseif ( ! $version ) {
273
+		} elseif ( ! $version) {
274 274
 			$version = 'v1';
275 275
 		}
276 276
 
@@ -291,14 +291,14 @@  discard block
 block discarded – undo
291 291
 
292 292
 		$version = $wp_query->query_vars['give-api'];
293 293
 
294
-		if ( strpos( $version, '/' ) ) {
294
+		if (strpos($version, '/')) {
295 295
 
296
-			$version = explode( '/', $version );
297
-			$version = strtolower( $version[0] );
296
+			$version = explode('/', $version);
297
+			$version = strtolower($version[0]);
298 298
 
299
-			$wp_query->query_vars['give-api'] = str_replace( $version . '/', '', $wp_query->query_vars['give-api'] );
299
+			$wp_query->query_vars['give-api'] = str_replace($version.'/', '', $wp_query->query_vars['give-api']);
300 300
 
301
-			if ( array_key_exists( $version, $this->versions ) ) {
301
+			if (array_key_exists($version, $this->versions)) {
302 302
 
303 303
 				$this->queried_version = $version;
304 304
 
@@ -334,16 +334,16 @@  discard block
 block discarded – undo
334 334
 		$this->override = false;
335 335
 
336 336
 		// Make sure we have both user and api key
337
-		if ( ! empty( $wp_query->query_vars['give-api'] ) && ( $wp_query->query_vars['give-api'] !== 'forms' || ! empty( $wp_query->query_vars['token'] ) ) ) {
337
+		if ( ! empty($wp_query->query_vars['give-api']) && ($wp_query->query_vars['give-api'] !== 'forms' || ! empty($wp_query->query_vars['token']))) {
338 338
 
339
-			if ( empty( $wp_query->query_vars['token'] ) || empty( $wp_query->query_vars['key'] ) ) {
339
+			if (empty($wp_query->query_vars['token']) || empty($wp_query->query_vars['key'])) {
340 340
 				$this->missing_auth();
341 341
 
342 342
 				return false;
343 343
 			}
344 344
 
345 345
 			// Retrieve the user by public API key and ensure they exist
346
-			if ( ! ( $user = $this->get_user( $wp_query->query_vars['key'] ) ) ) {
346
+			if ( ! ($user = $this->get_user($wp_query->query_vars['key']))) {
347 347
 
348 348
 				$this->invalid_key();
349 349
 
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 
352 352
 			} else {
353 353
 
354
-				$token  = urldecode( $wp_query->query_vars['token'] );
355
-				$secret = $this->get_user_secret_key( $user );
356
-				$public = urldecode( $wp_query->query_vars['key'] );
354
+				$token  = urldecode($wp_query->query_vars['token']);
355
+				$secret = $this->get_user_secret_key($user);
356
+				$public = urldecode($wp_query->query_vars['key']);
357 357
 
358
-				if ( hash_equals( md5( $secret . $public ), $token ) ) {
358
+				if (hash_equals(md5($secret.$public), $token)) {
359 359
 					$this->is_valid_request = true;
360 360
 				} else {
361 361
 					$this->invalid_auth();
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
 				}
365 365
 
366 366
 			}
367
-		} elseif ( ! empty( $wp_query->query_vars['give-api'] ) && $wp_query->query_vars['give-api'] === 'forms' ) {
367
+		} elseif ( ! empty($wp_query->query_vars['give-api']) && $wp_query->query_vars['give-api'] === 'forms') {
368 368
 			$this->is_valid_request = true;
369
-			$wp_query->set( 'key', 'public' );
369
+			$wp_query->set('key', 'public');
370 370
 		}
371 371
 	}
372 372
 
@@ -382,25 +382,25 @@  discard block
 block discarded – undo
382 382
 	 *
383 383
 	 * @return bool if user ID is found, false otherwise
384 384
 	 */
385
-	public function get_user( $key = '' ) {
385
+	public function get_user($key = '') {
386 386
 		global $wpdb, $wp_query;
387 387
 
388
-		if ( empty( $key ) ) {
389
-			$key = urldecode( $wp_query->query_vars['key'] );
388
+		if (empty($key)) {
389
+			$key = urldecode($wp_query->query_vars['key']);
390 390
 		}
391 391
 
392
-		if ( empty( $key ) ) {
392
+		if (empty($key)) {
393 393
 			return false;
394 394
 		}
395 395
 
396
-		$user = Give_Cache::get( md5( 'give_api_user_' . $key ), true );
396
+		$user = Give_Cache::get(md5('give_api_user_'.$key), true);
397 397
 
398
-		if ( false === $user ) {
399
-			$user = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s LIMIT 1", $key ) );
400
-			Give_Cache::set( md5( 'give_api_user_' . $key ), $user, DAY_IN_SECONDS, true );
398
+		if (false === $user) {
399
+			$user = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s LIMIT 1", $key));
400
+			Give_Cache::set(md5('give_api_user_'.$key), $user, DAY_IN_SECONDS, true);
401 401
 		}
402 402
 
403
-		if ( $user != null ) {
403
+		if ($user != null) {
404 404
 			$this->user_id = $user;
405 405
 
406 406
 			return $user;
@@ -416,19 +416,19 @@  discard block
 block discarded – undo
416 416
 	 *
417 417
 	 * @return mixed|null|string
418 418
 	 */
419
-	public function get_user_public_key( $user_id = 0 ) {
419
+	public function get_user_public_key($user_id = 0) {
420 420
 		global $wpdb;
421 421
 
422
-		if ( empty( $user_id ) ) {
422
+		if (empty($user_id)) {
423 423
 			return '';
424 424
 		}
425 425
 
426
-		$cache_key       = md5( 'give_api_user_public_key' . $user_id );
427
-		$user_public_key = Give_Cache::get( $cache_key, true );
426
+		$cache_key       = md5('give_api_user_public_key'.$user_id);
427
+		$user_public_key = Give_Cache::get($cache_key, true);
428 428
 
429
-		if ( empty( $user_public_key ) ) {
430
-			$user_public_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_public_key' AND user_id = %d", $user_id ) );
431
-			Give_Cache::set( $cache_key, $user_public_key, HOUR_IN_SECONDS, true );
429
+		if (empty($user_public_key)) {
430
+			$user_public_key = $wpdb->get_var($wpdb->prepare("SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_public_key' AND user_id = %d", $user_id));
431
+			Give_Cache::set($cache_key, $user_public_key, HOUR_IN_SECONDS, true);
432 432
 		}
433 433
 
434 434
 		return $user_public_key;
@@ -441,19 +441,19 @@  discard block
 block discarded – undo
441 441
 	 *
442 442
 	 * @return mixed|null|string
443 443
 	 */
444
-	public function get_user_secret_key( $user_id = 0 ) {
444
+	public function get_user_secret_key($user_id = 0) {
445 445
 		global $wpdb;
446 446
 
447
-		if ( empty( $user_id ) ) {
447
+		if (empty($user_id)) {
448 448
 			return '';
449 449
 		}
450 450
 
451
-		$cache_key       = md5( 'give_api_user_secret_key' . $user_id );
452
-		$user_secret_key = Give_Cache::get( $cache_key, true );
451
+		$cache_key       = md5('give_api_user_secret_key'.$user_id);
452
+		$user_secret_key = Give_Cache::get($cache_key, true);
453 453
 
454
-		if ( empty( $user_secret_key ) ) {
455
-			$user_secret_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_secret_key' AND user_id = %d", $user_id ) );
456
-			Give_Cache::set( $cache_key, $user_secret_key, HOUR_IN_SECONDS, true );
454
+		if (empty($user_secret_key)) {
455
+			$user_secret_key = $wpdb->get_var($wpdb->prepare("SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_secret_key' AND user_id = %d", $user_id));
456
+			Give_Cache::set($cache_key, $user_secret_key, HOUR_IN_SECONDS, true);
457 457
 		}
458 458
 
459 459
 		return $user_secret_key;
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 	 */
470 470
 	private function missing_auth() {
471 471
 		$error          = array();
472
-		$error['error'] = __( 'You must specify both a token and API key.', 'give' );
472
+		$error['error'] = __('You must specify both a token and API key.', 'give');
473 473
 
474 474
 		$this->data = $error;
475
-		$this->output( 401 );
475
+		$this->output(401);
476 476
 	}
477 477
 
478 478
 	/**
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 	 */
487 487
 	private function invalid_auth() {
488 488
 		$error          = array();
489
-		$error['error'] = __( 'Your request could not be authenticated.', 'give' );
489
+		$error['error'] = __('Your request could not be authenticated.', 'give');
490 490
 
491 491
 		$this->data = $error;
492
-		$this->output( 403 );
492
+		$this->output(403);
493 493
 	}
494 494
 
495 495
 	/**
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
 	 */
504 504
 	private function invalid_key() {
505 505
 		$error          = array();
506
-		$error['error'] = __( 'Invalid API key.', 'give' );
506
+		$error['error'] = __('Invalid API key.', 'give');
507 507
 
508 508
 		$this->data = $error;
509
-		$this->output( 403 );
509
+		$this->output(403);
510 510
 	}
511 511
 
512 512
 	/**
@@ -519,10 +519,10 @@  discard block
 block discarded – undo
519 519
 	 */
520 520
 	private function invalid_version() {
521 521
 		$error          = array();
522
-		$error['error'] = __( 'Invalid API version.', 'give' );
522
+		$error['error'] = __('Invalid API version.', 'give');
523 523
 
524 524
 		$this->data = $error;
525
-		$this->output( 404 );
525
+		$this->output(404);
526 526
 	}
527 527
 
528 528
 	/**
@@ -538,10 +538,10 @@  discard block
 block discarded – undo
538 538
 		global $wp_query;
539 539
 
540 540
 		// Start logging how long the request takes for logging
541
-		$before = microtime( true );
541
+		$before = microtime(true);
542 542
 
543 543
 		// Check for give-api var. Get out if not present
544
-		if ( empty( $wp_query->query_vars['give-api'] ) ) {
544
+		if (empty($wp_query->query_vars['give-api'])) {
545 545
 			return;
546 546
 		}
547 547
 
@@ -555,45 +555,45 @@  discard block
 block discarded – undo
555 555
 		$this->validate_request();
556 556
 
557 557
 		// Only proceed if no errors have been noted
558
-		if ( ! $this->is_valid_request ) {
558
+		if ( ! $this->is_valid_request) {
559 559
 			return;
560 560
 		}
561 561
 
562
-		if ( ! defined( 'GIVE_DOING_API' ) ) {
563
-			define( 'GIVE_DOING_API', true );
562
+		if ( ! defined('GIVE_DOING_API')) {
563
+			define('GIVE_DOING_API', true);
564 564
 		}
565 565
 
566 566
 		$data         = array();
567 567
 		$this->routes = new $this->versions[$this->get_queried_version()];
568 568
 		$this->routes->validate_request();
569 569
 
570
-		switch ( $this->endpoint ) :
570
+		switch ($this->endpoint) :
571 571
 
572 572
 			case 'stats' :
573 573
 
574
-				$data = $this->routes->get_stats( array(
575
-					'type'      => isset( $wp_query->query_vars['type'] ) ? $wp_query->query_vars['type'] : null,
576
-					'form'      => isset( $wp_query->query_vars['form'] ) ? $wp_query->query_vars['form'] : null,
577
-					'date'      => isset( $wp_query->query_vars['date'] ) ? $wp_query->query_vars['date'] : null,
578
-					'startdate' => isset( $wp_query->query_vars['startdate'] ) ? $wp_query->query_vars['startdate'] : null,
579
-					'enddate'   => isset( $wp_query->query_vars['enddate'] ) ? $wp_query->query_vars['enddate'] : null,
580
-				) );
574
+				$data = $this->routes->get_stats(array(
575
+					'type'      => isset($wp_query->query_vars['type']) ? $wp_query->query_vars['type'] : null,
576
+					'form'      => isset($wp_query->query_vars['form']) ? $wp_query->query_vars['form'] : null,
577
+					'date'      => isset($wp_query->query_vars['date']) ? $wp_query->query_vars['date'] : null,
578
+					'startdate' => isset($wp_query->query_vars['startdate']) ? $wp_query->query_vars['startdate'] : null,
579
+					'enddate'   => isset($wp_query->query_vars['enddate']) ? $wp_query->query_vars['enddate'] : null,
580
+				));
581 581
 
582 582
 				break;
583 583
 
584 584
 			case 'forms' :
585 585
 
586
-				$form = isset( $wp_query->query_vars['form'] ) ? $wp_query->query_vars['form'] : null;
586
+				$form = isset($wp_query->query_vars['form']) ? $wp_query->query_vars['form'] : null;
587 587
 
588
-				$data = $this->routes->get_forms( $form );
588
+				$data = $this->routes->get_forms($form);
589 589
 
590 590
 				break;
591 591
 
592 592
 			case 'donors' :
593 593
 
594
-				$donor = isset( $wp_query->query_vars['donor'] ) ? $wp_query->query_vars['donor'] : null;
594
+				$donor = isset($wp_query->query_vars['donor']) ? $wp_query->query_vars['donor'] : null;
595 595
 
596
-				$data = $this->routes->get_donors( $donor );
596
+				$data = $this->routes->get_donors($donor);
597 597
 
598 598
 				break;
599 599
 
@@ -606,26 +606,26 @@  discard block
 block discarded – undo
606 606
 				 * @params date startdate | required when date = range and format to be YYYYMMDD (i.e. 20170524)
607 607
 				 * @params date enddate | required when date = range and format to be YYYYMMDD (i.e. 20170524)
608 608
 				 */
609
-				$data = $this->routes->get_recent_donations( array(
610
-					'id'        => isset( $wp_query->query_vars['id'] ) ? $wp_query->query_vars['id'] : null,
611
-					'date'      => isset( $wp_query->query_vars['date'] ) ? $wp_query->query_vars['date'] : null,
612
-					'startdate' => isset( $wp_query->query_vars['startdate'] ) ? $wp_query->query_vars['startdate'] : null,
613
-					'enddate'   => isset( $wp_query->query_vars['enddate'] ) ? $wp_query->query_vars['enddate'] : null,
614
-				) );
609
+				$data = $this->routes->get_recent_donations(array(
610
+					'id'        => isset($wp_query->query_vars['id']) ? $wp_query->query_vars['id'] : null,
611
+					'date'      => isset($wp_query->query_vars['date']) ? $wp_query->query_vars['date'] : null,
612
+					'startdate' => isset($wp_query->query_vars['startdate']) ? $wp_query->query_vars['startdate'] : null,
613
+					'enddate'   => isset($wp_query->query_vars['enddate']) ? $wp_query->query_vars['enddate'] : null,
614
+				));
615 615
 
616 616
 				break;
617 617
 
618 618
 		endswitch;
619 619
 
620 620
 		// Allow extensions to setup their own return data
621
-		$this->data = apply_filters( 'give_api_output_data', $data, $this->endpoint, $this );
621
+		$this->data = apply_filters('give_api_output_data', $data, $this->endpoint, $this);
622 622
 
623
-		$after                       = microtime( true );
624
-		$request_time                = ( $after - $before );
623
+		$after                       = microtime(true);
624
+		$request_time                = ($after - $before);
625 625
 		$this->data['request_speed'] = $request_time;
626 626
 
627 627
 		// Log this API request, if enabled. We log it here because we have access to errors.
628
-		$this->log_request( $this->data );
628
+		$this->log_request($this->data);
629 629
 
630 630
 		// Send out data to the output function
631 631
 		$this->output();
@@ -655,25 +655,25 @@  discard block
 block discarded – undo
655 655
 		global $wp_query;
656 656
 
657 657
 		// Whitelist our query options
658
-		$accepted = apply_filters( 'give_api_valid_query_modes', array(
658
+		$accepted = apply_filters('give_api_valid_query_modes', array(
659 659
 			'stats',
660 660
 			'forms',
661 661
 			'donors',
662 662
 			'donations',
663
-		) );
663
+		));
664 664
 
665
-		$query = isset( $wp_query->query_vars['give-api'] ) ? $wp_query->query_vars['give-api'] : null;
666
-		$query = str_replace( $this->queried_version . '/', '', $query );
665
+		$query = isset($wp_query->query_vars['give-api']) ? $wp_query->query_vars['give-api'] : null;
666
+		$query = str_replace($this->queried_version.'/', '', $query);
667 667
 
668 668
 		$error = array();
669 669
 
670 670
 		// Make sure our query is valid
671
-		if ( ! in_array( $query, $accepted ) ) {
672
-			$error['error'] = __( 'Invalid query.', 'give' );
671
+		if ( ! in_array($query, $accepted)) {
672
+			$error['error'] = __('Invalid query.', 'give');
673 673
 
674 674
 			$this->data = $error;
675 675
 			// 400 is Bad Request
676
-			$this->output( 400 );
676
+			$this->output(400);
677 677
 		}
678 678
 
679 679
 		$this->endpoint = $query;
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 	public function get_paged() {
691 691
 		global $wp_query;
692 692
 
693
-		return isset( $wp_query->query_vars['page'] ) ? $wp_query->query_vars['page'] : 1;
693
+		return isset($wp_query->query_vars['page']) ? $wp_query->query_vars['page'] : 1;
694 694
 	}
695 695
 
696 696
 
@@ -705,13 +705,13 @@  discard block
 block discarded – undo
705 705
 	public function per_page() {
706 706
 		global $wp_query;
707 707
 
708
-		$per_page = isset( $wp_query->query_vars['number'] ) ? $wp_query->query_vars['number'] : 10;
708
+		$per_page = isset($wp_query->query_vars['number']) ? $wp_query->query_vars['number'] : 10;
709 709
 
710
-		if ( $per_page < 0 && $this->get_query_mode() == 'donors' ) {
710
+		if ($per_page < 0 && $this->get_query_mode() == 'donors') {
711 711
 			$per_page = 99999999;
712 712
 		} // End if().
713 713
 
714
-		return apply_filters( 'give_api_results_per_page', $per_page );
714
+		return apply_filters('give_api_results_per_page', $per_page);
715 715
 	}
716 716
 
717 717
 	/**
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 	 *
725 725
 	 * @return array $dates
726 726
 	 */
727
-	public function get_dates( $args = array() ) {
727
+	public function get_dates($args = array()) {
728 728
 		$dates = array();
729 729
 
730 730
 		$defaults = array(
@@ -735,60 +735,60 @@  discard block
 block discarded – undo
735 735
 			'enddate'   => null,
736 736
 		);
737 737
 
738
-		$args = wp_parse_args( $args, $defaults );
738
+		$args = wp_parse_args($args, $defaults);
739 739
 
740
-		$current_time = current_time( 'timestamp' );
740
+		$current_time = current_time('timestamp');
741 741
 
742
-		if ( 'range' === $args['date'] ) {
743
-			$startdate          = strtotime( $args['startdate'] );
744
-			$enddate            = strtotime( $args['enddate'] );
745
-			$dates['day_start'] = date( 'd', $startdate );
746
-			$dates['day_end']   = date( 'd', $enddate );
747
-			$dates['m_start']   = date( 'n', $startdate );
748
-			$dates['m_end']     = date( 'n', $enddate );
749
-			$dates['year']      = date( 'Y', $startdate );
750
-			$dates['year_end']  = date( 'Y', $enddate );
742
+		if ('range' === $args['date']) {
743
+			$startdate          = strtotime($args['startdate']);
744
+			$enddate            = strtotime($args['enddate']);
745
+			$dates['day_start'] = date('d', $startdate);
746
+			$dates['day_end']   = date('d', $enddate);
747
+			$dates['m_start']   = date('n', $startdate);
748
+			$dates['m_end']     = date('n', $enddate);
749
+			$dates['year']      = date('Y', $startdate);
750
+			$dates['year_end']  = date('Y', $enddate);
751 751
 		} else {
752 752
 			// Modify dates based on predefined ranges
753
-			switch ( $args['date'] ) :
753
+			switch ($args['date']) :
754 754
 
755 755
 				case 'this_month' :
756 756
 					$dates['day']     = null;
757
-					$dates['m_start'] = date( 'n', $current_time );
758
-					$dates['m_end']   = date( 'n', $current_time );
759
-					$dates['year']    = date( 'Y', $current_time );
757
+					$dates['m_start'] = date('n', $current_time);
758
+					$dates['m_end']   = date('n', $current_time);
759
+					$dates['year']    = date('Y', $current_time);
760 760
 					break;
761 761
 
762 762
 				case 'last_month' :
763 763
 					$dates['day']     = null;
764
-					$dates['m_start'] = date( 'n', $current_time ) == 1 ? 12 : date( 'n', $current_time ) - 1;
764
+					$dates['m_start'] = date('n', $current_time) == 1 ? 12 : date('n', $current_time) - 1;
765 765
 					$dates['m_end']   = $dates['m_start'];
766
-					$dates['year']    = date( 'n', $current_time ) == 1 ? date( 'Y', $current_time ) - 1 : date( 'Y', $current_time );
766
+					$dates['year']    = date('n', $current_time) == 1 ? date('Y', $current_time) - 1 : date('Y', $current_time);
767 767
 					break;
768 768
 
769 769
 				case 'today' :
770
-					$dates['day']     = date( 'd', $current_time );
771
-					$dates['m_start'] = date( 'n', $current_time );
772
-					$dates['m_end']   = date( 'n', $current_time );
773
-					$dates['year']    = date( 'Y', $current_time );
770
+					$dates['day']     = date('d', $current_time);
771
+					$dates['m_start'] = date('n', $current_time);
772
+					$dates['m_end']   = date('n', $current_time);
773
+					$dates['year']    = date('Y', $current_time);
774 774
 					break;
775 775
 
776 776
 				case 'yesterday' :
777 777
 
778
-					$year  = date( 'Y', $current_time );
779
-					$month = date( 'n', $current_time );
780
-					$day   = date( 'd', $current_time );
778
+					$year  = date('Y', $current_time);
779
+					$month = date('n', $current_time);
780
+					$day   = date('d', $current_time);
781 781
 
782
-					if ( $month == 1 && $day == 1 ) {
782
+					if ($month == 1 && $day == 1) {
783 783
 
784
-						$year  -= 1;
784
+						$year -= 1;
785 785
 						$month = 12;
786
-						$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
786
+						$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
787 787
 
788
-					} elseif ( $month > 1 && $day == 1 ) {
788
+					} elseif ($month > 1 && $day == 1) {
789 789
 
790 790
 						$month -= 1;
791
-						$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
791
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
792 792
 
793 793
 					} else {
794 794
 
@@ -804,65 +804,65 @@  discard block
 block discarded – undo
804 804
 					break;
805 805
 
806 806
 				case 'this_quarter' :
807
-					$month_now = date( 'n', $current_time );
807
+					$month_now = date('n', $current_time);
808 808
 
809 809
 					$dates['day'] = null;
810 810
 
811
-					if ( $month_now <= 3 ) {
811
+					if ($month_now <= 3) {
812 812
 
813 813
 						$dates['m_start'] = 1;
814 814
 						$dates['m_end']   = 3;
815
-						$dates['year']    = date( 'Y', $current_time );
815
+						$dates['year']    = date('Y', $current_time);
816 816
 
817
-					} elseif ( $month_now <= 6 ) {
817
+					} elseif ($month_now <= 6) {
818 818
 
819 819
 						$dates['m_start'] = 4;
820 820
 						$dates['m_end']   = 6;
821
-						$dates['year']    = date( 'Y', $current_time );
821
+						$dates['year']    = date('Y', $current_time);
822 822
 
823
-					} elseif ( $month_now <= 9 ) {
823
+					} elseif ($month_now <= 9) {
824 824
 
825 825
 						$dates['m_start'] = 7;
826 826
 						$dates['m_end']   = 9;
827
-						$dates['year']    = date( 'Y', $current_time );
827
+						$dates['year']    = date('Y', $current_time);
828 828
 
829 829
 					} else {
830 830
 
831 831
 						$dates['m_start'] = 10;
832 832
 						$dates['m_end']   = 12;
833
-						$dates['year']    = date( 'Y', $current_time );
833
+						$dates['year']    = date('Y', $current_time);
834 834
 
835 835
 					}
836 836
 					break;
837 837
 
838 838
 				case 'last_quarter' :
839
-					$month_now = date( 'n', $current_time );
839
+					$month_now = date('n', $current_time);
840 840
 
841 841
 					$dates['day'] = null;
842 842
 
843
-					if ( $month_now <= 3 ) {
843
+					if ($month_now <= 3) {
844 844
 
845 845
 						$dates['m_start'] = 10;
846 846
 						$dates['m_end']   = 12;
847
-						$dates['year']    = date( 'Y', $current_time ) - 1; // Previous year
847
+						$dates['year']    = date('Y', $current_time) - 1; // Previous year
848 848
 
849
-					} elseif ( $month_now <= 6 ) {
849
+					} elseif ($month_now <= 6) {
850 850
 
851 851
 						$dates['m_start'] = 1;
852 852
 						$dates['m_end']   = 3;
853
-						$dates['year']    = date( 'Y', $current_time );
853
+						$dates['year']    = date('Y', $current_time);
854 854
 
855
-					} elseif ( $month_now <= 9 ) {
855
+					} elseif ($month_now <= 9) {
856 856
 
857 857
 						$dates['m_start'] = 4;
858 858
 						$dates['m_end']   = 6;
859
-						$dates['year']    = date( 'Y', $current_time );
859
+						$dates['year']    = date('Y', $current_time);
860 860
 
861 861
 					} else {
862 862
 
863 863
 						$dates['m_start'] = 7;
864 864
 						$dates['m_end']   = 9;
865
-						$dates['year']    = date( 'Y', $current_time );
865
+						$dates['year']    = date('Y', $current_time);
866 866
 
867 867
 					}
868 868
 					break;
@@ -871,14 +871,14 @@  discard block
 block discarded – undo
871 871
 					$dates['day']     = null;
872 872
 					$dates['m_start'] = null;
873 873
 					$dates['m_end']   = null;
874
-					$dates['year']    = date( 'Y', $current_time );
874
+					$dates['year']    = date('Y', $current_time);
875 875
 					break;
876 876
 
877 877
 				case 'last_year' :
878 878
 					$dates['day']     = null;
879 879
 					$dates['m_start'] = null;
880 880
 					$dates['m_end']   = null;
881
-					$dates['year']    = date( 'Y', $current_time ) - 1;
881
+					$dates['year']    = date('Y', $current_time) - 1;
882 882
 					break;
883 883
 
884 884
 			endswitch;
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 		 *
892 892
 		 * @param array $dates The dates used for retrieving earnings.
893 893
 		 */
894
-		return apply_filters( 'give_api_stat_dates', $dates );
894
+		return apply_filters('give_api_stat_dates', $dates);
895 895
 	}
896 896
 
897 897
 	/**
@@ -905,84 +905,84 @@  discard block
 block discarded – undo
905 905
 	 *
906 906
 	 * @return array $donors Multidimensional array of the donors.
907 907
 	 */
908
-	public function get_donors( $donor = null ) {
908
+	public function get_donors($donor = null) {
909 909
 
910 910
 		$donors = array();
911 911
 		$error  = array();
912
-		if ( ! user_can( $this->user_id, 'view_give_sensitive_data' ) && ! $this->override ) {
912
+		if ( ! user_can($this->user_id, 'view_give_sensitive_data') && ! $this->override) {
913 913
 			return $donors;
914 914
 		}
915 915
 
916 916
 		$paged    = $this->get_paged();
917 917
 		$per_page = $this->per_page();
918
-		$offset   = $per_page * ( $paged - 1 );
918
+		$offset   = $per_page * ($paged - 1);
919 919
 
920
-		if ( is_numeric( $donor ) ) {
920
+		if (is_numeric($donor)) {
921 921
 			$field = 'id';
922 922
 		} else {
923 923
 			$field = 'email';
924 924
 		}
925 925
 
926
-		$donor_query = Give()->donors->get_donors( array(
926
+		$donor_query = Give()->donors->get_donors(array(
927 927
 			'number' => $per_page,
928 928
 			'offset' => $offset,
929 929
 			$field   => $donor,
930
-		) );
930
+		));
931 931
 		$donor_count = 0;
932 932
 
933
-		if ( $donor_query ) {
933
+		if ($donor_query) {
934 934
 
935
-			foreach ( $donor_query as $donor_obj ) {
935
+			foreach ($donor_query as $donor_obj) {
936 936
 
937
-				$names      = explode( ' ', $donor_obj->name );
938
-				$first_name = ! empty( $names[0] ) ? $names[0] : '';
937
+				$names      = explode(' ', $donor_obj->name);
938
+				$first_name = ! empty($names[0]) ? $names[0] : '';
939 939
 				$last_name  = '';
940
-				if ( ! empty( $names[1] ) ) {
941
-					unset( $names[0] );
942
-					$last_name = implode( ' ', $names );
940
+				if ( ! empty($names[1])) {
941
+					unset($names[0]);
942
+					$last_name = implode(' ', $names);
943 943
 				}
944 944
 
945
-				$donors['donors'][ $donor_count ]['info']['user_id']      = '';
946
-				$donors['donors'][ $donor_count ]['info']['username']     = '';
947
-				$donors['donors'][ $donor_count ]['info']['display_name'] = '';
948
-				$donors['donors'][ $donor_count ]['info']['donor_id']     = $donor_obj->id;
949
-				$donors['donors'][ $donor_count ]['info']['first_name']   = $first_name;
950
-				$donors['donors'][ $donor_count ]['info']['last_name']    = $last_name;
951
-				$donors['donors'][ $donor_count ]['info']['email']        = $donor_obj->email;
945
+				$donors['donors'][$donor_count]['info']['user_id']      = '';
946
+				$donors['donors'][$donor_count]['info']['username']     = '';
947
+				$donors['donors'][$donor_count]['info']['display_name'] = '';
948
+				$donors['donors'][$donor_count]['info']['donor_id']     = $donor_obj->id;
949
+				$donors['donors'][$donor_count]['info']['first_name']   = $first_name;
950
+				$donors['donors'][$donor_count]['info']['last_name']    = $last_name;
951
+				$donors['donors'][$donor_count]['info']['email']        = $donor_obj->email;
952 952
 
953
-				if ( ! empty( $donor_obj->user_id ) ) {
953
+				if ( ! empty($donor_obj->user_id)) {
954 954
 
955
-					$user_data = get_userdata( $donor_obj->user_id );
955
+					$user_data = get_userdata($donor_obj->user_id);
956 956
 
957 957
 					// Donor with registered account.
958
-					$donors['donors'][ $donor_count ]['info']['user_id']      = $donor_obj->user_id;
959
-					$donors['donors'][ $donor_count ]['info']['username']     = $user_data->user_login;
960
-					$donors['donors'][ $donor_count ]['info']['display_name'] = $user_data->display_name;
958
+					$donors['donors'][$donor_count]['info']['user_id']      = $donor_obj->user_id;
959
+					$donors['donors'][$donor_count]['info']['username']     = $user_data->user_login;
960
+					$donors['donors'][$donor_count]['info']['display_name'] = $user_data->display_name;
961 961
 
962 962
 				}
963 963
 
964
-				$donors['donors'][ $donor_count ]['stats']['total_donations'] = $donor_obj->purchase_count;
965
-				$donors['donors'][ $donor_count ]['stats']['total_spent']     = $donor_obj->purchase_value;
964
+				$donors['donors'][$donor_count]['stats']['total_donations'] = $donor_obj->purchase_count;
965
+				$donors['donors'][$donor_count]['stats']['total_spent']     = $donor_obj->purchase_value;
966 966
 
967 967
 				/** @var $donor \Give_Donor */
968
-				$donor = new Give_Donor( $donor_obj->id );
968
+				$donor = new Give_Donor($donor_obj->id);
969 969
 
970 970
 				// Get donor's addresses.
971
-				$donors['donors'][ $donor_count ]['address'] = $donor->address;
971
+				$donors['donors'][$donor_count]['address'] = $donor->address;
972 972
 
973
-				$donor_count ++;
973
+				$donor_count++;
974 974
 
975 975
 			}
976
-		} elseif ( $donor ) {
976
+		} elseif ($donor) {
977 977
 
978 978
 			$error['error'] = sprintf( /* translators: %s: donor */
979
-				__( 'Donor %s not found.', 'give' ), $donor );
979
+				__('Donor %s not found.', 'give'), $donor );
980 980
 
981 981
 			return $error;
982 982
 
983 983
 		} else {
984 984
 
985
-			$error['error'] = __( 'No donors found.', 'give' );
985
+			$error['error'] = __('No donors found.', 'give');
986 986
 
987 987
 			return $error;
988 988
 
@@ -1001,37 +1001,37 @@  discard block
 block discarded – undo
1001 1001
 	 *
1002 1002
 	 * @return array $donors Multidimensional array of the forms.
1003 1003
 	 */
1004
-	public function get_forms( $form = null ) {
1004
+	public function get_forms($form = null) {
1005 1005
 
1006 1006
 		$forms = array();
1007 1007
 		$error = array();
1008 1008
 
1009
-		if ( $form == null ) {
1009
+		if ($form == null) {
1010 1010
 			$forms['forms'] = array();
1011 1011
 
1012
-			$form_list = get_posts( array(
1012
+			$form_list = get_posts(array(
1013 1013
 				'post_type'        => 'give_forms',
1014 1014
 				'posts_per_page'   => $this->per_page(),
1015 1015
 				'suppress_filters' => true,
1016 1016
 				'paged'            => $this->get_paged(),
1017
-			) );
1017
+			));
1018 1018
 
1019
-			if ( $form_list ) {
1019
+			if ($form_list) {
1020 1020
 				$i = 0;
1021
-				foreach ( $form_list as $form_info ) {
1022
-					$forms['forms'][ $i ] = $this->get_form_data( $form_info );
1023
-					$i ++;
1021
+				foreach ($form_list as $form_info) {
1022
+					$forms['forms'][$i] = $this->get_form_data($form_info);
1023
+					$i++;
1024 1024
 				}
1025 1025
 			}
1026 1026
 		} else {
1027
-			if ( get_post_type( $form ) == 'give_forms' ) {
1028
-				$form_info = get_post( $form );
1027
+			if (get_post_type($form) == 'give_forms') {
1028
+				$form_info = get_post($form);
1029 1029
 
1030
-				$forms['forms'][0] = $this->get_form_data( $form_info );
1030
+				$forms['forms'][0] = $this->get_form_data($form_info);
1031 1031
 
1032 1032
 			} else {
1033 1033
 				$error['error'] = sprintf( /* translators: %s: form */
1034
-					__( 'Form %s not found.', 'give' ), $form );
1034
+					__('Form %s not found.', 'give'), $form );
1035 1035
 
1036 1036
 				return $error;
1037 1037
 			}
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 	 *
1050 1050
 	 * @return array                Array of post data to return back in the API.
1051 1051
 	 */
1052
-	private function get_form_data( $form_info ) {
1052
+	private function get_form_data($form_info) {
1053 1053
 
1054 1054
 		$form = array();
1055 1055
 
@@ -1059,60 +1059,60 @@  discard block
 block discarded – undo
1059 1059
 		$form['info']['create_date']   = $form_info->post_date;
1060 1060
 		$form['info']['modified_date'] = $form_info->post_modified;
1061 1061
 		$form['info']['status']        = $form_info->post_status;
1062
-		$form['info']['link']          = html_entity_decode( $form_info->guid );
1063
-		$form['info']['content']       = give_get_meta( $form_info->ID, '_give_form_content', true );
1064
-		$form['info']['thumbnail']     = wp_get_attachment_url( get_post_thumbnail_id( $form_info->ID ) );
1062
+		$form['info']['link']          = html_entity_decode($form_info->guid);
1063
+		$form['info']['content']       = give_get_meta($form_info->ID, '_give_form_content', true);
1064
+		$form['info']['thumbnail']     = wp_get_attachment_url(get_post_thumbnail_id($form_info->ID));
1065 1065
 
1066
-		if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
1067
-			$form['info']['category'] = get_the_terms( $form_info, 'give_forms_category' );
1068
-			$form['info']['tags']     = get_the_terms( $form_info, 'give_forms_tag' );
1066
+		if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
1067
+			$form['info']['category'] = get_the_terms($form_info, 'give_forms_category');
1068
+			$form['info']['tags']     = get_the_terms($form_info, 'give_forms_tag');
1069 1069
 		}
1070
-		if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
1071
-			$form['info']['tags'] = get_the_terms( $form_info, 'give_forms_tag' );
1070
+		if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
1071
+			$form['info']['tags'] = get_the_terms($form_info, 'give_forms_tag');
1072 1072
 		}
1073 1073
 
1074 1074
 		// Check whether any goal is to be achieved for the donation form.
1075
-		$goal_option = give_get_meta( $form_info->ID, '_give_goal_option', true );
1076
-		$goal_amount = give_get_meta( $form_info->ID, '_give_set_goal', true );
1077
-		if ( give_is_setting_enabled( $goal_option ) && $goal_amount ) {
1078
-			$total_income                         = give_get_form_earnings_stats( $form_info->ID );
1079
-			$goal_percentage_completed            = ( $total_income < $goal_amount ) ? round( ( $total_income / $goal_amount ) * 100, 2 ) : 100;
1080
-			$form['goal']['amount']               = isset( $goal_amount ) ? $goal_amount : '';
1081
-			$form['goal']['percentage_completed'] = isset( $goal_percentage_completed ) ? $goal_percentage_completed : '';
1075
+		$goal_option = give_get_meta($form_info->ID, '_give_goal_option', true);
1076
+		$goal_amount = give_get_meta($form_info->ID, '_give_set_goal', true);
1077
+		if (give_is_setting_enabled($goal_option) && $goal_amount) {
1078
+			$total_income                         = give_get_form_earnings_stats($form_info->ID);
1079
+			$goal_percentage_completed            = ($total_income < $goal_amount) ? round(($total_income / $goal_amount) * 100, 2) : 100;
1080
+			$form['goal']['amount']               = isset($goal_amount) ? $goal_amount : '';
1081
+			$form['goal']['percentage_completed'] = isset($goal_percentage_completed) ? $goal_percentage_completed : '';
1082 1082
 		}
1083 1083
 
1084
-		if ( user_can( $this->user_id, 'view_give_reports' ) || $this->override ) {
1085
-			$form['stats']['total']['donations']           = give_get_form_sales_stats( $form_info->ID );
1086
-			$form['stats']['total']['earnings']            = give_get_form_earnings_stats( $form_info->ID );
1087
-			$form['stats']['monthly_average']['donations'] = give_get_average_monthly_form_sales( $form_info->ID );
1088
-			$form['stats']['monthly_average']['earnings']  = give_get_average_monthly_form_earnings( $form_info->ID );
1084
+		if (user_can($this->user_id, 'view_give_reports') || $this->override) {
1085
+			$form['stats']['total']['donations']           = give_get_form_sales_stats($form_info->ID);
1086
+			$form['stats']['total']['earnings']            = give_get_form_earnings_stats($form_info->ID);
1087
+			$form['stats']['monthly_average']['donations'] = give_get_average_monthly_form_sales($form_info->ID);
1088
+			$form['stats']['monthly_average']['earnings']  = give_get_average_monthly_form_earnings($form_info->ID);
1089 1089
 		}
1090 1090
 
1091 1091
 		$counter = 0;
1092
-		if ( give_has_variable_prices( $form_info->ID ) ) {
1093
-			foreach ( give_get_variable_prices( $form_info->ID ) as $price ) {
1094
-				$counter ++;
1092
+		if (give_has_variable_prices($form_info->ID)) {
1093
+			foreach (give_get_variable_prices($form_info->ID) as $price) {
1094
+				$counter++;
1095 1095
 				// multi-level item
1096
-				$level                                     = isset( $price['_give_text'] ) ? $price['_give_text'] : 'level-' . $counter;
1097
-				$form['pricing'][ sanitize_key( $level ) ] = $price['_give_amount'];
1096
+				$level                                     = isset($price['_give_text']) ? $price['_give_text'] : 'level-'.$counter;
1097
+				$form['pricing'][sanitize_key($level)] = $price['_give_amount'];
1098 1098
 
1099 1099
 			}
1100 1100
 		} else {
1101
-			$form['pricing']['amount'] = give_get_form_price( $form_info->ID );
1101
+			$form['pricing']['amount'] = give_get_form_price($form_info->ID);
1102 1102
 		}
1103 1103
 
1104
-		if ( user_can( $this->user_id, 'view_give_sensitive_data' ) || $this->override ) {
1104
+		if (user_can($this->user_id, 'view_give_sensitive_data') || $this->override) {
1105 1105
 
1106 1106
 			/**
1107 1107
 			 * Fires when generating API sensitive data.
1108 1108
 			 *
1109 1109
 			 * @since 1.1
1110 1110
 			 */
1111
-			do_action( 'give_api_sensitive_data' );
1111
+			do_action('give_api_sensitive_data');
1112 1112
 
1113 1113
 		}
1114 1114
 
1115
-		return apply_filters( 'give_api_forms_form', $form );
1115
+		return apply_filters('give_api_forms_form', $form);
1116 1116
 
1117 1117
 	}
1118 1118
 
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 	 *
1128 1128
 	 * @return array
1129 1129
 	 */
1130
-	public function get_stats( $args = array() ) {
1130
+	public function get_stats($args = array()) {
1131 1131
 		$defaults = array(
1132 1132
 			'type'      => null,
1133 1133
 			'form'      => null,
@@ -1136,9 +1136,9 @@  discard block
 block discarded – undo
1136 1136
 			'enddate'   => null,
1137 1137
 		);
1138 1138
 
1139
-		$args = wp_parse_args( $args, $defaults );
1139
+		$args = wp_parse_args($args, $defaults);
1140 1140
 
1141
-		$dates = $this->get_dates( $args );
1141
+		$dates = $this->get_dates($args);
1142 1142
 
1143 1143
 		$stats     = array();
1144 1144
 		$earnings  = array(
@@ -1149,40 +1149,40 @@  discard block
 block discarded – undo
1149 1149
 		);
1150 1150
 		$error     = array();
1151 1151
 
1152
-		if ( ! user_can( $this->user_id, 'view_give_reports' ) && ! $this->override ) {
1152
+		if ( ! user_can($this->user_id, 'view_give_reports') && ! $this->override) {
1153 1153
 			return $stats;
1154 1154
 		}
1155 1155
 
1156
-		if ( $args['type'] == 'donations' ) {
1156
+		if ($args['type'] == 'donations') {
1157 1157
 
1158
-			if ( $args['form'] == null ) {
1159
-				if ( $args['date'] == null ) {
1158
+			if ($args['form'] == null) {
1159
+				if ($args['date'] == null) {
1160 1160
 					$donations = $this->get_default_sales_stats();
1161
-				} elseif ( $args['date'] === 'range' ) {
1161
+				} elseif ($args['date'] === 'range') {
1162 1162
 					// Return donations for a date range.
1163 1163
 					// Ensure the end date is later than the start date.
1164
-					if ( $args['enddate'] < $args['startdate'] ) {
1165
-						$error['error'] = __( 'The end date must be later than the start date.', 'give' );
1164
+					if ($args['enddate'] < $args['startdate']) {
1165
+						$error['error'] = __('The end date must be later than the start date.', 'give');
1166 1166
 					}
1167 1167
 
1168 1168
 					// Ensure both the start and end date are specified
1169
-					if ( empty( $args['startdate'] ) || empty( $args['enddate'] ) ) {
1170
-						$error['error'] = __( 'Invalid or no date range specified.', 'give' );
1169
+					if (empty($args['startdate']) || empty($args['enddate'])) {
1170
+						$error['error'] = __('Invalid or no date range specified.', 'give');
1171 1171
 					}
1172 1172
 
1173 1173
 					$total = 0;
1174 1174
 
1175 1175
 					// Loop through the years
1176 1176
 					$y = $dates['year'];
1177
-					while ( $y <= $dates['year_end'] ) :
1177
+					while ($y <= $dates['year_end']) :
1178 1178
 
1179
-						if ( $dates['year'] == $dates['year_end'] ) {
1179
+						if ($dates['year'] == $dates['year_end']) {
1180 1180
 							$month_start = $dates['m_start'];
1181 1181
 							$month_end   = $dates['m_end'];
1182
-						} elseif ( $y == $dates['year'] && $dates['year_end'] > $dates['year'] ) {
1182
+						} elseif ($y == $dates['year'] && $dates['year_end'] > $dates['year']) {
1183 1183
 							$month_start = $dates['m_start'];
1184 1184
 							$month_end   = 12;
1185
-						} elseif ( $y == $dates['year_end'] ) {
1185
+						} elseif ($y == $dates['year_end']) {
1186 1186
 							$month_start = 1;
1187 1187
 							$month_end   = $dates['m_end'];
1188 1188
 						} else {
@@ -1191,132 +1191,132 @@  discard block
 block discarded – undo
1191 1191
 						}
1192 1192
 
1193 1193
 						$i = $month_start;
1194
-						while ( $i <= $month_end ) :
1194
+						while ($i <= $month_end) :
1195 1195
 
1196
-							if ( $i == $dates['m_start'] ) {
1196
+							if ($i == $dates['m_start']) {
1197 1197
 								$d = $dates['day_start'];
1198 1198
 							} else {
1199 1199
 								$d = 1;
1200 1200
 							}
1201 1201
 
1202
-							if ( $i == $dates['m_end'] ) {
1202
+							if ($i == $dates['m_end']) {
1203 1203
 								$num_of_days = $dates['day_end'];
1204 1204
 							} else {
1205
-								$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
1205
+								$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
1206 1206
 							}
1207 1207
 
1208
-							while ( $d <= $num_of_days ) :
1209
-								$sale_count = give_get_sales_by_date( $d, $i, $y );
1210
-								$date_key   = date( 'Ymd', strtotime( $y . '/' . $i . '/' . $d ) );
1211
-								if ( ! isset( $donations['sales'][ $date_key ] ) ) {
1212
-									$donations['sales'][ $date_key ] = 0;
1208
+							while ($d <= $num_of_days) :
1209
+								$sale_count = give_get_sales_by_date($d, $i, $y);
1210
+								$date_key   = date('Ymd', strtotime($y.'/'.$i.'/'.$d));
1211
+								if ( ! isset($donations['sales'][$date_key])) {
1212
+									$donations['sales'][$date_key] = 0;
1213 1213
 								}
1214
-								$donations['sales'][ $date_key ] += $sale_count;
1214
+								$donations['sales'][$date_key] += $sale_count;
1215 1215
 								$total                           += $sale_count;
1216
-								$d ++;
1216
+								$d++;
1217 1217
 							endwhile;
1218
-							$i ++;
1218
+							$i++;
1219 1219
 						endwhile;
1220 1220
 
1221
-						$y ++;
1221
+						$y++;
1222 1222
 					endwhile;
1223 1223
 
1224 1224
 					$donations['totals'] = $total;
1225 1225
 				} else {
1226
-					if ( $args['date'] == 'this_quarter' || $args['date'] == 'last_quarter' ) {
1226
+					if ($args['date'] == 'this_quarter' || $args['date'] == 'last_quarter') {
1227 1227
 						$donations_count = 0;
1228 1228
 
1229 1229
 						// Loop through the months
1230 1230
 						$month = $dates['m_start'];
1231 1231
 
1232
-						while ( $month <= $dates['m_end'] ) :
1233
-							$donations_count += give_get_sales_by_date( null, $month, $dates['year'] );
1234
-							$month ++;
1232
+						while ($month <= $dates['m_end']) :
1233
+							$donations_count += give_get_sales_by_date(null, $month, $dates['year']);
1234
+							$month++;
1235 1235
 						endwhile;
1236 1236
 
1237
-						$donations['donations'][ $args['date'] ] = $donations_count;
1237
+						$donations['donations'][$args['date']] = $donations_count;
1238 1238
 					} else {
1239
-						$donations['donations'][ $args['date'] ] = give_get_sales_by_date( $dates['day'], $dates['m_start'], $dates['year'] );
1239
+						$donations['donations'][$args['date']] = give_get_sales_by_date($dates['day'], $dates['m_start'], $dates['year']);
1240 1240
 					}
1241 1241
 				}// End if().
1242
-			} elseif ( $args['form'] == 'all' ) {
1243
-				$forms = get_posts( array(
1242
+			} elseif ($args['form'] == 'all') {
1243
+				$forms = get_posts(array(
1244 1244
 					'post_type' => 'give_forms',
1245 1245
 					'nopaging'  => true,
1246
-				) );
1247
-				$i     = 0;
1248
-				foreach ( $forms as $form_info ) {
1249
-					$donations['donations'][ $i ] = array(
1246
+				));
1247
+				$i = 0;
1248
+				foreach ($forms as $form_info) {
1249
+					$donations['donations'][$i] = array(
1250 1250
 						$form_info->post_name => $this->stats->get_sales(
1251 1251
 							$form_info->ID,
1252
-							is_numeric( $args['startdate'] )
1253
-								? strtotime( $args['startdate'] )
1252
+							is_numeric($args['startdate'])
1253
+								? strtotime($args['startdate'])
1254 1254
 								: $args['startdate'],
1255
-							is_numeric( $args['enddate'] )
1256
-								? strtotime( $args['enddate'] )
1255
+							is_numeric($args['enddate'])
1256
+								? strtotime($args['enddate'])
1257 1257
 								: $args['enddate']
1258 1258
 						),
1259 1259
 					);
1260
-					$i ++;
1260
+					$i++;
1261 1261
 				}
1262 1262
 			} else {
1263
-				if ( get_post_type( $args['form'] ) == 'give_forms' ) {
1264
-					$form_info                 = get_post( $args['form'] );
1263
+				if (get_post_type($args['form']) == 'give_forms') {
1264
+					$form_info                 = get_post($args['form']);
1265 1265
 					$donations['donations'][0] = array(
1266 1266
 						$form_info->post_name => $this->stats->get_sales(
1267 1267
 							$args['form'],
1268
-							is_numeric( $args['startdate'] )
1269
-								? strtotime( $args['startdate'] )
1268
+							is_numeric($args['startdate'])
1269
+								? strtotime($args['startdate'])
1270 1270
 								: $args['startdate'],
1271
-							is_numeric( $args['enddate'] )
1272
-								? strtotime( $args['enddate'] )
1271
+							is_numeric($args['enddate'])
1272
+								? strtotime($args['enddate'])
1273 1273
 								: $args['enddate']
1274 1274
 						),
1275 1275
 					);
1276 1276
 				} else {
1277 1277
 					$error['error'] = sprintf( /* translators: %s: form */
1278
-						__( 'Form %s not found.', 'give' ), $args['form'] );
1278
+						__('Form %s not found.', 'give'), $args['form'] );
1279 1279
 				}
1280 1280
 			}// End if().
1281 1281
 
1282
-			if ( ! empty( $error ) ) {
1282
+			if ( ! empty($error)) {
1283 1283
 				return $error;
1284 1284
 			}
1285 1285
 
1286 1286
 			return $donations;
1287 1287
 
1288
-		} elseif ( $args['type'] == 'earnings' ) {
1289
-			if ( $args['form'] == null ) {
1290
-				if ( $args['date'] == null ) {
1288
+		} elseif ($args['type'] == 'earnings') {
1289
+			if ($args['form'] == null) {
1290
+				if ($args['date'] == null) {
1291 1291
 					$earnings = $this->get_default_earnings_stats();
1292
-				} elseif ( $args['date'] === 'range' ) {
1292
+				} elseif ($args['date'] === 'range') {
1293 1293
 					// Return sales for a date range
1294 1294
 					// Ensure the end date is later than the start date
1295
-					if ( $args['enddate'] < $args['startdate'] ) {
1296
-						$error['error'] = __( 'The end date must be later than the start date.', 'give' );
1295
+					if ($args['enddate'] < $args['startdate']) {
1296
+						$error['error'] = __('The end date must be later than the start date.', 'give');
1297 1297
 					}
1298 1298
 
1299 1299
 					// Ensure both the start and end date are specified
1300
-					if ( empty( $args['startdate'] ) || empty( $args['enddate'] ) ) {
1301
-						$error['error'] = __( 'Invalid or no date range specified.', 'give' );
1300
+					if (empty($args['startdate']) || empty($args['enddate'])) {
1301
+						$error['error'] = __('Invalid or no date range specified.', 'give');
1302 1302
 					}
1303 1303
 
1304 1304
 					$total = (float) 0.00;
1305 1305
 
1306 1306
 					// Loop through the years
1307 1307
 					$y = $dates['year'];
1308
-					if ( ! isset( $earnings['earnings'] ) ) {
1308
+					if ( ! isset($earnings['earnings'])) {
1309 1309
 						$earnings['earnings'] = array();
1310 1310
 					}
1311
-					while ( $y <= $dates['year_end'] ) :
1311
+					while ($y <= $dates['year_end']) :
1312 1312
 
1313
-						if ( $dates['year'] == $dates['year_end'] ) {
1313
+						if ($dates['year'] == $dates['year_end']) {
1314 1314
 							$month_start = $dates['m_start'];
1315 1315
 							$month_end   = $dates['m_end'];
1316
-						} elseif ( $y == $dates['year'] && $dates['year_end'] > $dates['year'] ) {
1316
+						} elseif ($y == $dates['year'] && $dates['year_end'] > $dates['year']) {
1317 1317
 							$month_start = $dates['m_start'];
1318 1318
 							$month_end   = 12;
1319
-						} elseif ( $y == $dates['year_end'] ) {
1319
+						} elseif ($y == $dates['year_end']) {
1320 1320
 							$month_start = 1;
1321 1321
 							$month_end   = $dates['m_end'];
1322 1322
 						} else {
@@ -1325,102 +1325,102 @@  discard block
 block discarded – undo
1325 1325
 						}
1326 1326
 
1327 1327
 						$i = $month_start;
1328
-						while ( $i <= $month_end ) :
1328
+						while ($i <= $month_end) :
1329 1329
 
1330
-							if ( $i == $dates['m_start'] ) {
1330
+							if ($i == $dates['m_start']) {
1331 1331
 								$d = $dates['day_start'];
1332 1332
 							} else {
1333 1333
 								$d = 1;
1334 1334
 							}
1335 1335
 
1336
-							if ( $i == $dates['m_end'] ) {
1336
+							if ($i == $dates['m_end']) {
1337 1337
 								$num_of_days = $dates['day_end'];
1338 1338
 							} else {
1339
-								$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
1339
+								$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
1340 1340
 							}
1341 1341
 
1342
-							while ( $d <= $num_of_days ) :
1343
-								$earnings_stat = give_get_earnings_by_date( $d, $i, $y );
1344
-								$date_key      = date( 'Ymd', strtotime( $y . '/' . $i . '/' . $d ) );
1345
-								if ( ! isset( $earnings['earnings'][ $date_key ] ) ) {
1346
-									$earnings['earnings'][ $date_key ] = 0;
1342
+							while ($d <= $num_of_days) :
1343
+								$earnings_stat = give_get_earnings_by_date($d, $i, $y);
1344
+								$date_key      = date('Ymd', strtotime($y.'/'.$i.'/'.$d));
1345
+								if ( ! isset($earnings['earnings'][$date_key])) {
1346
+									$earnings['earnings'][$date_key] = 0;
1347 1347
 								}
1348
-								$earnings['earnings'][ $date_key ] += $earnings_stat;
1348
+								$earnings['earnings'][$date_key] += $earnings_stat;
1349 1349
 								$total                             += $earnings_stat;
1350
-								$d ++;
1350
+								$d++;
1351 1351
 							endwhile;
1352 1352
 
1353
-							$i ++;
1353
+							$i++;
1354 1354
 						endwhile;
1355 1355
 
1356
-						$y ++;
1356
+						$y++;
1357 1357
 					endwhile;
1358 1358
 
1359 1359
 					$earnings['totals'] = $total;
1360 1360
 				} else {
1361
-					if ( $args['date'] == 'this_quarter' || $args['date'] == 'last_quarter' ) {
1361
+					if ($args['date'] == 'this_quarter' || $args['date'] == 'last_quarter') {
1362 1362
 						$earnings_count = (float) 0.00;
1363 1363
 
1364 1364
 						// Loop through the months
1365 1365
 						$month = $dates['m_start'];
1366 1366
 
1367
-						while ( $month <= $dates['m_end'] ) :
1368
-							$earnings_count += give_get_earnings_by_date( null, $month, $dates['year'] );
1369
-							$month ++;
1367
+						while ($month <= $dates['m_end']) :
1368
+							$earnings_count += give_get_earnings_by_date(null, $month, $dates['year']);
1369
+							$month++;
1370 1370
 						endwhile;
1371 1371
 
1372
-						$earnings['earnings'][ $args['date'] ] = $earnings_count;
1372
+						$earnings['earnings'][$args['date']] = $earnings_count;
1373 1373
 					} else {
1374
-						$earnings['earnings'][ $args['date'] ] = give_get_earnings_by_date( $dates['day'], $dates['m_start'], $dates['year'] );
1374
+						$earnings['earnings'][$args['date']] = give_get_earnings_by_date($dates['day'], $dates['m_start'], $dates['year']);
1375 1375
 					}
1376 1376
 				}// End if().
1377
-			} elseif ( $args['form'] == 'all' ) {
1378
-				$forms = get_posts( array(
1377
+			} elseif ($args['form'] == 'all') {
1378
+				$forms = get_posts(array(
1379 1379
 					'post_type' => 'give_forms',
1380 1380
 					'nopaging'  => true,
1381
-				) );
1381
+				));
1382 1382
 
1383 1383
 				$i = 0;
1384
-				foreach ( $forms as $form_info ) {
1385
-					$earnings['earnings'][ $i ] = array(
1386
-						$form_info->post_name => give_get_form_earnings_stats( $form_info->ID ),
1384
+				foreach ($forms as $form_info) {
1385
+					$earnings['earnings'][$i] = array(
1386
+						$form_info->post_name => give_get_form_earnings_stats($form_info->ID),
1387 1387
 					);
1388
-					$i ++;
1388
+					$i++;
1389 1389
 				}
1390 1390
 			} else {
1391
-				if ( get_post_type( $args['form'] ) == 'give_forms' ) {
1392
-					$form_info               = get_post( $args['form'] );
1391
+				if (get_post_type($args['form']) == 'give_forms') {
1392
+					$form_info               = get_post($args['form']);
1393 1393
 					$earnings['earnings'][0] = array(
1394 1394
 						$form_info->post_name => $this->stats->get_earnings(
1395 1395
 								$args['form'],
1396
-								is_numeric( $args['startdate'] )
1397
-									? strtotime( $args['startdate'] )
1396
+								is_numeric($args['startdate'])
1397
+									? strtotime($args['startdate'])
1398 1398
 									: $args['startdate'],
1399
-								is_numeric( $args['enddate'] )
1400
-									? strtotime( $args['enddate'] )
1399
+								is_numeric($args['enddate'])
1400
+									? strtotime($args['enddate'])
1401 1401
 									: $args['enddate']
1402 1402
 						),
1403 1403
 					);
1404 1404
 				} else {
1405 1405
 					$error['error'] = sprintf( /* translators: %s: form */
1406
-						__( 'Form %s not found.', 'give' ), $args['form'] );
1406
+						__('Form %s not found.', 'give'), $args['form'] );
1407 1407
 				}
1408 1408
 			}// End if().
1409 1409
 
1410
-			if ( ! empty( $error ) ) {
1410
+			if ( ! empty($error)) {
1411 1411
 				return $error;
1412 1412
 			}
1413 1413
 
1414 1414
 			return $earnings;
1415
-		} elseif ( $args['type'] == 'donors' ) {
1415
+		} elseif ($args['type'] == 'donors') {
1416 1416
 			$donors                             = new Give_DB_Donors();
1417 1417
 			$stats['donations']['total_donors'] = $donors->count();
1418 1418
 
1419 1419
 			return $stats;
1420 1420
 
1421
-		} elseif ( empty( $args['type'] ) ) {
1422
-			$stats = array_merge( $stats, $this->get_default_sales_stats() );
1423
-			$stats = array_merge( $stats, $this->get_default_earnings_stats() );
1421
+		} elseif (empty($args['type'])) {
1422
+			$stats = array_merge($stats, $this->get_default_sales_stats());
1423
+			$stats = array_merge($stats, $this->get_default_earnings_stats());
1424 1424
 
1425 1425
 			return array(
1426 1426
 				'stats' => $stats,
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
 	 *
1439 1439
 	 * @return array
1440 1440
 	 */
1441
-	public function get_recent_donations( $args = array() ) {
1441
+	public function get_recent_donations($args = array()) {
1442 1442
 		global $wp_query;
1443 1443
 
1444 1444
 		$defaults = array(
@@ -1448,33 +1448,33 @@  discard block
 block discarded – undo
1448 1448
 			'enddate'   => null,
1449 1449
 		);
1450 1450
 
1451
-		$args = wp_parse_args( $args, $defaults );
1451
+		$args = wp_parse_args($args, $defaults);
1452 1452
 
1453 1453
 		$donations = array();
1454 1454
 
1455
-		if ( ! user_can( $this->user_id, 'view_give_reports' ) && ! $this->override ) {
1455
+		if ( ! user_can($this->user_id, 'view_give_reports') && ! $this->override) {
1456 1456
 			return $donations;
1457 1457
 		}
1458 1458
 
1459
-		if ( isset( $wp_query->query_vars['id'] ) ) {
1459
+		if (isset($wp_query->query_vars['id'])) {
1460 1460
 			$query   = array();
1461
-			$query[] = new Give_Payment( $wp_query->query_vars['id'] );
1462
-		} elseif ( isset( $wp_query->query_vars['purchasekey'] ) ) {
1461
+			$query[] = new Give_Payment($wp_query->query_vars['id']);
1462
+		} elseif (isset($wp_query->query_vars['purchasekey'])) {
1463 1463
 			$query   = array();
1464
-			$query[] = give_get_payment_by( 'key', $wp_query->query_vars['purchasekey'] );
1465
-		} elseif ( isset( $wp_query->query_vars['email'] ) ) {
1466
-			$args  = array(
1464
+			$query[] = give_get_payment_by('key', $wp_query->query_vars['purchasekey']);
1465
+		} elseif (isset($wp_query->query_vars['email'])) {
1466
+			$args = array(
1467 1467
 				'fields'     => 'ids',
1468 1468
 				'meta_key'   => '_give_payment_donor_email',
1469 1469
 				'meta_value' => $wp_query->query_vars['email'],
1470 1470
 				'number'     => $this->per_page(),
1471 1471
 				'page'       => $this->get_paged(),
1472 1472
 			);
1473
-			$query = give_get_payments( $args );
1474
-		} elseif ( isset( $wp_query->query_vars['date'] ) ) {
1473
+			$query = give_get_payments($args);
1474
+		} elseif (isset($wp_query->query_vars['date'])) {
1475 1475
 
1476
-			$current_time = current_time( 'timestamp' );
1477
-			$dates        = $this->get_dates( $args );
1476
+			$current_time = current_time('timestamp');
1477
+			$dates        = $this->get_dates($args);
1478 1478
 			$start_date   = '';
1479 1479
 			$end_date     = '';
1480 1480
 
@@ -1487,27 +1487,27 @@  discard block
 block discarded – undo
1487 1487
 			 * @params date startdate | required when date = range and format to be YYYYMMDD (i.e. 20170524)
1488 1488
 			 * @params date enddate | required when date = range and format to be YYYYMMDD (i.e. 20170524)
1489 1489
 			 */
1490
-			switch ( $wp_query->query_vars['date'] ) {
1490
+			switch ($wp_query->query_vars['date']) {
1491 1491
 
1492 1492
 				case 'today':
1493 1493
 
1494 1494
 					// Set and Format Start and End Date to be date of today.
1495
-					$start_date = $end_date = date( 'Y/m/d', $current_time );
1495
+					$start_date = $end_date = date('Y/m/d', $current_time);
1496 1496
 
1497 1497
 					break;
1498 1498
 
1499 1499
 				case 'yesterday':
1500 1500
 
1501 1501
 					// Set and Format Start and End Date to be date of yesterday.
1502
-					$start_date = $end_date = date( 'Y/m', $current_time ) . '/' . ( date( 'd', $current_time ) - 1 );
1502
+					$start_date = $end_date = date('Y/m', $current_time).'/'.(date('d', $current_time) - 1);
1503 1503
 
1504 1504
 					break;
1505 1505
 
1506 1506
 				case 'range':
1507 1507
 
1508 1508
 					// Format Start Date and End Date for filtering payment based on date range.
1509
-					$start_date = $dates['year'] . '/' . $dates['m_start'] . '/' . $dates['day_start'];
1510
-					$end_date   = $dates['year_end'] . '/' . $dates['m_end'] . '/' . $dates['day_end'];
1509
+					$start_date = $dates['year'].'/'.$dates['m_start'].'/'.$dates['day_start'];
1510
+					$end_date   = $dates['year_end'].'/'.$dates['m_end'].'/'.$dates['day_end'];
1511 1511
 
1512 1512
 					break;
1513 1513
 
@@ -1521,22 +1521,22 @@  discard block
 block discarded – undo
1521 1521
 				'page'       => $this->get_paged(),
1522 1522
 			);
1523 1523
 
1524
-			$query = give_get_payments( $args );
1524
+			$query = give_get_payments($args);
1525 1525
 		} else {
1526 1526
 			$args  = array(
1527 1527
 				'fields' => 'ids',
1528 1528
 				'number' => $this->per_page(),
1529 1529
 				'page'   => $this->get_paged(),
1530 1530
 			);
1531
-			$query = give_get_payments( $args );
1531
+			$query = give_get_payments($args);
1532 1532
 		}// End if().
1533 1533
 
1534
-		if ( $query ) {
1534
+		if ($query) {
1535 1535
 			$i = 0;
1536
-			foreach ( $query as $payment ) {
1536
+			foreach ($query as $payment) {
1537 1537
 
1538
-				if ( is_numeric( $payment ) ) {
1539
-					$payment      = new Give_Payment( $payment );
1538
+				if (is_numeric($payment)) {
1539
+					$payment      = new Give_Payment($payment);
1540 1540
 					$payment_meta = $payment->get_meta();
1541 1541
 					$user_info    = $payment->user_info;
1542 1542
 				}
@@ -1544,44 +1544,44 @@  discard block
 block discarded – undo
1544 1544
 				$payment_meta = $payment->get_meta();
1545 1545
 				$user_info    = $payment->user_info;
1546 1546
 
1547
-				$first_name = isset( $user_info['first_name'] ) ? $user_info['first_name'] : '';
1548
-				$last_name  = isset( $user_info['last_name'] ) ? $user_info['last_name'] : '';
1549
-
1550
-				$donations['donations'][ $i ]['ID']             = $payment->ID;
1551
-				$donations['donations'][ $i ]['number']         = $payment->number;
1552
-				$donations['donations'][ $i ]['transaction_id'] = $payment->transaction_id;
1553
-				$donations['donations'][ $i ]['key']            = $payment->key;
1554
-				$donations['donations'][ $i ]['total']          = $payment->total;
1555
-				$donations['donations'][ $i ]['status']         = give_get_payment_status( $payment, true );
1556
-				$donations['donations'][ $i ]['gateway']        = $payment->gateway;
1557
-				$donations['donations'][ $i ]['name']           = $first_name . ' ' . $last_name;
1558
-				$donations['donations'][ $i ]['fname']          = $first_name;
1559
-				$donations['donations'][ $i ]['lname']          = $last_name;
1560
-				$donations['donations'][ $i ]['email']          = $payment->email;
1561
-				$donations['donations'][ $i ]['date']           = $payment->date;
1562
-				$donations['donations'][ $i ]['payment_meta']   = array();
1563
-
1564
-				$form_id  = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : $payment_meta;
1565
-				$price    = isset( $payment_meta['form_id'] ) ? give_get_form_price( $payment_meta['form_id'] ) : false;
1566
-				$price_id = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null;
1567
-
1568
-				$donations['donations'][ $i ]['form']['id']    = $form_id;
1569
-				$donations['donations'][ $i ]['form']['name']  = get_the_title( $payment_meta['form_id'] );
1570
-				$donations['donations'][ $i ]['form']['price'] = $price;
1571
-
1572
-				if ( give_has_variable_prices( $form_id ) ) {
1573
-					if ( isset( $payment_meta['price_id'] ) ) {
1574
-						$price_name                                         = give_get_price_option_name( $form_id, $payment_meta['price_id'], $payment->ID );
1575
-						$donations['donations'][ $i ]['form']['price_name'] = $price_name;
1576
-						$donations['donations'][ $i ]['form']['price_id']   = $price_id;
1577
-						$donations['donations'][ $i ]['form']['price']      = give_get_price_option_amount( $form_id, $price_id );
1547
+				$first_name = isset($user_info['first_name']) ? $user_info['first_name'] : '';
1548
+				$last_name  = isset($user_info['last_name']) ? $user_info['last_name'] : '';
1549
+
1550
+				$donations['donations'][$i]['ID']             = $payment->ID;
1551
+				$donations['donations'][$i]['number']         = $payment->number;
1552
+				$donations['donations'][$i]['transaction_id'] = $payment->transaction_id;
1553
+				$donations['donations'][$i]['key']            = $payment->key;
1554
+				$donations['donations'][$i]['total']          = $payment->total;
1555
+				$donations['donations'][$i]['status']         = give_get_payment_status($payment, true);
1556
+				$donations['donations'][$i]['gateway']        = $payment->gateway;
1557
+				$donations['donations'][$i]['name']           = $first_name.' '.$last_name;
1558
+				$donations['donations'][$i]['fname']          = $first_name;
1559
+				$donations['donations'][$i]['lname']          = $last_name;
1560
+				$donations['donations'][$i]['email']          = $payment->email;
1561
+				$donations['donations'][$i]['date']           = $payment->date;
1562
+				$donations['donations'][$i]['payment_meta']   = array();
1563
+
1564
+				$form_id  = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : $payment_meta;
1565
+				$price    = isset($payment_meta['form_id']) ? give_get_form_price($payment_meta['form_id']) : false;
1566
+				$price_id = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
1567
+
1568
+				$donations['donations'][$i]['form']['id']    = $form_id;
1569
+				$donations['donations'][$i]['form']['name']  = get_the_title($payment_meta['form_id']);
1570
+				$donations['donations'][$i]['form']['price'] = $price;
1571
+
1572
+				if (give_has_variable_prices($form_id)) {
1573
+					if (isset($payment_meta['price_id'])) {
1574
+						$price_name                                         = give_get_price_option_name($form_id, $payment_meta['price_id'], $payment->ID);
1575
+						$donations['donations'][$i]['form']['price_name'] = $price_name;
1576
+						$donations['donations'][$i]['form']['price_id']   = $price_id;
1577
+						$donations['donations'][$i]['form']['price']      = give_get_price_option_amount($form_id, $price_id);
1578 1578
 
1579 1579
 					}
1580 1580
 				}
1581 1581
 
1582
-				if( ! empty( $payment_meta ) ) {
1582
+				if ( ! empty($payment_meta)) {
1583 1583
 					// Add custom meta to API
1584
-					foreach ( $payment_meta as $meta_key => $meta_value ) {
1584
+					foreach ($payment_meta as $meta_key => $meta_value) {
1585 1585
 
1586 1586
 						$exceptions = array(
1587 1587
 							'form_title',
@@ -1594,20 +1594,20 @@  discard block
 block discarded – undo
1594 1594
 						);
1595 1595
 
1596 1596
 						// Don't clutter up results with dupes
1597
-						if ( in_array( $meta_key, $exceptions ) ) {
1597
+						if (in_array($meta_key, $exceptions)) {
1598 1598
 							continue;
1599 1599
 						}
1600 1600
 
1601
-						$donations['donations'][ $i ]['payment_meta'][ $meta_key ] = $meta_value;
1601
+						$donations['donations'][$i]['payment_meta'][$meta_key] = $meta_value;
1602 1602
 
1603 1603
 					}
1604 1604
 				}
1605 1605
 
1606
-				$i ++;
1606
+				$i++;
1607 1607
 			}// End foreach().
1608 1608
 		}// End if().
1609 1609
 
1610
-		return apply_filters( 'give_api_donations_endpoint', $donations );
1610
+		return apply_filters('give_api_donations_endpoint', $donations);
1611 1611
 	}
1612 1612
 
1613 1613
 	/**
@@ -1623,9 +1623,9 @@  discard block
 block discarded – undo
1623 1623
 	public function get_output_format() {
1624 1624
 		global $wp_query;
1625 1625
 
1626
-		$format = isset( $wp_query->query_vars['format'] ) ? $wp_query->query_vars['format'] : 'json';
1626
+		$format = isset($wp_query->query_vars['format']) ? $wp_query->query_vars['format'] : 'json';
1627 1627
 
1628
-		return apply_filters( 'give_api_output_format', $format );
1628
+		return apply_filters('give_api_output_format', $format);
1629 1629
 	}
1630 1630
 
1631 1631
 
@@ -1641,8 +1641,8 @@  discard block
 block discarded – undo
1641 1641
 	 *
1642 1642
 	 * @return void
1643 1643
 	 */
1644
-	private function log_request( $data = array() ) {
1645
-		if ( ! $this->log_requests ) {
1644
+	private function log_request($data = array()) {
1645
+		if ( ! $this->log_requests) {
1646 1646
 			return;
1647 1647
 		}
1648 1648
 
@@ -1653,37 +1653,37 @@  discard block
 block discarded – undo
1653 1653
 
1654 1654
 		$query = array(
1655 1655
 			'give-api'    => $wp_query->query_vars['give-api'],
1656
-			'key'         => isset( $wp_query->query_vars['key'] ) ? $wp_query->query_vars['key'] : null,
1657
-			'token'       => isset( $wp_query->query_vars['token'] ) ? $wp_query->query_vars['token'] : null,
1658
-			'query'       => isset( $wp_query->query_vars['query'] ) ? $wp_query->query_vars['query'] : null,
1659
-			'type'        => isset( $wp_query->query_vars['type'] ) ? $wp_query->query_vars['type'] : null,
1660
-			'form'        => isset( $wp_query->query_vars['form'] ) ? $wp_query->query_vars['form'] : null,
1661
-			'donor'       => isset( $wp_query->query_vars['donor'] ) ? $wp_query->query_vars['donor'] : null,
1662
-			'date'        => isset( $wp_query->query_vars['date'] ) ? $wp_query->query_vars['date'] : null,
1663
-			'startdate'   => isset( $wp_query->query_vars['startdate'] ) ? $wp_query->query_vars['startdate'] : null,
1664
-			'enddate'     => isset( $wp_query->query_vars['enddate'] ) ? $wp_query->query_vars['enddate'] : null,
1665
-			'id'          => isset( $wp_query->query_vars['id'] ) ? $wp_query->query_vars['id'] : null,
1666
-			'purchasekey' => isset( $wp_query->query_vars['purchasekey'] ) ? $wp_query->query_vars['purchasekey'] : null,
1667
-			'email'       => isset( $wp_query->query_vars['email'] ) ? $wp_query->query_vars['email'] : null,
1656
+			'key'         => isset($wp_query->query_vars['key']) ? $wp_query->query_vars['key'] : null,
1657
+			'token'       => isset($wp_query->query_vars['token']) ? $wp_query->query_vars['token'] : null,
1658
+			'query'       => isset($wp_query->query_vars['query']) ? $wp_query->query_vars['query'] : null,
1659
+			'type'        => isset($wp_query->query_vars['type']) ? $wp_query->query_vars['type'] : null,
1660
+			'form'        => isset($wp_query->query_vars['form']) ? $wp_query->query_vars['form'] : null,
1661
+			'donor'       => isset($wp_query->query_vars['donor']) ? $wp_query->query_vars['donor'] : null,
1662
+			'date'        => isset($wp_query->query_vars['date']) ? $wp_query->query_vars['date'] : null,
1663
+			'startdate'   => isset($wp_query->query_vars['startdate']) ? $wp_query->query_vars['startdate'] : null,
1664
+			'enddate'     => isset($wp_query->query_vars['enddate']) ? $wp_query->query_vars['enddate'] : null,
1665
+			'id'          => isset($wp_query->query_vars['id']) ? $wp_query->query_vars['id'] : null,
1666
+			'purchasekey' => isset($wp_query->query_vars['purchasekey']) ? $wp_query->query_vars['purchasekey'] : null,
1667
+			'email'       => isset($wp_query->query_vars['email']) ? $wp_query->query_vars['email'] : null,
1668 1668
 		);
1669 1669
 
1670 1670
 		$log_data = array(
1671 1671
 			'log_type'     => 'api_request',
1672
-			'post_excerpt' => http_build_query( $query ),
1673
-			'post_content' => ! empty( $data['error'] ) ? $data['error'] : '',
1672
+			'post_excerpt' => http_build_query($query),
1673
+			'post_content' => ! empty($data['error']) ? $data['error'] : '',
1674 1674
 		);
1675 1675
 
1676 1676
 		$log_meta = array(
1677
-			'api_query'  => http_build_query( $query ),
1677
+			'api_query'  => http_build_query($query),
1678 1678
 			'request_ip' => give_get_ip(),
1679 1679
 			'user'       => $this->user_id,
1680
-			'key'        => isset( $wp_query->query_vars['key'] ) ? $wp_query->query_vars['key'] : null,
1681
-			'token'      => isset( $wp_query->query_vars['token'] ) ? $wp_query->query_vars['token'] : null,
1680
+			'key'        => isset($wp_query->query_vars['key']) ? $wp_query->query_vars['key'] : null,
1681
+			'token'      => isset($wp_query->query_vars['token']) ? $wp_query->query_vars['token'] : null,
1682 1682
 			'time'       => $data['request_speed'],
1683 1683
 			'version'    => $this->get_queried_version(),
1684 1684
 		);
1685 1685
 
1686
-		Give()->logs->insert_log( $log_data, $log_meta );
1686
+		Give()->logs->insert_log($log_data, $log_meta);
1687 1687
 	}
1688 1688
 
1689 1689
 
@@ -1707,11 +1707,11 @@  discard block
 block discarded – undo
1707 1707
 	 *
1708 1708
 	 * @param int       $status_code
1709 1709
 	 */
1710
-	public function output( $status_code = 200 ) {
1710
+	public function output($status_code = 200) {
1711 1711
 
1712 1712
 		$format = $this->get_output_format();
1713 1713
 
1714
-		status_header( $status_code );
1714
+		status_header($status_code);
1715 1715
 
1716 1716
 		/**
1717 1717
 		 * Fires before outputting the API.
@@ -1722,25 +1722,25 @@  discard block
 block discarded – undo
1722 1722
 		 * @param Give_API $this   The Give_API object.
1723 1723
 		 * @param string   $format Output format, XML or JSON. Default is JSON.
1724 1724
 		 */
1725
-		do_action( 'give_api_output_before', $this->data, $this, $format );
1725
+		do_action('give_api_output_before', $this->data, $this, $format);
1726 1726
 
1727
-		switch ( $format ) :
1727
+		switch ($format) :
1728 1728
 
1729 1729
 			case 'xml' :
1730 1730
 
1731
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/array2xml.php';
1732
-				$xml = Array2XML::createXML( 'give', $this->data );
1731
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/array2xml.php';
1732
+				$xml = Array2XML::createXML('give', $this->data);
1733 1733
 				echo $xml->saveXML();
1734 1734
 
1735 1735
 				break;
1736 1736
 
1737 1737
 			case 'json' :
1738 1738
 
1739
-				header( 'Content-Type: application/json' );
1740
-				if ( ! empty( $this->pretty_print ) ) {
1741
-					echo json_encode( $this->data, $this->pretty_print );
1739
+				header('Content-Type: application/json');
1740
+				if ( ! empty($this->pretty_print)) {
1741
+					echo json_encode($this->data, $this->pretty_print);
1742 1742
 				} else {
1743
-					echo json_encode( $this->data );
1743
+					echo json_encode($this->data);
1744 1744
 				}
1745 1745
 
1746 1746
 				break;
@@ -1755,7 +1755,7 @@  discard block
 block discarded – undo
1755 1755
 				 * @param array    $data Response data to return.
1756 1756
 				 * @param Give_API $this The Give_API object.
1757 1757
 				 */
1758
-				do_action( "give_api_output_{$format}", $this->data, $this );
1758
+				do_action("give_api_output_{$format}", $this->data, $this);
1759 1759
 
1760 1760
 				break;
1761 1761
 
@@ -1770,7 +1770,7 @@  discard block
 block discarded – undo
1770 1770
 		 * @param Give_API $this   The Give_API object.
1771 1771
 		 * @param string   $format Output format, XML or JSON. Default is JSON.
1772 1772
 		 */
1773
-		do_action( 'give_api_output_after', $this->data, $this, $format );
1773
+		do_action('give_api_output_after', $this->data, $this, $format);
1774 1774
 
1775 1775
 		give_die();
1776 1776
 	}
@@ -1787,41 +1787,41 @@  discard block
 block discarded – undo
1787 1787
 	 *
1788 1788
 	 * @return void
1789 1789
 	 */
1790
-	function user_key_field( $user ) {
1790
+	function user_key_field($user) {
1791 1791
 
1792
-		if ( ( give_get_option( 'api_allow_user_keys', false ) || current_user_can( 'manage_give_settings' ) ) && current_user_can( 'edit_user', $user->ID ) ) {
1792
+		if ((give_get_option('api_allow_user_keys', false) || current_user_can('manage_give_settings')) && current_user_can('edit_user', $user->ID)) {
1793 1793
 
1794
-			$user = get_userdata( $user->ID );
1794
+			$user = get_userdata($user->ID);
1795 1795
 			?>
1796 1796
 			<table class="form-table">
1797 1797
 				<tbody>
1798 1798
 				<tr>
1799 1799
 					<th>
1800
-						<?php _e( 'Give API Keys', 'give' ); ?>
1800
+						<?php _e('Give API Keys', 'give'); ?>
1801 1801
 					</th>
1802 1802
 					<td>
1803 1803
 						<?php
1804
-						$public_key = $this->get_user_public_key( $user->ID );
1805
-						$secret_key = $this->get_user_secret_key( $user->ID );
1804
+						$public_key = $this->get_user_public_key($user->ID);
1805
+						$secret_key = $this->get_user_secret_key($user->ID);
1806 1806
 						?>
1807
-						<?php if ( empty( $user->give_user_public_key ) ) { ?>
1807
+						<?php if (empty($user->give_user_public_key)) { ?>
1808 1808
 							<input name="give_set_api_key" type="checkbox" id="give_set_api_key" />
1809
-							<span class="description"><?php _e( 'Generate API Key', 'give' ); ?></span>
1809
+							<span class="description"><?php _e('Generate API Key', 'give'); ?></span>
1810 1810
 						<?php } else { ?>
1811
-							<strong style="display:inline-block; width: 125px;"><?php _e( 'Public key:', 'give' ); ?>
1811
+							<strong style="display:inline-block; width: 125px;"><?php _e('Public key:', 'give'); ?>
1812 1812
 								&nbsp;</strong>
1813
-							<input type="text" disabled="disabled" class="regular-text" id="publickey" value="<?php echo esc_attr( $public_key ); ?>" />
1813
+							<input type="text" disabled="disabled" class="regular-text" id="publickey" value="<?php echo esc_attr($public_key); ?>" />
1814 1814
 							<br />
1815
-							<strong style="display:inline-block; width: 125px;"><?php _e( 'Secret key:', 'give' ); ?>
1815
+							<strong style="display:inline-block; width: 125px;"><?php _e('Secret key:', 'give'); ?>
1816 1816
 								&nbsp;</strong>
1817
-							<input type="text" disabled="disabled" class="regular-text" id="privatekey" value="<?php echo esc_attr( $secret_key ); ?>" />
1817
+							<input type="text" disabled="disabled" class="regular-text" id="privatekey" value="<?php echo esc_attr($secret_key); ?>" />
1818 1818
 							<br />
1819
-							<strong style="display:inline-block; width: 125px;"><?php _e( 'Token:', 'give' ); ?>
1819
+							<strong style="display:inline-block; width: 125px;"><?php _e('Token:', 'give'); ?>
1820 1820
 								&nbsp;</strong>
1821
-							<input type="text" disabled="disabled" class="regular-text" id="token" value="<?php echo esc_attr( $this->get_token( $user->ID ) ); ?>" />
1821
+							<input type="text" disabled="disabled" class="regular-text" id="token" value="<?php echo esc_attr($this->get_token($user->ID)); ?>" />
1822 1822
 							<br />
1823 1823
 							<input name="give_revoke_api_key" type="checkbox" id="give_revoke_api_key" />
1824
-							<span class="description"><label for="give_revoke_api_key"><?php _e( 'Revoke API Keys', 'give' ); ?></label></span>
1824
+							<span class="description"><label for="give_revoke_api_key"><?php _e('Revoke API Keys', 'give'); ?></label></span>
1825 1825
 						<?php } ?>
1826 1826
 					</td>
1827 1827
 				</tr>
@@ -1840,61 +1840,61 @@  discard block
 block discarded – undo
1840 1840
 	 *
1841 1841
 	 * @return void
1842 1842
 	 */
1843
-	public function process_api_key( $args ) {
1843
+	public function process_api_key($args) {
1844 1844
 
1845
-		if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'give-api-nonce' ) ) {
1846
-			wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array(
1845
+		if ( ! wp_verify_nonce($_REQUEST['_wpnonce'], 'give-api-nonce')) {
1846
+			wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array(
1847 1847
 				'response' => 403,
1848
-			) );
1848
+			));
1849 1849
 		}
1850 1850
 
1851
-		if ( empty( $args['user_id'] ) ) {
1852
-			wp_die( __( 'User ID Required.', 'give' ), __( 'Error', 'give' ), array(
1851
+		if (empty($args['user_id'])) {
1852
+			wp_die(__('User ID Required.', 'give'), __('Error', 'give'), array(
1853 1853
 				'response' => 401,
1854
-			) );
1854
+			));
1855 1855
 		}
1856 1856
 
1857
-		if ( is_numeric( $args['user_id'] ) ) {
1858
-			$user_id = isset( $args['user_id'] ) ? absint( $args['user_id'] ) : get_current_user_id();
1857
+		if (is_numeric($args['user_id'])) {
1858
+			$user_id = isset($args['user_id']) ? absint($args['user_id']) : get_current_user_id();
1859 1859
 		} else {
1860
-			$userdata = get_user_by( 'login', $args['user_id'] );
1860
+			$userdata = get_user_by('login', $args['user_id']);
1861 1861
 			$user_id  = $userdata->ID;
1862 1862
 		}
1863
-		$process = isset( $args['give_api_process'] ) ? strtolower( $args['give_api_process'] ) : false;
1863
+		$process = isset($args['give_api_process']) ? strtolower($args['give_api_process']) : false;
1864 1864
 
1865
-		if ( $user_id == get_current_user_id() && ! give_get_option( 'allow_user_api_keys' ) && ! current_user_can( 'manage_give_settings' ) ) {
1866
-			wp_die( sprintf( /* translators: %s: process */
1867
-				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1865
+		if ($user_id == get_current_user_id() && ! give_get_option('allow_user_api_keys') && ! current_user_can('manage_give_settings')) {
1866
+			wp_die(sprintf( /* translators: %s: process */
1867
+				__('You do not have permission to %s API keys for this user.', 'give'), $process ), __('Error', 'give'), array(
1868 1868
 				'response' => 403,
1869
-			) );
1870
-		} elseif ( ! current_user_can( 'manage_give_settings' ) ) {
1871
-			wp_die( sprintf( /* translators: %s: process */
1872
-				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1869
+			));
1870
+		} elseif ( ! current_user_can('manage_give_settings')) {
1871
+			wp_die(sprintf( /* translators: %s: process */
1872
+				__('You do not have permission to %s API keys for this user.', 'give'), $process ), __('Error', 'give'), array(
1873 1873
 				'response' => 403,
1874
-			) );
1874
+			));
1875 1875
 		}
1876 1876
 
1877
-		switch ( $process ) {
1877
+		switch ($process) {
1878 1878
 			case 'generate':
1879
-				if ( $this->generate_api_key( $user_id ) ) {
1880
-					Give_Cache::delete( Give_Cache::get_key( 'give_total_api_keys' ) );
1881
-					wp_redirect( add_query_arg( 'give-messages[]', 'api-key-generated', 'edit.php?post_type=give_forms&page=give-tools&tab=api' ) );
1879
+				if ($this->generate_api_key($user_id)) {
1880
+					Give_Cache::delete(Give_Cache::get_key('give_total_api_keys'));
1881
+					wp_redirect(add_query_arg('give-messages[]', 'api-key-generated', 'edit.php?post_type=give_forms&page=give-tools&tab=api'));
1882 1882
 					exit();
1883 1883
 				} else {
1884
-					wp_redirect( add_query_arg( 'give-messages[]', 'api-key-failed', 'edit.php?post_type=give_forms&page=give-tools&tab=api' ) );
1884
+					wp_redirect(add_query_arg('give-messages[]', 'api-key-failed', 'edit.php?post_type=give_forms&page=give-tools&tab=api'));
1885 1885
 					exit();
1886 1886
 				}
1887 1887
 				break;
1888 1888
 			case 'regenerate':
1889
-				$this->generate_api_key( $user_id, true );
1890
-				Give_Cache::delete( Give_Cache::get_key( 'give_total_api_keys' ) );
1891
-				wp_redirect( add_query_arg( 'give-messages[]', 'api-key-regenerated', 'edit.php?post_type=give_forms&page=give-tools&tab=api' ) );
1889
+				$this->generate_api_key($user_id, true);
1890
+				Give_Cache::delete(Give_Cache::get_key('give_total_api_keys'));
1891
+				wp_redirect(add_query_arg('give-messages[]', 'api-key-regenerated', 'edit.php?post_type=give_forms&page=give-tools&tab=api'));
1892 1892
 				exit();
1893 1893
 				break;
1894 1894
 			case 'revoke':
1895
-				$this->revoke_api_key( $user_id );
1896
-				Give_Cache::delete( Give_Cache::get_key( 'give_total_api_keys' ) );
1897
-				wp_redirect( add_query_arg( 'give-messages[]', 'api-key-revoked', 'edit.php?post_type=give_forms&page=give-tools&tab=api' ) );
1895
+				$this->revoke_api_key($user_id);
1896
+				Give_Cache::delete(Give_Cache::get_key('give_total_api_keys'));
1897
+				wp_redirect(add_query_arg('give-messages[]', 'api-key-revoked', 'edit.php?post_type=give_forms&page=give-tools&tab=api'));
1898 1898
 				exit();
1899 1899
 				break;
1900 1900
 			default;
@@ -1913,59 +1913,59 @@  discard block
 block discarded – undo
1913 1913
 	 *
1914 1914
 	 * @return boolean True if (re)generated successfully, false otherwise.
1915 1915
 	 */
1916
-	public function generate_api_key( $user_id = 0, $regenerate = false ) {
1916
+	public function generate_api_key($user_id = 0, $regenerate = false) {
1917 1917
 
1918 1918
 		// Bail out, if user doesn't exists.
1919
-		if ( empty( $user_id ) ) {
1919
+		if (empty($user_id)) {
1920 1920
 			return false;
1921 1921
 		}
1922 1922
 
1923
-		$user = get_userdata( $user_id );
1923
+		$user = get_userdata($user_id);
1924 1924
 
1925 1925
 		// Bail Out, if user object doesn't exists.
1926
-		if ( ! $user ) {
1926
+		if ( ! $user) {
1927 1927
 			return false;
1928 1928
 		}
1929 1929
 
1930 1930
 		$new_public_key = '';
1931 1931
 		$new_secret_key = '';
1932 1932
 
1933
-		if( ! empty( $_POST['from'] ) && 'profile' === $_POST['from'] ) {
1933
+		if ( ! empty($_POST['from']) && 'profile' === $_POST['from']) {
1934 1934
 			// For User Profile Page.
1935
-			if( ! empty( $_POST['give_set_api_key'] ) ) {
1935
+			if ( ! empty($_POST['give_set_api_key'])) {
1936 1936
 				// Generate API Key from User Profile page.
1937
-				$new_public_key = $this->generate_public_key( $user->user_email );
1938
-				$new_secret_key = $this->generate_private_key( $user->ID );
1939
-			} elseif ( ! empty( $_POST['give_revoke_api_key'] ) ) {
1937
+				$new_public_key = $this->generate_public_key($user->user_email);
1938
+				$new_secret_key = $this->generate_private_key($user->ID);
1939
+			} elseif ( ! empty($_POST['give_revoke_api_key'])) {
1940 1940
 				// Revoke API Key from User Profile page.
1941
-				$this->revoke_api_key( $user->ID );
1941
+				$this->revoke_api_key($user->ID);
1942 1942
 			} else {
1943 1943
 				return false;
1944 1944
 			}
1945 1945
 		} else {
1946 1946
 			// For Tools > API page.
1947
-			$public_key = $this->get_user_public_key( $user_id );
1947
+			$public_key = $this->get_user_public_key($user_id);
1948 1948
 
1949
-			if ( empty( $public_key ) && ! $regenerate ) {
1949
+			if (empty($public_key) && ! $regenerate) {
1950 1950
 				// Generating API for first time.
1951
-				$new_public_key = $this->generate_public_key( $user->user_email );
1952
-				$new_secret_key = $this->generate_private_key( $user->ID );
1953
-			} elseif ( $public_key && $regenerate ) {
1951
+				$new_public_key = $this->generate_public_key($user->user_email);
1952
+				$new_secret_key = $this->generate_private_key($user->ID);
1953
+			} elseif ($public_key && $regenerate) {
1954 1954
 				// API Key already exists and Regenerating API Key.
1955
-				$this->revoke_api_key( $user->ID );
1956
-				$new_public_key = $this->generate_public_key( $user->user_email );
1957
-				$new_secret_key = $this->generate_private_key( $user->ID );
1958
-			} elseif ( ! empty( $public_key ) && ! $regenerate ) {
1955
+				$this->revoke_api_key($user->ID);
1956
+				$new_public_key = $this->generate_public_key($user->user_email);
1957
+				$new_secret_key = $this->generate_private_key($user->ID);
1958
+			} elseif ( ! empty($public_key) && ! $regenerate) {
1959 1959
 				// Doing nothing, when API Key exists but still try to generate again instead of regenerating.
1960 1960
 				return false;
1961 1961
 			} else {
1962 1962
 				// Revoke API Key.
1963
-				$this->revoke_api_key( $user->ID );
1963
+				$this->revoke_api_key($user->ID);
1964 1964
 			}
1965 1965
 		}
1966 1966
 
1967
-		update_user_meta( $user_id, $new_public_key, 'give_user_public_key' );
1968
-		update_user_meta( $user_id, $new_secret_key, 'give_user_secret_key' );
1967
+		update_user_meta($user_id, $new_public_key, 'give_user_public_key');
1968
+		update_user_meta($user_id, $new_secret_key, 'give_user_secret_key');
1969 1969
 
1970 1970
 		return true;
1971 1971
 	}
@@ -1980,26 +1980,26 @@  discard block
 block discarded – undo
1980 1980
 	 *
1981 1981
 	 * @return bool
1982 1982
 	 */
1983
-	public function revoke_api_key( $user_id = 0 ) {
1983
+	public function revoke_api_key($user_id = 0) {
1984 1984
 
1985
-		if ( empty( $user_id ) ) {
1985
+		if (empty($user_id)) {
1986 1986
 			return false;
1987 1987
 		}
1988 1988
 
1989
-		$user = get_userdata( $user_id );
1989
+		$user = get_userdata($user_id);
1990 1990
 
1991
-		if ( ! $user ) {
1991
+		if ( ! $user) {
1992 1992
 			return false;
1993 1993
 		}
1994 1994
 
1995
-		$public_key = $this->get_user_public_key( $user_id );
1996
-		$secret_key = $this->get_user_secret_key( $user_id );
1997
-		if ( ! empty( $public_key ) ) {
1998
-			Give_Cache::delete( Give_Cache::get_key( md5( 'give_api_user_' . $public_key ) ) );
1999
-			Give_Cache::delete( Give_Cache::get_key( md5( 'give_api_user_public_key' . $user_id ) ) );
2000
-			Give_Cache::delete( Give_Cache::get_key( md5( 'give_api_user_secret_key' . $user_id ) ) );
2001
-			delete_user_meta( $user_id, $public_key );
2002
-			delete_user_meta( $user_id, $secret_key );
1995
+		$public_key = $this->get_user_public_key($user_id);
1996
+		$secret_key = $this->get_user_secret_key($user_id);
1997
+		if ( ! empty($public_key)) {
1998
+			Give_Cache::delete(Give_Cache::get_key(md5('give_api_user_'.$public_key)));
1999
+			Give_Cache::delete(Give_Cache::get_key(md5('give_api_user_public_key'.$user_id)));
2000
+			Give_Cache::delete(Give_Cache::get_key(md5('give_api_user_secret_key'.$user_id)));
2001
+			delete_user_meta($user_id, $public_key);
2002
+			delete_user_meta($user_id, $secret_key);
2003 2003
 		} else {
2004 2004
 			return false;
2005 2005
 		}
@@ -2021,9 +2021,9 @@  discard block
 block discarded – undo
2021 2021
 	 *
2022 2022
 	 * @return string
2023 2023
 	 */
2024
-	private function generate_public_key( $user_email = '' ) {
2025
-		$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
2026
-		$public   = hash( 'md5', $user_email . $auth_key . date( 'U' ) );
2024
+	private function generate_public_key($user_email = '') {
2025
+		$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
2026
+		$public   = hash('md5', $user_email.$auth_key.date('U'));
2027 2027
 
2028 2028
 		return $public;
2029 2029
 	}
@@ -2038,9 +2038,9 @@  discard block
 block discarded – undo
2038 2038
 	 *
2039 2039
 	 * @return string
2040 2040
 	 */
2041
-	private function generate_private_key( $user_id = 0 ) {
2042
-		$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
2043
-		$secret   = hash( 'md5', $user_id . $auth_key . date( 'U' ) );
2041
+	private function generate_private_key($user_id = 0) {
2042
+		$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
2043
+		$secret   = hash('md5', $user_id.$auth_key.date('U'));
2044 2044
 
2045 2045
 		return $secret;
2046 2046
 	}
@@ -2055,8 +2055,8 @@  discard block
 block discarded – undo
2055 2055
 	 *
2056 2056
 	 * @return string
2057 2057
 	 */
2058
-	public function get_token( $user_id = 0 ) {
2059
-		return hash( 'md5', $this->get_user_secret_key( $user_id ) . $this->get_user_public_key( $user_id ) );
2058
+	public function get_token($user_id = 0) {
2059
+		return hash('md5', $this->get_user_secret_key($user_id).$this->get_user_public_key($user_id));
2060 2060
 	}
2061 2061
 
2062 2062
 	/**
@@ -2070,9 +2070,9 @@  discard block
 block discarded – undo
2070 2070
 
2071 2071
 		// Default sales return
2072 2072
 		$donations                               = array();
2073
-		$donations['donations']['today']         = $this->stats->get_sales( 0, 'today' );
2074
-		$donations['donations']['current_month'] = $this->stats->get_sales( 0, 'this_month' );
2075
-		$donations['donations']['last_month']    = $this->stats->get_sales( 0, 'last_month' );
2073
+		$donations['donations']['today']         = $this->stats->get_sales(0, 'today');
2074
+		$donations['donations']['current_month'] = $this->stats->get_sales(0, 'this_month');
2075
+		$donations['donations']['last_month']    = $this->stats->get_sales(0, 'last_month');
2076 2076
 		$donations['donations']['totals']        = give_get_total_donations();
2077 2077
 
2078 2078
 		return $donations;
@@ -2089,9 +2089,9 @@  discard block
 block discarded – undo
2089 2089
 
2090 2090
 		// Default earnings return
2091 2091
 		$earnings                              = array();
2092
-		$earnings['earnings']['today']         = $this->stats->get_earnings( 0, 'today' );
2093
-		$earnings['earnings']['current_month'] = $this->stats->get_earnings( 0, 'this_month' );
2094
-		$earnings['earnings']['last_month']    = $this->stats->get_earnings( 0, 'last_month' );
2092
+		$earnings['earnings']['today']         = $this->stats->get_earnings(0, 'today');
2093
+		$earnings['earnings']['current_month'] = $this->stats->get_earnings(0, 'this_month');
2094
+		$earnings['earnings']['last_month']    = $this->stats->get_earnings(0, 'last_month');
2095 2095
 		$earnings['earnings']['totals']        = give_get_total_earnings();
2096 2096
 
2097 2097
 		return $earnings;
@@ -2111,25 +2111,25 @@  discard block
 block discarded – undo
2111 2111
 	 *
2112 2112
 	 * @return string            The API key/secret for the user supplied
2113 2113
 	 */
2114
-	public function api_key_backwards_compat( $check, $object_id, $meta_key, $single ) {
2114
+	public function api_key_backwards_compat($check, $object_id, $meta_key, $single) {
2115 2115
 
2116
-		if ( $meta_key !== 'give_user_public_key' && $meta_key !== 'give_user_secret_key' ) {
2116
+		if ($meta_key !== 'give_user_public_key' && $meta_key !== 'give_user_secret_key') {
2117 2117
 			return $check;
2118 2118
 		}
2119 2119
 
2120 2120
 		$return = $check;
2121 2121
 
2122
-		switch ( $meta_key ) {
2122
+		switch ($meta_key) {
2123 2123
 			case 'give_user_public_key':
2124
-				$return = Give()->api->get_user_public_key( $object_id );
2124
+				$return = Give()->api->get_user_public_key($object_id);
2125 2125
 				break;
2126 2126
 			case 'give_user_secret_key':
2127
-				$return = Give()->api->get_user_secret_key( $object_id );
2127
+				$return = Give()->api->get_user_secret_key($object_id);
2128 2128
 				break;
2129 2129
 		}
2130 2130
 
2131
-		if ( ! $single ) {
2132
-			$return = array( $return );
2131
+		if ( ! $single) {
2132
+			$return = array($return);
2133 2133
 		}
2134 2134
 
2135 2135
 		return $return;
Please login to merge, or discard this patch.