Test Failed
Pull Request — master (#2558)
by Devin
04:48
created
give.php 1 patch
Spacing   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly.
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 
49 49
 	/**
50 50
 	 * Main Give Class
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		 * @return    Give
203 203
 		 */
204 204
 		public static function instance() {
205
-			if ( is_null( self::$_instance ) ) {
205
+			if (is_null(self::$_instance)) {
206 206
 				self::$_instance = new self();
207 207
 			}
208 208
 
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
 		 */
215 215
 		public function __construct() {
216 216
 			// PHP version
217
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
218
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
217
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
218
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
219 219
 			}
220 220
 
221 221
 			// Bailout: Need minimum php version to load plugin.
222
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
223
-				add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) );
222
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
223
+				add_action('admin_notices', array($this, 'minmum_phpversion_notice'));
224 224
 
225 225
 				return;
226 226
 			}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 			$this->includes();
231 231
 			$this->init_hooks();
232 232
 
233
-			do_action( 'give_loaded' );
233
+			do_action('give_loaded');
234 234
 		}
235 235
 
236 236
 		/**
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 		 * @since  1.8.9
240 240
 		 */
241 241
 		private function init_hooks() {
242
-			register_activation_hook( __FILE__, 'give_install' );
243
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
242
+			register_activation_hook(__FILE__, 'give_install');
243
+			add_action('plugins_loaded', array($this, 'init'), 0);
244 244
 		}
245 245
 		/**
246 246
 		 * Init Give when WordPress Initializes.
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			 *
255 255
 			 * @since 1.8.9
256 256
 			 */
257
-			do_action( 'before_give_init' );
257
+			do_action('before_give_init');
258 258
 
259 259
 			// Set up localization.
260 260
 			$this->load_textdomain();
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 			 *
280 280
 			 * @since 1.8.7
281 281
 			 */
282
-			do_action( 'give_init', $this );
282
+			do_action('give_init', $this);
283 283
 
284 284
 		}
285 285
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 		 */
297 297
 		public function __clone() {
298 298
 			// Cloning instances of the class is forbidden.
299
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
299
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
300 300
 		}
301 301
 
302 302
 		/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		 */
310 310
 		public function __wakeup() {
311 311
 			// Unserializing instances of the class is forbidden.
312
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' );
312
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
313 313
 		}
314 314
 
315 315
 		/**
@@ -323,33 +323,33 @@  discard block
 block discarded – undo
323 323
 		private function setup_constants() {
324 324
 
325 325
 			// Plugin version
326
-			if ( ! defined( 'GIVE_VERSION' ) ) {
327
-				define( 'GIVE_VERSION', '1.8.19' );
326
+			if ( ! defined('GIVE_VERSION')) {
327
+				define('GIVE_VERSION', '1.8.19');
328 328
 			}
329 329
 
330 330
 			// Plugin Folder Path
331
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
332
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
331
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
332
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
333 333
 			}
334 334
 
335 335
 			// Plugin Folder URL
336
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
337
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
336
+			if ( ! defined('GIVE_PLUGIN_URL')) {
337
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
338 338
 			}
339 339
 
340 340
 			// Plugin Basename aka: "give/give.php"
341
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
342
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
341
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
342
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
343 343
 			}
344 344
 
345 345
 			// Plugin Root File
346
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
347
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
346
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
347
+				define('GIVE_PLUGIN_FILE', __FILE__);
348 348
 			}
349 349
 
350 350
 			// Make sure CAL_GREGORIAN is defined
351
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
352
-				define( 'CAL_GREGORIAN', 1 );
351
+			if ( ! defined('CAL_GREGORIAN')) {
352
+				define('CAL_GREGORIAN', 1);
353 353
 			}
354 354
 		}
355 355
 
@@ -364,133 +364,133 @@  discard block
 block discarded – undo
364 364
 		private function includes() {
365 365
 			global $give_options;
366 366
 
367
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
368
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
367
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
368
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
369 369
 			$give_options = give_get_settings();
370 370
 
371
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
372
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
373
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
374
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
375
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
376
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
377
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
378
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
379
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
380
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
381
-
382
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
383
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
384
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
385
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
386
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
387
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
388
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
389
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
390
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
391
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
392
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
393
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
394
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
395
-
396
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
397
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
398
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
399
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
400
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
401
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
402
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
403
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
404
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
405
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
406
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
407
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
408
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
409
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
410
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
411
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
412
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
413
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
414
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
415
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
416
-
417
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
418
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
419
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
420
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
421
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
422
-
423
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
424
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
425
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
426
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
427
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
428
-
429
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
430
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
431
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
432
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
433
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
434
-
435
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
436
-
437
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
438
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
371
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
372
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
373
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
374
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
375
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
376
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
377
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
378
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
379
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
380
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
381
+
382
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
383
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
384
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
385
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
386
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
387
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
388
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
389
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
390
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
391
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
392
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
393
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
394
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
395
+
396
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
397
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
398
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
399
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
400
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
401
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
402
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
403
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
404
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
405
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
406
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
407
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
408
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
409
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
410
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
411
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
412
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
413
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
414
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
415
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
416
+
417
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
418
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
419
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
420
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
421
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
422
+
423
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
424
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
425
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
426
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
427
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
428
+
429
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
430
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
431
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
432
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
433
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
434
+
435
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
436
+
437
+			if (defined('WP_CLI') && WP_CLI) {
438
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
439 439
 			}
440 440
 
441
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
441
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
442 442
 
443
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
444
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
445
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
446
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
447
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
448
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
449
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
450
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
451
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
452
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
453
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
443
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
444
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
445
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
446
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
447
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
448
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
449
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
450
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
451
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
452
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
453
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
454 454
 
455
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
456
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
455
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
456
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
457 457
 
458
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
459
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
460
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
458
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
459
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
460
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
461 461
 
462
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
463
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
464
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
462
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
463
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
464
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
465 465
 
466
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
467
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
468
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
469
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
466
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
467
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
468
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
469
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
470 470
 
471
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
472
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
473
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
471
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
472
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
473
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
474 474
 
475
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
475
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
476 476
 
477
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
477
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
478 478
 
479
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
480
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
481
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
482
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
483
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
484
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
485
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
486
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
487
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
479
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
480
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
481
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
482
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
483
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
484
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
485
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
486
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
487
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
488 488
 
489
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
489
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
490 490
 
491 491
 			}// End if().
492 492
 
493
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
494 494
 
495 495
 		}
496 496
 
@@ -505,16 +505,16 @@  discard block
 block discarded – undo
505 505
 		public function load_textdomain() {
506 506
 
507 507
 			// Set filter for Give's languages directory
508
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
509
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
508
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
509
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
510 510
 
511 511
 			// Traditional WordPress plugin locale filter.
512
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
513
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
512
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
513
+			$locale = apply_filters('plugin_locale', $locale, 'give');
514 514
 
515
-			unload_textdomain( 'give' );
516
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
517
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
515
+			unload_textdomain('give');
516
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
517
+			load_plugin_textdomain('give', false, $give_lang_dir);
518 518
 
519 519
 		}
520 520
 
@@ -527,17 +527,17 @@  discard block
 block discarded – undo
527 527
 		 */
528 528
 		public function minmum_phpversion_notice() {
529 529
 			// Bailout.
530
-			if ( ! is_admin() ) {
530
+			if ( ! is_admin()) {
531 531
 				return;
532 532
 			}
533 533
 
534
-			$notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
535
-			$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>';
536
-			$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>';
537
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
538
-			$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>';
539
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
540
-			$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>';
534
+			$notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
535
+			$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>';
536
+			$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>';
537
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
538
+			$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>';
539
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
540
+			$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>';
541 541
 
542 542
 			echo sprintf(
543 543
 				'<div class="notice notice-error">%1$s</div>',
Please login to merge, or discard this patch.
includes/class-give-db-donors.php 1 patch
Spacing   +117 added lines, -117 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
 
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 		/* @var WPDB $wpdb */
36 36
 		global $wpdb;
37 37
 
38
-		$this->table_name  = $wpdb->prefix . 'give_customers';
38
+		$this->table_name  = $wpdb->prefix.'give_customers';
39 39
 		$this->primary_key = 'id';
40 40
 		$this->version     = '1.0';
41 41
 
42 42
 		// Set hooks and register table only if instance loading first time.
43
-		if ( ! ( Give()->donors instanceof Give_DB_Donors ) ) {
43
+		if ( ! (Give()->donors instanceof Give_DB_Donors)) {
44 44
 			// Setup hook.
45
-			add_action( 'profile_update', array( $this, 'update_donor_email_on_user_update' ), 10, 2 );
45
+			add_action('profile_update', array($this, 'update_donor_email_on_user_update'), 10, 2);
46 46
 
47 47
 			// Install table.
48 48
 			$this->register_table();
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 			'purchase_value'  => 0.00,
93 93
 			'purchase_count'  => 0,
94 94
 			'notes'           => '',
95
-			'date_created'    => date( 'Y-m-d H:i:s' ),
95
+			'date_created'    => date('Y-m-d H:i:s'),
96 96
 			'token'           => '',
97 97
 			'verify_key'      => '',
98 98
 			'verify_throttle' => '',
@@ -109,40 +109,40 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return int|bool
111 111
 	 */
112
-	public function add( $data = array() ) {
112
+	public function add($data = array()) {
113 113
 
114 114
 		$defaults = array(
115 115
 			'payment_ids' => '',
116 116
 		);
117 117
 
118
-		$args = wp_parse_args( $data, $defaults );
118
+		$args = wp_parse_args($data, $defaults);
119 119
 
120
-		if ( empty( $args['email'] ) ) {
120
+		if (empty($args['email'])) {
121 121
 			return false;
122 122
 		}
123 123
 
124
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
125
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
124
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
125
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
126 126
 		}
127 127
 
128
-		$donor = $this->get_donor_by( 'email', $args['email'] );
128
+		$donor = $this->get_donor_by('email', $args['email']);
129 129
 
130 130
 		// update an existing donor.
131
-		if ( $donor ) {
131
+		if ($donor) {
132 132
 
133 133
 			// Update the payment IDs attached to the donor
134
-			if ( ! empty( $args['payment_ids'] ) ) {
134
+			if ( ! empty($args['payment_ids'])) {
135 135
 
136
-				if ( empty( $donor->payment_ids ) ) {
136
+				if (empty($donor->payment_ids)) {
137 137
 
138 138
 					$donor->payment_ids = $args['payment_ids'];
139 139
 
140 140
 				} else {
141 141
 
142
-					$existing_ids       = array_map( 'absint', explode( ',', $donor->payment_ids ) );
143
-					$payment_ids        = array_map( 'absint', explode( ',', $args['payment_ids'] ) );
144
-					$payment_ids        = array_merge( $payment_ids, $existing_ids );
145
-					$donor->payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
142
+					$existing_ids       = array_map('absint', explode(',', $donor->payment_ids));
143
+					$payment_ids        = array_map('absint', explode(',', $args['payment_ids']));
144
+					$payment_ids        = array_merge($payment_ids, $existing_ids);
145
+					$donor->payment_ids = implode(',', array_unique(array_values($payment_ids)));
146 146
 
147 147
 				}
148 148
 
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 
151 151
 			}
152 152
 
153
-			$this->update( $donor->id, $args );
153
+			$this->update($donor->id, $args);
154 154
 
155 155
 			return $donor->id;
156 156
 
157 157
 		} else {
158 158
 
159
-			return $this->insert( $args, 'donor' );
159
+			return $this->insert($args, 'donor');
160 160
 
161 161
 		}
162 162
 
@@ -175,16 +175,16 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @return bool|int
177 177
 	 */
178
-	public function delete( $_id_or_email = false ) {
178
+	public function delete($_id_or_email = false) {
179 179
 
180
-		if ( empty( $_id_or_email ) ) {
180
+		if (empty($_id_or_email)) {
181 181
 			return false;
182 182
 		}
183 183
 
184
-		$column = is_email( $_id_or_email ) ? 'email' : 'id';
185
-		$donor  = $this->get_donor_by( $column, $_id_or_email );
184
+		$column = is_email($_id_or_email) ? 'email' : 'id';
185
+		$donor  = $this->get_donor_by($column, $_id_or_email);
186 186
 
187
-		if ( $donor->id > 0 ) {
187
+		if ($donor->id > 0) {
188 188
 
189 189
 			global $wpdb;
190 190
 
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 			 *
194 194
 			 * @since 1.8.14
195 195
 			 */
196
-			Give()->donor_meta->delete_all_meta( $donor->id );
196
+			Give()->donor_meta->delete_all_meta($donor->id);
197 197
 
198
-			return $wpdb->delete( $this->table_name, array( 'id' => $donor->id ), array( '%d' ) );
198
+			return $wpdb->delete($this->table_name, array('id' => $donor->id), array('%d'));
199 199
 
200 200
 		} else {
201 201
 			return false;
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @return bool|int
218 218
 	 */
219
-	public function delete_by_user_id( $user_id = false ) {
219
+	public function delete_by_user_id($user_id = false) {
220 220
 
221
-		if ( empty( $user_id ) ) {
221
+		if (empty($user_id)) {
222 222
 			return false;
223 223
 		}
224 224
 
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
 		 *
228 228
 		 * @since 1.8.14
229 229
 		 */
230
-		$donor = new Give_Donor( $user_id, true );
231
-		if ( ! empty( $donor->id ) ) {
232
-			Give()->donor_meta->delete_all_meta( $donor->id );
230
+		$donor = new Give_Donor($user_id, true);
231
+		if ( ! empty($donor->id)) {
232
+			Give()->donor_meta->delete_all_meta($donor->id);
233 233
 		}
234 234
 
235 235
 		global $wpdb;
236 236
 
237
-		return $wpdb->delete( $this->table_name, array( 'user_id' => $user_id ), array( '%d' ) );
237
+		return $wpdb->delete($this->table_name, array('user_id' => $user_id), array('%d'));
238 238
 	}
239 239
 
240 240
 	/**
@@ -248,14 +248,14 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @return bool          True is exists, false otherwise.
250 250
 	 */
251
-	public function exists( $value = '', $field = 'email' ) {
251
+	public function exists($value = '', $field = 'email') {
252 252
 
253 253
 		$columns = $this->get_columns();
254
-		if ( ! array_key_exists( $field, $columns ) ) {
254
+		if ( ! array_key_exists($field, $columns)) {
255 255
 			return false;
256 256
 		}
257 257
 
258
-		return (bool) $this->get_column_by( 'id', $field, $value );
258
+		return (bool) $this->get_column_by('id', $field, $value);
259 259
 
260 260
 	}
261 261
 
@@ -270,16 +270,16 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @return bool
272 272
 	 */
273
-	public function attach_payment( $donor_id = 0, $payment_id = 0 ) {
273
+	public function attach_payment($donor_id = 0, $payment_id = 0) {
274 274
 
275
-		$donor = new Give_Donor( $donor_id );
275
+		$donor = new Give_Donor($donor_id);
276 276
 
277
-		if ( empty( $donor->id ) ) {
277
+		if (empty($donor->id)) {
278 278
 			return false;
279 279
 		}
280 280
 
281 281
 		// Attach the payment, but don't increment stats, as this function previously did not
282
-		return $donor->attach_payment( $payment_id, false );
282
+		return $donor->attach_payment($payment_id, false);
283 283
 
284 284
 	}
285 285
 
@@ -294,16 +294,16 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @return bool
296 296
 	 */
297
-	public function remove_payment( $donor_id = 0, $payment_id = 0 ) {
297
+	public function remove_payment($donor_id = 0, $payment_id = 0) {
298 298
 
299
-		$donor = new Give_Donor( $donor_id );
299
+		$donor = new Give_Donor($donor_id);
300 300
 
301
-		if ( ! $donor ) {
301
+		if ( ! $donor) {
302 302
 			return false;
303 303
 		}
304 304
 
305 305
 		// Remove the payment, but don't decrease stats, as this function previously did not
306
-		return $donor->remove_payment( $payment_id, false );
306
+		return $donor->remove_payment($payment_id, false);
307 307
 
308 308
 	}
309 309
 
@@ -317,18 +317,18 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @return bool
319 319
 	 */
320
-	public function increment_stats( $donor_id = 0, $amount = 0.00 ) {
320
+	public function increment_stats($donor_id = 0, $amount = 0.00) {
321 321
 
322
-		$donor = new Give_Donor( $donor_id );
322
+		$donor = new Give_Donor($donor_id);
323 323
 
324
-		if ( empty( $donor->id ) ) {
324
+		if (empty($donor->id)) {
325 325
 			return false;
326 326
 		}
327 327
 
328 328
 		$increased_count = $donor->increase_purchase_count();
329
-		$increased_value = $donor->increase_value( $amount );
329
+		$increased_value = $donor->increase_value($amount);
330 330
 
331
-		return ( $increased_count && $increased_value ) ? true : false;
331
+		return ($increased_count && $increased_value) ? true : false;
332 332
 
333 333
 	}
334 334
 
@@ -343,18 +343,18 @@  discard block
 block discarded – undo
343 343
 	 *
344 344
 	 * @return bool
345 345
 	 */
346
-	public function decrement_stats( $donor_id = 0, $amount = 0.00 ) {
346
+	public function decrement_stats($donor_id = 0, $amount = 0.00) {
347 347
 
348
-		$donor = new Give_Donor( $donor_id );
348
+		$donor = new Give_Donor($donor_id);
349 349
 
350
-		if ( ! $donor ) {
350
+		if ( ! $donor) {
351 351
 			return false;
352 352
 		}
353 353
 
354 354
 		$decreased_count = $donor->decrease_donation_count();
355
-		$decreased_value = $donor->decrease_value( $amount );
355
+		$decreased_value = $donor->decrease_value($amount);
356 356
 
357
-		return ( $decreased_count && $decreased_value ) ? true : false;
357
+		return ($decreased_count && $decreased_value) ? true : false;
358 358
 
359 359
 	}
360 360
 
@@ -369,31 +369,31 @@  discard block
 block discarded – undo
369 369
 	 *
370 370
 	 * @return bool
371 371
 	 */
372
-	public function update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) {
372
+	public function update_donor_email_on_user_update($user_id = 0, $old_user_data = false) {
373 373
 
374
-		$donor = new Give_Donor( $user_id, true );
374
+		$donor = new Give_Donor($user_id, true);
375 375
 
376
-		if ( ! $donor ) {
376
+		if ( ! $donor) {
377 377
 			return false;
378 378
 		}
379 379
 
380
-		$user = get_userdata( $user_id );
380
+		$user = get_userdata($user_id);
381 381
 
382
-		if ( ! empty( $user ) && $user->user_email !== $donor->email ) {
382
+		if ( ! empty($user) && $user->user_email !== $donor->email) {
383 383
 
384
-			if ( ! $this->get_donor_by( 'email', $user->user_email ) ) {
384
+			if ( ! $this->get_donor_by('email', $user->user_email)) {
385 385
 
386
-				$success = $this->update( $donor->id, array( 'email' => $user->user_email ) );
386
+				$success = $this->update($donor->id, array('email' => $user->user_email));
387 387
 
388
-				if ( $success ) {
388
+				if ($success) {
389 389
 					// Update some payment meta if we need to
390
-					$payments_array = explode( ',', $donor->payment_ids );
390
+					$payments_array = explode(',', $donor->payment_ids);
391 391
 
392
-					if ( ! empty( $payments_array ) ) {
392
+					if ( ! empty($payments_array)) {
393 393
 
394
-						foreach ( $payments_array as $payment_id ) {
394
+						foreach ($payments_array as $payment_id) {
395 395
 
396
-							give_update_payment_meta( $payment_id, 'email', $user->user_email );
396
+							give_update_payment_meta($payment_id, 'email', $user->user_email);
397 397
 
398 398
 						}
399 399
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 					 * @param  WP_User    $user  WordPress User object.
408 408
 					 * @param  Give_Donor $donor Give donor object.
409 409
 					 */
410
-					do_action( 'give_update_donor_email_on_user_update', $user, $donor );
410
+					do_action('give_update_donor_email_on_user_update', $user, $donor);
411 411
 
412 412
 				}
413 413
 
@@ -428,44 +428,44 @@  discard block
 block discarded – undo
428 428
 	 *
429 429
 	 * @return mixed         Upon success, an object of the donor. Upon failure, NULL
430 430
 	 */
431
-	public function get_donor_by( $field = 'id', $value = 0 ) {
432
-		$value = sanitize_text_field( $value );
431
+	public function get_donor_by($field = 'id', $value = 0) {
432
+		$value = sanitize_text_field($value);
433 433
 
434 434
 		// Bailout.
435
-		if ( empty( $field ) || empty( $value ) ) {
435
+		if (empty($field) || empty($value)) {
436 436
 			return null;
437 437
 		}
438 438
 
439 439
 		// Verify values.
440
-		if ( 'id' === $field || 'user_id' === $field ) {
440
+		if ('id' === $field || 'user_id' === $field) {
441 441
 			// Make sure the value is numeric to avoid casting objects, for example,
442 442
 			// to int 1.
443
-			if ( ! is_numeric( $value ) ) {
443
+			if ( ! is_numeric($value)) {
444 444
 				return false;
445 445
 			}
446 446
 
447
-			$value = absint( $value );
447
+			$value = absint($value);
448 448
 
449
-			if ( $value < 1 ) {
449
+			if ($value < 1) {
450 450
 				return false;
451 451
 			}
452 452
 
453
-		} elseif ( 'email' === $field ) {
453
+		} elseif ('email' === $field) {
454 454
 
455
-			if ( ! is_email( $value ) ) {
455
+			if ( ! is_email($value)) {
456 456
 				return false;
457 457
 			}
458 458
 
459
-			$value = trim( $value );
459
+			$value = trim($value);
460 460
 		}
461 461
 
462 462
 		// Bailout
463
-		if ( ! $value ) {
463
+		if ( ! $value) {
464 464
 			return false;
465 465
 		}
466 466
 
467 467
 		// Set query params.
468
-		switch ( $field ) {
468
+		switch ($field) {
469 469
 			case 'id':
470 470
 				$args['donor'] = $value;
471 471
 				break;
@@ -480,9 +480,9 @@  discard block
 block discarded – undo
480 480
 		}
481 481
 
482 482
 		// Get donors.
483
-		$donor = new Give_Donors_Query( $args );
483
+		$donor = new Give_Donors_Query($args);
484 484
 
485
-		if ( ! $donor = $donor->get_donors() ) {
485
+		if ( ! $donor = $donor->get_donors()) {
486 486
 			// Look for donor from an additional email.
487 487
 			$args = array(
488 488
 				'meta_query' => array(
@@ -493,15 +493,15 @@  discard block
 block discarded – undo
493 493
 				),
494 494
 			);
495 495
 
496
-			$donor = new Give_Donors_Query( $args );
496
+			$donor = new Give_Donors_Query($args);
497 497
 			$donor = $donor->get_donors();
498 498
 
499
-			if ( empty( $donor ) ) {
499
+			if (empty($donor)) {
500 500
 				return false;
501 501
 			}
502 502
 		}
503 503
 
504
-		return current( $donor );
504
+		return current($donor);
505 505
 	}
506 506
 
507 507
 	/**
@@ -514,18 +514,18 @@  discard block
 block discarded – undo
514 514
 	 *
515 515
 	 * @return array|object|null Donors array or object. Null if not found.
516 516
 	 */
517
-	public function get_donors( $args = array() ) {
518
-		$this->bc_1814_params( $args );
517
+	public function get_donors($args = array()) {
518
+		$this->bc_1814_params($args);
519 519
 
520
-		$cache_key = md5( 'give_donors_' . serialize( $args ) );
520
+		$cache_key = md5('give_donors_'.serialize($args));
521 521
 
522
-		$donors = wp_cache_get( $cache_key, 'donors' );
522
+		$donors = wp_cache_get($cache_key, 'donors');
523 523
 
524
-		if ( $donors === false ) {
525
-			$donors = new Give_Donors_Query( $args );
524
+		if ($donors === false) {
525
+			$donors = new Give_Donors_Query($args);
526 526
 			$donors = $donors->get_donors();
527 527
 
528
-			wp_cache_set( $cache_key, $donors, 'donors', 3600 );
528
+			wp_cache_set($cache_key, $donors, 'donors', 3600);
529 529
 		}
530 530
 
531 531
 		return $donors;
@@ -543,21 +543,21 @@  discard block
 block discarded – undo
543 543
 	 *
544 544
 	 * @return int         Total number of donors.
545 545
 	 */
546
-	public function count( $args = array() ) {
547
-		$this->bc_1814_params( $args );
546
+	public function count($args = array()) {
547
+		$this->bc_1814_params($args);
548 548
 		$args['count'] = true;
549 549
 
550
-		$cache_key = md5( 'give_donors_count' . serialize( $args ) );
551
-		$count     = wp_cache_get( $cache_key, 'donors' );
550
+		$cache_key = md5('give_donors_count'.serialize($args));
551
+		$count     = wp_cache_get($cache_key, 'donors');
552 552
 
553
-		if ( $count === false ) {
554
-			$donors = new Give_Donors_Query( $args );
553
+		if ($count === false) {
554
+			$donors = new Give_Donors_Query($args);
555 555
 			$count  = $donors->get_donors();
556 556
 
557
-			wp_cache_set( $cache_key, $count, 'donors', 3600 );
557
+			wp_cache_set($cache_key, $count, 'donors', 3600);
558 558
 		}
559 559
 
560
-		return absint( $count );
560
+		return absint($count);
561 561
 
562 562
 	}
563 563
 
@@ -571,9 +571,9 @@  discard block
 block discarded – undo
571 571
 	 */
572 572
 	public function create_table() {
573 573
 
574
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
574
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
575 575
 
576
-		$sql = "CREATE TABLE " . $this->table_name . " (
576
+		$sql = "CREATE TABLE ".$this->table_name." (
577 577
 		id bigint(20) NOT NULL AUTO_INCREMENT,
578 578
 		user_id bigint(20) NOT NULL,
579 579
 		email varchar(50) NOT NULL,
@@ -591,9 +591,9 @@  discard block
 block discarded – undo
591 591
 		KEY user (user_id)
592 592
 		) CHARACTER SET utf8 COLLATE utf8_general_ci;";
593 593
 
594
-		dbDelta( $sql );
594
+		dbDelta($sql);
595 595
 
596
-		update_option( $this->table_name . '_db_version', $this->version );
596
+		update_option($this->table_name.'_db_version', $this->version);
597 597
 	}
598 598
 
599 599
 	/**
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 	 * @return bool Returns if the donors table was installed and upgrade routine run.
606 606
 	 */
607 607
 	public function installed() {
608
-		return $this->table_exists( $this->table_name );
608
+		return $this->table_exists($this->table_name);
609 609
 	}
610 610
 
611 611
 	/**
@@ -616,41 +616,41 @@  discard block
 block discarded – undo
616 616
 	 *
617 617
 	 * @param $args
618 618
 	 */
619
-	private function bc_1814_params( &$args ) {
619
+	private function bc_1814_params(&$args) {
620 620
 		// Backward compatibility: user_id
621
-		if ( ! empty( $args['user_id'] ) ) {
621
+		if ( ! empty($args['user_id'])) {
622 622
 			$args['user'] = $args['user_id'];
623 623
 		}
624 624
 
625 625
 		// Backward compatibility: id
626
-		if ( ! empty( $args['id'] ) ) {
626
+		if ( ! empty($args['id'])) {
627 627
 			$args['donor'] = $args['id'];
628 628
 		}
629 629
 
630 630
 		// Backward compatibility: name
631
-		if ( ! empty( $args['name'] ) ) {
631
+		if ( ! empty($args['name'])) {
632 632
 			$args['s'] = "name:{$args['name']}";
633 633
 		}
634 634
 
635 635
 		// Backward compatibility: date
636 636
 		// Donors created for a specific date or in a date range.
637
-		if ( ! empty( $args['date'] ) ) {
637
+		if ( ! empty($args['date'])) {
638 638
 
639
-			if ( is_array( $args['date'] ) ) {
639
+			if (is_array($args['date'])) {
640 640
 
641
-				if ( ! empty( $args['date']['start'] ) ) {
642
-					$args['date_query']['after'] = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
641
+				if ( ! empty($args['date']['start'])) {
642
+					$args['date_query']['after'] = date('Y-m-d H:i:s', strtotime($args['date']['start']));
643 643
 				}
644 644
 
645
-				if ( ! empty( $args['date']['end'] ) ) {
646
-					$args['date_query']['before'] = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
645
+				if ( ! empty($args['date']['end'])) {
646
+					$args['date_query']['before'] = date('Y-m-d H:i:s', strtotime($args['date']['end']));
647 647
 				}
648 648
 
649 649
 			} else {
650 650
 
651
-				$args['date_query']['year']  = date( 'Y', strtotime( $args['date'] ) );
652
-				$args['date_query']['month'] = date( 'm', strtotime( $args['date'] ) );
653
-				$args['date_query']['day']   = date( 'd', strtotime( $args['date'] ) );
651
+				$args['date_query']['year']  = date('Y', strtotime($args['date']));
652
+				$args['date_query']['month'] = date('m', strtotime($args['date']));
653
+				$args['date_query']['day']   = date('d', strtotime($args['date']));
654 654
 			}
655 655
 
656 656
 		}
Please login to merge, or discard this patch.