@@ -39,11 +39,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
364 | 364 | private function setup_constants() { |
365 | 365 | |
366 | 366 | // Plugin version |
367 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
368 | - define( 'GIVE_VERSION', '2.0.0' ); |
|
367 | + if ( ! defined('GIVE_VERSION')) { |
|
368 | + define('GIVE_VERSION', '2.0.0'); |
|
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 |
||
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 |
||
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 |
||
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>', |
@@ -10,7 +10,7 @@ discard block |
||
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 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | public function __construct() { |
107 | 107 | |
108 | 108 | // get it started |
109 | - add_action( 'init', array( $this, 'init' ) ); |
|
109 | + add_action('init', array($this, 'init')); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -122,28 +122,28 @@ discard block |
||
122 | 122 | public function init() { |
123 | 123 | |
124 | 124 | // Bail Out, if user is logged in. |
125 | - if ( is_user_logged_in() ) { |
|
125 | + if (is_user_logged_in()) { |
|
126 | 126 | return; |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Are db columns setup? |
130 | - $column_exists = Give()->donors->does_column_exist( 'token' ); |
|
131 | - if ( ! $column_exists ) { |
|
130 | + $column_exists = Give()->donors->does_column_exist('token'); |
|
131 | + if ( ! $column_exists) { |
|
132 | 132 | $this->create_columns(); |
133 | 133 | } |
134 | 134 | |
135 | 135 | // Timeouts. |
136 | - $this->verify_throttle = apply_filters( 'give_nl_verify_throttle', 300 ); |
|
137 | - $this->limit_throttle = apply_filters( 'give_nl_limit_throttle', 3 ); |
|
138 | - $this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 ); |
|
136 | + $this->verify_throttle = apply_filters('give_nl_verify_throttle', 300); |
|
137 | + $this->limit_throttle = apply_filters('give_nl_limit_throttle', 3); |
|
138 | + $this->token_expiration = apply_filters('give_nl_token_expiration', 7200); |
|
139 | 139 | |
140 | 140 | // Setup login. |
141 | 141 | $this->check_for_token(); |
142 | 142 | |
143 | - if ( $this->token_exists ) { |
|
144 | - add_filter( 'give_can_view_receipt', '__return_true' ); |
|
145 | - add_filter( 'give_user_pending_verification', '__return_false' ); |
|
146 | - add_filter( 'give_get_users_donations_args', array( $this, 'users_donations_args' ) ); |
|
143 | + if ($this->token_exists) { |
|
144 | + add_filter('give_can_view_receipt', '__return_true'); |
|
145 | + add_filter('give_user_pending_verification', '__return_false'); |
|
146 | + add_filter('give_get_users_donations_args', array($this, 'users_donations_args')); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | } |
@@ -158,23 +158,23 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return bool |
160 | 160 | */ |
161 | - public function can_send_email( $donor_id ) { |
|
161 | + public function can_send_email($donor_id) { |
|
162 | 162 | |
163 | - $donor = Give()->donors->get_donor_by( 'id', $donor_id ); |
|
163 | + $donor = Give()->donors->get_donor_by('id', $donor_id); |
|
164 | 164 | |
165 | - if ( is_object( $donor ) && count( $donor ) > 0 ) { |
|
165 | + if (is_object($donor) && count($donor) > 0) { |
|
166 | 166 | |
167 | - $email_throttle_count = (int) give_get_meta( $donor_id, '_give_email_throttle_count', true ); |
|
167 | + $email_throttle_count = (int) give_get_meta($donor_id, '_give_email_throttle_count', true); |
|
168 | 168 | |
169 | 169 | $cache_key = "give_cache_email_throttle_limit_exhausted_{$donor_id}"; |
170 | 170 | if ( |
171 | 171 | $email_throttle_count < $this->limit_throttle && |
172 | - true !== Give_Cache::get( $cache_key ) |
|
172 | + true !== Give_Cache::get($cache_key) |
|
173 | 173 | ) { |
174 | - give_update_meta( $donor_id, '_give_email_throttle_count', $email_throttle_count + 1 ); |
|
174 | + give_update_meta($donor_id, '_give_email_throttle_count', $email_throttle_count + 1); |
|
175 | 175 | } else { |
176 | - give_update_meta( $donor_id, '_give_email_throttle_count', 0 ); |
|
177 | - Give_Cache::set( $cache_key, true, $this->verify_throttle ); |
|
176 | + give_update_meta($donor_id, '_give_email_throttle_count', 0); |
|
177 | + Give_Cache::set($cache_key, true, $this->verify_throttle); |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @return bool |
196 | 196 | */ |
197 | - public function send_email( $donor_id, $email ) { |
|
198 | - return apply_filters( 'give_email-access_email_notification', $donor_id, $email ); |
|
197 | + public function send_email($donor_id, $email) { |
|
198 | + return apply_filters('give_email-access_email_notification', $donor_id, $email); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -208,28 +208,28 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function check_for_token() { |
210 | 210 | |
211 | - $token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : ''; |
|
211 | + $token = isset($_GET['give_nl']) ? $_GET['give_nl'] : ''; |
|
212 | 212 | |
213 | 213 | // Check for cookie. |
214 | - if ( empty( $token ) ) { |
|
215 | - $token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : ''; |
|
214 | + if (empty($token)) { |
|
215 | + $token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : ''; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | // Must have a token. |
219 | - if ( ! empty( $token ) ) { |
|
219 | + if ( ! empty($token)) { |
|
220 | 220 | |
221 | - if ( ! $this->is_valid_token( $token ) ) { |
|
222 | - if ( ! $this->is_valid_verify_key( $token ) ) { |
|
221 | + if ( ! $this->is_valid_token($token)) { |
|
222 | + if ( ! $this->is_valid_verify_key($token)) { |
|
223 | 223 | return false; |
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | 227 | // Set Receipt Access Session. |
228 | - Give()->session->set( 'receipt_access', true ); |
|
228 | + Give()->session->set('receipt_access', true); |
|
229 | 229 | $this->token_exists = true; |
230 | 230 | // Set cookie. |
231 | - $lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time(); |
|
232 | - @setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
231 | + $lifetime = current_time('timestamp') + Give()->session->set_expiration_time(); |
|
232 | + @setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
233 | 233 | |
234 | 234 | return true; |
235 | 235 | } |
@@ -245,26 +245,26 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @return bool |
247 | 247 | */ |
248 | - public function is_valid_token( $token ) { |
|
248 | + public function is_valid_token($token) { |
|
249 | 249 | |
250 | 250 | global $wpdb; |
251 | 251 | |
252 | 252 | // Make sure token isn't expired. |
253 | - $expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration ); |
|
253 | + $expires = date('Y-m-d H:i:s', time() - $this->token_expiration); |
|
254 | 254 | |
255 | 255 | $email = $wpdb->get_var( |
256 | - $wpdb->prepare( "SELECT email FROM {$wpdb->donors} WHERE verify_key = %s AND verify_throttle >= %s LIMIT 1", $token, $expires ) |
|
256 | + $wpdb->prepare("SELECT email FROM {$wpdb->donors} WHERE verify_key = %s AND verify_throttle >= %s LIMIT 1", $token, $expires) |
|
257 | 257 | ); |
258 | 258 | |
259 | - if ( ! empty( $email ) ) { |
|
259 | + if ( ! empty($email)) { |
|
260 | 260 | $this->token_email = $email; |
261 | 261 | $this->token = $token; |
262 | 262 | return true; |
263 | 263 | } |
264 | 264 | |
265 | 265 | // Set error only if email access form isn't being submitted. |
266 | - if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) { |
|
267 | - give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', __( 'Your access token has expired. Please request a new one below:', 'give' ) ) ); |
|
266 | + if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) { |
|
267 | + give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', __('Your access token has expired. Please request a new one below:', 'give'))); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | return false; |
@@ -283,25 +283,25 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @return void |
285 | 285 | */ |
286 | - public function set_verify_key( $donor_id, $email, $verify_key ) { |
|
286 | + public function set_verify_key($donor_id, $email, $verify_key) { |
|
287 | 287 | global $wpdb; |
288 | 288 | |
289 | - $now = date( 'Y-m-d H:i:s' ); |
|
289 | + $now = date('Y-m-d H:i:s'); |
|
290 | 290 | |
291 | 291 | // Insert or update? |
292 | 292 | $row_id = (int) $wpdb->get_var( |
293 | - $wpdb->prepare( "SELECT id FROM {$wpdb->donors} WHERE id = %d LIMIT 1", $donor_id ) |
|
293 | + $wpdb->prepare("SELECT id FROM {$wpdb->donors} WHERE id = %d LIMIT 1", $donor_id) |
|
294 | 294 | ); |
295 | 295 | |
296 | 296 | // Update. |
297 | - if ( ! empty( $row_id ) ) { |
|
297 | + if ( ! empty($row_id)) { |
|
298 | 298 | $wpdb->query( |
299 | - $wpdb->prepare( "UPDATE {$wpdb->donors} SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id ) |
|
299 | + $wpdb->prepare("UPDATE {$wpdb->donors} SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id) |
|
300 | 300 | ); |
301 | 301 | } // Insert. |
302 | 302 | else { |
303 | 303 | $wpdb->query( |
304 | - $wpdb->prepare( "INSERT INTO {$wpdb->donors} ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now ) |
|
304 | + $wpdb->prepare("INSERT INTO {$wpdb->donors} ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now) |
|
305 | 305 | ); |
306 | 306 | } |
307 | 307 | } |
@@ -316,21 +316,21 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @return bool |
318 | 318 | */ |
319 | - public function is_valid_verify_key( $token ) { |
|
319 | + public function is_valid_verify_key($token) { |
|
320 | 320 | /* @var WPDB $wpdb */ |
321 | 321 | global $wpdb; |
322 | 322 | |
323 | 323 | // See if the verify_key exists. |
324 | 324 | $row = $wpdb->get_row( |
325 | - $wpdb->prepare( "SELECT id, email FROM {$wpdb->donors} WHERE verify_key = %s LIMIT 1", $token ) |
|
325 | + $wpdb->prepare("SELECT id, email FROM {$wpdb->donors} WHERE verify_key = %s LIMIT 1", $token) |
|
326 | 326 | ); |
327 | 327 | |
328 | - $now = date( 'Y-m-d H:i:s' ); |
|
328 | + $now = date('Y-m-d H:i:s'); |
|
329 | 329 | |
330 | 330 | // Set token and remove verify key. |
331 | - if ( ! empty( $row ) ) { |
|
331 | + if ( ! empty($row)) { |
|
332 | 332 | $wpdb->query( |
333 | - $wpdb->prepare( "UPDATE {$wpdb->donors} SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id ) |
|
333 | + $wpdb->prepare("UPDATE {$wpdb->donors} SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id) |
|
334 | 334 | ); |
335 | 335 | |
336 | 336 | $this->token_email = $row->email; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return mixed |
356 | 356 | */ |
357 | - public function users_donations_args( $args ) { |
|
357 | + public function users_donations_args($args) { |
|
358 | 358 | $args['user'] = $this->token_email; |
359 | 359 | |
360 | 360 | return $args; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | global $wpdb; |
376 | 376 | |
377 | 377 | // Create columns in donors table. |
378 | - $wpdb->query( "ALTER TABLE {$wpdb->donors} ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" ); |
|
378 | + $wpdb->query("ALTER TABLE {$wpdb->donors} ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`"); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | } |
@@ -10,7 +10,7 @@ discard block |
||
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 |
||
50 | 50 | /* @var WPDB $wpdb */ |
51 | 51 | global $wpdb; |
52 | 52 | |
53 | - $wpdb->paymentmeta = $this->table_name = $wpdb->prefix . 'give_paymentmeta'; |
|
53 | + $wpdb->paymentmeta = $this->table_name = $wpdb->prefix.'give_paymentmeta'; |
|
54 | 54 | $this->primary_key = 'meta_id'; |
55 | 55 | $this->version = '1.0'; |
56 | 56 | |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | KEY meta_key (meta_key) |
100 | 100 | ) {$charset_collate};"; |
101 | 101 | |
102 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
103 | - dbDelta( $sql ); |
|
102 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
103 | + dbDelta($sql); |
|
104 | 104 | |
105 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
105 | + update_option($this->table_name.'_db_version', $this->version); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -113,6 +113,6 @@ discard block |
||
113 | 113 | * @return bool |
114 | 114 | */ |
115 | 115 | protected function is_custom_meta_table_active() { |
116 | - return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ); |
|
116 | + return give_has_upgrade_completed('v20_move_metadata_into_new_table'); |
|
117 | 117 | } |
118 | 118 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -149,32 +149,32 @@ discard block |
||
149 | 149 | * @param bool $_id_or_email |
150 | 150 | * @param bool $by_user_id |
151 | 151 | */ |
152 | - public function __construct( $_id_or_email = false, $by_user_id = false ) { |
|
152 | + public function __construct($_id_or_email = false, $by_user_id = false) { |
|
153 | 153 | |
154 | 154 | $this->db = Give()->donors; |
155 | 155 | |
156 | 156 | if ( |
157 | 157 | false === $_id_or_email |
158 | - || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) |
|
158 | + || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email)) |
|
159 | 159 | ) { |
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
163 | - $by_user_id = is_bool( $by_user_id ) ? $by_user_id : false; |
|
163 | + $by_user_id = is_bool($by_user_id) ? $by_user_id : false; |
|
164 | 164 | |
165 | - if ( is_numeric( $_id_or_email ) ) { |
|
165 | + if (is_numeric($_id_or_email)) { |
|
166 | 166 | $field = $by_user_id ? 'user_id' : 'id'; |
167 | 167 | } else { |
168 | 168 | $field = 'email'; |
169 | 169 | } |
170 | 170 | |
171 | - $donor = $this->db->get_donor_by( $field, $_id_or_email ); |
|
171 | + $donor = $this->db->get_donor_by($field, $_id_or_email); |
|
172 | 172 | |
173 | - if ( empty( $donor ) || ! is_object( $donor ) ) { |
|
173 | + if (empty($donor) || ! is_object($donor)) { |
|
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | |
177 | - $this->setup_donor( $donor ); |
|
177 | + $this->setup_donor($donor); |
|
178 | 178 | |
179 | 179 | } |
180 | 180 | |
@@ -190,19 +190,19 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @return bool If the setup was successful or not. |
192 | 192 | */ |
193 | - private function setup_donor( $donor ) { |
|
193 | + private function setup_donor($donor) { |
|
194 | 194 | |
195 | - if ( ! is_object( $donor ) ) { |
|
195 | + if ( ! is_object($donor)) { |
|
196 | 196 | return false; |
197 | 197 | } |
198 | 198 | |
199 | 199 | // Get cached donors. |
200 | - $donor_vars = Give_Cache::get_group( $donor->id, 'give-donors' ); |
|
200 | + $donor_vars = Give_Cache::get_group($donor->id, 'give-donors'); |
|
201 | 201 | |
202 | - if( is_null( $donor_vars ) ){ |
|
203 | - foreach ( $donor as $key => $value ) { |
|
202 | + if (is_null($donor_vars)) { |
|
203 | + foreach ($donor as $key => $value) { |
|
204 | 204 | |
205 | - switch ( $key ) { |
|
205 | + switch ($key) { |
|
206 | 206 | |
207 | 207 | case 'notes': |
208 | 208 | $this->$key = $this->get_notes(); |
@@ -216,20 +216,20 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | // Get donor's all email including primary email. |
219 | - $this->emails = (array) $this->get_meta( 'additional_email', false ); |
|
220 | - $this->emails = array( 'primary' => $this->email ) + $this->emails; |
|
219 | + $this->emails = (array) $this->get_meta('additional_email', false); |
|
220 | + $this->emails = array('primary' => $this->email) + $this->emails; |
|
221 | 221 | |
222 | 222 | $this->setup_address(); |
223 | 223 | |
224 | - Give_Cache::set_group( $donor->id, get_object_vars( $this ), 'give-donors' ); |
|
225 | - } else{ |
|
226 | - foreach ( $donor_vars as $donor_var => $value ) { |
|
224 | + Give_Cache::set_group($donor->id, get_object_vars($this), 'give-donors'); |
|
225 | + } else { |
|
226 | + foreach ($donor_vars as $donor_var => $value) { |
|
227 | 227 | $this->$donor_var = $value; |
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | 231 | // Donor ID and email are the only things that are necessary, make sure they exist. |
232 | - if ( ! empty( $this->id ) && ! empty( $this->email ) ) { |
|
232 | + if ( ! empty($this->id) && ! empty($this->email)) { |
|
233 | 233 | return true; |
234 | 234 | } |
235 | 235 | |
@@ -262,18 +262,18 @@ discard block |
||
262 | 262 | ARRAY_N |
263 | 263 | ); |
264 | 264 | |
265 | - if ( empty( $addresses ) ) { |
|
265 | + if (empty($addresses)) { |
|
266 | 266 | return $this->address; |
267 | 267 | } |
268 | 268 | |
269 | - foreach ( $addresses as $address ) { |
|
270 | - $address[0] = str_replace( '_give_donor_address_', '', $address[0] ); |
|
271 | - $address[0] = explode( '_', $address[0] ); |
|
269 | + foreach ($addresses as $address) { |
|
270 | + $address[0] = str_replace('_give_donor_address_', '', $address[0]); |
|
271 | + $address[0] = explode('_', $address[0]); |
|
272 | 272 | |
273 | - if ( 3 === count( $address[0] ) ) { |
|
274 | - $this->address[ $address[0][0] ][ $address[0][2] ][ $address[0][1] ] = $address[1]; |
|
273 | + if (3 === count($address[0])) { |
|
274 | + $this->address[$address[0][0]][$address[0][2]][$address[0][1]] = $address[1]; |
|
275 | 275 | } else { |
276 | - $this->address[ $address[0][0] ][ $address[0][1] ] = $address[1]; |
|
276 | + $this->address[$address[0][0]][$address[0][1]] = $address[1]; |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | } |
@@ -287,16 +287,16 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @return mixed|\WP_Error |
289 | 289 | */ |
290 | - public function __get( $key ) { |
|
290 | + public function __get($key) { |
|
291 | 291 | |
292 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
292 | + if (method_exists($this, 'get_'.$key)) { |
|
293 | 293 | |
294 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
294 | + return call_user_func(array($this, 'get_'.$key)); |
|
295 | 295 | |
296 | 296 | } else { |
297 | 297 | |
298 | 298 | /* translators: %s: property key */ |
299 | - return new WP_Error( 'give-donor-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
299 | + return new WP_Error('give-donor-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
300 | 300 | |
301 | 301 | } |
302 | 302 | |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return bool|int False if not a valid creation, donor ID if user is found or valid creation. |
314 | 314 | */ |
315 | - public function create( $data = array() ) { |
|
315 | + public function create($data = array()) { |
|
316 | 316 | |
317 | - if ( $this->id != 0 || empty( $data ) ) { |
|
317 | + if ($this->id != 0 || empty($data)) { |
|
318 | 318 | return false; |
319 | 319 | } |
320 | 320 | |
@@ -322,15 +322,15 @@ discard block |
||
322 | 322 | 'payment_ids' => '', |
323 | 323 | ); |
324 | 324 | |
325 | - $args = wp_parse_args( $data, $defaults ); |
|
326 | - $args = $this->sanitize_columns( $args ); |
|
325 | + $args = wp_parse_args($data, $defaults); |
|
326 | + $args = $this->sanitize_columns($args); |
|
327 | 327 | |
328 | - if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) { |
|
328 | + if (empty($args['email']) || ! is_email($args['email'])) { |
|
329 | 329 | return false; |
330 | 330 | } |
331 | 331 | |
332 | - if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) { |
|
333 | - $args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) ); |
|
332 | + if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) { |
|
333 | + $args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids']))); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -340,18 +340,18 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @param array $args Donor attributes. |
342 | 342 | */ |
343 | - do_action( 'give_donor_pre_create', $args ); |
|
343 | + do_action('give_donor_pre_create', $args); |
|
344 | 344 | |
345 | 345 | $created = false; |
346 | 346 | |
347 | 347 | // The DB class 'add' implies an update if the donor being asked to be created already exists |
348 | - if ( $this->db->add( $data ) ) { |
|
348 | + if ($this->db->add($data)) { |
|
349 | 349 | |
350 | 350 | // We've successfully added/updated the donor, reset the class vars with the new data |
351 | - $donor = $this->db->get_donor_by( 'email', $args['email'] ); |
|
351 | + $donor = $this->db->get_donor_by('email', $args['email']); |
|
352 | 352 | |
353 | 353 | // Setup the donor data with the values from DB |
354 | - $this->setup_donor( $donor ); |
|
354 | + $this->setup_donor($donor); |
|
355 | 355 | |
356 | 356 | $created = $this->id; |
357 | 357 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * @param bool|int $created False if not a valid creation, donor ID if user is found or valid creation. |
365 | 365 | * @param array $args Customer attributes. |
366 | 366 | */ |
367 | - do_action( 'give_donor_post_create', $created, $args ); |
|
367 | + do_action('give_donor_post_create', $created, $args); |
|
368 | 368 | |
369 | 369 | return $created; |
370 | 370 | |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @return bool If the update was successful or not. |
382 | 382 | */ |
383 | - public function update( $data = array() ) { |
|
383 | + public function update($data = array()) { |
|
384 | 384 | |
385 | - if ( empty( $data ) ) { |
|
385 | + if (empty($data)) { |
|
386 | 386 | return false; |
387 | 387 | } |
388 | 388 | |
389 | - $data = $this->sanitize_columns( $data ); |
|
389 | + $data = $this->sanitize_columns($data); |
|
390 | 390 | |
391 | 391 | /** |
392 | 392 | * Fires before updating donors. |
@@ -396,15 +396,15 @@ discard block |
||
396 | 396 | * @param int $donor_id Donor id. |
397 | 397 | * @param array $data Donor attributes. |
398 | 398 | */ |
399 | - do_action( 'give_donor_pre_update', $this->id, $data ); |
|
399 | + do_action('give_donor_pre_update', $this->id, $data); |
|
400 | 400 | |
401 | 401 | $updated = false; |
402 | 402 | |
403 | - if ( $this->db->update( $this->id, $data ) ) { |
|
403 | + if ($this->db->update($this->id, $data)) { |
|
404 | 404 | |
405 | - $donor = $this->db->get_donor_by( 'id', $this->id ); |
|
405 | + $donor = $this->db->get_donor_by('id', $this->id); |
|
406 | 406 | |
407 | - $this->setup_donor( $donor ); |
|
407 | + $this->setup_donor($donor); |
|
408 | 408 | |
409 | 409 | $updated = true; |
410 | 410 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @param int $donor_id Donor id. |
419 | 419 | * @param array $data Donor attributes. |
420 | 420 | */ |
421 | - do_action( 'give_donor_post_update', $updated, $this->id, $data ); |
|
421 | + do_action('give_donor_post_update', $updated, $this->id, $data); |
|
422 | 422 | |
423 | 423 | return $updated; |
424 | 424 | } |
@@ -436,27 +436,27 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @return bool If the attachment was successfully. |
438 | 438 | */ |
439 | - public function attach_payment( $payment_id = 0, $update_stats = true ) { |
|
439 | + public function attach_payment($payment_id = 0, $update_stats = true) { |
|
440 | 440 | |
441 | - if ( empty( $payment_id ) ) { |
|
441 | + if (empty($payment_id)) { |
|
442 | 442 | return false; |
443 | 443 | } |
444 | 444 | |
445 | - if ( empty( $this->payment_ids ) ) { |
|
445 | + if (empty($this->payment_ids)) { |
|
446 | 446 | |
447 | 447 | $new_payment_ids = $payment_id; |
448 | 448 | |
449 | 449 | } else { |
450 | 450 | |
451 | - $payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) ); |
|
451 | + $payment_ids = array_map('absint', explode(',', $this->payment_ids)); |
|
452 | 452 | |
453 | - if ( in_array( $payment_id, $payment_ids ) ) { |
|
453 | + if (in_array($payment_id, $payment_ids)) { |
|
454 | 454 | $update_stats = false; |
455 | 455 | } |
456 | 456 | |
457 | 457 | $payment_ids[] = $payment_id; |
458 | 458 | |
459 | - $new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) ); |
|
459 | + $new_payment_ids = implode(',', array_unique(array_values($payment_ids))); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | |
@@ -468,20 +468,20 @@ discard block |
||
468 | 468 | * @param int $payment_id Payment id. |
469 | 469 | * @param int $donor_id Customer id. |
470 | 470 | */ |
471 | - do_action( 'give_donor_pre_attach_payment', $payment_id, $this->id ); |
|
471 | + do_action('give_donor_pre_attach_payment', $payment_id, $this->id); |
|
472 | 472 | |
473 | - $payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) ); |
|
473 | + $payment_added = $this->update(array('payment_ids' => $new_payment_ids)); |
|
474 | 474 | |
475 | - if ( $payment_added ) { |
|
475 | + if ($payment_added) { |
|
476 | 476 | |
477 | 477 | $this->payment_ids = $new_payment_ids; |
478 | 478 | |
479 | 479 | // We added this payment successfully, increment the stats |
480 | - if ( $update_stats ) { |
|
481 | - $payment_amount = give_donation_amount( $payment_id, array( 'type' => 'stats' ) ); |
|
480 | + if ($update_stats) { |
|
481 | + $payment_amount = give_donation_amount($payment_id, array('type' => 'stats')); |
|
482 | 482 | |
483 | - if ( ! empty( $payment_amount ) ) { |
|
484 | - $this->increase_value( $payment_amount ); |
|
483 | + if ( ! empty($payment_amount)) { |
|
484 | + $this->increase_value($payment_amount); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | $this->increase_purchase_count(); |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | * @param int $payment_id Payment id. |
498 | 498 | * @param int $donor_id Donor id. |
499 | 499 | */ |
500 | - do_action( 'give_donor_post_attach_payment', $payment_added, $payment_id, $this->id ); |
|
500 | + do_action('give_donor_post_attach_payment', $payment_added, $payment_id, $this->id); |
|
501 | 501 | |
502 | 502 | return $payment_added; |
503 | 503 | } |
@@ -515,33 +515,33 @@ discard block |
||
515 | 515 | * |
516 | 516 | * @return boolean If the removal was successful. |
517 | 517 | */ |
518 | - public function remove_payment( $payment_id = 0, $update_stats = true ) { |
|
518 | + public function remove_payment($payment_id = 0, $update_stats = true) { |
|
519 | 519 | |
520 | - if ( empty( $payment_id ) ) { |
|
520 | + if (empty($payment_id)) { |
|
521 | 521 | return false; |
522 | 522 | } |
523 | 523 | |
524 | - $payment = new Give_Payment( $payment_id ); |
|
524 | + $payment = new Give_Payment($payment_id); |
|
525 | 525 | |
526 | - if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) { |
|
526 | + if ('publish' !== $payment->status && 'revoked' !== $payment->status) { |
|
527 | 527 | $update_stats = false; |
528 | 528 | } |
529 | 529 | |
530 | 530 | $new_payment_ids = ''; |
531 | 531 | |
532 | - if ( ! empty( $this->payment_ids ) ) { |
|
532 | + if ( ! empty($this->payment_ids)) { |
|
533 | 533 | |
534 | - $payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) ); |
|
534 | + $payment_ids = array_map('absint', explode(',', $this->payment_ids)); |
|
535 | 535 | |
536 | - $pos = array_search( $payment_id, $payment_ids ); |
|
537 | - if ( false === $pos ) { |
|
536 | + $pos = array_search($payment_id, $payment_ids); |
|
537 | + if (false === $pos) { |
|
538 | 538 | return false; |
539 | 539 | } |
540 | 540 | |
541 | - unset( $payment_ids[ $pos ] ); |
|
542 | - $payment_ids = array_filter( $payment_ids ); |
|
541 | + unset($payment_ids[$pos]); |
|
542 | + $payment_ids = array_filter($payment_ids); |
|
543 | 543 | |
544 | - $new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) ); |
|
544 | + $new_payment_ids = implode(',', array_unique(array_values($payment_ids))); |
|
545 | 545 | |
546 | 546 | } |
547 | 547 | |
@@ -553,20 +553,20 @@ discard block |
||
553 | 553 | * @param int $payment_id Payment id. |
554 | 554 | * @param int $donor_id Customer id. |
555 | 555 | */ |
556 | - do_action( 'give_donor_pre_remove_payment', $payment_id, $this->id ); |
|
556 | + do_action('give_donor_pre_remove_payment', $payment_id, $this->id); |
|
557 | 557 | |
558 | - $payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) ); |
|
558 | + $payment_removed = $this->update(array('payment_ids' => $new_payment_ids)); |
|
559 | 559 | |
560 | - if ( $payment_removed ) { |
|
560 | + if ($payment_removed) { |
|
561 | 561 | |
562 | 562 | $this->payment_ids = $new_payment_ids; |
563 | 563 | |
564 | - if ( $update_stats ) { |
|
564 | + if ($update_stats) { |
|
565 | 565 | // We removed this payment successfully, decrement the stats |
566 | - $payment_amount = give_donation_amount( $payment_id ); |
|
566 | + $payment_amount = give_donation_amount($payment_id); |
|
567 | 567 | |
568 | - if ( ! empty( $payment_amount ) ) { |
|
569 | - $this->decrease_value( $payment_amount ); |
|
568 | + if ( ! empty($payment_amount)) { |
|
569 | + $this->decrease_value($payment_amount); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | $this->decrease_donation_count(); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | * @param int $payment_id Payment id. |
583 | 583 | * @param int $donor_id Donor id. |
584 | 584 | */ |
585 | - do_action( 'give_donor_post_remove_payment', $payment_removed, $payment_id, $this->id ); |
|
585 | + do_action('give_donor_post_remove_payment', $payment_removed, $payment_id, $this->id); |
|
586 | 586 | |
587 | 587 | return $payment_removed; |
588 | 588 | |
@@ -598,10 +598,10 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @return int The donation count. |
600 | 600 | */ |
601 | - public function increase_purchase_count( $count = 1 ) { |
|
601 | + public function increase_purchase_count($count = 1) { |
|
602 | 602 | |
603 | 603 | // Make sure it's numeric and not negative. |
604 | - if ( ! is_numeric( $count ) || $count != absint( $count ) ) { |
|
604 | + if ( ! is_numeric($count) || $count != absint($count)) { |
|
605 | 605 | return false; |
606 | 606 | } |
607 | 607 | |
@@ -615,9 +615,9 @@ discard block |
||
615 | 615 | * @param int $count The number to increase by. |
616 | 616 | * @param int $donor_id Donor id. |
617 | 617 | */ |
618 | - do_action( 'give_donor_pre_increase_donation_count', $count, $this->id ); |
|
618 | + do_action('give_donor_pre_increase_donation_count', $count, $this->id); |
|
619 | 619 | |
620 | - if ( $this->update( array( 'purchase_count' => $new_total ) ) ) { |
|
620 | + if ($this->update(array('purchase_count' => $new_total))) { |
|
621 | 621 | $this->purchase_count = $new_total; |
622 | 622 | } |
623 | 623 | |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | * @param int $count The number increased by. |
631 | 631 | * @param int $donor_id Donor id. |
632 | 632 | */ |
633 | - do_action( 'give_donor_post_increase_donation_count', $this->purchase_count, $count, $this->id ); |
|
633 | + do_action('give_donor_post_increase_donation_count', $this->purchase_count, $count, $this->id); |
|
634 | 634 | |
635 | 635 | return $this->purchase_count; |
636 | 636 | } |
@@ -645,16 +645,16 @@ discard block |
||
645 | 645 | * |
646 | 646 | * @return mixed If successful, the new count, otherwise false. |
647 | 647 | */ |
648 | - public function decrease_donation_count( $count = 1 ) { |
|
648 | + public function decrease_donation_count($count = 1) { |
|
649 | 649 | |
650 | 650 | // Make sure it's numeric and not negative |
651 | - if ( ! is_numeric( $count ) || $count != absint( $count ) ) { |
|
651 | + if ( ! is_numeric($count) || $count != absint($count)) { |
|
652 | 652 | return false; |
653 | 653 | } |
654 | 654 | |
655 | 655 | $new_total = (int) $this->purchase_count - (int) $count; |
656 | 656 | |
657 | - if ( $new_total < 0 ) { |
|
657 | + if ($new_total < 0) { |
|
658 | 658 | $new_total = 0; |
659 | 659 | } |
660 | 660 | |
@@ -666,9 +666,9 @@ discard block |
||
666 | 666 | * @param int $count The number to decrease by. |
667 | 667 | * @param int $donor_id Customer id. |
668 | 668 | */ |
669 | - do_action( 'give_donor_pre_decrease_donation_count', $count, $this->id ); |
|
669 | + do_action('give_donor_pre_decrease_donation_count', $count, $this->id); |
|
670 | 670 | |
671 | - if ( $this->update( array( 'purchase_count' => $new_total ) ) ) { |
|
671 | + if ($this->update(array('purchase_count' => $new_total))) { |
|
672 | 672 | $this->purchase_count = $new_total; |
673 | 673 | } |
674 | 674 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @param int $count The number decreased by. |
682 | 682 | * @param int $donor_id Donor id. |
683 | 683 | */ |
684 | - do_action( 'give_donor_post_decrease_donation_count', $this->purchase_count, $count, $this->id ); |
|
684 | + do_action('give_donor_post_decrease_donation_count', $this->purchase_count, $count, $this->id); |
|
685 | 685 | |
686 | 686 | return $this->purchase_count; |
687 | 687 | } |
@@ -696,9 +696,9 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @return mixed If successful, the new value, otherwise false. |
698 | 698 | */ |
699 | - public function increase_value( $value = 0.00 ) { |
|
699 | + public function increase_value($value = 0.00) { |
|
700 | 700 | |
701 | - $new_value = floatval( $this->purchase_value ) + $value; |
|
701 | + $new_value = floatval($this->purchase_value) + $value; |
|
702 | 702 | |
703 | 703 | /** |
704 | 704 | * Fires before increasing donor lifetime value. |
@@ -708,9 +708,9 @@ discard block |
||
708 | 708 | * @param float $value The value to increase by. |
709 | 709 | * @param int $donor_id Customer id. |
710 | 710 | */ |
711 | - do_action( 'give_donor_pre_increase_value', $value, $this->id ); |
|
711 | + do_action('give_donor_pre_increase_value', $value, $this->id); |
|
712 | 712 | |
713 | - if ( $this->update( array( 'purchase_value' => $new_value ) ) ) { |
|
713 | + if ($this->update(array('purchase_value' => $new_value))) { |
|
714 | 714 | $this->purchase_value = $new_value; |
715 | 715 | } |
716 | 716 | |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | * @param float $value The value increased by. |
724 | 724 | * @param int $donor_id Donor id. |
725 | 725 | */ |
726 | - do_action( 'give_donor_post_increase_value', $this->purchase_value, $value, $this->id ); |
|
726 | + do_action('give_donor_post_increase_value', $this->purchase_value, $value, $this->id); |
|
727 | 727 | |
728 | 728 | return $this->purchase_value; |
729 | 729 | } |
@@ -738,11 +738,11 @@ discard block |
||
738 | 738 | * |
739 | 739 | * @return mixed If successful, the new value, otherwise false. |
740 | 740 | */ |
741 | - public function decrease_value( $value = 0.00 ) { |
|
741 | + public function decrease_value($value = 0.00) { |
|
742 | 742 | |
743 | - $new_value = floatval( $this->purchase_value ) - $value; |
|
743 | + $new_value = floatval($this->purchase_value) - $value; |
|
744 | 744 | |
745 | - if ( $new_value < 0 ) { |
|
745 | + if ($new_value < 0) { |
|
746 | 746 | $new_value = 0.00; |
747 | 747 | } |
748 | 748 | |
@@ -754,9 +754,9 @@ discard block |
||
754 | 754 | * @param float $value The value to decrease by. |
755 | 755 | * @param int $donor_id Donor id. |
756 | 756 | */ |
757 | - do_action( 'give_donor_pre_decrease_value', $value, $this->id ); |
|
757 | + do_action('give_donor_pre_decrease_value', $value, $this->id); |
|
758 | 758 | |
759 | - if ( $this->update( array( 'purchase_value' => $new_value ) ) ) { |
|
759 | + if ($this->update(array('purchase_value' => $new_value))) { |
|
760 | 760 | $this->purchase_value = $new_value; |
761 | 761 | } |
762 | 762 | |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | * @param float $value The value decreased by. |
770 | 770 | * @param int $donor_id Donor id. |
771 | 771 | */ |
772 | - do_action( 'give_donor_post_decrease_value', $this->purchase_value, $value, $this->id ); |
|
772 | + do_action('give_donor_post_decrease_value', $this->purchase_value, $value, $this->id); |
|
773 | 773 | |
774 | 774 | return $this->purchase_value; |
775 | 775 | } |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | * |
789 | 789 | * @return mixed If successful, the new donation stat value, otherwise false. |
790 | 790 | */ |
791 | - public function update_donation_value( $curr_amount, $new_amount ) { |
|
791 | + public function update_donation_value($curr_amount, $new_amount) { |
|
792 | 792 | /** |
793 | 793 | * Payment total difference value can be: |
794 | 794 | * zero (in case amount not change) |
@@ -798,15 +798,15 @@ discard block |
||
798 | 798 | $payment_total_diff = $new_amount - $curr_amount; |
799 | 799 | |
800 | 800 | // We do not need to update donation stat if donation did not change. |
801 | - if ( ! $payment_total_diff ) { |
|
801 | + if ( ! $payment_total_diff) { |
|
802 | 802 | return false; |
803 | 803 | } |
804 | 804 | |
805 | - if ( $payment_total_diff > 0 ) { |
|
806 | - $this->increase_value( $payment_total_diff ); |
|
805 | + if ($payment_total_diff > 0) { |
|
806 | + $this->increase_value($payment_total_diff); |
|
807 | 807 | } else { |
808 | 808 | // Pass payment total difference as +ve value to decrease amount from user lifetime stat. |
809 | - $this->decrease_value( - $payment_total_diff ); |
|
809 | + $this->decrease_value( -$payment_total_diff ); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | return $this->purchase_value; |
@@ -823,15 +823,15 @@ discard block |
||
823 | 823 | * |
824 | 824 | * @return array The notes requested. |
825 | 825 | */ |
826 | - public function get_notes( $length = 20, $paged = 1 ) { |
|
826 | + public function get_notes($length = 20, $paged = 1) { |
|
827 | 827 | |
828 | - $length = is_numeric( $length ) ? $length : 20; |
|
829 | - $offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0; |
|
828 | + $length = is_numeric($length) ? $length : 20; |
|
829 | + $offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0; |
|
830 | 830 | |
831 | 831 | $all_notes = $this->get_raw_notes(); |
832 | - $notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) ); |
|
832 | + $notes_array = array_reverse(array_filter(explode("\n\n", $all_notes))); |
|
833 | 833 | |
834 | - $desired_notes = array_slice( $notes_array, $offset, $length ); |
|
834 | + $desired_notes = array_slice($notes_array, $offset, $length); |
|
835 | 835 | |
836 | 836 | return $desired_notes; |
837 | 837 | |
@@ -848,9 +848,9 @@ discard block |
||
848 | 848 | public function get_notes_count() { |
849 | 849 | |
850 | 850 | $all_notes = $this->get_raw_notes(); |
851 | - $notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) ); |
|
851 | + $notes_array = array_reverse(array_filter(explode("\n\n", $all_notes))); |
|
852 | 852 | |
853 | - return count( $notes_array ); |
|
853 | + return count($notes_array); |
|
854 | 854 | |
855 | 855 | } |
856 | 856 | |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | * |
864 | 864 | * @return string|float |
865 | 865 | */ |
866 | - public function get_total_donation_amount( $args = array() ) { |
|
866 | + public function get_total_donation_amount($args = array()) { |
|
867 | 867 | |
868 | 868 | /** |
869 | 869 | * Filter total donation amount. |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | * @param integer $donor_id Donor ID. |
875 | 875 | * @param array $args Pass additional data. |
876 | 876 | */ |
877 | - return apply_filters( 'give_get_total_donation_amount', $this->purchase_value, $this->id, $args ); |
|
877 | + return apply_filters('give_get_total_donation_amount', $this->purchase_value, $this->id, $args); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | /** |
@@ -887,22 +887,22 @@ discard block |
||
887 | 887 | * |
888 | 888 | * @return string|boolean The new note if added successfully, false otherwise. |
889 | 889 | */ |
890 | - public function add_note( $note = '' ) { |
|
890 | + public function add_note($note = '') { |
|
891 | 891 | |
892 | - $note = trim( $note ); |
|
893 | - if ( empty( $note ) ) { |
|
892 | + $note = trim($note); |
|
893 | + if (empty($note)) { |
|
894 | 894 | return false; |
895 | 895 | } |
896 | 896 | |
897 | 897 | $notes = $this->get_raw_notes(); |
898 | 898 | |
899 | - if ( empty( $notes ) ) { |
|
899 | + if (empty($notes)) { |
|
900 | 900 | $notes = ''; |
901 | 901 | } |
902 | 902 | |
903 | - $note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note; |
|
904 | - $new_note = apply_filters( 'give_customer_add_note_string', $note_string ); |
|
905 | - $notes .= "\n\n" . $new_note; |
|
903 | + $note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note; |
|
904 | + $new_note = apply_filters('give_customer_add_note_string', $note_string); |
|
905 | + $notes .= "\n\n".$new_note; |
|
906 | 906 | |
907 | 907 | /** |
908 | 908 | * Fires before donor note is added. |
@@ -912,11 +912,11 @@ discard block |
||
912 | 912 | * @param string $new_note New note to add. |
913 | 913 | * @param int $donor_id Donor id. |
914 | 914 | */ |
915 | - do_action( 'give_donor_pre_add_note', $new_note, $this->id ); |
|
915 | + do_action('give_donor_pre_add_note', $new_note, $this->id); |
|
916 | 916 | |
917 | - $updated = $this->update( array( 'notes' => $notes ) ); |
|
917 | + $updated = $this->update(array('notes' => $notes)); |
|
918 | 918 | |
919 | - if ( $updated ) { |
|
919 | + if ($updated) { |
|
920 | 920 | $this->notes = $this->get_notes(); |
921 | 921 | } |
922 | 922 | |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | * @param string $new_note New note added. |
930 | 930 | * @param int $donor_id Donor id. |
931 | 931 | */ |
932 | - do_action( 'give_donor_post_add_note', $this->notes, $new_note, $this->id ); |
|
932 | + do_action('give_donor_post_add_note', $this->notes, $new_note, $this->id); |
|
933 | 933 | |
934 | 934 | // Return the formatted note, so we can test, as well as update any displays |
935 | 935 | return $new_note; |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | */ |
947 | 947 | private function get_raw_notes() { |
948 | 948 | |
949 | - $all_notes = $this->db->get_column( 'notes', $this->id ); |
|
949 | + $all_notes = $this->db->get_column('notes', $this->id); |
|
950 | 950 | |
951 | 951 | return $all_notes; |
952 | 952 | |
@@ -963,8 +963,8 @@ discard block |
||
963 | 963 | * |
964 | 964 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true. |
965 | 965 | */ |
966 | - public function get_meta( $meta_key = '', $single = true ) { |
|
967 | - return Give()->donor_meta->get_meta( $this->id, $meta_key, $single ); |
|
966 | + public function get_meta($meta_key = '', $single = true) { |
|
967 | + return Give()->donor_meta->get_meta($this->id, $meta_key, $single); |
|
968 | 968 | } |
969 | 969 | |
970 | 970 | /** |
@@ -979,8 +979,8 @@ discard block |
||
979 | 979 | * |
980 | 980 | * @return bool False for failure. True for success. |
981 | 981 | */ |
982 | - public function add_meta( $meta_key = '', $meta_value, $unique = false ) { |
|
983 | - return Give()->donor_meta->add_meta( $this->id, $meta_key, $meta_value, $unique ); |
|
982 | + public function add_meta($meta_key = '', $meta_value, $unique = false) { |
|
983 | + return Give()->donor_meta->add_meta($this->id, $meta_key, $meta_value, $unique); |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | /** |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | * |
996 | 996 | * @return bool False on failure, true if success. |
997 | 997 | */ |
998 | - public function update_meta( $meta_key = '', $meta_value, $prev_value = '' ) { |
|
999 | - return Give()->donor_meta->update_meta( $this->id, $meta_key, $meta_value, $prev_value ); |
|
998 | + public function update_meta($meta_key = '', $meta_value, $prev_value = '') { |
|
999 | + return Give()->donor_meta->update_meta($this->id, $meta_key, $meta_value, $prev_value); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | /** |
@@ -1010,8 +1010,8 @@ discard block |
||
1010 | 1010 | * |
1011 | 1011 | * @return bool False for failure. True for success. |
1012 | 1012 | */ |
1013 | - public function delete_meta( $meta_key = '', $meta_value = '' ) { |
|
1014 | - return Give()->donor_meta->delete_meta( $this->id, $meta_key, $meta_value ); |
|
1013 | + public function delete_meta($meta_key = '', $meta_value = '') { |
|
1014 | + return Give()->donor_meta->delete_meta($this->id, $meta_key, $meta_value); |
|
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | /** |
@@ -1024,51 +1024,51 @@ discard block |
||
1024 | 1024 | * |
1025 | 1025 | * @return array The sanitized data, based off column defaults. |
1026 | 1026 | */ |
1027 | - private function sanitize_columns( $data ) { |
|
1027 | + private function sanitize_columns($data) { |
|
1028 | 1028 | |
1029 | 1029 | $columns = $this->db->get_columns(); |
1030 | 1030 | $default_values = $this->db->get_column_defaults(); |
1031 | 1031 | |
1032 | - foreach ( $columns as $key => $type ) { |
|
1032 | + foreach ($columns as $key => $type) { |
|
1033 | 1033 | |
1034 | 1034 | // Only sanitize data that we were provided |
1035 | - if ( ! array_key_exists( $key, $data ) ) { |
|
1035 | + if ( ! array_key_exists($key, $data)) { |
|
1036 | 1036 | continue; |
1037 | 1037 | } |
1038 | 1038 | |
1039 | - switch ( $type ) { |
|
1039 | + switch ($type) { |
|
1040 | 1040 | |
1041 | 1041 | case '%s': |
1042 | - if ( 'email' == $key ) { |
|
1043 | - $data[ $key ] = sanitize_email( $data[ $key ] ); |
|
1044 | - } elseif ( 'notes' == $key ) { |
|
1045 | - $data[ $key ] = strip_tags( $data[ $key ] ); |
|
1042 | + if ('email' == $key) { |
|
1043 | + $data[$key] = sanitize_email($data[$key]); |
|
1044 | + } elseif ('notes' == $key) { |
|
1045 | + $data[$key] = strip_tags($data[$key]); |
|
1046 | 1046 | } else { |
1047 | - $data[ $key ] = sanitize_text_field( $data[ $key ] ); |
|
1047 | + $data[$key] = sanitize_text_field($data[$key]); |
|
1048 | 1048 | } |
1049 | 1049 | break; |
1050 | 1050 | |
1051 | 1051 | case '%d': |
1052 | - if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) { |
|
1053 | - $data[ $key ] = $default_values[ $key ]; |
|
1052 | + if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) { |
|
1053 | + $data[$key] = $default_values[$key]; |
|
1054 | 1054 | } else { |
1055 | - $data[ $key ] = absint( $data[ $key ] ); |
|
1055 | + $data[$key] = absint($data[$key]); |
|
1056 | 1056 | } |
1057 | 1057 | break; |
1058 | 1058 | |
1059 | 1059 | case '%f': |
1060 | 1060 | // Convert what was given to a float |
1061 | - $value = floatval( $data[ $key ] ); |
|
1061 | + $value = floatval($data[$key]); |
|
1062 | 1062 | |
1063 | - if ( ! is_float( $value ) ) { |
|
1064 | - $data[ $key ] = $default_values[ $key ]; |
|
1063 | + if ( ! is_float($value)) { |
|
1064 | + $data[$key] = $default_values[$key]; |
|
1065 | 1065 | } else { |
1066 | - $data[ $key ] = $value; |
|
1066 | + $data[$key] = $value; |
|
1067 | 1067 | } |
1068 | 1068 | break; |
1069 | 1069 | |
1070 | 1070 | default: |
1071 | - $data[ $key ] = sanitize_text_field( $data[ $key ] ); |
|
1071 | + $data[$key] = sanitize_text_field($data[$key]); |
|
1072 | 1072 | break; |
1073 | 1073 | |
1074 | 1074 | } |
@@ -1088,33 +1088,33 @@ discard block |
||
1088 | 1088 | * |
1089 | 1089 | * @return bool If the email was added successfully |
1090 | 1090 | */ |
1091 | - public function add_email( $email = '', $primary = false ) { |
|
1092 | - if ( ! is_email( $email ) ) { |
|
1091 | + public function add_email($email = '', $primary = false) { |
|
1092 | + if ( ! is_email($email)) { |
|
1093 | 1093 | return false; |
1094 | 1094 | } |
1095 | - $existing = new Give_Donor( $email ); |
|
1095 | + $existing = new Give_Donor($email); |
|
1096 | 1096 | |
1097 | - if ( $existing->id > 0 ) { |
|
1097 | + if ($existing->id > 0) { |
|
1098 | 1098 | // Email address already belongs to another donor |
1099 | 1099 | return false; |
1100 | 1100 | } |
1101 | 1101 | |
1102 | - if ( email_exists( $email ) ) { |
|
1103 | - $user = get_user_by( 'email', $email ); |
|
1104 | - if ( $user->ID != $this->user_id ) { |
|
1102 | + if (email_exists($email)) { |
|
1103 | + $user = get_user_by('email', $email); |
|
1104 | + if ($user->ID != $this->user_id) { |
|
1105 | 1105 | return false; |
1106 | 1106 | } |
1107 | 1107 | } |
1108 | 1108 | |
1109 | - do_action( 'give_donor_pre_add_email', $email, $this->id, $this ); |
|
1109 | + do_action('give_donor_pre_add_email', $email, $this->id, $this); |
|
1110 | 1110 | |
1111 | 1111 | // Add is used to ensure duplicate emails are not added |
1112 | - $ret = (bool) $this->add_meta( 'additional_email', $email ); |
|
1112 | + $ret = (bool) $this->add_meta('additional_email', $email); |
|
1113 | 1113 | |
1114 | - do_action( 'give_donor_post_add_email', $email, $this->id, $this ); |
|
1114 | + do_action('give_donor_post_add_email', $email, $this->id, $this); |
|
1115 | 1115 | |
1116 | - if ( $ret && true === $primary ) { |
|
1117 | - $this->set_primary_email( $email ); |
|
1116 | + if ($ret && true === $primary) { |
|
1117 | + $this->set_primary_email($email); |
|
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | return $ret; |
@@ -1130,16 +1130,16 @@ discard block |
||
1130 | 1130 | * |
1131 | 1131 | * @return bool If the email was removed successfully. |
1132 | 1132 | */ |
1133 | - public function remove_email( $email = '' ) { |
|
1134 | - if ( ! is_email( $email ) ) { |
|
1133 | + public function remove_email($email = '') { |
|
1134 | + if ( ! is_email($email)) { |
|
1135 | 1135 | return false; |
1136 | 1136 | } |
1137 | 1137 | |
1138 | - do_action( 'give_donor_pre_remove_email', $email, $this->id, $this ); |
|
1138 | + do_action('give_donor_pre_remove_email', $email, $this->id, $this); |
|
1139 | 1139 | |
1140 | - $ret = (bool) $this->delete_meta( 'additional_email', $email ); |
|
1140 | + $ret = (bool) $this->delete_meta('additional_email', $email); |
|
1141 | 1141 | |
1142 | - do_action( 'give_donor_post_remove_email', $email, $this->id, $this ); |
|
1142 | + do_action('give_donor_post_remove_email', $email, $this->id, $this); |
|
1143 | 1143 | |
1144 | 1144 | return $ret; |
1145 | 1145 | } |
@@ -1156,16 +1156,16 @@ discard block |
||
1156 | 1156 | * |
1157 | 1157 | * @return bool If the email was set as primary successfully. |
1158 | 1158 | */ |
1159 | - public function set_primary_email( $new_primary_email = '' ) { |
|
1160 | - if ( ! is_email( $new_primary_email ) ) { |
|
1159 | + public function set_primary_email($new_primary_email = '') { |
|
1160 | + if ( ! is_email($new_primary_email)) { |
|
1161 | 1161 | return false; |
1162 | 1162 | } |
1163 | 1163 | |
1164 | - do_action( 'give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this ); |
|
1164 | + do_action('give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this); |
|
1165 | 1165 | |
1166 | - $existing = new Give_Donor( $new_primary_email ); |
|
1166 | + $existing = new Give_Donor($new_primary_email); |
|
1167 | 1167 | |
1168 | - if ( $existing->id > 0 && (int) $existing->id !== (int) $this->id ) { |
|
1168 | + if ($existing->id > 0 && (int) $existing->id !== (int) $this->id) { |
|
1169 | 1169 | // This email belongs to another donor. |
1170 | 1170 | return false; |
1171 | 1171 | } |
@@ -1173,21 +1173,21 @@ discard block |
||
1173 | 1173 | $old_email = $this->email; |
1174 | 1174 | |
1175 | 1175 | // Update donor record with new email. |
1176 | - $update = $this->update( array( 'email' => $new_primary_email ) ); |
|
1176 | + $update = $this->update(array('email' => $new_primary_email)); |
|
1177 | 1177 | |
1178 | 1178 | // Remove new primary from list of additional emails. |
1179 | - $remove = $this->remove_email( $new_primary_email ); |
|
1179 | + $remove = $this->remove_email($new_primary_email); |
|
1180 | 1180 | |
1181 | 1181 | // Add old email to additional emails list. |
1182 | - $add = $this->add_email( $old_email ); |
|
1182 | + $add = $this->add_email($old_email); |
|
1183 | 1183 | |
1184 | 1184 | $ret = $update && $remove && $add; |
1185 | 1185 | |
1186 | - if ( $ret ) { |
|
1186 | + if ($ret) { |
|
1187 | 1187 | $this->email = $new_primary_email; |
1188 | 1188 | } |
1189 | 1189 | |
1190 | - do_action( 'give_donor_post_set_primary_email', $new_primary_email, $this->id, $this ); |
|
1190 | + do_action('give_donor_post_set_primary_email', $new_primary_email, $this->id, $this); |
|
1191 | 1191 | |
1192 | 1192 | return $ret; |
1193 | 1193 | } |
@@ -1202,17 +1202,17 @@ discard block |
||
1202 | 1202 | * |
1203 | 1203 | * @return bool |
1204 | 1204 | */ |
1205 | - private function is_valid_address( $address ) { |
|
1205 | + private function is_valid_address($address) { |
|
1206 | 1206 | $is_valid_address = true; |
1207 | 1207 | |
1208 | 1208 | // Address ready to process even if only one value set. |
1209 | - foreach ( $address as $address_type => $value ) { |
|
1209 | + foreach ($address as $address_type => $value) { |
|
1210 | 1210 | // @todo: Handle state field validation on basis of country. |
1211 | - if( in_array( $address_type, array( 'line2', 'state' )) ) { |
|
1211 | + if (in_array($address_type, array('line2', 'state'))) { |
|
1212 | 1212 | continue; |
1213 | 1213 | } |
1214 | 1214 | |
1215 | - if ( empty( $value ) ) { |
|
1215 | + if (empty($value)) { |
|
1216 | 1216 | $is_valid_address = false; |
1217 | 1217 | break; |
1218 | 1218 | } |
@@ -1239,30 +1239,27 @@ discard block |
||
1239 | 1239 | * |
1240 | 1240 | * @return bool |
1241 | 1241 | */ |
1242 | - public function add_address( $address_type, $address ) { |
|
1242 | + public function add_address($address_type, $address) { |
|
1243 | 1243 | // Bailout. |
1244 | - if ( empty( $address_type ) || ! $this->is_valid_address( $address ) || ! $this->id ) { |
|
1244 | + if (empty($address_type) || ! $this->is_valid_address($address) || ! $this->id) { |
|
1245 | 1245 | return false; |
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | // Check if multiple address exist or not and set params. |
1249 | 1249 | $multi_address_id = null; |
1250 | - if( $is_multi_address = ( false !== strpos( $address_type, '[]' ) ) ) { |
|
1251 | - $address_type = $is_multi_address ? |
|
1252 | - str_replace( '[]', '', $address_type ) : |
|
1253 | - $address_type; |
|
1254 | - } elseif ( $is_multi_address = ( false !== strpos( $address_type, '_' ) ) ){ |
|
1255 | - $multi_address_id = $is_multi_address ? |
|
1256 | - array_pop( explode( '_', $address_type ) ) : |
|
1257 | - $address_type; |
|
1258 | - |
|
1259 | - $address_type = $is_multi_address ? |
|
1260 | - array_shift( explode( '_', $address_type ) ) : |
|
1261 | - $address_type; |
|
1250 | + if ($is_multi_address = (false !== strpos($address_type, '[]'))) { |
|
1251 | + $address_type = $is_multi_address ? |
|
1252 | + str_replace('[]', '', $address_type) : $address_type; |
|
1253 | + } elseif ($is_multi_address = (false !== strpos($address_type, '_'))) { |
|
1254 | + $multi_address_id = $is_multi_address ? |
|
1255 | + array_pop(explode('_', $address_type)) : $address_type; |
|
1256 | + |
|
1257 | + $address_type = $is_multi_address ? |
|
1258 | + array_shift(explode('_', $address_type)) : $address_type; |
|
1262 | 1259 | } |
1263 | 1260 | |
1264 | 1261 | // Bailout: do not save duplicate orders |
1265 | - if( $this->is_address_exist( $address_type, $address ) ) { |
|
1262 | + if ($this->is_address_exist($address_type, $address)) { |
|
1266 | 1263 | return false; |
1267 | 1264 | } |
1268 | 1265 | |
@@ -1284,8 +1281,8 @@ discard block |
||
1284 | 1281 | $meta_key_prefix = "_give_donor_address_{$address_type}_{address_name}"; |
1285 | 1282 | $meta_type = Give()->donor_meta->meta_type; |
1286 | 1283 | |
1287 | - if ( $is_multi_address ) { |
|
1288 | - if ( is_null( $multi_address_id ) ) { |
|
1284 | + if ($is_multi_address) { |
|
1285 | + if (is_null($multi_address_id)) { |
|
1289 | 1286 | // Get latest address key to set multi address id. |
1290 | 1287 | $multi_address_id = $wpdb->get_var( |
1291 | 1288 | $wpdb->prepare( |
@@ -1302,10 +1299,10 @@ discard block |
||
1302 | 1299 | ) |
1303 | 1300 | ); |
1304 | 1301 | |
1305 | - if( ! empty( $multi_address_id ) ) { |
|
1306 | - $multi_address_id = absint( substr( strrchr( $multi_address_id, '_' ), 1 ) ); |
|
1302 | + if ( ! empty($multi_address_id)) { |
|
1303 | + $multi_address_id = absint(substr(strrchr($multi_address_id, '_'), 1)); |
|
1307 | 1304 | $multi_address_id++; |
1308 | - } else{ |
|
1305 | + } else { |
|
1309 | 1306 | $multi_address_id = 0; |
1310 | 1307 | } |
1311 | 1308 | } |
@@ -1314,9 +1311,9 @@ discard block |
||
1314 | 1311 | } |
1315 | 1312 | |
1316 | 1313 | // Save donor address. |
1317 | - foreach ( $address as $type => $value ) { |
|
1318 | - $meta_key = str_replace( '{address_name}', $type, $meta_key_prefix ); |
|
1319 | - Give()->donor_meta->update_meta( $this->id, $meta_key, $value ); |
|
1314 | + foreach ($address as $type => $value) { |
|
1315 | + $meta_key = str_replace('{address_name}', $type, $meta_key_prefix); |
|
1316 | + Give()->donor_meta->update_meta($this->id, $meta_key, $value); |
|
1320 | 1317 | } |
1321 | 1318 | |
1322 | 1319 | $this->setup_address(); |
@@ -1335,23 +1332,21 @@ discard block |
||
1335 | 1332 | * |
1336 | 1333 | * @return bool |
1337 | 1334 | */ |
1338 | - public function remove_address( $address_id ) { |
|
1335 | + public function remove_address($address_id) { |
|
1339 | 1336 | global $wpdb; |
1340 | 1337 | |
1341 | 1338 | // Get address type. |
1342 | - $is_multi_address = false !== strpos( $address_id, '_' ) ? true : false; |
|
1339 | + $is_multi_address = false !== strpos($address_id, '_') ? true : false; |
|
1343 | 1340 | |
1344 | - $address_type = false !== strpos( $address_id, '_' ) ? |
|
1345 | - array_shift( explode( '_', $address_id ) ) : |
|
1346 | - $address_id; |
|
1341 | + $address_type = false !== strpos($address_id, '_') ? |
|
1342 | + array_shift(explode('_', $address_id)) : $address_id; |
|
1347 | 1343 | |
1348 | - $address_count = false !== strpos( $address_id, '_' ) ? |
|
1349 | - array_pop( explode( '_', $address_id ) ) : |
|
1350 | - null; |
|
1344 | + $address_count = false !== strpos($address_id, '_') ? |
|
1345 | + array_pop(explode('_', $address_id)) : null; |
|
1351 | 1346 | |
1352 | 1347 | // Set meta key prefix. |
1353 | 1348 | $meta_key_prefix = "_give_donor_address_{$address_type}_%"; |
1354 | - if ( $is_multi_address && is_numeric( $address_count ) ) { |
|
1349 | + if ($is_multi_address && is_numeric($address_count)) { |
|
1355 | 1350 | $meta_key_prefix .= "_{$address_count}"; |
1356 | 1351 | } |
1357 | 1352 | |
@@ -1388,23 +1383,21 @@ discard block |
||
1388 | 1383 | * |
1389 | 1384 | * @return bool |
1390 | 1385 | */ |
1391 | - public function update_address( $address_id, $address ) { |
|
1386 | + public function update_address($address_id, $address) { |
|
1392 | 1387 | global $wpdb; |
1393 | 1388 | |
1394 | 1389 | // Get address type. |
1395 | - $is_multi_address = false !== strpos( $address_id, '_' ) ? true : false; |
|
1390 | + $is_multi_address = false !== strpos($address_id, '_') ? true : false; |
|
1396 | 1391 | |
1397 | - $address_type = false !== strpos( $address_id, '_' ) ? |
|
1398 | - array_shift( explode( '_', $address_id ) ) : |
|
1399 | - $address_id; |
|
1392 | + $address_type = false !== strpos($address_id, '_') ? |
|
1393 | + array_shift(explode('_', $address_id)) : $address_id; |
|
1400 | 1394 | |
1401 | - $address_count = false !== strpos( $address_id, '_' ) ? |
|
1402 | - array_pop( explode( '_', $address_id ) ) : |
|
1403 | - null; |
|
1395 | + $address_count = false !== strpos($address_id, '_') ? |
|
1396 | + array_pop(explode('_', $address_id)) : null; |
|
1404 | 1397 | |
1405 | 1398 | // Set meta key prefix. |
1406 | 1399 | $meta_key_prefix = "_give_donor_address_{$address_type}_%"; |
1407 | - if ( $is_multi_address && is_numeric( $address_count ) ) { |
|
1400 | + if ($is_multi_address && is_numeric($address_count)) { |
|
1408 | 1401 | $meta_key_prefix .= "_{$address_count}"; |
1409 | 1402 | } |
1410 | 1403 | |
@@ -1425,12 +1418,12 @@ discard block |
||
1425 | 1418 | ); |
1426 | 1419 | |
1427 | 1420 | // Return result. |
1428 | - if( ! count( $row_affected ) ) { |
|
1421 | + if ( ! count($row_affected)) { |
|
1429 | 1422 | return false; |
1430 | 1423 | } |
1431 | 1424 | |
1432 | 1425 | // Update address. |
1433 | - if( ! $this->add_address( $address_id, $address ) ) { |
|
1426 | + if ( ! $this->add_address($address_id, $address)) { |
|
1434 | 1427 | return false; |
1435 | 1428 | } |
1436 | 1429 | |
@@ -1449,39 +1442,39 @@ discard block |
||
1449 | 1442 | * |
1450 | 1443 | * @return bool|null |
1451 | 1444 | */ |
1452 | - public function is_address_exist( $current_address_type, $current_address ) { |
|
1445 | + public function is_address_exist($current_address_type, $current_address) { |
|
1453 | 1446 | $status = false; |
1454 | 1447 | |
1455 | 1448 | // Bailout. |
1456 | - if( empty( $current_address_type ) || empty( $current_address ) ) { |
|
1449 | + if (empty($current_address_type) || empty($current_address)) { |
|
1457 | 1450 | return null; |
1458 | 1451 | } |
1459 | 1452 | |
1460 | 1453 | // Bailout. |
1461 | - if( empty( $this->address ) || empty( $this->address[ $current_address_type ] ) ) { |
|
1454 | + if (empty($this->address) || empty($this->address[$current_address_type])) { |
|
1462 | 1455 | return $status; |
1463 | 1456 | } |
1464 | 1457 | |
1465 | 1458 | // Get address. |
1466 | - $address = $this->address[ $current_address_type ]; |
|
1459 | + $address = $this->address[$current_address_type]; |
|
1467 | 1460 | |
1468 | - switch ( true ){ |
|
1461 | + switch (true) { |
|
1469 | 1462 | |
1470 | 1463 | // Single address. |
1471 | - case is_string( end( $address ) ) : |
|
1472 | - $status = $this->is_address_match( $current_address, $address ); |
|
1464 | + case is_string(end($address)) : |
|
1465 | + $status = $this->is_address_match($current_address, $address); |
|
1473 | 1466 | break; |
1474 | 1467 | |
1475 | 1468 | // Multi address. |
1476 | - case is_array( end( $address ) ): |
|
1469 | + case is_array(end($address)): |
|
1477 | 1470 | // Compare address. |
1478 | - foreach ( $address as $saved_address ) { |
|
1479 | - if( empty( $saved_address ) ) { |
|
1471 | + foreach ($address as $saved_address) { |
|
1472 | + if (empty($saved_address)) { |
|
1480 | 1473 | continue; |
1481 | 1474 | } |
1482 | 1475 | |
1483 | 1476 | // Exit loop immediately if address exist. |
1484 | - if( $status = $this->is_address_match( $current_address, $saved_address ) ) { |
|
1477 | + if ($status = $this->is_address_match($current_address, $saved_address)) { |
|
1485 | 1478 | break; |
1486 | 1479 | } |
1487 | 1480 | } |
@@ -1502,10 +1495,10 @@ discard block |
||
1502 | 1495 | * |
1503 | 1496 | * @return bool |
1504 | 1497 | */ |
1505 | - private function is_address_match( $address_1, $address_2 ) { |
|
1506 | - $result = array_diff( $address_1, $address_2 ); |
|
1498 | + private function is_address_match($address_1, $address_2) { |
|
1499 | + $result = array_diff($address_1, $address_2); |
|
1507 | 1500 | |
1508 | - return empty( $result ); |
|
1501 | + return empty($result); |
|
1509 | 1502 | } |
1510 | 1503 | |
1511 | 1504 | /** |
@@ -1515,22 +1508,22 @@ discard block |
||
1515 | 1508 | * @since 2.0 |
1516 | 1509 | * @return object |
1517 | 1510 | */ |
1518 | - public function split_donor_name( $id ) { |
|
1519 | - $first_name = $last_name = ''; |
|
1520 | - $donor = new Give_Donor( $id ); |
|
1511 | + public function split_donor_name($id) { |
|
1512 | + $first_name = $last_name = ''; |
|
1513 | + $donor = new Give_Donor($id); |
|
1521 | 1514 | |
1522 | - $split_donor_name = explode( ' ', $donor->name, 2 ); |
|
1515 | + $split_donor_name = explode(' ', $donor->name, 2); |
|
1523 | 1516 | |
1524 | 1517 | // Check for existence of first name after split of donor name. |
1525 | - if( is_array( $split_donor_name ) && ! empty( $split_donor_name[0] ) ) { |
|
1518 | + if (is_array($split_donor_name) && ! empty($split_donor_name[0])) { |
|
1526 | 1519 | $first_name = $split_donor_name[0]; |
1527 | 1520 | } |
1528 | 1521 | |
1529 | 1522 | // Check for existence of last name after split of donor name. |
1530 | - if( is_array( $split_donor_name ) && ! empty( $split_donor_name[1] ) ) { |
|
1523 | + if (is_array($split_donor_name) && ! empty($split_donor_name[1])) { |
|
1531 | 1524 | $last_name = $split_donor_name[1]; |
1532 | 1525 | } |
1533 | - return (object) array( 'first_name' => $first_name, 'last_name' => $last_name ); |
|
1526 | + return (object) array('first_name' => $first_name, 'last_name' => $last_name); |
|
1534 | 1527 | } |
1535 | 1528 | |
1536 | 1529 | /** |
@@ -1540,9 +1533,9 @@ discard block |
||
1540 | 1533 | * @return string |
1541 | 1534 | */ |
1542 | 1535 | public function get_first_name() { |
1543 | - $first_name = $this->get_meta( '_give_donor_first_name'); |
|
1544 | - if( ! $first_name ) { |
|
1545 | - $first_name = $this->split_donor_name( $this->id )->first_name; |
|
1536 | + $first_name = $this->get_meta('_give_donor_first_name'); |
|
1537 | + if ( ! $first_name) { |
|
1538 | + $first_name = $this->split_donor_name($this->id)->first_name; |
|
1546 | 1539 | } |
1547 | 1540 | |
1548 | 1541 | return $first_name; |
@@ -1555,14 +1548,14 @@ discard block |
||
1555 | 1548 | * @return string |
1556 | 1549 | */ |
1557 | 1550 | public function get_last_name() { |
1558 | - $first_name = $this->get_meta( '_give_donor_first_name'); |
|
1559 | - $last_name = $this->get_meta( '_give_donor_last_name'); |
|
1551 | + $first_name = $this->get_meta('_give_donor_first_name'); |
|
1552 | + $last_name = $this->get_meta('_give_donor_last_name'); |
|
1560 | 1553 | |
1561 | 1554 | // This condition will prevent unnecessary splitting of donor name to fetch last name. |
1562 | - if( ! $first_name && ! $last_name ) { |
|
1563 | - $last_name = $this->split_donor_name( $this->id )->last_name; |
|
1555 | + if ( ! $first_name && ! $last_name) { |
|
1556 | + $last_name = $this->split_donor_name($this->id)->last_name; |
|
1564 | 1557 | } |
1565 | 1558 | |
1566 | - return ( $last_name ) ? $last_name : ''; |
|
1559 | + return ($last_name) ? $last_name : ''; |
|
1567 | 1560 | } |
1568 | 1561 | } |
@@ -9,11 +9,11 @@ discard block |
||
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_Page' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Page')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Page. |
@@ -70,25 +70,25 @@ discard block |
||
70 | 70 | // Get current setting page. |
71 | 71 | $this->current_setting_page = give_get_current_setting_page(); |
72 | 72 | |
73 | - add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 ); |
|
74 | - add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 ); |
|
75 | - add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
73 | + add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10); |
|
74 | + add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20); |
|
75 | + add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output')); |
|
76 | 76 | |
77 | 77 | // Output section only if exist. |
78 | 78 | $sections = $this->get_sections(); |
79 | - if ( ! empty( $sections ) ) { |
|
80 | - add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( |
|
79 | + if ( ! empty($sections)) { |
|
80 | + add_action("{$this->current_setting_page}_sections_{$this->id}_page", array( |
|
81 | 81 | $this, |
82 | 82 | 'output_sections', |
83 | - ) ); |
|
83 | + )); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Save hide button by default. |
87 | 87 | $GLOBALS['give_hide_save_button'] = true; |
88 | 88 | |
89 | 89 | // Enable saving feature. |
90 | - if ( $this->enable_save ) { |
|
91 | - add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) ); |
|
90 | + if ($this->enable_save) { |
|
91 | + add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save')); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return string |
115 | 115 | */ |
116 | - function set_default_setting_tab( $setting_tab ) { |
|
116 | + function set_default_setting_tab($setting_tab) { |
|
117 | 117 | return $this->default_tab; |
118 | 118 | } |
119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return array |
128 | 128 | */ |
129 | - public function add_settings_page( $pages ) { |
|
130 | - $pages[ $this->id ] = $this->label; |
|
129 | + public function add_settings_page($pages) { |
|
130 | + $pages[$this->id] = $this->label; |
|
131 | 131 | |
132 | 132 | return $pages; |
133 | 133 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param array $settings |
148 | 148 | */ |
149 | - $settings = apply_filters( 'give_get_settings_' . $this->id, array() ); |
|
149 | + $settings = apply_filters('give_get_settings_'.$this->id, array()); |
|
150 | 150 | |
151 | 151 | // Output. |
152 | 152 | return $settings; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @return array |
160 | 160 | */ |
161 | 161 | public function get_sections() { |
162 | - return apply_filters( 'give_get_sections_' . $this->id, array() ); |
|
162 | + return apply_filters('give_get_sections_'.$this->id, array()); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -176,39 +176,39 @@ discard block |
||
176 | 176 | $sections = $this->get_sections(); |
177 | 177 | |
178 | 178 | // Bailout. |
179 | - if ( empty( $sections ) ) { |
|
179 | + if (empty($sections)) { |
|
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | 183 | // Show section settings only if setting section exist. |
184 | - if ( $current_section && ! in_array( $current_section, array_keys( $sections ) ) ) { |
|
185 | - echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
184 | + if ($current_section && ! in_array($current_section, array_keys($sections))) { |
|
185 | + echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; |
|
186 | 186 | $GLOBALS['give_hide_save_button'] = true; |
187 | 187 | |
188 | 188 | return; |
189 | 189 | } |
190 | 190 | |
191 | - if ( is_null( $this->current_setting_page ) ) { |
|
191 | + if (is_null($this->current_setting_page)) { |
|
192 | 192 | $this->current_setting_page = give_get_current_setting_page(); |
193 | 193 | } |
194 | 194 | |
195 | 195 | $section_list = array(); |
196 | - foreach ( $sections as $id => $label ) { |
|
196 | + foreach ($sections as $id => $label) { |
|
197 | 197 | /** |
198 | 198 | * Fire the filter to hide particular section on tab. |
199 | 199 | * |
200 | 200 | * @since 2.0 |
201 | 201 | */ |
202 | - if ( apply_filters( "give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id ) ) { |
|
202 | + if (apply_filters("give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id)) { |
|
203 | 203 | continue; |
204 | 204 | } |
205 | 205 | |
206 | - $section_list[] = '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a>'; |
|
206 | + $section_list[] = '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'§ion='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a>'; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | echo sprintf( |
210 | 210 | '<ul class="subsubsub">%s</ul><br class="clear" /><hr>', |
211 | - implode( ' | </li>', $section_list ) |
|
211 | + implode(' | </li>', $section_list) |
|
212 | 212 | ); |
213 | 213 | } |
214 | 214 | |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | * @return void |
222 | 222 | */ |
223 | 223 | public function output() { |
224 | - if ( $this->enable_save ) { |
|
224 | + if ($this->enable_save) { |
|
225 | 225 | $GLOBALS['give_hide_save_button'] = false; |
226 | 226 | } |
227 | 227 | |
228 | 228 | $settings = $this->get_settings(); |
229 | 229 | |
230 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
230 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | $settings = $this->get_settings(); |
241 | 241 | $current_section = give_get_current_setting_section(); |
242 | 242 | |
243 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
243 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Trigger Action |
247 | 247 | * |
248 | 248 | * @since 1.8 |
249 | 249 | */ |
250 | - do_action( 'give_update_options_' . $this->id . '_' . $current_section ); |
|
250 | + do_action('give_update_options_'.$this->id.'_'.$current_section); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -264,11 +264,11 @@ discard block |
||
264 | 264 | $section = $this->get_sections(); |
265 | 265 | $current_section = give_get_current_setting_section(); |
266 | 266 | |
267 | - if ( array_key_exists( $current_section, $section ) ) { |
|
268 | - $heading[] = $section[ $current_section ]; |
|
267 | + if (array_key_exists($current_section, $section)) { |
|
268 | + $heading[] = $section[$current_section]; |
|
269 | 269 | } |
270 | 270 | |
271 | - return array_unique( $heading ); |
|
271 | + return array_unique($heading); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | public function get_heading_html() { |
283 | 283 | return sprintf( |
284 | 284 | '<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">', |
285 | - implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() ) |
|
285 | + implode(' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading()) |
|
286 | 286 | ); |
287 | 287 | } |
288 | 288 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return string |
27 | 27 | */ |
28 | -function __give_get_format_address( $address, $address_args = array() ) { |
|
28 | +function __give_get_format_address($address, $address_args = array()) { |
|
29 | 29 | $address_html = ''; |
30 | 30 | $address_args = wp_parse_args( |
31 | 31 | $address_args, |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $address_id = $address_args['type']; |
41 | 41 | |
42 | 42 | // Bailout. |
43 | - if ( empty( $address ) || ! is_array( $address ) ) { |
|
43 | + if (empty($address) || ! is_array($address)) { |
|
44 | 44 | return $address_html; |
45 | 45 | } |
46 | 46 | |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | $address_html .= sprintf( |
50 | 50 | '<span data-address-type="line1">%1$s</span>%2$s', |
51 | 51 | $address['line1'], |
52 | - ( ! empty( $address['line2'] ) ? '<br>' : '' ) |
|
52 | + ( ! empty($address['line2']) ? '<br>' : '') |
|
53 | 53 | ); |
54 | 54 | $address_html .= sprintf( |
55 | 55 | '<span data-address-type="line2">%1$s</span>%2$s', |
56 | 56 | $address['line2'], |
57 | - ( ! empty( $address['city'] ) ? '<br>' : '' ) |
|
57 | + ( ! empty($address['city']) ? '<br>' : '') |
|
58 | 58 | ); |
59 | 59 | $address_html .= sprintf( |
60 | 60 | '<span data-address-type="city">%1$s</span><span data-address-type="state">%2$s</span><span data-address-type="zip">%3$s</span>%4$s', |
61 | 61 | $address['city'], |
62 | - ( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ), |
|
63 | - ( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ), |
|
64 | - ( ! empty( $address['country'] ) ? '<br>' : '' ) |
|
62 | + ( ! empty($address['state']) ? ", {$address['state']}" : ''), |
|
63 | + ( ! empty($address['zip']) ? " {$address['zip']}" : ''), |
|
64 | + ( ! empty($address['country']) ? '<br>' : '') |
|
65 | 65 | ); |
66 | 66 | $address_html .= sprintf( |
67 | 67 | '<span data-address-type="country">%s</span><br>', |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | // Address action. |
72 | 72 | $address_html .= sprintf( |
73 | 73 | '<br><a href="#" class="js-edit">%1$s</a> | <a href="#" class="js-remove">%2$s</a>', |
74 | - __( 'Edit', 'give' ), |
|
75 | - __( 'Remove', 'give' ) |
|
74 | + __('Edit', 'give'), |
|
75 | + __('Remove', 'give') |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | /** |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 2.0 |
82 | 82 | */ |
83 | - $address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args ); |
|
83 | + $address_label = apply_filters("give_donor_{$address_args['type']}_address_label", ucfirst($address_args['type']), $address_args); |
|
84 | 84 | |
85 | 85 | // Set unique id and index for multi type address. |
86 | - if ( isset( $address_args['index'] ) ) { |
|
86 | + if (isset($address_args['index'])) { |
|
87 | 87 | $address_label = "{$address_label} #{$address_args['index']}"; |
88 | 88 | } |
89 | 89 | |
90 | - if ( isset( $address_args['id'] ) ) { |
|
90 | + if (isset($address_args['id'])) { |
|
91 | 91 | $address_id = "{$address_id}_{$address_args['id']}"; |
92 | 92 | } |
93 | 93 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | */ |
113 | 113 | function give_donors_page() { |
114 | 114 | $default_views = give_donor_views(); |
115 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
|
116 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
117 | - give_render_donor_view( $requested_view, $default_views ); |
|
115 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors'; |
|
116 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
117 | + give_render_donor_view($requested_view, $default_views); |
|
118 | 118 | } else { |
119 | 119 | give_donors_list(); |
120 | 120 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | $views = array(); |
132 | 132 | |
133 | - return apply_filters( 'give_donor_views', $views ); |
|
133 | + return apply_filters('give_donor_views', $views); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $tabs = array(); |
146 | 146 | |
147 | - return apply_filters( 'give_donor_tabs', $tabs ); |
|
147 | + return apply_filters('give_donor_tabs', $tabs); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function give_donors_list() { |
158 | 158 | |
159 | - include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php'; |
|
159 | + include GIVE_PLUGIN_DIR.'includes/admin/donors/class-donor-table.php'; |
|
160 | 160 | |
161 | 161 | $donors_table = new Give_Donor_List_Table(); |
162 | 162 | $donors_table->prepare_items(); |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @since 1.0 |
171 | 171 | */ |
172 | - do_action( 'give_donors_table_top' ); |
|
172 | + do_action('give_donors_table_top'); |
|
173 | 173 | ?> |
174 | 174 | |
175 | 175 | <hr class="wp-header-end"> |
176 | - <form id="give-donors-search-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
177 | - <?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?> |
|
176 | + <form id="give-donors-search-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
177 | + <?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?> |
|
178 | 178 | <input type="hidden" name="post_type" value="give_forms" /> |
179 | 179 | <input type="hidden" name="page" value="give-donors" /> |
180 | 180 | <input type="hidden" name="view" value="donors" /> |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @since 1.0 |
193 | 193 | */ |
194 | - do_action( 'give_donors_table_bottom' ); |
|
194 | + do_action('give_donors_table_bottom'); |
|
195 | 195 | ?> |
196 | 196 | </div> |
197 | 197 | <?php |
@@ -207,33 +207,33 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return void |
209 | 209 | */ |
210 | -function give_render_donor_view( $view, $callbacks ) { |
|
210 | +function give_render_donor_view($view, $callbacks) { |
|
211 | 211 | |
212 | 212 | $render = true; |
213 | 213 | |
214 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
214 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
215 | 215 | |
216 | - if ( ! current_user_can( $donor_view_role ) ) { |
|
217 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
216 | + if ( ! current_user_can($donor_view_role)) { |
|
217 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
218 | 218 | $render = false; |
219 | 219 | } |
220 | 220 | |
221 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
222 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
221 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
222 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
223 | 223 | $render = false; |
224 | 224 | } |
225 | 225 | |
226 | 226 | $donor_id = (int) $_GET['id']; |
227 | - $reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : ''; |
|
228 | - $donor = new Give_Donor( $donor_id ); |
|
227 | + $reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : ''; |
|
228 | + $donor = new Give_Donor($donor_id); |
|
229 | 229 | |
230 | 230 | // Reconnect User with Donor profile. |
231 | - if ( $reconnect_user_id ) { |
|
232 | - give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() ); |
|
231 | + if ($reconnect_user_id) { |
|
232 | + give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array()); |
|
233 | 233 | } |
234 | 234 | |
235 | - if ( empty( $donor->id ) ) { |
|
236 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
235 | + if (empty($donor->id)) { |
|
236 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
237 | 237 | $render = false; |
238 | 238 | } |
239 | 239 | |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | |
243 | 243 | <div class='wrap'> |
244 | 244 | |
245 | - <?php if ( give_get_errors() ) : ?> |
|
245 | + <?php if (give_get_errors()) : ?> |
|
246 | 246 | <div class="error settings-error"> |
247 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
247 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
248 | 248 | </div> |
249 | 249 | <?php endif; ?> |
250 | 250 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | <?php |
253 | 253 | printf( |
254 | 254 | /* translators: %s: donor number */ |
255 | - esc_html__( 'Donor %s', 'give' ), |
|
255 | + esc_html__('Donor %s', 'give'), |
|
256 | 256 | $donor_id |
257 | 257 | ); |
258 | 258 | ?> |
@@ -260,26 +260,26 @@ discard block |
||
260 | 260 | |
261 | 261 | <hr class="wp-header-end"> |
262 | 262 | |
263 | - <?php if ( $donor && $render ) : ?> |
|
263 | + <?php if ($donor && $render) : ?> |
|
264 | 264 | |
265 | 265 | <h2 class="nav-tab-wrapper"> |
266 | 266 | <?php |
267 | - foreach ( $donor_tabs as $key => $tab ) : |
|
267 | + foreach ($donor_tabs as $key => $tab) : |
|
268 | 268 | $active = $key === $view ? true : false; |
269 | 269 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
270 | 270 | printf( |
271 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
272 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
273 | - esc_attr( $class ), |
|
274 | - sanitize_html_class( $tab['dashicon'] ), |
|
275 | - esc_html( $tab['title'] ) |
|
271 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
272 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
273 | + esc_attr($class), |
|
274 | + sanitize_html_class($tab['dashicon']), |
|
275 | + esc_html($tab['title']) |
|
276 | 276 | ); |
277 | 277 | endforeach; |
278 | 278 | ?> |
279 | 279 | </h2> |
280 | 280 | |
281 | 281 | <div id="give-donor-card-wrapper"> |
282 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
282 | + <?php $callbacks[$view]($donor) ?> |
|
283 | 283 | </div> |
284 | 284 | |
285 | 285 | <?php endif; ?> |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @return void |
301 | 301 | */ |
302 | -function give_donor_view( $donor ) { |
|
302 | +function give_donor_view($donor) { |
|
303 | 303 | |
304 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
304 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * Fires in donor profile screen, above the donor card. |
@@ -310,11 +310,11 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @param object $donor The donor object being displayed. |
312 | 312 | */ |
313 | - do_action( 'give_donor_card_top', $donor ); |
|
313 | + do_action('give_donor_card_top', $donor); |
|
314 | 314 | |
315 | 315 | // Set Read only to the fields which needs to be locked. |
316 | 316 | $read_only = ''; |
317 | - if ( $donor->user_id ) { |
|
317 | + if ($donor->user_id) { |
|
318 | 318 | $read_only = 'readonly="readonly"'; |
319 | 319 | } |
320 | 320 | ?> |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
323 | 323 | |
324 | 324 | <form id="edit-donor-info" method="post" |
325 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
325 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
326 | 326 | |
327 | 327 | <div class="donor-info"> |
328 | 328 | |
329 | 329 | <div class="donor-bio-header clearfix"> |
330 | 330 | |
331 | 331 | <div class="avatar-wrap left" id="donor-avatar"> |
332 | - <?php echo get_avatar( $donor->email ); ?> |
|
332 | + <?php echo get_avatar($donor->email); ?> |
|
333 | 333 | </div> |
334 | 334 | |
335 | 335 | <div id="donor-name-wrap" class="left"> |
@@ -337,18 +337,18 @@ discard block |
||
337 | 337 | <span class="donor-name info-item edit-item"> |
338 | 338 | <input <?php echo $read_only; ?> size="15" data-key="first_name" |
339 | 339 | name="customerinfo[first_name]" type="text" |
340 | - value="<?php esc_attr_e( $donor->get_first_name() ); ?>" |
|
341 | - placeholder="<?php _e( 'First Name', 'give' ); ?>"/> |
|
342 | - <?php if ( $donor->user_id ) : ?> |
|
340 | + value="<?php esc_attr_e($donor->get_first_name()); ?>" |
|
341 | + placeholder="<?php _e('First Name', 'give'); ?>"/> |
|
342 | + <?php if ($donor->user_id) : ?> |
|
343 | 343 | <a href="#" class="give-lock-block"> |
344 | 344 | <i class="give-icon give-icon-locked"></i> |
345 | 345 | </a> |
346 | 346 | <?php endif; ?> |
347 | 347 | <input <?php echo $read_only; ?> size="15" data-key="last_name" |
348 | 348 | name="customerinfo[last_name]" type="text" |
349 | - value="<?php esc_attr_e( $donor->get_last_name() ); ?>" |
|
350 | - placeholder="<?php _e( 'Last Name', 'give' ); ?>"/> |
|
351 | - <?php if ( $donor->user_id ) : ?> |
|
349 | + value="<?php esc_attr_e($donor->get_last_name()); ?>" |
|
350 | + placeholder="<?php _e('Last Name', 'give'); ?>"/> |
|
351 | + <?php if ($donor->user_id) : ?> |
|
352 | 352 | <a href="#" class="give-lock-block"> |
353 | 353 | <i class="give-icon give-icon-locked"></i> |
354 | 354 | </a> |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | data-key="name"><?php echo $donor->name; ?></span></span> |
359 | 359 | </div> |
360 | 360 | <p class="donor-since info-item"> |
361 | - <?php _e( 'Donor since', 'give' ); ?> |
|
362 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
361 | + <?php _e('Donor since', 'give'); ?> |
|
362 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
363 | 363 | </p> |
364 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
364 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
365 | 365 | <a href="#" id="edit-donor" |
366 | - class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
366 | + class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
367 | 367 | <?php endif; ?> |
368 | 368 | </div> |
369 | 369 | <!-- /donor-bio-header --> |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | <table class="widefat"> |
374 | 374 | <tbody> |
375 | 375 | <tr class="alternate"> |
376 | - <th scope="col"><label for="tablecell"><?php _e( 'User:', 'give' ); ?></label></th> |
|
376 | + <th scope="col"><label for="tablecell"><?php _e('User:', 'give'); ?></label></th> |
|
377 | 377 | <td> |
378 | 378 | <span class="donor-user-id info-item edit-item"> |
379 | 379 | <?php |
@@ -390,22 +390,22 @@ discard block |
||
390 | 390 | 'data' => $data_atts, |
391 | 391 | ); |
392 | 392 | |
393 | - if ( ! empty( $user_id ) ) { |
|
394 | - $userdata = get_userdata( $user_id ); |
|
393 | + if ( ! empty($user_id)) { |
|
394 | + $userdata = get_userdata($user_id); |
|
395 | 395 | $user_args['selected'] = $user_id; |
396 | 396 | } |
397 | 397 | |
398 | - echo Give()->html->ajax_user_search( $user_args ); |
|
398 | + echo Give()->html->ajax_user_search($user_args); |
|
399 | 399 | ?> |
400 | 400 | </span> |
401 | 401 | |
402 | 402 | <span class="donor-user-id info-item editable"> |
403 | - <?php if ( ! empty( $userdata ) ) : ?> |
|
404 | - <span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
403 | + <?php if ( ! empty($userdata)) : ?> |
|
404 | + <span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
405 | 405 | <?php else: ?> |
406 | - <span data-key="user_id"><?php _e( 'None', 'give' ); ?></span> |
|
406 | + <span data-key="user_id"><?php _e('None', 'give'); ?></span> |
|
407 | 407 | <?php endif; ?> |
408 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ): |
|
408 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0): |
|
409 | 409 | |
410 | 410 | echo sprintf( |
411 | 411 | '- <span class="disconnect-user"> |
@@ -414,11 +414,11 @@ discard block |
||
414 | 414 | | <span class="view-user-profile"> |
415 | 415 | <a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a> |
416 | 416 | </span>', |
417 | - __( 'Disconnects the current user ID from this donor record.', 'give' ), |
|
418 | - __( 'Disconnect User', 'give' ), |
|
419 | - 'user-edit.php?user_id=' . $donor->user_id, |
|
420 | - __( 'View User Profile of current user ID.', 'give' ), |
|
421 | - __( 'View User Profile', 'give' ) |
|
417 | + __('Disconnects the current user ID from this donor record.', 'give'), |
|
418 | + __('Disconnect User', 'give'), |
|
419 | + 'user-edit.php?user_id='.$donor->user_id, |
|
420 | + __('View User Profile of current user ID.', 'give'), |
|
421 | + __('View User Profile', 'give') |
|
422 | 422 | ); |
423 | 423 | |
424 | 424 | endif; ?> |
@@ -434,11 +434,11 @@ discard block |
||
434 | 434 | |
435 | 435 | <span id="donor-edit-actions" class="edit-item"> |
436 | 436 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>"/> |
437 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
437 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
438 | 438 | <input type="hidden" name="give_action" value="edit-donor"/> |
439 | 439 | <input type="submit" id="give-edit-donor-save" class="button-secondary" |
440 | - value="<?php _e( 'Update Donor', 'give' ); ?>"/> |
|
441 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
440 | + value="<?php _e('Update Donor', 'give'); ?>"/> |
|
441 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
442 | 442 | </span> |
443 | 443 | |
444 | 444 | </form> |
@@ -453,24 +453,24 @@ discard block |
||
453 | 453 | * |
454 | 454 | * @param Give_Donor $donor The donor object being displayed. |
455 | 455 | */ |
456 | - do_action( 'give_donor_before_stats', $donor ); |
|
456 | + do_action('give_donor_before_stats', $donor); |
|
457 | 457 | ?> |
458 | 458 | |
459 | 459 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
460 | 460 | <ul> |
461 | 461 | <li> |
462 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>"> |
|
462 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>"> |
|
463 | 463 | <span class="dashicons dashicons-heart"></span> |
464 | 464 | <?php |
465 | 465 | // Completed Donations. |
466 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
467 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
466 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
467 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
468 | 468 | ?> |
469 | 469 | </a> |
470 | 470 | </li> |
471 | 471 | <li> |
472 | 472 | <span class="dashicons dashicons-chart-area"></span> |
473 | - <?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
473 | + <?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
474 | 474 | </li> |
475 | 475 | <?php |
476 | 476 | /** |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * |
483 | 483 | * @param object $donor The donor object being displayed. |
484 | 484 | */ |
485 | - do_action( 'give_donor_stats_list', $donor ); |
|
485 | + do_action('give_donor_stats_list', $donor); |
|
486 | 486 | ?> |
487 | 487 | </ul> |
488 | 488 | </div> |
@@ -495,11 +495,11 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @param Give_Donor $donor The donor object being displayed. |
497 | 497 | */ |
498 | - do_action( 'give_donor_before_address', $donor ); |
|
498 | + do_action('give_donor_before_address', $donor); |
|
499 | 499 | ?> |
500 | 500 | |
501 | 501 | <div id="donor-address-wrapper" class="donor-section clear"> |
502 | - <h3><?php _e( 'Addresses', 'give' ); ?></h3> |
|
502 | + <h3><?php _e('Addresses', 'give'); ?></h3> |
|
503 | 503 | |
504 | 504 | <div class="postbox"> |
505 | 505 | <div class="give-spinner-wrapper"> |
@@ -509,16 +509,16 @@ discard block |
||
509 | 509 | <div class="all-address"> |
510 | 510 | <div class="give-grid-row"> |
511 | 511 | <?php |
512 | - if ( ! empty( $donor->address ) ) : |
|
512 | + if ( ! empty($donor->address)) : |
|
513 | 513 | // Default address always will be at zero array index. |
514 | 514 | $is_set_as_default = null; |
515 | 515 | |
516 | - foreach ( $donor->address as $address_type => $addresses ) { |
|
516 | + foreach ($donor->address as $address_type => $addresses) { |
|
517 | 517 | |
518 | - switch ( true ) { |
|
519 | - case is_array( end( $addresses ) ): |
|
518 | + switch (true) { |
|
519 | + case is_array(end($addresses)): |
|
520 | 520 | $index = 1; |
521 | - foreach ( $addresses as $id => $address ) { |
|
521 | + foreach ($addresses as $id => $address) { |
|
522 | 522 | echo __give_get_format_address( |
523 | 523 | $address, |
524 | 524 | array( |
@@ -528,11 +528,11 @@ discard block |
||
528 | 528 | ) |
529 | 529 | ); |
530 | 530 | |
531 | - $index ++; |
|
531 | + $index++; |
|
532 | 532 | } |
533 | 533 | break; |
534 | 534 | |
535 | - case is_string( end( $addresses ) ): |
|
535 | + case is_string(end($addresses)): |
|
536 | 536 | echo __give_get_format_address( |
537 | 537 | $addresses, |
538 | 538 | array( |
@@ -545,13 +545,13 @@ discard block |
||
545 | 545 | endif; |
546 | 546 | ?> |
547 | 547 | </div> |
548 | - <span class="give-no-address-message<?php if ( ! empty( $donor->address ) ) { |
|
548 | + <span class="give-no-address-message<?php if ( ! empty($donor->address)) { |
|
549 | 549 | echo ' give-hidden'; |
550 | 550 | } ?>"> |
551 | - <?php _e( 'This donor does not have any addresses saved.', 'give' ); ?> |
|
551 | + <?php _e('This donor does not have any addresses saved.', 'give'); ?> |
|
552 | 552 | </span> |
553 | 553 | <button class="button add-new-address"> |
554 | - <?php _e( 'Add Address', 'give' ); ?> |
|
554 | + <?php _e('Add Address', 'give'); ?> |
|
555 | 555 | </button> |
556 | 556 | </div> |
557 | 557 | |
@@ -561,26 +561,26 @@ discard block |
||
561 | 561 | <tbody> |
562 | 562 | <tr> |
563 | 563 | <th class="col"> |
564 | - <label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
564 | + <label class="country"><?php esc_html_e('Country:', 'give'); ?></label> |
|
565 | 565 | </th> |
566 | 566 | <td> |
567 | 567 | <?php |
568 | - echo Give()->html->select( array( |
|
568 | + echo Give()->html->select(array( |
|
569 | 569 | 'options' => give_get_country_list(), |
570 | 570 | 'name' => 'country', |
571 | - 'selected' => give_get_option( 'base_country' ), |
|
571 | + 'selected' => give_get_option('base_country'), |
|
572 | 572 | 'show_option_all' => false, |
573 | 573 | 'show_option_none' => false, |
574 | 574 | 'chosen' => true, |
575 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
576 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
577 | - ) ); |
|
575 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
576 | + 'data' => array('search-type' => 'no_ajax'), |
|
577 | + )); |
|
578 | 578 | ?> |
579 | 579 | </td> |
580 | 580 | </tr> |
581 | 581 | <tr> |
582 | 582 | <th class="col"> |
583 | - <label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
583 | + <label for="line1"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
584 | 584 | </th> |
585 | 585 | <td> |
586 | 586 | <input id="line1" name="line1" type="text" class="medium-text"/> |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | </tr> |
589 | 589 | <tr> |
590 | 590 | <th class="col"> |
591 | - <label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
591 | + <label for="line2"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
592 | 592 | </th> |
593 | 593 | <td> |
594 | 594 | <input id="line2" type="text" name="line2" value="" class="medium-text"/> |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | </tr> |
598 | 598 | <tr> |
599 | 599 | <th class="col"> |
600 | - <label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
600 | + <label for="city"><?php esc_html_e('City:', 'give'); ?></label> |
|
601 | 601 | </th> |
602 | 602 | <td> |
603 | 603 | <input id="city" type="text" name="city" value="" class="medium-text"/> |
@@ -605,41 +605,41 @@ discard block |
||
605 | 605 | </tr> |
606 | 606 | <?php |
607 | 607 | $no_states_country = give_no_states_country_list(); |
608 | - $base_country = give_get_option( 'base_country' ); |
|
609 | - if ( ! array_key_exists( $base_country, $no_states_country ) ) { |
|
608 | + $base_country = give_get_option('base_country'); |
|
609 | + if ( ! array_key_exists($base_country, $no_states_country)) { |
|
610 | 610 | ?> |
611 | 611 | <tr class="give-field-wrap"> |
612 | 612 | <th class="col"> |
613 | - <label for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
613 | + <label for="state"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
614 | 614 | </th> |
615 | 615 | <td> |
616 | 616 | <?php |
617 | - $states = give_get_states( $base_country ); |
|
617 | + $states = give_get_states($base_country); |
|
618 | 618 | $state_args = array( |
619 | 619 | 'name' => 'state', |
620 | 620 | 'class' => 'regular-text', |
621 | 621 | ); |
622 | 622 | |
623 | - if ( empty( $states ) ) { |
|
623 | + if (empty($states)) { |
|
624 | 624 | |
625 | 625 | // Show Text field, if empty states. |
626 | - $state_args = wp_parse_args( $state_args, array( |
|
627 | - 'value' => give_get_option( 'base_state' ), |
|
628 | - ) ); |
|
629 | - echo Give()->html->text( $state_args ); |
|
626 | + $state_args = wp_parse_args($state_args, array( |
|
627 | + 'value' => give_get_option('base_state'), |
|
628 | + )); |
|
629 | + echo Give()->html->text($state_args); |
|
630 | 630 | } else { |
631 | 631 | |
632 | 632 | // Show Chosen DropDown, if states are not empty. |
633 | - $state_args = wp_parse_args( $state_args, array( |
|
633 | + $state_args = wp_parse_args($state_args, array( |
|
634 | 634 | 'options' => $states, |
635 | - 'selected' => give_get_option( 'base_state' ), |
|
635 | + 'selected' => give_get_option('base_state'), |
|
636 | 636 | 'show_option_all' => false, |
637 | 637 | 'show_option_none' => false, |
638 | 638 | 'chosen' => true, |
639 | - 'placeholder' => __( 'Select a state', 'give' ), |
|
640 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
641 | - ) ); |
|
642 | - echo Give()->html->select( $state_args ); |
|
639 | + 'placeholder' => __('Select a state', 'give'), |
|
640 | + 'data' => array('search-type' => 'no_ajax'), |
|
641 | + )); |
|
642 | + echo Give()->html->select($state_args); |
|
643 | 643 | } |
644 | 644 | ?> |
645 | 645 | </td> |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | ?> |
650 | 650 | <tr> |
651 | 651 | <th class="col"> |
652 | - <label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
652 | + <label for="zip"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
653 | 653 | </th> |
654 | 654 | <td> |
655 | 655 | <input id="zip" type="text" name="zip" value="" class="medium-text"/> |
@@ -657,12 +657,12 @@ discard block |
||
657 | 657 | </tr> |
658 | 658 | <tr> |
659 | 659 | <td colspan="2"> |
660 | - <?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?> |
|
660 | + <?php wp_nonce_field('give-manage-donor-addresses', '_wpnonce', false); ?> |
|
661 | 661 | <input type="hidden" name="address-action" value="add"> |
662 | 662 | <input type="hidden" name="address-id" value=""> |
663 | 663 | <input type="submit" class="button button-primary js-save" |
664 | - value="<?php _e( 'Save', 'give' ); ?>"> <button |
|
665 | - class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button> |
|
664 | + value="<?php _e('Save', 'give'); ?>"> <button |
|
665 | + class="button js-cancel"><?php _e('Cancel', 'give'); ?></button> |
|
666 | 666 | </td> |
667 | 667 | </tr> |
668 | 668 | </tbody> |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * |
682 | 682 | * @param Give_Donor $donor The donor object being displayed. |
683 | 683 | */ |
684 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
684 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
685 | 685 | ?> |
686 | 686 | |
687 | 687 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -694,46 +694,46 @@ discard block |
||
694 | 694 | * |
695 | 695 | * @param object $donor The donor object being displayed. |
696 | 696 | */ |
697 | - do_action( 'give_donor_before_tables', $donor ); |
|
697 | + do_action('give_donor_before_tables', $donor); |
|
698 | 698 | ?> |
699 | 699 | |
700 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
700 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
701 | 701 | |
702 | 702 | <table class="wp-list-table widefat striped emails"> |
703 | 703 | <thead> |
704 | 704 | <tr> |
705 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
706 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
705 | + <th><?php _e('Email', 'give'); ?></th> |
|
706 | + <th><?php _e('Actions', 'give'); ?></th> |
|
707 | 707 | </tr> |
708 | 708 | </thead> |
709 | 709 | |
710 | 710 | <tbody> |
711 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
711 | + <?php if ( ! empty($donor->emails)) { ?> |
|
712 | 712 | |
713 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
713 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
714 | 714 | <tr data-key="<?php echo $key; ?>"> |
715 | 715 | <td> |
716 | 716 | <?php echo $email; ?> |
717 | - <?php if ( 'primary' === $key ) : ?> |
|
717 | + <?php if ('primary' === $key) : ?> |
|
718 | 718 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
719 | 719 | <?php endif; ?> |
720 | 720 | </td> |
721 | 721 | <td> |
722 | - <?php if ( 'primary' !== $key ) : ?> |
|
722 | + <?php if ('primary' !== $key) : ?> |
|
723 | 723 | <?php |
724 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
725 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
726 | - 'email' => rawurlencode( $email ), |
|
724 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
725 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
726 | + 'email' => rawurlencode($email), |
|
727 | 727 | 'give_action' => 'set_donor_primary_email', |
728 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
729 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
730 | - 'email' => rawurlencode( $email ), |
|
728 | + ), $base_url), 'give-set-donor-primary-email'); |
|
729 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
730 | + 'email' => rawurlencode($email), |
|
731 | 731 | 'give_action' => 'remove_donor_email', |
732 | - ), $base_url ), 'give-remove-donor-email' ); |
|
732 | + ), $base_url), 'give-remove-donor-email'); |
|
733 | 733 | ?> |
734 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
734 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
735 | 735 | | |
736 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
736 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
737 | 737 | <?php endif; ?> |
738 | 738 | </td> |
739 | 739 | </tr> |
@@ -743,14 +743,14 @@ discard block |
||
743 | 743 | <td colspan="2" class="add-donor-email-td"> |
744 | 744 | <div class="add-donor-email-wrapper"> |
745 | 745 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/> |
746 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
746 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
747 | 747 | <input type="email" name="additional-email" value="" |
748 | - placeholder="<?php _e( 'Email Address', 'give' ); ?>"/> |
|
748 | + placeholder="<?php _e('Email Address', 'give'); ?>"/> |
|
749 | 749 | <input type="checkbox" name="make-additional-primary" value="1" |
750 | 750 | id="make-additional-primary"/> <label |
751 | - for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
751 | + for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
752 | 752 | <button class="button-secondary give-add-donor-email" |
753 | - id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
753 | + id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
754 | 754 | <span class="spinner"></span> |
755 | 755 | </div> |
756 | 756 | <div class="notice-wrap"></div> |
@@ -758,50 +758,50 @@ discard block |
||
758 | 758 | </tr> |
759 | 759 | <?php } else { ?> |
760 | 760 | <tr> |
761 | - <td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td> |
|
761 | + <td colspan="2"><?php _e('No Emails Found', 'give'); ?></td> |
|
762 | 762 | </tr> |
763 | 763 | <?php }// End if(). |
764 | 764 | ?> |
765 | 765 | </tbody> |
766 | 766 | </table> |
767 | 767 | |
768 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
768 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
769 | 769 | <?php |
770 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
771 | - $payments = give_get_payments( array( |
|
770 | + $payment_ids = explode(',', $donor->payment_ids); |
|
771 | + $payments = give_get_payments(array( |
|
772 | 772 | 'post__in' => $payment_ids, |
773 | - ) ); |
|
774 | - $payments = array_slice( $payments, 0, 10 ); |
|
773 | + )); |
|
774 | + $payments = array_slice($payments, 0, 10); |
|
775 | 775 | ?> |
776 | 776 | <table class="wp-list-table widefat striped payments"> |
777 | 777 | <thead> |
778 | 778 | <tr> |
779 | - <th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
|
780 | - <th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
|
781 | - <th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
|
782 | - <th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
|
783 | - <th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
|
779 | + <th scope="col"><?php _e('ID', 'give'); ?></th> |
|
780 | + <th scope="col"><?php _e('Amount', 'give'); ?></th> |
|
781 | + <th scope="col"><?php _e('Date', 'give'); ?></th> |
|
782 | + <th scope="col"><?php _e('Status', 'give'); ?></th> |
|
783 | + <th scope="col"><?php _e('Actions', 'give'); ?></th> |
|
784 | 784 | </tr> |
785 | 785 | </thead> |
786 | 786 | <tbody> |
787 | - <?php if ( ! empty( $payments ) ) { ?> |
|
788 | - <?php foreach ( $payments as $payment ) : ?> |
|
787 | + <?php if ( ! empty($payments)) { ?> |
|
788 | + <?php foreach ($payments as $payment) : ?> |
|
789 | 789 | <tr> |
790 | 790 | <td><?php echo $payment->ID; ?></td> |
791 | - <td><?php echo give_donation_amount( $payment->ID, array( 'currency' => true, 'amount' => true, 'type' => 'donor' ) ); ?></td> |
|
792 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
793 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
791 | + <td><?php echo give_donation_amount($payment->ID, array('currency' => true, 'amount' => true, 'type' => 'donor')); ?></td> |
|
792 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
793 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
794 | 794 | <td> |
795 | 795 | <?php |
796 | 796 | printf( |
797 | 797 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
798 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
798 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
799 | 799 | sprintf( |
800 | 800 | /* translators: %s: Donation ID */ |
801 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
801 | + esc_attr__('View Donation %s.', 'give'), |
|
802 | 802 | $payment->ID |
803 | 803 | ), |
804 | - __( 'View Donation', 'give' ) |
|
804 | + __('View Donation', 'give') |
|
805 | 805 | ); |
806 | 806 | ?> |
807 | 807 | |
@@ -816,47 +816,47 @@ discard block |
||
816 | 816 | * @param object $donor The donor object being displayed. |
817 | 817 | * @param object $payment The payment object being displayed. |
818 | 818 | */ |
819 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
819 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
820 | 820 | ?> |
821 | 821 | </td> |
822 | 822 | </tr> |
823 | 823 | <?php endforeach; ?> |
824 | 824 | <?php } else { ?> |
825 | 825 | <tr> |
826 | - <td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
|
826 | + <td colspan="5"><?php _e('No donations found.', 'give'); ?></td> |
|
827 | 827 | </tr> |
828 | 828 | <?php }// End if(). |
829 | 829 | ?> |
830 | 830 | </tbody> |
831 | 831 | </table> |
832 | 832 | |
833 | - <h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
|
833 | + <h3><?php _e('Completed Forms', 'give'); ?></h3> |
|
834 | 834 | <?php |
835 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
835 | + $donations = give_get_users_completed_donations($donor->email); |
|
836 | 836 | ?> |
837 | 837 | <table class="wp-list-table widefat striped donations"> |
838 | 838 | <thead> |
839 | 839 | <tr> |
840 | - <th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
|
841 | - <th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
840 | + <th scope="col"><?php _e('Form', 'give'); ?></th> |
|
841 | + <th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th> |
|
842 | 842 | </tr> |
843 | 843 | </thead> |
844 | 844 | <tbody> |
845 | - <?php if ( ! empty( $donations ) ) { ?> |
|
846 | - <?php foreach ( $donations as $donation ) : ?> |
|
845 | + <?php if ( ! empty($donations)) { ?> |
|
846 | + <?php foreach ($donations as $donation) : ?> |
|
847 | 847 | <tr> |
848 | 848 | <td><?php echo $donation->post_title; ?></td> |
849 | 849 | <td> |
850 | 850 | <?php |
851 | 851 | printf( |
852 | 852 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
853 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
853 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
854 | 854 | sprintf( |
855 | 855 | /* translators: %s: form name */ |
856 | - esc_attr__( 'View Form %s.', 'give' ), |
|
856 | + esc_attr__('View Form %s.', 'give'), |
|
857 | 857 | $donation->post_title |
858 | 858 | ), |
859 | - __( 'View Form', 'give' ) |
|
859 | + __('View Form', 'give') |
|
860 | 860 | ); |
861 | 861 | ?> |
862 | 862 | </td> |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | <?php endforeach; ?> |
865 | 865 | <?php } else { ?> |
866 | 866 | <tr> |
867 | - <td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
|
867 | + <td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td> |
|
868 | 868 | </tr> |
869 | 869 | <?php } ?> |
870 | 870 | </tbody> |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | * |
879 | 879 | * @param object $donor The donor object being displayed. |
880 | 880 | */ |
881 | - do_action( 'give_donor_after_tables', $donor ); |
|
881 | + do_action('give_donor_after_tables', $donor); |
|
882 | 882 | ?> |
883 | 883 | |
884 | 884 | </div> |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | * |
892 | 892 | * @param object $donor The donor object being displayed. |
893 | 893 | */ |
894 | - do_action( 'give_donor_card_bottom', $donor ); |
|
894 | + do_action('give_donor_card_bottom', $donor); |
|
895 | 895 | |
896 | 896 | } |
897 | 897 | |
@@ -904,31 +904,31 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @return void |
906 | 906 | */ |
907 | -function give_donor_notes_view( $donor ) { |
|
907 | +function give_donor_notes_view($donor) { |
|
908 | 908 | |
909 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
910 | - $paged = absint( $paged ); |
|
909 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
910 | + $paged = absint($paged); |
|
911 | 911 | $note_count = $donor->get_notes_count(); |
912 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
913 | - $total_pages = ceil( $note_count / $per_page ); |
|
914 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
912 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
913 | + $total_pages = ceil($note_count / $per_page); |
|
914 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
915 | 915 | ?> |
916 | 916 | |
917 | 917 | <div id="donor-notes-wrapper"> |
918 | 918 | <div class="donor-notes-header"> |
919 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
919 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
920 | 920 | </div> |
921 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
921 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
922 | 922 | |
923 | - <?php if ( 1 == $paged ) : ?> |
|
923 | + <?php if (1 == $paged) : ?> |
|
924 | 924 | <div style="display: block; margin-bottom: 55px;"> |
925 | 925 | <form id="give-add-donor-note" method="post" |
926 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
926 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
927 | 927 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
928 | 928 | <br/> |
929 | 929 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/> |
930 | 930 | <input type="hidden" name="give_action" value="add-donor-note"/> |
931 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
931 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
932 | 932 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/> |
933 | 933 | </form> |
934 | 934 | </div> |
@@ -943,26 +943,26 @@ discard block |
||
943 | 943 | 'show_all' => true, |
944 | 944 | ); |
945 | 945 | |
946 | - echo paginate_links( $pagination_args ); |
|
946 | + echo paginate_links($pagination_args); |
|
947 | 947 | ?> |
948 | 948 | |
949 | 949 | <div id="give-donor-notes" class="postbox"> |
950 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
951 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
950 | + <?php if (count($donor_notes) > 0) { ?> |
|
951 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
952 | 952 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
953 | 953 | <span class="note-content-wrap"> |
954 | - <?php echo stripslashes( $note ); ?> |
|
954 | + <?php echo stripslashes($note); ?> |
|
955 | 955 | </span> |
956 | 956 | </div> |
957 | 957 | <?php endforeach; ?> |
958 | 958 | <?php } else { ?> |
959 | 959 | <div class="give-no-donor-notes"> |
960 | - <?php _e( 'No donor notes found.', 'give' ); ?> |
|
960 | + <?php _e('No donor notes found.', 'give'); ?> |
|
961 | 961 | </div> |
962 | 962 | <?php } ?> |
963 | 963 | </div> |
964 | 964 | |
965 | - <?php echo paginate_links( $pagination_args ); ?> |
|
965 | + <?php echo paginate_links($pagination_args); ?> |
|
966 | 966 | |
967 | 967 | </div> |
968 | 968 | |
@@ -978,9 +978,9 @@ discard block |
||
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
981 | -function give_donor_delete_view( $donor ) { |
|
981 | +function give_donor_delete_view($donor) { |
|
982 | 982 | |
983 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
983 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
984 | 984 | |
985 | 985 | /** |
986 | 986 | * Fires in donor delete screen, above the content. |
@@ -989,16 +989,16 @@ discard block |
||
989 | 989 | * |
990 | 990 | * @param object $donor The donor object being displayed. |
991 | 991 | */ |
992 | - do_action( 'give_donor_delete_top', $donor ); |
|
992 | + do_action('give_donor_delete_top', $donor); |
|
993 | 993 | ?> |
994 | 994 | |
995 | 995 | <div class="info-wrapper donor-section"> |
996 | 996 | |
997 | 997 | <form id="delete-donor" method="post" |
998 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
998 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
999 | 999 | |
1000 | 1000 | <div class="donor-notes-header"> |
1001 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
1001 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
1002 | 1002 | </div> |
1003 | 1003 | |
1004 | 1004 | |
@@ -1006,20 +1006,20 @@ discard block |
||
1006 | 1006 | |
1007 | 1007 | <span class="delete-donor-options"> |
1008 | 1008 | <p> |
1009 | - <?php echo Give()->html->checkbox( array( |
|
1009 | + <?php echo Give()->html->checkbox(array( |
|
1010 | 1010 | 'name' => 'give-donor-delete-confirm', |
1011 | - ) ); ?> |
|
1012 | - <label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
1011 | + )); ?> |
|
1012 | + <label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
1013 | 1013 | </p> |
1014 | 1014 | |
1015 | 1015 | <p> |
1016 | - <?php echo Give()->html->checkbox( array( |
|
1016 | + <?php echo Give()->html->checkbox(array( |
|
1017 | 1017 | 'name' => 'give-donor-delete-records', |
1018 | 1018 | 'options' => array( |
1019 | 1019 | 'disabled' => true, |
1020 | 1020 | ), |
1021 | - ) ); ?> |
|
1022 | - <label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
1021 | + )); ?> |
|
1022 | + <label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label> |
|
1023 | 1023 | </p> |
1024 | 1024 | |
1025 | 1025 | <?php |
@@ -1032,19 +1032,19 @@ discard block |
||
1032 | 1032 | * |
1033 | 1033 | * @param object $donor The donor object being displayed. |
1034 | 1034 | */ |
1035 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
1035 | + do_action('give_donor_delete_inputs', $donor); |
|
1036 | 1036 | ?> |
1037 | 1037 | </span> |
1038 | 1038 | |
1039 | 1039 | <span id="donor-edit-actions"> |
1040 | 1040 | <input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>"/> |
1041 | - <?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?> |
|
1041 | + <?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?> |
|
1042 | 1042 | <input type="hidden" name="give_action" value="delete-donor"/> |
1043 | 1043 | <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" |
1044 | - value="<?php _e( 'Delete Donor', 'give' ); ?>"/> |
|
1044 | + value="<?php _e('Delete Donor', 'give'); ?>"/> |
|
1045 | 1045 | <a id="give-delete-donor-cancel" |
1046 | - href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" |
|
1047 | - class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
1046 | + href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" |
|
1047 | + class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
1048 | 1048 | </span> |
1049 | 1049 | |
1050 | 1050 | </div> |
@@ -1060,5 +1060,5 @@ discard block |
||
1060 | 1060 | * |
1061 | 1061 | * @param object $donor The donor object being displayed. |
1062 | 1062 | */ |
1063 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
1063 | + do_action('give_donor_delete_bottom', $donor); |
|
1064 | 1064 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array The altered list of views. |
25 | 25 | */ |
26 | -function give_register_default_donor_views( $views ) { |
|
26 | +function give_register_default_donor_views($views) { |
|
27 | 27 | |
28 | 28 | $default_views = array( |
29 | 29 | 'overview' => 'give_donor_view', |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | 'notes' => 'give_donor_notes_view', |
32 | 32 | ); |
33 | 33 | |
34 | - return array_merge( $views, $default_views ); |
|
34 | + return array_merge($views, $default_views); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'give_donor_views', 'give_register_default_donor_views', 1, 1 ); |
|
38 | +add_filter('give_donor_views', 'give_register_default_donor_views', 1, 1); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register a tab for the single donor view. |
@@ -46,23 +46,23 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The altered list of tabs |
48 | 48 | */ |
49 | -function give_register_default_donor_tabs( $tabs ) { |
|
49 | +function give_register_default_donor_tabs($tabs) { |
|
50 | 50 | |
51 | 51 | $default_tabs = array( |
52 | 52 | 'overview' => array( |
53 | 53 | 'dashicon' => 'dashicons-admin-users', |
54 | - 'title' => __( 'Donor Profile', 'give' ), |
|
54 | + 'title' => __('Donor Profile', 'give'), |
|
55 | 55 | ), |
56 | 56 | 'notes' => array( |
57 | 57 | 'dashicon' => 'dashicons-admin-comments', |
58 | - 'title' => __( 'Donor Notes', 'give' ), |
|
58 | + 'title' => __('Donor Notes', 'give'), |
|
59 | 59 | ), |
60 | 60 | ); |
61 | 61 | |
62 | - return array_merge( $tabs, $default_tabs ); |
|
62 | + return array_merge($tabs, $default_tabs); |
|
63 | 63 | } |
64 | 64 | |
65 | -add_filter( 'give_donor_tabs', 'give_register_default_donor_tabs', 1, 1 ); |
|
65 | +add_filter('give_donor_tabs', 'give_register_default_donor_tabs', 1, 1); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Register the Delete icon as late as possible so it's at the bottom. |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return array The altered list of tabs, with 'delete' at the bottom. |
75 | 75 | */ |
76 | -function give_register_delete_donor_tab( $tabs ) { |
|
76 | +function give_register_delete_donor_tab($tabs) { |
|
77 | 77 | |
78 | 78 | $tabs['delete'] = array( |
79 | 79 | 'dashicon' => 'dashicons-trash', |
80 | - 'title' => __( 'Delete Donor', 'give' ), |
|
80 | + 'title' => __('Delete Donor', 'give'), |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | return $tabs; |
84 | 84 | } |
85 | 85 | |
86 | -add_filter( 'give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1 ); |
|
86 | +add_filter('give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1); |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Connect and Reconnect Donor with User profile. |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return array |
99 | 99 | */ |
100 | -function give_connect_user_donor_profile( $donor, $donor_data, $address ) { |
|
100 | +function give_connect_user_donor_profile($donor, $donor_data, $address) { |
|
101 | 101 | |
102 | 102 | $donor_id = $donor->id; |
103 | 103 | $previous_user_id = $donor->user_id; |
@@ -111,31 +111,31 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @since 1.0 |
113 | 113 | */ |
114 | - do_action( 'give_pre_edit_donor', $donor_id, $donor_data, $address ); |
|
114 | + do_action('give_pre_edit_donor', $donor_id, $donor_data, $address); |
|
115 | 115 | |
116 | 116 | $output = array(); |
117 | 117 | |
118 | - if ( $donor->update( $donor_data ) ) { |
|
118 | + if ($donor->update($donor_data)) { |
|
119 | 119 | |
120 | 120 | // Create and Update Donor First Name and Last Name in Meta Fields. |
121 | - $donor->update_meta( '_give_donor_first_name', $donor_data['first_name'] ); |
|
122 | - $donor->update_meta( '_give_donor_last_name', $donor_data['last_name'] ); |
|
121 | + $donor->update_meta('_give_donor_first_name', $donor_data['first_name']); |
|
122 | + $donor->update_meta('_give_donor_last_name', $donor_data['last_name']); |
|
123 | 123 | |
124 | 124 | // Fetch disconnected user id, if exists. |
125 | - $disconnected_user_id = $donor->get_meta( '_give_disconnected_user_id', true ); |
|
125 | + $disconnected_user_id = $donor->get_meta('_give_disconnected_user_id', true); |
|
126 | 126 | |
127 | 127 | // Flag User and Donor Disconnection. |
128 | - delete_user_meta( $disconnected_user_id, '_give_is_donor_disconnected' ); |
|
128 | + delete_user_meta($disconnected_user_id, '_give_is_donor_disconnected'); |
|
129 | 129 | |
130 | 130 | // Check whether the disconnected user id and the reconnected user id are same or not. |
131 | 131 | // If both are same then delete user id store in donor meta. |
132 | - if( $donor_data['user_id'] === $disconnected_user_id ) { |
|
133 | - delete_user_meta( $disconnected_user_id, '_give_disconnected_donor_id' ); |
|
134 | - $donor->delete_meta( '_give_disconnected_user_id' ); |
|
132 | + if ($donor_data['user_id'] === $disconnected_user_id) { |
|
133 | + delete_user_meta($disconnected_user_id, '_give_disconnected_donor_id'); |
|
134 | + $donor->delete_meta('_give_disconnected_user_id'); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $output['success'] = true; |
138 | - $donor_data = array_merge( $donor_data, $address ); |
|
138 | + $donor_data = array_merge($donor_data, $address); |
|
139 | 139 | $output['customer_info'] = $donor_data; |
140 | 140 | |
141 | 141 | } else { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @since 1.0 |
154 | 154 | */ |
155 | - do_action( 'give_post_edit_donor', $donor_id, $donor_data ); |
|
155 | + do_action('give_post_edit_donor', $donor_id, $donor_data); |
|
156 | 156 | |
157 | 157 | |
158 | 158 | return $output; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,33 +23,33 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array|bool $output Response messages |
25 | 25 | */ |
26 | -function give_edit_donor( $args ) { |
|
26 | +function give_edit_donor($args) { |
|
27 | 27 | |
28 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
28 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
29 | 29 | |
30 | - if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) { |
|
31 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array( |
|
30 | + if ( ! is_admin() || ! current_user_can($donor_edit_role)) { |
|
31 | + wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array( |
|
32 | 32 | 'response' => 403, |
33 | - ) ); |
|
33 | + )); |
|
34 | 34 | } |
35 | 35 | |
36 | - if ( empty( $args ) ) { |
|
36 | + if (empty($args)) { |
|
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | |
40 | - $donor_info = give_clean( $args['customerinfo'] ); |
|
40 | + $donor_info = give_clean($args['customerinfo']); |
|
41 | 41 | $donor_id = (int) $args['customerinfo']['id']; |
42 | 42 | $nonce = $args['_wpnonce']; |
43 | 43 | |
44 | - if ( ! wp_verify_nonce( $nonce, 'edit-donor' ) ) { |
|
45 | - wp_die( __( 'Cheatin’ uh?', 'give' ), __( 'Error', 'give' ), array( |
|
44 | + if ( ! wp_verify_nonce($nonce, 'edit-donor')) { |
|
45 | + wp_die(__('Cheatin’ uh?', 'give'), __('Error', 'give'), array( |
|
46 | 46 | 'response' => 400, |
47 | - ) ); |
|
47 | + )); |
|
48 | 48 | } |
49 | 49 | |
50 | - $donor = new Give_Donor( $donor_id ); |
|
50 | + $donor = new Give_Donor($donor_id); |
|
51 | 51 | |
52 | - if ( empty( $donor->id ) ) { |
|
52 | + if (empty($donor->id)) { |
|
53 | 53 | return false; |
54 | 54 | } |
55 | 55 | |
@@ -64,39 +64,39 @@ discard block |
||
64 | 64 | 'country' => '', |
65 | 65 | ); |
66 | 66 | |
67 | - $donor_info = wp_parse_args( $donor_info, $defaults ); |
|
67 | + $donor_info = wp_parse_args($donor_info, $defaults); |
|
68 | 68 | |
69 | - if ( (int) $donor_info['user_id'] !== (int) $donor->user_id ) { |
|
69 | + if ((int) $donor_info['user_id'] !== (int) $donor->user_id) { |
|
70 | 70 | |
71 | 71 | // Make sure we don't already have this user attached to a donor. |
72 | - if ( ! empty( $donor_info['user_id'] ) && false !== Give()->donors->get_donor_by( 'user_id', $donor_info['user_id'] ) ) { |
|
73 | - give_set_error( 'give-invalid-donor-user_id', sprintf( __( 'The User ID #%d is already associated with a different donor.', 'give' ), $donor_info['user_id'] ) ); |
|
72 | + if ( ! empty($donor_info['user_id']) && false !== Give()->donors->get_donor_by('user_id', $donor_info['user_id'])) { |
|
73 | + give_set_error('give-invalid-donor-user_id', sprintf(__('The User ID #%d is already associated with a different donor.', 'give'), $donor_info['user_id'])); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // Make sure it's actually a user. |
77 | - $user = get_user_by( 'id', $donor_info['user_id'] ); |
|
78 | - if ( ! empty( $donor_info['user_id'] ) && false === $user ) { |
|
79 | - give_set_error( 'give-invalid-user_id', sprintf( __( 'The User ID #%d does not exist. Please assign an existing user.', 'give' ), $donor_info['user_id'] ) ); |
|
77 | + $user = get_user_by('id', $donor_info['user_id']); |
|
78 | + if ( ! empty($donor_info['user_id']) && false === $user) { |
|
79 | + give_set_error('give-invalid-user_id', sprintf(__('The User ID #%d does not exist. Please assign an existing user.', 'give'), $donor_info['user_id'])); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - if ( give_get_errors() ) { |
|
83 | + if (give_get_errors()) { |
|
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | |
87 | 87 | // If First name of donor is empty, then fetch the current first name of donor. |
88 | - if ( empty( $donor_info['first_name'] ) ) { |
|
88 | + if (empty($donor_info['first_name'])) { |
|
89 | 89 | $donor_info['first_name'] = $donor->get_first_name(); |
90 | 90 | } |
91 | 91 | |
92 | 92 | // Sanitize the inputs. |
93 | 93 | $donor_data = array(); |
94 | - $donor_data['name'] = trim( "{$donor_info['first_name']} {$donor_info['last_name']}" ); |
|
94 | + $donor_data['name'] = trim("{$donor_info['first_name']} {$donor_info['last_name']}"); |
|
95 | 95 | $donor_data['first_name'] = $donor_info['first_name']; |
96 | 96 | $donor_data['last_name'] = $donor_info['last_name']; |
97 | 97 | $donor_data['user_id'] = $donor_info['user_id']; |
98 | 98 | |
99 | - $donor_data = apply_filters( 'give_edit_donor_info', $donor_data, $donor_id ); |
|
99 | + $donor_data = apply_filters('give_edit_donor_info', $donor_data, $donor_id); |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Filter the address |
@@ -104,28 +104,28 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @since 1.0 |
106 | 106 | */ |
107 | - $address = apply_filters( 'give_edit_donor_address', array(), $donor_id ); |
|
107 | + $address = apply_filters('give_edit_donor_address', array(), $donor_id); |
|
108 | 108 | |
109 | - $donor_data = give_clean( $donor_data ); |
|
110 | - $address = give_clean( $address ); |
|
109 | + $donor_data = give_clean($donor_data); |
|
110 | + $address = give_clean($address); |
|
111 | 111 | |
112 | - $output = give_connect_user_donor_profile( $donor, $donor_data, $address ); |
|
112 | + $output = give_connect_user_donor_profile($donor, $donor_data, $address); |
|
113 | 113 | |
114 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
115 | - header( 'Content-Type: application/json' ); |
|
116 | - echo json_encode( $output ); |
|
114 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
115 | + header('Content-Type: application/json'); |
|
116 | + echo json_encode($output); |
|
117 | 117 | wp_die(); |
118 | 118 | } |
119 | 119 | |
120 | - if ( $output['success'] ) { |
|
121 | - wp_redirect( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}&give-message=profile-updated" ) ); |
|
120 | + if ($output['success']) { |
|
121 | + wp_redirect(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}&give-message=profile-updated")); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | exit; |
125 | 125 | |
126 | 126 | } |
127 | 127 | |
128 | -add_action( 'give_edit-donor', 'give_edit_donor', 10, 1 ); |
|
128 | +add_action('give_edit-donor', 'give_edit_donor', 10, 1); |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * Save a donor note. |
@@ -136,40 +136,40 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return int The Note ID that was saved, or 0 if nothing was saved. |
138 | 138 | */ |
139 | -function give_donor_save_note( $args ) { |
|
139 | +function give_donor_save_note($args) { |
|
140 | 140 | |
141 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
141 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
142 | 142 | |
143 | - if ( ! is_admin() || ! current_user_can( $donor_view_role ) ) { |
|
144 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array( |
|
143 | + if ( ! is_admin() || ! current_user_can($donor_view_role)) { |
|
144 | + wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array( |
|
145 | 145 | 'response' => 403, |
146 | - ) ); |
|
146 | + )); |
|
147 | 147 | } |
148 | 148 | |
149 | - if ( empty( $args ) ) { |
|
149 | + if (empty($args)) { |
|
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
153 | - $donor_note = trim( give_clean( $args['donor_note'] ) ); |
|
153 | + $donor_note = trim(give_clean($args['donor_note'])); |
|
154 | 154 | $donor_id = (int) $args['customer_id']; |
155 | 155 | $nonce = $args['add_donor_note_nonce']; |
156 | 156 | |
157 | - if ( ! wp_verify_nonce( $nonce, 'add-donor-note' ) ) { |
|
158 | - wp_die( __( 'Cheatin’ uh?', 'give' ), __( 'Error', 'give' ), array( |
|
157 | + if ( ! wp_verify_nonce($nonce, 'add-donor-note')) { |
|
158 | + wp_die(__('Cheatin’ uh?', 'give'), __('Error', 'give'), array( |
|
159 | 159 | 'response' => 400, |
160 | - ) ); |
|
160 | + )); |
|
161 | 161 | } |
162 | 162 | |
163 | - if ( empty( $donor_note ) ) { |
|
164 | - give_set_error( 'empty-donor-note', __( 'A note is required.', 'give' ) ); |
|
163 | + if (empty($donor_note)) { |
|
164 | + give_set_error('empty-donor-note', __('A note is required.', 'give')); |
|
165 | 165 | } |
166 | 166 | |
167 | - if ( give_get_errors() ) { |
|
167 | + if (give_get_errors()) { |
|
168 | 168 | return false; |
169 | 169 | } |
170 | 170 | |
171 | - $donor = new Give_Donor( $donor_id ); |
|
172 | - $new_note = $donor->add_note( $donor_note ); |
|
171 | + $donor = new Give_Donor($donor_id); |
|
172 | + $new_note = $donor->add_note($donor_note); |
|
173 | 173 | |
174 | 174 | /** |
175 | 175 | * Fires before inserting donor note. |
@@ -179,22 +179,22 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @since 1.0 |
181 | 181 | */ |
182 | - do_action( 'give_pre_insert_donor_note', $donor_id, $new_note ); |
|
182 | + do_action('give_pre_insert_donor_note', $donor_id, $new_note); |
|
183 | 183 | |
184 | - if ( ! empty( $new_note ) && ! empty( $donor->id ) ) { |
|
184 | + if ( ! empty($new_note) && ! empty($donor->id)) { |
|
185 | 185 | |
186 | 186 | ob_start(); |
187 | 187 | ?> |
188 | 188 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
189 | 189 | <span class="note-content-wrap"> |
190 | - <?php echo stripslashes( $new_note ); ?> |
|
190 | + <?php echo stripslashes($new_note); ?> |
|
191 | 191 | </span> |
192 | 192 | </div> |
193 | 193 | <?php |
194 | 194 | $output = ob_get_contents(); |
195 | 195 | ob_end_clean(); |
196 | 196 | |
197 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
197 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
198 | 198 | echo $output; |
199 | 199 | exit; |
200 | 200 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | } |
209 | 209 | |
210 | -add_action( 'give_add-donor-note', 'give_donor_save_note', 10, 1 ); |
|
210 | +add_action('give_add-donor-note', 'give_donor_save_note', 10, 1); |
|
211 | 211 | |
212 | 212 | /** |
213 | 213 | * Delete a donor. |
@@ -218,41 +218,41 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return int Whether it was a successful deletion. |
220 | 220 | */ |
221 | -function give_donor_delete( $args ) { |
|
221 | +function give_donor_delete($args) { |
|
222 | 222 | |
223 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
223 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
224 | 224 | |
225 | - if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) { |
|
226 | - wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array( |
|
225 | + if ( ! is_admin() || ! current_user_can($donor_edit_role)) { |
|
226 | + wp_die(__('You do not have permission to delete donors.', 'give'), __('Error', 'give'), array( |
|
227 | 227 | 'response' => 403, |
228 | - ) ); |
|
228 | + )); |
|
229 | 229 | } |
230 | 230 | |
231 | - if ( empty( $args ) ) { |
|
231 | + if (empty($args)) { |
|
232 | 232 | return false; |
233 | 233 | } |
234 | 234 | |
235 | 235 | $donor_id = (int) $args['customer_id']; |
236 | - $confirm = ! empty( $args['give-donor-delete-confirm'] ) ? true : false; |
|
237 | - $remove_data = ! empty( $args['give-donor-delete-records'] ) ? true : false; |
|
236 | + $confirm = ! empty($args['give-donor-delete-confirm']) ? true : false; |
|
237 | + $remove_data = ! empty($args['give-donor-delete-records']) ? true : false; |
|
238 | 238 | $nonce = $args['_wpnonce']; |
239 | 239 | |
240 | - if ( ! wp_verify_nonce( $nonce, 'delete-donor' ) ) { |
|
241 | - wp_die( __( 'Cheatin’ uh?', 'give' ), __( 'Error', 'give' ), array( |
|
240 | + if ( ! wp_verify_nonce($nonce, 'delete-donor')) { |
|
241 | + wp_die(__('Cheatin’ uh?', 'give'), __('Error', 'give'), array( |
|
242 | 242 | 'response' => 400, |
243 | - ) ); |
|
243 | + )); |
|
244 | 244 | } |
245 | 245 | |
246 | - if ( ! $confirm ) { |
|
247 | - give_set_error( 'donor-delete-no-confirm', __( 'Please confirm you want to delete this donor.', 'give' ) ); |
|
246 | + if ( ! $confirm) { |
|
247 | + give_set_error('donor-delete-no-confirm', __('Please confirm you want to delete this donor.', 'give')); |
|
248 | 248 | } |
249 | 249 | |
250 | - if ( give_get_errors() ) { |
|
251 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id ) ); |
|
250 | + if (give_get_errors()) { |
|
251 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id)); |
|
252 | 252 | exit; |
253 | 253 | } |
254 | 254 | |
255 | - $donor = new Give_Donor( $donor_id ); |
|
255 | + $donor = new Give_Donor($donor_id); |
|
256 | 256 | |
257 | 257 | /** |
258 | 258 | * Fires before deleting donor. |
@@ -263,50 +263,50 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @since 1.0 |
265 | 265 | */ |
266 | - do_action( 'give_pre_delete_donor', $donor_id, $confirm, $remove_data ); |
|
266 | + do_action('give_pre_delete_donor', $donor_id, $confirm, $remove_data); |
|
267 | 267 | |
268 | - if ( $donor->id > 0 ) { |
|
268 | + if ($donor->id > 0) { |
|
269 | 269 | |
270 | - $payments_array = explode( ',', $donor->payment_ids ); |
|
271 | - $success = Give()->donors->delete( $donor->id ); |
|
270 | + $payments_array = explode(',', $donor->payment_ids); |
|
271 | + $success = Give()->donors->delete($donor->id); |
|
272 | 272 | |
273 | - if ( $success ) { |
|
273 | + if ($success) { |
|
274 | 274 | |
275 | - if ( $remove_data ) { |
|
275 | + if ($remove_data) { |
|
276 | 276 | |
277 | 277 | // Remove all donations, logs, etc. |
278 | - foreach ( $payments_array as $payment_id ) { |
|
279 | - give_delete_donation( $payment_id ); |
|
278 | + foreach ($payments_array as $payment_id) { |
|
279 | + give_delete_donation($payment_id); |
|
280 | 280 | } |
281 | 281 | } else { |
282 | 282 | |
283 | 283 | // Just set the donations to customer_id of 0. |
284 | - foreach ( $payments_array as $payment_id ) { |
|
285 | - give_update_payment_meta( $payment_id, '_give_payment_donor_id', 0 ); |
|
284 | + foreach ($payments_array as $payment_id) { |
|
285 | + give_update_payment_meta($payment_id, '_give_payment_donor_id', 0); |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
289 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=donor-deleted' ); |
|
289 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=donor-deleted'); |
|
290 | 290 | |
291 | 291 | } else { |
292 | 292 | |
293 | - give_set_error( 'give-donor-delete-failed', __( 'Error deleting donor.', 'give' ) ); |
|
294 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor_id ); |
|
293 | + give_set_error('give-donor-delete-failed', __('Error deleting donor.', 'give')); |
|
294 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor_id); |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | } else { |
298 | 298 | |
299 | - give_set_error( 'give-donor-delete-invalid-id', __( 'Invalid Donor ID.', 'give' ) ); |
|
300 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); |
|
299 | + give_set_error('give-donor-delete-invalid-id', __('Invalid Donor ID.', 'give')); |
|
300 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors'); |
|
301 | 301 | |
302 | 302 | } |
303 | 303 | |
304 | - wp_redirect( $redirect ); |
|
304 | + wp_redirect($redirect); |
|
305 | 305 | exit; |
306 | 306 | |
307 | 307 | } |
308 | 308 | |
309 | -add_action( 'give_delete-donor', 'give_donor_delete', 10, 1 ); |
|
309 | +add_action('give_delete-donor', 'give_donor_delete', 10, 1); |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * Disconnect a user ID from a donor |
@@ -317,17 +317,17 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return bool|array If the disconnect was successful. |
319 | 319 | */ |
320 | -function give_disconnect_donor_user_id( $args ) { |
|
320 | +function give_disconnect_donor_user_id($args) { |
|
321 | 321 | |
322 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
322 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
323 | 323 | |
324 | - if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) { |
|
325 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array( |
|
324 | + if ( ! is_admin() || ! current_user_can($donor_edit_role)) { |
|
325 | + wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array( |
|
326 | 326 | 'response' => 403, |
327 | - ) ); |
|
327 | + )); |
|
328 | 328 | } |
329 | 329 | |
330 | - if ( empty( $args ) ) { |
|
330 | + if (empty($args)) { |
|
331 | 331 | return false; |
332 | 332 | } |
333 | 333 | |
@@ -335,14 +335,14 @@ discard block |
||
335 | 335 | |
336 | 336 | $nonce = $args['_wpnonce']; |
337 | 337 | |
338 | - if ( ! wp_verify_nonce( $nonce, 'edit-donor' ) ) { |
|
339 | - wp_die( __( 'Cheatin’ uh?', 'give' ), __( 'Error', 'give' ), array( |
|
338 | + if ( ! wp_verify_nonce($nonce, 'edit-donor')) { |
|
339 | + wp_die(__('Cheatin’ uh?', 'give'), __('Error', 'give'), array( |
|
340 | 340 | 'response' => 400, |
341 | - ) ); |
|
341 | + )); |
|
342 | 342 | } |
343 | 343 | |
344 | - $donor = new Give_Donor( $donor_id ); |
|
345 | - if ( empty( $donor->id ) ) { |
|
344 | + $donor = new Give_Donor($donor_id); |
|
345 | + if (empty($donor->id)) { |
|
346 | 346 | return false; |
347 | 347 | } |
348 | 348 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @since 1.0 |
358 | 358 | */ |
359 | - do_action( 'give_pre_donor_disconnect_user_id', $donor_id, $user_id ); |
|
359 | + do_action('give_pre_donor_disconnect_user_id', $donor_id, $user_id); |
|
360 | 360 | |
361 | 361 | $output = array(); |
362 | 362 | $donor_args = array( |
@@ -365,19 +365,19 @@ discard block |
||
365 | 365 | |
366 | 366 | |
367 | 367 | $output['success'] = true; |
368 | - if ( ! $donor->update( $donor_args ) ) { |
|
369 | - update_user_meta( $user_id, '_give_is_donor_disconnected', true ); |
|
370 | - update_user_meta( $user_id, '_give_disconnected_donor_id', $donor->id ); |
|
371 | - $donor->update_meta( '_give_disconnected_user_id', $user_id ); |
|
368 | + if ( ! $donor->update($donor_args)) { |
|
369 | + update_user_meta($user_id, '_give_is_donor_disconnected', true); |
|
370 | + update_user_meta($user_id, '_give_disconnected_donor_id', $donor->id); |
|
371 | + $donor->update_meta('_give_disconnected_user_id', $user_id); |
|
372 | 372 | |
373 | 373 | $output['success'] = true; |
374 | 374 | |
375 | 375 | } else { |
376 | 376 | $output['success'] = false; |
377 | - give_set_error( 'give-disconnect-user-fail', __( 'Failed to disconnect user from donor.', 'give' ) ); |
|
377 | + give_set_error('give-disconnect-user-fail', __('Failed to disconnect user from donor.', 'give')); |
|
378 | 378 | } |
379 | 379 | |
380 | - $output['redirect'] = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' ) . $donor_id; |
|
380 | + $output['redirect'] = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id=').$donor_id; |
|
381 | 381 | |
382 | 382 | /** |
383 | 383 | * Fires after disconnecting user ID from a donor. |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | * |
387 | 387 | * @since 1.0 |
388 | 388 | */ |
389 | - do_action( 'give_post_donor_disconnect_user_id', $donor_id ); |
|
389 | + do_action('give_post_donor_disconnect_user_id', $donor_id); |
|
390 | 390 | |
391 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
392 | - header( 'Content-Type: application/json' ); |
|
393 | - echo json_encode( $output ); |
|
391 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
392 | + header('Content-Type: application/json'); |
|
393 | + echo json_encode($output); |
|
394 | 394 | wp_die(); |
395 | 395 | } |
396 | 396 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | |
399 | 399 | } |
400 | 400 | |
401 | -add_action( 'give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1 ); |
|
401 | +add_action('give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1); |
|
402 | 402 | |
403 | 403 | /** |
404 | 404 | * Add an email address to the donor from within the admin and log a donor note. |
@@ -409,86 +409,86 @@ discard block |
||
409 | 409 | * |
410 | 410 | * @return mixed If DOING_AJAX echos out JSON, otherwise returns array of success (bool) and message (string). |
411 | 411 | */ |
412 | -function give_add_donor_email( $args ) { |
|
412 | +function give_add_donor_email($args) { |
|
413 | 413 | |
414 | 414 | $donor_id = ''; |
415 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
415 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
416 | 416 | |
417 | - if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) { |
|
418 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array( |
|
417 | + if ( ! is_admin() || ! current_user_can($donor_edit_role)) { |
|
418 | + wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array( |
|
419 | 419 | 'response' => 403, |
420 | - ) ); |
|
420 | + )); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | $output = array(); |
424 | - if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) { |
|
424 | + if (empty($args) || empty($args['email']) || empty($args['customer_id'])) { |
|
425 | 425 | $output['success'] = false; |
426 | - if ( empty( $args['email'] ) ) { |
|
427 | - $output['message'] = __( 'Email address is required.', 'give' ); |
|
428 | - } elseif ( empty( $args['customer_id'] ) ) { |
|
429 | - $output['message'] = __( 'Donor ID is required.', 'give' ); |
|
426 | + if (empty($args['email'])) { |
|
427 | + $output['message'] = __('Email address is required.', 'give'); |
|
428 | + } elseif (empty($args['customer_id'])) { |
|
429 | + $output['message'] = __('Donor ID is required.', 'give'); |
|
430 | 430 | } else { |
431 | - $output['message'] = __( 'An error has occurred. Please try again.', 'give' ); |
|
431 | + $output['message'] = __('An error has occurred. Please try again.', 'give'); |
|
432 | 432 | } |
433 | - } elseif ( ! wp_verify_nonce( $args['_wpnonce'], 'give_add_donor_email' ) ) { |
|
433 | + } elseif ( ! wp_verify_nonce($args['_wpnonce'], 'give_add_donor_email')) { |
|
434 | 434 | $output = array( |
435 | 435 | 'success' => false, |
436 | - 'message' => __( 'Nonce verification failed.', 'give' ), |
|
436 | + 'message' => __('Nonce verification failed.', 'give'), |
|
437 | 437 | ); |
438 | - } elseif ( ! is_email( $args['email'] ) ) { |
|
438 | + } elseif ( ! is_email($args['email'])) { |
|
439 | 439 | $output = array( |
440 | 440 | 'success' => false, |
441 | - 'message' => __( 'Invalid email.', 'give' ), |
|
441 | + 'message' => __('Invalid email.', 'give'), |
|
442 | 442 | ); |
443 | 443 | } else { |
444 | - $email = sanitize_email( $args['email'] ); |
|
444 | + $email = sanitize_email($args['email']); |
|
445 | 445 | $donor_id = (int) $args['customer_id']; |
446 | 446 | $primary = 'true' === $args['primary'] ? true : false; |
447 | - $donor = new Give_Donor( $donor_id ); |
|
448 | - if ( false === $donor->add_email( $email, $primary ) ) { |
|
449 | - if ( in_array( $email, $donor->emails ) ) { |
|
447 | + $donor = new Give_Donor($donor_id); |
|
448 | + if (false === $donor->add_email($email, $primary)) { |
|
449 | + if (in_array($email, $donor->emails)) { |
|
450 | 450 | $output = array( |
451 | 451 | 'success' => false, |
452 | - 'message' => __( 'Email already associated with this donor.', 'give' ), |
|
452 | + 'message' => __('Email already associated with this donor.', 'give'), |
|
453 | 453 | ); |
454 | 454 | } else { |
455 | 455 | $output = array( |
456 | 456 | 'success' => false, |
457 | - 'message' => __( 'Email address is already associated with another donor.', 'give' ), |
|
457 | + 'message' => __('Email address is already associated with another donor.', 'give'), |
|
458 | 458 | ); |
459 | 459 | } |
460 | 460 | } else { |
461 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&give-message=email-added' ); |
|
461 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&give-message=email-added'); |
|
462 | 462 | $output = array( |
463 | 463 | 'success' => true, |
464 | - 'message' => __( 'Email successfully added to donor.', 'give' ), |
|
464 | + 'message' => __('Email successfully added to donor.', 'give'), |
|
465 | 465 | 'redirect' => $redirect, |
466 | 466 | ); |
467 | 467 | |
468 | 468 | $user = wp_get_current_user(); |
469 | - $user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' ); |
|
470 | - $donor_note = sprintf( __( 'Email address %1$s added by %2$s', 'give' ), $email, $user_login ); |
|
471 | - $donor->add_note( $donor_note ); |
|
469 | + $user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give'); |
|
470 | + $donor_note = sprintf(__('Email address %1$s added by %2$s', 'give'), $email, $user_login); |
|
471 | + $donor->add_note($donor_note); |
|
472 | 472 | |
473 | - if ( $primary ) { |
|
474 | - $donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $email, $user_login ); |
|
475 | - $donor->add_note( $donor_note ); |
|
473 | + if ($primary) { |
|
474 | + $donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $email, $user_login); |
|
475 | + $donor->add_note($donor_note); |
|
476 | 476 | } |
477 | 477 | } |
478 | 478 | } // End if(). |
479 | 479 | |
480 | - do_action( 'give_post_add_donor_email', $donor_id, $args ); |
|
480 | + do_action('give_post_add_donor_email', $donor_id, $args); |
|
481 | 481 | |
482 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
483 | - header( 'Content-Type: application/json' ); |
|
484 | - echo json_encode( $output ); |
|
482 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
483 | + header('Content-Type: application/json'); |
|
484 | + echo json_encode($output); |
|
485 | 485 | wp_die(); |
486 | 486 | } |
487 | 487 | |
488 | 488 | return $output; |
489 | 489 | } |
490 | 490 | |
491 | -add_action( 'give_add_donor_email', 'give_add_donor_email', 10, 1 ); |
|
491 | +add_action('give_add_donor_email', 'give_add_donor_email', 10, 1); |
|
492 | 492 | |
493 | 493 | |
494 | 494 | /** |
@@ -499,39 +499,39 @@ discard block |
||
499 | 499 | * @return bool|null |
500 | 500 | */ |
501 | 501 | function give_remove_donor_email() { |
502 | - if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
502 | + if (empty($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
503 | 503 | return false; |
504 | 504 | } |
505 | - if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) { |
|
505 | + if (empty($_GET['email']) || ! is_email($_GET['email'])) { |
|
506 | 506 | return false; |
507 | 507 | } |
508 | - if ( empty( $_GET['_wpnonce'] ) ) { |
|
508 | + if (empty($_GET['_wpnonce'])) { |
|
509 | 509 | return false; |
510 | 510 | } |
511 | 511 | |
512 | 512 | $nonce = $_GET['_wpnonce']; |
513 | - if ( ! wp_verify_nonce( $nonce, 'give-remove-donor-email' ) ) { |
|
514 | - wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( |
|
513 | + if ( ! wp_verify_nonce($nonce, 'give-remove-donor-email')) { |
|
514 | + wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array( |
|
515 | 515 | 'response' => 403, |
516 | - ) ); |
|
516 | + )); |
|
517 | 517 | } |
518 | 518 | |
519 | - $donor = new Give_Donor( $_GET['id'] ); |
|
520 | - if ( $donor->remove_email( $_GET['email'] ) ) { |
|
521 | - $url = add_query_arg( 'give-message', 'email-removed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ); |
|
519 | + $donor = new Give_Donor($_GET['id']); |
|
520 | + if ($donor->remove_email($_GET['email'])) { |
|
521 | + $url = add_query_arg('give-message', 'email-removed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)); |
|
522 | 522 | $user = wp_get_current_user(); |
523 | - $user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' ); |
|
524 | - $donor_note = sprintf( __( 'Email address %1$s removed by %2$s', 'give' ), $_GET['email'], $user_login ); |
|
525 | - $donor->add_note( $donor_note ); |
|
523 | + $user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give'); |
|
524 | + $donor_note = sprintf(__('Email address %1$s removed by %2$s', 'give'), $_GET['email'], $user_login); |
|
525 | + $donor->add_note($donor_note); |
|
526 | 526 | } else { |
527 | - $url = add_query_arg( 'give-message', 'email-remove-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ); |
|
527 | + $url = add_query_arg('give-message', 'email-remove-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)); |
|
528 | 528 | } |
529 | 529 | |
530 | - wp_safe_redirect( $url ); |
|
530 | + wp_safe_redirect($url); |
|
531 | 531 | exit; |
532 | 532 | } |
533 | 533 | |
534 | -add_action( 'give_remove_donor_email', 'give_remove_donor_email', 10 ); |
|
534 | +add_action('give_remove_donor_email', 'give_remove_donor_email', 10); |
|
535 | 535 | |
536 | 536 | |
537 | 537 | /** |
@@ -543,44 +543,44 @@ discard block |
||
543 | 543 | * @return bool|null |
544 | 544 | */ |
545 | 545 | function give_set_donor_primary_email() { |
546 | - if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
546 | + if (empty($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
547 | 547 | return false; |
548 | 548 | } |
549 | 549 | |
550 | - if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) { |
|
550 | + if (empty($_GET['email']) || ! is_email($_GET['email'])) { |
|
551 | 551 | return false; |
552 | 552 | } |
553 | 553 | |
554 | - if ( empty( $_GET['_wpnonce'] ) ) { |
|
554 | + if (empty($_GET['_wpnonce'])) { |
|
555 | 555 | return false; |
556 | 556 | } |
557 | 557 | |
558 | 558 | $nonce = $_GET['_wpnonce']; |
559 | 559 | |
560 | - if ( ! wp_verify_nonce( $nonce, 'give-set-donor-primary-email' ) ) { |
|
561 | - wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( |
|
560 | + if ( ! wp_verify_nonce($nonce, 'give-set-donor-primary-email')) { |
|
561 | + wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array( |
|
562 | 562 | 'response' => 403, |
563 | - ) ); |
|
563 | + )); |
|
564 | 564 | } |
565 | 565 | |
566 | - $donor = new Give_Donor( $_GET['id'] ); |
|
566 | + $donor = new Give_Donor($_GET['id']); |
|
567 | 567 | |
568 | - if ( $donor->set_primary_email( $_GET['email'] ) ) { |
|
569 | - $url = add_query_arg( 'give-message', 'primary-email-updated', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ); |
|
568 | + if ($donor->set_primary_email($_GET['email'])) { |
|
569 | + $url = add_query_arg('give-message', 'primary-email-updated', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)); |
|
570 | 570 | $user = wp_get_current_user(); |
571 | - $user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' ); |
|
572 | - $donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $_GET['email'], $user_login ); |
|
571 | + $user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give'); |
|
572 | + $donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $_GET['email'], $user_login); |
|
573 | 573 | |
574 | - $donor->add_note( $donor_note ); |
|
574 | + $donor->add_note($donor_note); |
|
575 | 575 | } else { |
576 | - $url = add_query_arg( 'give-message', 'primary-email-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ); |
|
576 | + $url = add_query_arg('give-message', 'primary-email-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)); |
|
577 | 577 | } |
578 | 578 | |
579 | - wp_safe_redirect( $url ); |
|
579 | + wp_safe_redirect($url); |
|
580 | 580 | exit; |
581 | 581 | } |
582 | 582 | |
583 | -add_action( 'give_set_donor_primary_email', 'give_set_donor_primary_email', 10 ); |
|
583 | +add_action('give_set_donor_primary_email', 'give_set_donor_primary_email', 10); |
|
584 | 584 | |
585 | 585 | /** |
586 | 586 | * Delete Donor using Bulk Actions. |
@@ -591,57 +591,57 @@ discard block |
||
591 | 591 | * |
592 | 592 | * @return void |
593 | 593 | */ |
594 | -function give_delete_donor( $args ) { |
|
594 | +function give_delete_donor($args) { |
|
595 | 595 | |
596 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
596 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
597 | 597 | |
598 | - if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) { |
|
599 | - wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array( |
|
598 | + if ( ! is_admin() || ! current_user_can($donor_edit_role)) { |
|
599 | + wp_die(__('You do not have permission to delete donors.', 'give'), __('Error', 'give'), array( |
|
600 | 600 | 'response' => 403, |
601 | - ) ); |
|
601 | + )); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | $give_args = array(); |
605 | - $donor_ids = ( ! empty( $_GET['donor'] ) && is_array( $_GET['donor'] ) && count( $_GET['donor'] ) > 0 ) ? $_GET['donor'] : array(); |
|
606 | - $delete_donor = ! empty( $_GET['give-delete-donor-confirm'] ) ? $_GET['give-delete-donor-confirm'] : ''; |
|
607 | - $delete_donations = ! empty( $_GET['give-delete-donor-records'] ) ? $_GET['give-delete-donor-records'] : ''; |
|
608 | - $search_keyword = ! empty( $_GET['s'] ) ? $_GET['s'] : ''; |
|
609 | - $give_args['orderby'] = ! empty( $_GET['orderby'] ) ? $_GET['orderby'] : 'id'; |
|
610 | - $give_args['order'] = ! empty( $_GET['order'] ) ? $_GET['order'] : 'desc'; |
|
605 | + $donor_ids = ( ! empty($_GET['donor']) && is_array($_GET['donor']) && count($_GET['donor']) > 0) ? $_GET['donor'] : array(); |
|
606 | + $delete_donor = ! empty($_GET['give-delete-donor-confirm']) ? $_GET['give-delete-donor-confirm'] : ''; |
|
607 | + $delete_donations = ! empty($_GET['give-delete-donor-records']) ? $_GET['give-delete-donor-records'] : ''; |
|
608 | + $search_keyword = ! empty($_GET['s']) ? $_GET['s'] : ''; |
|
609 | + $give_args['orderby'] = ! empty($_GET['orderby']) ? $_GET['orderby'] : 'id'; |
|
610 | + $give_args['order'] = ! empty($_GET['order']) ? $_GET['order'] : 'desc'; |
|
611 | 611 | $nonce = $args['_wpnonce']; |
612 | 612 | |
613 | 613 | // Verify Nonce for deleting bulk donors. |
614 | - if ( ! wp_verify_nonce( $nonce, 'bulk-donors' ) ) { |
|
615 | - wp_die( __( 'Cheatin’ uh?', 'give' ), __( 'Error', 'give' ), array( |
|
614 | + if ( ! wp_verify_nonce($nonce, 'bulk-donors')) { |
|
615 | + wp_die(__('Cheatin’ uh?', 'give'), __('Error', 'give'), array( |
|
616 | 616 | 'response' => 400, |
617 | - ) ); |
|
617 | + )); |
|
618 | 618 | } |
619 | 619 | |
620 | - if( count( $donor_ids ) > 0 ) { |
|
621 | - foreach ( $donor_ids as $donor_id ) { |
|
622 | - $donor = new Give_Donor( $donor_id ); |
|
620 | + if (count($donor_ids) > 0) { |
|
621 | + foreach ($donor_ids as $donor_id) { |
|
622 | + $donor = new Give_Donor($donor_id); |
|
623 | 623 | |
624 | - if ( $donor->id > 0 ) { |
|
624 | + if ($donor->id > 0) { |
|
625 | 625 | |
626 | - if( $delete_donor ) { |
|
627 | - $donor_deleted = Give()->donors->delete( $donor->id ); |
|
626 | + if ($delete_donor) { |
|
627 | + $donor_deleted = Give()->donors->delete($donor->id); |
|
628 | 628 | |
629 | - if ( $donor_deleted ) { |
|
630 | - $donation_ids = explode( ',', $donor->payment_ids ); |
|
629 | + if ($donor_deleted) { |
|
630 | + $donation_ids = explode(',', $donor->payment_ids); |
|
631 | 631 | |
632 | - if( $delete_donations ) { |
|
632 | + if ($delete_donations) { |
|
633 | 633 | |
634 | 634 | // Remove all donations, logs, etc. |
635 | - foreach ( $donation_ids as $donation_id ) { |
|
636 | - give_delete_donation( $donation_id ); |
|
635 | + foreach ($donation_ids as $donation_id) { |
|
636 | + give_delete_donation($donation_id); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | $give_args['give-message'] = 'donor-donations-deleted'; |
640 | 640 | } else { |
641 | 641 | |
642 | 642 | // Just set the donations to customer_id of 0. |
643 | - foreach ( $donation_ids as $donation_id ) { |
|
644 | - give_update_payment_meta( $donation_id, '_give_payment_customer_id', 0 ); |
|
643 | + foreach ($donation_ids as $donation_id) { |
|
644 | + give_update_payment_meta($donation_id, '_give_payment_customer_id', 0); |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | $give_args['give-message'] = 'donor-deleted'; |
@@ -658,13 +658,13 @@ discard block |
||
658 | 658 | } |
659 | 659 | |
660 | 660 | // Add Search Keyword on redirection, if it exists. |
661 | - if ( ! empty( $search_keyword ) ) { |
|
661 | + if ( ! empty($search_keyword)) { |
|
662 | 662 | $give_args['s'] = $search_keyword; |
663 | 663 | } |
664 | 664 | |
665 | - wp_redirect( add_query_arg( $give_args, admin_url( 'edit.php?post_type=give_forms&page=give-donors' ) ) ); |
|
665 | + wp_redirect(add_query_arg($give_args, admin_url('edit.php?post_type=give_forms&page=give-donors'))); |
|
666 | 666 | give_die(); |
667 | 667 | } |
668 | 668 | } |
669 | 669 | |
670 | -add_action( 'give_delete_donor', 'give_delete_donor' ); |
|
671 | 670 | \ No newline at end of file |
671 | +add_action('give_delete_donor', 'give_delete_donor'); |
|
672 | 672 | \ No newline at end of file |
@@ -9,11 +9,11 @@ discard block |
||
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_Gateways' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Gateways')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Gateways. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'gateways'; |
30 | - $this->label = esc_html__( 'Payment Gateways', 'give' ); |
|
30 | + $this->label = esc_html__('Payment Gateways', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'gateways-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'paypal-standard': |
49 | 49 | $settings = array( |
50 | 50 | // Section 2: PayPal Standard. |
@@ -53,55 +53,55 @@ discard block |
||
53 | 53 | 'id' => 'give_title_gateway_settings_2', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'PayPal Email', 'give' ), |
|
57 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
56 | + 'name' => __('PayPal Email', 'give'), |
|
57 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
58 | 58 | 'id' => 'paypal_email', |
59 | 59 | 'type' => 'email', |
60 | 60 | ), |
61 | 61 | array( |
62 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
63 | - 'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ), |
|
62 | + 'name' => __('PayPal Page Style', 'give'), |
|
63 | + 'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'), |
|
64 | 64 | 'id' => 'paypal_page_style', |
65 | 65 | 'type' => 'text', |
66 | 66 | ), |
67 | 67 | array( |
68 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
69 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
68 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
69 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
70 | 70 | 'id' => 'paypal_button_type', |
71 | 71 | 'type' => 'radio_inline', |
72 | 72 | 'options' => array( |
73 | - 'donation' => __( 'Donation', 'give' ), |
|
74 | - 'standard' => __( 'Standard Transaction', 'give' ) |
|
73 | + 'donation' => __('Donation', 'give'), |
|
74 | + 'standard' => __('Standard Transaction', 'give') |
|
75 | 75 | ), |
76 | 76 | 'default' => 'donation', |
77 | 77 | ), |
78 | 78 | array( |
79 | - 'name' => __( 'Billing Details', 'give' ), |
|
80 | - 'desc' => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ), |
|
79 | + 'name' => __('Billing Details', 'give'), |
|
80 | + 'desc' => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'), |
|
81 | 81 | 'id' => 'paypal_standard_billing_details', |
82 | 82 | 'type' => 'radio_inline', |
83 | 83 | 'default' => 'disabled', |
84 | 84 | 'options' => array( |
85 | - 'enabled' => __( 'Enabled', 'give' ), |
|
86 | - 'disabled' => __( 'Disabled', 'give' ), |
|
85 | + 'enabled' => __('Enabled', 'give'), |
|
86 | + 'disabled' => __('Disabled', 'give'), |
|
87 | 87 | ) |
88 | 88 | ), |
89 | 89 | array( |
90 | - 'name' => __( 'PayPal IPN Verification', 'give' ), |
|
91 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
90 | + 'name' => __('PayPal IPN Verification', 'give'), |
|
91 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
92 | 92 | 'id' => 'paypal_verification', |
93 | 93 | 'type' => 'radio_inline', |
94 | 94 | 'default' => 'enabled', |
95 | 95 | 'options' => array( |
96 | - 'enabled' => __( 'Enabled', 'give' ), |
|
97 | - 'disabled' => __( 'Disabled', 'give' ), |
|
96 | + 'enabled' => __('Enabled', 'give'), |
|
97 | + 'disabled' => __('Disabled', 'give'), |
|
98 | 98 | ) |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
101 | + 'name' => __('PayPal Standard Gateway Settings Docs Link', 'give'), |
|
102 | 102 | 'id' => 'paypal_standard_gateway_settings_docs_link', |
103 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
104 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
103 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'), |
|
104 | + 'title' => __('PayPal Standard Gateway Settings', 'give'), |
|
105 | 105 | 'type' => 'give_docs_link', |
106 | 106 | ), |
107 | 107 | array( |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | 'id' => 'give_title_gateway_settings_3', |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
123 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
122 | + 'name' => __('Collect Billing Details', 'give'), |
|
123 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
124 | 124 | 'id' => 'give_offline_donation_enable_billing_fields', |
125 | 125 | 'type' => 'radio_inline', |
126 | 126 | 'default' => 'disabled', |
127 | 127 | 'options' => array( |
128 | - 'enabled' => __( 'Enabled', 'give' ), |
|
129 | - 'disabled' => __( 'Disabled', 'give' ) |
|
128 | + 'enabled' => __('Enabled', 'give'), |
|
129 | + 'disabled' => __('Disabled', 'give') |
|
130 | 130 | ) |
131 | 131 | ), |
132 | 132 | array( |
133 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
134 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
133 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
134 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
135 | 135 | 'id' => 'global_offline_donation_content', |
136 | 136 | 'default' => give_get_default_offline_donation_content(), |
137 | 137 | 'type' => 'wysiwyg', |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | ) |
141 | 141 | ), |
142 | 142 | array( |
143 | - 'name' => esc_html__( 'Offline Donations Settings Docs Link', 'give' ), |
|
143 | + 'name' => esc_html__('Offline Donations Settings Docs Link', 'give'), |
|
144 | 144 | 'id' => 'offline_gateway_settings_docs_link', |
145 | - 'url' => esc_url( 'http://docs.givewp.com/offlinegateway' ), |
|
146 | - 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
145 | + 'url' => esc_url('http://docs.givewp.com/offlinegateway'), |
|
146 | + 'title' => __('Offline Gateway Settings', 'give'), |
|
147 | 147 | 'type' => 'give_docs_link', |
148 | 148 | ), |
149 | 149 | array( |
@@ -161,33 +161,33 @@ discard block |
||
161 | 161 | 'type' => 'title' |
162 | 162 | ), |
163 | 163 | array( |
164 | - 'name' => __( 'Test Mode', 'give' ), |
|
165 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
164 | + 'name' => __('Test Mode', 'give'), |
|
165 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
166 | 166 | 'id' => 'test_mode', |
167 | 167 | 'type' => 'radio_inline', |
168 | 168 | 'default' => 'disabled', |
169 | 169 | 'options' => array( |
170 | - 'enabled' => __( 'Enabled', 'give' ), |
|
171 | - 'disabled' => __( 'Disabled', 'give' ), |
|
170 | + 'enabled' => __('Enabled', 'give'), |
|
171 | + 'disabled' => __('Disabled', 'give'), |
|
172 | 172 | ) |
173 | 173 | ), |
174 | 174 | array( |
175 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
176 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
175 | + 'name' => __('Enabled Gateways', 'give'), |
|
176 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
177 | 177 | 'id' => 'gateways', |
178 | 178 | 'type' => 'enabled_gateways' |
179 | 179 | ), |
180 | 180 | array( |
181 | - 'name' => __( 'Default Gateway', 'give' ), |
|
182 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
181 | + 'name' => __('Default Gateway', 'give'), |
|
182 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
183 | 183 | 'id' => 'default_gateway', |
184 | 184 | 'type' => 'default_gateway' |
185 | 185 | ), |
186 | 186 | array( |
187 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
187 | + 'name' => __('Gateways Docs Link', 'give'), |
|
188 | 188 | 'id' => 'gateway_settings_docs_link', |
189 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
190 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
189 | + 'url' => esc_url('http://docs.givewp.com/settings-gateways'), |
|
190 | + 'title' => __('Gateway Settings', 'give'), |
|
191 | 191 | 'type' => 'give_docs_link', |
192 | 192 | ), |
193 | 193 | array( |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * Filter the payment gateways settings. |
203 | 203 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
204 | 204 | */ |
205 | - $settings = apply_filters( 'give_settings_gateways', $settings ); |
|
205 | + $settings = apply_filters('give_settings_gateways', $settings); |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Filter the settings. |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * |
212 | 212 | * @param array $settings |
213 | 213 | */ |
214 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
214 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
215 | 215 | |
216 | 216 | // Output. |
217 | 217 | return $settings; |
@@ -225,12 +225,12 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function get_sections() { |
227 | 227 | $sections = array( |
228 | - 'gateways-settings' => __( 'Gateways', 'give' ), |
|
229 | - 'paypal-standard' => __( 'PayPal Standard', 'give' ), |
|
230 | - 'offline-donations' => __( 'Offline Donations', 'give' ) |
|
228 | + 'gateways-settings' => __('Gateways', 'give'), |
|
229 | + 'paypal-standard' => __('PayPal Standard', 'give'), |
|
230 | + 'offline-donations' => __('Offline Donations', 'give') |
|
231 | 231 | ); |
232 | 232 | |
233 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
233 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 |