Test Failed
Pull Request — master (#2712)
by Devin
07:52 queued 02:44
created
give.php 1 patch
Spacing   +174 added lines, -174 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
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		 * @return    Give
238 238
 		 */
239 239
 		public static function instance() {
240
-			if ( is_null( self::$_instance ) ) {
240
+			if (is_null(self::$_instance)) {
241 241
 				self::$_instance = new self();
242 242
 			}
243 243
 
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 		 */
250 250
 		public function __construct() {
251 251
 			// PHP version
252
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
253
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
252
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
253
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
254 254
 			}
255 255
 
256 256
 			// Bailout: Need minimum php version to load plugin.
257
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
258
-				add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) );
257
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
258
+				add_action('admin_notices', array($this, 'minmum_phpversion_notice'));
259 259
 
260 260
 				return;
261 261
 			}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			$this->includes();
266 266
 			$this->init_hooks();
267 267
 
268
-			do_action( 'give_loaded' );
268
+			do_action('give_loaded');
269 269
 		}
270 270
 
271 271
 		/**
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 		 * @since  1.8.9
275 275
 		 */
276 276
 		private function init_hooks() {
277
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
278
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
277
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
278
+			add_action('plugins_loaded', array($this, 'init'), 0);
279 279
 		}
280 280
 
281 281
 		/**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			 *
291 291
 			 * @since 1.8.9
292 292
 			 */
293
-			do_action( 'before_give_init' );
293
+			do_action('before_give_init');
294 294
 
295 295
 			// Set up localization.
296 296
 			$this->load_textdomain();
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			 *
321 321
 			 * @since 1.8.7
322 322
 			 */
323
-			do_action( 'give_init', $this );
323
+			do_action('give_init', $this);
324 324
 
325 325
 		}
326 326
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		 */
338 338
 		public function __clone() {
339 339
 			// Cloning instances of the class is forbidden.
340
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
340
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
341 341
 		}
342 342
 
343 343
 		/**
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 		 */
351 351
 		public function __wakeup() {
352 352
 			// Unserializing instances of the class is forbidden.
353
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
353
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
354 354
 		}
355 355
 
356 356
 		/**
@@ -364,33 +364,33 @@  discard block
 block discarded – undo
364 364
 		private function setup_constants() {
365 365
 
366 366
 			// Plugin version
367
-			if ( ! defined( 'GIVE_VERSION' ) ) {
368
-				define( 'GIVE_VERSION', '2.0.1' );
367
+			if ( ! defined('GIVE_VERSION')) {
368
+				define('GIVE_VERSION', '2.0.1');
369 369
 			}
370 370
 
371 371
 			// Plugin Root File
372
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
373
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
372
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
373
+				define('GIVE_PLUGIN_FILE', __FILE__);
374 374
 			}
375 375
 
376 376
 			// Plugin Folder Path
377
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
378
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
377
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
378
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
379 379
 			}
380 380
 
381 381
 			// Plugin Folder URL
382
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
383
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
382
+			if ( ! defined('GIVE_PLUGIN_URL')) {
383
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
384 384
 			}
385 385
 
386 386
 			// Plugin Basename aka: "give/give.php"
387
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
388
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
387
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
388
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
389 389
 			}
390 390
 
391 391
 			// Make sure CAL_GREGORIAN is defined
392
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
393
-				define( 'CAL_GREGORIAN', 1 );
392
+			if ( ! defined('CAL_GREGORIAN')) {
393
+				define('CAL_GREGORIAN', 1);
394 394
 			}
395 395
 		}
396 396
 
@@ -408,152 +408,152 @@  discard block
 block discarded – undo
408 408
 			/**
409 409
 			 * Load libraries.
410 410
 			 */
411
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
412
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
411
+			if ( ! class_exists('WP_Async_Request')) {
412
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
413 413
 			}
414 414
 
415
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
416
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
415
+			if ( ! class_exists('WP_Background_Process')) {
416
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
417 417
 			}
418 418
 
419 419
 			/**
420 420
 			 * Load plugin files
421 421
 			 */
422
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
423
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
422
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
423
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
424 424
 			$give_options = give_get_settings();
425 425
 
426
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
427
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
428
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
429
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
430
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
431
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
432
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
433
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
434
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
435
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
436
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
437
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
438
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
439
-
440
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
441
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
442
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
443
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
444
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
445
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
446
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
447
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
448
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
449
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
450
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
451
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
452
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
453
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
454
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
455
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
456
-
457
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
458
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
459
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
460
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
461
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
462
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
463
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
464
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
465
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
466
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
467
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
468
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
469
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
470
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
471
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
472
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
473
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
474
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
475
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
476
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
477
-
478
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
479
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
480
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
481
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
482
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
484
-
485
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
486
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
488
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
489
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
490
-
491
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
492
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
497
-
498
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
499
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
500
-
501
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
502
-
503
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
504
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
426
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
427
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
428
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
429
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
430
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
431
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
432
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
433
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
434
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
435
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
436
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
437
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
438
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
439
+
440
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
441
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
442
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
443
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
444
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
445
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
446
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
447
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
448
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
449
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
450
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
451
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
452
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
453
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
454
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
455
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
456
+
457
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
458
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
459
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
460
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
461
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
462
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
463
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
464
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
465
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
466
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
467
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
468
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
469
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
470
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
471
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
472
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
473
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
474
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
475
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
476
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
477
+
478
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
479
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
480
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
481
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
484
+
485
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
486
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
488
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
489
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
490
+
491
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
492
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
497
+
498
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
499
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
500
+
501
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
502
+
503
+			if (defined('WP_CLI') && WP_CLI) {
504
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
505 505
 			}
506 506
 
507
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
508
-
509
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
510
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
511
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
512
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
513
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
514
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
515
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
516
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
517
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
518
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
519
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
520
-
521
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
522
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
523
-
524
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
525
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
526
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
527
-
528
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
529
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
530
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
531
-
532
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
533
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
534
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
535
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
536
-
537
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
538
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
539
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
540
-
541
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
542
-
543
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
544
-
545
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
546
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
547
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
548
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
549
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
550
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
551
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
552
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
553
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
507
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
508
+
509
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
510
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
511
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
512
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
513
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
514
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
515
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
516
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
517
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
518
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
519
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
520
+
521
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
522
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
523
+
524
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
525
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
526
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
527
+
528
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
529
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
530
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
531
+
532
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
533
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
534
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
535
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
536
+
537
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
538
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
539
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
540
+
541
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
542
+
543
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
544
+
545
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
546
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
547
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
548
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
549
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
550
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
551
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
552
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
553
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
554 554
 			}// End if().
555 555
 
556
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
556
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
557 557
 
558 558
 		}
559 559
 
@@ -568,16 +568,16 @@  discard block
 block discarded – undo
568 568
 		public function load_textdomain() {
569 569
 
570 570
 			// Set filter for Give's languages directory
571
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
572
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
571
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
572
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
573 573
 
574 574
 			// Traditional WordPress plugin locale filter.
575
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
576
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
575
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
576
+			$locale = apply_filters('plugin_locale', $locale, 'give');
577 577
 
578
-			unload_textdomain( 'give' );
579
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
580
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
578
+			unload_textdomain('give');
579
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
580
+			load_plugin_textdomain('give', false, $give_lang_dir);
581 581
 
582 582
 		}
583 583
 
@@ -590,17 +590,17 @@  discard block
 block discarded – undo
590 590
 		 */
591 591
 		public function minmum_phpversion_notice() {
592 592
 			// Bailout.
593
-			if ( ! is_admin() ) {
593
+			if ( ! is_admin()) {
594 594
 				return;
595 595
 			}
596 596
 
597
-			$notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
598
-			$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>';
599
-			$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>';
600
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
601
-			$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>';
602
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
603
-			$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>';
597
+			$notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
598
+			$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>';
599
+			$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>';
600
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
601
+			$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>';
602
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
603
+			$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>';
604 604
 
605 605
 			echo sprintf(
606 606
 				'<div class="notice notice-error">%1$s</div>',
Please login to merge, or discard this patch.
includes/class-give-db-form-meta.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->formmeta    = $this->table_name = $wpdb->prefix . 'give_formmeta';
53
+		$wpdb->formmeta    = $this->table_name = $wpdb->prefix.'give_formmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -84,6 +84,6 @@  discard block
 block discarded – undo
84 84
 	 * @return bool
85 85
 	 */
86 86
 	protected function is_custom_meta_table_active() {
87
-		return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' );
87
+		return give_has_upgrade_completed('v20_move_metadata_into_new_table');
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
includes/class-give-logging.php 1 patch
Spacing   +137 added lines, -137 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
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 		 * Setup properties
54 54
 		 */
55 55
 
56
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs.php';
57
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs-meta.php';
56
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs.php';
57
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs-meta.php';
58 58
 		$this->log_db     = new Give_DB_Logs();
59 59
 		$this->logmeta_db = new Give_DB_Log_Meta();
60 60
 
@@ -62,22 +62,22 @@  discard block
 block discarded – undo
62 62
 		 * Setup hooks.
63 63
 		 */
64 64
 
65
-		add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache' ) );
66
-		add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache' ) );
67
-		add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache' ) );
68
-		add_action( 'give_delete_log_cache', array( $this, 'delete_cache' ) );
69
-		add_action( 'update_log_metadata', array( $this, 'bc_200_set_payment_as_log_parent' ), 10, 4 );
65
+		add_action('save_post_give_payment', array($this, 'background_process_delete_cache'));
66
+		add_action('save_post_give_forms', array($this, 'background_process_delete_cache'));
67
+		add_action('save_post_give_log', array($this, 'background_process_delete_cache'));
68
+		add_action('give_delete_log_cache', array($this, 'delete_cache'));
69
+		add_action('update_log_metadata', array($this, 'bc_200_set_payment_as_log_parent'), 10, 4);
70 70
 
71 71
 		// Backward compatibility.
72
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
72
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
73 73
 			// Create the log post type
74
-			add_action( 'init', array( $this, 'register_post_type' ), -2 );
74
+			add_action('init', array($this, 'register_post_type'), -2);
75 75
 		}
76 76
 
77 77
 		// Create types taxonomy and default types
78 78
 		// @todo: remove this taxonomy, some addon use this taxonomy with there custom log post type for example: recurring
79 79
 		// Do not use this taxonomy with your log type because we will remove it in future releases.
80
-		add_action( 'init', array( $this, 'register_taxonomy' ), -2 );
80
+		add_action('init', array($this, 'register_taxonomy'), -2);
81 81
 	}
82 82
 
83 83
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		/* Logs post type */
96 96
 		$log_args = array(
97 97
 			'labels'              => array(
98
-				'name' => esc_html__( 'Logs', 'give' ),
98
+				'name' => esc_html__('Logs', 'give'),
99 99
 			),
100 100
 			'public'              => false,
101 101
 			'exclude_from_search' => true,
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 			'query_var'           => false,
105 105
 			'rewrite'             => false,
106 106
 			'capability_type'     => 'post',
107
-			'supports'            => array( 'title', 'editor' ),
107
+			'supports'            => array('title', 'editor'),
108 108
 			'can_export'          => true,
109 109
 		);
110 110
 
111
-		register_post_type( 'give_log', $log_args );
111
+		register_post_type('give_log', $log_args);
112 112
 	}
113 113
 
114 114
 	/**
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 	 * @return void
123 123
 	 */
124 124
 	public function register_taxonomy() {
125
-		register_taxonomy( 'give_log_type', 'give_log', array(
125
+		register_taxonomy('give_log_type', 'give_log', array(
126 126
 			'public' => false,
127
-		) );
127
+		));
128 128
 	}
129 129
 
130 130
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'update',
146 146
 		);
147 147
 
148
-		return apply_filters( 'give_log_types', $terms );
148
+		return apply_filters('give_log_types', $terms);
149 149
 	}
150 150
 
151 151
 	/**
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return bool         Whether log type is valid.
162 162
 	 */
163
-	public function valid_type( $type ) {
164
-		return in_array( $type, $this->log_types() );
163
+	public function valid_type($type) {
164
+		return in_array($type, $this->log_types());
165 165
 	}
166 166
 
167 167
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return int             Log ID.
182 182
 	 */
183
-	public function add( $title = '', $message = '', $parent = 0, $type = '' ) {
183
+	public function add($title = '', $message = '', $parent = 0, $type = '') {
184 184
 		$log_data = array(
185 185
 			'post_title'   => $title,
186 186
 			'post_content' => $message,
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 			'log_type'     => $type,
189 189
 		);
190 190
 
191
-		return $this->insert_log( $log_data );
191
+		return $this->insert_log($log_data);
192 192
 	}
193 193
 
194 194
 	/**
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @return array             An array of the connected logs.
207 207
 	 */
208
-	public function get_logs( $object_id = 0, $type = '', $paged = null ) {
209
-		return $this->get_connected_logs( array(
208
+	public function get_logs($object_id = 0, $type = '', $paged = null) {
209
+		return $this->get_connected_logs(array(
210 210
 			'log_parent' => $object_id,
211 211
 			'paged'      => $paged,
212 212
 			'log_type'   => $type,
213
-		) );
213
+		));
214 214
 	}
215 215
 
216 216
 	/**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return int             The ID of the newly created log item.
226 226
 	 */
227
-	public function insert_log( $log_data = array(), $log_meta = array() ) {
227
+	public function insert_log($log_data = array(), $log_meta = array()) {
228 228
 		$log_id = 0;
229 229
 
230 230
 		$defaults = array(
@@ -237,28 +237,28 @@  discard block
 block discarded – undo
237 237
 			'post_status' => 'publish',
238 238
 		);
239 239
 
240
-		$args = wp_parse_args( $log_data, $defaults );
241
-		$this->bc_200_validate_params( $args, $log_meta );
240
+		$args = wp_parse_args($log_data, $defaults);
241
+		$this->bc_200_validate_params($args, $log_meta);
242 242
 
243
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
243
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
244 244
 			global $wpdb;
245 245
 
246 246
 			// Backward Compatibility.
247
-			if ( ! $wpdb->get_var( "SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1" ) ) {
248
-				$latest_log_id = $wpdb->get_var( "SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1" );
249
-				$latest_log_id = empty( $latest_log_id ) ? 1 : ++ $latest_log_id;
247
+			if ( ! $wpdb->get_var("SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1")) {
248
+				$latest_log_id = $wpdb->get_var("SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1");
249
+				$latest_log_id = empty($latest_log_id) ? 1 : ++ $latest_log_id;
250 250
 
251 251
 				$args['ID'] = $latest_log_id;
252
-				$this->log_db->insert( $args );
252
+				$this->log_db->insert($args);
253 253
 			}
254 254
 		}
255 255
 
256
-		$log_id = $this->log_db->add( $args );
256
+		$log_id = $this->log_db->add($args);
257 257
 
258 258
 		// Set log meta, if any
259
-		if ( $log_id && ! empty( $log_meta ) ) {
260
-			foreach ( (array) $log_meta as $key => $meta ) {
261
-				$this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
259
+		if ($log_id && ! empty($log_meta)) {
260
+			foreach ((array) $log_meta as $key => $meta) {
261
+				$this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
262 262
 			}
263 263
 		}
264 264
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @return bool|null       True if successful, false otherwise.
282 282
 	 */
283
-	public function update_log( $log_data = array(), $log_meta = array() ) {
283
+	public function update_log($log_data = array(), $log_meta = array()) {
284 284
 		$log_id = 0;
285 285
 
286 286
 		/**
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 		 * @param array $log_data Log entry data.
292 292
 		 * @param array $log_meta Log entry meta.
293 293
 		 */
294
-		do_action( 'give_pre_update_log', $log_data, $log_meta );
294
+		do_action('give_pre_update_log', $log_data, $log_meta);
295 295
 
296 296
 		$defaults = array(
297 297
 			'log_parent'  => 0,
@@ -301,28 +301,28 @@  discard block
 block discarded – undo
301 301
 			'post_status' => 'publish',
302 302
 		);
303 303
 
304
-		$args = wp_parse_args( $log_data, $defaults );
305
-		$this->bc_200_validate_params( $args, $log_meta );
304
+		$args = wp_parse_args($log_data, $defaults);
305
+		$this->bc_200_validate_params($args, $log_meta);
306 306
 
307 307
 		// Store the log entry
308
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
308
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
309 309
 			// Backward compatibility.
310
-			$log_id = wp_update_post( $args );
310
+			$log_id = wp_update_post($args);
311 311
 
312
-			if ( $log_id && ! empty( $log_meta ) ) {
313
-				foreach ( (array) $log_meta as $key => $meta ) {
314
-					if ( ! empty( $meta ) ) {
315
-						give_update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
312
+			if ($log_id && ! empty($log_meta)) {
313
+				foreach ((array) $log_meta as $key => $meta) {
314
+					if ( ! empty($meta)) {
315
+						give_update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
316 316
 					}
317 317
 				}
318 318
 			}
319 319
 		} else {
320
-			$log_id = $this->log_db->add( $args );
320
+			$log_id = $this->log_db->add($args);
321 321
 
322
-			if ( $log_id && ! empty( $log_meta ) ) {
323
-				foreach ( (array) $log_meta as $key => $meta ) {
324
-					if ( ! empty( $meta ) ) {
325
-						$this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
322
+			if ($log_id && ! empty($log_meta)) {
323
+				foreach ((array) $log_meta as $key => $meta) {
324
+					if ( ! empty($meta)) {
325
+						$this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
326 326
 					}
327 327
 				}
328 328
 			}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		 * @param array $log_data Log entry data.
338 338
 		 * @param array $log_meta Log entry meta.
339 339
 		 */
340
-		do_action( 'give_post_update_log', $log_id, $log_data, $log_meta );
340
+		do_action('give_post_update_log', $log_id, $log_data, $log_meta);
341 341
 	}
342 342
 
343 343
 	/**
@@ -354,30 +354,30 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return array|false Array if logs were found, false otherwise.
356 356
 	 */
357
-	public function get_connected_logs( $args = array() ) {
357
+	public function get_connected_logs($args = array()) {
358 358
 		$logs = array();
359 359
 
360
-		$defaults   = array(
360
+		$defaults = array(
361 361
 			'number'      => 20,
362
-			'paged'       => get_query_var( 'paged' ),
362
+			'paged'       => get_query_var('paged'),
363 363
 			'log_type'    => false,
364 364
 
365 365
 			// Backward compatibility.
366 366
 			'post_type'   => 'give_log',
367 367
 			'post_status' => 'publish',
368 368
 		);
369
-		$query_args = wp_parse_args( $args, $defaults );
370
-		$this->bc_200_validate_params( $query_args );
369
+		$query_args = wp_parse_args($args, $defaults);
370
+		$this->bc_200_validate_params($query_args);
371 371
 
372
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
372
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
373 373
 			// Backward compatibility.
374
-			$logs = get_posts( $query_args );
375
-			$this->bc_200_add_new_properties( $logs );
374
+			$logs = get_posts($query_args);
375
+			$this->bc_200_add_new_properties($logs);
376 376
 		} else {
377
-			$logs = $this->log_db->get_logs( $query_args );
377
+			$logs = $this->log_db->get_logs($query_args);
378 378
 		}
379 379
 
380
-		return ( ! empty( $logs ) ? $logs : false );
380
+		return ( ! empty($logs) ? $logs : false);
381 381
 	}
382 382
 
383 383
 	/**
@@ -395,41 +395,41 @@  discard block
 block discarded – undo
395 395
 	 *
396 396
 	 * @return int                Log count.
397 397
 	 */
398
-	public function get_log_count( $object_id = 0, $type = '', $meta_query = null, $date_query = null ) {
398
+	public function get_log_count($object_id = 0, $type = '', $meta_query = null, $date_query = null) {
399 399
 		$logs_count = 0;
400 400
 
401 401
 		$query_args = array(
402
-			'number'      => - 1,
402
+			'number'      => -1,
403 403
 
404 404
 			// Backward comatibility.
405 405
 			'post_type'   => 'give_log',
406 406
 			'post_status' => 'publish',
407 407
 		);
408 408
 
409
-		if ( $object_id ) {
409
+		if ($object_id) {
410 410
 			$query_args['log_parent'] = $object_id;
411 411
 		}
412 412
 
413
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
413
+		if ( ! empty($type) && $this->valid_type($type)) {
414 414
 			$query_args['log_type'] = $type;
415 415
 		}
416 416
 
417
-		if ( ! empty( $meta_query ) ) {
417
+		if ( ! empty($meta_query)) {
418 418
 			$query_args['meta_query'] = $meta_query;
419 419
 		}
420 420
 
421
-		if ( ! empty( $date_query ) ) {
421
+		if ( ! empty($date_query)) {
422 422
 			$query_args['date_query'] = $date_query;
423 423
 		}
424 424
 
425
-		$this->bc_200_validate_params( $query_args );
425
+		$this->bc_200_validate_params($query_args);
426 426
 
427
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
427
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
428 428
 			// Backward compatibility.
429
-			$logs       = new WP_Query( $query_args );
429
+			$logs       = new WP_Query($query_args);
430 430
 			$logs_count = (int) $logs->post_count;
431 431
 		} else {
432
-			$logs_count = $this->log_db->count( $query_args );
432
+			$logs_count = $this->log_db->count($query_args);
433 433
 		}
434 434
 
435 435
 		return $logs_count;
@@ -449,10 +449,10 @@  discard block
 block discarded – undo
449 449
 	 *
450 450
 	 * @return void
451 451
 	 */
452
-	public function delete_logs( $object_id = 0, $type = '', $meta_query = null ) {
452
+	public function delete_logs($object_id = 0, $type = '', $meta_query = null) {
453 453
 		$query_args = array(
454 454
 			'log_parent'  => $object_id,
455
-			'number'      => - 1,
455
+			'number'      => -1,
456 456
 			'fields'      => 'ID',
457 457
 
458 458
 			// Backward compatibility.
@@ -460,32 +460,32 @@  discard block
 block discarded – undo
460 460
 			'post_status' => 'publish',
461 461
 		);
462 462
 
463
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
463
+		if ( ! empty($type) && $this->valid_type($type)) {
464 464
 			$query_args['log_type'] = $type;
465 465
 		}
466 466
 
467
-		if ( ! empty( $meta_query ) ) {
467
+		if ( ! empty($meta_query)) {
468 468
 			$query_args['meta_query'] = $meta_query;
469 469
 		}
470 470
 
471
-		$this->bc_200_validate_params( $query_args );
471
+		$this->bc_200_validate_params($query_args);
472 472
 
473
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
473
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
474 474
 			// Backward compatibility.
475
-			$logs = get_posts( $query_args );
475
+			$logs = get_posts($query_args);
476 476
 
477
-			if ( $logs ) {
478
-				foreach ( $logs as $log ) {
479
-					wp_delete_post( $log, true );
477
+			if ($logs) {
478
+				foreach ($logs as $log) {
479
+					wp_delete_post($log, true);
480 480
 				}
481 481
 			}
482 482
 		} else {
483
-			$logs = $this->log_db->get_logs( $query_args );
483
+			$logs = $this->log_db->get_logs($query_args);
484 484
 
485
-			if ( $logs ) {
486
-				foreach ( $logs as $log ) {
487
-					if ( $this->log_db->delete( $log->ID ) ) {
488
-						$this->logmeta_db->delete_row( $log->ID );
485
+			if ($logs) {
486
+				foreach ($logs as $log) {
487
+					if ($this->log_db->delete($log->ID)) {
488
+						$this->logmeta_db->delete_row($log->ID);
489 489
 					}
490 490
 				}
491 491
 			}
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @param int $post_id
504 504
 	 */
505
-	public function background_process_delete_cache( $post_id ) {
505
+	public function background_process_delete_cache($post_id) {
506 506
 		// Delete log cache immediately
507
-		wp_schedule_single_event( time() - 5, 'give_delete_log_cache' );
507
+		wp_schedule_single_event(time() - 5, 'give_delete_log_cache');
508 508
 	}
509 509
 
510 510
 	/**
@@ -517,17 +517,17 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	public function delete_cache() {
519 519
 		// Add log related keys to delete.
520
-		$cache_give_logs      = Give_Cache::get_options_like( 'give_logs' );
521
-		$cache_give_log_count = Give_Cache::get_options_like( 'log_count' );
520
+		$cache_give_logs      = Give_Cache::get_options_like('give_logs');
521
+		$cache_give_log_count = Give_Cache::get_options_like('log_count');
522 522
 
523
-		$cache_option_names = array_merge( $cache_give_logs, $cache_give_log_count );
523
+		$cache_option_names = array_merge($cache_give_logs, $cache_give_log_count);
524 524
 
525 525
 		// Bailout.
526
-		if ( empty( $cache_option_names ) ) {
526
+		if (empty($cache_option_names)) {
527 527
 			return false;
528 528
 		}
529 529
 
530
-		Give_Cache::delete( $cache_option_names );
530
+		Give_Cache::delete($cache_option_names);
531 531
 	}
532 532
 
533 533
 	/**
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	 * @param array $log_query
540 540
 	 * @param array $log_meta
541 541
 	 */
542
-	private function bc_200_validate_params( &$log_query, &$log_meta = array() ) {
542
+	private function bc_200_validate_params(&$log_query, &$log_meta = array()) {
543 543
 		$query_params = array(
544 544
 			'log_title'    => 'post_title',
545 545
 			'log_parent'   => 'post_parent',
@@ -551,41 +551,41 @@  discard block
 block discarded – undo
551 551
 			'meta_query'   => 'meta_query',
552 552
 		);
553 553
 
554
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
554
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
555 555
 			// Set old params.
556
-			foreach ( $query_params as $new_query_param => $old_query_param ) {
556
+			foreach ($query_params as $new_query_param => $old_query_param) {
557 557
 
558
-				if ( isset( $log_query[ $old_query_param ] ) && empty( $log_query[ $new_query_param ] ) ) {
559
-					$log_query[ $new_query_param ] = $log_query[ $old_query_param ];
558
+				if (isset($log_query[$old_query_param]) && empty($log_query[$new_query_param])) {
559
+					$log_query[$new_query_param] = $log_query[$old_query_param];
560 560
 					continue;
561
-				} elseif ( ! isset( $log_query[ $new_query_param ] ) ) {
561
+				} elseif ( ! isset($log_query[$new_query_param])) {
562 562
 					continue;
563
-				} elseif( empty( $log_query[ $new_query_param ] ) ) {
563
+				} elseif (empty($log_query[$new_query_param])) {
564 564
 					continue;
565 565
 				}
566 566
 
567
-				switch ( $new_query_param ) {
567
+				switch ($new_query_param) {
568 568
 					case 'log_type':
569 569
 						$log_query['tax_query'] = array(
570 570
 							array(
571 571
 								'taxonomy' => 'give_log_type',
572 572
 								'field'    => 'slug',
573
-								'terms'    => $log_query[ $new_query_param ],
573
+								'terms'    => $log_query[$new_query_param],
574 574
 							),
575 575
 						);
576 576
 						break;
577 577
 
578 578
 					case 'meta_query':
579
-						if( ! empty( $log_query['meta_query'] ) && empty( $log_query['post_parent'] ) ) {
580
-							foreach ( $log_query['meta_query'] as $index => $meta_query ){
581
-								if( ! is_array( $meta_query ) || empty( $meta_query['key'] ) ) {
579
+						if ( ! empty($log_query['meta_query']) && empty($log_query['post_parent'])) {
580
+							foreach ($log_query['meta_query'] as $index => $meta_query) {
581
+								if ( ! is_array($meta_query) || empty($meta_query['key'])) {
582 582
 									continue;
583 583
 								}
584 584
 
585
-								switch ( $meta_query['key'] ) {
585
+								switch ($meta_query['key']) {
586 586
 									case '_give_log_form_id':
587 587
 										$log_query['post_parent'] = $meta_query['value'];
588
-										unset( $log_query['meta_query'][$index] );
588
+										unset($log_query['meta_query'][$index]);
589 589
 										break;
590 590
 								}
591 591
 							}
@@ -593,40 +593,40 @@  discard block
 block discarded – undo
593 593
 						break;
594 594
 
595 595
 					default:
596
-						switch( $new_query_param ){
596
+						switch ($new_query_param) {
597 597
 							case 'log_parent':
598 598
 								$log_query['meta_query'][] = array(
599 599
 									'key' => '_give_log_payment_id',
600
-									'value' => $log_query[ $new_query_param ]
600
+									'value' => $log_query[$new_query_param]
601 601
 								);
602 602
 
603 603
 								break;
604 604
 
605 605
 							default:
606
-								$log_query[ $old_query_param ] = $log_query[ $new_query_param ];
606
+								$log_query[$old_query_param] = $log_query[$new_query_param];
607 607
 						}
608 608
 				}
609 609
 			}
610 610
 		} else {
611 611
 			// Set only old params.
612
-			$query_params = array_flip( $query_params );
613
-			foreach ( $query_params as $old_query_param => $new_query_param ) {
614
-				if ( isset( $log_query[ $new_query_param ] ) && empty( $log_query[ $old_query_param ] ) ) {
615
-					$log_query[ $old_query_param ] = $log_query[ $new_query_param ];
612
+			$query_params = array_flip($query_params);
613
+			foreach ($query_params as $old_query_param => $new_query_param) {
614
+				if (isset($log_query[$new_query_param]) && empty($log_query[$old_query_param])) {
615
+					$log_query[$old_query_param] = $log_query[$new_query_param];
616 616
 					continue;
617
-				} elseif ( ! isset( $log_query[ $old_query_param ] ) ) {
617
+				} elseif ( ! isset($log_query[$old_query_param])) {
618 618
 					continue;
619 619
 				}
620 620
 
621
-				switch ( $old_query_param ) {
621
+				switch ($old_query_param) {
622 622
 					case 'tax_query':
623
-						if ( isset( $log_query[ $old_query_param ][0]['terms'] ) ) {
624
-							$log_query[ $new_query_param ] = $log_query[ $old_query_param ][0]['terms'];
623
+						if (isset($log_query[$old_query_param][0]['terms'])) {
624
+							$log_query[$new_query_param] = $log_query[$old_query_param][0]['terms'];
625 625
 						}
626 626
 						break;
627 627
 
628 628
 					default:
629
-						$log_query[ $new_query_param ] = $log_query[ $old_query_param ];
629
+						$log_query[$new_query_param] = $log_query[$old_query_param];
630 630
 				}
631 631
 			}
632 632
 		}
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 *
641 641
 	 * @param  array $logs
642 642
 	 */
643
-	private function bc_200_add_new_properties( &$logs ) {
644
-		if ( empty( $logs ) ) {
643
+	private function bc_200_add_new_properties(&$logs) {
644
+		if (empty($logs)) {
645 645
 			return;
646 646
 		}
647 647
 
@@ -654,30 +654,30 @@  discard block
 block discarded – undo
654 654
 			'log_type'     => 'give_log_type',
655 655
 		);
656 656
 
657
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
658
-			foreach ( $logs as $index => $log ) {
659
-				foreach ( $query_params as $new_query_param => $old_query_param ) {
660
-					if ( ! property_exists( $log, $old_query_param ) ) {
657
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
658
+			foreach ($logs as $index => $log) {
659
+				foreach ($query_params as $new_query_param => $old_query_param) {
660
+					if ( ! property_exists($log, $old_query_param)) {
661 661
 						/**
662 662
 						 *  Set unmatched properties.
663 663
 						 */
664 664
 
665 665
 						// 1. log_type
666
-						$term = get_the_terms( $log->ID, 'give_log_type' );
667
-						$term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
666
+						$term = get_the_terms($log->ID, 'give_log_type');
667
+						$term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
668 668
 
669
-						$logs[ $index ]->{$new_query_param} = ! empty( $term ) ? $term->slug : '';
669
+						$logs[$index]->{$new_query_param} = ! empty($term) ? $term->slug : '';
670 670
 
671 671
 						continue;
672 672
 					}
673 673
 
674
-					switch ( $old_query_param ) {
674
+					switch ($old_query_param) {
675 675
 						case 'post_parent':
676
-							$logs[ $index ]->{$new_query_param} = give_get_meta( $log->ID, '_give_log_payment_id', true );
676
+							$logs[$index]->{$new_query_param} = give_get_meta($log->ID, '_give_log_payment_id', true);
677 677
 							break;
678 678
 
679 679
 						default:
680
-							$logs[ $index ]->{$new_query_param} = $log->{$old_query_param};
680
+							$logs[$index]->{$new_query_param} = $log->{$old_query_param};
681 681
 					}
682 682
 				}
683 683
 			}
@@ -697,10 +697,10 @@  discard block
 block discarded – undo
697 697
 	 *
698 698
 	 * @return mixed
699 699
 	 */
700
-	public function bc_200_set_payment_as_log_parent( $check, $log_id, $meta_key, $meta_value ) {
700
+	public function bc_200_set_payment_as_log_parent($check, $log_id, $meta_key, $meta_value) {
701 701
 		global $wpdb;
702 702
 		$update_status = false;
703
-		$post_type     = get_post_type( $log_id );
703
+		$post_type     = get_post_type($log_id);
704 704
 
705 705
 		// Bailout.
706 706
 		if (
@@ -720,9 +720,9 @@  discard block
 block discarded – undo
720 720
 			)
721 721
 		);
722 722
 
723
-		if ( $form_id ) {
724
-			$this->logmeta_db->delete_meta( $log_id, '_give_log_payment_id' );
725
-			$this->logmeta_db->update_meta( $log_id, '_give_log_form_id', $form_id );
723
+		if ($form_id) {
724
+			$this->logmeta_db->delete_meta($log_id, '_give_log_payment_id');
725
+			$this->logmeta_db->update_meta($log_id, '_give_log_form_id', $form_id);
726 726
 
727 727
 			$update_status = $wpdb->update(
728 728
 				$this->log_db->table_name,
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +456 added lines, -456 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,77 +25,77 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_automatic_upgrades() {
27 27
 	$did_upgrade  = false;
28
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
28
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
29 29
 
30
-	if ( ! $give_version ) {
30
+	if ( ! $give_version) {
31 31
 		// 1.0 is the first version to use this option so we must add it.
32 32
 		$give_version = '1.0';
33 33
 	}
34 34
 
35
-	switch ( true ) {
35
+	switch (true) {
36 36
 
37
-		case version_compare( $give_version, '1.6', '<' ) :
37
+		case version_compare($give_version, '1.6', '<') :
38 38
 			give_v16_upgrades();
39 39
 			$did_upgrade = true;
40 40
 
41
-		case version_compare( $give_version, '1.7', '<' ) :
41
+		case version_compare($give_version, '1.7', '<') :
42 42
 			give_v17_upgrades();
43 43
 			$did_upgrade = true;
44 44
 
45
-		case version_compare( $give_version, '1.8', '<' ) :
45
+		case version_compare($give_version, '1.8', '<') :
46 46
 			give_v18_upgrades();
47 47
 			$did_upgrade = true;
48 48
 
49
-		case version_compare( $give_version, '1.8.7', '<' ) :
49
+		case version_compare($give_version, '1.8.7', '<') :
50 50
 			give_v187_upgrades();
51 51
 			$did_upgrade = true;
52 52
 
53
-		case version_compare( $give_version, '1.8.8', '<' ) :
53
+		case version_compare($give_version, '1.8.8', '<') :
54 54
 			give_v188_upgrades();
55 55
 			$did_upgrade = true;
56 56
 
57
-		case version_compare( $give_version, '1.8.9', '<' ) :
57
+		case version_compare($give_version, '1.8.9', '<') :
58 58
 			give_v189_upgrades();
59 59
 			$did_upgrade = true;
60 60
 
61
-		case version_compare( $give_version, '1.8.12', '<' ) :
61
+		case version_compare($give_version, '1.8.12', '<') :
62 62
 			give_v1812_upgrades();
63 63
 			$did_upgrade = true;
64 64
 
65
-		case version_compare( $give_version, '1.8.13', '<' ) :
65
+		case version_compare($give_version, '1.8.13', '<') :
66 66
 			give_v1813_upgrades();
67 67
 			$did_upgrade = true;
68 68
 
69
-		case version_compare( $give_version, '1.8.17', '<' ) :
69
+		case version_compare($give_version, '1.8.17', '<') :
70 70
 			give_v1817_upgrades();
71 71
 			$did_upgrade = true;
72 72
 
73
-		case version_compare( $give_version, '1.8.18', '<' ) :
73
+		case version_compare($give_version, '1.8.18', '<') :
74 74
 			give_v1818_upgrades();
75 75
 			$did_upgrade = true;
76 76
 
77
-		case version_compare( $give_version, '2.0', '<' ) :
77
+		case version_compare($give_version, '2.0', '<') :
78 78
 			give_v20_upgrades();
79 79
 			$did_upgrade = true;
80 80
 
81
-		case version_compare( $give_version, '2.0.1', '<' ) :
81
+		case version_compare($give_version, '2.0.1', '<') :
82 82
 			// Do nothing on fresh install.
83
-			if( ! doing_action( 'give_upgrades' ) ) {
83
+			if ( ! doing_action('give_upgrades')) {
84 84
 				give_v201_create_tables();
85
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
85
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
86 86
 				Give_Updates::$background_updater->dispatch();
87 87
 			}
88 88
 
89 89
 			$did_upgrade = true;
90 90
 	}
91 91
 
92
-	if ( $did_upgrade ) {
93
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
92
+	if ($did_upgrade) {
93
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
94 94
 	}
95 95
 }
96 96
 
97
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
98
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
97
+add_action('admin_init', 'give_do_automatic_upgrades');
98
+add_action('give_upgrades', 'give_do_automatic_upgrades');
99 99
 
100 100
 /**
101 101
  * Display Upgrade Notices.
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
  *
110 110
  * @return void
111 111
  */
112
-function give_show_upgrade_notices( $give_updates ) {
112
+function give_show_upgrade_notices($give_updates) {
113 113
 	// v1.3.2 Upgrades
114 114
 	$give_updates->register(
115 115
 		array(
@@ -175,32 +175,32 @@  discard block
 block discarded – undo
175 175
 	);
176 176
 
177 177
 	// v1.8.17 Upgrades for donations.
178
-	$give_updates->register( array(
178
+	$give_updates->register(array(
179 179
 		'id'       => 'v1817_update_donation_iranian_currency_code',
180 180
 		'version'  => '1.8.17',
181 181
 		'callback' => 'give_v1817_update_donation_iranian_currency_code',
182
-	) );
182
+	));
183 183
 
184 184
 	// v1.8.17 Upgrades for cleanup of user roles.
185
-	$give_updates->register( array(
185
+	$give_updates->register(array(
186 186
 		'id'       => 'v1817_cleanup_user_roles',
187 187
 		'version'  => '1.8.17',
188 188
 		'callback' => 'give_v1817_cleanup_user_roles',
189
-	) );
189
+	));
190 190
 
191 191
 	// v1.8.18 Upgrades for assigning custom amount to existing set donations.
192
-	$give_updates->register( array(
192
+	$give_updates->register(array(
193 193
 		'id'       => 'v1818_assign_custom_amount_set_donation',
194 194
 		'version'  => '1.8.18',
195 195
 		'callback' => 'give_v1818_assign_custom_amount_set_donation',
196
-	) );
196
+	));
197 197
 
198 198
 	// v1.8.18 Cleanup the Give Worker Role Caps.
199
-	$give_updates->register( array(
199
+	$give_updates->register(array(
200 200
 		'id'       => 'v1818_give_worker_role_cleanup',
201 201
 		'version'  => '1.8.18',
202 202
 		'callback' => 'give_v1818_give_worker_role_cleanup',
203
-	) );
203
+	));
204 204
 
205 205
 	// v2.0.0 Upgrades
206 206
 	$give_updates->register(
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			'id'       => 'v20_move_metadata_into_new_table',
255 255
 			'version'  => '2.0.0',
256 256
 			'callback' => 'give_v20_move_metadata_into_new_table_callback',
257
-			'depend'   => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ),
257
+			'depend'   => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'),
258 258
 		)
259 259
 	);
260 260
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 			'id'       => 'v201_move_metadata_into_new_table',
301 301
 			'version'  => '2.0.1',
302 302
 			'callback' => 'give_v201_move_metadata_into_new_table_callback',
303
-			'depend'   => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ),
303
+			'depend'   => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'),
304 304
 		)
305 305
 	);
306 306
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	);
316 316
 }
317 317
 
318
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
318
+add_action('give_register_updates', 'give_show_upgrade_notices');
319 319
 
320 320
 /**
321 321
  * Triggers all upgrade functions
@@ -327,29 +327,29 @@  discard block
 block discarded – undo
327 327
  */
328 328
 function give_trigger_upgrades() {
329 329
 
330
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
331
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
330
+	if ( ! current_user_can('manage_give_settings')) {
331
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
332 332
 			'response' => 403,
333
-		) );
333
+		));
334 334
 	}
335 335
 
336
-	$give_version = get_option( 'give_version' );
336
+	$give_version = get_option('give_version');
337 337
 
338
-	if ( ! $give_version ) {
338
+	if ( ! $give_version) {
339 339
 		// 1.0 is the first version to use this option so we must add it.
340 340
 		$give_version = '1.0';
341
-		add_option( 'give_version', $give_version );
341
+		add_option('give_version', $give_version);
342 342
 	}
343 343
 
344
-	update_option( 'give_version', GIVE_VERSION );
345
-	delete_option( 'give_doing_upgrade' );
344
+	update_option('give_version', GIVE_VERSION);
345
+	delete_option('give_doing_upgrade');
346 346
 
347
-	if ( DOING_AJAX ) {
348
-		die( 'complete' );
347
+	if (DOING_AJAX) {
348
+		die('complete');
349 349
 	} // End if().
350 350
 }
351 351
 
352
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
352
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
353 353
 
354 354
 
355 355
 /**
@@ -365,20 +365,20 @@  discard block
 block discarded – undo
365 365
 	/* @var Give_Updates $give_updates */
366 366
 	$give_updates = Give_Updates::get_instance();
367 367
 
368
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
369
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
368
+	if ( ! current_user_can('manage_give_settings')) {
369
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
370 370
 			'response' => 403,
371
-		) );
371
+		));
372 372
 	}
373 373
 
374 374
 	give_ignore_user_abort();
375 375
 
376 376
 	// UPDATE DB METAKEYS.
377 377
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
378
-	$query = $wpdb->query( $sql );
378
+	$query = $wpdb->query($sql);
379 379
 
380 380
 	$give_updates->percentage = 100;
381
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
381
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
382 382
 }
383 383
 
384 384
 
@@ -402,24 +402,24 @@  discard block
 block discarded – undo
402 402
 	$where  .= "AND ( p.post_status = 'abandoned' )";
403 403
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
404 404
 
405
-	$sql            = $select . $join . $where;
406
-	$found_payments = $wpdb->get_col( $sql );
405
+	$sql            = $select.$join.$where;
406
+	$found_payments = $wpdb->get_col($sql);
407 407
 
408
-	foreach ( $found_payments as $payment ) {
408
+	foreach ($found_payments as $payment) {
409 409
 
410 410
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
411
-		$modified_time = get_post_modified_time( 'U', false, $payment );
411
+		$modified_time = get_post_modified_time('U', false, $payment);
412 412
 
413 413
 		// 1450124863 =  12/10/2015 20:42:25.
414
-		if ( $modified_time >= 1450124863 ) {
414
+		if ($modified_time >= 1450124863) {
415 415
 
416
-			give_update_payment_status( $payment, 'pending' );
416
+			give_update_payment_status($payment, 'pending');
417 417
 
418 418
 		}
419 419
 	}
420 420
 
421 421
 	$give_updates->percentage = 100;
422
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
422
+	give_set_upgrade_complete('upgrade_give_offline_status');
423 423
 }
424 424
 
425 425
 
@@ -432,17 +432,17 @@  discard block
 block discarded – undo
432 432
  */
433 433
 function give_v152_cleanup_users() {
434 434
 
435
-	$give_version = get_option( 'give_version' );
435
+	$give_version = get_option('give_version');
436 436
 
437
-	if ( ! $give_version ) {
437
+	if ( ! $give_version) {
438 438
 		// 1.0 is the first version to use this option so we must add it.
439 439
 		$give_version = '1.0';
440 440
 	}
441 441
 
442
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
442
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
443 443
 
444 444
 	// v1.5.2 Upgrades
445
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
445
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
446 446
 
447 447
 		// Delete all caps with "ss".
448 448
 		// Also delete all unused "campaign" roles.
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
 		);
490 490
 
491 491
 		global $wp_roles;
492
-		foreach ( $delete_caps as $cap ) {
493
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
494
-				$wp_roles->remove_cap( $role, $cap );
492
+		foreach ($delete_caps as $cap) {
493
+			foreach (array_keys($wp_roles->roles) as $role) {
494
+				$wp_roles->remove_cap($role, $cap);
495 495
 			}
496 496
 		}
497 497
 
@@ -501,15 +501,15 @@  discard block
 block discarded – undo
501 501
 		$roles->add_caps();
502 502
 
503 503
 		// The Update Ran.
504
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
505
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
506
-		delete_option( 'give_doing_upgrade' );
504
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
505
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
506
+		delete_option('give_doing_upgrade');
507 507
 
508 508
 	}// End if().
509 509
 
510 510
 }
511 511
 
512
-add_action( 'admin_init', 'give_v152_cleanup_users' );
512
+add_action('admin_init', 'give_v152_cleanup_users');
513 513
 
514 514
 /**
515 515
  * 1.6 Upgrade routine to create the customer meta table.
@@ -552,53 +552,53 @@  discard block
 block discarded – undo
552 552
 
553 553
 	// Get addons license key.
554 554
 	$addons = array();
555
-	foreach ( $give_options as $key => $value ) {
556
-		if ( false !== strpos( $key, '_license_key' ) ) {
557
-			$addons[ $key ] = $value;
555
+	foreach ($give_options as $key => $value) {
556
+		if (false !== strpos($key, '_license_key')) {
557
+			$addons[$key] = $value;
558 558
 		}
559 559
 	}
560 560
 
561 561
 	// Bailout: We do not have any addon license data to upgrade.
562
-	if ( empty( $addons ) ) {
562
+	if (empty($addons)) {
563 563
 		return false;
564 564
 	}
565 565
 
566
-	foreach ( $addons as $key => $addon_license ) {
566
+	foreach ($addons as $key => $addon_license) {
567 567
 
568 568
 		// Get addon shortname.
569
-		$shortname = str_replace( '_license_key', '', $key );
569
+		$shortname = str_replace('_license_key', '', $key);
570 570
 
571 571
 		// Addon license option name.
572
-		$addon_license_option_name = $shortname . '_license_active';
572
+		$addon_license_option_name = $shortname.'_license_active';
573 573
 
574 574
 		// bailout if license is empty.
575
-		if ( empty( $addon_license ) ) {
576
-			delete_option( $addon_license_option_name );
575
+		if (empty($addon_license)) {
576
+			delete_option($addon_license_option_name);
577 577
 			continue;
578 578
 		}
579 579
 
580 580
 		// Get addon name.
581 581
 		$addon_name       = array();
582
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
583
-		foreach ( $addon_name_parts as $name_part ) {
582
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
583
+		foreach ($addon_name_parts as $name_part) {
584 584
 
585 585
 			// Fix addon name
586
-			switch ( $name_part ) {
586
+			switch ($name_part) {
587 587
 				case 'authorizenet' :
588 588
 					$name_part = 'authorize.net';
589 589
 					break;
590 590
 			}
591 591
 
592
-			$addon_name[] = ucfirst( $name_part );
592
+			$addon_name[] = ucfirst($name_part);
593 593
 		}
594 594
 
595
-		$addon_name = implode( ' ', $addon_name );
595
+		$addon_name = implode(' ', $addon_name);
596 596
 
597 597
 		// Data to send to the API.
598 598
 		$api_params = array(
599 599
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
600 600
 			'license'    => $addon_license,
601
-			'item_name'  => urlencode( $addon_name ),
601
+			'item_name'  => urlencode($addon_name),
602 602
 			'url'        => home_url(),
603 603
 		);
604 604
 
@@ -613,17 +613,17 @@  discard block
 block discarded – undo
613 613
 		);
614 614
 
615 615
 		// Make sure there are no errors.
616
-		if ( is_wp_error( $response ) ) {
617
-			delete_option( $addon_license_option_name );
616
+		if (is_wp_error($response)) {
617
+			delete_option($addon_license_option_name);
618 618
 			continue;
619 619
 		}
620 620
 
621 621
 		// Tell WordPress to look for updates.
622
-		set_site_transient( 'update_plugins', null );
622
+		set_site_transient('update_plugins', null);
623 623
 
624 624
 		// Decode license data.
625
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
626
-		update_option( $addon_license_option_name, $license_data );
625
+		$license_data = json_decode(wp_remote_retrieve_body($response));
626
+		update_option($addon_license_option_name, $license_data);
627 627
 	}// End foreach().
628 628
 }
629 629
 
@@ -653,9 +653,9 @@  discard block
 block discarded – undo
653 653
 	);
654 654
 
655 655
 	global $wp_roles;
656
-	foreach ( $delete_caps as $cap ) {
657
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
658
-			$wp_roles->remove_cap( $role, $cap );
656
+	foreach ($delete_caps as $cap) {
657
+		foreach (array_keys($wp_roles->roles) as $role) {
658
+			$wp_roles->remove_cap($role, $cap);
659 659
 		}
660 660
 	}
661 661
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 function give_v18_upgrades_core_setting() {
690 690
 	// Core settings which changes from checkbox to radio.
691 691
 	$core_setting_names = array_merge(
692
-		array_keys( give_v18_renamed_core_settings() ),
692
+		array_keys(give_v18_renamed_core_settings()),
693 693
 		array(
694 694
 			'uninstall_on_delete',
695 695
 			'scripts_footer',
@@ -701,48 +701,48 @@  discard block
 block discarded – undo
701 701
 	);
702 702
 
703 703
 	// Bailout: If not any setting define.
704
-	if ( $give_settings = get_option( 'give_settings' ) ) {
704
+	if ($give_settings = get_option('give_settings')) {
705 705
 
706 706
 		$setting_changed = false;
707 707
 
708 708
 		// Loop: check each setting field.
709
-		foreach ( $core_setting_names as $setting_name ) {
709
+		foreach ($core_setting_names as $setting_name) {
710 710
 			// New setting name.
711
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
711
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
712 712
 
713 713
 			// Continue: If setting already set.
714 714
 			if (
715
-				array_key_exists( $new_setting_name, $give_settings )
716
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
715
+				array_key_exists($new_setting_name, $give_settings)
716
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
717 717
 			) {
718 718
 				continue;
719 719
 			}
720 720
 
721 721
 			// Set checkbox value to radio value.
722
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
722
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
723 723
 
724 724
 			// @see https://github.com/WordImpress/Give/issues/1063.
725
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
725
+			if (false !== strpos($setting_name, 'disable_')) {
726 726
 
727
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
728
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
727
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
728
+			} elseif (false !== strpos($setting_name, 'enable_')) {
729 729
 
730
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
730
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
731 731
 			}
732 732
 
733 733
 			// Tell bot to update core setting to db.
734
-			if ( ! $setting_changed ) {
734
+			if ( ! $setting_changed) {
735 735
 				$setting_changed = true;
736 736
 			}
737 737
 		}
738 738
 
739 739
 		// Update setting only if they changed.
740
-		if ( $setting_changed ) {
741
-			update_option( 'give_settings', $give_settings );
740
+		if ($setting_changed) {
741
+			update_option('give_settings', $give_settings);
742 742
 		}
743 743
 	}// End if().
744 744
 
745
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
745
+	give_set_upgrade_complete('v18_upgrades_core_setting');
746 746
 }
747 747
 
748 748
 /**
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 	$give_updates = Give_Updates::get_instance();
757 757
 
758 758
 	// form query
759
-	$forms = new WP_Query( array(
759
+	$forms = new WP_Query(array(
760 760
 			'paged'          => $give_updates->step,
761 761
 			'status'         => 'any',
762 762
 			'order'          => 'ASC',
@@ -765,41 +765,41 @@  discard block
 block discarded – undo
765 765
 		)
766 766
 	);
767 767
 
768
-	if ( $forms->have_posts() ) {
769
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
768
+	if ($forms->have_posts()) {
769
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
770 770
 
771
-		while ( $forms->have_posts() ) {
771
+		while ($forms->have_posts()) {
772 772
 			$forms->the_post();
773 773
 
774 774
 			// Form content.
775 775
 			// Note in version 1.8 display content setting split into display content and content placement setting.
776 776
 			// You can delete _give_content_option in future.
777
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
778
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
779
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
780
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
777
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
778
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
779
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
780
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
781 781
 
782
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
783
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
782
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
783
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
784 784
 			}
785 785
 
786 786
 			// "Disable" Guest Donation. Checkbox.
787 787
 			// See: https://github.com/WordImpress/Give/issues/1470.
788
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
789
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
790
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
788
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
789
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
790
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
791 791
 
792 792
 			// Offline Donations.
793 793
 			// See: https://github.com/WordImpress/Give/issues/1579.
794
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
795
-			if ( 'no' === $offline_donation ) {
794
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
795
+			if ('no' === $offline_donation) {
796 796
 				$offline_donation_newval = 'global';
797
-			} elseif ( 'yes' === $offline_donation ) {
797
+			} elseif ('yes' === $offline_donation) {
798 798
 				$offline_donation_newval = 'enabled';
799 799
 			} else {
800 800
 				$offline_donation_newval = 'disabled';
801 801
 			}
802
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
802
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
803 803
 
804 804
 			// Convert yes/no setting field to enabled/disabled.
805 805
 			$form_radio_settings = array(
@@ -819,15 +819,15 @@  discard block
 block discarded – undo
819 819
 				'_give_offline_donation_enable_billing_fields_single',
820 820
 			);
821 821
 
822
-			foreach ( $form_radio_settings as $meta_key ) {
822
+			foreach ($form_radio_settings as $meta_key) {
823 823
 				// Get value.
824
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
824
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
825 825
 
826 826
 				// Convert meta value only if it is in yes/no/none.
827
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
827
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
828 828
 
829
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
830
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
829
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
830
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
831 831
 				}
832 832
 			}
833 833
 		}// End while().
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 
837 837
 	} else {
838 838
 		// No more forms found, finish up.
839
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
839
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
840 840
 	}
841 841
 }
842 842
 
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 				'%_transient_give_stats_%',
904 904
 				'give_cache%',
905 905
 				'%_transient_give_add_ons_feed%',
906
-				'%_transient__give_ajax_works' .
906
+				'%_transient__give_ajax_works'.
907 907
 				'%_transient_give_total_api_keys%',
908 908
 				'%_transient_give_i18n_give_promo_hide%',
909 909
 				'%_transient_give_contributors%',
@@ -930,24 +930,24 @@  discard block
 block discarded – undo
930 930
 		ARRAY_A
931 931
 	);
932 932
 
933
-	if ( ! empty( $user_apikey_options ) ) {
934
-		foreach ( $user_apikey_options as $user ) {
935
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
936
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
937
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
933
+	if ( ! empty($user_apikey_options)) {
934
+		foreach ($user_apikey_options as $user) {
935
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
936
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
937
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
938 938
 		}
939 939
 	}
940 940
 
941
-	if ( ! empty( $cached_options ) ) {
942
-		foreach ( $cached_options as $option ) {
943
-			switch ( true ) {
944
-				case ( false !== strpos( $option, 'transient' ) ):
945
-					$option = str_replace( '_transient_', '', $option );
946
-					delete_transient( $option );
941
+	if ( ! empty($cached_options)) {
942
+		foreach ($cached_options as $option) {
943
+			switch (true) {
944
+				case (false !== strpos($option, 'transient')):
945
+					$option = str_replace('_transient_', '', $option);
946
+					delete_transient($option);
947 947
 					break;
948 948
 
949 949
 				default:
950
-					delete_option( $option );
950
+					delete_option($option);
951 951
 			}
952 952
 		}
953 953
 	}
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 	global $wp_roles;
966 966
 
967 967
 	// Get the role object.
968
-	$give_worker = get_role( 'give_worker' );
968
+	$give_worker = get_role('give_worker');
969 969
 
970 970
 	// A list of capabilities to add for give workers.
971 971
 	$caps_to_add = array(
@@ -973,9 +973,9 @@  discard block
 block discarded – undo
973 973
 		'edit_pages',
974 974
 	);
975 975
 
976
-	foreach ( $caps_to_add as $cap ) {
976
+	foreach ($caps_to_add as $cap) {
977 977
 		// Add the capability.
978
-		$give_worker->add_cap( $cap );
978
+		$give_worker->add_cap($cap);
979 979
 	}
980 980
 
981 981
 }
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 	$give_updates = Give_Updates::get_instance();
993 993
 
994 994
 	// form query.
995
-	$donation_forms = new WP_Query( array(
995
+	$donation_forms = new WP_Query(array(
996 996
 			'paged'          => $give_updates->step,
997 997
 			'status'         => 'any',
998 998
 			'order'          => 'ASC',
@@ -1001,10 +1001,10 @@  discard block
 block discarded – undo
1001 1001
 		)
1002 1002
 	);
1003 1003
 
1004
-	if ( $donation_forms->have_posts() ) {
1005
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1004
+	if ($donation_forms->have_posts()) {
1005
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1006 1006
 
1007
-		while ( $donation_forms->have_posts() ) {
1007
+		while ($donation_forms->have_posts()) {
1008 1008
 			$donation_forms->the_post();
1009 1009
 			$form_id = get_the_ID();
1010 1010
 
@@ -1012,41 +1012,41 @@  discard block
 block discarded – undo
1012 1012
 			update_post_meta(
1013 1013
 				$form_id,
1014 1014
 				'_give_set_price',
1015
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
1015
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
1016 1016
 			);
1017 1017
 
1018 1018
 			// Remove formatting from _give_custom_amount_minimum.
1019 1019
 			update_post_meta(
1020 1020
 				$form_id,
1021 1021
 				'_give_custom_amount_minimum',
1022
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
1022
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
1023 1023
 			);
1024 1024
 
1025 1025
 			// Bailout.
1026
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
1026
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
1027 1027
 				continue;
1028 1028
 			}
1029 1029
 
1030
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
1030
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
1031 1031
 
1032
-			if ( ! empty( $donation_levels ) ) {
1032
+			if ( ! empty($donation_levels)) {
1033 1033
 
1034
-				foreach ( $donation_levels as $index => $donation_level ) {
1035
-					if ( isset( $donation_level['_give_amount'] ) ) {
1036
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
1034
+				foreach ($donation_levels as $index => $donation_level) {
1035
+					if (isset($donation_level['_give_amount'])) {
1036
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
1037 1037
 					}
1038 1038
 				}
1039 1039
 
1040
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
1040
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
1041 1041
 
1042
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
1042
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
1043 1043
 
1044
-				$min_amount = min( $donation_levels_amounts );
1045
-				$max_amount = max( $donation_levels_amounts );
1044
+				$min_amount = min($donation_levels_amounts);
1045
+				$max_amount = max($donation_levels_amounts);
1046 1046
 
1047 1047
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
1048
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
1049
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
1048
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
1049
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
1050 1050
 			}
1051 1051
 
1052 1052
 		}
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
 		wp_reset_postdata();
1056 1056
 	} else {
1057 1057
 		// The Update Ran.
1058
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
1058
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
1059 1059
 	}
1060 1060
 
1061 1061
 }
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
  */
1106 1106
 function give_v20_upgrades() {
1107 1107
 	// Update cache setting.
1108
-	give_update_option( 'cache', 'enabled' );
1108
+	give_update_option('cache', 'enabled');
1109 1109
 
1110 1110
 	// Upgrade email settings.
1111 1111
 	give_v20_upgrades_email_setting();
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
 	$all_setting = give_get_settings();
1125 1125
 
1126 1126
 	// Bailout on fresh install.
1127
-	if ( empty( $all_setting ) ) {
1127
+	if (empty($all_setting)) {
1128 1128
 		return;
1129 1129
 	}
1130 1130
 
@@ -1143,19 +1143,19 @@  discard block
 block discarded – undo
1143 1143
 		'admin_notices'                 => 'new-donation_notification',
1144 1144
 	);
1145 1145
 
1146
-	foreach ( $settings as $old_setting => $new_setting ) {
1146
+	foreach ($settings as $old_setting => $new_setting) {
1147 1147
 		// Do not update already modified
1148
-		if ( ! is_array( $new_setting ) ) {
1149
-			if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) {
1148
+		if ( ! is_array($new_setting)) {
1149
+			if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) {
1150 1150
 				continue;
1151 1151
 			}
1152 1152
 		}
1153 1153
 
1154
-		switch ( $old_setting ) {
1154
+		switch ($old_setting) {
1155 1155
 			case 'admin_notices':
1156
-				$notification_status = give_get_option( $old_setting, 'enabled' );
1156
+				$notification_status = give_get_option($old_setting, 'enabled');
1157 1157
 
1158
-				give_update_option( $new_setting, $notification_status );
1158
+				give_update_option($new_setting, $notification_status);
1159 1159
 
1160 1160
 				// @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon.
1161 1161
 				// give_delete_option( $old_setting );
@@ -1166,19 +1166,19 @@  discard block
 block discarded – undo
1166 1166
 			case 'admin_notice_emails':
1167 1167
 				$recipients = give_get_admin_notice_emails();
1168 1168
 
1169
-				foreach ( $new_setting as $setting ) {
1169
+				foreach ($new_setting as $setting) {
1170 1170
 					// bailout if setting already exist.
1171
-					if ( array_key_exists( $setting, $all_setting ) ) {
1171
+					if (array_key_exists($setting, $all_setting)) {
1172 1172
 						continue;
1173 1173
 					}
1174 1174
 
1175
-					give_update_option( $setting, $recipients );
1175
+					give_update_option($setting, $recipients);
1176 1176
 				}
1177 1177
 				break;
1178 1178
 
1179 1179
 			default:
1180
-				give_update_option( $new_setting, give_get_option( $old_setting ) );
1181
-				give_delete_option( $old_setting );
1180
+				give_update_option($new_setting, give_get_option($old_setting));
1181
+				give_delete_option($old_setting);
1182 1182
 		}
1183 1183
 	}
1184 1184
 }
@@ -1195,22 +1195,22 @@  discard block
 block discarded – undo
1195 1195
 	$give_settings        = give_get_settings();
1196 1196
 	$give_setting_updated = false;
1197 1197
 
1198
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
1198
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
1199 1199
 		$give_settings['number_decimals']   = 0;
1200 1200
 		$give_settings['decimal_separator'] = '';
1201 1201
 		$give_setting_updated               = true;
1202 1202
 
1203
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
1203
+	} elseif (empty($give_settings['decimal_separator'])) {
1204 1204
 		$give_settings['number_decimals'] = 0;
1205 1205
 		$give_setting_updated             = true;
1206 1206
 
1207
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
1207
+	} elseif (6 < absint($give_settings['number_decimals'])) {
1208 1208
 		$give_settings['number_decimals'] = 5;
1209 1209
 		$give_setting_updated             = true;
1210 1210
 	}
1211 1211
 
1212
-	if ( $give_setting_updated ) {
1213
-		update_option( 'give_settings', $give_settings );
1212
+	if ($give_setting_updated) {
1213
+		update_option('give_settings', $give_settings);
1214 1214
 	}
1215 1215
 }
1216 1216
 
@@ -1229,69 +1229,69 @@  discard block
 block discarded – undo
1229 1229
 	$give_updates = Give_Updates::get_instance();
1230 1230
 
1231 1231
 	// form query.
1232
-	$donation_forms = new WP_Query( array(
1232
+	$donation_forms = new WP_Query(array(
1233 1233
 			'paged'          => $give_updates->step,
1234 1234
 			'status'         => 'any',
1235 1235
 			'order'          => 'ASC',
1236
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1236
+			'post_type'      => array('give_forms', 'give_payment'),
1237 1237
 			'posts_per_page' => 20,
1238 1238
 		)
1239 1239
 	);
1240
-	if ( $donation_forms->have_posts() ) {
1241
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1240
+	if ($donation_forms->have_posts()) {
1241
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1242 1242
 
1243
-		while ( $donation_forms->have_posts() ) {
1243
+		while ($donation_forms->have_posts()) {
1244 1244
 			$donation_forms->the_post();
1245 1245
 			global $post;
1246 1246
 
1247
-			$meta = get_post_meta( $post->ID );
1247
+			$meta = get_post_meta($post->ID);
1248 1248
 
1249
-			switch ( $post->post_type ) {
1249
+			switch ($post->post_type) {
1250 1250
 				case 'give_forms':
1251 1251
 					// _give_set_price.
1252
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
1253
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
1252
+					if ( ! empty($meta['_give_set_price'][0])) {
1253
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
1254 1254
 					}
1255 1255
 
1256 1256
 					// _give_custom_amount_minimum.
1257
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
1258
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
1257
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
1258
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
1259 1259
 					}
1260 1260
 
1261 1261
 					// _give_levels_minimum_amount.
1262
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1263
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1262
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1263
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1264 1264
 					}
1265 1265
 
1266 1266
 					// _give_levels_maximum_amount.
1267
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1268
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1267
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1268
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1269 1269
 					}
1270 1270
 
1271 1271
 					// _give_set_goal.
1272
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1273
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1272
+					if ( ! empty($meta['_give_set_goal'][0])) {
1273
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1274 1274
 					}
1275 1275
 
1276 1276
 					// _give_form_earnings.
1277
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1278
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1277
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1278
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1279 1279
 					}
1280 1280
 
1281 1281
 					// _give_custom_amount_minimum.
1282
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1283
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1282
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1283
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1284 1284
 
1285
-						foreach ( $donation_levels as $index => $level ) {
1286
-							if ( empty( $level['_give_amount'] ) ) {
1285
+						foreach ($donation_levels as $index => $level) {
1286
+							if (empty($level['_give_amount'])) {
1287 1287
 								continue;
1288 1288
 							}
1289 1289
 
1290
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1290
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1291 1291
 						}
1292 1292
 
1293 1293
 						$meta['_give_donation_levels'] = $donation_levels;
1294
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1294
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1295 1295
 					}
1296 1296
 
1297 1297
 
@@ -1299,8 +1299,8 @@  discard block
 block discarded – undo
1299 1299
 
1300 1300
 				case 'give_payment':
1301 1301
 					// _give_payment_total.
1302
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1303
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1302
+					if ( ! empty($meta['_give_payment_total'][0])) {
1303
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1304 1304
 					}
1305 1305
 
1306 1306
 					break;
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 		wp_reset_postdata();
1312 1312
 	} else {
1313 1313
 		// The Update Ran.
1314
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1314
+		give_set_upgrade_complete('v1812_update_amount_values');
1315 1315
 	}
1316 1316
 }
1317 1317
 
@@ -1331,22 +1331,22 @@  discard block
 block discarded – undo
1331 1331
 	$offset       = 1 === $give_updates->step ? 0 : $give_updates->step * 20;
1332 1332
 
1333 1333
 	// form query.
1334
-	$donors = Give()->donors->get_donors( array(
1334
+	$donors = Give()->donors->get_donors(array(
1335 1335
 			'number' => 20,
1336 1336
 			'offset' => $offset,
1337 1337
 		)
1338 1338
 	);
1339 1339
 
1340
-	if ( ! empty( $donors ) ) {
1341
-		$give_updates->set_percentage( Give()->donors->count(), $offset );
1340
+	if ( ! empty($donors)) {
1341
+		$give_updates->set_percentage(Give()->donors->count(), $offset);
1342 1342
 
1343 1343
 		/* @var Object $donor */
1344
-		foreach ( $donors as $donor ) {
1345
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1344
+		foreach ($donors as $donor) {
1345
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1346 1346
 		}
1347 1347
 	} else {
1348 1348
 		// The Update Ran.
1349
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1349
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1350 1350
 	}
1351 1351
 }
1352 1352
 
@@ -1361,25 +1361,25 @@  discard block
 block discarded – undo
1361 1361
 	$offset       = 1 === $give_updates->step ? 0 : $give_updates->step * 20;
1362 1362
 
1363 1363
 	// Fetch all the existing donors.
1364
-	$donors = Give()->donors->get_donors( array(
1364
+	$donors = Give()->donors->get_donors(array(
1365 1365
 			'number' => 20,
1366 1366
 			'offset' => $offset,
1367 1367
 		)
1368 1368
 	);
1369 1369
 
1370
-	if ( ! empty( $donors ) ) {
1371
-		$give_updates->set_percentage( Give()->donors->count(), ( $give_updates->step * 20 ) );
1370
+	if ( ! empty($donors)) {
1371
+		$give_updates->set_percentage(Give()->donors->count(), ($give_updates->step * 20));
1372 1372
 
1373 1373
 		/* @var Object $donor */
1374
-		foreach ( $donors as $donor ) {
1374
+		foreach ($donors as $donor) {
1375 1375
 			$user_id = $donor->user_id;
1376 1376
 
1377 1377
 			// Proceed, if donor is attached with user.
1378
-			if ( $user_id ) {
1379
-				$user = get_userdata( $user_id );
1378
+			if ($user_id) {
1379
+				$user = get_userdata($user_id);
1380 1380
 
1381 1381
 				// Update user role, if user has subscriber role.
1382
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1382
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1383 1383
 					wp_update_user(
1384 1384
 						array(
1385 1385
 							'ID'   => $user_id,
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 		}
1392 1392
 	} else {
1393 1393
 		// The Update Ran.
1394
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1394
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1395 1395
 	}
1396 1396
 }
1397 1397
 
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
  */
1404 1404
 function give_v1813_upgrades() {
1405 1405
 	// Update admin setting.
1406
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1406
+	give_update_option('donor_default_user_role', 'give_donor');
1407 1407
 
1408 1408
 	// Update Give roles.
1409 1409
 	$roles = new Give_Roles();
@@ -1421,33 +1421,33 @@  discard block
 block discarded – undo
1421 1421
 	$give_updates = Give_Updates::get_instance();
1422 1422
 
1423 1423
 	// form query.
1424
-	$payments = new WP_Query( array(
1424
+	$payments = new WP_Query(array(
1425 1425
 			'paged'          => $give_updates->step,
1426 1426
 			'status'         => 'any',
1427 1427
 			'order'          => 'ASC',
1428
-			'post_type'      => array( 'give_payment' ),
1428
+			'post_type'      => array('give_payment'),
1429 1429
 			'posts_per_page' => 100,
1430 1430
 		)
1431 1431
 	);
1432 1432
 
1433
-	if ( $payments->have_posts() ) {
1434
-		$give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) );
1433
+	if ($payments->have_posts()) {
1434
+		$give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100));
1435 1435
 
1436
-		while ( $payments->have_posts() ) {
1436
+		while ($payments->have_posts()) {
1437 1437
 			$payments->the_post();
1438 1438
 
1439
-			$payment_meta = give_get_payment_meta( get_the_ID() );
1439
+			$payment_meta = give_get_payment_meta(get_the_ID());
1440 1440
 
1441
-			if ( 'RIAL' === $payment_meta['currency'] ) {
1441
+			if ('RIAL' === $payment_meta['currency']) {
1442 1442
 				$payment_meta['currency'] = 'IRR';
1443
-				give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta );
1443
+				give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta);
1444 1444
 			}
1445 1445
 
1446 1446
 		}
1447 1447
 
1448 1448
 	} else {
1449 1449
 		// The Update Ran.
1450
-		give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' );
1450
+		give_set_upgrade_complete('v1817_update_donation_iranian_currency_code');
1451 1451
 	}
1452 1452
 }
1453 1453
 
@@ -1460,9 +1460,9 @@  discard block
 block discarded – undo
1460 1460
 function give_v1817_upgrades() {
1461 1461
 	$give_settings = give_get_settings();
1462 1462
 
1463
-	if ( 'RIAL' === $give_settings['currency'] ) {
1463
+	if ('RIAL' === $give_settings['currency']) {
1464 1464
 		$give_settings['currency'] = 'IRR';
1465
-		update_option( 'give_settings', $give_settings );
1465
+		update_option('give_settings', $give_settings);
1466 1466
 	}
1467 1467
 }
1468 1468
 
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 
1476 1476
 	global $wp_roles;
1477 1477
 
1478
-	if( ! ( $wp_roles instanceof  WP_Roles ) ) {
1478
+	if ( ! ($wp_roles instanceof  WP_Roles)) {
1479 1479
 		return;
1480 1480
 	}
1481 1481
 
@@ -1499,15 +1499,15 @@  discard block
 block discarded – undo
1499 1499
 		),
1500 1500
 	);
1501 1501
 
1502
-	foreach ( $add_caps as $role => $caps ) {
1503
-		foreach ( $caps as $cap ) {
1504
-			$wp_roles->add_cap( $role, $cap );
1502
+	foreach ($add_caps as $role => $caps) {
1503
+		foreach ($caps as $cap) {
1504
+			$wp_roles->add_cap($role, $cap);
1505 1505
 		}
1506 1506
 	}
1507 1507
 
1508
-	foreach ( $remove_caps as $role => $caps ) {
1509
-		foreach ( $caps as $cap ) {
1510
-			$wp_roles->remove_cap( $role, $cap );
1508
+	foreach ($remove_caps as $role => $caps) {
1509
+		foreach ($caps as $cap) {
1510
+			$wp_roles->remove_cap($role, $cap);
1511 1511
 		}
1512 1512
 	}
1513 1513
 
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
 	$roles->add_roles();
1532 1532
 	$roles->add_caps();
1533 1533
 
1534
-	give_set_upgrade_complete( 'v1817_cleanup_user_roles' );
1534
+	give_set_upgrade_complete('v1817_cleanup_user_roles');
1535 1535
 }
1536 1536
 
1537 1537
 /**
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
 function give_v1818_upgrades() {
1543 1543
 
1544 1544
 	// Remove email_access_installed from give_settings.
1545
-	give_delete_option( 'email_access_installed' );
1545
+	give_delete_option('email_access_installed');
1546 1546
 }
1547 1547
 
1548 1548
 /**
@@ -1553,25 +1553,25 @@  discard block
 block discarded – undo
1553 1553
 function give_v1818_assign_custom_amount_set_donation() {
1554 1554
 
1555 1555
 	/* @var Give_Updates $give_updates */
1556
-	$give_updates   = Give_Updates::get_instance();
1556
+	$give_updates = Give_Updates::get_instance();
1557 1557
 
1558
-	$donations = new WP_Query( array(
1558
+	$donations = new WP_Query(array(
1559 1559
 			'paged'          => $give_updates->step,
1560 1560
 			'status'         => 'any',
1561 1561
 			'order'          => 'ASC',
1562
-			'post_type'      => array( 'give_payment' ),
1562
+			'post_type'      => array('give_payment'),
1563 1563
 			'posts_per_page' => 100,
1564 1564
 		)
1565 1565
 	);
1566 1566
 
1567
-	if ( $donations->have_posts() ) {
1568
-		$give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 );
1567
+	if ($donations->have_posts()) {
1568
+		$give_updates->set_percentage($donations->found_posts, $give_updates->step * 100);
1569 1569
 
1570
-		while ( $donations->have_posts() ) {
1570
+		while ($donations->have_posts()) {
1571 1571
 			$donations->the_post();
1572 1572
 
1573
-			$form          = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) );
1574
-			$donation_meta = give_get_payment_meta( get_the_ID() );
1573
+			$form          = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true));
1574
+			$donation_meta = give_get_payment_meta(get_the_ID());
1575 1575
 
1576 1576
 			// Update Donation meta with price_id set as custom, only if it is:
1577 1577
 			// 1. Donation Type = Set Donation.
@@ -1580,19 +1580,19 @@  discard block
 block discarded – undo
1580 1580
 			if (
1581 1581
 				$form->ID &&
1582 1582
 				$form->is_set_type_donation_form() &&
1583
-				( 'custom' !== $donation_meta['price_id'] ) &&
1584
-				$form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) )
1583
+				('custom' !== $donation_meta['price_id']) &&
1584
+				$form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true))
1585 1585
 			) {
1586 1586
 				$donation_meta['price_id'] = 'custom';
1587
-				give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta );
1588
-				give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' );
1587
+				give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta);
1588
+				give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom');
1589 1589
 			}
1590 1590
 		}
1591 1591
 
1592 1592
 		wp_reset_postdata();
1593 1593
 	} else {
1594 1594
 		// Update Ran Successfully.
1595
-		give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' );
1595
+		give_set_upgrade_complete('v1818_assign_custom_amount_set_donation');
1596 1596
 	}
1597 1597
 }
1598 1598
 
@@ -1603,14 +1603,14 @@  discard block
 block discarded – undo
1603 1603
  *
1604 1604
  * @since 1.8.18
1605 1605
  */
1606
-function give_v1818_give_worker_role_cleanup(){
1606
+function give_v1818_give_worker_role_cleanup() {
1607 1607
 
1608 1608
 	/* @var Give_Updates $give_updates */
1609 1609
 	$give_updates = Give_Updates::get_instance();
1610 1610
 
1611 1611
 	global $wp_roles;
1612 1612
 
1613
-	if( ! ( $wp_roles instanceof  WP_Roles ) ) {
1613
+	if ( ! ($wp_roles instanceof  WP_Roles)) {
1614 1614
 		return;
1615 1615
 	}
1616 1616
 
@@ -1628,9 +1628,9 @@  discard block
 block discarded – undo
1628 1628
 		),
1629 1629
 	);
1630 1630
 
1631
-	foreach ( $remove_caps as $role => $caps ) {
1632
-		foreach( $caps as $cap ) {
1633
-			$wp_roles->remove_cap( $role, $cap );
1631
+	foreach ($remove_caps as $role => $caps) {
1632
+		foreach ($caps as $cap) {
1633
+			$wp_roles->remove_cap($role, $cap);
1634 1634
 		}
1635 1635
 	}
1636 1636
 
@@ -1641,7 +1641,7 @@  discard block
 block discarded – undo
1641 1641
 	$roles->add_roles();
1642 1642
 	$roles->add_caps();
1643 1643
 
1644
-	give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' );
1644
+	give_set_upgrade_complete('v1818_give_worker_role_cleanup');
1645 1645
 }
1646 1646
 
1647 1647
 /**
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 	$give_updates = Give_Updates::get_instance();
1656 1656
 
1657 1657
 	// form query
1658
-	$forms = new WP_Query( array(
1658
+	$forms = new WP_Query(array(
1659 1659
 			'paged'          => $give_updates->step,
1660 1660
 			'status'         => 'any',
1661 1661
 			'order'          => 'ASC',
@@ -1664,22 +1664,22 @@  discard block
 block discarded – undo
1664 1664
 		)
1665 1665
 	);
1666 1666
 
1667
-	if ( $forms->have_posts() ) {
1668
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1667
+	if ($forms->have_posts()) {
1668
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1669 1669
 
1670
-		while ( $forms->have_posts() ) {
1670
+		while ($forms->have_posts()) {
1671 1671
 			$forms->the_post();
1672 1672
 			global $post;
1673 1673
 
1674 1674
 			// Update offline instruction email notification status.
1675
-			$offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
1676
-			$offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array(
1675
+			$offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
1676
+			$offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array(
1677 1677
 				'enabled',
1678 1678
 				'global',
1679
-			) )
1679
+			))
1680 1680
 				? $offline_instruction_notification_status
1681 1681
 				: 'global';
1682
-			update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status );
1682
+			update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status);
1683 1683
 
1684 1684
 			// Update offline instruction email message.
1685 1685
 			update_post_meta(
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 		wp_reset_postdata();
1712 1712
 	} else {
1713 1713
 		// No more forms found, finish up.
1714
-		give_set_upgrade_complete( 'v20_upgrades_form_metadata' );
1714
+		give_set_upgrade_complete('v20_upgrades_form_metadata');
1715 1715
 	}
1716 1716
 }
1717 1717
 
@@ -1728,7 +1728,7 @@  discard block
 block discarded – undo
1728 1728
 	$give_updates = Give_Updates::get_instance();
1729 1729
 
1730 1730
 	// form query
1731
-	$forms = new WP_Query( array(
1731
+	$forms = new WP_Query(array(
1732 1732
 			'paged'          => $give_updates->step,
1733 1733
 			'status'         => 'any',
1734 1734
 			'order'          => 'ASC',
@@ -1737,19 +1737,19 @@  discard block
 block discarded – undo
1737 1737
 		)
1738 1738
 	);
1739 1739
 
1740
-	if ( $forms->have_posts() ) {
1741
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1740
+	if ($forms->have_posts()) {
1741
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1742 1742
 
1743
-		while ( $forms->have_posts() ) {
1743
+		while ($forms->have_posts()) {
1744 1744
 			$forms->the_post();
1745 1745
 			global $post;
1746 1746
 
1747 1747
 			// Split _give_payment_meta meta.
1748 1748
 			// @todo Remove _give_payment_meta after releases 2.0
1749
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
1749
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
1750 1750
 
1751
-			if ( ! empty( $payment_meta ) ) {
1752
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
1751
+			if ( ! empty($payment_meta)) {
1752
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
1753 1753
 			}
1754 1754
 
1755 1755
 			$deprecated_meta_keys = array(
@@ -1758,9 +1758,9 @@  discard block
 block discarded – undo
1758 1758
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
1759 1759
 			);
1760 1760
 
1761
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
1761
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
1762 1762
 				// Do not add new meta key if already exist.
1763
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
1763
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
1764 1764
 					continue;
1765 1765
 				}
1766 1766
 
@@ -1769,25 +1769,25 @@  discard block
 block discarded – undo
1769 1769
 					array(
1770 1770
 						'post_id' => $post->ID,
1771 1771
 						'meta_key' => $new_meta_key,
1772
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true )
1772
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true)
1773 1773
 					)
1774 1774
 				);
1775 1775
 			}
1776 1776
 
1777 1777
 			// Bailout
1778
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
1778
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
1779 1779
 				/* @var Give_Donor $donor */
1780
-				$donor = new Give_Donor( $donor_id );
1780
+				$donor = new Give_Donor($donor_id);
1781 1781
 
1782
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
1783
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
1784
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
1785
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
1786
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
1787
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
1782
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
1783
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
1784
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
1785
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
1786
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
1787
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
1788 1788
 
1789 1789
 				// Save address.
1790
-				$donor->add_address( 'billing[]', $address );
1790
+				$donor->add_address('billing[]', $address);
1791 1791
 			}
1792 1792
 
1793 1793
 		}// End while().
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
1799 1799
 
1800 1800
 		// No more forms found, finish up.
1801
-		give_set_upgrade_complete( 'v20_upgrades_payment_metadata' );
1801
+		give_set_upgrade_complete('v20_upgrades_payment_metadata');
1802 1802
 	}
1803 1803
 }
1804 1804
 
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
 	$give_updates = Give_Updates::get_instance();
1815 1815
 
1816 1816
 	// form query
1817
-	$forms = new WP_Query( array(
1817
+	$forms = new WP_Query(array(
1818 1818
 			'paged'          => $give_updates->step,
1819 1819
 			'order'          => 'DESC',
1820 1820
 			'post_type'      => 'give_log',
@@ -1823,20 +1823,20 @@  discard block
 block discarded – undo
1823 1823
 		)
1824 1824
 	);
1825 1825
 
1826
-	if ( $forms->have_posts() ) {
1827
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
1826
+	if ($forms->have_posts()) {
1827
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
1828 1828
 
1829
-		while ( $forms->have_posts() ) {
1829
+		while ($forms->have_posts()) {
1830 1830
 			$forms->the_post();
1831 1831
 			global $post;
1832 1832
 
1833
-			if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
1833
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
1834 1834
 				continue;
1835 1835
 			}
1836 1836
 
1837
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
1838
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
1839
-			$term_name = ! empty( $term ) ? $term->slug : '';
1837
+			$term      = get_the_terms($post->ID, 'give_log_type');
1838
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
1839
+			$term_name = ! empty($term) ? $term->slug : '';
1840 1840
 
1841 1841
 			$log_data = array(
1842 1842
 				'ID'           => $post->ID,
@@ -1849,29 +1849,29 @@  discard block
 block discarded – undo
1849 1849
 			);
1850 1850
 			$log_meta = array();
1851 1851
 
1852
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
1853
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
1854
-					switch ( $meta_key ) {
1852
+			if ($old_log_meta = get_post_meta($post->ID)) {
1853
+				foreach ($old_log_meta as $meta_key => $meta_value) {
1854
+					switch ($meta_key) {
1855 1855
 						case '_give_log_payment_id':
1856
-							$log_data['log_parent']        = current( $meta_value );
1856
+							$log_data['log_parent']        = current($meta_value);
1857 1857
 							$log_meta['_give_log_form_id'] = $post->post_parent;
1858 1858
 							break;
1859 1859
 
1860 1860
 						default:
1861
-							$log_meta[ $meta_key ] = current( $meta_value );
1861
+							$log_meta[$meta_key] = current($meta_value);
1862 1862
 					}
1863 1863
 				}
1864 1864
 			}
1865 1865
 
1866
-			if ( 'api_request' === $term_name ) {
1866
+			if ('api_request' === $term_name) {
1867 1867
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
1868 1868
 			}
1869 1869
 
1870
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
1870
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
1871 1871
 
1872
-			if ( ! empty( $log_meta ) ) {
1873
-				foreach ( $log_meta as $meta_key => $meta_value ) {
1874
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
1872
+			if ( ! empty($log_meta)) {
1873
+				foreach ($log_meta as $meta_key => $meta_value) {
1874
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
1875 1875
 				}
1876 1876
 			}
1877 1877
 
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
 		Give()->logs->delete_cache();
1914 1914
 
1915 1915
 		// No more forms found, finish up.
1916
-		give_set_upgrade_complete( 'v20_logs_upgrades' );
1916
+		give_set_upgrade_complete('v20_logs_upgrades');
1917 1917
 	}
1918 1918
 }
1919 1919
 
@@ -1929,19 +1929,19 @@  discard block
 block discarded – undo
1929 1929
 	$give_updates = Give_Updates::get_instance();
1930 1930
 
1931 1931
 	// form query
1932
-	$payments = new WP_Query( array(
1932
+	$payments = new WP_Query(array(
1933 1933
 			'paged'          => $give_updates->step,
1934 1934
 			'status'         => 'any',
1935 1935
 			'order'          => 'ASC',
1936
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1936
+			'post_type'      => array('give_forms', 'give_payment'),
1937 1937
 			'posts_per_page' => 100,
1938 1938
 		)
1939 1939
 	);
1940 1940
 
1941
-	if ( $payments->have_posts() ) {
1942
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
1941
+	if ($payments->have_posts()) {
1942
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
1943 1943
 
1944
-		while ( $payments->have_posts() ) {
1944
+		while ($payments->have_posts()) {
1945 1945
 			$payments->the_post();
1946 1946
 			global $post;
1947 1947
 
@@ -1953,19 +1953,19 @@  discard block
 block discarded – undo
1953 1953
 				ARRAY_A
1954 1954
 			);
1955 1955
 
1956
-			if ( ! empty( $meta_data ) ) {
1957
-				foreach ( $meta_data as $index => $data ) {
1956
+			if ( ! empty($meta_data)) {
1957
+				foreach ($meta_data as $index => $data) {
1958 1958
 					// Check for duplicate meta values.
1959
-					if( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) .  " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
1959
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
1960 1960
 						continue;
1961 1961
 					}
1962 1962
 					
1963
-					switch ( $post->post_type ) {
1963
+					switch ($post->post_type) {
1964 1964
 						case 'give_forms':
1965 1965
 							$data['form_id'] = $data['post_id'];
1966
-							unset( $data['post_id'] );
1966
+							unset($data['post_id']);
1967 1967
 
1968
-							Give()->form_meta->insert( $data );
1968
+							Give()->form_meta->insert($data);
1969 1969
 							// @todo: delete form meta from post meta table after releases 2.0.
1970 1970
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
1971 1971
 
@@ -1973,9 +1973,9 @@  discard block
 block discarded – undo
1973 1973
 
1974 1974
 						case 'give_payment':
1975 1975
 							$data['payment_id'] = $data['post_id'];
1976
-							unset( $data['post_id'] );
1976
+							unset($data['post_id']);
1977 1977
 
1978
-							Give()->payment_meta->insert( $data );
1978
+							Give()->payment_meta->insert($data);
1979 1979
 
1980 1980
 							// @todo: delete donation meta from post meta table after releases 2.0.
1981 1981
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 		wp_reset_postdata();
1991 1991
 	} else {
1992 1992
 		// No more forms found, finish up.
1993
-		give_set_upgrade_complete( 'v20_move_metadata_into_new_table' );
1993
+		give_set_upgrade_complete('v20_move_metadata_into_new_table');
1994 1994
 	}
1995 1995
 
1996 1996
 }
@@ -2006,44 +2006,44 @@  discard block
 block discarded – undo
2006 2006
 	/* @var Give_Updates $give_updates */
2007 2007
 	$give_updates = Give_Updates::get_instance();
2008 2008
 
2009
-	$donors = Give()->donors->get_donors( array(
2009
+	$donors = Give()->donors->get_donors(array(
2010 2010
 		'paged'  => $give_updates->step,
2011 2011
 		'number' => 100,
2012
-	) );
2012
+	));
2013 2013
 
2014
-	if ( $donors ) {
2015
-		$give_updates->set_percentage( count( $donors ), $give_updates->step * 100 );
2014
+	if ($donors) {
2015
+		$give_updates->set_percentage(count($donors), $give_updates->step * 100);
2016 2016
 		// Loop through Donors
2017
-		foreach ( $donors as $donor ) {
2017
+		foreach ($donors as $donor) {
2018 2018
 
2019
-			$donor_name       = explode( ' ', $donor->name, 2 );
2020
-			$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2021
-			$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2019
+			$donor_name       = explode(' ', $donor->name, 2);
2020
+			$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2021
+			$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2022 2022
 
2023 2023
 			// If first name meta of donor is not created, then create it.
2024
-			if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2025
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2024
+			if ( ! $donor_first_name && isset($donor_name[0])) {
2025
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2026 2026
 			}
2027 2027
 
2028 2028
 			// If last name meta of donor is not created, then create it.
2029
-			if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2030
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2029
+			if ( ! $donor_last_name && isset($donor_name[1])) {
2030
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2031 2031
 			}
2032 2032
 
2033 2033
 			// If Donor is connected with WP User then update user meta.
2034
-			if ( $donor->user_id ) {
2035
-				if ( isset( $donor_name[0] ) ) {
2036
-					update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2034
+			if ($donor->user_id) {
2035
+				if (isset($donor_name[0])) {
2036
+					update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2037 2037
 				}
2038
-				if ( isset( $donor_name[1] ) ) {
2039
-					update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2038
+				if (isset($donor_name[1])) {
2039
+					update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2040 2040
 				}
2041 2041
 			}
2042 2042
 		}
2043 2043
 
2044 2044
 	} else {
2045 2045
 		// The Update Ran.
2046
-		give_set_upgrade_complete( 'v20_upgrades_donor_name' );
2046
+		give_set_upgrade_complete('v20_upgrades_donor_name');
2047 2047
 	}
2048 2048
 
2049 2049
 }
@@ -2072,15 +2072,15 @@  discard block
 block discarded – undo
2072 2072
 
2073 2073
 	$users = $user_query->get_results();
2074 2074
 
2075
-	if ( $users ) {
2076
-		$give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 );
2075
+	if ($users) {
2076
+		$give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100);
2077 2077
 
2078 2078
 		// Loop through Donors
2079
-		foreach ( $users as $user ) {
2079
+		foreach ($users as $user) {
2080 2080
 			/* @var Give_Donor $donor */
2081
-			$donor = new Give_Donor( $user->ID, true );
2081
+			$donor = new Give_Donor($user->ID, true);
2082 2082
 
2083
-			if ( ! $donor->id ) {
2083
+			if ( ! $donor->id) {
2084 2084
 				continue;
2085 2085
 			}
2086 2086
 
@@ -2096,10 +2096,10 @@  discard block
 block discarded – undo
2096 2096
 				)
2097 2097
 			);
2098 2098
 
2099
-			if ( ! empty( $address ) ) {
2100
-				$address = maybe_unserialize( $address );
2101
-				$donor->add_address( 'personal', $address );
2102
-				$donor->add_address( 'billing[]', $address );
2099
+			if ( ! empty($address)) {
2100
+				$address = maybe_unserialize($address);
2101
+				$donor->add_address('personal', $address);
2102
+				$donor->add_address('billing[]', $address);
2103 2103
 
2104 2104
 
2105 2105
 				// @todo: delete _give_user_address from user meta after releases 2.0.
@@ -2109,7 +2109,7 @@  discard block
 block discarded – undo
2109 2109
 
2110 2110
 	} else {
2111 2111
 		// The Update Ran.
2112
-		give_set_upgrade_complete( 'v20_upgrades_user_address' );
2112
+		give_set_upgrade_complete('v20_upgrades_user_address');
2113 2113
 	}
2114 2114
 
2115 2115
 }
@@ -2133,15 +2133,15 @@  discard block
 block discarded – undo
2133 2133
 	);
2134 2134
 
2135 2135
 	// Alter customer table
2136
-	foreach ( $tables as $old_table => $new_table ) {
2136
+	foreach ($tables as $old_table => $new_table) {
2137 2137
 		if (
2138
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) &&
2139
-			! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) )
2138
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) &&
2139
+			! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table))
2140 2140
 		) {
2141
-			$wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" );
2141
+			$wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}");
2142 2142
 
2143
-			if ( "{$wpdb->prefix}give_donormeta" === $new_table ) {
2144
-				$wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" );
2143
+			if ("{$wpdb->prefix}give_donormeta" === $new_table) {
2144
+				$wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)");
2145 2145
 			}
2146 2146
 		}
2147 2147
 	}
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
 	$give_updates->percentage = 100;
2150 2150
 
2151 2151
 	// No more forms found, finish up.
2152
-	give_set_upgrade_complete( 'v20_rename_donor_tables' );
2152
+	give_set_upgrade_complete('v20_rename_donor_tables');
2153 2153
 
2154 2154
 	// Re initiate donor classes.
2155 2155
 	Give()->donors     = new Give_DB_Donors();
@@ -2164,22 +2164,22 @@  discard block
 block discarded – undo
2164 2164
  * @global wpdb $wpdb
2165 2165
  * @return void
2166 2166
  */
2167
-function give_v201_create_tables(){
2167
+function give_v201_create_tables() {
2168 2168
 	global $wpdb;
2169 2169
 
2170
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) {
2170
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) {
2171 2171
 		Give()->payment_meta->create_table();
2172 2172
 	}
2173 2173
 
2174
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) {
2174
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) {
2175 2175
 		Give()->form_meta->create_table();
2176 2176
 	}
2177 2177
 
2178
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) {
2178
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) {
2179 2179
 		Give()->logs->log_db->create_table();
2180 2180
 	}
2181 2181
 
2182
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) {
2182
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) {
2183 2183
 		Give()->logs->logmeta_db->create_table();
2184 2184
 	}
2185 2185
 }
@@ -2196,7 +2196,7 @@  discard block
 block discarded – undo
2196 2196
 	$give_updates = Give_Updates::get_instance();
2197 2197
 
2198 2198
 	// form query
2199
-	$forms = new WP_Query( array(
2199
+	$forms = new WP_Query(array(
2200 2200
 			'paged'          => $give_updates->step,
2201 2201
 			'status'         => 'any',
2202 2202
 			'order'          => 'ASC',
@@ -2213,25 +2213,25 @@  discard block
 block discarded – undo
2213 2213
 		)
2214 2214
 	);
2215 2215
 
2216
-	if ( $forms->have_posts() ) {
2217
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
2216
+	if ($forms->have_posts()) {
2217
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
2218 2218
 
2219
-		while ( $forms->have_posts() ) {
2219
+		while ($forms->have_posts()) {
2220 2220
 			$forms->the_post();
2221 2221
 			global $post;
2222 2222
 
2223 2223
 			// Do not add new meta keys if already refactored.
2224
-			if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id' ) ) ) {
2224
+			if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id'))) {
2225 2225
 				continue;
2226 2226
 			}
2227 2227
 
2228 2228
 
2229 2229
 			// Split _give_payment_meta meta.
2230 2230
 			// @todo Remove _give_payment_meta after releases 2.0
2231
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
2231
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
2232 2232
 
2233
-			if ( ! empty( $payment_meta ) ) {
2234
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
2233
+			if ( ! empty($payment_meta)) {
2234
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
2235 2235
 			}
2236 2236
 
2237 2237
 			$deprecated_meta_keys = array(
@@ -2240,9 +2240,9 @@  discard block
 block discarded – undo
2240 2240
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
2241 2241
 			);
2242 2242
 
2243
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
2243
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
2244 2244
 				// Do not add new meta key if already exist.
2245
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
2245
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
2246 2246
 					continue;
2247 2247
 				}
2248 2248
 
@@ -2251,25 +2251,25 @@  discard block
 block discarded – undo
2251 2251
 					array(
2252 2252
 						'post_id' => $post->ID,
2253 2253
 						'meta_key' => $new_meta_key,
2254
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true )
2254
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true)
2255 2255
 					)
2256 2256
 				);
2257 2257
 			}
2258 2258
 
2259 2259
 			// Bailout
2260
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
2260
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
2261 2261
 				/* @var Give_Donor $donor */
2262
-				$donor = new Give_Donor( $donor_id );
2262
+				$donor = new Give_Donor($donor_id);
2263 2263
 
2264
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
2265
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
2266
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
2267
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
2268
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
2269
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
2264
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
2265
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
2266
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
2267
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
2268
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
2269
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
2270 2270
 
2271 2271
 				// Save address.
2272
-				$donor->add_address( 'billing[]', $address );
2272
+				$donor->add_address('billing[]', $address);
2273 2273
 			}
2274 2274
 
2275 2275
 		}// End while().
@@ -2280,7 +2280,7 @@  discard block
 block discarded – undo
2280 2280
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
2281 2281
 
2282 2282
 		// No more forms found, finish up.
2283
-		give_set_upgrade_complete( 'v201_upgrades_payment_metadata' );
2283
+		give_set_upgrade_complete('v201_upgrades_payment_metadata');
2284 2284
 	}
2285 2285
 }
2286 2286
 
@@ -2295,19 +2295,19 @@  discard block
 block discarded – undo
2295 2295
 	$give_updates = Give_Updates::get_instance();
2296 2296
 
2297 2297
 	// form query
2298
-	$payments = new WP_Query( array(
2298
+	$payments = new WP_Query(array(
2299 2299
 			'paged'          => $give_updates->step,
2300 2300
 			'status'         => 'any',
2301 2301
 			'order'          => 'ASC',
2302
-			'post_type'      => array( 'give_forms', 'give_payment' ),
2302
+			'post_type'      => array('give_forms', 'give_payment'),
2303 2303
 			'posts_per_page' => 100,
2304 2304
 		)
2305 2305
 	);
2306 2306
 
2307
-	if ( $payments->have_posts() ) {
2308
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
2307
+	if ($payments->have_posts()) {
2308
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
2309 2309
 
2310
-		while ( $payments->have_posts() ) {
2310
+		while ($payments->have_posts()) {
2311 2311
 			$payments->the_post();
2312 2312
 			global $post;
2313 2313
 
@@ -2319,19 +2319,19 @@  discard block
 block discarded – undo
2319 2319
 				ARRAY_A
2320 2320
 			);
2321 2321
 
2322
-			if ( ! empty( $meta_data ) ) {
2323
-				foreach ( $meta_data as $index => $data ) {
2322
+			if ( ! empty($meta_data)) {
2323
+				foreach ($meta_data as $index => $data) {
2324 2324
 					// Check for duplicate meta values.
2325
-					if( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) .  " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
2325
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
2326 2326
 						continue;
2327 2327
 					}
2328 2328
 
2329
-					switch ( $post->post_type ) {
2329
+					switch ($post->post_type) {
2330 2330
 						case 'give_forms':
2331 2331
 							$data['form_id'] = $data['post_id'];
2332
-							unset( $data['post_id'] );
2332
+							unset($data['post_id']);
2333 2333
 
2334
-							Give()->form_meta->insert( $data );
2334
+							Give()->form_meta->insert($data);
2335 2335
 							// @todo: delete form meta from post meta table after releases 2.0.
2336 2336
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2337 2337
 
@@ -2339,9 +2339,9 @@  discard block
 block discarded – undo
2339 2339
 
2340 2340
 						case 'give_payment':
2341 2341
 							$data['payment_id'] = $data['post_id'];
2342
-							unset( $data['post_id'] );
2342
+							unset($data['post_id']);
2343 2343
 
2344
-							Give()->payment_meta->insert( $data );
2344
+							Give()->payment_meta->insert($data);
2345 2345
 
2346 2346
 							// @todo: delete donation meta from post meta table after releases 2.0.
2347 2347
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
 		wp_reset_postdata();
2357 2357
 	} else {
2358 2358
 		// No more forms found, finish up.
2359
-		give_set_upgrade_complete( 'v201_move_metadata_into_new_table' );
2359
+		give_set_upgrade_complete('v201_move_metadata_into_new_table');
2360 2360
 	}
2361 2361
 
2362 2362
 }
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 	$give_updates = Give_Updates::get_instance();
2373 2373
 
2374 2374
 	// form query
2375
-	$forms = new WP_Query( array(
2375
+	$forms = new WP_Query(array(
2376 2376
 			'paged'          => $give_updates->step,
2377 2377
 			'order'          => 'DESC',
2378 2378
 			'post_type'      => 'give_log',
@@ -2381,20 +2381,20 @@  discard block
 block discarded – undo
2381 2381
 		)
2382 2382
 	);
2383 2383
 
2384
-	if ( $forms->have_posts() ) {
2385
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
2384
+	if ($forms->have_posts()) {
2385
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
2386 2386
 
2387
-		while ( $forms->have_posts() ) {
2387
+		while ($forms->have_posts()) {
2388 2388
 			$forms->the_post();
2389 2389
 			global $post;
2390 2390
 
2391
-			if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
2391
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
2392 2392
 				continue;
2393 2393
 			}
2394 2394
 
2395
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
2396
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
2397
-			$term_name = ! empty( $term ) ? $term->slug : '';
2395
+			$term      = get_the_terms($post->ID, 'give_log_type');
2396
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
2397
+			$term_name = ! empty($term) ? $term->slug : '';
2398 2398
 
2399 2399
 			$log_data = array(
2400 2400
 				'ID'           => $post->ID,
@@ -2407,29 +2407,29 @@  discard block
 block discarded – undo
2407 2407
 			);
2408 2408
 			$log_meta = array();
2409 2409
 
2410
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
2411
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
2412
-					switch ( $meta_key ) {
2410
+			if ($old_log_meta = get_post_meta($post->ID)) {
2411
+				foreach ($old_log_meta as $meta_key => $meta_value) {
2412
+					switch ($meta_key) {
2413 2413
 						case '_give_log_payment_id':
2414
-							$log_data['log_parent']        = current( $meta_value );
2414
+							$log_data['log_parent']        = current($meta_value);
2415 2415
 							$log_meta['_give_log_form_id'] = $post->post_parent;
2416 2416
 							break;
2417 2417
 
2418 2418
 						default:
2419
-							$log_meta[ $meta_key ] = current( $meta_value );
2419
+							$log_meta[$meta_key] = current($meta_value);
2420 2420
 					}
2421 2421
 				}
2422 2422
 			}
2423 2423
 
2424
-			if ( 'api_request' === $term_name ) {
2424
+			if ('api_request' === $term_name) {
2425 2425
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
2426 2426
 			}
2427 2427
 
2428
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
2428
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
2429 2429
 
2430
-			if ( ! empty( $log_meta ) ) {
2431
-				foreach ( $log_meta as $meta_key => $meta_value ) {
2432
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
2430
+			if ( ! empty($log_meta)) {
2431
+				foreach ($log_meta as $meta_key => $meta_value) {
2432
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
2433 2433
 				}
2434 2434
 			}
2435 2435
 
@@ -2442,7 +2442,7 @@  discard block
 block discarded – undo
2442 2442
 		Give()->logs->delete_cache();
2443 2443
 
2444 2444
 		// No more forms found, finish up.
2445
-		give_set_upgrade_complete( 'v201_logs_upgrades' );
2445
+		give_set_upgrade_complete('v201_logs_upgrades');
2446 2446
 	}
2447 2447
 }
2448 2448
 
@@ -2453,54 +2453,54 @@  discard block
 block discarded – undo
2453 2453
  * @since  2.0.1
2454 2454
  * @return void
2455 2455
  */
2456
-function give_v201_add_missing_donors_callback(){
2456
+function give_v201_add_missing_donors_callback() {
2457 2457
 	global $wpdb;
2458 2458
 
2459
-	if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) {
2460
-		$customers  = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' );
2461
-		$donors     = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' );
2459
+	if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) {
2460
+		$customers  = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id');
2461
+		$donors     = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id');
2462 2462
 		$donor_data = array();
2463 2463
 
2464
-		if ( $missing_donors = array_diff( $customers, $donors ) ) {
2465
-			foreach ( $missing_donors as $donor_id ) {
2464
+		if ($missing_donors = array_diff($customers, $donors)) {
2465
+			foreach ($missing_donors as $donor_id) {
2466 2466
 				$donor_data[] = array(
2467
-					'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ),
2468
-					'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ),
2467
+					'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)),
2468
+					'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)),
2469 2469
 
2470 2470
 				);
2471 2471
 			}
2472 2472
 		}
2473 2473
 
2474
-		if( ! empty( $donor_data ) ) {
2474
+		if ( ! empty($donor_data)) {
2475 2475
 			$donor_table_name = Give()->donors->table_name;
2476 2476
 			$donor_meta_table_name = Give()->donor_meta->table_name;
2477 2477
 
2478 2478
 			Give()->donors->table_name = "{$wpdb->prefix}give_donors";
2479 2479
 			Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta";
2480 2480
 
2481
-			foreach ( $donor_data as $donor ) {
2481
+			foreach ($donor_data as $donor) {
2482 2482
 				$donor['info'][0] = (array) $donor['info'][0];
2483 2483
 
2484 2484
 				// Prevent duplicate meta id issue.
2485
-				if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ){
2485
+				if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) {
2486 2486
 					continue;
2487 2487
 				}
2488 2488
 
2489
-				$donor_id = Give()->donors->add( $donor['info'][0] );
2489
+				$donor_id = Give()->donors->add($donor['info'][0]);
2490 2490
 
2491
-				if( ! empty( $donor['meta'] ) ) {
2492
-					foreach ( $donor['meta'] as $donor_meta ) {
2491
+				if ( ! empty($donor['meta'])) {
2492
+					foreach ($donor['meta'] as $donor_meta) {
2493 2493
 						$donor_meta = (array) $donor_meta;
2494 2494
 
2495 2495
 						// Prevent duplicate meta id issue.
2496
-						if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ){
2497
-							unset( $donor_meta['meta_id'] );
2496
+						if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) {
2497
+							unset($donor_meta['meta_id']);
2498 2498
 						}
2499 2499
 
2500 2500
 						$donor_meta['donor_id'] = $donor_meta['customer_id'];
2501
-						unset( $donor_meta['customer_id'] );
2501
+						unset($donor_meta['customer_id']);
2502 2502
 
2503
-						Give()->donor_meta->insert( $donor_meta );
2503
+						Give()->donor_meta->insert($donor_meta);
2504 2504
 					}
2505 2505
 				}
2506 2506
 
@@ -2519,35 +2519,35 @@  discard block
 block discarded – undo
2519 2519
 					)
2520 2520
 				);
2521 2521
 
2522
-				$donor = new Give_Donor( $donor_id );
2522
+				$donor = new Give_Donor($donor_id);
2523 2523
 
2524
-				if ( ! empty( $address ) ) {
2525
-					$address = maybe_unserialize( $address );
2526
-					$donor->add_address( 'personal', $address );
2527
-					$donor->add_address( 'billing[]', $address );
2524
+				if ( ! empty($address)) {
2525
+					$address = maybe_unserialize($address);
2526
+					$donor->add_address('personal', $address);
2527
+					$donor->add_address('billing[]', $address);
2528 2528
 				}
2529 2529
 
2530
-				$donor_name       = explode( ' ', $donor->name, 2 );
2531
-				$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2532
-				$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2530
+				$donor_name       = explode(' ', $donor->name, 2);
2531
+				$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2532
+				$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2533 2533
 
2534 2534
 				// If first name meta of donor is not created, then create it.
2535
-				if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2536
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2535
+				if ( ! $donor_first_name && isset($donor_name[0])) {
2536
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2537 2537
 				}
2538 2538
 
2539 2539
 				// If last name meta of donor is not created, then create it.
2540
-				if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2541
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2540
+				if ( ! $donor_last_name && isset($donor_name[1])) {
2541
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2542 2542
 				}
2543 2543
 
2544 2544
 				// If Donor is connected with WP User then update user meta.
2545
-				if ( $donor->user_id ) {
2546
-					if ( isset( $donor_name[0] ) ) {
2547
-						update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2545
+				if ($donor->user_id) {
2546
+					if (isset($donor_name[0])) {
2547
+						update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2548 2548
 					}
2549
-					if ( isset( $donor_name[1] ) ) {
2550
-						update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2549
+					if (isset($donor_name[1])) {
2550
+						update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2551 2551
 					}
2552 2552
 				}
2553 2553
 			}
@@ -2558,5 +2558,5 @@  discard block
 block discarded – undo
2558 2558
 	}
2559 2559
 
2560 2560
 	Give_Updates::get_instance()->percentage = 100;
2561
-	give_set_upgrade_complete('v201_add_missing_donors' );
2561
+	give_set_upgrade_complete('v201_add_missing_donors');
2562 2562
 }
2563 2563
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades.php 1 patch
Spacing   +30 added lines, -31 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
 
@@ -18,48 +18,47 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 <div class="wrap" id="poststuff">
20 20
 	<div id="give-updates">
21
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
21
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1>
22 22
 		<hr class="wp-header-end">
23 23
 
24 24
 		<div class="give-update-panel-content">
25
-			<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
25
+			<p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p>
26 26
 		</div>
27 27
 
28 28
 		<?php $db_updates = $give_updates->get_pending_db_update_count(); ?>
29
-		<?php if ( ! empty( $db_updates ) ) : ?>
29
+		<?php if ( ! empty($db_updates)) : ?>
30 30
 			<?php
31 31
 			$is_doing_updates = $give_updates->is_doing_updates();
32
-			$db_update_url    = add_query_arg( array( 'type' => 'database', ) );
33
-			$resume_updates   = get_option( 'give_doing_upgrade' );
34
-			$width            = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0;
32
+			$db_update_url    = add_query_arg(array('type' => 'database',));
33
+			$resume_updates   = get_option('give_doing_upgrade');
34
+			$width            = ! empty($resume_updates) ? $resume_updates['percentage'] : 0;
35 35
 			?>
36
-			<div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>">
36
+			<div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>">
37 37
 				<div class="postbox-container">
38 38
 					<div class="postbox">
39
-						<h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2>
39
+						<h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2>
40 40
 						<div class="inside">
41 41
 							<div class="panel-content">
42 42
 								<p class="give-update-button">
43
-									<span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : '';  ?>>
43
+									<span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
44 44
 										<?php echo sprintf(
45
-										__( '%1$s <a href="%2$s" class="%3$s">%4$s</a>', 'give' ),
45
+										__('%1$s <a href="%2$s" class="%3$s">%4$s</a>', 'give'),
46 46
 										$is_doing_updates ?
47
-											__( 'Give is currently updating the database in the background.', 'give' ) :
48
-											__( 'Give needs to update the database.', 'give' ),
47
+											__('Give is currently updating the database in the background.', 'give') : __('Give needs to update the database.', 'give'),
49 48
 										$db_update_url,
50
-										( $is_doing_updates ? 'give-hidden' : '' ),
51
-										__( 'Update now', 'give' )
49
+										($is_doing_updates ? 'give-hidden' : ''),
50
+										__('Update now', 'give')
52 51
 									);
53 52
 									?>
54 53
 									</span>
55
-									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process()  ? 'style="display:none;"' : '';  ?>>
54
+									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
56 55
 										<?php _e('The updates have been paused.', 'give'); ?>
57 56
 									</span>
58 57
 
59
-									<?php if ( Give_Updates::$background_updater->is_paused_process() ) : ?>
60
-										<button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1' ) ); ?>"><?php _e( 'Restart Upgrades', 'give' ); ?></button>
61
-									<?php elseif( $give_updates->is_doing_updates() ): ?>
62
-										<button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1' ) ); ?>"><?php _e( 'Pause Upgrades', 'give' ); ?></button>
58
+									<?php if (Give_Updates::$background_updater->is_paused_process()) : ?>
59
+										<button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1')); ?>"><?php _e('Restart Upgrades', 'give'); ?></button>
60
+									<?php elseif ($give_updates->is_doing_updates()): ?>
61
+										<button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1')); ?>"><?php _e('Pause Upgrades', 'give'); ?></button>
63 62
 									<?php endif; ?>
64 63
 
65 64
 									<script type="text/javascript">
@@ -67,7 +66,7 @@  discard block
 block discarded – undo
67 66
 											e.preventDefault();
68 67
 											jQuery('.give-doing-update-text-p').hide();
69 68
 											jQuery('.give-update-paused-text-p').show();
70
-											if (window.confirm('<?php echo esc_js( __( 'Do you want to stop the update process now?', 'give' ) ); ?>')) {
69
+											if (window.confirm('<?php echo esc_js(__('Do you want to stop the update process now?', 'give')); ?>')) {
71 70
 												window.location.assign(jQuery(this).data('redirect-url'));
72 71
 											}
73 72
 										});
@@ -75,7 +74,7 @@  discard block
 block discarded – undo
75 74
 											e.preventDefault();
76 75
 											jQuery('.give-doing-update-text-p').show();
77 76
 											jQuery('.give-update-paused-text-p').hide();
78
-											if (window.confirm('<?php echo esc_js( __( 'Do you want to restart the update process?', 'give' ) ); ?>')) {
77
+											if (window.confirm('<?php echo esc_js(__('Do you want to restart the update process?', 'give')); ?>')) {
79 78
 												window.location.assign(jQuery(this).data('redirect-url'));
80 79
 											}
81 80
 										});
@@ -87,7 +86,7 @@  discard block
 block discarded – undo
87 86
 									<strong>
88 87
 										<?php
89 88
 										echo sprintf(
90
-											__( 'Update %s of %s', 'give' ),
89
+											__('Update %s of %s', 'give'),
91 90
 											$give_updates->get_running_db_update(),
92 91
 											$give_updates->get_total_new_db_update_count()
93 92
 										);
@@ -95,10 +94,10 @@  discard block
 block discarded – undo
95 94
 									</strong>
96 95
 								</p>
97 96
 								<div class="progress-content">
98
-									<?php if ( $is_doing_updates  ) : ?>
97
+									<?php if ($is_doing_updates) : ?>
99 98
 										<div class="notice-wrap give-clearfix">
100 99
 
101
-											<?php if ( ! Give_Updates::$background_updater->is_paused_process() ) :  ?>
100
+											<?php if ( ! Give_Updates::$background_updater->is_paused_process()) :  ?>
102 101
 												<span class="spinner is-active"></span>
103 102
 											<?php endif; ?>
104 103
 
@@ -110,7 +109,7 @@  discard block
 block discarded – undo
110 109
 								</div>
111 110
 							</div>
112 111
 
113
-							<?php if ( ! $is_doing_updates ) : ?>
112
+							<?php if ( ! $is_doing_updates) : ?>
114 113
 								<div class="give-run-database-update"></div>
115 114
 							<?php endif; ?>
116 115
 						</div>
@@ -121,17 +120,17 @@  discard block
 block discarded – undo
121 120
 		<?php endif; ?>
122 121
 
123 122
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
124
-		<?php if ( ! empty( $plugin_updates ) ) : ?>
125
-			<?php $plugin_update_url = add_query_arg( array(
123
+		<?php if ( ! empty($plugin_updates)) : ?>
124
+			<?php $plugin_update_url = add_query_arg(array(
126 125
 				's' => 'Give',
127
-			), admin_url( '/plugins.php' ) ); ?>
126
+			), admin_url('/plugins.php')); ?>
128 127
 			<div id="give-plugin-updates">
129 128
 				<div class="postbox-container">
130 129
 					<div class="postbox">
131
-						<h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2>
130
+						<h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2>
132 131
 						<div class="inside">
133 132
 							<div class="panel-content">
134
-								<p><?php echo sprintf( __( 'There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give' ), _n( 'is', 'are', $plugin_updates, 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), _n( 'needs', 'need', $plugin_updates, 'give' ), $plugin_update_url ); ?></p>
133
+								<p><?php echo sprintf(__('There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give'), _n('is', 'are', $plugin_updates, 'give'), $plugin_updates, _n('add-on', 'add-ons', $plugin_updates, 'give'), _n('needs', 'need', $plugin_updates, 'give'), $plugin_update_url); ?></p>
135 134
 								<?php include_once 'plugins-update-section.php'; ?>
136 135
 							</div>
137 136
 						</div>
Please login to merge, or discard this patch.
includes/admin/upgrades/class-give-updates.php 1 patch
Spacing   +197 added lines, -203 removed lines patch added patch discarded remove patch
@@ -80,34 +80,34 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param array $args
82 82
 	 */
83
-	public function register( $args ) {
83
+	public function register($args) {
84 84
 		$args_default = array(
85 85
 			'id'       => '',
86 86
 			'version'  => '',
87 87
 			'callback' => '',
88 88
 		);
89 89
 
90
-		$args = wp_parse_args( $args, $args_default );
90
+		$args = wp_parse_args($args, $args_default);
91 91
 
92 92
 		// You can only register database upgrade.
93 93
 		$args['type'] = 'database';
94 94
 
95 95
 		// Bailout.
96 96
 		if (
97
-			empty( $args['id'] ) ||
98
-			empty( $args['version'] ) ||
99
-			empty( $args['callback'] ) ||
100
-			! is_callable( $args['callback'] )
97
+			empty($args['id']) ||
98
+			empty($args['version']) ||
99
+			empty($args['callback']) ||
100
+			! is_callable($args['callback'])
101 101
 		) {
102 102
 			return;
103 103
 		}
104 104
 
105 105
 		// Change depend param to array.
106
-		if ( isset( $args['depend'] ) && is_string( $args['depend'] ) ) {
107
-			$args['depend'] = array( $args['depend'] );
106
+		if (isset($args['depend']) && is_string($args['depend'])) {
107
+			$args['depend'] = array($args['depend']);
108 108
 		}
109 109
 
110
-		$this->updates[ $args['type'] ][] = $args;
110
+		$this->updates[$args['type']][] = $args;
111 111
 	}
112 112
 
113 113
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @return static
119 119
 	 */
120 120
 	static function get_instance() {
121
-		if ( is_null( self::$instance ) ) {
121
+		if (is_null(self::$instance)) {
122 122
 			self::$instance = new self();
123 123
 		}
124 124
 
@@ -136,27 +136,27 @@  discard block
 block discarded – undo
136 136
 		/**
137 137
 		 * Load file
138 138
 		 */
139
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-background-updater.php';
140
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
139
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-background-updater.php';
140
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
141 141
 
142 142
 		self::$background_updater = new Give_Background_Updater();
143 143
 
144 144
 		/**
145 145
 		 * Setup hooks.
146 146
 		 */
147
-		add_action( 'init', array( $this, '__register_upgrade' ), 9999 );
148
-		add_action( 'give_set_upgrade_completed', array( $this, '__flush_resume_updates' ), 9999 );
149
-		add_action( 'wp_ajax_give_db_updates_info', array( $this, '__give_db_updates_info' ) );
150
-		add_action( 'wp_ajax_give_run_db_updates', array( $this, '__give_start_updating' ) );
151
-		add_action( 'admin_init', array( $this, '__redirect_admin' ) );
152
-		add_action( 'admin_init', array( $this, '__pause_db_update' ), -1 );
153
-		add_action( 'admin_init', array( $this, '__restart_db_update' ), -1 );
154
-		add_action( 'admin_notices', array( $this, '__show_notice' ) );
155
-		add_action( 'give_restart_db_upgrade', array( $this, '__health_background_update' ) );
147
+		add_action('init', array($this, '__register_upgrade'), 9999);
148
+		add_action('give_set_upgrade_completed', array($this, '__flush_resume_updates'), 9999);
149
+		add_action('wp_ajax_give_db_updates_info', array($this, '__give_db_updates_info'));
150
+		add_action('wp_ajax_give_run_db_updates', array($this, '__give_start_updating'));
151
+		add_action('admin_init', array($this, '__redirect_admin'));
152
+		add_action('admin_init', array($this, '__pause_db_update'), -1);
153
+		add_action('admin_init', array($this, '__restart_db_update'), -1);
154
+		add_action('admin_notices', array($this, '__show_notice'));
155
+		add_action('give_restart_db_upgrade', array($this, '__health_background_update'));
156 156
 
157
-		if ( is_admin() ) {
158
-			add_action( 'admin_init', array( $this, '__change_donations_label' ), 9999 );
159
-			add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 );
157
+		if (is_admin()) {
158
+			add_action('admin_init', array($this, '__change_donations_label'), 9999);
159
+			add_action('admin_menu', array($this, '__register_menu'), 9999);
160 160
 		}
161 161
 	}
162 162
 
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 		$addons         = give_get_plugins();
171 171
 		$plugin_updates = get_plugin_updates();
172 172
 
173
-		foreach ( $addons as $key => $info ) {
174
-			if ( 'active' != $info['Status'] || 'add-on' != $info['Type'] || empty( $plugin_updates[ $key ] ) ) {
173
+		foreach ($addons as $key => $info) {
174
+			if ('active' != $info['Status'] || 'add-on' != $info['Type'] || empty($plugin_updates[$key])) {
175 175
 				continue;
176 176
 			}
177 177
 
178
-			$this->updates['plugin'][] = array_merge( $info, (array) $plugin_updates[ $key ] );
178
+			$this->updates['plugin'][] = array_merge($info, (array) $plugin_updates[$key]);
179 179
 		}
180 180
 	}
181 181
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @access public
188 188
 	 */
189 189
 	public function __register_upgrade() {
190
-		if ( ! is_admin() ) {
190
+		if ( ! is_admin()) {
191 191
 			return;
192 192
 		}
193 193
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		 *
197 197
 		 * @since 1.8.12
198 198
 		 */
199
-		do_action( 'give_register_updates', $this );
199
+		do_action('give_register_updates', $this);
200 200
 	}
201 201
 
202 202
 	/**
@@ -209,23 +209,22 @@  discard block
 block discarded – undo
209 209
 		global $menu;
210 210
 
211 211
 		// Bailout.
212
-		if ( empty( $menu ) || ! $this->get_total_update_count() ) {
212
+		if (empty($menu) || ! $this->get_total_update_count()) {
213 213
 			return;
214 214
 		}
215 215
 
216
-		$is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() );
216
+		$is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process());
217 217
 
218
-		foreach ( $menu as $index => $menu_item ) {
219
-			if ( 'edit.php?post_type=give_forms' !== $menu_item[2] ) {
218
+		foreach ($menu as $index => $menu_item) {
219
+			if ('edit.php?post_type=give_forms' !== $menu_item[2]) {
220 220
 				continue;
221 221
 			}
222 222
 
223
-			$menu[ $index ][0] = sprintf(
223
+			$menu[$index][0] = sprintf(
224 224
 				'%1$s <span class="update-plugins"><span class="plugin-count give-update-progress-count">%2$s%3$s</span></span>',
225
-				__( 'Donations', 'give' ),
225
+				__('Donations', 'give'),
226 226
 				$is_update ?
227
-					$this->get_db_update_processing_percentage() :
228
-					$this->get_total_update_count(),
227
+					$this->get_db_update_processing_percentage() : $this->get_total_update_count(),
229 228
 				$is_update ? '%' : ''
230 229
 			);
231 230
 
@@ -241,7 +240,7 @@  discard block
 block discarded – undo
241 240
 	 */
242 241
 	public function __register_menu() {
243 242
 		// Bailout.
244
-		if( ! give_test_ajax_works() ) {
243
+		if ( ! give_test_ajax_works()) {
245 244
 			return;
246 245
 		}
247 246
 
@@ -249,41 +248,40 @@  discard block
 block discarded – undo
249 248
 		$this->__register_plugin_addon_updates();
250 249
 
251 250
 		// Bailout.
252
-		if ( ! $this->get_total_update_count() ) {
251
+		if ( ! $this->get_total_update_count()) {
253 252
 			// Show complete update message if still on update setting page.
254
-			if ( isset( $_GET['page'] ) && 'give-updates' === $_GET['page'] ) {
253
+			if (isset($_GET['page']) && 'give-updates' === $_GET['page']) {
255 254
 				// Upgrades
256 255
 				add_submenu_page(
257 256
 					'edit.php?post_type=give_forms',
258
-					esc_html__( 'Give Updates Complete', 'give' ),
259
-					__( 'Updates', 'give' ),
257
+					esc_html__('Give Updates Complete', 'give'),
258
+					__('Updates', 'give'),
260 259
 					'manage_give_settings',
261 260
 					'give-updates',
262
-					array( $this, 'render_complete_page' )
261
+					array($this, 'render_complete_page')
263 262
 				);
264 263
 			}
265 264
 
266 265
 			return;
267 266
 		}
268 267
 
269
-		$is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() );
268
+		$is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process());
270 269
 
271 270
 		// Upgrades
272 271
 		add_submenu_page(
273 272
 			'edit.php?post_type=give_forms',
274
-			esc_html__( 'Give Updates', 'give' ),
273
+			esc_html__('Give Updates', 'give'),
275 274
 			sprintf(
276 275
 				'%1$s <span class="update-plugins"%2$s><span class="plugin-count give-update-progress-count">%3$s%4$s</span></span>',
277
-				__( 'Updates', 'give' ),
278
-				isset( $_GET['give-pause-db-upgrades'] ) ? ' style="display:none;"' : '',
276
+				__('Updates', 'give'),
277
+				isset($_GET['give-pause-db-upgrades']) ? ' style="display:none;"' : '',
279 278
 				$is_update ?
280
-					$this->get_db_update_processing_percentage() :
281
-					$this->get_total_update_count(),
279
+					$this->get_db_update_processing_percentage() : $this->get_total_update_count(),
282 280
 				$is_update ? '%' : ''
283 281
 			),
284 282
 			'manage_give_settings',
285 283
 			'give-updates',
286
-			array( $this, 'render_page' )
284
+			array($this, 'render_page')
287 285
 		);
288 286
 	}
289 287
 
@@ -298,13 +296,13 @@  discard block
 block discarded – undo
298 296
 		// Show db upgrade completed notice.
299 297
 		if (
300 298
 			! wp_doing_ajax() &&
301
-			current_user_can( 'manage_give_settings' ) &&
302
-			get_option( 'give_show_db_upgrade_complete_notice' ) &&
303
-			! isset( $_GET['give-db-update-completed'] )
299
+			current_user_can('manage_give_settings') &&
300
+			get_option('give_show_db_upgrade_complete_notice') &&
301
+			! isset($_GET['give-db-update-completed'])
304 302
 		) {
305
-			delete_option( 'give_show_db_upgrade_complete_notice' );
303
+			delete_option('give_show_db_upgrade_complete_notice');
306 304
 
307
-			wp_redirect( add_query_arg( array( 'give-db-update-completed' => 'give_db_upgrade_completed' ) ) );
305
+			wp_redirect(add_query_arg(array('give-db-update-completed' => 'give_db_upgrade_completed')));
308 306
 			exit();
309 307
 		}
310 308
 	}
@@ -322,9 +320,9 @@  discard block
 block discarded – undo
322 320
 		// Bailout.
323 321
 		if (
324 322
 			wp_doing_ajax() ||
325
-			! isset( $_GET['page'] ) ||
323
+			! isset($_GET['page']) ||
326 324
 			'give-updates' !== $_GET['page'] ||
327
-			! isset( $_GET['give-pause-db-upgrades'] ) ||
325
+			! isset($_GET['give-pause-db-upgrades']) ||
328 326
 			self::$background_updater->is_paused_process()
329 327
 		) {
330 328
 			return false;
@@ -332,20 +330,20 @@  discard block
 block discarded – undo
332 330
 
333 331
 		$batch = self::$background_updater->get_all_batch();
334 332
 
335
-		if ( ! empty( $batch ) ) {
336
-			update_option( 'give_paused_batches', $batch,  'no' );
337
-			delete_option( $batch->key );
338
-			delete_site_transient( self::$background_updater->get_identifier() . '_process_lock' );
339
-			wp_clear_scheduled_hook( self::$background_updater->get_cron_identifier() );
333
+		if ( ! empty($batch)) {
334
+			update_option('give_paused_batches', $batch, 'no');
335
+			delete_option($batch->key);
336
+			delete_site_transient(self::$background_updater->get_identifier().'_process_lock');
337
+			wp_clear_scheduled_hook(self::$background_updater->get_cron_identifier());
340 338
 
341
-			Give()->logs->add( 'Update Pause', print_r( $batch, true ), 0, 'update' );
339
+			Give()->logs->add('Update Pause', print_r($batch, true), 0, 'update');
342 340
 
343 341
 			/**
344 342
 			 * Fire action when pause db updates
345 343
 			 *
346 344
 			 * @since 2.0.1
347 345
 			 */
348
-			do_action( 'give_pause_db_upgrade', $this );
346
+			do_action('give_pause_db_upgrade', $this);
349 347
 		}
350 348
 
351 349
 		return true;
@@ -363,28 +361,28 @@  discard block
 block discarded – undo
363 361
 		// Bailout.
364 362
 		if (
365 363
 			wp_doing_ajax() ||
366
-			! isset( $_GET['page'] ) ||
364
+			! isset($_GET['page']) ||
367 365
 			'give-updates' !== $_GET['page'] ||
368
-			! isset( $_GET['give-restart-db-upgrades'] ) ||
366
+			! isset($_GET['give-restart-db-upgrades']) ||
369 367
 			! self::$background_updater->is_paused_process()
370 368
 		) {
371 369
 			return false;
372 370
 		}
373 371
 
374
-		$batch = get_option( 'give_paused_batches' );
372
+		$batch = get_option('give_paused_batches');
375 373
 
376
-		if ( ! empty( $batch ) ) {
377
-			update_option( $batch->key, $batch->data );
378
-			delete_option( 'give_paused_batches' );
374
+		if ( ! empty($batch)) {
375
+			update_option($batch->key, $batch->data);
376
+			delete_option('give_paused_batches');
379 377
 
380
-			Give()->logs->add( 'Update Restart', print_r( $batch, true ), 0, 'update' );
378
+			Give()->logs->add('Update Restart', print_r($batch, true), 0, 'update');
381 379
 
382 380
 
383 381
 			/** Fire action when restart db updates
384 382
 			 *
385 383
 			 * @since 2.0.1
386 384
 			 */
387
-			do_action( 'give_restart_db_upgrade', $this );
385
+			do_action('give_restart_db_upgrade', $this);
388 386
 
389 387
 			self::$background_updater->dispatch();
390 388
 		}
@@ -400,77 +398,77 @@  discard block
 block discarded – undo
400 398
 	 *
401 399
 	 * @param Give_Updates $give_updates
402 400
 	 */
403
-	public function __health_background_update( $give_updates ) {
404
-		if( ! $this->is_doing_updates() ) {
401
+	public function __health_background_update($give_updates) {
402
+		if ( ! $this->is_doing_updates()) {
405 403
 			return;
406 404
 		}
407 405
 
408 406
 		$batch                = Give_Updates::$background_updater->get_all_batch();
409
-		$batch_data_count     = count( $batch->data );
410
-		$all_updates          = $give_updates->get_updates( 'database', 'all' );
411
-		$all_update_ids       = wp_list_pluck( $all_updates, 'id' );
412
-		$all_batch_update_ids = ! empty( $batch ) ? wp_list_pluck( $batch->data, 'id' ) : array();
407
+		$batch_data_count     = count($batch->data);
408
+		$all_updates          = $give_updates->get_updates('database', 'all');
409
+		$all_update_ids       = wp_list_pluck($all_updates, 'id');
410
+		$all_batch_update_ids = ! empty($batch) ? wp_list_pluck($batch->data, 'id') : array();
413 411
 		$log_data             = '';
414 412
 
415
-		if ( ! empty( $batch ) ) {
413
+		if ( ! empty($batch)) {
416 414
 
417
-			foreach ( $batch->data as $index => $update ) {
418
-				$log_data = print_r( $update, true ) . "\n";
415
+			foreach ($batch->data as $index => $update) {
416
+				$log_data = print_r($update, true)."\n";
419 417
 
420
-				if ( ! is_callable( $update['callback'] ) ) {
421
-					$log_data .= 'Removing missing callback update: ' . "{$update['id']}\n";
422
-					unset( $batch->data[ $index ] );
418
+				if ( ! is_callable($update['callback'])) {
419
+					$log_data .= 'Removing missing callback update: '."{$update['id']}\n";
420
+					unset($batch->data[$index]);
423 421
 				}
424 422
 
425
-				if ( ! empty( $update['depend'] ) ) {
423
+				if ( ! empty($update['depend'])) {
426 424
 
427
-					foreach ( $update['depend'] as $depend ) {
428
-						if ( give_has_upgrade_completed( $depend ) ) {
429
-							$log_data .= 'Completed update: ' . "{$depend}\n";
425
+					foreach ($update['depend'] as $depend) {
426
+						if (give_has_upgrade_completed($depend)) {
427
+							$log_data .= 'Completed update: '."{$depend}\n";
430 428
 							continue;
431 429
 						}
432 430
 
433
-						if ( in_array( $depend, $all_update_ids ) && ! in_array( $depend, $all_batch_update_ids ) ) {
434
-							$log_data .= 'Adding missing update: ' . "{$depend}\n";
435
-							array_unshift( $batch->data, $all_updates[ array_search( $depend, $all_update_ids ) ] );
431
+						if (in_array($depend, $all_update_ids) && ! in_array($depend, $all_batch_update_ids)) {
432
+							$log_data .= 'Adding missing update: '."{$depend}\n";
433
+							array_unshift($batch->data, $all_updates[array_search($depend, $all_update_ids)]);
436 434
 						}
437 435
 					}
438 436
 				}
439 437
 			}
440 438
 		}
441 439
 
442
-		if( $new_updates = $this->get_updates( 'database', 'new' ) ){
443
-			$all_batch_update_ids = ! empty( $batch ) ? wp_list_pluck( $batch->data, 'id' ) : array();
440
+		if ($new_updates = $this->get_updates('database', 'new')) {
441
+			$all_batch_update_ids = ! empty($batch) ? wp_list_pluck($batch->data, 'id') : array();
444 442
 
445
-			foreach ( $new_updates as $index => $new_update ) {
446
-				if( give_has_upgrade_completed( $new_update['id'] ) || in_array( $new_update['id'], $all_batch_update_ids ) ) {
447
-					unset( $new_updates[$index] );
443
+			foreach ($new_updates as $index => $new_update) {
444
+				if (give_has_upgrade_completed($new_update['id']) || in_array($new_update['id'], $all_batch_update_ids)) {
445
+					unset($new_updates[$index]);
448 446
 				}
449 447
 			}
450 448
 
451
-			if( ! empty( $new_updates ) ) {
452
-				$log_data .= 'Adding new update: ' . "\n";
453
-				$log_data .= print_r( $new_updates, true ) . "\n";
449
+			if ( ! empty($new_updates)) {
450
+				$log_data .= 'Adding new update: '."\n";
451
+				$log_data .= print_r($new_updates, true)."\n";
454 452
 
455
-				$batch->data = array_merge( $batch->data, $new_updates );
456
-				update_option( 'give_db_update_count',  ( absint( get_option( 'give_db_update_count' ) ) + count( $new_updates ) ) );
453
+				$batch->data = array_merge($batch->data, $new_updates);
454
+				update_option('give_db_update_count', (absint(get_option('give_db_update_count')) + count($new_updates)));
457 455
 			}
458 456
 		}
459 457
 
460
-		if ( $batch_data_count !== count( $batch->data ) ) {
461
-			$log_data .= 'Updating batch' . "\n";
462
-			$log_data .= print_r( $batch, true );
458
+		if ($batch_data_count !== count($batch->data)) {
459
+			$log_data .= 'Updating batch'."\n";
460
+			$log_data .= print_r($batch, true);
463 461
 
464
-			update_option( $batch->key, $batch->data );
462
+			update_option($batch->key, $batch->data);
465 463
 
466 464
 			// Reset update info.
467
-			$doing_upgrade_args                     = get_option( 'give_doing_upgrade' );
465
+			$doing_upgrade_args                     = get_option('give_doing_upgrade');
468 466
 			// $doing_upgrade_args['update']           = $give_updates->update;
469
-			$doing_upgrade_args['heading']          = sprintf( 'Update %s of %s', $doing_upgrade_args['update'], get_option( 'give_db_update_count' ) );
467
+			$doing_upgrade_args['heading']          = sprintf('Update %s of %s', $doing_upgrade_args['update'], get_option('give_db_update_count'));
470 468
 			$doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage();
471
-			update_option( 'give_doing_upgrade', $doing_upgrade_args );
469
+			update_option('give_doing_upgrade', $doing_upgrade_args);
472 470
 
473
-			Give()->logs->add( 'Update Health Check', $log_data, 0, 'update' );
471
+			Give()->logs->add('Update Health Check', $log_data, 0, 'update');
474 472
 		}
475 473
 	}
476 474
 
@@ -483,63 +481,63 @@  discard block
 block discarded – undo
483 481
 	 */
484 482
 	public function __show_notice() {
485 483
 		// Bailout.
486
-		if ( ! current_user_can( 'manage_give_settings' ) ) {
484
+		if ( ! current_user_can('manage_give_settings')) {
487 485
 			return;
488 486
 		}
489 487
 
490 488
 		// Run DB updates.
491
-		if ( ! empty( $_GET['give-run-db-update'] ) ) {
489
+		if ( ! empty($_GET['give-run-db-update'])) {
492 490
 			$this->run_db_update();
493 491
 		}
494 492
 
495 493
 
496 494
 		// Bailout.
497
-		if ( isset( $_GET['page'] ) && 'give-updates' === $_GET['page'] ) {
495
+		if (isset($_GET['page']) && 'give-updates' === $_GET['page']) {
498 496
 			return;
499 497
 		}
500 498
 
501 499
 		// Show notice if upgrade paused.
502
-		if ( self::$background_updater->is_paused_process() ) {
500
+		if (self::$background_updater->is_paused_process()) {
503 501
 			ob_start();
504 502
 			?>
505 503
 			<p>
506
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
507
-				&nbsp;&#8211;&nbsp;<?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give' ); ?>
504
+				<strong><?php _e('Database Update', 'give'); ?></strong>
505
+				&nbsp;&#8211;&nbsp;<?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give'); ?>
508 506
 			</p>
509 507
 			<p class="submit">
510
-				<a href="<?php echo esc_url( add_query_arg( array( 'give-restart-db-upgrades' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-restart-updater-btn">
511
-					<?php _e( 'Restart the updater', 'give' ); ?>
508
+				<a href="<?php echo esc_url(add_query_arg(array('give-restart-db-upgrades' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-restart-updater-btn">
509
+					<?php _e('Restart the updater', 'give'); ?>
512 510
 				</a>
513 511
 			</p>
514 512
 			<script type="text/javascript">
515 513
 				jQuery('.give-restart-updater-btn').click('click', function () {
516
-					return window.confirm('<?php echo esc_js( __( 'It is strongly recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ) ); ?>'); // jshint ignore:line
514
+					return window.confirm('<?php echo esc_js(__('It is strongly recommended that you backup your database before proceeding. Do you want to run the update now?', 'give')); ?>'); // jshint ignore:line
517 515
 				});
518 516
 			</script>
519 517
 			<?php
520 518
 			$desc_html = ob_get_clean();
521 519
 
522 520
 
523
-			Give()->notices->register_notice( array(
521
+			Give()->notices->register_notice(array(
524 522
 				'id'          => 'give_upgrade_db',
525 523
 				'type'        => 'error',
526 524
 				'dismissible' => false,
527 525
 				'description' => $desc_html,
528
-			) );
526
+			));
529 527
 		}
530 528
 
531 529
 		// Bailout if doing upgrades.
532
-		if( $this->is_doing_updates() ) {
530
+		if ($this->is_doing_updates()) {
533 531
 			return;
534 532
 		}
535 533
 
536 534
 		// Show notice if ajax is not working.
537
-		if ( ! give_test_ajax_works() ) {
535
+		if ( ! give_test_ajax_works()) {
538 536
 			Give()->notices->register_notice(
539 537
 				array(
540 538
 					'id'          => 'give_db_upgrade_ajax_inaccessible',
541 539
 					'type'        => 'error',
542
-					'description' => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give' ), 'http://docs.givewp.com/admin-ajax-error', __( 'Read More', 'give' ) . ' &raquo;' ),
540
+					'description' => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give'), 'http://docs.givewp.com/admin-ajax-error', __('Read More', 'give').' &raquo;'),
543 541
 					'show'        => true,
544 542
 				)
545 543
 			);
@@ -548,46 +546,46 @@  discard block
 block discarded – undo
548 546
 		}
549 547
 
550 548
 		// Show db upgrade completed notice.
551
-		if ( ! empty( $_GET['give-db-update-completed'] ) ) {
552
-			Give()->notices->register_notice( array(
549
+		if ( ! empty($_GET['give-db-update-completed'])) {
550
+			Give()->notices->register_notice(array(
553 551
 				'id'          => 'give_db_upgrade_completed',
554 552
 				'type'        => 'updated',
555
-				'description' => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
553
+				'description' => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
556 554
 				'show'        => true,
557
-			) );
555
+			));
558 556
 
559 557
 			// Start update.
560
-		} elseif ( ! empty( $_GET['give-run-db-update'] ) ) {
558
+		} elseif ( ! empty($_GET['give-run-db-update'])) {
561 559
 			$this->run_db_update();
562 560
 
563 561
 			// Show run the update notice.
564
-		} elseif ( $this->get_total_new_db_update_count() ) {
562
+		} elseif ($this->get_total_new_db_update_count()) {
565 563
 			ob_start();
566 564
 			?>
567 565
 			<p>
568
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
569
-				&nbsp;&#8211;&nbsp;<?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give' ); ?>
566
+				<strong><?php _e('Database Update', 'give'); ?></strong>
567
+				&nbsp;&#8211;&nbsp;<?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give'); ?>
570 568
 			</p>
571 569
 			<p class="submit">
572
-				<a href="<?php echo esc_url( add_query_arg( array( 'give-run-db-update' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-run-update-now">
573
-					<?php _e( 'Run the updater', 'give' ); ?>
570
+				<a href="<?php echo esc_url(add_query_arg(array('give-run-db-update' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-run-update-now">
571
+					<?php _e('Run the updater', 'give'); ?>
574 572
 				</a>
575 573
 			</p>
576 574
 			<script type="text/javascript">
577 575
 				jQuery('.give-run-update-now').click('click', function () {
578
-					return window.confirm('<?php echo esc_js( __( 'It is strongly recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ) ); ?>'); // jshint ignore:line
576
+					return window.confirm('<?php echo esc_js(__('It is strongly recommended that you backup your database before proceeding. Do you want to run the update now?', 'give')); ?>'); // jshint ignore:line
579 577
 				});
580 578
 			</script>
581 579
 			<?php
582 580
 			$desc_html = ob_get_clean();
583 581
 
584 582
 
585
-			Give()->notices->register_notice( array(
583
+			Give()->notices->register_notice(array(
586 584
 				'id'          => 'give_upgrade_db',
587 585
 				'type'        => 'updated',
588 586
 				'dismissible' => false,
589 587
 				'description' => $desc_html,
590
-			) );
588
+			));
591 589
 		}
592 590
 	}
593 591
 
@@ -598,7 +596,7 @@  discard block
 block discarded – undo
598 596
 	 * @access public
599 597
 	 */
600 598
 	public function render_complete_page() {
601
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades-complete.php';
599
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades-complete.php';
602 600
 	}
603 601
 
604 602
 	/**
@@ -608,7 +606,7 @@  discard block
 block discarded – undo
608 606
 	 * @access public
609 607
 	 */
610 608
 	public function render_page() {
611
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades.php';
609
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades.php';
612 610
 	}
613 611
 
614 612
 	/**
@@ -619,26 +617,26 @@  discard block
 block discarded – undo
619 617
 	 */
620 618
 	private function run_db_update() {
621 619
 		// Bailout.
622
-		if ( $this->is_doing_updates() || ! $this->get_total_new_db_update_count() ) {
620
+		if ($this->is_doing_updates() || ! $this->get_total_new_db_update_count()) {
623 621
 			return;
624 622
 		}
625 623
 
626
-		$updates = $this->get_updates( 'database', 'new' );
624
+		$updates = $this->get_updates('database', 'new');
627 625
 
628
-		foreach ( $updates as $update ) {
629
-			self::$background_updater->push_to_queue( $update );
626
+		foreach ($updates as $update) {
627
+			self::$background_updater->push_to_queue($update);
630 628
 		}
631 629
 
632
-		add_option( 'give_db_update_count', count( $updates ), '', 'no' );
630
+		add_option('give_db_update_count', count($updates), '', 'no');
633 631
 
634
-		add_option( 'give_doing_upgrade', array(
632
+		add_option('give_doing_upgrade', array(
635 633
 			'update_info' => $updates[0],
636 634
 			'step'        => 1,
637 635
 			'update'      => 1,
638
-			'heading'     => sprintf( 'Update %s of %s', 1, count( $updates ) ),
636
+			'heading'     => sprintf('Update %s of %s', 1, count($updates)),
639 637
 			'percentage'  => 0,
640 638
 			'total_percentage'  => 0,
641
-		), '', 'no' );
639
+		), '', 'no');
642 640
 
643 641
 		self::$background_updater->save()->dispatch();
644 642
 	}
@@ -652,11 +650,11 @@  discard block
 block discarded – undo
652 650
 	 */
653 651
 	public function __flush_resume_updates() {
654 652
 		//delete_option( 'give_doing_upgrade' );
655
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
653
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
656 654
 
657 655
 		// Reset counter.
658 656
 		$this->step = $this->percentage = 0;
659
-		++ $this->update;
657
+		++$this->update;
660 658
 	}
661 659
 
662 660
 
@@ -671,7 +669,7 @@  discard block
 block discarded – undo
671 669
 	public function __give_start_updating() {
672 670
 		// Check permission.
673 671
 		if (
674
-			! current_user_can( 'manage_give_settings' ) ||
672
+			! current_user_can('manage_give_settings') ||
675 673
 			$this->is_doing_updates()
676 674
 		) {
677 675
 			wp_send_json_error();
@@ -679,7 +677,7 @@  discard block
 block discarded – undo
679 677
 
680 678
 		// @todo: validate nonce
681 679
 		// @todo: set http method to post
682
-		if ( empty( $_POST['run_db_update'] ) ) {
680
+		if (empty($_POST['run_db_update'])) {
683 681
 			wp_send_json_error();
684 682
 		}
685 683
 
@@ -698,21 +696,21 @@  discard block
 block discarded – undo
698 696
 	 * @return string
699 697
 	 */
700 698
 	public function __give_db_updates_info() {
701
-		$update_info   = get_option( 'give_doing_upgrade' );
699
+		$update_info   = get_option('give_doing_upgrade');
702 700
 		$response_type = '';
703 701
 
704
-		if ( empty( $update_info ) ) {
705
-			$update_info   = array(
706
-				'message'    => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
707
-				'heading'    => __( 'Updates Completed.', 'give' ),
702
+		if (empty($update_info)) {
703
+			$update_info = array(
704
+				'message'    => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
705
+				'heading'    => __('Updates Completed.', 'give'),
708 706
 				'percentage' => 0,
709 707
 			);
710 708
 			$response_type = 'success';
711 709
 
712
-			delete_option( 'give_show_db_upgrade_complete_notice' );
710
+			delete_option('give_show_db_upgrade_complete_notice');
713 711
 		}
714 712
 
715
-		$this->send_ajax_response( $update_info, $response_type );
713
+		$this->send_ajax_response($update_info, $response_type);
716 714
 	}
717 715
 
718 716
 	/**
@@ -724,7 +722,7 @@  discard block
 block discarded – undo
724 722
 	 * @param        $data
725 723
 	 * @param string $type
726 724
 	 */
727
-	public function send_ajax_response( $data, $type = '' ) {
725
+	public function send_ajax_response($data, $type = '') {
728 726
 		$default = array(
729 727
 			'message'    => '',
730 728
 			'heading'    => '',
@@ -734,24 +732,24 @@  discard block
 block discarded – undo
734 732
 		);
735 733
 
736 734
 		// Set data.
737
-		$data = wp_parse_args( $data, $default );
735
+		$data = wp_parse_args($data, $default);
738 736
 
739 737
 		// Enable cache.
740 738
 		Give_Cache::enable();
741 739
 
742
-		switch ( $type ) {
740
+		switch ($type) {
743 741
 			case 'success':
744
-				wp_send_json_success( $data );
742
+				wp_send_json_success($data);
745 743
 				break;
746 744
 
747 745
 			case 'error':
748
-				wp_send_json_error( $data );
746
+				wp_send_json_error($data);
749 747
 				break;
750 748
 
751 749
 			default:
752
-				wp_send_json( array(
750
+				wp_send_json(array(
753 751
 					'data' => $data,
754
-				) );
752
+				));
755 753
 				break;
756 754
 		}
757 755
 	}
@@ -765,12 +763,12 @@  discard block
 block discarded – undo
765 763
 	 * @param $total
766 764
 	 * @param $current_total
767 765
 	 */
768
-	public function set_percentage( $total, $current_total ) {
766
+	public function set_percentage($total, $current_total) {
769 767
 		// Set percentage.
770
-		$this->percentage = $total ? ( ( $current_total ) / $total ) * 100 : 0;
768
+		$this->percentage = $total ? (($current_total) / $total) * 100 : 0;
771 769
 
772 770
 		// Verify percentage.
773
-		$this->percentage = ( 100 < $this->percentage ) ? 100 : $this->percentage;
771
+		$this->percentage = (100 < $this->percentage) ? 100 : $this->percentage;
774 772
 	}
775 773
 
776 774
 	/**
@@ -783,22 +781,22 @@  discard block
 block discarded – undo
783 781
 	 *
784 782
 	 * @return bool|null
785 783
 	 */
786
-	public function is_parent_updates_completed( $update ) {
784
+	public function is_parent_updates_completed($update) {
787 785
 		// Bailout.
788
-		if ( empty( $update['depend'] ) ) {
786
+		if (empty($update['depend'])) {
789 787
 			return true;
790 788
 		}
791 789
 
792 790
 		// Check if dependency is valid or not.
793
-		if ( ! $this->has_valid_dependency( $update ) ) {
791
+		if ( ! $this->has_valid_dependency($update)) {
794 792
 			return null;
795 793
 		}
796 794
 
797 795
 		$is_dependency_completed = true;
798 796
 
799
-		foreach ( $update['depend'] as $depend ) {
797
+		foreach ($update['depend'] as $depend) {
800 798
 
801
-			if ( ! give_has_upgrade_completed( $depend ) ) {
799
+			if ( ! give_has_upgrade_completed($depend)) {
802 800
 				$is_dependency_completed = false;
803 801
 				break;
804 802
 			}
@@ -815,7 +813,7 @@  discard block
 block discarded – undo
815 813
 	 * @return bool
816 814
 	 */
817 815
 	public function is_doing_updates() {
818
-		return (bool) get_option( 'give_doing_upgrade' );
816
+		return (bool) get_option('give_doing_upgrade');
819 817
 	}
820 818
 
821 819
 
@@ -829,7 +827,7 @@  discard block
 block discarded – undo
829 827
 	 *
830 828
 	 * @return bool
831 829
 	 */
832
-	public function has_valid_dependency( $update ) {
830
+	public function has_valid_dependency($update) {
833 831
 		$is_valid_dependency = true;
834 832
 		// $update_ids          = wp_list_pluck( $this->get_updates( 'database', 'all' ), 'id' );
835 833
 		//
@@ -855,32 +853,32 @@  discard block
 block discarded – undo
855 853
 	 *
856 854
 	 * @return array
857 855
 	 */
858
-	public function get_updates( $update_type = '', $status = 'all' ) {
856
+	public function get_updates($update_type = '', $status = 'all') {
859 857
 		// return all updates.
860
-		if ( empty( $update_type ) ) {
858
+		if (empty($update_type)) {
861 859
 			return $this->updates;
862 860
 		}
863 861
 
864 862
 		// Get specific update.
865
-		$updates = ! empty( $this->updates[ $update_type ] ) ? $this->updates[ $update_type ] : array();
863
+		$updates = ! empty($this->updates[$update_type]) ? $this->updates[$update_type] : array();
866 864
 
867 865
 		// Bailout.
868
-		if ( empty( $updates ) ) {
866
+		if (empty($updates)) {
869 867
 			return $updates;
870 868
 		}
871 869
 
872
-		switch ( $status ) {
870
+		switch ($status) {
873 871
 			case 'new':
874 872
 				// Remove already completed updates.
875 873
 				$completed_updates = give_get_completed_upgrades();
876 874
 
877
-				if ( ! empty( $completed_updates ) ) {
878
-					foreach ( $updates as $index => $update ) {
879
-						if ( in_array( $update['id'], $completed_updates ) ) {
880
-							unset( $updates[ $index ] );
875
+				if ( ! empty($completed_updates)) {
876
+					foreach ($updates as $index => $update) {
877
+						if (in_array($update['id'], $completed_updates)) {
878
+							unset($updates[$index]);
881 879
 						}
882 880
 					}
883
-					$updates = array_values( $updates );
881
+					$updates = array_values($updates);
884 882
 				}
885 883
 
886 884
 				break;
@@ -897,7 +895,7 @@  discard block
 block discarded – undo
897 895
 	 * @return int
898 896
 	 */
899 897
 	public function get_total_plugin_update_count() {
900
-		return count( $this->get_updates( 'plugin' ) );
898
+		return count($this->get_updates('plugin'));
901 899
 	}
902 900
 
903 901
 	/**
@@ -912,7 +910,7 @@  discard block
 block discarded – undo
912 910
 		$db_update_count     = $this->get_pending_db_update_count();
913 911
 		$plugin_update_count = $this->get_total_plugin_update_count();
914 912
 
915
-		return ( $db_update_count + $plugin_update_count );
913
+		return ($db_update_count + $plugin_update_count);
916 914
 	}
917 915
 
918 916
 	/**
@@ -924,7 +922,7 @@  discard block
 block discarded – undo
924 922
 	 * @return int
925 923
 	 */
926 924
 	public function get_pending_db_update_count() {
927
-		return count( $this->get_updates( 'database', 'new' ) );
925
+		return count($this->get_updates('database', 'new'));
928 926
 	}
929 927
 
930 928
 	/**
@@ -936,7 +934,7 @@  discard block
 block discarded – undo
936 934
 	 * @return int
937 935
 	 */
938 936
 	public function get_total_db_update_count() {
939
-		return count( $this->get_updates( 'database', 'all' ) );
937
+		return count($this->get_updates('database', 'all'));
940 938
 	}
941 939
 
942 940
 	/**
@@ -949,8 +947,7 @@  discard block
 block discarded – undo
949 947
 	 */
950 948
 	public function get_total_new_db_update_count() {
951 949
 		return $this->is_doing_updates() ?
952
-			get_option( 'give_db_update_count' ) :
953
-			$this->get_pending_db_update_count();
950
+			get_option('give_db_update_count') : $this->get_pending_db_update_count();
954 951
 	}
955 952
 
956 953
 	/**
@@ -962,11 +959,10 @@  discard block
 block discarded – undo
962 959
 	 * @return int
963 960
 	 */
964 961
 	public function get_running_db_update() {
965
-		$current_update = get_option( 'give_doing_upgrade' );
962
+		$current_update = get_option('give_doing_upgrade');
966 963
 
967 964
 		return $this->is_doing_updates() ?
968
-			$current_update['update'] :
969
-			1;
965
+			$current_update['update'] : 1;
970 966
 	}
971 967
 
972 968
 	/**
@@ -978,23 +974,21 @@  discard block
 block discarded – undo
978 974
 	 */
979 975
 	public function get_db_update_processing_percentage() {
980 976
 		// Bailout.
981
-		if ( ! $this->get_total_new_db_update_count() ) {
977
+		if ( ! $this->get_total_new_db_update_count()) {
982 978
 			return 0;
983 979
 		}
984 980
 
985
-		$resume_update            = get_option( 'give_doing_upgrade' );
986
-		$update_count_percentages = ( ( $this->get_running_db_update() - 1 ) / $this->get_total_new_db_update_count() ) * 100;
987
-		$update_percentage_share  = ( 1 / $this->get_total_new_db_update_count() ) * 100;
988
-		$upgrade_percentage       = ( ( $resume_update['percentage'] * $update_percentage_share ) / 100 );
981
+		$resume_update            = get_option('give_doing_upgrade');
982
+		$update_count_percentages = (($this->get_running_db_update() - 1) / $this->get_total_new_db_update_count()) * 100;
983
+		$update_percentage_share  = (1 / $this->get_total_new_db_update_count()) * 100;
984
+		$upgrade_percentage       = (($resume_update['percentage'] * $update_percentage_share) / 100);
989 985
 
990 986
 		$final_percentage = $update_count_percentages + $upgrade_percentage;
991 987
 
992 988
 		return $this->is_doing_updates() ?
993
-			( absint( $final_percentage ) ?
994
-				absint( $final_percentage ) :
995
-				round( $final_percentage, 2 )
996
-			) :
997
-			0;
989
+			(absint($final_percentage) ?
990
+				absint($final_percentage) : round($final_percentage, 2)
991
+			) : 0;
998 992
 	}
999 993
 }
1000 994
 
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-logs.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Logs' ) ) :
16
+if ( ! class_exists('Give_Settings_Logs')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Logs.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		public function __construct() {
36 36
 			$this->id    = 'logs';
37
-			$this->label = __( 'Logs', 'give' );
37
+			$this->label = __('Logs', 'give');
38 38
 
39 39
 			$this->default_tab = 'sales';
40 40
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		 */
51 51
 		public function get_settings() {
52 52
 			// Get settings.
53
-			$settings = apply_filters( 'give_settings_logs', array(
53
+			$settings = apply_filters('give_settings_logs', array(
54 54
 				array(
55 55
 					'id'         => 'give_tools_logs',
56 56
 					'type'       => 'title',
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				),
59 59
 				array(
60 60
 					'id'   => 'logs',
61
-					'name' => __( 'Log', 'give' ),
61
+					'name' => __('Log', 'give'),
62 62
 					'type' => 'logs',
63 63
 
64 64
 				),
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 					'type'       => 'sectionend',
68 68
 					'table_html' => false,
69 69
 				),
70
-			) );
70
+			));
71 71
 
72 72
 			/**
73 73
 			 * Filter the settings.
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			 *
77 77
 			 * @param  array $settings
78 78
 			 */
79
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
79
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
80 80
 
81 81
 			// Output.
82 82
 			return $settings;
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 		 */
91 91
 		public function get_sections() {
92 92
 			$sections = array(
93
-				'sales'          => __( 'Donations', 'give' ),
94
-				'gateway_errors' => __( 'Payment Errors', 'give' ),
95
-				'api_requests'   => __( 'API Requests', 'give' ),
96
-				'updates'   => __( 'Updates', 'give' ),
93
+				'sales'          => __('Donations', 'give'),
94
+				'gateway_errors' => __('Payment Errors', 'give'),
95
+				'api_requests'   => __('API Requests', 'give'),
96
+				'updates'   => __('Updates', 'give'),
97 97
 			);
98 98
 
99
-			$sections = apply_filters( 'give_log_views', $sections );
99
+			$sections = apply_filters('give_log_views', $sections);
100 100
 
101
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
101
+			return apply_filters('give_get_sections_'.$this->id, $sections);
102 102
 		}
103 103
 	}
104 104
 
Please login to merge, or discard this patch.
includes/admin/tools/logs/logs.php 1 patch
Spacing   +26 added lines, -26 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
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_get_logs_tab() {
24 24
 
25
-	require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' );
25
+	require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php');
26 26
 
27 27
 	// Get current section.
28 28
 	$current_section = $_GET['section'] = give_get_current_setting_section();
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @since 1.0
34 34
 	 */
35
-	do_action( "give_logs_view_{$current_section}" );
35
+	do_action("give_logs_view_{$current_section}");
36 36
 }
37 37
 
38 38
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  */
47 47
 function give_logs_view_sales() {
48 48
 
49
-	include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php';
49
+	include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php';
50 50
 
51 51
 	$logs_table = new Give_Sales_Log_Table();
52 52
 	$logs_table->prepare_items();
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		 *
60 60
 		 * @since 1.8.12
61 61
 		 */
62
-		do_action( 'give_logs_donations_top' );
62
+		do_action('give_logs_donations_top');
63 63
 
64 64
 		$logs_table->display(); ?>
65 65
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 		 *
74 74
 		 * @since 1.8.12
75 75
 		 */
76
-		do_action( 'give_logs_donations_bottom' );
76
+		do_action('give_logs_donations_bottom');
77 77
 		?>
78 78
 
79 79
 	</div>
80 80
 	<?php
81 81
 }
82 82
 
83
-add_action( 'give_logs_view_sales', 'give_logs_view_sales' );
83
+add_action('give_logs_view_sales', 'give_logs_view_sales');
84 84
 
85 85
 /**
86 86
  * Update Logs
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
  * @return void
91 91
  */
92 92
 function give_logs_view_updates() {
93
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-update-logs-list-table.php' );
93
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-update-logs-list-table.php');
94 94
 
95 95
 	$logs_table = new Give_Update_Log_Table();
96 96
 	$logs_table->prepare_items();
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @since 2.0.1
105 105
 		 */
106
-		do_action( 'give_logs_update_top' );
106
+		do_action('give_logs_update_top');
107 107
 
108 108
 		$logs_table->display(); ?>
109 109
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
 		 *
118 118
 		 * @since 2.0.1
119 119
 		 */
120
-		do_action( 'give_logs_update_bottom' );
120
+		do_action('give_logs_update_bottom');
121 121
 		?>
122 122
 
123 123
 	</div>
124 124
 	<?php
125 125
 }
126 126
 
127
-add_action( 'give_logs_view_updates', 'give_logs_view_updates' );
127
+add_action('give_logs_view_updates', 'give_logs_view_updates');
128 128
 
129 129
 /**
130 130
  * Gateway Error Logs
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
  * @return void
136 136
  */
137 137
 function give_logs_view_gateway_errors() {
138
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' );
138
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php');
139 139
 
140 140
 	$logs_table = new Give_Gateway_Error_Log_Table();
141 141
 	$logs_table->prepare_items();
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		 *
149 149
 		 * @since 1.8.12
150 150
 		 */
151
-		do_action( 'give_logs_payment_error_top' );
151
+		do_action('give_logs_payment_error_top');
152 152
 
153 153
 		$logs_table->display(); ?>
154 154
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 		 *
163 163
 		 * @since 1.8.12
164 164
 		 */
165
-		do_action( 'give_logs_payment_error_bottom' );
165
+		do_action('give_logs_payment_error_bottom');
166 166
 		?>
167 167
 
168 168
 	</div>
169 169
 	<?php
170 170
 }
171 171
 
172
-add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' );
172
+add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors');
173 173
 
174 174
 /**
175 175
  * API Request Logs
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
  * @return void
181 181
  */
182 182
 function give_logs_view_api_requests() {
183
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' );
183
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php');
184 184
 
185 185
 	$logs_table = new Give_API_Request_Log_Table();
186 186
 	$logs_table->prepare_items();
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @since 1.0
192 192
 	 */
193
-	do_action( 'give_logs_api_requests_top' );
193
+	do_action('give_logs_api_requests_top');
194 194
 
195
-	$logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' );
195
+	$logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests');
196 196
 	$logs_table->display();
197 197
 	?>
198 198
 	<input type="hidden" name="post_type" value="give_forms"/>
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @since 1.0
208 208
 	 */
209
-	do_action( 'give_logs_api_requests_bottom' );
209
+	do_action('give_logs_api_requests_bottom');
210 210
 }
211
-add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' );
211
+add_action('give_logs_view_api_requests', 'give_logs_view_api_requests');
212 212
 
213 213
 /**
214 214
  * Renders the log views drop down.
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 	$current_section = give_get_current_setting_section();
221 221
 
222 222
 	// If there are not any event attach to action then do not show form.
223
-	if ( ! has_action( 'give_log_view_actions' ) ) {
223
+	if ( ! has_action('give_log_view_actions')) {
224 224
 		return;
225 225
 	}
226 226
 	?>
227
-	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section=' . $current_section; ?>">
227
+	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section='.$current_section; ?>">
228 228
 		<?php
229 229
 		/**
230 230
 		 * Fires after displaying the reports page views drop down.
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 		 *
234 234
 		 * @since 1.0
235 235
 		 */
236
-		do_action( 'give_log_view_actions' );
236
+		do_action('give_log_view_actions');
237 237
 		?>
238 238
 
239 239
 		<input type="hidden" name="post_type" value="give_forms"/>
240 240
 		<input type="hidden" name="page" value="give-tools"/>
241 241
 		<input type="hidden" name="tab" value="logs"/>
242 242
 
243
-		<?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?>
243
+		<?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?>
244 244
 	</form>
245 245
 	<?php
246 246
 }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return string
254 254
  */
255
-function give_tools_set_form_method( $method ) {
255
+function give_tools_set_form_method($method) {
256 256
 	return 'get';
257 257
 }
258
-add_filter( 'give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10 );
258
+add_filter('give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10);
Please login to merge, or discard this patch.
includes/admin/tools/logs/class-update-logs-list-table.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
51
-			'ajax'     => false,// Does this table support ajax?
52
-		) );
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51
+			'ajax'     => false, // Does this table support ajax?
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return void
65 65
 	 */
66
-	public function search_box( $text, $input_id ) {
66
+	public function search_box($text, $input_id) {
67 67
 	}
68 68
 
69 69
 	/**
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function get_columns() {
78 78
 		$columns = array(
79
-			'ID'      => __( 'Log ID', 'give' ),
80
-			'date'    => __( 'Date', 'give' ),
81
-			'details' => __( 'Process Details', 'give' ),
79
+			'ID'      => __('Log ID', 'give'),
80
+			'date'    => __('Date', 'give'),
81
+			'details' => __('Process Details', 'give'),
82 82
 		);
83 83
 
84 84
 		return $columns;
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return string Column Name
97 97
 	 */
98
-	public function column_default( $item, $column_name ) {
99
-		switch ( $column_name ) {
98
+	public function column_default($item, $column_name) {
99
+		switch ($column_name) {
100 100
 			case 'ID':
101 101
 				return sprintf(
102 102
 					'<span class="give-item-label give-item-label-gray">%1$s</span> %2$s',
103
-					esc_attr( $item[ $column_name ] ),
104
-					esc_attr( $item['title'] )
103
+					esc_attr($item[$column_name]),
104
+					esc_attr($item['title'])
105 105
 				);
106 106
 
107 107
 			default:
108
-				return esc_attr( $item[ $column_name ] );
108
+				return esc_attr($item[$column_name]);
109 109
 		}
110 110
 	}
111 111
 
@@ -119,24 +119,24 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return void
121 121
 	 */
122
-	public function column_details( $item ) {
123
-		echo Give()->tooltips->render_link( array(
124
-			'label'       => __( 'View Update Log', 'give' ),
122
+	public function column_details($item) {
123
+		echo Give()->tooltips->render_link(array(
124
+			'label'       => __('View Update Log', 'give'),
125 125
 			'tag_content' => '<span class="dashicons dashicons-visibility"></span>',
126 126
 			'link'        => "#TB_inline?width=640&amp;inlineId=log-details-{$item['ID']}",
127 127
 			'attributes'  => array(
128 128
 				'class' => 'thickbox give-error-log-details-link button button-small',
129 129
 			),
130
-		) );
130
+		));
131 131
 		?>
132 132
 		<div id="log-details-<?php echo $item['ID']; ?>" style="display:none;">
133 133
 			<?php
134 134
 
135 135
 			// Print Log Content, if not empty.
136
-			if ( ! empty( $item['log_content'] ) ) {
136
+			if ( ! empty($item['log_content'])) {
137 137
 				echo sprintf(
138 138
 					'<p><pre>%1$s</pre></div>',
139
-					esc_html( $item['log_content'] )
139
+					esc_html($item['log_content'])
140 140
 				);
141 141
 			}
142 142
 			?>
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @param string $which
159 159
 	 */
160
-	protected function display_tablenav( $which ) {
161
-		if ( 'top' === $which ) {
162
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
160
+	protected function display_tablenav($which) {
161
+		if ('top' === $which) {
162
+			wp_nonce_field('bulk-'.$this->_args['plural']);
163 163
 		}
164 164
 		?>
165
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
165
+		<div class="tablenav <?php echo esc_attr($which); ?>">
166 166
 
167 167
 			<div class="alignleft actions bulkactions">
168
-				<?php $this->bulk_actions( $which ); ?>
168
+				<?php $this->bulk_actions($which); ?>
169 169
 			</div>
170 170
 			<?php
171
-			$this->extra_tablenav( $which );
172
-			$this->pagination( $which );
171
+			$this->extra_tablenav($which);
172
+			$this->pagination($which);
173 173
 			?>
174 174
 
175 175
 			<br class="clear"/>
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @return int Current page number
187 187
 	 */
188 188
 	public function get_paged() {
189
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
189
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
190 190
 	}
191 191
 
192 192
 	/**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return void
201 201
 	 */
202
-	function bulk_actions( $which = '' ) {
202
+	function bulk_actions($which = '') {
203 203
 	}
204 204
 
205 205
 	/**
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 			'posts_per_page' => $this->per_page,
220 220
 		);
221 221
 
222
-		$logs = Give()->logs->get_connected_logs( $log_query );
222
+		$logs = Give()->logs->get_connected_logs($log_query);
223 223
 
224
-		if ( $logs ) {
225
-			foreach ( $logs as $log ) {
224
+		if ($logs) {
225
+			foreach ($logs as $log) {
226 226
 
227 227
 				$logs_data[] = array(
228 228
 					'ID'          => $log->ID,
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
 		$columns               = $this->get_columns();
255 255
 		$hidden                = array(); // No hidden columns
256 256
 		$sortable              = $this->get_sortable_columns();
257
-		$this->_column_headers = array( $columns, $hidden, $sortable );
257
+		$this->_column_headers = array($columns, $hidden, $sortable);
258 258
 		$this->items           = $this->get_logs();
259
-		$total_items           = Give()->logs->get_log_count( 0, 'update' );
259
+		$total_items           = Give()->logs->get_log_count(0, 'update');
260 260
 
261
-		$this->set_pagination_args( array(
261
+		$this->set_pagination_args(array(
262 262
 				'total_items' => $total_items,
263 263
 				'per_page'    => $this->per_page,
264
-				'total_pages' => ceil( $total_items / $this->per_page ),
264
+				'total_pages' => ceil($total_items / $this->per_page),
265 265
 			)
266 266
 		);
267 267
 	}
Please login to merge, or discard this patch.