@@ -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 |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @return Give |
281 | 281 | */ |
282 | 282 | public static function instance() { |
283 | - if ( is_null( self::$_instance ) ) { |
|
283 | + if (is_null(self::$_instance)) { |
|
284 | 284 | self::$_instance = new self(); |
285 | 285 | } |
286 | 286 | |
@@ -292,13 +292,13 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function __construct() { |
294 | 294 | // PHP version |
295 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
296 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
295 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
296 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | // Bailout: Need minimum php version to load plugin. |
300 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
301 | - add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) ); |
|
300 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
301 | + add_action('admin_notices', array($this, 'minimum_phpversion_notice')); |
|
302 | 302 | |
303 | 303 | return; |
304 | 304 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $this->includes(); |
308 | 308 | $this->init_hooks(); |
309 | 309 | |
310 | - do_action( 'give_loaded' ); |
|
310 | + do_action('give_loaded'); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | * @since 1.8.9 |
317 | 317 | */ |
318 | 318 | private function init_hooks() { |
319 | - register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
320 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
319 | + register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
320 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
321 | 321 | |
322 | 322 | // Set up localization on init Hook. |
323 | - add_action( 'init', array( $this, 'load_textdomain' ), 0 ); |
|
323 | + add_action('init', array($this, 'load_textdomain'), 0); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @since 1.8.9 |
338 | 338 | */ |
339 | - do_action( 'before_give_init' ); |
|
339 | + do_action('before_give_init'); |
|
340 | 340 | |
341 | 341 | // Set up localization. |
342 | 342 | $this->load_textdomain(); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @since 1.8.7 |
373 | 373 | */ |
374 | - do_action( 'give_init', $this ); |
|
374 | + do_action('give_init', $this); |
|
375 | 375 | |
376 | 376 | } |
377 | 377 | |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | */ |
389 | 389 | public function __clone() { |
390 | 390 | // Cloning instances of the class is forbidden. |
391 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
391 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | */ |
402 | 402 | public function __wakeup() { |
403 | 403 | // Unserializing instances of the class is forbidden. |
404 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
404 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | /** |
@@ -415,33 +415,33 @@ discard block |
||
415 | 415 | private function setup_constants() { |
416 | 416 | |
417 | 417 | // Plugin version |
418 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
419 | - define( 'GIVE_VERSION', '2.2.3' ); |
|
418 | + if ( ! defined('GIVE_VERSION')) { |
|
419 | + define('GIVE_VERSION', '2.2.3'); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | // Plugin Root File |
423 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
424 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
423 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
424 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | // Plugin Folder Path |
428 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
429 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) ); |
|
428 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
429 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE)); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | // Plugin Folder URL |
433 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
434 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) ); |
|
433 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
434 | + define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE)); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | // Plugin Basename aka: "give/give.php" |
438 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
439 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) ); |
|
438 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
439 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE)); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | // Make sure CAL_GREGORIAN is defined |
443 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
444 | - define( 'CAL_GREGORIAN', 1 ); |
|
443 | + if ( ! defined('CAL_GREGORIAN')) { |
|
444 | + define('CAL_GREGORIAN', 1); |
|
445 | 445 | } |
446 | 446 | } |
447 | 447 | |
@@ -459,170 +459,170 @@ discard block |
||
459 | 459 | /** |
460 | 460 | * Load libraries. |
461 | 461 | */ |
462 | - if ( ! class_exists( 'WP_Async_Request' ) ) { |
|
463 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' ); |
|
462 | + if ( ! class_exists('WP_Async_Request')) { |
|
463 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php'); |
|
464 | 464 | } |
465 | 465 | |
466 | - if ( ! class_exists( 'WP_Background_Process' ) ) { |
|
467 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' ); |
|
466 | + if ( ! class_exists('WP_Background_Process')) { |
|
467 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php'); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /** |
471 | 471 | * Load plugin files |
472 | 472 | */ |
473 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
474 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
473 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
474 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
475 | 475 | $give_options = give_get_settings(); |
476 | 476 | |
477 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
478 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php'; |
|
479 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
480 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
481 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
482 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
483 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
484 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
485 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
486 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php'; |
|
487 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php'; |
|
488 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
489 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php'; |
|
490 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-readme-parser.php'; |
|
491 | - |
|
492 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php'; |
|
493 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
494 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
495 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
496 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
497 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php'; |
|
498 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
499 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
500 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php'; |
|
501 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php'; |
|
502 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
503 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor-wall-widget.php'; |
|
504 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
505 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sessions.php'; |
|
506 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
507 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
508 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
509 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
510 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
511 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php'; |
|
512 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-comment.php'; |
|
513 | - |
|
514 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
515 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
516 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
517 | - require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php'; |
|
518 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
519 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
520 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
521 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
522 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
523 | - require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php'; |
|
524 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
525 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
526 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
527 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
528 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
529 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
530 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
531 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
532 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
533 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
534 | - |
|
535 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php'; |
|
536 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
537 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
538 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
539 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
540 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
541 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php'; |
|
542 | - |
|
543 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
544 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
545 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
546 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
547 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
548 | - |
|
549 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
550 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
551 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php'; |
|
552 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
553 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
554 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
555 | - |
|
556 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php'; |
|
557 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-wall.php'; |
|
558 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-stats.php'; |
|
559 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php'; |
|
560 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/frontend-donor-functions.php'; |
|
561 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/actions.php'; |
|
562 | - |
|
563 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
564 | - |
|
565 | - require_once GIVE_PLUGIN_DIR . 'blocks/load.php'; |
|
566 | - |
|
567 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
568 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
477 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
478 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php'; |
|
479 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
481 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
482 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
483 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
484 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
485 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
486 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php'; |
|
487 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php'; |
|
488 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
489 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php'; |
|
490 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-readme-parser.php'; |
|
491 | + |
|
492 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php'; |
|
493 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
494 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
495 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
496 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
497 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php'; |
|
498 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
499 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
500 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php'; |
|
501 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php'; |
|
502 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
503 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor-wall-widget.php'; |
|
504 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
505 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sessions.php'; |
|
506 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
507 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
508 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
509 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
510 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
511 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php'; |
|
512 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-comment.php'; |
|
513 | + |
|
514 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
515 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
516 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
517 | + require_once GIVE_PLUGIN_DIR.'includes/import-functions.php'; |
|
518 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
519 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
520 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
521 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
522 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
523 | + require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php'; |
|
524 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
525 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
526 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
527 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
528 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
529 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
530 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
531 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
532 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
533 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
534 | + |
|
535 | + require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php'; |
|
536 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
537 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
538 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
539 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
540 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
541 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php'; |
|
542 | + |
|
543 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
544 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
545 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
546 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
547 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
548 | + |
|
549 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
550 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
551 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php'; |
|
552 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
553 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
554 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
555 | + |
|
556 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php'; |
|
557 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-wall.php'; |
|
558 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-stats.php'; |
|
559 | + require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php'; |
|
560 | + require_once GIVE_PLUGIN_DIR.'includes/donors/frontend-donor-functions.php'; |
|
561 | + require_once GIVE_PLUGIN_DIR.'includes/donors/actions.php'; |
|
562 | + |
|
563 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
564 | + |
|
565 | + require_once GIVE_PLUGIN_DIR.'blocks/load.php'; |
|
566 | + |
|
567 | + if (defined('WP_CLI') && WP_CLI) { |
|
568 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
569 | 569 | } |
570 | 570 | |
571 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
572 | - |
|
573 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
574 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
575 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
576 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
577 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
578 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
579 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
580 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
581 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
582 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
583 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php'; |
|
584 | - |
|
585 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
586 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
587 | - |
|
588 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
589 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
590 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
591 | - |
|
592 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
593 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-give-form-duplicator.php'; |
|
594 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
595 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
596 | - |
|
597 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
598 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
599 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
600 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
601 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php'; |
|
602 | - |
|
603 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
604 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
605 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
606 | - |
|
607 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
608 | - |
|
609 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
610 | - |
|
611 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
612 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
613 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
614 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
615 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
616 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
617 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
618 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
619 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
620 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
621 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
622 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donor-wall.php'; |
|
571 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
572 | + |
|
573 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
574 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
575 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
576 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
577 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
578 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
579 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
580 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
581 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
582 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
583 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php'; |
|
584 | + |
|
585 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
586 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
587 | + |
|
588 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
589 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
590 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
591 | + |
|
592 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
593 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-give-form-duplicator.php'; |
|
594 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
595 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
596 | + |
|
597 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
598 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
599 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
600 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
601 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php'; |
|
602 | + |
|
603 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
604 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
605 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
606 | + |
|
607 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
608 | + |
|
609 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
610 | + |
|
611 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
612 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
613 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
614 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
615 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
616 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
617 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
618 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
619 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
620 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
621 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
622 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donor-wall.php'; |
|
623 | 623 | }// End if(). |
624 | 624 | |
625 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
625 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | |
@@ -637,16 +637,16 @@ discard block |
||
637 | 637 | public function load_textdomain() { |
638 | 638 | |
639 | 639 | // Set filter for Give's languages directory |
640 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
641 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
640 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
641 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
642 | 642 | |
643 | 643 | // Traditional WordPress plugin locale filter. |
644 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
645 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
644 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
645 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
646 | 646 | |
647 | - unload_textdomain( 'give' ); |
|
648 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
649 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
647 | + unload_textdomain('give'); |
|
648 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
649 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
650 | 650 | |
651 | 651 | } |
652 | 652 | |
@@ -659,21 +659,21 @@ discard block |
||
659 | 659 | */ |
660 | 660 | public function minimum_phpversion_notice() { |
661 | 661 | // Bailout. |
662 | - if ( ! is_admin() ) { |
|
662 | + if ( ! is_admin()) { |
|
663 | 663 | return; |
664 | 664 | } |
665 | 665 | |
666 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
667 | - $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>'; |
|
668 | - $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>'; |
|
669 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
670 | - $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>'; |
|
671 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
672 | - $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>'; |
|
666 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
667 | + $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>'; |
|
668 | + $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>'; |
|
669 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
670 | + $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>'; |
|
671 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
672 | + $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>'; |
|
673 | 673 | |
674 | 674 | echo sprintf( |
675 | 675 | '<div class="notice notice-error">%1$s</div>', |
676 | - wp_kses_post( $notice_desc ) |
|
676 | + wp_kses_post($notice_desc) |
|
677 | 677 | ); |
678 | 678 | } |
679 | 679 |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * @since 2.1.0 |
38 | 38 | */ |
39 | 39 | public function __construct() { |
40 | - $this->direction = ( is_rtl() || isset( $_GET['d'] ) && 'rtl' === $_GET['d'] ) ? '.rtl' : ''; |
|
41 | - $this->scripts_footer = give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ? true : false; |
|
40 | + $this->direction = (is_rtl() || isset($_GET['d']) && 'rtl' === $_GET['d']) ? '.rtl' : ''; |
|
41 | + $this->scripts_footer = give_is_setting_enabled(give_get_option('scripts_footer')) ? true : false; |
|
42 | 42 | $this->init(); |
43 | 43 | } |
44 | 44 | |
@@ -49,20 +49,20 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function init() { |
51 | 51 | |
52 | - add_action( 'admin_enqueue_scripts', array( $this, 'register_styles' ) ); |
|
53 | - add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
54 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_styles' ) ); |
|
55 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
52 | + add_action('admin_enqueue_scripts', array($this, 'register_styles')); |
|
53 | + add_action('admin_enqueue_scripts', array($this, 'register_scripts')); |
|
54 | + add_action('wp_enqueue_scripts', array($this, 'register_styles')); |
|
55 | + add_action('wp_enqueue_scripts', array($this, 'register_scripts')); |
|
56 | 56 | |
57 | - if ( is_admin() ) { |
|
58 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
59 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_styles' ) ); |
|
60 | - add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_admin_scripts' ) ); |
|
61 | - add_action( 'admin_head', array( $this, 'global_admin_head' ) ); |
|
57 | + if (is_admin()) { |
|
58 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
59 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_styles')); |
|
60 | + add_action('enqueue_block_editor_assets', array($this, 'gutenberg_admin_scripts')); |
|
61 | + add_action('admin_head', array($this, 'global_admin_head')); |
|
62 | 62 | |
63 | 63 | } else { |
64 | - add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_styles' ) ); |
|
65 | - add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_scripts' ) ); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'public_enqueue_styles')); |
|
65 | + add_action('wp_enqueue_scripts', array($this, 'public_enqueue_scripts')); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | public function register_styles() { |
75 | 75 | |
76 | 76 | // WP-admin. |
77 | - wp_register_style( 'give-admin-styles', GIVE_PLUGIN_URL . 'assets/dist/css/admin' . $this->direction . '.css', array(), GIVE_VERSION ); |
|
77 | + wp_register_style('give-admin-styles', GIVE_PLUGIN_URL.'assets/dist/css/admin'.$this->direction.'.css', array(), GIVE_VERSION); |
|
78 | 78 | |
79 | 79 | // WP-admin: plugin page. |
80 | 80 | wp_register_style( |
81 | 81 | 'plugin-deactivation-survey-css', |
82 | - GIVE_PLUGIN_URL . 'assets/dist/css/plugin-deactivation-survey.css', |
|
82 | + GIVE_PLUGIN_URL.'assets/dist/css/plugin-deactivation-survey.css', |
|
83 | 83 | array(), |
84 | 84 | GIVE_VERSION |
85 | 85 | ); |
86 | 86 | |
87 | 87 | // Frontend. |
88 | - if ( give_is_setting_enabled( give_get_option( 'css' ) ) ) { |
|
89 | - wp_register_style( 'give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
88 | + if (give_is_setting_enabled(give_get_option('css'))) { |
|
89 | + wp_register_style('give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -98,23 +98,23 @@ discard block |
||
98 | 98 | public function register_scripts() { |
99 | 99 | |
100 | 100 | // WP-Admin. |
101 | - wp_register_script( 'give-admin-scripts', GIVE_PLUGIN_URL . 'assets/dist/js/admin.js', array( |
|
101 | + wp_register_script('give-admin-scripts', GIVE_PLUGIN_URL.'assets/dist/js/admin.js', array( |
|
102 | 102 | 'jquery', |
103 | 103 | 'jquery-ui-datepicker', |
104 | 104 | 'wp-color-picker', |
105 | 105 | 'jquery-query', |
106 | - ), GIVE_VERSION ); |
|
106 | + ), GIVE_VERSION); |
|
107 | 107 | |
108 | 108 | // WP-admin: plugin page. |
109 | - wp_register_script( 'plugin-deactivation-survey-js', |
|
110 | - GIVE_PLUGIN_URL . 'assets/dist/js/plugin-deactivation-survey.js', |
|
111 | - array( 'jquery' ), |
|
109 | + wp_register_script('plugin-deactivation-survey-js', |
|
110 | + GIVE_PLUGIN_URL.'assets/dist/js/plugin-deactivation-survey.js', |
|
111 | + array('jquery'), |
|
112 | 112 | GIVE_VERSION, |
113 | 113 | true |
114 | 114 | ); |
115 | 115 | |
116 | 116 | // Frontend. |
117 | - wp_register_script( 'give', GIVE_PLUGIN_URL . 'assets/dist/js/give.js', array( 'jquery' ), GIVE_VERSION, $this->scripts_footer ); |
|
117 | + wp_register_script('give', GIVE_PLUGIN_URL.'assets/dist/js/give.js', array('jquery'), GIVE_VERSION, $this->scripts_footer); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param string $hook Page hook. |
126 | 126 | */ |
127 | - public function admin_enqueue_styles( $hook ) { |
|
127 | + public function admin_enqueue_styles($hook) { |
|
128 | 128 | // Give Admin Only. |
129 | - if ( ! apply_filters( 'give_load_admin_styles', give_is_admin_page(), $hook ) ) { |
|
129 | + if ( ! apply_filters('give_load_admin_styles', give_is_admin_page(), $hook)) { |
|
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
133 | 133 | // Give enqueues. |
134 | - wp_enqueue_style( 'give-admin-styles' ); |
|
135 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
134 | + wp_enqueue_style('give-admin-styles'); |
|
135 | + wp_enqueue_style('give-admin-bar-notification'); |
|
136 | 136 | |
137 | 137 | // WP Core enqueues. |
138 | - wp_enqueue_style( 'wp-color-picker' ); |
|
139 | - wp_enqueue_style( 'thickbox' ); // @TODO remove once we have modal API. |
|
138 | + wp_enqueue_style('wp-color-picker'); |
|
139 | + wp_enqueue_style('thickbox'); // @TODO remove once we have modal API. |
|
140 | 140 | |
141 | 141 | } |
142 | 142 | |
@@ -147,27 +147,27 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @param string $hook Page hook. |
149 | 149 | */ |
150 | - public function admin_enqueue_scripts( $hook ) { |
|
150 | + public function admin_enqueue_scripts($hook) { |
|
151 | 151 | global $pagenow; |
152 | 152 | |
153 | 153 | // Plugin page script |
154 | - if ( 'plugins.php' === $pagenow ) { |
|
154 | + if ('plugins.php' === $pagenow) { |
|
155 | 155 | $this->plugin_equeue_scripts(); |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Give Admin Only. |
159 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
159 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // WP Scripts. |
164 | - wp_enqueue_script( 'wp-color-picker' ); |
|
165 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
166 | - wp_enqueue_script( 'thickbox' ); |
|
164 | + wp_enqueue_script('wp-color-picker'); |
|
165 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
166 | + wp_enqueue_script('thickbox'); |
|
167 | 167 | wp_enqueue_media(); |
168 | 168 | |
169 | 169 | // Give admin scripts. |
170 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
170 | + wp_enqueue_script('give-admin-scripts'); |
|
171 | 171 | |
172 | 172 | // Localize admin scripts |
173 | 173 | $this->admin_localize_scripts(); |
@@ -183,19 +183,19 @@ discard block |
||
183 | 183 | * |
184 | 184 | */ |
185 | 185 | private function plugin_equeue_scripts() { |
186 | - wp_enqueue_style( 'plugin-deactivation-survey-css' ); |
|
187 | - wp_enqueue_script( 'plugin-deactivation-survey-js' ); |
|
186 | + wp_enqueue_style('plugin-deactivation-survey-css'); |
|
187 | + wp_enqueue_script('plugin-deactivation-survey-js'); |
|
188 | 188 | |
189 | 189 | $localized_data = array( |
190 | - 'nonce' => wp_create_nonce( 'deactivation_survey_nonce' ), |
|
191 | - 'cancel' => __( 'Cancel', 'give' ), |
|
192 | - 'deactivation_no_option_selected' => __( 'Error: Please select at least one option.', 'give' ), |
|
193 | - 'submit_and_deactivate' => __( 'Submit and Deactivate', 'give' ), |
|
194 | - 'skip_and_deactivate' => __( 'Skip & Deactivate', 'give' ), |
|
195 | - 'please_fill_field' => __( 'Error: Please fill the field.', 'give' ), |
|
190 | + 'nonce' => wp_create_nonce('deactivation_survey_nonce'), |
|
191 | + 'cancel' => __('Cancel', 'give'), |
|
192 | + 'deactivation_no_option_selected' => __('Error: Please select at least one option.', 'give'), |
|
193 | + 'submit_and_deactivate' => __('Submit and Deactivate', 'give'), |
|
194 | + 'skip_and_deactivate' => __('Skip & Deactivate', 'give'), |
|
195 | + 'please_fill_field' => __('Error: Please fill the field.', 'give'), |
|
196 | 196 | |
197 | 197 | ); |
198 | - wp_localize_script( 'plugin-deactivation-survey-js', 'give_vars', $localized_data ); |
|
198 | + wp_localize_script('plugin-deactivation-survey-js', 'give_vars', $localized_data); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -212,119 +212,119 @@ discard block |
||
212 | 212 | |
213 | 213 | // Localize strings & variables for JS. |
214 | 214 | $localized_data = array( |
215 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
215 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
216 | 216 | 'give_version' => GIVE_VERSION, |
217 | 217 | 'thousands_separator' => $thousand_separator, |
218 | 218 | 'decimal_separator' => $decimal_separator, |
219 | - 'quick_edit_warning' => __( 'Not available for variable priced forms.', 'give' ), |
|
220 | - 'delete_payment' => __( 'Are you sure you want to <strong>permanently</strong> delete this donation?', 'give' ), |
|
221 | - 'delete_payment_note' => __( 'Are you sure you want to delete this note?', 'give' ), |
|
222 | - 'revoke_api_key' => __( 'Are you sure you want to revoke this API key?', 'give' ), |
|
223 | - 'regenerate_api_key' => __( 'Are you sure you want to regenerate this API key?', 'give' ), |
|
224 | - 'resend_receipt' => __( 'Are you sure you want to resend the donation receipt?', 'give' ), |
|
225 | - 'disconnect_user' => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ), |
|
226 | - 'one_option' => __( 'Choose a form', 'give' ), |
|
227 | - 'one_or_more_option' => __( 'Choose one or more forms', 'give' ), |
|
228 | - 'currency_sign' => give_currency_filter( '' ), |
|
229 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
219 | + 'quick_edit_warning' => __('Not available for variable priced forms.', 'give'), |
|
220 | + 'delete_payment' => __('Are you sure you want to <strong>permanently</strong> delete this donation?', 'give'), |
|
221 | + 'delete_payment_note' => __('Are you sure you want to delete this note?', 'give'), |
|
222 | + 'revoke_api_key' => __('Are you sure you want to revoke this API key?', 'give'), |
|
223 | + 'regenerate_api_key' => __('Are you sure you want to regenerate this API key?', 'give'), |
|
224 | + 'resend_receipt' => __('Are you sure you want to resend the donation receipt?', 'give'), |
|
225 | + 'disconnect_user' => __('Are you sure you want to disconnect the user from this donor?', 'give'), |
|
226 | + 'one_option' => __('Choose a form', 'give'), |
|
227 | + 'one_or_more_option' => __('Choose one or more forms', 'give'), |
|
228 | + 'currency_sign' => give_currency_filter(''), |
|
229 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
230 | 230 | 'currency_decimals' => give_get_price_decimals(), |
231 | - 'ok' => __( 'Ok', 'give' ), |
|
232 | - 'cancel' => __( 'Cancel', 'give' ), |
|
233 | - 'success' => __( 'Success', 'give' ), |
|
234 | - 'error' => __( 'Error', 'give' ), |
|
235 | - 'close' => __( 'Close', 'give' ), |
|
236 | - 'confirm' => __( 'Confirm', 'give' ), |
|
237 | - 'confirm_action' => __( 'Confirm Action', 'give' ), |
|
238 | - 'confirm_deletion' => __( 'Confirm Deletion', 'give' ), |
|
239 | - 'confirm_delete_donation' => __( 'Confirm Delete Donation', 'give' ), |
|
240 | - 'confirm_resend' => __( 'Confirm re-send', 'give' ), |
|
241 | - 'confirm_bulk_action' => __( 'Confirm bulk action', 'give' ), |
|
242 | - 'restart_upgrade' => __( 'Do you want to restart the update process?', 'give' ), |
|
243 | - 'restart_update' => __( 'It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ), |
|
244 | - 'stop_upgrade' => __( 'Do you want to stop the update process now?', 'give' ), |
|
245 | - 'import_failed' => __( 'Import failed', 'give' ), |
|
246 | - 'flush_success' => __( 'Flush success', 'give' ), |
|
247 | - 'flush_error' => __( 'Flush error', 'give' ), |
|
248 | - 'no_form_selected' => __( 'No form selected', 'give' ), |
|
249 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
250 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
251 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
252 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
253 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
254 | - 'price_format_guide' => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ), |
|
231 | + 'ok' => __('Ok', 'give'), |
|
232 | + 'cancel' => __('Cancel', 'give'), |
|
233 | + 'success' => __('Success', 'give'), |
|
234 | + 'error' => __('Error', 'give'), |
|
235 | + 'close' => __('Close', 'give'), |
|
236 | + 'confirm' => __('Confirm', 'give'), |
|
237 | + 'confirm_action' => __('Confirm Action', 'give'), |
|
238 | + 'confirm_deletion' => __('Confirm Deletion', 'give'), |
|
239 | + 'confirm_delete_donation' => __('Confirm Delete Donation', 'give'), |
|
240 | + 'confirm_resend' => __('Confirm re-send', 'give'), |
|
241 | + 'confirm_bulk_action' => __('Confirm bulk action', 'give'), |
|
242 | + 'restart_upgrade' => __('Do you want to restart the update process?', 'give'), |
|
243 | + 'restart_update' => __('It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give'), |
|
244 | + 'stop_upgrade' => __('Do you want to stop the update process now?', 'give'), |
|
245 | + 'import_failed' => __('Import failed', 'give'), |
|
246 | + 'flush_success' => __('Flush success', 'give'), |
|
247 | + 'flush_error' => __('Flush error', 'give'), |
|
248 | + 'no_form_selected' => __('No form selected', 'give'), |
|
249 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
250 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
251 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
252 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
253 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
254 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
255 | 255 | /* translators : %s: Donation form options metabox */ |
256 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this item?', 'give' ), |
|
257 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
258 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
259 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
260 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
261 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
262 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
263 | - 'unlock_donor_fields_title' => __( 'Action forbidden', 'give' ), |
|
264 | - 'unlock_donor_fields_message' => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ), |
|
265 | - 'remove_from_bulk_delete' => __( 'Remove from Bulk Delete', 'give' ), |
|
256 | + 'confirm_before_remove_row_text' => __('Do you want to delete this item?', 'give'), |
|
257 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
258 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
259 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
260 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
261 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
262 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
263 | + 'unlock_donor_fields_title' => __('Action forbidden', 'give'), |
|
264 | + 'unlock_donor_fields_message' => __('To edit first name and last name, please go to user profile of the donor.', 'give'), |
|
265 | + 'remove_from_bulk_delete' => __('Remove from Bulk Delete', 'give'), |
|
266 | 266 | 'donors_bulk_action' => array( |
267 | 267 | 'no_donor_selected' => array( |
268 | - 'title' => __( 'No donors selected', 'give' ), |
|
269 | - 'desc' => __( 'You must choose at least one or more donors to delete.', 'give' ) |
|
268 | + 'title' => __('No donors selected', 'give'), |
|
269 | + 'desc' => __('You must choose at least one or more donors to delete.', 'give') |
|
270 | 270 | ), |
271 | 271 | 'no_action_selected' => array( |
272 | - 'title' => __( 'No action selected', 'give' ), |
|
273 | - 'desc' => __( 'You must select a bulk action to proceed.', 'give' ), |
|
272 | + 'title' => __('No action selected', 'give'), |
|
273 | + 'desc' => __('You must select a bulk action to proceed.', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | 'donations_bulk_action' => array( |
277 | 277 | 'titles' => array( |
278 | - 'zero' => __( 'No payments selected', 'give' ), |
|
278 | + 'zero' => __('No payments selected', 'give'), |
|
279 | 279 | ), |
280 | 280 | 'delete' => array( |
281 | - 'zero' => __( 'You must choose at least one or more donations to delete.', 'give' ), |
|
282 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
283 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
281 | + 'zero' => __('You must choose at least one or more donations to delete.', 'give'), |
|
282 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
283 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
284 | 284 | ), |
285 | 285 | 'resend-receipt' => array( |
286 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
287 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
288 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
286 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
287 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
288 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
289 | 289 | ), |
290 | 290 | 'set-to-status' => array( |
291 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
292 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
293 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
291 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
292 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
293 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
294 | 294 | ), |
295 | 295 | ), |
296 | 296 | 'updates' => array( |
297 | - 'ajax_error' => __( 'Please reload this page and try again', 'give' ), |
|
297 | + 'ajax_error' => __('Please reload this page and try again', 'give'), |
|
298 | 298 | ), |
299 | 299 | 'metabox_fields' => array( |
300 | 300 | 'media' => array( |
301 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
301 | + 'button_title' => __('Choose Image', 'give'), |
|
302 | 302 | ), |
303 | 303 | 'file' => array( |
304 | - 'button_title' => __( 'Choose File', 'give' ), |
|
304 | + 'button_title' => __('Choose File', 'give'), |
|
305 | 305 | ), |
306 | 306 | ), |
307 | 307 | 'chosen' => array( |
308 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
309 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
308 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
309 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
310 | 310 | ), |
311 | - 'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ), |
|
312 | - 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ), |
|
313 | - 'error_message' => __( 'Something went wrong kindly try again!', 'give' ), |
|
311 | + 'db_update_confirmation_msg_button' => __('Run Updates', 'give'), |
|
312 | + 'db_update_confirmation_msg' => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'), |
|
313 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
314 | 314 | 'give_donation_import' => 'give_donation_import', |
315 | 315 | 'core_settings_import' => 'give_core_settings_import', |
316 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ), |
|
316 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
317 | 317 | 'give_donation_amounts' => array( |
318 | - 'minimum' => apply_filters( 'give_donation_minimum_limit', 1 ), |
|
319 | - 'maximum' => apply_filters( 'give_donation_maximum_limit', 999999.99 ), |
|
318 | + 'minimum' => apply_filters('give_donation_minimum_limit', 1), |
|
319 | + 'maximum' => apply_filters('give_donation_maximum_limit', 999999.99), |
|
320 | 320 | ), |
321 | - 'chosen_add_title_prefix' => __( 'No result found. Press enter to add', 'give' ), |
|
322 | - 'db_update_nonce' => wp_create_nonce( Give_Updates::$background_updater->get_identifier() ), |
|
321 | + 'chosen_add_title_prefix' => __('No result found. Press enter to add', 'give'), |
|
322 | + 'db_update_nonce' => wp_create_nonce(Give_Updates::$background_updater->get_identifier()), |
|
323 | 323 | 'ajax' => give_test_ajax_works(), |
324 | 324 | 'date_format' => give_get_localized_date_format_to_js(), |
325 | 325 | ); |
326 | 326 | |
327 | - wp_localize_script( 'give-admin-scripts', 'give_vars', $localized_data ); |
|
327 | + wp_localize_script('give-admin-scripts', 'give_vars', $localized_data); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | <style type="text/css" media="screen"> |
336 | 336 | @font-face { |
337 | 337 | font-family: 'give-icomoon'; |
338 | - src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?ngjl88'; ?>'); |
|
339 | - src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
340 | - url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
341 | - url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
338 | + src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?ngjl88'; ?>'); |
|
339 | + src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
340 | + url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
341 | + url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
342 | 342 | font-weight: normal; |
343 | 343 | font-style: normal; |
344 | 344 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @since 2.1.0 |
362 | 362 | */ |
363 | 363 | public function public_enqueue_styles() { |
364 | - wp_enqueue_style( 'give-styles' ); |
|
364 | + wp_enqueue_style('give-styles'); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -373,17 +373,17 @@ discard block |
||
373 | 373 | public function public_enqueue_scripts() { |
374 | 374 | |
375 | 375 | // Call Babel Polyfill with common handle so that it is compatible with plugins and themes. |
376 | - if ( ! wp_script_is( 'babel-polyfill', 'enqueued' ) ) { |
|
376 | + if ( ! wp_script_is('babel-polyfill', 'enqueued')) { |
|
377 | 377 | wp_enqueue_script( |
378 | 378 | 'babel-polyfill', |
379 | - GIVE_PLUGIN_URL . 'assets/dist/js/babel-polyfill.js', |
|
380 | - array( 'jquery' ), |
|
379 | + GIVE_PLUGIN_URL.'assets/dist/js/babel-polyfill.js', |
|
380 | + array('jquery'), |
|
381 | 381 | GIVE_VERSION, |
382 | 382 | false |
383 | 383 | ); |
384 | 384 | } |
385 | 385 | |
386 | - wp_enqueue_script( 'give' ); |
|
386 | + wp_enqueue_script('give'); |
|
387 | 387 | |
388 | 388 | $this->public_localize_scripts(); |
389 | 389 | } |
@@ -402,22 +402,22 @@ discard block |
||
402 | 402 | * |
403 | 403 | * @return string $message Send notice message for email access. |
404 | 404 | */ |
405 | - $message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) ); |
|
405 | + $message = (string) apply_filters('give_email_access_mail_send_notice', __('Please check your email and click on the link to access your complete donation history.', 'give')); |
|
406 | 406 | |
407 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
407 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
408 | 408 | 'ajaxurl' => give_get_ajax_url(), |
409 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
409 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
410 | 410 | // Do not use this nonce. Its deprecated. |
411 | 411 | 'currency' => give_get_currency(), |
412 | - 'currency_sign' => give_currency_filter( '' ), |
|
412 | + 'currency_sign' => give_currency_filter(''), |
|
413 | 413 | 'currency_pos' => give_get_currency_position(), |
414 | 414 | 'thousands_separator' => give_get_price_thousand_separator(), |
415 | 415 | 'decimal_separator' => give_get_price_decimal_separator(), |
416 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
417 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
418 | - 'bad_maximum' => __( 'The maximum custom donation amount for this form is', 'give' ), |
|
419 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
420 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
416 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
417 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
418 | + 'bad_maximum' => __('The maximum custom donation amount for this form is', 'give'), |
|
419 | + 'general_loading' => __('Loading...', 'give'), |
|
420 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
421 | 421 | 'number_decimals' => give_get_price_decimals(), |
422 | 422 | 'give_version' => GIVE_VERSION, |
423 | 423 | 'magnific_options' => apply_filters( |
@@ -431,32 +431,32 @@ discard block |
||
431 | 431 | 'give_form_translation_js', |
432 | 432 | array( |
433 | 433 | // Field name Validation message. |
434 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
435 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
436 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
437 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
438 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
439 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
440 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
434 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
435 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
436 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
437 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
438 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
439 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
440 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
441 | 441 | ) |
442 | 442 | ), |
443 | 443 | 'confirm_email_sent_message' => $message, |
444 | - 'ajax_vars' => apply_filters( 'give_global_ajax_vars', array( |
|
444 | + 'ajax_vars' => apply_filters('give_global_ajax_vars', array( |
|
445 | 445 | 'ajaxurl' => give_get_ajax_url(), |
446 | - 'ajaxNonce' => wp_create_nonce( 'give_ajax_nonce' ), |
|
447 | - 'loading' => __( 'Loading', 'give' ), |
|
446 | + 'ajaxNonce' => wp_create_nonce('give_ajax_nonce'), |
|
447 | + 'loading' => __('Loading', 'give'), |
|
448 | 448 | // General loading message. |
449 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
449 | + 'select_option' => __('Please select an option', 'give'), |
|
450 | 450 | // Variable pricing error with multi-donation option enabled. |
451 | - 'default_gateway' => give_get_default_gateway( null ), |
|
452 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
451 | + 'default_gateway' => give_get_default_gateway(null), |
|
452 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
453 | 453 | 'number_decimals' => give_get_price_decimals(), |
454 | - ) ), |
|
454 | + )), |
|
455 | 455 | 'cookie_hash' => COOKIEHASH, |
456 | - 'delete_session_nonce_cookie' => absint( Give()->session->is_delete_nonce_cookie() ) |
|
457 | - ) ); |
|
456 | + 'delete_session_nonce_cookie' => absint(Give()->session->is_delete_nonce_cookie()) |
|
457 | + )); |
|
458 | 458 | |
459 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
459 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | |
@@ -470,15 +470,15 @@ discard block |
||
470 | 470 | */ |
471 | 471 | public function get_frontend_stylesheet_uri() { |
472 | 472 | |
473 | - $file = 'give' . $this->direction . '.css'; |
|
473 | + $file = 'give'.$this->direction.'.css'; |
|
474 | 474 | $templates_dir = give_get_theme_template_dir_name(); |
475 | 475 | |
476 | 476 | // Directory paths to CSS files to support checking via file_exists(). |
477 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
478 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
479 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
480 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
481 | - $give_plugin_style_sheet = trailingslashit( GIVE_PLUGIN_DIR ) . 'assets/dist/css/' . $file; |
|
477 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
478 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$this->direction.'.css'; |
|
479 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
480 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$this->direction.'.css'; |
|
481 | + $give_plugin_style_sheet = trailingslashit(GIVE_PLUGIN_DIR).'assets/dist/css/'.$file; |
|
482 | 482 | $uri = false; |
483 | 483 | |
484 | 484 | /** |
@@ -489,23 +489,23 @@ discard block |
||
489 | 489 | * c. followed by non minified version, even if SCRIPT_DEBUG is not enabled. This allows users to copy just give.css to their theme. |
490 | 490 | * d. Finally, fallback to the standard Give version. This is the default styles included within the plugin. |
491 | 491 | */ |
492 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
493 | - if ( ! empty( $nonmin ) ) { |
|
494 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
492 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
493 | + if ( ! empty($nonmin)) { |
|
494 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$this->direction.'.css'; |
|
495 | 495 | } else { |
496 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
496 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
497 | 497 | } |
498 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
499 | - if ( ! empty( $nonmin ) ) { |
|
500 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
498 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
499 | + if ( ! empty($nonmin)) { |
|
500 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$this->direction.'.css'; |
|
501 | 501 | } else { |
502 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
502 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
503 | 503 | } |
504 | - } elseif ( file_exists( $give_plugin_style_sheet ) ) { |
|
505 | - $uri = trailingslashit( GIVE_PLUGIN_URL ) . 'assets/dist/css/' . $file; |
|
504 | + } elseif (file_exists($give_plugin_style_sheet)) { |
|
505 | + $uri = trailingslashit(GIVE_PLUGIN_URL).'assets/dist/css/'.$file; |
|
506 | 506 | } |
507 | 507 | |
508 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
508 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
509 | 509 | |
510 | 510 | } |
511 | 511 | |
@@ -517,18 +517,18 @@ discard block |
||
517 | 517 | // Enqueue the bundled block JS file |
518 | 518 | wp_enqueue_script( |
519 | 519 | 'give-blocks-js', |
520 | - GIVE_PLUGIN_URL . 'assets/dist/js/gutenberg.js', |
|
521 | - array( 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api' ), |
|
520 | + GIVE_PLUGIN_URL.'assets/dist/js/gutenberg.js', |
|
521 | + array('wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api'), |
|
522 | 522 | GIVE_VERSION |
523 | 523 | ); |
524 | 524 | |
525 | 525 | // Enqueue public styles |
526 | - wp_enqueue_style( 'give-styles' ); |
|
526 | + wp_enqueue_style('give-styles'); |
|
527 | 527 | |
528 | 528 | // Enqueue the bundled block css file |
529 | 529 | wp_enqueue_style( |
530 | 530 | 'give-blocks-css', |
531 | - GIVE_PLUGIN_URL . 'assets/dist/css/gutenberg.css', |
|
531 | + GIVE_PLUGIN_URL.'assets/dist/css/gutenberg.css', |
|
532 | 532 | array( ), |
533 | 533 | GIVE_VERSION |
534 | 534 | ); |
@@ -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,35 +23,35 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string Donation form. |
25 | 25 | */ |
26 | -function give_get_donation_form( $args = array() ) { |
|
26 | +function give_get_donation_form($args = array()) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | static $count = 1; |
30 | 30 | |
31 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
31 | + $form_id = is_object($post) ? $post->ID : 0; |
|
32 | 32 | |
33 | - if ( isset( $args['id'] ) ) { |
|
33 | + if (isset($args['id'])) { |
|
34 | 34 | $form_id = $args['id']; |
35 | 35 | } |
36 | 36 | |
37 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
37 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
38 | 38 | 'form_id' => $form_id, |
39 | - ) ); |
|
39 | + )); |
|
40 | 40 | |
41 | - $args = wp_parse_args( $args, $defaults ); |
|
41 | + $args = wp_parse_args($args, $defaults); |
|
42 | 42 | |
43 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
43 | + $form = new Give_Donate_Form($args['form_id']); |
|
44 | 44 | |
45 | 45 | // Bail out, if no form ID. |
46 | - if ( empty( $form->ID ) ) { |
|
46 | + if (empty($form->ID)) { |
|
47 | 47 | return false; |
48 | 48 | } |
49 | 49 | |
50 | 50 | $args['id_prefix'] = "{$form_id}-{$count}"; |
51 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
51 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
52 | 52 | |
53 | 53 | $form_action = add_query_arg( |
54 | - apply_filters( 'give_form_action_args', array( |
|
54 | + apply_filters('give_form_action_args', array( |
|
55 | 55 | 'payment-mode' => $payment_mode, |
56 | 56 | ) |
57 | 57 | ), |
@@ -60,17 +60,17 @@ discard block |
||
60 | 60 | |
61 | 61 | // Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
62 | 62 | if ( |
63 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
64 | - || ( 'trash' === $form->post_status ) |
|
63 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
64 | + || ('trash' === $form->post_status) |
|
65 | 65 | ) { |
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | |
69 | 69 | // Get the form wrap CSS classes. |
70 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
70 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
71 | 71 | |
72 | 72 | // Get the <form> tag wrap CSS classes. |
73 | - $form_classes = $form->get_form_classes( $args ); |
|
73 | + $form_classes = $form->get_form_classes($args); |
|
74 | 74 | |
75 | 75 | ob_start(); |
76 | 76 | |
@@ -82,21 +82,21 @@ discard block |
||
82 | 82 | * @param int $form_id The form ID. |
83 | 83 | * @param array $args An array of form arguments. |
84 | 84 | */ |
85 | - do_action( 'give_pre_form_output', $form->ID, $args, $form ); |
|
85 | + do_action('give_pre_form_output', $form->ID, $args, $form); |
|
86 | 86 | |
87 | 87 | ?> |
88 | 88 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
89 | 89 | <?php |
90 | - if ( $form->is_close_donation_form() ) { |
|
90 | + if ($form->is_close_donation_form()) { |
|
91 | 91 | |
92 | - $form_title = ! is_singular( 'give_forms' ) ? apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ) : ''; |
|
92 | + $form_title = ! is_singular('give_forms') ? apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>') : ''; |
|
93 | 93 | |
94 | 94 | // Get Goal thank you message. |
95 | - $goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
96 | - $goal_achieved_message = ! empty( $goal_achieved_message ) ? $form_title . apply_filters( 'the_content', $goal_achieved_message ) : ''; |
|
95 | + $goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
96 | + $goal_achieved_message = ! empty($goal_achieved_message) ? $form_title.apply_filters('the_content', $goal_achieved_message) : ''; |
|
97 | 97 | |
98 | 98 | // Print thank you message. |
99 | - echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form ); |
|
99 | + echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form); |
|
100 | 100 | |
101 | 101 | } else { |
102 | 102 | /** |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | * 1. if show_title params set to true |
105 | 105 | * 2. if admin set form display_style to button |
106 | 106 | */ |
107 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
107 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
108 | 108 | if ( |
109 | 109 | ( |
110 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
111 | - || ( 'button' === get_post_meta( $form_id, '_give_payment_display', true ) ) |
|
110 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
111 | + || ('button' === get_post_meta($form_id, '_give_payment_display', true)) |
|
112 | 112 | ) |
113 | - && ! doing_action( 'give_single_form_summary' ) |
|
113 | + && ! doing_action('give_single_form_summary') |
|
114 | 114 | ) { |
115 | 115 | echo $form_title; |
116 | 116 | } |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | * @param array $args An array of form arguments. |
125 | 125 | * @param Give_Donate_Form $form Form object. |
126 | 126 | */ |
127 | - do_action( 'give_pre_form', $form->ID, $args, $form ); |
|
127 | + do_action('give_pre_form', $form->ID, $args, $form); |
|
128 | 128 | |
129 | 129 | // Set form html tags. |
130 | 130 | $form_html_tags = array( |
131 | 131 | 'id' => "give-form-{$args['id_prefix']}", |
132 | 132 | 'class' => $form_classes, |
133 | - 'action' => esc_url_raw( $form_action ), |
|
133 | + 'action' => esc_url_raw($form_action), |
|
134 | 134 | 'data-id' => $args['id_prefix'], |
135 | 135 | ); |
136 | 136 | |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | * @param array $form_html_tags Array of form html tags. |
143 | 143 | * @param Give_Donate_Form $form Form object. |
144 | 144 | */ |
145 | - $form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form ); |
|
145 | + $form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form); |
|
146 | 146 | ?> |
147 | - <form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post"> |
|
147 | + <form <?php echo give_get_attribute_str($form_html_tags); ?> method="post"> |
|
148 | 148 | <!-- The following field is for robots only, invisible to humans: --> |
149 | 149 | <span class="give-hidden" style="display: none !important;"> |
150 | 150 | <label for="give-form-honeypot-<?php echo $form_id; ?>"></label> |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param array $args An array of form arguments. |
163 | 163 | * @param Give_Donate_Form $form Form object. |
164 | 164 | */ |
165 | - do_action( 'give_donation_form_top', $form->ID, $args, $form ); |
|
165 | + do_action('give_donation_form_top', $form->ID, $args, $form); |
|
166 | 166 | |
167 | 167 | /** |
168 | 168 | * Fires while outputting donation form, for payment gateway fields. |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param array $args An array of form arguments. |
174 | 174 | * @param Give_Donate_Form $form Form object. |
175 | 175 | */ |
176 | - do_action( 'give_payment_mode_select', $form->ID, $args, $form ); |
|
176 | + do_action('give_payment_mode_select', $form->ID, $args, $form); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Fires while outputting donation form, after all other fields. |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @param array $args An array of form arguments. |
185 | 185 | * @param Give_Donate_Form $form Form object. |
186 | 186 | */ |
187 | - do_action( 'give_donation_form_bottom', $form->ID, $args, $form ); |
|
187 | + do_action('give_donation_form_bottom', $form->ID, $args, $form); |
|
188 | 188 | |
189 | 189 | ?> |
190 | 190 | </form> |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | * @param array $args An array of form arguments. |
200 | 200 | * @param Give_Donate_Form $form Form object. |
201 | 201 | */ |
202 | - do_action( 'give_post_form', $form->ID, $args, $form ); |
|
202 | + do_action('give_post_form', $form->ID, $args, $form); |
|
203 | 203 | |
204 | 204 | } |
205 | 205 | ?> |
206 | 206 | |
207 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
207 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
208 | 208 | <?php |
209 | 209 | |
210 | 210 | /** |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | * @param int $form_id The form ID. |
216 | 216 | * @param array $args An array of form arguments. |
217 | 217 | */ |
218 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
218 | + do_action('give_post_form_output', $form->ID, $args); |
|
219 | 219 | |
220 | 220 | $final_output = ob_get_clean(); |
221 | - $count ++; |
|
221 | + $count++; |
|
222 | 222 | |
223 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
223 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -237,11 +237,11 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return string |
239 | 239 | */ |
240 | -function give_show_purchase_form( $form_id, $args ) { |
|
240 | +function give_show_purchase_form($form_id, $args) { |
|
241 | 241 | |
242 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
242 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
243 | 243 | |
244 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
244 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
245 | 245 | $form_id = $_POST['give_form_id']; |
246 | 246 | } |
247 | 247 | |
@@ -250,33 +250,33 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @since 1.7 |
252 | 252 | */ |
253 | - do_action( 'give_payment_fields_top', $form_id ); |
|
253 | + do_action('give_payment_fields_top', $form_id); |
|
254 | 254 | |
255 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
255 | + if (give_can_checkout() && isset($form_id)) { |
|
256 | 256 | |
257 | 257 | /** |
258 | 258 | * Fires while displaying donation form, before registration login. |
259 | 259 | * |
260 | 260 | * @since 1.7 |
261 | 261 | */ |
262 | - do_action( 'give_donation_form_before_register_login', $form_id, $args ); |
|
262 | + do_action('give_donation_form_before_register_login', $form_id, $args); |
|
263 | 263 | |
264 | 264 | /** |
265 | 265 | * Fire when register/login form fields render. |
266 | 266 | * |
267 | 267 | * @since 1.7 |
268 | 268 | */ |
269 | - do_action( 'give_donation_form_register_login_fields', $form_id, $args ); |
|
269 | + do_action('give_donation_form_register_login_fields', $form_id, $args); |
|
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Fire when credit card form fields render. |
273 | 273 | * |
274 | 274 | * @since 1.7 |
275 | 275 | */ |
276 | - do_action( 'give_donation_form_before_cc_form', $form_id, $args ); |
|
276 | + do_action('give_donation_form_before_cc_form', $form_id, $args); |
|
277 | 277 | |
278 | 278 | // Load the credit card form and allow gateways to load their own if they wish. |
279 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
279 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
280 | 280 | /** |
281 | 281 | * Fires while displaying donation form, credit card form fields for a given gateway. |
282 | 282 | * |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @param int $form_id The form ID. |
286 | 286 | */ |
287 | - do_action( "give_{$payment_mode}_cc_form", $form_id, $args ); |
|
287 | + do_action("give_{$payment_mode}_cc_form", $form_id, $args); |
|
288 | 288 | } else { |
289 | 289 | /** |
290 | 290 | * Fires while displaying donation form, credit card form fields. |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @param int $form_id The form ID. |
295 | 295 | */ |
296 | - do_action( 'give_cc_form', $form_id, $args ); |
|
296 | + do_action('give_cc_form', $form_id, $args); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @since 1.7 |
303 | 303 | */ |
304 | - do_action( 'give_donation_form_after_cc_form', $form_id, $args ); |
|
304 | + do_action('give_donation_form_after_cc_form', $form_id, $args); |
|
305 | 305 | |
306 | 306 | } else { |
307 | 307 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * |
310 | 310 | * @since 1.7 |
311 | 311 | */ |
312 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
312 | + do_action('give_donation_form_no_access', $form_id); |
|
313 | 313 | |
314 | 314 | } |
315 | 315 | |
@@ -318,10 +318,10 @@ discard block |
||
318 | 318 | * |
319 | 319 | * @since 1.7 |
320 | 320 | */ |
321 | - do_action( 'give_payment_fields_bottom', $form_id, $args ); |
|
321 | + do_action('give_payment_fields_bottom', $form_id, $args); |
|
322 | 322 | } |
323 | 323 | |
324 | -add_action( 'give_donation_form', 'give_show_purchase_form', 10, 2 ); |
|
324 | +add_action('give_donation_form', 'give_show_purchase_form', 10, 2); |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * Give Show Login/Register Form Fields. |
@@ -332,11 +332,11 @@ discard block |
||
332 | 332 | * |
333 | 333 | * @return void |
334 | 334 | */ |
335 | -function give_show_register_login_fields( $form_id ) { |
|
335 | +function give_show_register_login_fields($form_id) { |
|
336 | 336 | |
337 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
337 | + $show_register_form = give_show_login_register_option($form_id); |
|
338 | 338 | |
339 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
339 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
340 | 340 | ?> |
341 | 341 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
342 | 342 | <?php |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | * |
346 | 346 | * @since 1.7 |
347 | 347 | */ |
348 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
348 | + do_action('give_donation_form_register_fields', $form_id); |
|
349 | 349 | ?> |
350 | 350 | </div> |
351 | 351 | <?php |
352 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
352 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
353 | 353 | ?> |
354 | 354 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
355 | 355 | <?php |
@@ -358,23 +358,23 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @since 1.7 |
360 | 360 | */ |
361 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
361 | + do_action('give_donation_form_login_fields', $form_id); |
|
362 | 362 | ?> |
363 | 363 | </div> |
364 | 364 | <?php |
365 | 365 | endif; |
366 | 366 | |
367 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
367 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
368 | 368 | /** |
369 | 369 | * Fire when user info render. |
370 | 370 | * |
371 | 371 | * @since 1.7 |
372 | 372 | */ |
373 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
373 | + do_action('give_donation_form_after_user_info', $form_id); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
377 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Donation Amount Field. |
@@ -389,16 +389,16 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @return void |
391 | 391 | */ |
392 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
392 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
393 | 393 | |
394 | 394 | $give_options = give_get_settings(); |
395 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
396 | - $allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
397 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
398 | - $symbol = give_currency_symbol( give_get_currency( $form_id, $args ) ); |
|
399 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
400 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false, 'currency' => give_get_currency( $form_id ) ) ); |
|
401 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
395 | + $variable_pricing = give_has_variable_prices($form_id); |
|
396 | + $allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
397 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
398 | + $symbol = give_currency_symbol(give_get_currency($form_id, $args)); |
|
399 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
400 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false, 'currency' => give_get_currency($form_id))); |
|
401 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
402 | 402 | |
403 | 403 | /** |
404 | 404 | * Fires while displaying donation form, before donation level fields. |
@@ -408,20 +408,20 @@ discard block |
||
408 | 408 | * @param int $form_id The form ID. |
409 | 409 | * @param array $args An array of form arguments. |
410 | 410 | */ |
411 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
411 | + do_action('give_before_donation_levels', $form_id, $args); |
|
412 | 412 | |
413 | 413 | // Set Price, No Custom Amount Allowed means hidden price field. |
414 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
414 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
415 | 415 | ?> |
416 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
416 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
417 | 417 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
418 | 418 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
419 | 419 | <div class="set-price give-donation-amount form-row-wide"> |
420 | - <?php if ( $currency_position == 'before' ) { |
|
420 | + <?php if ($currency_position == 'before') { |
|
421 | 421 | echo $currency_output; |
422 | 422 | } ?> |
423 | 423 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
424 | - <?php if ( $currency_position == 'after' ) { |
|
424 | + <?php if ($currency_position == 'after') { |
|
425 | 425 | echo $currency_output; |
426 | 426 | } ?> |
427 | 427 | </div> |
@@ -431,13 +431,13 @@ discard block |
||
431 | 431 | ?> |
432 | 432 | <div class="give-total-wrap"> |
433 | 433 | <div class="give-donation-amount form-row-wide"> |
434 | - <?php if ( $currency_position == 'before' ) { |
|
434 | + <?php if ($currency_position == 'before') { |
|
435 | 435 | echo $currency_output; |
436 | 436 | } ?> |
437 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
437 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
438 | 438 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
439 | 439 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
440 | - <?php if ( $currency_position == 'after' ) { |
|
440 | + <?php if ($currency_position == 'after') { |
|
441 | 441 | echo $currency_output; |
442 | 442 | } ?> |
443 | 443 | </div> |
@@ -452,16 +452,16 @@ discard block |
||
452 | 452 | * @param int $form_id The form ID. |
453 | 453 | * @param array $args An array of form arguments. |
454 | 454 | */ |
455 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
455 | + do_action('give_after_donation_amount', $form_id, $args); |
|
456 | 456 | |
457 | 457 | // Custom Amount Text |
458 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
458 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
459 | 459 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
460 | 460 | <?php } |
461 | 461 | |
462 | 462 | // Output Variable Pricing Levels. |
463 | - if ( $variable_pricing ) { |
|
464 | - give_output_levels( $form_id ); |
|
463 | + if ($variable_pricing) { |
|
464 | + give_output_levels($form_id); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
@@ -472,10 +472,10 @@ discard block |
||
472 | 472 | * @param int $form_id The form ID. |
473 | 473 | * @param array $args An array of form arguments. |
474 | 474 | */ |
475 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
475 | + do_action('give_after_donation_levels', $form_id, $args); |
|
476 | 476 | } |
477 | 477 | |
478 | -add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
478 | +add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2); |
|
479 | 479 | |
480 | 480 | /** |
481 | 481 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | * |
487 | 487 | * @return string Donation levels. |
488 | 488 | */ |
489 | -function give_output_levels( $form_id ) { |
|
489 | +function give_output_levels($form_id) { |
|
490 | 490 | |
491 | 491 | /** |
492 | 492 | * Filter the variable pricing |
@@ -499,47 +499,47 @@ discard block |
||
499 | 499 | * @param array $prices Array of variable prices. |
500 | 500 | * @param int $form Form ID. |
501 | 501 | */ |
502 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
502 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
503 | 503 | |
504 | 504 | |
505 | - $display_style = give_get_meta( $form_id, '_give_display_style', true ); |
|
506 | - $custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
507 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
505 | + $display_style = give_get_meta($form_id, '_give_display_style', true); |
|
506 | + $custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
507 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
508 | 508 | |
509 | - if ( empty( $custom_amount_text ) ) { |
|
510 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
509 | + if (empty($custom_amount_text)) { |
|
510 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | $output = ''; |
514 | 514 | |
515 | - switch ( $display_style ) { |
|
515 | + switch ($display_style) { |
|
516 | 516 | case 'buttons': |
517 | 517 | |
518 | 518 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
519 | 519 | |
520 | - foreach ( $prices as $price ) { |
|
521 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price ); |
|
522 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( give_is_default_level_id( $price ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
520 | + foreach ($prices as $price) { |
|
521 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price); |
|
522 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.(give_is_default_level_id($price) ? 'give-default-level' : ''), $form_id, $price); |
|
523 | 523 | |
524 | - $formatted_amount = give_format_amount( $price['_give_amount'], array( |
|
524 | + $formatted_amount = give_format_amount($price['_give_amount'], array( |
|
525 | 525 | 'sanitize' => false, |
526 | - 'currency' => give_get_currency( $form_id ), |
|
527 | - ) ); |
|
526 | + 'currency' => give_get_currency($form_id), |
|
527 | + )); |
|
528 | 528 | |
529 | 529 | $output .= sprintf( |
530 | 530 | '<li><button type="button" data-price-id="%1$s" class="%2$s" value="%3$s" data-default="%4$s">%5$s</button></li>', |
531 | 531 | $price['_give_id']['level_id'], |
532 | 532 | $level_classes, |
533 | 533 | $formatted_amount, |
534 | - array_key_exists( '_give_default', $price ) ? 1 : 0, |
|
534 | + array_key_exists('_give_default', $price) ? 1 : 0, |
|
535 | 535 | $level_text |
536 | 536 | ); |
537 | 537 | } |
538 | 538 | |
539 | 539 | // Custom Amount. |
540 | 540 | if ( |
541 | - give_is_setting_enabled( $custom_amount ) |
|
542 | - && ! empty( $custom_amount_text ) |
|
541 | + give_is_setting_enabled($custom_amount) |
|
542 | + && ! empty($custom_amount_text) |
|
543 | 543 | ) { |
544 | 544 | |
545 | 545 | $output .= sprintf( |
@@ -556,30 +556,30 @@ discard block |
||
556 | 556 | |
557 | 557 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
558 | 558 | |
559 | - foreach ( $prices as $price ) { |
|
560 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price ); |
|
561 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
559 | + foreach ($prices as $price) { |
|
560 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price); |
|
561 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].(give_is_default_level_id($price) ? ' give-default-level' : ''), $form_id, $price); |
|
562 | 562 | |
563 | - $formatted_amount = give_format_amount( $price['_give_amount'], array( |
|
563 | + $formatted_amount = give_format_amount($price['_give_amount'], array( |
|
564 | 564 | 'sanitize' => false, |
565 | - 'currency' => give_get_currency( $form_id ), |
|
566 | - ) ); |
|
565 | + 'currency' => give_get_currency($form_id), |
|
566 | + )); |
|
567 | 567 | |
568 | 568 | $output .= sprintf( |
569 | 569 | '<li><input type="radio" data-price-id="%1$s" class="%2$s" value="%3$s" name="give-radio-donation-level" id="give-radio-level-%1$s" %4$s data-default="%5$s"><label for="give-radio-level-%1$s">%6$s</label></li>', |
570 | 570 | $price['_give_id']['level_id'], |
571 | 571 | $level_classes, |
572 | 572 | $formatted_amount, |
573 | - ( give_is_default_level_id( $price ) ? 'checked="checked"' : '' ), |
|
574 | - array_key_exists( '_give_default', $price ) ? 1 : 0, |
|
573 | + (give_is_default_level_id($price) ? 'checked="checked"' : ''), |
|
574 | + array_key_exists('_give_default', $price) ? 1 : 0, |
|
575 | 575 | $level_text |
576 | 576 | ); |
577 | 577 | } |
578 | 578 | |
579 | 579 | // Custom Amount. |
580 | 580 | if ( |
581 | - give_is_setting_enabled( $custom_amount ) |
|
582 | - && ! empty( $custom_amount_text ) |
|
581 | + give_is_setting_enabled($custom_amount) |
|
582 | + && ! empty($custom_amount_text) |
|
583 | 583 | ) { |
584 | 584 | $output .= sprintf( |
585 | 585 | '<li><input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom"><label for="give-radio-level-custom">%1$s</label></li>', |
@@ -593,33 +593,33 @@ discard block |
||
593 | 593 | |
594 | 594 | case 'dropdown': |
595 | 595 | |
596 | - $output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
597 | - $output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
596 | + $output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
597 | + $output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
598 | 598 | |
599 | 599 | // first loop through prices. |
600 | - foreach ( $prices as $price ) { |
|
601 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price ); |
|
602 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id, |
|
603 | - $price ); |
|
600 | + foreach ($prices as $price) { |
|
601 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price); |
|
602 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].(give_is_default_level_id($price) ? ' give-default-level' : ''), $form_id, |
|
603 | + $price); |
|
604 | 604 | |
605 | - $formatted_amount = give_format_amount( $price['_give_amount'], array( |
|
605 | + $formatted_amount = give_format_amount($price['_give_amount'], array( |
|
606 | 606 | 'sanitize' => false, |
607 | - 'currency' => give_get_currency( $form_id ), |
|
608 | - ) ); |
|
607 | + 'currency' => give_get_currency($form_id), |
|
608 | + )); |
|
609 | 609 | |
610 | 610 | $output .= sprintf( |
611 | 611 | '<option data-price-id="%1$s" class="%2$s" value="%3$s" %4$s data-default="%5$s">%6$s</option>', |
612 | 612 | $price['_give_id']['level_id'], |
613 | 613 | $level_classes, |
614 | 614 | $formatted_amount, |
615 | - ( give_is_default_level_id( $price ) ? 'selected="selected"' : '' ), |
|
616 | - array_key_exists( '_give_default', $price ) ? 1 : 0, |
|
615 | + (give_is_default_level_id($price) ? 'selected="selected"' : ''), |
|
616 | + array_key_exists('_give_default', $price) ? 1 : 0, |
|
617 | 617 | $level_text |
618 | 618 | ); |
619 | 619 | } |
620 | 620 | |
621 | 621 | // Custom Amount. |
622 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
622 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
623 | 623 | $output .= sprintf( |
624 | 624 | '<option data-price-id="custom" class="give-donation-level-custom" value="custom">%1$s</option>', |
625 | 625 | $custom_amount_text |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | break; |
632 | 632 | } |
633 | 633 | |
634 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
634 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | /** |
@@ -646,27 +646,27 @@ discard block |
||
646 | 646 | * |
647 | 647 | * @return string Checkout button. |
648 | 648 | */ |
649 | -function give_display_checkout_button( $form_id, $args ) { |
|
649 | +function give_display_checkout_button($form_id, $args) { |
|
650 | 650 | |
651 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
651 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
652 | 652 | ? $args['display_style'] |
653 | - : give_get_meta( $form_id, '_give_payment_display', true ); |
|
653 | + : give_get_meta($form_id, '_give_payment_display', true); |
|
654 | 654 | |
655 | - if ( 'button' === $display_option ) { |
|
655 | + if ('button' === $display_option) { |
|
656 | 656 | $display_option = 'modal'; |
657 | - } elseif ( $display_option === 'onpage' ) { |
|
657 | + } elseif ($display_option === 'onpage') { |
|
658 | 658 | return ''; |
659 | 659 | } |
660 | 660 | |
661 | - $display_label_field = give_get_meta( $form_id, '_give_reveal_label', true ); |
|
662 | - $display_label = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
661 | + $display_label_field = give_get_meta($form_id, '_give_reveal_label', true); |
|
662 | + $display_label = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
663 | 663 | |
664 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
664 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
665 | 665 | |
666 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
666 | + echo apply_filters('give_display_checkout_button', $output); |
|
667 | 667 | } |
668 | 668 | |
669 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
669 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
670 | 670 | |
671 | 671 | /** |
672 | 672 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -679,52 +679,52 @@ discard block |
||
679 | 679 | * |
680 | 680 | * @return void |
681 | 681 | */ |
682 | -function give_user_info_fields( $form_id ) { |
|
682 | +function give_user_info_fields($form_id) { |
|
683 | 683 | |
684 | 684 | // Get user info. |
685 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
686 | - $title = ! empty( $give_user_info['give_title'] ) ? $give_user_info['give_title'] : ''; |
|
687 | - $first_name = ! empty( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; |
|
688 | - $last_name = ! empty( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; |
|
689 | - $company_name = ! empty( $give_user_info['company_name'] ) ? $give_user_info['company_name'] : ''; |
|
690 | - $email = ! empty( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; |
|
691 | - $title_prefixes = give_get_name_title_prefixes( $form_id ); |
|
685 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
686 | + $title = ! empty($give_user_info['give_title']) ? $give_user_info['give_title'] : ''; |
|
687 | + $first_name = ! empty($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; |
|
688 | + $last_name = ! empty($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; |
|
689 | + $company_name = ! empty($give_user_info['company_name']) ? $give_user_info['company_name'] : ''; |
|
690 | + $email = ! empty($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; |
|
691 | + $title_prefixes = give_get_name_title_prefixes($form_id); |
|
692 | 692 | |
693 | 693 | /** |
694 | 694 | * Fire before user personal information fields |
695 | 695 | * |
696 | 696 | * @since 1.7 |
697 | 697 | */ |
698 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
698 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
699 | 699 | |
700 | 700 | $title_prefix_classes = ''; |
701 | - if ( give_is_name_title_prefix_enabled( $form_id ) ) { |
|
701 | + if (give_is_name_title_prefix_enabled($form_id)) { |
|
702 | 702 | $title_prefix_classes = 'give-title-prefix-wrap'; |
703 | 703 | } |
704 | 704 | ?> |
705 | - <fieldset id="give_checkout_user_info" class="<?php echo esc_html( $title_prefix_classes ); ?>"> |
|
705 | + <fieldset id="give_checkout_user_info" class="<?php echo esc_html($title_prefix_classes); ?>"> |
|
706 | 706 | <legend> |
707 | - <?php echo esc_html( apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ) ); ?> |
|
707 | + <?php echo esc_html(apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give'))); ?> |
|
708 | 708 | </legend> |
709 | 709 | |
710 | - <?php if ( give_is_name_title_prefix_enabled( $form_id ) && is_array( $title_prefixes ) && count( $title_prefixes ) > 0 ) { ?> |
|
710 | + <?php if (give_is_name_title_prefix_enabled($form_id) && is_array($title_prefixes) && count($title_prefixes) > 0) { ?> |
|
711 | 711 | <p id="give-title-wrap" class="form-row form-row-title form-row-responsive"> |
712 | 712 | <label class="give-label" for="give-title"> |
713 | - <?php esc_attr_e( 'Title', 'give' ); ?> |
|
714 | - <?php if ( give_field_is_required( 'give_title', $form_id ) ) : ?> |
|
713 | + <?php esc_attr_e('Title', 'give'); ?> |
|
714 | + <?php if (give_field_is_required('give_title', $form_id)) : ?> |
|
715 | 715 | <span class="give-required-indicator">*</span> |
716 | 716 | <?php endif ?> |
717 | - <?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?> |
|
717 | + <?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?> |
|
718 | 718 | </label> |
719 | 719 | <select |
720 | 720 | class="give-input required" |
721 | 721 | type="text" |
722 | 722 | name="give_title" |
723 | 723 | id="give-title" |
724 | - <?php echo( give_field_is_required( 'give_title', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
724 | + <?php echo(give_field_is_required('give_title', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
725 | 725 | > |
726 | - <?php foreach ( $title_prefixes as $key => $value ) { ?> |
|
727 | - <option value="<?php echo esc_html( $value ); ?>" <?php selected( $value, $title, true ); ?>><?php echo esc_html( $value ); ?></option> |
|
726 | + <?php foreach ($title_prefixes as $key => $value) { ?> |
|
727 | + <option value="<?php echo esc_html($value); ?>" <?php selected($value, $title, true); ?>><?php echo esc_html($value); ?></option> |
|
728 | 728 | <?php } ?> |
729 | 729 | </select> |
730 | 730 | </p> |
@@ -732,63 +732,63 @@ discard block |
||
732 | 732 | |
733 | 733 | <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive"> |
734 | 734 | <label class="give-label" for="give-first"> |
735 | - <?php esc_attr_e( 'First Name', 'give' ); ?> |
|
736 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
735 | + <?php esc_attr_e('First Name', 'give'); ?> |
|
736 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
737 | 737 | <span class="give-required-indicator">*</span> |
738 | 738 | <?php endif ?> |
739 | - <?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?> |
|
739 | + <?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?> |
|
740 | 740 | </label> |
741 | 741 | <input |
742 | 742 | class="give-input required" |
743 | 743 | type="text" |
744 | 744 | name="give_first" |
745 | 745 | autocomplete="given-name" |
746 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
746 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
747 | 747 | id="give-first" |
748 | - value="<?php echo esc_html( $first_name ); ?>" |
|
749 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
748 | + value="<?php echo esc_html($first_name); ?>" |
|
749 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
750 | 750 | /> |
751 | 751 | </p> |
752 | 752 | |
753 | 753 | <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive"> |
754 | 754 | <label class="give-label" for="give-last"> |
755 | - <?php esc_attr_e( 'Last Name', 'give' ); ?> |
|
756 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
755 | + <?php esc_attr_e('Last Name', 'give'); ?> |
|
756 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
757 | 757 | <span class="give-required-indicator">*</span> |
758 | 758 | <?php endif ?> |
759 | - <?php echo Give()->tooltips->render_help( __( 'We will use this as well to personalize your account experience.', 'give' ) ); ?> |
|
759 | + <?php echo Give()->tooltips->render_help(__('We will use this as well to personalize your account experience.', 'give')); ?> |
|
760 | 760 | </label> |
761 | 761 | |
762 | 762 | <input |
763 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
763 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
764 | 764 | type="text" |
765 | 765 | name="give_last" |
766 | 766 | autocomplete="family-name" |
767 | 767 | id="give-last" |
768 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
769 | - value="<?php echo esc_html( $last_name ); ?>" |
|
770 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
768 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
769 | + value="<?php echo esc_html($last_name); ?>" |
|
770 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
771 | 771 | /> |
772 | 772 | </p> |
773 | 773 | |
774 | - <?php if ( give_is_company_field_enabled( $form_id ) ) : ?> |
|
775 | - <?php $give_company = give_field_is_required( 'give_company_name', $form_id ); ?> |
|
774 | + <?php if (give_is_company_field_enabled($form_id)) : ?> |
|
775 | + <?php $give_company = give_field_is_required('give_company_name', $form_id); ?> |
|
776 | 776 | <p id="give-company-wrap" class="form-row form-row-wide"> |
777 | 777 | <label class="give-label" for="give-company"> |
778 | - <?php esc_attr_e( 'Company Name', 'give' ); ?> |
|
779 | - <?php if ( $give_company ) : ?> |
|
778 | + <?php esc_attr_e('Company Name', 'give'); ?> |
|
779 | + <?php if ($give_company) : ?> |
|
780 | 780 | <span class="give-required-indicator">*</span> |
781 | 781 | <?php endif; ?> |
782 | - <?php echo Give()->tooltips->render_help( __( 'Donate on behalf of Company', 'give' ) ); ?> |
|
782 | + <?php echo Give()->tooltips->render_help(__('Donate on behalf of Company', 'give')); ?> |
|
783 | 783 | </label> |
784 | 784 | <input |
785 | - class="give-input<?php echo( $give_company ? ' required' : '' ); ?>" |
|
785 | + class="give-input<?php echo($give_company ? ' required' : ''); ?>" |
|
786 | 786 | type="text" |
787 | 787 | name="give_company_name" |
788 | - placeholder="<?php esc_attr_e( 'Company Name', 'give' ); ?>" |
|
788 | + placeholder="<?php esc_attr_e('Company Name', 'give'); ?>" |
|
789 | 789 | id="give-company" |
790 | - value="<?php echo esc_html( $company_name ); ?>" |
|
791 | - <?php echo( $give_company ? ' required aria-required="true" ' : '' ); ?> |
|
790 | + value="<?php echo esc_html($company_name); ?>" |
|
791 | + <?php echo($give_company ? ' required aria-required="true" ' : ''); ?> |
|
792 | 792 | /> |
793 | 793 | </p> |
794 | 794 | <?php endif ?> |
@@ -799,31 +799,31 @@ discard block |
||
799 | 799 | * |
800 | 800 | * @since 1.7 |
801 | 801 | */ |
802 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
802 | + do_action('give_donation_form_before_email', $form_id); |
|
803 | 803 | ?> |
804 | 804 | <p id="give-email-wrap" class="form-row form-row-wide"> |
805 | 805 | <label class="give-label" for="give-email"> |
806 | - <?php esc_attr_e( 'Email Address', 'give' ); ?> |
|
807 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
806 | + <?php esc_attr_e('Email Address', 'give'); ?> |
|
807 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
808 | 808 | <span class="give-required-indicator">*</span> |
809 | 809 | <?php } ?> |
810 | - <?php echo Give()->tooltips->render_help( __( 'We will send the donation receipt to this address.', 'give' ) ); ?> |
|
810 | + <?php echo Give()->tooltips->render_help(__('We will send the donation receipt to this address.', 'give')); ?> |
|
811 | 811 | </label> |
812 | 812 | <input |
813 | 813 | class="give-input required" |
814 | 814 | type="email" |
815 | 815 | name="give_email" |
816 | 816 | autocomplete="email" |
817 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
817 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
818 | 818 | id="give-email" |
819 | - value="<?php echo esc_html( $email ); ?>" |
|
820 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
819 | + value="<?php echo esc_html($email); ?>" |
|
820 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
821 | 821 | /> |
822 | 822 | |
823 | 823 | </p> |
824 | 824 | |
825 | - <?php if ( give_is_anonymous_donation_field_enabled( $form_id ) ) : ?> |
|
826 | - <?php $is_anonymous_donation = isset( $_POST['give_anonymous_donation'] ) ? absint( $_POST['give_anonymous_donation'] ) : 0; ?> |
|
825 | + <?php if (give_is_anonymous_donation_field_enabled($form_id)) : ?> |
|
826 | + <?php $is_anonymous_donation = isset($_POST['give_anonymous_donation']) ? absint($_POST['give_anonymous_donation']) : 0; ?> |
|
827 | 827 | <p id="give-anonymous-donation-wrap" class="form-row form-row-wide"> |
828 | 828 | <label class="give-label" for="give-anonymous-donation"> |
829 | 829 | <input |
@@ -832,35 +832,35 @@ discard block |
||
832 | 832 | name="give_anonymous_donation" |
833 | 833 | id="give-anonymous-donation" |
834 | 834 | value="1" |
835 | - <?php echo( give_field_is_required( 'give_anonymous_donation', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
836 | - <?php checked( 1, $is_anonymous_donation ); ?> |
|
835 | + <?php echo(give_field_is_required('give_anonymous_donation', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
836 | + <?php checked(1, $is_anonymous_donation); ?> |
|
837 | 837 | > |
838 | - <?php _e( 'Make this an anonymous donation', 'give' ); ?> |
|
839 | - <?php if ( give_field_is_required( 'give_comment', $form_id ) ) { ?> |
|
838 | + <?php _e('Make this an anonymous donation', 'give'); ?> |
|
839 | + <?php if (give_field_is_required('give_comment', $form_id)) { ?> |
|
840 | 840 | <span class="give-required-indicator">*</span> |
841 | 841 | <?php } ?> |
842 | - <?php echo Give()->tooltips->render_help( esc_html__( 'Would you like to prevent this donation from being displayed publicy?', 'give' ) ); ?> |
|
842 | + <?php echo Give()->tooltips->render_help(esc_html__('Would you like to prevent this donation from being displayed publicy?', 'give')); ?> |
|
843 | 843 | </label> |
844 | 844 | </p> |
845 | 845 | <?php endif; ?> |
846 | 846 | |
847 | - <?php if ( give_is_donor_comment_field_enabled( $form_id ) ) : ?> |
|
847 | + <?php if (give_is_donor_comment_field_enabled($form_id)) : ?> |
|
848 | 848 | <p id="give-comment-wrap" class="form-row form-row-wide"> |
849 | 849 | <label class="give-label" for="give-comment"> |
850 | - <?php _e( 'Comment', 'give' ); ?> |
|
851 | - <?php if ( give_field_is_required( 'give_comment', $form_id ) ) { ?> |
|
850 | + <?php _e('Comment', 'give'); ?> |
|
851 | + <?php if (give_field_is_required('give_comment', $form_id)) { ?> |
|
852 | 852 | <span class="give-required-indicator">*</span> |
853 | 853 | <?php } ?> |
854 | - <?php echo Give()->tooltips->render_help( __( 'Would you like to add a comment to this donation?', 'give' ) ); ?> |
|
854 | + <?php echo Give()->tooltips->render_help(__('Would you like to add a comment to this donation?', 'give')); ?> |
|
855 | 855 | </label> |
856 | 856 | |
857 | 857 | <textarea |
858 | 858 | class="give-input required" |
859 | 859 | name="give_comment" |
860 | - placeholder="<?php _e( 'Leave a comment', 'give' ); ?>" |
|
860 | + placeholder="<?php _e('Leave a comment', 'give'); ?>" |
|
861 | 861 | id="give-comment" |
862 | - <?php echo( give_field_is_required( 'give_comment', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
863 | - ><?php echo isset( $_POST['give_comment'] ) ? give_clean( $_POST['give_comment'] ) : ''; ?></textarea> |
|
862 | + <?php echo(give_field_is_required('give_comment', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
863 | + ><?php echo isset($_POST['give_comment']) ? give_clean($_POST['give_comment']) : ''; ?></textarea> |
|
864 | 864 | |
865 | 865 | </p> |
866 | 866 | <?php endif; ?> |
@@ -870,14 +870,14 @@ discard block |
||
870 | 870 | * |
871 | 871 | * @since 1.7 |
872 | 872 | */ |
873 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
873 | + do_action('give_donation_form_after_email', $form_id); |
|
874 | 874 | |
875 | 875 | /** |
876 | 876 | * Fire after personal email field |
877 | 877 | * |
878 | 878 | * @since 1.7 |
879 | 879 | */ |
880 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
880 | + do_action('give_donation_form_user_info', $form_id); |
|
881 | 881 | ?> |
882 | 882 | </fieldset> |
883 | 883 | <?php |
@@ -886,11 +886,11 @@ discard block |
||
886 | 886 | * |
887 | 887 | * @since 1.7 |
888 | 888 | */ |
889 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
889 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
890 | 890 | } |
891 | 891 | |
892 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
893 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
892 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
893 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
894 | 894 | |
895 | 895 | /** |
896 | 896 | * Renders the credit card info form. |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | * |
902 | 902 | * @return void |
903 | 903 | */ |
904 | -function give_get_cc_form( $form_id ) { |
|
904 | +function give_get_cc_form($form_id) { |
|
905 | 905 | |
906 | 906 | ob_start(); |
907 | 907 | |
@@ -912,50 +912,50 @@ discard block |
||
912 | 912 | * |
913 | 913 | * @param int $form_id The form ID. |
914 | 914 | */ |
915 | - do_action( 'give_before_cc_fields', $form_id ); |
|
915 | + do_action('give_before_cc_fields', $form_id); |
|
916 | 916 | ?> |
917 | 917 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
918 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
919 | - <?php if ( is_ssl() ) : ?> |
|
918 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
919 | + <?php if (is_ssl()) : ?> |
|
920 | 920 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
921 | 921 | <span class="give-icon padlock"></span> |
922 | - <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
922 | + <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
923 | 923 | </div> |
924 | 924 | <?php endif; ?> |
925 | 925 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
926 | 926 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
927 | - <?php _e( 'Card Number', 'give' ); ?> |
|
927 | + <?php _e('Card Number', 'give'); ?> |
|
928 | 928 | <span class="give-required-indicator">*</span> |
929 | - <?php echo Give()->tooltips->render_help( __( 'The (typically) 16 digits on the front of your credit card.', 'give' ) ); ?> |
|
929 | + <?php echo Give()->tooltips->render_help(__('The (typically) 16 digits on the front of your credit card.', 'give')); ?> |
|
930 | 930 | <span class="card-type"></span> |
931 | 931 | </label> |
932 | 932 | |
933 | 933 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
934 | - class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" |
|
934 | + class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" |
|
935 | 935 | required aria-required="true"/> |
936 | 936 | </p> |
937 | 937 | |
938 | 938 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive"> |
939 | 939 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
940 | - <?php _e( 'CVC', 'give' ); ?> |
|
940 | + <?php _e('CVC', 'give'); ?> |
|
941 | 941 | <span class="give-required-indicator">*</span> |
942 | - <?php echo Give()->tooltips->render_help( __( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ) ); ?> |
|
942 | + <?php echo Give()->tooltips->render_help(__('The 3 digit (back) or 4 digit (front) value on your card.', 'give')); ?> |
|
943 | 943 | </label> |
944 | 944 | |
945 | 945 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
946 | - class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" |
|
946 | + class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" |
|
947 | 947 | required aria-required="true"/> |
948 | 948 | </p> |
949 | 949 | |
950 | 950 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
951 | 951 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
952 | - <?php _e( 'Name on the Card', 'give' ); ?> |
|
952 | + <?php _e('Name on the Card', 'give'); ?> |
|
953 | 953 | <span class="give-required-indicator">*</span> |
954 | - <?php echo Give()->tooltips->render_help( __( 'The name printed on the front of your credit card.', 'give' ) ); ?> |
|
954 | + <?php echo Give()->tooltips->render_help(__('The name printed on the front of your credit card.', 'give')); ?> |
|
955 | 955 | </label> |
956 | 956 | |
957 | 957 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
958 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
958 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
959 | 959 | required aria-required="true"/> |
960 | 960 | </p> |
961 | 961 | <?php |
@@ -966,19 +966,19 @@ discard block |
||
966 | 966 | * |
967 | 967 | * @param int $form_id The form ID. |
968 | 968 | */ |
969 | - do_action( 'give_before_cc_expiration' ); |
|
969 | + do_action('give_before_cc_expiration'); |
|
970 | 970 | ?> |
971 | 971 | <p class="card-expiration form-row form-row-one-third form-row-responsive"> |
972 | 972 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
973 | - <?php _e( 'Expiration', 'give' ); ?> |
|
973 | + <?php _e('Expiration', 'give'); ?> |
|
974 | 974 | <span class="give-required-indicator">*</span> |
975 | - <?php echo Give()->tooltips->render_help( __( 'The date your credit card expires, typically on the front of the card.', 'give' ) ); ?> |
|
975 | + <?php echo Give()->tooltips->render_help(__('The date your credit card expires, typically on the front of the card.', 'give')); ?> |
|
976 | 976 | </label> |
977 | 977 | |
978 | 978 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
979 | 979 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
980 | 980 | |
981 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required aria-required="true"/> |
|
981 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required aria-required="true"/> |
|
982 | 982 | </p> |
983 | 983 | <?php |
984 | 984 | /** |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | * |
989 | 989 | * @param int $form_id The form ID. |
990 | 990 | */ |
991 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
991 | + do_action('give_after_cc_expiration', $form_id); |
|
992 | 992 | ?> |
993 | 993 | </fieldset> |
994 | 994 | <?php |
@@ -999,12 +999,12 @@ discard block |
||
999 | 999 | * |
1000 | 1000 | * @param int $form_id The form ID. |
1001 | 1001 | */ |
1002 | - do_action( 'give_after_cc_fields', $form_id ); |
|
1002 | + do_action('give_after_cc_fields', $form_id); |
|
1003 | 1003 | |
1004 | 1004 | echo ob_get_clean(); |
1005 | 1005 | } |
1006 | 1006 | |
1007 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
1007 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
1008 | 1008 | |
1009 | 1009 | /** |
1010 | 1010 | * Outputs the default credit card address fields. |
@@ -1015,20 +1015,20 @@ discard block |
||
1015 | 1015 | * |
1016 | 1016 | * @return void |
1017 | 1017 | */ |
1018 | -function give_default_cc_address_fields( $form_id ) { |
|
1018 | +function give_default_cc_address_fields($form_id) { |
|
1019 | 1019 | // Get user info. |
1020 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
1020 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
1021 | 1021 | |
1022 | 1022 | $logged_in = is_user_logged_in(); |
1023 | 1023 | |
1024 | - if ( $logged_in ) { |
|
1025 | - $user_address = give_get_donor_address( get_current_user_id() ); |
|
1024 | + if ($logged_in) { |
|
1025 | + $user_address = give_get_donor_address(get_current_user_id()); |
|
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | ob_start(); |
1029 | 1029 | ?> |
1030 | 1030 | <fieldset id="give_cc_address" class="cc-address"> |
1031 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
1031 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
1032 | 1032 | <?php |
1033 | 1033 | /** |
1034 | 1034 | * Fires while rendering credit card billing form, before address fields. |
@@ -1037,36 +1037,36 @@ discard block |
||
1037 | 1037 | * |
1038 | 1038 | * @param int $form_id The form ID. |
1039 | 1039 | */ |
1040 | - do_action( 'give_cc_billing_top' ); |
|
1040 | + do_action('give_cc_billing_top'); |
|
1041 | 1041 | |
1042 | 1042 | // For Country. |
1043 | 1043 | $selected_country = give_get_country(); |
1044 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
1044 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
1045 | 1045 | $selected_country = $give_user_info['billing_country']; |
1046 | 1046 | } |
1047 | 1047 | $countries = give_get_country_list(); |
1048 | 1048 | |
1049 | 1049 | // For state. |
1050 | 1050 | $selected_state = ''; |
1051 | - if ( $selected_country === give_get_country() ) { |
|
1051 | + if ($selected_country === give_get_country()) { |
|
1052 | 1052 | // Get default selected state by admin. |
1053 | 1053 | $selected_state = give_get_state(); |
1054 | 1054 | } |
1055 | 1055 | // Get the last payment made by user states. |
1056 | - if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) { |
|
1056 | + if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) { |
|
1057 | 1057 | $selected_state = $give_user_info['card_state']; |
1058 | 1058 | } |
1059 | 1059 | // Get the country code. |
1060 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
1060 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
1061 | 1061 | $selected_country = $give_user_info['billing_country']; |
1062 | 1062 | } |
1063 | - $label = __( 'State', 'give' ); |
|
1063 | + $label = __('State', 'give'); |
|
1064 | 1064 | $states_label = give_get_states_label(); |
1065 | 1065 | // Check if $country code exists in the array key for states label. |
1066 | - if ( array_key_exists( $selected_country, $states_label ) ) { |
|
1067 | - $label = $states_label[ $selected_country ]; |
|
1066 | + if (array_key_exists($selected_country, $states_label)) { |
|
1067 | + $label = $states_label[$selected_country]; |
|
1068 | 1068 | } |
1069 | - $states = give_get_states( $selected_country ); |
|
1069 | + $states = give_get_states($selected_country); |
|
1070 | 1070 | // Get the country list that do not have any states init. |
1071 | 1071 | $no_states_country = give_no_states_country_list(); |
1072 | 1072 | // Get the country list that does not require states. |
@@ -1074,24 +1074,24 @@ discard block |
||
1074 | 1074 | ?> |
1075 | 1075 | <p id="give-card-country-wrap" class="form-row form-row-wide"> |
1076 | 1076 | <label for="billing_country" class="give-label"> |
1077 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
1078 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
1077 | + <?php esc_html_e('Country', 'give'); ?> |
|
1078 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
1079 | 1079 | <span class="give-required-indicator">*</span> |
1080 | 1080 | <?php endif; ?> |
1081 | 1081 | <span class="give-tooltip give-icon give-icon-question" |
1082 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
1082 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
1083 | 1083 | </label> |
1084 | 1084 | |
1085 | 1085 | <select |
1086 | 1086 | name="billing_country" |
1087 | 1087 | autocomplete="country-name" |
1088 | 1088 | id="billing_country" |
1089 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
1090 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
1089 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
1090 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
1091 | 1091 | > |
1092 | 1092 | <?php |
1093 | - foreach ( $countries as $country_code => $country ) { |
|
1094 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
1093 | + foreach ($countries as $country_code => $country) { |
|
1094 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
1095 | 1095 | } |
1096 | 1096 | ?> |
1097 | 1097 | </select> |
@@ -1099,12 +1099,12 @@ discard block |
||
1099 | 1099 | |
1100 | 1100 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
1101 | 1101 | <label for="card_address" class="give-label"> |
1102 | - <?php _e( 'Address 1', 'give' ); ?> |
|
1102 | + <?php _e('Address 1', 'give'); ?> |
|
1103 | 1103 | <?php |
1104 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
1104 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
1105 | 1105 | <span class="give-required-indicator">*</span> |
1106 | 1106 | <?php endif; ?> |
1107 | - <?php echo Give()->tooltips->render_help( __( 'The primary billing address for your credit card.', 'give' ) ); ?> |
|
1107 | + <?php echo Give()->tooltips->render_help(__('The primary billing address for your credit card.', 'give')); ?> |
|
1108 | 1108 | </label> |
1109 | 1109 | |
1110 | 1110 | <input |
@@ -1112,20 +1112,20 @@ discard block |
||
1112 | 1112 | id="card_address" |
1113 | 1113 | name="card_address" |
1114 | 1114 | autocomplete="address-line1" |
1115 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
1116 | - placeholder="<?php _e( 'Address line 1', 'give' ); ?>" |
|
1117 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
1118 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
1115 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
1116 | + placeholder="<?php _e('Address line 1', 'give'); ?>" |
|
1117 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
1118 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
1119 | 1119 | /> |
1120 | 1120 | </p> |
1121 | 1121 | |
1122 | 1122 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
1123 | 1123 | <label for="card_address_2" class="give-label"> |
1124 | - <?php _e( 'Address 2', 'give' ); ?> |
|
1125 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
1124 | + <?php _e('Address 2', 'give'); ?> |
|
1125 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
1126 | 1126 | <span class="give-required-indicator">*</span> |
1127 | 1127 | <?php endif; ?> |
1128 | - <?php echo Give()->tooltips->render_help( __( '(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give' ) ); ?> |
|
1128 | + <?php echo Give()->tooltips->render_help(__('(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give')); ?> |
|
1129 | 1129 | </label> |
1130 | 1130 | |
1131 | 1131 | <input |
@@ -1133,56 +1133,56 @@ discard block |
||
1133 | 1133 | id="card_address_2" |
1134 | 1134 | name="card_address_2" |
1135 | 1135 | autocomplete="address-line2" |
1136 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
1137 | - placeholder="<?php _e( 'Address line 2', 'give' ); ?>" |
|
1138 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
1139 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
1136 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
1137 | + placeholder="<?php _e('Address line 2', 'give'); ?>" |
|
1138 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
1139 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
1140 | 1140 | /> |
1141 | 1141 | </p> |
1142 | 1142 | |
1143 | 1143 | <p id="give-card-city-wrap" class="form-row form-row-wide"> |
1144 | 1144 | <label for="card_city" class="give-label"> |
1145 | - <?php _e( 'City', 'give' ); ?> |
|
1146 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
1145 | + <?php _e('City', 'give'); ?> |
|
1146 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
1147 | 1147 | <span class="give-required-indicator">*</span> |
1148 | 1148 | <?php endif; ?> |
1149 | - <?php echo Give()->tooltips->render_help( __( 'The city for your billing address.', 'give' ) ); ?> |
|
1149 | + <?php echo Give()->tooltips->render_help(__('The city for your billing address.', 'give')); ?> |
|
1150 | 1150 | </label> |
1151 | 1151 | <input |
1152 | 1152 | type="text" |
1153 | 1153 | id="card_city" |
1154 | 1154 | name="card_city" |
1155 | 1155 | autocomplete="address-level3" |
1156 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
1157 | - placeholder="<?php _e( 'City', 'give' ); ?>" |
|
1158 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
1159 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
1156 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
1157 | + placeholder="<?php _e('City', 'give'); ?>" |
|
1158 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
1159 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
1160 | 1160 | /> |
1161 | 1161 | </p> |
1162 | 1162 | |
1163 | 1163 | <p id="give-card-state-wrap" |
1164 | - class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> "> |
|
1164 | + class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> "> |
|
1165 | 1165 | <label for="card_state" class="give-label"> |
1166 | 1166 | <span class="state-label-text"><?php echo $label; ?></span> |
1167 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : |
|
1167 | + <?php if (give_field_is_required('card_state', $form_id)) : |
|
1168 | 1168 | ?> |
1169 | - <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span> |
|
1169 | + <span class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : '') ?> ">*</span> |
|
1170 | 1170 | <?php endif; ?> |
1171 | 1171 | <span class="give-tooltip give-icon give-icon-question" |
1172 | - data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span> |
|
1172 | + data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span> |
|
1173 | 1173 | </label> |
1174 | 1174 | <?php |
1175 | 1175 | |
1176 | - if ( ! empty( $states ) ) : ?> |
|
1176 | + if ( ! empty($states)) : ?> |
|
1177 | 1177 | <select |
1178 | 1178 | name="card_state" |
1179 | 1179 | autocomplete="address-level4" |
1180 | 1180 | id="card_state" |
1181 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
1182 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
1181 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
1182 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
1183 | 1183 | <?php |
1184 | - foreach ( $states as $state_code => $state ) { |
|
1185 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
1184 | + foreach ($states as $state_code => $state) { |
|
1185 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
1186 | 1186 | } |
1187 | 1187 | ?> |
1188 | 1188 | </select> |
@@ -1194,11 +1194,11 @@ discard block |
||
1194 | 1194 | |
1195 | 1195 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
1196 | 1196 | <label for="card_zip" class="give-label"> |
1197 | - <?php _e( 'Zip / Postal Code', 'give' ); ?> |
|
1198 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
1197 | + <?php _e('Zip / Postal Code', 'give'); ?> |
|
1198 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
1199 | 1199 | <span class="give-required-indicator">*</span> |
1200 | 1200 | <?php endif; ?> |
1201 | - <?php echo Give()->tooltips->render_help( __( 'The ZIP Code or postal code for your billing address.', 'give' ) ); ?> |
|
1201 | + <?php echo Give()->tooltips->render_help(__('The ZIP Code or postal code for your billing address.', 'give')); ?> |
|
1202 | 1202 | </label> |
1203 | 1203 | |
1204 | 1204 | <input |
@@ -1207,10 +1207,10 @@ discard block |
||
1207 | 1207 | id="card_zip" |
1208 | 1208 | name="card_zip" |
1209 | 1209 | autocomplete="postal-code" |
1210 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
1211 | - placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" |
|
1212 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
1213 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
1210 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
1211 | + placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" |
|
1212 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
1213 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
1214 | 1214 | /> |
1215 | 1215 | </p> |
1216 | 1216 | <?php |
@@ -1221,14 +1221,14 @@ discard block |
||
1221 | 1221 | * |
1222 | 1222 | * @param int $form_id The form ID. |
1223 | 1223 | */ |
1224 | - do_action( 'give_cc_billing_bottom' ); |
|
1224 | + do_action('give_cc_billing_bottom'); |
|
1225 | 1225 | ?> |
1226 | 1226 | </fieldset> |
1227 | 1227 | <?php |
1228 | 1228 | echo ob_get_clean(); |
1229 | 1229 | } |
1230 | 1230 | |
1231 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
1231 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
1232 | 1232 | |
1233 | 1233 | |
1234 | 1234 | /** |
@@ -1241,15 +1241,15 @@ discard block |
||
1241 | 1241 | * |
1242 | 1242 | * @return string |
1243 | 1243 | */ |
1244 | -function give_get_register_fields( $form_id ) { |
|
1244 | +function give_get_register_fields($form_id) { |
|
1245 | 1245 | |
1246 | 1246 | global $user_ID; |
1247 | 1247 | |
1248 | - if ( is_user_logged_in() ) { |
|
1249 | - $user_data = get_userdata( $user_ID ); |
|
1248 | + if (is_user_logged_in()) { |
|
1249 | + $user_data = get_userdata($user_ID); |
|
1250 | 1250 | } |
1251 | 1251 | |
1252 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1252 | + $show_register_form = give_show_login_register_option($form_id); |
|
1253 | 1253 | |
1254 | 1254 | ob_start(); ?> |
1255 | 1255 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | * |
1263 | 1263 | * @param int $form_id The form ID. |
1264 | 1264 | */ |
1265 | - do_action( 'give_register_fields_before', $form_id ); |
|
1265 | + do_action('give_register_fields_before', $form_id); |
|
1266 | 1266 | ?> |
1267 | 1267 | |
1268 | 1268 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
@@ -1274,24 +1274,24 @@ discard block |
||
1274 | 1274 | * |
1275 | 1275 | * @param int $form_id The form ID. |
1276 | 1276 | */ |
1277 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
1277 | + do_action('give_register_account_fields_before', $form_id); |
|
1278 | 1278 | |
1279 | - $class = ( 'registration' === $show_register_form) ? 'form-row-wide' : 'form-row-first'; |
|
1279 | + $class = ('registration' === $show_register_form) ? 'form-row-wide' : 'form-row-first'; |
|
1280 | 1280 | ?> |
1281 | - <div id="give-create-account-wrap-<?php echo $form_id; ?>" class="form-row <?php echo esc_attr( $class ); ?> form-row-responsive"> |
|
1281 | + <div id="give-create-account-wrap-<?php echo $form_id; ?>" class="form-row <?php echo esc_attr($class); ?> form-row-responsive"> |
|
1282 | 1282 | <label for="give-create-account-<?php echo $form_id; ?>"> |
1283 | 1283 | <?php |
1284 | 1284 | // Add attributes to checkbox, if Guest Checkout is disabled. |
1285 | - $is_guest_checkout = give_get_meta( $form_id, '_give_logged_in_only', true ); |
|
1286 | - $id = 'give-create-account-' . $form_id; |
|
1287 | - if ( ! give_is_setting_enabled( $is_guest_checkout ) ) { |
|
1285 | + $is_guest_checkout = give_get_meta($form_id, '_give_logged_in_only', true); |
|
1286 | + $id = 'give-create-account-'.$form_id; |
|
1287 | + if ( ! give_is_setting_enabled($is_guest_checkout)) { |
|
1288 | 1288 | echo Give()->tooltips->render( |
1289 | 1289 | array( |
1290 | 1290 | 'tag_content' => sprintf( |
1291 | 1291 | '<input type="checkbox" name="give_create_account" value="on" id="%s" class="give-input give-disabled" checked />', |
1292 | 1292 | $id |
1293 | 1293 | ), |
1294 | - 'label' => __( 'Registration is required to donate.', 'give' ), |
|
1294 | + 'label' => __('Registration is required to donate.', 'give'), |
|
1295 | 1295 | ) ); |
1296 | 1296 | } else { |
1297 | 1297 | ?> |
@@ -1299,22 +1299,22 @@ discard block |
||
1299 | 1299 | <?php |
1300 | 1300 | } |
1301 | 1301 | |
1302 | - _e( 'Create an account', 'give' ); |
|
1303 | - echo Give()->tooltips->render_help( __( 'Create an account on the site to see and manage donation history.', 'give' ) ); |
|
1302 | + _e('Create an account', 'give'); |
|
1303 | + echo Give()->tooltips->render_help(__('Create an account on the site to see and manage donation history.', 'give')); |
|
1304 | 1304 | echo str_replace( |
1305 | 1305 | '/>', |
1306 | - 'data-time="' . time() . '" data-nonce-life="' . give_get_nonce_life() . '"/>', |
|
1307 | - give_get_nonce_field( "give_form_create_user_nonce_{$form_id}", 'give-form-user-register-hash', false ) |
|
1306 | + 'data-time="'.time().'" data-nonce-life="'.give_get_nonce_life().'"/>', |
|
1307 | + give_get_nonce_field("give_form_create_user_nonce_{$form_id}", 'give-form-user-register-hash', false) |
|
1308 | 1308 | ); |
1309 | 1309 | ?> |
1310 | 1310 | </label> |
1311 | 1311 | </div> |
1312 | 1312 | |
1313 | - <?php if ( 'both' === $show_register_form ) { ?> |
|
1313 | + <?php if ('both' === $show_register_form) { ?> |
|
1314 | 1314 | <div class="give-login-account-wrap form-row form-row-last form-row-responsive"> |
1315 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
1316 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
1317 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
1315 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
1316 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
1317 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
1318 | 1318 | </p> |
1319 | 1319 | <p class="give-loading-text"> |
1320 | 1320 | <span class="give-loading-animation"></span> |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | * |
1331 | 1331 | * @param int $form_id The form ID. |
1332 | 1332 | */ |
1333 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
1333 | + do_action('give_register_account_fields_after', $form_id); |
|
1334 | 1334 | ?> |
1335 | 1335 | </fieldset> |
1336 | 1336 | |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | * |
1343 | 1343 | * @param int $form_id The form ID. |
1344 | 1344 | */ |
1345 | - do_action( 'give_register_fields_after', $form_id ); |
|
1345 | + do_action('give_register_fields_after', $form_id); |
|
1346 | 1346 | ?> |
1347 | 1347 | |
1348 | 1348 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1353,7 +1353,7 @@ discard block |
||
1353 | 1353 | * |
1354 | 1354 | * @since 1.7 |
1355 | 1355 | */ |
1356 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
1356 | + do_action('give_donation_form_user_info', $form_id); |
|
1357 | 1357 | ?> |
1358 | 1358 | |
1359 | 1359 | </fieldset> |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | echo ob_get_clean(); |
1362 | 1362 | } |
1363 | 1363 | |
1364 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
1364 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
1365 | 1365 | |
1366 | 1366 | /** |
1367 | 1367 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1374,28 +1374,28 @@ discard block |
||
1374 | 1374 | * |
1375 | 1375 | * @return string |
1376 | 1376 | */ |
1377 | -function give_get_login_fields( $form_id ) { |
|
1377 | +function give_get_login_fields($form_id) { |
|
1378 | 1378 | |
1379 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
1380 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1379 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
1380 | + $show_register_form = give_show_login_register_option($form_id); |
|
1381 | 1381 | |
1382 | 1382 | ob_start(); |
1383 | 1383 | ?> |
1384 | 1384 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
1385 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) ); |
|
1386 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1387 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
1385 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
1386 | + if ( ! give_logged_in_only($form_id)) { |
|
1387 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
1388 | 1388 | } ?> |
1389 | 1389 | </legend> |
1390 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1390 | + <?php if ($show_register_form == 'both') { ?> |
|
1391 | 1391 | <p class="give-new-account-link"> |
1392 | - <?php _e( 'Don\'t have an account?', 'give' ); ?> |
|
1393 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
1392 | + <?php _e('Don\'t have an account?', 'give'); ?> |
|
1393 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
1394 | 1394 | data-action="give_checkout_register"> |
1395 | - <?php if ( give_logged_in_only( $form_id ) ) { |
|
1396 | - _e( 'Register as a part of your donation »', 'give' ); |
|
1395 | + <?php if (give_logged_in_only($form_id)) { |
|
1396 | + _e('Register as a part of your donation »', 'give'); |
|
1397 | 1397 | } else { |
1398 | - _e( 'Register or donate as a guest »', 'give' ); |
|
1398 | + _e('Register or donate as a guest »', 'give'); |
|
1399 | 1399 | } ?> |
1400 | 1400 | </a> |
1401 | 1401 | </p> |
@@ -1411,40 +1411,40 @@ discard block |
||
1411 | 1411 | * |
1412 | 1412 | * @param int $form_id The form ID. |
1413 | 1413 | */ |
1414 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
1414 | + do_action('give_checkout_login_fields_before', $form_id); |
|
1415 | 1415 | ?> |
1416 | 1416 | <div class="give-user-login-fields-container"> |
1417 | 1417 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive"> |
1418 | 1418 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
1419 | - <?php _e( 'Username', 'give' ); ?> |
|
1420 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1419 | + <?php _e('Username', 'give'); ?> |
|
1420 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1421 | 1421 | <span class="give-required-indicator">*</span> |
1422 | 1422 | <?php } ?> |
1423 | 1423 | </label> |
1424 | 1424 | |
1425 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
1425 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
1426 | 1426 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
1427 | - placeholder="<?php _e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1427 | + placeholder="<?php _e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1428 | 1428 | </div> |
1429 | 1429 | |
1430 | 1430 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
1431 | 1431 | class="give_login_password form-row form-row-last form-row-responsive"> |
1432 | 1432 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
1433 | - <?php _e( 'Password', 'give' ); ?> |
|
1434 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1433 | + <?php _e('Password', 'give'); ?> |
|
1434 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1435 | 1435 | <span class="give-required-indicator">*</span> |
1436 | 1436 | <?php } ?> |
1437 | 1437 | </label> |
1438 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
1438 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
1439 | 1439 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
1440 | - placeholder="<?php _e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1440 | + placeholder="<?php _e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1441 | 1441 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
1442 | 1442 | </div> |
1443 | 1443 | |
1444 | 1444 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
1445 | 1445 | <span class="give-forgot-password "> |
1446 | 1446 | <a href="<?php echo wp_lostpassword_url() ?>" |
1447 | - target="_blank"><?php _e( 'Reset Password', 'give' ) ?></a> |
|
1447 | + target="_blank"><?php _e('Reset Password', 'give') ?></a> |
|
1448 | 1448 | </span> |
1449 | 1449 | </div> |
1450 | 1450 | </div> |
@@ -1452,11 +1452,11 @@ discard block |
||
1452 | 1452 | |
1453 | 1453 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
1454 | 1454 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
1455 | - value="<?php _e( 'Login', 'give' ); ?>"/> |
|
1456 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
1455 | + value="<?php _e('Login', 'give'); ?>"/> |
|
1456 | + <?php if ($show_register_form !== 'login') { ?> |
|
1457 | 1457 | <input type="button" data-action="give_cancel_login" |
1458 | 1458 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
1459 | - value="<?php _e( 'Cancel', 'give' ); ?>"/> |
|
1459 | + value="<?php _e('Cancel', 'give'); ?>"/> |
|
1460 | 1460 | <?php } ?> |
1461 | 1461 | <span class="give-loading-animation"></span> |
1462 | 1462 | </div> |
@@ -1468,14 +1468,14 @@ discard block |
||
1468 | 1468 | * |
1469 | 1469 | * @param int $form_id The form ID. |
1470 | 1470 | */ |
1471 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
1471 | + do_action('give_checkout_login_fields_after', $form_id); |
|
1472 | 1472 | ?> |
1473 | 1473 | </fieldset><!--end #give-login-fields--> |
1474 | 1474 | <?php |
1475 | 1475 | echo ob_get_clean(); |
1476 | 1476 | } |
1477 | 1477 | |
1478 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
1478 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
1479 | 1479 | |
1480 | 1480 | /** |
1481 | 1481 | * Payment Mode Select. |
@@ -1491,10 +1491,10 @@ discard block |
||
1491 | 1491 | * |
1492 | 1492 | * @return void |
1493 | 1493 | */ |
1494 | -function give_payment_mode_select( $form_id, $args ) { |
|
1494 | +function give_payment_mode_select($form_id, $args) { |
|
1495 | 1495 | |
1496 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
1497 | - $id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : ''; |
|
1496 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
1497 | + $id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : ''; |
|
1498 | 1498 | |
1499 | 1499 | /** |
1500 | 1500 | * Fires while selecting payment gateways, before the fields. |
@@ -1503,10 +1503,10 @@ discard block |
||
1503 | 1503 | * |
1504 | 1504 | * @param int $form_id The form ID. |
1505 | 1505 | */ |
1506 | - do_action( 'give_payment_mode_top', $form_id ); |
|
1506 | + do_action('give_payment_mode_top', $form_id); |
|
1507 | 1507 | ?> |
1508 | 1508 | |
1509 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
1509 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
1510 | 1510 | echo 'style="display: none;"'; |
1511 | 1511 | } ?>> |
1512 | 1512 | <?php |
@@ -1517,10 +1517,10 @@ discard block |
||
1517 | 1517 | * |
1518 | 1518 | * @param int $form_id The form ID. |
1519 | 1519 | */ |
1520 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
1520 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
1521 | 1521 | ?> |
1522 | 1522 | <legend |
1523 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
1523 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
1524 | 1524 | <span class="give-loading-text"><span |
1525 | 1525 | class="give-loading-animation"></span> |
1526 | 1526 | </span> |
@@ -1533,37 +1533,36 @@ discard block |
||
1533 | 1533 | * |
1534 | 1534 | * @since 1.7 |
1535 | 1535 | */ |
1536 | - do_action( 'give_payment_mode_before_gateways' ) |
|
1536 | + do_action('give_payment_mode_before_gateways') |
|
1537 | 1537 | ?> |
1538 | 1538 | <ul id="give-gateway-radio-list"> |
1539 | 1539 | <?php |
1540 | 1540 | /** |
1541 | 1541 | * Loop through the active payment gateways. |
1542 | 1542 | */ |
1543 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
1543 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
1544 | 1544 | $give_settings = give_get_settings(); |
1545 | - $gateways_label = array_key_exists( 'gateways_label', $give_settings ) ? |
|
1546 | - $give_settings['gateways_label'] : |
|
1547 | - array(); |
|
1545 | + $gateways_label = array_key_exists('gateways_label', $give_settings) ? |
|
1546 | + $give_settings['gateways_label'] : array(); |
|
1548 | 1547 | |
1549 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
1548 | + foreach ($gateways as $gateway_id => $gateway) : |
|
1550 | 1549 | //Determine the default gateway. |
1551 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
1550 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
1552 | 1551 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
1553 | 1552 | <li<?php echo $checked_class ?>> |
1554 | 1553 | <input type="radio" name="payment-mode" class="give-gateway" |
1555 | - id="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>" |
|
1556 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
1554 | + id="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>" |
|
1555 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
1557 | 1556 | |
1558 | 1557 | <?php |
1559 | 1558 | $label = $gateway['checkout_label']; |
1560 | - if ( ! empty( $gateways_label[ $gateway_id ] ) ) { |
|
1561 | - $label = $gateways_label[ $gateway_id ]; |
|
1559 | + if ( ! empty($gateways_label[$gateway_id])) { |
|
1560 | + $label = $gateways_label[$gateway_id]; |
|
1562 | 1561 | } |
1563 | 1562 | ?> |
1564 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>" |
|
1563 | + <label for="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>" |
|
1565 | 1564 | class="give-gateway-option" |
1566 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $label ); ?></label> |
|
1565 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($label); ?></label> |
|
1567 | 1566 | </li> |
1568 | 1567 | <?php |
1569 | 1568 | endforeach; |
@@ -1575,7 +1574,7 @@ discard block |
||
1575 | 1574 | * |
1576 | 1575 | * @since 1.7 |
1577 | 1576 | */ |
1578 | - do_action( 'give_payment_mode_after_gateways' ); |
|
1577 | + do_action('give_payment_mode_after_gateways'); |
|
1579 | 1578 | ?> |
1580 | 1579 | </div> |
1581 | 1580 | <?php |
@@ -1586,7 +1585,7 @@ discard block |
||
1586 | 1585 | * |
1587 | 1586 | * @param int $form_id The form ID. |
1588 | 1587 | */ |
1589 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
1588 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
1590 | 1589 | ?> |
1591 | 1590 | </fieldset> |
1592 | 1591 | |
@@ -1598,7 +1597,7 @@ discard block |
||
1598 | 1597 | * |
1599 | 1598 | * @param int $form_id The form ID. |
1600 | 1599 | */ |
1601 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
1600 | + do_action('give_payment_mode_bottom', $form_id); |
|
1602 | 1601 | ?> |
1603 | 1602 | |
1604 | 1603 | <div id="give_purchase_form_wrap"> |
@@ -1609,7 +1608,7 @@ discard block |
||
1609 | 1608 | * |
1610 | 1609 | * @since 1.7 |
1611 | 1610 | */ |
1612 | - do_action( 'give_donation_form', $form_id, $args ); |
|
1611 | + do_action('give_donation_form', $form_id, $args); |
|
1613 | 1612 | ?> |
1614 | 1613 | |
1615 | 1614 | </div> |
@@ -1620,10 +1619,10 @@ discard block |
||
1620 | 1619 | * |
1621 | 1620 | * @since 1.7 |
1622 | 1621 | */ |
1623 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
1622 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
1624 | 1623 | } |
1625 | 1624 | |
1626 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select', 10, 2 ); |
|
1625 | +add_action('give_payment_mode_select', 'give_payment_mode_select', 10, 2); |
|
1627 | 1626 | |
1628 | 1627 | /** |
1629 | 1628 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1636,22 +1635,22 @@ discard block |
||
1636 | 1635 | * |
1637 | 1636 | * @return bool |
1638 | 1637 | */ |
1639 | -function give_terms_agreement( $form_id ) { |
|
1640 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
1638 | +function give_terms_agreement($form_id) { |
|
1639 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
1641 | 1640 | |
1642 | 1641 | // Bailout if per form and global term and conditions is not setup. |
1643 | 1642 | if ( |
1644 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1645 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1643 | + give_is_setting_enabled($form_option, 'global') |
|
1644 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1646 | 1645 | ) { |
1647 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
1648 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
1649 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
1646 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
1647 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
1648 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
1650 | 1649 | |
1651 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1652 | - $label = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
1653 | - $terms = give_get_meta( $form_id, '_give_agree_text', true ); |
|
1654 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
1650 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1651 | + $label = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
1652 | + $terms = give_get_meta($form_id, '_give_agree_text', true); |
|
1653 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
1655 | 1654 | |
1656 | 1655 | } else { |
1657 | 1656 | return false; |
@@ -1659,9 +1658,9 @@ discard block |
||
1659 | 1658 | |
1660 | 1659 | |
1661 | 1660 | // Bailout: Check if term and conditions text is empty or not. |
1662 | - if ( empty( $terms ) ) { |
|
1663 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
1664 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
1661 | + if (empty($terms)) { |
|
1662 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
1663 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
1665 | 1664 | } |
1666 | 1665 | |
1667 | 1666 | return false; |
@@ -1672,11 +1671,11 @@ discard block |
||
1672 | 1671 | * |
1673 | 1672 | * @since 2.1.5 |
1674 | 1673 | */ |
1675 | - $terms = apply_filters( 'give_the_term_content', wpautop( do_shortcode( $terms ) ), $terms, $form_id ); |
|
1674 | + $terms = apply_filters('give_the_term_content', wpautop(do_shortcode($terms)), $terms, $form_id); |
|
1676 | 1675 | |
1677 | 1676 | ?> |
1678 | 1677 | <fieldset id="give_terms_agreement"> |
1679 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
1678 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
1680 | 1679 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
1681 | 1680 | <?php |
1682 | 1681 | /** |
@@ -1684,7 +1683,7 @@ discard block |
||
1684 | 1683 | * |
1685 | 1684 | * @since 1.0 |
1686 | 1685 | */ |
1687 | - do_action( 'give_before_terms' ); |
|
1686 | + do_action('give_before_terms'); |
|
1688 | 1687 | |
1689 | 1688 | echo $terms; |
1690 | 1689 | /** |
@@ -1692,14 +1691,14 @@ discard block |
||
1692 | 1691 | * |
1693 | 1692 | * @since 1.0 |
1694 | 1693 | */ |
1695 | - do_action( 'give_after_terms' ); |
|
1694 | + do_action('give_after_terms'); |
|
1696 | 1695 | ?> |
1697 | 1696 | </div> |
1698 | 1697 | <div id="give_show_terms"> |
1699 | 1698 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1700 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
1699 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
1701 | 1700 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1702 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
1701 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
1703 | 1702 | </div> |
1704 | 1703 | |
1705 | 1704 | <input name="give_agree_to_terms" class="required" type="checkbox" |
@@ -1710,7 +1709,7 @@ discard block |
||
1710 | 1709 | <?php |
1711 | 1710 | } |
1712 | 1711 | |
1713 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
1712 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
1714 | 1713 | |
1715 | 1714 | /** |
1716 | 1715 | * Checkout Final Total. |
@@ -1723,15 +1722,14 @@ discard block |
||
1723 | 1722 | * |
1724 | 1723 | * @return void |
1725 | 1724 | */ |
1726 | -function give_checkout_final_total( $form_id ) { |
|
1725 | +function give_checkout_final_total($form_id) { |
|
1727 | 1726 | |
1728 | - $total = isset( $_POST['give_total'] ) ? |
|
1729 | - apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) : |
|
1730 | - give_get_default_form_amount( $form_id ); |
|
1727 | + $total = isset($_POST['give_total']) ? |
|
1728 | + apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id); |
|
1731 | 1729 | |
1732 | 1730 | |
1733 | 1731 | // Only proceed if give_total available. |
1734 | - if ( empty( $total ) ) { |
|
1732 | + if (empty($total)) { |
|
1735 | 1733 | return; |
1736 | 1734 | } |
1737 | 1735 | ?> |
@@ -1742,18 +1740,18 @@ discard block |
||
1742 | 1740 | * |
1743 | 1741 | * @since 2.0.5 |
1744 | 1742 | */ |
1745 | - do_action( 'give_donation_final_total_label_before', $form_id ); |
|
1743 | + do_action('give_donation_final_total_label_before', $form_id); |
|
1746 | 1744 | ?> |
1747 | 1745 | <span class="give-donation-total-label"> |
1748 | - <?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?> |
|
1746 | + <?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?> |
|
1749 | 1747 | </span> |
1750 | 1748 | <span class="give-final-total-amount" |
1751 | - data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>"> |
|
1749 | + data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>"> |
|
1752 | 1750 | <?php |
1753 | - echo give_currency_filter( give_format_amount( $total, array( |
|
1751 | + echo give_currency_filter(give_format_amount($total, array( |
|
1754 | 1752 | 'sanitize' => false, |
1755 | - 'currency' => give_get_currency( $form_id ), |
|
1756 | - ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ); ?> |
|
1753 | + 'currency' => give_get_currency($form_id), |
|
1754 | + )), array('currency_code' => give_get_currency($form_id))); ?> |
|
1757 | 1755 | </span> |
1758 | 1756 | <?php |
1759 | 1757 | /** |
@@ -1761,13 +1759,13 @@ discard block |
||
1761 | 1759 | * |
1762 | 1760 | * @since 2.0.5 |
1763 | 1761 | */ |
1764 | - do_action( 'give_donation_final_total_label_after', $form_id ); |
|
1762 | + do_action('give_donation_final_total_label_after', $form_id); |
|
1765 | 1763 | ?> |
1766 | 1764 | </p> |
1767 | 1765 | <?php |
1768 | 1766 | } |
1769 | 1767 | |
1770 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1768 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
1771 | 1769 | |
1772 | 1770 | /** |
1773 | 1771 | * Renders the Checkout Submit section. |
@@ -1779,7 +1777,7 @@ discard block |
||
1779 | 1777 | * |
1780 | 1778 | * @return void |
1781 | 1779 | */ |
1782 | -function give_checkout_submit( $form_id, $args ) { |
|
1780 | +function give_checkout_submit($form_id, $args) { |
|
1783 | 1781 | ?> |
1784 | 1782 | <fieldset id="give_purchase_submit" class="give-donation-submit"> |
1785 | 1783 | <?php |
@@ -1788,24 +1786,24 @@ discard block |
||
1788 | 1786 | * |
1789 | 1787 | * @since 1.7 |
1790 | 1788 | */ |
1791 | - do_action( 'give_donation_form_before_submit', $form_id, $args ); |
|
1789 | + do_action('give_donation_form_before_submit', $form_id, $args); |
|
1792 | 1790 | |
1793 | - give_checkout_hidden_fields( $form_id ); |
|
1791 | + give_checkout_hidden_fields($form_id); |
|
1794 | 1792 | |
1795 | - echo give_get_donation_form_submit_button( $form_id ); |
|
1793 | + echo give_get_donation_form_submit_button($form_id); |
|
1796 | 1794 | |
1797 | 1795 | /** |
1798 | 1796 | * Fire after donation form submit. |
1799 | 1797 | * |
1800 | 1798 | * @since 1.7 |
1801 | 1799 | */ |
1802 | - do_action( 'give_donation_form_after_submit', $form_id, $args ); |
|
1800 | + do_action('give_donation_form_after_submit', $form_id, $args); |
|
1803 | 1801 | ?> |
1804 | 1802 | </fieldset> |
1805 | 1803 | <?php |
1806 | 1804 | } |
1807 | 1805 | |
1808 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2 ); |
|
1806 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2); |
|
1809 | 1807 | |
1810 | 1808 | /** |
1811 | 1809 | * Give Donation form submit button. |
@@ -1816,10 +1814,10 @@ discard block |
||
1816 | 1814 | * |
1817 | 1815 | * @return string |
1818 | 1816 | */ |
1819 | -function give_get_donation_form_submit_button( $form_id ) { |
|
1817 | +function give_get_donation_form_submit_button($form_id) { |
|
1820 | 1818 | |
1821 | - $display_label_field = give_get_meta( $form_id, '_give_checkout_label', true ); |
|
1822 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
1819 | + $display_label_field = give_get_meta($form_id, '_give_checkout_label', true); |
|
1820 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
1823 | 1821 | ob_start(); |
1824 | 1822 | ?> |
1825 | 1823 | <div class="give-submit-button-wrap give-clearfix"> |
@@ -1828,7 +1826,7 @@ discard block |
||
1828 | 1826 | <span class="give-loading-animation"></span> |
1829 | 1827 | </div> |
1830 | 1828 | <?php |
1831 | - return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id ); |
|
1829 | + return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id); |
|
1832 | 1830 | } |
1833 | 1831 | |
1834 | 1832 | /** |
@@ -1843,22 +1841,22 @@ discard block |
||
1843 | 1841 | * |
1844 | 1842 | * @return mixed |
1845 | 1843 | */ |
1846 | -function give_show_goal_progress( $form_id, $args = array() ) { |
|
1844 | +function give_show_goal_progress($form_id, $args = array()) { |
|
1847 | 1845 | |
1848 | 1846 | ob_start(); |
1849 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1847 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
1850 | 1848 | |
1851 | 1849 | /** |
1852 | 1850 | * Filter progress bar output |
1853 | 1851 | * |
1854 | 1852 | * @since 2.0 |
1855 | 1853 | */ |
1856 | - echo apply_filters( 'give_goal_output', ob_get_clean(), $form_id, $args ); |
|
1854 | + echo apply_filters('give_goal_output', ob_get_clean(), $form_id, $args); |
|
1857 | 1855 | |
1858 | 1856 | return true; |
1859 | 1857 | } |
1860 | 1858 | |
1861 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1859 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1862 | 1860 | |
1863 | 1861 | /** |
1864 | 1862 | * Show Give Totals Progress. |
@@ -1870,22 +1868,22 @@ discard block |
||
1870 | 1868 | * |
1871 | 1869 | * @return mixed |
1872 | 1870 | */ |
1873 | -function give_show_goal_totals_progress( $total, $total_goal ) { |
|
1871 | +function give_show_goal_totals_progress($total, $total_goal) { |
|
1874 | 1872 | |
1875 | 1873 | // Bail out if total goal is set as an array. |
1876 | - if ( isset( $total_goal ) && is_array( $total_goal ) ) { |
|
1874 | + if (isset($total_goal) && is_array($total_goal)) { |
|
1877 | 1875 | return false; |
1878 | 1876 | } |
1879 | 1877 | |
1880 | 1878 | ob_start(); |
1881 | - give_get_template( 'shortcode-totals-progress', array( 'total' => $total, 'total_goal' => $total_goal ) ); |
|
1879 | + give_get_template('shortcode-totals-progress', array('total' => $total, 'total_goal' => $total_goal)); |
|
1882 | 1880 | |
1883 | - echo apply_filters( 'give_total_progress_output', ob_get_clean() ); |
|
1881 | + echo apply_filters('give_total_progress_output', ob_get_clean()); |
|
1884 | 1882 | |
1885 | 1883 | return true; |
1886 | 1884 | } |
1887 | 1885 | |
1888 | -add_action( 'give_pre_form', 'give_show_goal_totals_progress', 10, 2 ); |
|
1886 | +add_action('give_pre_form', 'give_show_goal_totals_progress', 10, 2); |
|
1889 | 1887 | |
1890 | 1888 | /** |
1891 | 1889 | * Get form content position. |
@@ -1897,10 +1895,10 @@ discard block |
||
1897 | 1895 | * |
1898 | 1896 | * @return mixed|string |
1899 | 1897 | */ |
1900 | -function give_get_form_content_placement( $form_id, $args ) { |
|
1898 | +function give_get_form_content_placement($form_id, $args) { |
|
1901 | 1899 | $show_content = ''; |
1902 | 1900 | |
1903 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
1901 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
1904 | 1902 | // Content positions. |
1905 | 1903 | $content_placement = array( |
1906 | 1904 | 'above' => 'give_pre_form', |
@@ -1908,18 +1906,18 @@ discard block |
||
1908 | 1906 | ); |
1909 | 1907 | |
1910 | 1908 | // Check if content position already decoded. |
1911 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
1909 | + if (in_array($args['show_content'], $content_placement)) { |
|
1912 | 1910 | return $args['show_content']; |
1913 | 1911 | } |
1914 | 1912 | |
1915 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
1913 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
1916 | 1914 | |
1917 | - } elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) { |
|
1918 | - $show_content = give_get_meta( $form_id, '_give_content_placement', true ); |
|
1915 | + } elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) { |
|
1916 | + $show_content = give_get_meta($form_id, '_give_content_placement', true); |
|
1919 | 1917 | |
1920 | - } elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) { |
|
1918 | + } elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) { |
|
1921 | 1919 | // Backward compatibility for _give_content_option for v18. |
1922 | - $show_content = give_get_meta( $form_id, '_give_content_option', true ); |
|
1920 | + $show_content = give_get_meta($form_id, '_give_content_option', true); |
|
1923 | 1921 | } |
1924 | 1922 | |
1925 | 1923 | return $show_content; |
@@ -1935,20 +1933,20 @@ discard block |
||
1935 | 1933 | * |
1936 | 1934 | * @return void|bool |
1937 | 1935 | */ |
1938 | -function give_form_content( $form_id, $args ) { |
|
1936 | +function give_form_content($form_id, $args) { |
|
1939 | 1937 | |
1940 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1938 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1941 | 1939 | |
1942 | 1940 | // Bailout. |
1943 | - if ( empty( $show_content ) ) { |
|
1941 | + if (empty($show_content)) { |
|
1944 | 1942 | return false; |
1945 | 1943 | } |
1946 | 1944 | |
1947 | 1945 | // Add action according to value. |
1948 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1946 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1949 | 1947 | } |
1950 | 1948 | |
1951 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1949 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1952 | 1950 | |
1953 | 1951 | /** |
1954 | 1952 | * Renders Post Form Content. |
@@ -1962,14 +1960,14 @@ discard block |
||
1962 | 1960 | * |
1963 | 1961 | * @return void |
1964 | 1962 | */ |
1965 | -function give_form_display_content( $form_id, $args ) { |
|
1966 | - $content = give_get_meta( $form_id, '_give_form_content', true ); |
|
1967 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1968 | - |
|
1969 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
1970 | - $content = apply_filters( 'the_content', $content ); |
|
1971 | - } else{ |
|
1972 | - $content = wpautop( do_shortcode( $content ) ); |
|
1963 | +function give_form_display_content($form_id, $args) { |
|
1964 | + $content = give_get_meta($form_id, '_give_form_content', true); |
|
1965 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1966 | + |
|
1967 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
1968 | + $content = apply_filters('the_content', $content); |
|
1969 | + } else { |
|
1970 | + $content = wpautop(do_shortcode($content)); |
|
1973 | 1971 | } |
1974 | 1972 | |
1975 | 1973 | $output = sprintf( |
@@ -1988,11 +1986,11 @@ discard block |
||
1988 | 1986 | * @param int $form_id |
1989 | 1987 | * @param array $args |
1990 | 1988 | */ |
1991 | - echo apply_filters( 'give_form_content_output', $output, $form_id, $args ); |
|
1989 | + echo apply_filters('give_form_content_output', $output, $form_id, $args); |
|
1992 | 1990 | |
1993 | 1991 | // remove action to prevent content output on addition forms on page. |
1994 | 1992 | // @see: https://github.com/WordImpress/Give/issues/634. |
1995 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1993 | + remove_action($show_content, 'give_form_display_content'); |
|
1996 | 1994 | } |
1997 | 1995 | |
1998 | 1996 | /** |
@@ -2004,7 +2002,7 @@ discard block |
||
2004 | 2002 | * |
2005 | 2003 | * @return void |
2006 | 2004 | */ |
2007 | -function give_checkout_hidden_fields( $form_id ) { |
|
2005 | +function give_checkout_hidden_fields($form_id) { |
|
2008 | 2006 | |
2009 | 2007 | /** |
2010 | 2008 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -2013,13 +2011,13 @@ discard block |
||
2013 | 2011 | * |
2014 | 2012 | * @param int $form_id The form ID. |
2015 | 2013 | */ |
2016 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
2014 | + do_action('give_hidden_fields_before', $form_id); |
|
2017 | 2015 | |
2018 | - if ( is_user_logged_in() ) { ?> |
|
2016 | + if (is_user_logged_in()) { ?> |
|
2019 | 2017 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
2020 | 2018 | <?php } ?> |
2021 | 2019 | <input type="hidden" name="give_action" value="purchase"/> |
2022 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
2020 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
2023 | 2021 | <?php |
2024 | 2022 | /** |
2025 | 2023 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -2028,7 +2026,7 @@ discard block |
||
2028 | 2026 | * |
2029 | 2027 | * @param int $form_id The form ID. |
2030 | 2028 | */ |
2031 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
2029 | + do_action('give_hidden_fields_after', $form_id); |
|
2032 | 2030 | |
2033 | 2031 | } |
2034 | 2032 | |
@@ -2043,20 +2041,20 @@ discard block |
||
2043 | 2041 | * |
2044 | 2042 | * @return string $content Filtered content. |
2045 | 2043 | */ |
2046 | -function give_filter_success_page_content( $content ) { |
|
2044 | +function give_filter_success_page_content($content) { |
|
2047 | 2045 | |
2048 | 2046 | $give_options = give_get_settings(); |
2049 | 2047 | |
2050 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
2051 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
2052 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
2048 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
2049 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
2050 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
2053 | 2051 | } |
2054 | 2052 | } |
2055 | 2053 | |
2056 | 2054 | return $content; |
2057 | 2055 | } |
2058 | 2056 | |
2059 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
2057 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
2060 | 2058 | |
2061 | 2059 | /** |
2062 | 2060 | * Test Mode Frontend Warning. |
@@ -2067,12 +2065,12 @@ discard block |
||
2067 | 2065 | */ |
2068 | 2066 | function give_test_mode_frontend_warning() { |
2069 | 2067 | |
2070 | - if ( give_is_test_mode() ) { |
|
2071 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
2068 | + if (give_is_test_mode()) { |
|
2069 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
2072 | 2070 | } |
2073 | 2071 | } |
2074 | 2072 | |
2075 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
2073 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
2076 | 2074 | |
2077 | 2075 | /** |
2078 | 2076 | * Members-only Form. |
@@ -2086,21 +2084,21 @@ discard block |
||
2086 | 2084 | * |
2087 | 2085 | * @return string |
2088 | 2086 | */ |
2089 | -function give_members_only_form( $final_output, $args ) { |
|
2087 | +function give_members_only_form($final_output, $args) { |
|
2090 | 2088 | |
2091 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
2089 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
2092 | 2090 | |
2093 | 2091 | //Sanity Check: Must have form_id & not be logged in. |
2094 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
2092 | + if (empty($form_id) || is_user_logged_in()) { |
|
2095 | 2093 | return $final_output; |
2096 | 2094 | } |
2097 | 2095 | |
2098 | 2096 | //Logged in only and Register / Login set to none. |
2099 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
2097 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
2100 | 2098 | |
2101 | - $final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
2099 | + $final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
2102 | 2100 | |
2103 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
2101 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
2104 | 2102 | |
2105 | 2103 | } |
2106 | 2104 | |
@@ -2108,7 +2106,7 @@ discard block |
||
2108 | 2106 | |
2109 | 2107 | } |
2110 | 2108 | |
2111 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
2109 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
2112 | 2110 | |
2113 | 2111 | |
2114 | 2112 | /** |
@@ -2120,40 +2118,40 @@ discard block |
||
2120 | 2118 | * @param array $args |
2121 | 2119 | * @param Give_Donate_Form $form |
2122 | 2120 | */ |
2123 | -function __give_form_add_donation_hidden_field( $form_id, $args, $form ) { |
|
2124 | - $id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : ''; |
|
2121 | +function __give_form_add_donation_hidden_field($form_id, $args, $form) { |
|
2122 | + $id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : ''; |
|
2125 | 2123 | ?> |
2126 | 2124 | <input type="hidden" name="give-form-id-prefix" value="<?php echo $id_prefix; ?>"/> |
2127 | - <input type="hidden" name="give-form-id" value="<?php echo intval( $form_id ); ?>"/> |
|
2128 | - <input type="hidden" name="give-form-title" value="<?php echo esc_html( $form->post_title ); ?>"/> |
|
2129 | - <input type="hidden" name="give-current-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
2130 | - <input type="hidden" name="give-form-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
2125 | + <input type="hidden" name="give-form-id" value="<?php echo intval($form_id); ?>"/> |
|
2126 | + <input type="hidden" name="give-form-title" value="<?php echo esc_html($form->post_title); ?>"/> |
|
2127 | + <input type="hidden" name="give-current-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
2128 | + <input type="hidden" name="give-form-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
2131 | 2129 | <?php |
2132 | 2130 | // Get the custom option amount. |
2133 | - $custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
2131 | + $custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
2134 | 2132 | |
2135 | 2133 | // If custom amount enabled. |
2136 | - if ( give_is_setting_enabled( $custom_amount ) ) { |
|
2134 | + if (give_is_setting_enabled($custom_amount)) { |
|
2137 | 2135 | ?> |
2138 | 2136 | <input type="hidden" name="give-form-minimum" |
2139 | - value="<?php echo give_maybe_sanitize_amount( give_get_form_minimum_price( $form_id ) ); ?>"/> |
|
2137 | + value="<?php echo give_maybe_sanitize_amount(give_get_form_minimum_price($form_id)); ?>"/> |
|
2140 | 2138 | <input type="hidden" name="give-form-maximum" |
2141 | - value="<?php echo give_maybe_sanitize_amount( give_get_form_maximum_price( $form_id ) ); ?>"/> |
|
2139 | + value="<?php echo give_maybe_sanitize_amount(give_get_form_maximum_price($form_id)); ?>"/> |
|
2142 | 2140 | <?php |
2143 | 2141 | } |
2144 | 2142 | |
2145 | 2143 | // WP nonce field. |
2146 | 2144 | echo str_replace( |
2147 | 2145 | '/>', |
2148 | - 'data-time="' . time() . '" data-nonce-life="' . give_get_nonce_life() . '"/>', |
|
2149 | - give_get_nonce_field( "give_donation_form_nonce_{$form_id}", 'give-form-hash', false ) |
|
2146 | + 'data-time="'.time().'" data-nonce-life="'.give_get_nonce_life().'"/>', |
|
2147 | + give_get_nonce_field("give_donation_form_nonce_{$form_id}", 'give-form-hash', false) |
|
2150 | 2148 | ); |
2151 | 2149 | |
2152 | 2150 | // Price ID hidden field for variable (multi-level) donation forms. |
2153 | - if ( give_has_variable_prices( $form_id ) ) { |
|
2151 | + if (give_has_variable_prices($form_id)) { |
|
2154 | 2152 | // Get the default price ID. |
2155 | - $default_price = give_form_get_default_level( $form_id ); |
|
2156 | - $price_id = isset( $default_price['_give_id']['level_id'] ) ? $default_price['_give_id']['level_id'] : 0; |
|
2153 | + $default_price = give_form_get_default_level($form_id); |
|
2154 | + $price_id = isset($default_price['_give_id']['level_id']) ? $default_price['_give_id']['level_id'] : 0; |
|
2157 | 2155 | |
2158 | 2156 | echo sprintf( |
2159 | 2157 | '<input type="hidden" name="give-price-id" value="%s"/>', |
@@ -2162,7 +2160,7 @@ discard block |
||
2162 | 2160 | } |
2163 | 2161 | } |
2164 | 2162 | |
2165 | -add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 ); |
|
2163 | +add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3); |
|
2166 | 2164 | |
2167 | 2165 | /** |
2168 | 2166 | * Add currency settings on donation form. |
@@ -2174,20 +2172,20 @@ discard block |
||
2174 | 2172 | * |
2175 | 2173 | * @return array |
2176 | 2174 | */ |
2177 | -function __give_form_add_currency_settings( $form_html_tags, $form ) { |
|
2178 | - $form_currency = give_get_currency( $form->ID ); |
|
2179 | - $currency_settings = give_get_currency_formatting_settings( $form_currency ); |
|
2175 | +function __give_form_add_currency_settings($form_html_tags, $form) { |
|
2176 | + $form_currency = give_get_currency($form->ID); |
|
2177 | + $currency_settings = give_get_currency_formatting_settings($form_currency); |
|
2180 | 2178 | |
2181 | 2179 | // Check if currency exist. |
2182 | - if ( empty( $currency_settings ) ) { |
|
2180 | + if (empty($currency_settings)) { |
|
2183 | 2181 | return $form_html_tags; |
2184 | 2182 | } |
2185 | 2183 | |
2186 | - $form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency ); |
|
2184 | + $form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency); |
|
2187 | 2185 | $form_html_tags['data-currency_code'] = $form_currency; |
2188 | 2186 | |
2189 | - if ( ! empty( $currency_settings ) ) { |
|
2190 | - foreach ( $currency_settings as $key => $value ) { |
|
2187 | + if ( ! empty($currency_settings)) { |
|
2188 | + foreach ($currency_settings as $key => $value) { |
|
2191 | 2189 | $form_html_tags["data-{$key}"] = $value; |
2192 | 2190 | } |
2193 | 2191 | } |
@@ -2195,7 +2193,7 @@ discard block |
||
2195 | 2193 | return $form_html_tags; |
2196 | 2194 | } |
2197 | 2195 | |
2198 | -add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 ); |
|
2196 | +add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2); |
|
2199 | 2197 | |
2200 | 2198 | /** |
2201 | 2199 | * Adds classes to progress bar container. |
@@ -2206,7 +2204,7 @@ discard block |
||
2206 | 2204 | * |
2207 | 2205 | * @return string |
2208 | 2206 | */ |
2209 | -function add_give_goal_progress_class( $class_goal ) { |
|
2207 | +function add_give_goal_progress_class($class_goal) { |
|
2210 | 2208 | $class_goal = 'progress progress-striped active'; |
2211 | 2209 | |
2212 | 2210 | return $class_goal; |
@@ -2221,7 +2219,7 @@ discard block |
||
2221 | 2219 | * |
2222 | 2220 | * @return string |
2223 | 2221 | */ |
2224 | -function add_give_goal_progress_bar_class( $class_bar ) { |
|
2222 | +function add_give_goal_progress_bar_class($class_bar) { |
|
2225 | 2223 | $class_bar = 'bar'; |
2226 | 2224 | |
2227 | 2225 | return $class_bar; |
@@ -2238,12 +2236,12 @@ discard block |
||
2238 | 2236 | * |
2239 | 2237 | * @return array |
2240 | 2238 | */ |
2241 | -function add_class_for_form_grid( $class, $id, $args ) { |
|
2239 | +function add_class_for_form_grid($class, $id, $args) { |
|
2242 | 2240 | $class[] = 'give-form-grid-wrap'; |
2243 | 2241 | |
2244 | - foreach ( $class as $index => $item ) { |
|
2245 | - if( false !== strpos( $item, 'give-display-' ) ) { |
|
2246 | - unset( $class[$index] ); |
|
2242 | + foreach ($class as $index => $item) { |
|
2243 | + if (false !== strpos($item, 'give-display-')) { |
|
2244 | + unset($class[$index]); |
|
2247 | 2245 | } |
2248 | 2246 | } |
2249 | 2247 | |
@@ -2259,7 +2257,7 @@ discard block |
||
2259 | 2257 | * |
2260 | 2258 | * @since 2.1 |
2261 | 2259 | */ |
2262 | -function give_is_form_grid_page_hidden_field( $id, $args, $form ) { |
|
2260 | +function give_is_form_grid_page_hidden_field($id, $args, $form) { |
|
2263 | 2261 | echo '<input type="hidden" name="is-form-grid" value="true" />'; |
2264 | 2262 | } |
2265 | 2263 | |
@@ -2274,28 +2272,28 @@ discard block |
||
2274 | 2272 | * @since 2.1 |
2275 | 2273 | * @return string |
2276 | 2274 | */ |
2277 | -function give_redirect_and_popup_form( $redirect, $args ) { |
|
2275 | +function give_redirect_and_popup_form($redirect, $args) { |
|
2278 | 2276 | |
2279 | 2277 | // Check the page has Form Grid. |
2280 | - $is_form_grid = isset( $_POST['is-form-grid'] ) ? give_clean( $_POST['is-form-grid'] ) : ''; |
|
2278 | + $is_form_grid = isset($_POST['is-form-grid']) ? give_clean($_POST['is-form-grid']) : ''; |
|
2281 | 2279 | |
2282 | - if ( 'true' === $is_form_grid ) { |
|
2280 | + if ('true' === $is_form_grid) { |
|
2283 | 2281 | |
2284 | - $payment_mode = give_clean( $_POST['payment-mode'] ); |
|
2282 | + $payment_mode = give_clean($_POST['payment-mode']); |
|
2285 | 2283 | $form_id = $args['form-id']; |
2286 | 2284 | |
2287 | 2285 | // Get the URL without Query parameters. |
2288 | - $redirect = strtok( $redirect, '?' ); |
|
2286 | + $redirect = strtok($redirect, '?'); |
|
2289 | 2287 | |
2290 | 2288 | // Add query parameters 'form-id' and 'payment-mode'. |
2291 | - $redirect = add_query_arg( array( |
|
2289 | + $redirect = add_query_arg(array( |
|
2292 | 2290 | 'form-id' => $form_id, |
2293 | 2291 | 'payment-mode' => $payment_mode, |
2294 | - ), $redirect ); |
|
2292 | + ), $redirect); |
|
2295 | 2293 | } |
2296 | 2294 | |
2297 | 2295 | // Return the modified URL. |
2298 | 2296 | return $redirect; |
2299 | 2297 | } |
2300 | 2298 | |
2301 | -add_filter( 'give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2 ); |
|
2299 | +add_filter('give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2); |
@@ -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 | |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @global $wpdb |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_install( $network_wide = false ) { |
|
31 | +function give_install($network_wide = false) { |
|
32 | 32 | |
33 | 33 | global $wpdb; |
34 | 34 | |
35 | - if ( is_multisite() && $network_wide ) { |
|
35 | + if (is_multisite() && $network_wide) { |
|
36 | 36 | |
37 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
37 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
38 | 38 | |
39 | - switch_to_blog( $blog_id ); |
|
39 | + switch_to_blog($blog_id); |
|
40 | 40 | give_run_install(); |
41 | 41 | restore_current_blog(); |
42 | 42 | |
@@ -63,31 +63,31 @@ discard block |
||
63 | 63 | give_setup_post_types(); |
64 | 64 | |
65 | 65 | // Add Upgraded From Option. |
66 | - $current_version = get_option( 'give_version' ); |
|
67 | - if ( $current_version ) { |
|
68 | - update_option( 'give_version_upgraded_from', $current_version, false ); |
|
66 | + $current_version = get_option('give_version'); |
|
67 | + if ($current_version) { |
|
68 | + update_option('give_version_upgraded_from', $current_version, false); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Setup some default options. |
72 | 72 | $options = array(); |
73 | 73 | |
74 | 74 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency. |
75 | - if ( empty( $current_version ) ) { |
|
76 | - $options = array_merge( $options, give_get_default_settings() ); |
|
75 | + if (empty($current_version)) { |
|
76 | + $options = array_merge($options, give_get_default_settings()); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // Populate the default values. |
80 | - update_option( 'give_settings', array_merge( $give_options, $options ), false ); |
|
80 | + update_option('give_settings', array_merge($give_options, $options), false); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Run plugin upgrades. |
84 | 84 | * |
85 | 85 | * @since 1.8 |
86 | 86 | */ |
87 | - do_action( 'give_upgrades' ); |
|
87 | + do_action('give_upgrades'); |
|
88 | 88 | |
89 | - if ( GIVE_VERSION !== get_option( 'give_version' ) ) { |
|
90 | - update_option( 'give_version', GIVE_VERSION, false ); |
|
89 | + if (GIVE_VERSION !== get_option('give_version')) { |
|
90 | + update_option('give_version', GIVE_VERSION, false); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // Create Give roles. |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | // Set api version, end point and refresh permalink. |
99 | 99 | $api = new Give_API(); |
100 | 100 | $api->add_endpoint(); |
101 | - update_option( 'give_default_api_version', 'v' . $api->get_version(), false ); |
|
101 | + update_option('give_default_api_version', 'v'.$api->get_version(), false); |
|
102 | 102 | |
103 | 103 | flush_rewrite_rules(); |
104 | 104 | |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | $donor_meta->create_table(); |
110 | 110 | |
111 | 111 | // Add a temporary option to note that Give pages have been created. |
112 | - Give_Cache::set( '_give_installed', $options, 30, true ); |
|
112 | + Give_Cache::set('_give_installed', $options, 30, true); |
|
113 | 113 | |
114 | - if ( ! $current_version ) { |
|
114 | + if ( ! $current_version) { |
|
115 | 115 | |
116 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
116 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
117 | 117 | |
118 | 118 | // When new upgrade routines are added, mark them as complete on fresh install. |
119 | 119 | $upgrade_routines = array( |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | 'v220_rename_donation_meta_type', |
149 | 149 | ); |
150 | 150 | |
151 | - foreach ( $upgrade_routines as $upgrade ) { |
|
152 | - give_set_upgrade_complete( $upgrade ); |
|
151 | + foreach ($upgrade_routines as $upgrade) { |
|
152 | + give_set_upgrade_complete($upgrade); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | 156 | // Bail if activating from network, or bulk. |
157 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
157 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | 161 | // Add the transient to redirect. |
162 | - Give_Cache::set( '_give_activation_redirect', true, 30, true ); |
|
162 | + Give_Cache::set('_give_activation_redirect', true, 30, true); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | * @param int $site_id The Site ID. |
178 | 178 | * @param array $meta Blog Meta. |
179 | 179 | */ |
180 | -function give_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
180 | +function give_on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
181 | 181 | |
182 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
182 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
183 | 183 | |
184 | - switch_to_blog( $blog_id ); |
|
184 | + switch_to_blog($blog_id); |
|
185 | 185 | give_install(); |
186 | 186 | restore_current_blog(); |
187 | 187 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | } |
191 | 191 | |
192 | -add_action( 'wpmu_new_blog', 'give_on_create_blog', 10, 6 ); |
|
192 | +add_action('wpmu_new_blog', 'give_on_create_blog', 10, 6); |
|
193 | 193 | |
194 | 194 | |
195 | 195 | /** |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return array The tables to drop. |
204 | 204 | */ |
205 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
205 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
206 | 206 | |
207 | - switch_to_blog( $blog_id ); |
|
207 | + switch_to_blog($blog_id); |
|
208 | 208 | $donors_db = new Give_DB_Donors(); |
209 | 209 | $donor_meta_db = new Give_DB_Donor_Meta(); |
210 | 210 | |
211 | - if ( $donors_db->installed() ) { |
|
211 | + if ($donors_db->installed()) { |
|
212 | 212 | $tables[] = $donors_db->table_name; |
213 | 213 | $tables[] = $donor_meta_db->table_name; |
214 | 214 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | } |
220 | 220 | |
221 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
221 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
222 | 222 | |
223 | 223 | /** |
224 | 224 | * Post-installation |
@@ -230,16 +230,16 @@ discard block |
||
230 | 230 | */ |
231 | 231 | function give_after_install() { |
232 | 232 | |
233 | - if ( ! is_admin() ) { |
|
233 | + if ( ! is_admin()) { |
|
234 | 234 | return; |
235 | 235 | } |
236 | 236 | |
237 | - $give_options = Give_Cache::get( '_give_installed', true ); |
|
238 | - $give_table_check = get_option( '_give_table_check', false ); |
|
237 | + $give_options = Give_Cache::get('_give_installed', true); |
|
238 | + $give_table_check = get_option('_give_table_check', false); |
|
239 | 239 | |
240 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
240 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
241 | 241 | |
242 | - if ( ! @Give()->donor_meta->installed() ) { |
|
242 | + if ( ! @Give()->donor_meta->installed()) { |
|
243 | 243 | |
244 | 244 | // Create the donor meta database. |
245 | 245 | // (this ensures it creates it on multisite instances where it is network activated). |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | } |
249 | 249 | |
250 | - if ( ! @Give()->donors->installed() ) { |
|
250 | + if ( ! @Give()->donors->installed()) { |
|
251 | 251 | // Create the donor database. |
252 | 252 | // (this ensures it creates it on multisite instances where it is network activated). |
253 | 253 | @Give()->donors->create_table(); |
@@ -259,22 +259,22 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @param array $give_options Give plugin options. |
261 | 261 | */ |
262 | - do_action( 'give_after_install', $give_options ); |
|
262 | + do_action('give_after_install', $give_options); |
|
263 | 263 | } |
264 | 264 | |
265 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ), false ); |
|
265 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS), false); |
|
266 | 266 | |
267 | 267 | } |
268 | 268 | |
269 | 269 | // Delete the transient |
270 | - if ( false !== $give_options ) { |
|
271 | - Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) ); |
|
270 | + if (false !== $give_options) { |
|
271 | + Give_Cache::delete(Give_Cache::get_key('_give_installed')); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
275 | 275 | } |
276 | 276 | |
277 | -add_action( 'admin_init', 'give_after_install' ); |
|
277 | +add_action('admin_init', 'give_after_install'); |
|
278 | 278 | |
279 | 279 | |
280 | 280 | /** |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | |
290 | 290 | global $wp_roles; |
291 | 291 | |
292 | - if ( ! is_object( $wp_roles ) ) { |
|
292 | + if ( ! is_object($wp_roles)) { |
|
293 | 293 | return; |
294 | 294 | } |
295 | 295 | |
296 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
296 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
297 | 297 | |
298 | 298 | // Create Give plugin roles |
299 | 299 | $roles = new Give_Roles(); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | } |
306 | 306 | |
307 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
307 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
308 | 308 | |
309 | 309 | /** |
310 | 310 | * Default core setting values. |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | 'uninstall_on_delete' => 'disabled', |
347 | 347 | 'the_content_filter' => 'enabled', |
348 | 348 | 'scripts_footer' => 'disabled', |
349 | - 'agree_to_terms_label' => __( 'Agree to Terms?', 'give' ), |
|
349 | + 'agree_to_terms_label' => __('Agree to Terms?', 'give'), |
|
350 | 350 | 'agreement_text' => give_get_default_agreement_text(), |
351 | 351 | |
352 | 352 | // Paypal IPN verification. |
353 | 353 | 'paypal_verification' => 'enabled', |
354 | 354 | |
355 | 355 | // Default is manual gateway. |
356 | - 'gateways' => array( 'manual' => 1, 'offline' => 1 ), |
|
356 | + 'gateways' => array('manual' => 1, 'offline' => 1), |
|
357 | 357 | 'default_gateway' => 'manual', |
358 | 358 | |
359 | 359 | // Offline gateway setup. |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | */ |
382 | 382 | function give_get_default_agreement_text() { |
383 | 383 | |
384 | - $org_name = get_bloginfo( 'name' ); |
|
384 | + $org_name = get_bloginfo('name'); |
|
385 | 385 | |
386 | 386 | $agreement = sprintf( |
387 | 387 | '<p>Acceptance of any contribution, gift or grant is at the discretion of the %1$s. The %1$s will not accept any gift unless it can be used or expended consistently with the purpose and mission of the %1$s.</p> |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $org_name |
396 | 396 | ); |
397 | 397 | |
398 | - return apply_filters( 'give_get_default_agreement_text', $agreement, $org_name ); |
|
398 | + return apply_filters('give_get_default_agreement_text', $agreement, $org_name); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -409,19 +409,19 @@ discard block |
||
409 | 409 | function give_create_pages() { |
410 | 410 | |
411 | 411 | // Bailout if pages already created. |
412 | - if ( get_option( 'give_install_pages_created' ) ) { |
|
412 | + if (get_option('give_install_pages_created')) { |
|
413 | 413 | return false; |
414 | 414 | } |
415 | 415 | |
416 | 416 | $options = array(); |
417 | 417 | |
418 | 418 | // Checks if the Success Page option exists AND that the page exists. |
419 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
419 | + if ( ! get_post(give_get_option('success_page'))) { |
|
420 | 420 | |
421 | 421 | // Donation Confirmation (Success) Page |
422 | 422 | $success = wp_insert_post( |
423 | 423 | array( |
424 | - 'post_title' => esc_html__( 'Donation Confirmation', 'give' ), |
|
424 | + 'post_title' => esc_html__('Donation Confirmation', 'give'), |
|
425 | 425 | 'post_content' => '[give_receipt]', |
426 | 426 | 'post_status' => 'publish', |
427 | 427 | 'post_author' => 1, |
@@ -435,13 +435,13 @@ discard block |
||
435 | 435 | } |
436 | 436 | |
437 | 437 | // Checks if the Failure Page option exists AND that the page exists. |
438 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
438 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
439 | 439 | |
440 | 440 | // Failed Donation Page |
441 | 441 | $failed = wp_insert_post( |
442 | 442 | array( |
443 | - 'post_title' => esc_html__( 'Donation Failed', 'give' ), |
|
444 | - 'post_content' => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ), |
|
443 | + 'post_title' => esc_html__('Donation Failed', 'give'), |
|
444 | + 'post_content' => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'), |
|
445 | 445 | 'post_status' => 'publish', |
446 | 446 | 'post_author' => 1, |
447 | 447 | 'post_type' => 'page', |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | } |
454 | 454 | |
455 | 455 | // Checks if the History Page option exists AND that the page exists. |
456 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
456 | + if ( ! get_post(give_get_option('history_page'))) { |
|
457 | 457 | // Donation History Page |
458 | 458 | $history = wp_insert_post( |
459 | 459 | array( |
460 | - 'post_title' => esc_html__( 'Donation History', 'give' ), |
|
460 | + 'post_title' => esc_html__('Donation History', 'give'), |
|
461 | 461 | 'post_content' => '[donation_history]', |
462 | 462 | 'post_status' => 'publish', |
463 | 463 | 'post_author' => 1, |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | $options['history_page'] = $history; |
470 | 470 | } |
471 | 471 | |
472 | - if ( ! empty( $options ) ) { |
|
473 | - update_option( 'give_settings', array_merge( give_get_settings(), $options ), false ); |
|
472 | + if ( ! empty($options)) { |
|
473 | + update_option('give_settings', array_merge(give_get_settings(), $options), false); |
|
474 | 474 | } |
475 | 475 | |
476 | - add_option( 'give_install_pages_created', 1, '', false ); |
|
476 | + add_option('give_install_pages_created', 1, '', false); |
|
477 | 477 | } |
478 | 478 | |
479 | -add_action( 'admin_init', 'give_create_pages', - 1 ); |
|
479 | +add_action('admin_init', 'give_create_pages', - 1); |
@@ -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 | * @return Give_Donor_Wall |
51 | 51 | */ |
52 | 52 | public static function get_instance() { |
53 | - if ( null === static::$instance ) { |
|
53 | + if (null === static::$instance) { |
|
54 | 54 | self::$instance = new static(); |
55 | 55 | |
56 | 56 | self::$instance->setup_actions(); |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function setup_actions() { |
70 | 70 | |
71 | - add_shortcode( 'give_donor_wall', array( $this, 'render_shortcode' ) ); |
|
71 | + add_shortcode('give_donor_wall', array($this, 'render_shortcode')); |
|
72 | 72 | |
73 | - add_action( 'wp_ajax_give_get_donor_comments', array( $this, 'ajax_handler' ) ); |
|
74 | - add_action( 'wp_ajax_nopriv_give_get_donor_comments', array( $this, 'ajax_handler' ) ); |
|
73 | + add_action('wp_ajax_give_get_donor_comments', array($this, 'ajax_handler')); |
|
74 | + add_action('wp_ajax_nopriv_give_get_donor_comments', array($this, 'ajax_handler')); |
|
75 | 75 | |
76 | 76 | } |
77 | 77 | |
@@ -107,29 +107,29 @@ discard block |
||
107 | 107 | * } |
108 | 108 | * @return string|bool The markup of the form grid or false. |
109 | 109 | */ |
110 | - public function render_shortcode( $atts ) { |
|
110 | + public function render_shortcode($atts) { |
|
111 | 111 | |
112 | 112 | $give_settings = give_get_settings(); |
113 | 113 | |
114 | - $atts = $this->parse_atts( $atts ); |
|
115 | - $donor_query = $this->get_donor_query_atts( $atts ); |
|
116 | - $donors = $this->get_donors( $donor_query ); |
|
114 | + $atts = $this->parse_atts($atts); |
|
115 | + $donor_query = $this->get_donor_query_atts($atts); |
|
116 | + $donors = $this->get_donors($donor_query); |
|
117 | 117 | $html = ''; |
118 | 118 | |
119 | - if ( $donors ) { |
|
119 | + if ($donors) { |
|
120 | 120 | |
121 | 121 | ob_start(); |
122 | 122 | |
123 | - foreach ( $donors as $donor ) { |
|
123 | + foreach ($donors as $donor) { |
|
124 | 124 | // Give/templates/shortcode-donor-wall.php. |
125 | - give_get_template( 'shortcode-donor-wall', array( $donor, $give_settings, $atts ) ); |
|
125 | + give_get_template('shortcode-donor-wall', array($donor, $give_settings, $atts)); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | $html = ob_get_clean(); |
129 | 129 | |
130 | 130 | // Return only donor html. |
131 | 131 | if ( |
132 | - isset( $atts['only_donor_html'] ) |
|
132 | + isset($atts['only_donor_html']) |
|
133 | 133 | && wp_doing_ajax() |
134 | 134 | && $atts['only_donor_html'] |
135 | 135 | ) { |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | $next_donor_query['fields'] = 'id'; |
143 | 143 | |
144 | 144 | $more_btn_html = ''; |
145 | - if ( $this->get_donors( $next_donor_query ) ) { |
|
145 | + if ($this->get_donors($next_donor_query)) { |
|
146 | 146 | $more_btn_html = sprintf( |
147 | 147 | '<button class="give-donor__load_more give-button-with-loader" data-shortcode="%1$s"><span class="give-loading-animation"></span>%2$s</button>', |
148 | - rawurlencode( http_build_query( $atts ) ), |
|
148 | + rawurlencode(http_build_query($atts)), |
|
149 | 149 | $atts['loadmore_text'] |
150 | 150 | ); |
151 | 151 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $html = $html |
154 | 154 | ? sprintf( |
155 | 155 | '<div class="give-wrap give-grid-ie-utility"><div class="give-grid give-grid--%1$s">%2$s</div>%3$s</div>', |
156 | - esc_attr( $atts['columns'] ), |
|
156 | + esc_attr($atts['columns']), |
|
157 | 157 | $html, |
158 | 158 | $more_btn_html |
159 | 159 | ) |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return array |
174 | 174 | */ |
175 | - public function parse_atts( $atts ) { |
|
175 | + public function parse_atts($atts) { |
|
176 | 176 | $atts = shortcode_atts( |
177 | 177 | array( |
178 | 178 | 'donors_per_page' => 20, |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | 'show_comments' => true, |
188 | 188 | 'comment_length' => 20, |
189 | 189 | 'only_comments' => false, |
190 | - 'readmore_text' => esc_html__( 'Read More', 'give' ), |
|
191 | - 'loadmore_text' => esc_html__( 'Load More', 'give' ), |
|
190 | + 'readmore_text' => esc_html__('Read More', 'give'), |
|
191 | + 'loadmore_text' => esc_html__('Load More', 'give'), |
|
192 | 192 | 'avatar_size' => 60, |
193 | 193 | 'orderby' => 'donation_count', |
194 | 194 | 'order' => 'DESC', |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | ); |
199 | 199 | |
200 | 200 | // Validate integer attributes. |
201 | - $atts['donors_per_page'] = absint( $atts['donors_per_page'] ); |
|
201 | + $atts['donors_per_page'] = absint($atts['donors_per_page']); |
|
202 | 202 | |
203 | 203 | // Validate boolean attributes. |
204 | 204 | $boolean_attributes = array( |
@@ -213,14 +213,14 @@ discard block |
||
213 | 213 | 'only_donor_html', |
214 | 214 | ); |
215 | 215 | |
216 | - foreach ( $boolean_attributes as $att ) { |
|
216 | + foreach ($boolean_attributes as $att) { |
|
217 | 217 | // Convert numeric to boolean. |
218 | 218 | // It will prevent condition check against boolean value. |
219 | - if ( is_numeric( $atts[ $att ] ) ) { |
|
220 | - $atts[ $att ] = (bool) $atts[ $att ]; |
|
219 | + if (is_numeric($atts[$att])) { |
|
220 | + $atts[$att] = (bool) $atts[$att]; |
|
221 | 221 | } |
222 | 222 | |
223 | - $atts[ $att ] = filter_var( $atts[ $att ], FILTER_VALIDATE_BOOLEAN ); |
|
223 | + $atts[$att] = filter_var($atts[$att], FILTER_VALIDATE_BOOLEAN); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | return $atts; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return array |
238 | 238 | */ |
239 | - public function get_donor_query_atts( $atts ) { |
|
239 | + public function get_donor_query_atts($atts) { |
|
240 | 240 | // Set default form query args. |
241 | 241 | $donor_args = array( |
242 | 242 | 'number' => $atts['donors_per_page'], |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | ); |
247 | 247 | |
248 | 248 | // Hide donors with zero donation amount. |
249 | - if ( $atts['hide_empty'] ) { |
|
249 | + if ($atts['hide_empty']) { |
|
250 | 250 | $donor_args['donation_amount'] = array( |
251 | 251 | 'compare' => '>=', |
252 | 252 | 'amount' => 1, |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | } |
255 | 255 | |
256 | 256 | // Show donor who donated to specific form. |
257 | - if ( $atts['form_id'] ) { |
|
257 | + if ($atts['form_id']) { |
|
258 | 258 | $donor_args['give_forms'] = $atts['form_id']; |
259 | 259 | } |
260 | 260 | |
261 | 261 | // Show donor by id. |
262 | - if ( $atts['ids'] ) { |
|
262 | + if ($atts['ids']) { |
|
263 | 263 | $donor_args['donor'] = $atts['ids']; |
264 | 264 | } |
265 | 265 | |
266 | 266 | // Replace donation with purchase because donor table has that prefix in column name. |
267 | 267 | $donor_args['orderby'] = str_replace( |
268 | - array( 'donation', 'amount' ), array( |
|
268 | + array('donation', 'amount'), array( |
|
269 | 269 | 'purchase', |
270 | 270 | 'value', |
271 | 271 | ), $atts['orderby'] |
@@ -277,11 +277,11 @@ discard block |
||
277 | 277 | 'date_created' => 'DESC', |
278 | 278 | ); |
279 | 279 | |
280 | - unset( $donor_args['order'] ); |
|
280 | + unset($donor_args['order']); |
|
281 | 281 | |
282 | 282 | // Set payment query. |
283 | 283 | // @codingStandardsIgnoreStart |
284 | - if ( true === $atts['only_comments'] ) { |
|
284 | + if (true === $atts['only_comments']) { |
|
285 | 285 | $donor_args['meta_query'] = array( |
286 | 286 | array( |
287 | 287 | 'key' => '_give_has_comment', |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @return array |
306 | 306 | */ |
307 | - public function get_donors( $donor_query ) { |
|
308 | - $donor_query = new Give_Donors_Query( $donor_query ); |
|
307 | + public function get_donors($donor_query) { |
|
308 | + $donor_query = new Give_Donors_Query($donor_query); |
|
309 | 309 | $donors = $donor_query->get_donors(); |
310 | 310 | |
311 | 311 | return $donors; |
@@ -319,26 +319,26 @@ discard block |
||
319 | 319 | * @access public |
320 | 320 | */ |
321 | 321 | public function ajax_handler() { |
322 | - $shortcode_atts = wp_parse_args( give_clean( rawurldecode( $_POST['data'] ) ) ); // @codingStandardsIgnoreLine |
|
322 | + $shortcode_atts = wp_parse_args(give_clean(rawurldecode($_POST['data']))); // @codingStandardsIgnoreLine |
|
323 | 323 | |
324 | 324 | // Get next page donor comments. |
325 | 325 | $shortcode_atts['paged'] = $shortcode_atts['paged'] + 1; |
326 | 326 | $shortcode_atts['only_donor_html'] = true; |
327 | 327 | |
328 | - $donors_comment_html = $this->render_shortcode( $shortcode_atts ); |
|
328 | + $donors_comment_html = $this->render_shortcode($shortcode_atts); |
|
329 | 329 | |
330 | 330 | // Check if donor comment remaining. |
331 | - $donor_query = $this->get_donor_query_atts( $shortcode_atts ); |
|
331 | + $donor_query = $this->get_donor_query_atts($shortcode_atts); |
|
332 | 332 | $donor_query['paged'] = $donor_query['paged'] + 1; |
333 | 333 | $donor_query['fields'] = 'id'; |
334 | - $has_donors = $this->get_donors( $donor_query ) ? 1 : 0; |
|
334 | + $has_donors = $this->get_donors($donor_query) ? 1 : 0; |
|
335 | 335 | |
336 | 336 | // Remove internal shortcode param. |
337 | - unset( $shortcode_atts['only_donor_html'] ); |
|
337 | + unset($shortcode_atts['only_donor_html']); |
|
338 | 338 | |
339 | 339 | wp_send_json( |
340 | 340 | array( |
341 | - 'shortcode' => rawurlencode( http_build_query( $shortcode_atts ) ), |
|
341 | + 'shortcode' => rawurlencode(http_build_query($shortcode_atts)), |
|
342 | 342 | 'html' => $donors_comment_html, |
343 | 343 | 'remaining' => $has_donors, |
344 | 344 | ) |
@@ -10,13 +10,13 @@ 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 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false, // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
66 | + public function search_box($text, $input_id) { |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function get_columns() { |
78 | 78 | $columns = array( |
79 | - 'ID' => __( 'Log ID', 'give' ), |
|
80 | - 'date' => __( 'Date', 'give' ), |
|
81 | - 'details' => __( 'Process Details', 'give' ), |
|
79 | + 'ID' => __('Log ID', 'give'), |
|
80 | + 'date' => __('Date', 'give'), |
|
81 | + 'details' => __('Process Details', 'give'), |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | return $columns; |
@@ -95,17 +95,17 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return string Column Name |
97 | 97 | */ |
98 | - public function column_default( $item, $column_name ) { |
|
99 | - switch ( $column_name ) { |
|
98 | + public function column_default($item, $column_name) { |
|
99 | + switch ($column_name) { |
|
100 | 100 | case 'ID': |
101 | 101 | return sprintf( |
102 | 102 | '<span class="give-item-label give-item-label-gray">%1$s</span> %2$s', |
103 | - esc_attr( $item[ $column_name ] ), |
|
104 | - esc_attr( $item['title'] ) |
|
103 | + esc_attr($item[$column_name]), |
|
104 | + esc_attr($item['title']) |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | default: |
108 | - return esc_attr( $item[ $column_name ] ); |
|
108 | + return esc_attr($item[$column_name]); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -119,24 +119,24 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return void |
121 | 121 | */ |
122 | - public function column_details( $item ) { |
|
123 | - echo Give()->tooltips->render_link( array( |
|
124 | - 'label' => __( 'View Update Log', 'give' ), |
|
122 | + public function column_details($item) { |
|
123 | + echo Give()->tooltips->render_link(array( |
|
124 | + 'label' => __('View Update Log', 'give'), |
|
125 | 125 | 'tag_content' => '<span class="dashicons dashicons-visibility"></span>', |
126 | 126 | 'link' => "#TB_inline?width=640&inlineId=log-details-{$item['ID']}", |
127 | 127 | 'attributes' => array( |
128 | 128 | 'class' => 'thickbox give-error-log-details-link button button-small', |
129 | 129 | ), |
130 | - ) ); |
|
130 | + )); |
|
131 | 131 | ?> |
132 | - <div id="log-details-<?php echo esc_attr( $item['ID'] ); ?>" style="display:none;"> |
|
132 | + <div id="log-details-<?php echo esc_attr($item['ID']); ?>" style="display:none;"> |
|
133 | 133 | <?php |
134 | 134 | |
135 | 135 | // Print Log Content, if not empty. |
136 | - if ( ! empty( $item['log_content'] ) ) { |
|
136 | + if ( ! empty($item['log_content'])) { |
|
137 | 137 | echo sprintf( |
138 | 138 | '<p><pre>%1$s</pre></div>', |
139 | - esc_html( $item['log_content'] ) |
|
139 | + esc_html($item['log_content']) |
|
140 | 140 | ); |
141 | 141 | } |
142 | 142 | ?> |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @param string $which |
159 | 159 | */ |
160 | - protected function display_tablenav( $which ) { |
|
161 | - if ( 'top' === $which ) { |
|
162 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
160 | + protected function display_tablenav($which) { |
|
161 | + if ('top' === $which) { |
|
162 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
163 | 163 | } |
164 | 164 | ?> |
165 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
165 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
166 | 166 | |
167 | 167 | <div class="alignleft actions bulkactions"> |
168 | - <?php $this->bulk_actions( $which ); ?> |
|
168 | + <?php $this->bulk_actions($which); ?> |
|
169 | 169 | </div> |
170 | 170 | <?php |
171 | - $this->extra_tablenav( $which ); |
|
172 | - $this->pagination( $which ); |
|
171 | + $this->extra_tablenav($which); |
|
172 | + $this->pagination($which); |
|
173 | 173 | ?> |
174 | 174 | |
175 | 175 | <br class="clear"/> |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @return int Current page number |
187 | 187 | */ |
188 | 188 | public function get_paged() { |
189 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
189 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return void |
201 | 201 | */ |
202 | - function bulk_actions( $which = '' ) { |
|
202 | + function bulk_actions($which = '') { |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | 'posts_per_page' => $this->per_page, |
220 | 220 | ); |
221 | 221 | |
222 | - $logs = Give()->logs->get_connected_logs( $log_query ); |
|
222 | + $logs = Give()->logs->get_connected_logs($log_query); |
|
223 | 223 | |
224 | - if ( $logs ) { |
|
225 | - foreach ( $logs as $log ) { |
|
224 | + if ($logs) { |
|
225 | + foreach ($logs as $log) { |
|
226 | 226 | |
227 | 227 | $logs_data[] = array( |
228 | 228 | 'ID' => $log->ID, |
@@ -254,14 +254,14 @@ discard block |
||
254 | 254 | $columns = $this->get_columns(); |
255 | 255 | $hidden = array(); // No hidden columns |
256 | 256 | $sortable = $this->get_sortable_columns(); |
257 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
257 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
258 | 258 | $this->items = $this->get_logs(); |
259 | - $total_items = Give()->logs->get_log_count( 0, 'update' ); |
|
259 | + $total_items = Give()->logs->get_log_count(0, 'update'); |
|
260 | 260 | |
261 | - $this->set_pagination_args( array( |
|
261 | + $this->set_pagination_args(array( |
|
262 | 262 | 'total_items' => $total_items, |
263 | 263 | 'per_page' => $this->per_page, |
264 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
265 | - ) ); |
|
264 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
265 | + )); |
|
266 | 266 | } |
267 | 267 | } |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,29 +16,29 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.5 |
18 | 18 | */ |
19 | -do_action( 'give_tools_recount_stats_before' ); |
|
19 | +do_action('give_tools_recount_stats_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | 23 | |
24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
25 | 25 | |
26 | 26 | <div class="inside recount-stats-controls"> |
27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
29 | 29 | |
30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
31 | 31 | |
32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
35 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
36 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
37 | - <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option> |
|
39 | - <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option> |
|
40 | - <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Payments', 'give' ); ?></option> |
|
41 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
35 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
36 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
37 | + <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option> |
|
39 | + <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option> |
|
40 | + <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e('Delete Imported Donors and Payments', 'give'); ?></option> |
|
41 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
42 | 42 | <?php |
43 | 43 | /** |
44 | 44 | * Fires in the recount stats selectbox. |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 1.5 |
49 | 49 | */ |
50 | - do_action( 'give_recount_tool_options' ); |
|
50 | + do_action('give_recount_tool_options'); |
|
51 | 51 | ?> |
52 | 52 | </select> |
53 | 53 | |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | 'class' => 'tools-form-dropdown-recount-form-select', |
58 | 58 | 'name' => 'form_id', |
59 | 59 | 'chosen' => true, |
60 | - 'placeholder' => __( 'Select Form', 'give' ), |
|
60 | + 'placeholder' => __('Select Form', 'give'), |
|
61 | 61 | ); |
62 | - echo Give()->html->forms_dropdown( $args ); |
|
62 | + echo Give()->html->forms_dropdown($args); |
|
63 | 63 | ?> |
64 | 64 | </span> |
65 | 65 | |
66 | 66 | <span class="tools-form-dropdown tools-form-dropdown-delete-import-donors" style="display: none"> |
67 | 67 | <label for="delete-import-donors"> |
68 | 68 | <?php |
69 | - echo Give()->html->checkbox( array( 'name' => 'delete-import-donors' ) ); |
|
70 | - esc_html_e( 'Delete imported WordPress users', 'give' ); |
|
69 | + echo Give()->html->checkbox(array('name' => 'delete-import-donors')); |
|
70 | + esc_html_e('Delete imported WordPress users', 'give'); |
|
71 | 71 | ?> |
72 | 72 | </label> |
73 | 73 | </span> |
74 | 74 | |
75 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
75 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
76 | 76 | |
77 | 77 | <br/> |
78 | 78 | |
79 | 79 | <span class="give-recount-stats-descriptions"> |
80 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
81 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
82 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
83 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
80 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
81 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
82 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
83 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
84 | 84 | <?php |
85 | 85 | /** |
86 | 86 | * Fires in the recount stats description area. |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @since 1.5 |
91 | 91 | */ |
92 | - do_action( 'give_recount_tool_descriptions' ); |
|
92 | + do_action('give_recount_tool_descriptions'); |
|
93 | 93 | ?> |
94 | - <span id="delete-test-transactions"><strong><?php esc_html_e( 'Deletes', 'give' ); ?></strong> <?php esc_html_e( 'all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
95 | - <span id="reset-stats"><strong><?php esc_html_e( 'Deletes', 'give' ); ?></strong> <?php esc_html_e( 'ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
94 | + <span id="delete-test-transactions"><strong><?php esc_html_e('Deletes', 'give'); ?></strong> <?php esc_html_e('all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
95 | + <span id="reset-stats"><strong><?php esc_html_e('Deletes', 'give'); ?></strong> <?php esc_html_e('ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
96 | 96 | </span> |
97 | 97 | |
98 | 98 | <span class="spinner"></span> |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @since 1.5 |
108 | 108 | */ |
109 | - do_action( 'give_tools_recount_forms' ); |
|
109 | + do_action('give_tools_recount_forms'); |
|
110 | 110 | ?> |
111 | 111 | </div><!-- .inside --> |
112 | 112 | </div><!-- .postbox --> |
@@ -117,4 +117,4 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @since 1.5 |
119 | 119 | */ |
120 | -do_action( 'give_tools_recount_stats_after' ); |
|
120 | +do_action('give_tools_recount_stats_after'); |
@@ -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; |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param array $settings Array of settings class object. |
74 | 74 | */ |
75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
76 | 76 | |
77 | 77 | return self::$settings; |
78 | 78 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return bool |
87 | 87 | */ |
88 | 88 | public static function verify_nonce() { |
89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | public static function save() { |
103 | 103 | $current_tab = give_get_current_setting_tab(); |
104 | 104 | |
105 | - if ( ! self::verify_nonce() ) { |
|
106 | - echo '<div class="notice error"><p>' . esc_attr__( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>'; |
|
105 | + if ( ! self::verify_nonce()) { |
|
106 | + echo '<div class="notice error"><p>'.esc_attr__('Action failed. Please refresh the page and retry.', 'give').'</p></div>'; |
|
107 | 107 | die(); |
108 | 108 | } |
109 | 109 | |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @since 1.8 |
118 | 118 | */ |
119 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
119 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
120 | 120 | |
121 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
121 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Trigger Action. |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @since 1.8 |
131 | 131 | */ |
132 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
132 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return void |
144 | 144 | */ |
145 | - public static function add_message( $code, $message ) { |
|
146 | - self::$messages[ $code ] = $message; |
|
145 | + public static function add_message($code, $message) { |
|
146 | + self::$messages[$code] = $message; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @return void |
158 | 158 | */ |
159 | - public static function add_error( $code, $message ) { |
|
160 | - self::$errors[ $code ] = $message; |
|
159 | + public static function add_error($code, $message) { |
|
160 | + self::$errors[$code] = $message; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | $notice_html = ''; |
171 | 171 | $classes = 'give-notice settings-error notice is-dismissible'; |
172 | 172 | |
173 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
174 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
173 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
174 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
175 | 175 | |
176 | - if ( 0 < count( self::$errors ) ) { |
|
177 | - foreach ( self::$errors as $code => $message ) { |
|
176 | + if (0 < count(self::$errors)) { |
|
177 | + foreach (self::$errors as $code => $message) { |
|
178 | 178 | $notice_html .= sprintf( |
179 | 179 | '<div id="setting-error-%1$s" class="%2$s error" style="display: none"><p><strong>%3$s</strong></p></div>', |
180 | 180 | $code, |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - if ( 0 < count( self::$messages ) ) { |
|
188 | - foreach ( self::$messages as $code => $message ) { |
|
187 | + if (0 < count(self::$messages)) { |
|
188 | + foreach (self::$messages as $code => $message) { |
|
189 | 189 | $notice_html .= sprintf( |
190 | 190 | '<div id="setting-error-%1$s" class="%2$s updated" style="display: none"><p><strong>%3$s</strong></p></div>', |
191 | 191 | $code, |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | self::$setting_filter_prefix = give_get_current_setting_page(); |
212 | 212 | |
213 | 213 | // Bailout: Exit if setting page is not defined. |
214 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
214 | + if (empty(self::$setting_filter_prefix)) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @since 1.8 |
226 | 226 | */ |
227 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
227 | + do_action(self::$setting_filter_prefix.'_start'); |
|
228 | 228 | |
229 | 229 | $current_tab = give_get_current_setting_tab(); |
230 | 230 | |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | /* @var object $current_setting_obj */ |
235 | 235 | $current_setting_obj = new StdClass; |
236 | 236 | |
237 | - foreach ( $all_setting as $setting ) { |
|
237 | + foreach ($all_setting as $setting) { |
|
238 | 238 | if ( |
239 | - method_exists( $setting, 'get_id' ) && |
|
239 | + method_exists($setting, 'get_id') && |
|
240 | 240 | $current_tab === $setting->get_id() |
241 | 241 | ) { |
242 | 242 | $current_setting_obj = $setting; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | // Save settings if data has been posted. |
248 | - if ( isset( $_POST['_give-save-settings'] ) ) { |
|
248 | + if (isset($_POST['_give-save-settings'])) { |
|
249 | 249 | self::save(); |
250 | 250 | } |
251 | 251 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @since 1.8 |
260 | 260 | */ |
261 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
261 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
262 | 262 | |
263 | 263 | include 'views/html-admin-settings.php'; |
264 | 264 | |
@@ -276,25 +276,25 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @return string|bool |
278 | 278 | */ |
279 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
279 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
280 | 280 | // Bailout. |
281 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
281 | + if (empty($option_name) && empty($field_id)) { |
|
282 | 282 | return false; |
283 | 283 | } |
284 | 284 | |
285 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
285 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
286 | 286 | // Get field value if any. |
287 | - $option_value = get_option( $option_name ); |
|
287 | + $option_value = get_option($option_name); |
|
288 | 288 | |
289 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
290 | - ? $option_value[ $field_id ] |
|
289 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
290 | + ? $option_value[$field_id] |
|
291 | 291 | : $default; |
292 | 292 | } else { |
293 | 293 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
294 | 294 | $option_name = ! $option_name ? $field_id : $option_name; |
295 | 295 | |
296 | 296 | // Get option value if any. |
297 | - $option_value = get_option( $option_name, $default ); |
|
297 | + $option_value = get_option($option_name, $default); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @param string $field_id |
308 | 308 | * @param mixed $default |
309 | 309 | */ |
310 | - return apply_filters( 'give_admin_field_get_value', $option_value, $option_name, $field_id, $default ); |
|
310 | + return apply_filters('give_admin_field_get_value', $option_value, $option_name, $field_id, $default); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @return void |
325 | 325 | */ |
326 | - public static function output_fields( $options, $option_name = '' ) { |
|
326 | + public static function output_fields($options, $option_name = '') { |
|
327 | 327 | $current_tab = give_get_current_setting_tab(); |
328 | 328 | |
329 | 329 | // Field Default values. |
@@ -335,62 +335,62 @@ discard block |
||
335 | 335 | 'desc' => '', |
336 | 336 | 'table_html' => true, |
337 | 337 | 'repeat' => false, |
338 | - 'repeat_btn_title' => __( 'Add Field', 'give' ), |
|
338 | + 'repeat_btn_title' => __('Add Field', 'give'), |
|
339 | 339 | ); |
340 | 340 | |
341 | - foreach ( $options as $value ) { |
|
342 | - if ( ! isset( $value['type'] ) ) { |
|
341 | + foreach ($options as $value) { |
|
342 | + if ( ! isset($value['type'])) { |
|
343 | 343 | continue; |
344 | 344 | } |
345 | 345 | |
346 | 346 | // Set title. |
347 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
347 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
348 | 348 | |
349 | 349 | // Set default setting. |
350 | - $value = wp_parse_args( $value, $defaults ); |
|
350 | + $value = wp_parse_args($value, $defaults); |
|
351 | 351 | |
352 | 352 | // Colorpicker field. |
353 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
354 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
353 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
354 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
355 | 355 | |
356 | 356 | |
357 | 357 | // Custom attribute handling. |
358 | 358 | $custom_attributes = array(); |
359 | 359 | |
360 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
361 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
362 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
360 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
361 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
362 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | |
366 | 366 | // Description handling. |
367 | - $description = self::get_field_description( $value ); |
|
367 | + $description = self::get_field_description($value); |
|
368 | 368 | |
369 | 369 | // Switch based on type. |
370 | - switch ( $value['type'] ) { |
|
370 | + switch ($value['type']) { |
|
371 | 371 | |
372 | 372 | // Section Titles. |
373 | 373 | case 'title': |
374 | - if ( ! empty( $value['title'] ) || ! empty( $value['desc'] ) ) { |
|
374 | + if ( ! empty($value['title']) || ! empty($value['desc'])) { |
|
375 | 375 | ?> |
376 | 376 | <div class="give-setting-tab-header give-setting-tab-header-<?php echo $current_tab; ?>"> |
377 | - <?php if ( ! empty( $value['title'] ) ) : ?> |
|
378 | - <h2><?php echo self::get_field_title( $value ); ?></h2> |
|
377 | + <?php if ( ! empty($value['title'])) : ?> |
|
378 | + <h2><?php echo self::get_field_title($value); ?></h2> |
|
379 | 379 | <hr> |
380 | 380 | <?php endif; ?> |
381 | 381 | |
382 | - <?php if ( ! empty( $value['desc'] ) ) : ?> |
|
383 | - <?php echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); ?> |
|
382 | + <?php if ( ! empty($value['desc'])) : ?> |
|
383 | + <?php echo wpautop(wptexturize(wp_kses_post($value['desc']))); ?> |
|
384 | 384 | <?php endif; ?> |
385 | 385 | </div> |
386 | 386 | <?php |
387 | 387 | } |
388 | 388 | |
389 | - if ( $value['table_html'] ) { |
|
390 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
389 | + if ($value['table_html']) { |
|
390 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
391 | 391 | } |
392 | 392 | |
393 | - if ( ! empty( $value['id'] ) ) { |
|
393 | + if ( ! empty($value['id'])) { |
|
394 | 394 | |
395 | 395 | /** |
396 | 396 | * Trigger Action. |
@@ -399,14 +399,14 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @since 1.8 |
401 | 401 | */ |
402 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
402 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | break; |
406 | 406 | |
407 | 407 | // Section Ends. |
408 | 408 | case 'sectionend': |
409 | - if ( ! empty( $value['id'] ) ) { |
|
409 | + if ( ! empty($value['id'])) { |
|
410 | 410 | |
411 | 411 | /** |
412 | 412 | * Trigger Action. |
@@ -415,14 +415,14 @@ discard block |
||
415 | 415 | * |
416 | 416 | * @since 1.8 |
417 | 417 | */ |
418 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
418 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
419 | 419 | } |
420 | 420 | |
421 | - if ( $value['table_html'] ) { |
|
421 | + if ($value['table_html']) { |
|
422 | 422 | echo '</table>'; |
423 | 423 | } |
424 | 424 | |
425 | - if ( ! empty( $value['id'] ) ) { |
|
425 | + if ( ! empty($value['id'])) { |
|
426 | 426 | |
427 | 427 | /** |
428 | 428 | * Trigger Action. |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * |
432 | 432 | * @since 1.8 |
433 | 433 | */ |
434 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
434 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | break; |
@@ -439,51 +439,51 @@ discard block |
||
439 | 439 | // Standard text inputs and subtypes like 'number'. |
440 | 440 | case 'colorpicker': |
441 | 441 | case 'hidden' : |
442 | - $value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden'; |
|
442 | + $value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden'; |
|
443 | 443 | case 'text': |
444 | 444 | case 'email': |
445 | 445 | case 'number': |
446 | 446 | case 'password' : |
447 | 447 | $type = $value['type']; |
448 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
448 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
449 | 449 | |
450 | 450 | // Set default value for repeater field if not any value set yet. |
451 | - if ( $value['repeat'] && is_string( $option_value ) ) { |
|
452 | - $option_value = array( $value['default'] ); |
|
451 | + if ($value['repeat'] && is_string($option_value)) { |
|
452 | + $option_value = array($value['default']); |
|
453 | 453 | } |
454 | 454 | ?> |
455 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
455 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
456 | 456 | <th scope="row" class="titledesc"> |
457 | 457 | <label |
458 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
458 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
459 | 459 | </th> |
460 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
461 | - <?php if ( $value['repeat'] ) : ?> |
|
462 | - <?php foreach ( $option_value as $index => $field_value ) : ?> |
|
460 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
461 | + <?php if ($value['repeat']) : ?> |
|
462 | + <?php foreach ($option_value as $index => $field_value) : ?> |
|
463 | 463 | <p> |
464 | 464 | <input |
465 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
466 | - type="<?php echo esc_attr( $type ); ?>" |
|
467 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
468 | - value="<?php echo esc_attr( $field_value ); ?>" |
|
469 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?> <?php echo esc_attr( $value['id'] ); ?>" |
|
470 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
465 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
466 | + type="<?php echo esc_attr($type); ?>" |
|
467 | + style="<?php echo esc_attr($value['css']); ?>" |
|
468 | + value="<?php echo esc_attr($field_value); ?>" |
|
469 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?> <?php echo esc_attr($value['id']); ?>" |
|
470 | + <?php echo implode(' ', $custom_attributes); ?> |
|
471 | 471 | /> |
472 | 472 | <span class="give-remove-setting-field" |
473 | - title="<?php esc_html_e( 'Remove setting field', 'give' ); ?>">-</span> |
|
473 | + title="<?php esc_html_e('Remove setting field', 'give'); ?>">-</span> |
|
474 | 474 | </p> |
475 | 475 | <?php endforeach; ?> |
476 | 476 | <a href="#" data-id="<?php echo $value['id']; ?>" |
477 | 477 | class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a> |
478 | 478 | <?php else : ?> |
479 | 479 | <input |
480 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
481 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
482 | - type="<?php echo esc_attr( $type ); ?>" |
|
483 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
484 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
485 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
486 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
480 | + name="<?php echo esc_attr($value['id']); ?>" |
|
481 | + id="<?php echo esc_attr($value['id']); ?>" |
|
482 | + type="<?php echo esc_attr($type); ?>" |
|
483 | + style="<?php echo esc_attr($value['css']); ?>" |
|
484 | + value="<?php echo esc_attr($option_value); ?>" |
|
485 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
486 | + <?php echo implode(' ', $custom_attributes); ?> |
|
487 | 487 | /> |
488 | 488 | <?php endif; ?> |
489 | 489 | <?php echo $description; ?> |
@@ -494,26 +494,26 @@ discard block |
||
494 | 494 | // Textarea. |
495 | 495 | case 'textarea': |
496 | 496 | |
497 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
497 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
498 | 498 | $default_attributes = array( |
499 | 499 | 'rows' => 10, |
500 | 500 | 'cols' => 60 |
501 | 501 | ); |
502 | - $textarea_attributes = isset( $value['attributes'] ) ? $value['attributes'] : array(); |
|
502 | + $textarea_attributes = isset($value['attributes']) ? $value['attributes'] : array(); |
|
503 | 503 | ?> |
504 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
504 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
505 | 505 | <th scope="row" class="titledesc"> |
506 | 506 | <label |
507 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
507 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
508 | 508 | </th> |
509 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
509 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
510 | 510 | <textarea |
511 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
512 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
513 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
514 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
515 | - <?php echo give_get_attribute_str( $textarea_attributes, $default_attributes ); ?> |
|
516 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
511 | + name="<?php echo esc_attr($value['id']); ?>" |
|
512 | + id="<?php echo esc_attr($value['id']); ?>" |
|
513 | + style="<?php echo esc_attr($value['css']); ?>" |
|
514 | + class="<?php echo esc_attr($value['class']); ?>" |
|
515 | + <?php echo give_get_attribute_str($textarea_attributes, $default_attributes); ?> |
|
516 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
517 | 517 | <?php echo $description; ?> |
518 | 518 | </td> |
519 | 519 | </tr> |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | // Select boxes. |
524 | 524 | case 'select' : |
525 | 525 | case 'multiselect' : |
526 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
526 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
527 | 527 | |
528 | 528 | /** |
529 | 529 | * Insert page in option if missing. |
@@ -531,39 +531,39 @@ discard block |
||
531 | 531 | * Check success_page setting in general settings. |
532 | 532 | */ |
533 | 533 | if ( |
534 | - isset( $value['attributes'] ) && |
|
535 | - false !== strpos( $value['class'], 'give-select-chosen' ) && |
|
536 | - in_array( 'data-search-type', array_keys( $value['attributes' ] ) ) && |
|
537 | - 'pages' === $value['attributes' ]['data-search-type'] && |
|
538 | - ! in_array( $option_value, array_keys( $value['options'] ) ) |
|
534 | + isset($value['attributes']) && |
|
535 | + false !== strpos($value['class'], 'give-select-chosen') && |
|
536 | + in_array('data-search-type', array_keys($value['attributes'])) && |
|
537 | + 'pages' === $value['attributes']['data-search-type'] && |
|
538 | + ! in_array($option_value, array_keys($value['options'])) |
|
539 | 539 | ) { |
540 | - $value['options'][ $option_value ] = get_the_title( $option_value ); |
|
540 | + $value['options'][$option_value] = get_the_title($option_value); |
|
541 | 541 | } |
542 | 542 | ?> |
543 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
543 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
544 | 544 | <th scope="row" class="titledesc"> |
545 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
545 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
546 | 546 | </th> |
547 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
547 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
548 | 548 | <select |
549 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( 'multiselect' === $value['type'] ) echo '[]'; ?>" |
|
550 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
551 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
552 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
553 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
554 | - <?php echo ( 'multiselect' === $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
549 | + name="<?php echo esc_attr($value['id']); ?><?php if ('multiselect' === $value['type']) echo '[]'; ?>" |
|
550 | + id="<?php echo esc_attr($value['id']); ?>" |
|
551 | + style="<?php echo esc_attr($value['css']); ?>" |
|
552 | + class="<?php echo esc_attr($value['class']); ?>" |
|
553 | + <?php echo implode(' ', $custom_attributes); ?> |
|
554 | + <?php echo ('multiselect' === $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
555 | 555 | > |
556 | 556 | |
557 | 557 | <?php |
558 | - if ( ! empty( $value['options'] ) ) { |
|
559 | - foreach ( $value['options'] as $key => $val ) { |
|
558 | + if ( ! empty($value['options'])) { |
|
559 | + foreach ($value['options'] as $key => $val) { |
|
560 | 560 | ?> |
561 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
561 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
562 | 562 | |
563 | - if ( is_array( $option_value ) ) { |
|
564 | - selected( in_array( $key, $option_value ), true ); |
|
563 | + if (is_array($option_value)) { |
|
564 | + selected(in_array($key, $option_value), true); |
|
565 | 565 | } else { |
566 | - selected( $option_value, $key ); |
|
566 | + selected($option_value, $key); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | ?>><?php echo $val ?></option> |
@@ -579,29 +579,29 @@ discard block |
||
579 | 579 | |
580 | 580 | // Radio inputs. |
581 | 581 | case 'radio_inline' : |
582 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
582 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
583 | 583 | case 'radio' : |
584 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
584 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
585 | 585 | ?> |
586 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
586 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
587 | 587 | <th scope="row" class="titledesc"> |
588 | 588 | <label |
589 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
589 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
590 | 590 | </th> |
591 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
591 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
592 | 592 | <fieldset> |
593 | 593 | <ul> |
594 | 594 | <?php |
595 | - foreach ( $value['options'] as $key => $val ) { |
|
595 | + foreach ($value['options'] as $key => $val) { |
|
596 | 596 | ?> |
597 | 597 | <li> |
598 | 598 | <label><input |
599 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
599 | + name="<?php echo esc_attr($value['id']); ?>" |
|
600 | 600 | value="<?php echo $key; ?>" |
601 | 601 | type="radio" |
602 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
603 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
604 | - <?php checked( $key, $option_value ); ?> |
|
602 | + style="<?php echo esc_attr($value['css']); ?>" |
|
603 | + <?php echo implode(' ', $custom_attributes); ?> |
|
604 | + <?php checked($key, $option_value); ?> |
|
605 | 605 | /> <?php echo $val ?></label> |
606 | 606 | </li> |
607 | 607 | <?php |
@@ -615,22 +615,22 @@ discard block |
||
615 | 615 | |
616 | 616 | // Checkbox input. |
617 | 617 | case 'checkbox' : |
618 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
618 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
619 | 619 | ?> |
620 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
620 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
621 | 621 | <th scope="row" class="titledesc"> |
622 | 622 | <label |
623 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
623 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
624 | 624 | </th> |
625 | 625 | <td class="give-forminp"> |
626 | 626 | <input |
627 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
628 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
627 | + name="<?php echo esc_attr($value['id']); ?>" |
|
628 | + id="<?php echo esc_attr($value['id']); ?>" |
|
629 | 629 | type="checkbox" |
630 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
630 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
631 | 631 | value="1" |
632 | - <?php checked( $option_value, 'on' ); ?> |
|
633 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
632 | + <?php checked($option_value, 'on'); ?> |
|
633 | + <?php echo implode(' ', $custom_attributes); ?> |
|
634 | 634 | /> |
635 | 635 | <?php echo $description; ?> |
636 | 636 | </td> |
@@ -640,29 +640,29 @@ discard block |
||
640 | 640 | |
641 | 641 | // Multi Checkbox input. |
642 | 642 | case 'multicheck' : |
643 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
644 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
643 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
644 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
645 | 645 | ?> |
646 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
646 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
647 | 647 | <th scope="row" class="titledesc"> |
648 | 648 | <label |
649 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
649 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
650 | 650 | </th> |
651 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
651 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
652 | 652 | <fieldset> |
653 | 653 | <ul> |
654 | 654 | <?php |
655 | - foreach ( $value['options'] as $key => $val ) { |
|
655 | + foreach ($value['options'] as $key => $val) { |
|
656 | 656 | ?> |
657 | 657 | <li> |
658 | 658 | <label> |
659 | 659 | <input |
660 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
660 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
661 | 661 | value="<?php echo $key; ?>" |
662 | 662 | type="checkbox" |
663 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
664 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
665 | - <?php if ( in_array( $key, $option_value ) ) { |
|
663 | + style="<?php echo esc_attr($value['css']); ?>" |
|
664 | + <?php echo implode(' ', $custom_attributes); ?> |
|
665 | + <?php if (in_array($key, $option_value)) { |
|
666 | 666 | echo 'checked="checked"'; |
667 | 667 | } ?> |
668 | 668 | /> <?php echo $val ?> |
@@ -681,31 +681,31 @@ discard block |
||
681 | 681 | // File input field. |
682 | 682 | case 'file' : |
683 | 683 | case 'media' : |
684 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
685 | - $button_label = sprintf( __( 'Add or Upload %s', 'give' ), ( 'file' === $value['type'] ? __( 'File', 'give' ) : __( 'Image', 'give' ) ) ); |
|
686 | - $fvalue = empty( $value['fvalue'] ) ? 'url' : $value['fvalue']; |
|
687 | - |
|
688 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
689 | - $preview_image_src = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : ''; |
|
690 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
691 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
684 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
685 | + $button_label = sprintf(__('Add or Upload %s', 'give'), ('file' === $value['type'] ? __('File', 'give') : __('Image', 'give'))); |
|
686 | + $fvalue = empty($value['fvalue']) ? 'url' : $value['fvalue']; |
|
687 | + |
|
688 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
689 | + $preview_image_src = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : ''; |
|
690 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
691 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
692 | 692 | ?> |
693 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
693 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
694 | 694 | <th scope="row" class="titledesc"> |
695 | 695 | <label |
696 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
696 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
697 | 697 | </th> |
698 | 698 | <td class="give-forminp"> |
699 | 699 | <div class="give-field-wrap"> |
700 | 700 | <label for="<?php echo $value['id'] ?>"> |
701 | 701 | <input |
702 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
703 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
702 | + name="<?php echo esc_attr($value['id']); ?>" |
|
703 | + id="<?php echo esc_attr($value['id']); ?>" |
|
704 | 704 | type="text" |
705 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
705 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
706 | 706 | value="<?php echo $option_value; ?>" |
707 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
708 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
707 | + style="<?php echo esc_attr($value['css']); ?>" |
|
708 | + <?php echo implode(' ', $custom_attributes); ?> |
|
709 | 709 | /> <input class="give-upload-button button" type="button" |
710 | 710 | data-fvalue="<?php echo $fvalue; ?>" |
711 | 711 | data-field-type="<?php echo $value['type']; ?>" |
@@ -726,18 +726,18 @@ discard block |
||
726 | 726 | // WordPress Editor. |
727 | 727 | case 'wysiwyg' : |
728 | 728 | // Get option value. |
729 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
729 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
730 | 730 | |
731 | 731 | // Get editor settings. |
732 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
732 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
733 | 733 | ?> |
734 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
734 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
735 | 735 | <th scope="row" class="titledesc"> |
736 | 736 | <label |
737 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
737 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
738 | 738 | </th> |
739 | 739 | <td class="give-forminp"> |
740 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
740 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
741 | 741 | <?php echo $description; ?> |
742 | 742 | </td> |
743 | 743 | </tr><?php |
@@ -745,15 +745,15 @@ discard block |
||
745 | 745 | |
746 | 746 | // Custom: Default gateways setting field. |
747 | 747 | case 'default_gateway' : |
748 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
748 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
749 | 749 | ?> |
750 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
750 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
751 | 751 | <th scope="row" class="titledesc"> |
752 | 752 | <label |
753 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
753 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
754 | 754 | </th> |
755 | 755 | <td class="give-forminp"> |
756 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
756 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
757 | 757 | <?php echo $description; ?> |
758 | 758 | </td> |
759 | 759 | </tr><?php |
@@ -762,13 +762,13 @@ discard block |
||
762 | 762 | // Custom: Email preview buttons field. |
763 | 763 | case 'email_preview_buttons' : |
764 | 764 | ?> |
765 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
765 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
766 | 766 | <th scope="row" class="titledesc"> |
767 | 767 | <label |
768 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
768 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
769 | 769 | </th> |
770 | 770 | <td class="give-forminp"> |
771 | - <?php give_email_preview_buttons_callback( $value ); ?> |
|
771 | + <?php give_email_preview_buttons_callback($value); ?> |
|
772 | 772 | <?php echo $description; ?> |
773 | 773 | </td> |
774 | 774 | </tr><?php |
@@ -782,23 +782,23 @@ discard block |
||
782 | 782 | |
783 | 783 | // Custom: Gateway API key. |
784 | 784 | case 'api_key' : |
785 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
786 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
785 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
786 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
787 | 787 | ?> |
788 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
788 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
789 | 789 | <th scope="row" class="titledesc"> |
790 | 790 | <label |
791 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
791 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
792 | 792 | </th> |
793 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
793 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
794 | 794 | <input |
795 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
796 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
797 | - type="<?php echo esc_attr( $type ); ?>" |
|
798 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
799 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
800 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
801 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
795 | + name="<?php echo esc_attr($value['id']); ?>" |
|
796 | + id="<?php echo esc_attr($value['id']); ?>" |
|
797 | + type="<?php echo esc_attr($type); ?>" |
|
798 | + style="<?php echo esc_attr($value['css']); ?>" |
|
799 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
800 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
801 | + <?php echo implode(' ', $custom_attributes); ?> |
|
802 | 802 | /> <?php echo $description; ?> |
803 | 803 | </td> |
804 | 804 | </tr><?php |
@@ -808,54 +808,53 @@ discard block |
||
808 | 808 | case 'chosen' : |
809 | 809 | |
810 | 810 | // Get option value. |
811 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
812 | - $option_value = is_array( $option_value ) ? array_fill_keys( $option_value, 'selected' ) : $option_value; |
|
813 | - $wrapper_class = ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : ''; |
|
811 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
812 | + $option_value = is_array($option_value) ? array_fill_keys($option_value, 'selected') : $option_value; |
|
813 | + $wrapper_class = ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : ''; |
|
814 | 814 | $type = ''; |
815 | 815 | $allow_new_values = ''; |
816 | - $name = give_get_field_name( $value ); |
|
816 | + $name = give_get_field_name($value); |
|
817 | 817 | |
818 | 818 | // Set attributes based on multiselect datatype. |
819 | - if ( 'multiselect' === $value['data_type'] ) { |
|
819 | + if ('multiselect' === $value['data_type']) { |
|
820 | 820 | $type = 'multiple'; |
821 | 821 | $allow_new_values = 'data-allows-new-values="true"'; |
822 | - $name = $name . '[]'; |
|
823 | - $option_value = empty( $option_value ) ? array() : $option_value; |
|
822 | + $name = $name.'[]'; |
|
823 | + $option_value = empty($option_value) ? array() : $option_value; |
|
824 | 824 | } |
825 | 825 | |
826 | - $title_prefixes_value = ( is_array( $option_value ) && count( $option_value ) > 0 ) ? |
|
827 | - array_merge( $value['options'], $option_value ) : |
|
828 | - $value['options']; |
|
826 | + $title_prefixes_value = (is_array($option_value) && count($option_value) > 0) ? |
|
827 | + array_merge($value['options'], $option_value) : $value['options']; |
|
829 | 828 | |
830 | 829 | ?> |
831 | 830 | <tr valign="top" <?php echo $wrapper_class; ?>> |
832 | 831 | <th scope="row" class="titledesc"> |
833 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_attr( self::get_field_title( $value ) ); ?></label> |
|
832 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo esc_attr(self::get_field_title($value)); ?></label> |
|
834 | 833 | </th> |
835 | - <td class="give-forminp give-forminp-<?php echo esc_attr( $value['type'] ); ?>"> |
|
834 | + <td class="give-forminp give-forminp-<?php echo esc_attr($value['type']); ?>"> |
|
836 | 835 | <select |
837 | 836 | class="give-select-chosen give-chosen-settings" |
838 | - style="<?php echo esc_attr( $value['style'] ); ?>" |
|
839 | - name="<?php echo esc_attr( $name ); ?>" |
|
840 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
837 | + style="<?php echo esc_attr($value['style']); ?>" |
|
838 | + name="<?php echo esc_attr($name); ?>" |
|
839 | + id="<?php echo esc_attr($value['id']); ?>" |
|
841 | 840 | <?php |
842 | 841 | echo "{$type} {$allow_new_values}"; |
843 | - echo implode( ' ', $custom_attributes ); |
|
842 | + echo implode(' ', $custom_attributes); |
|
844 | 843 | ?> |
845 | 844 | > |
846 | 845 | <?php |
847 | - if ( is_array( $title_prefixes_value ) && count( $title_prefixes_value ) > 0 ) { |
|
848 | - foreach ( $title_prefixes_value as $key => $item_value ) { |
|
846 | + if (is_array($title_prefixes_value) && count($title_prefixes_value) > 0) { |
|
847 | + foreach ($title_prefixes_value as $key => $item_value) { |
|
849 | 848 | echo sprintf( |
850 | 849 | '<option %1$s value="%2$s">%2$s</option>', |
851 | - ( 'selected' === $item_value ) ? 'selected="selected"' : '', |
|
852 | - esc_attr( $key ) |
|
850 | + ('selected' === $item_value) ? 'selected="selected"' : '', |
|
851 | + esc_attr($key) |
|
853 | 852 | ); |
854 | 853 | } |
855 | 854 | } |
856 | 855 | ?> |
857 | 856 | </select> |
858 | - <?php echo wp_kses_post( $description ); ?> |
|
857 | + <?php echo wp_kses_post($description); ?> |
|
859 | 858 | </td> |
860 | 859 | </tr> |
861 | 860 | <?php |
@@ -872,7 +871,7 @@ discard block |
||
872 | 871 | * |
873 | 872 | * @since 1.0 |
874 | 873 | */ |
875 | - do_action( "give_logs_view_{$current_section}" ); |
|
874 | + do_action("give_logs_view_{$current_section}"); |
|
876 | 875 | |
877 | 876 | echo $description; |
878 | 877 | break; |
@@ -880,24 +879,24 @@ discard block |
||
880 | 879 | // Custom: Data field. |
881 | 880 | case 'data' : |
882 | 881 | |
883 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php'; |
|
882 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php'; |
|
884 | 883 | |
885 | 884 | echo $description; |
886 | 885 | break; |
887 | 886 | |
888 | 887 | // Custom: Give Docs Link field type. |
889 | 888 | case 'give_docs_link' : |
890 | - $wrapper_class = ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : ''; |
|
889 | + $wrapper_class = ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : ''; |
|
891 | 890 | ?> |
892 | - <tr valign="top" <?php echo esc_html( $wrapper_class ); ?>> |
|
891 | + <tr valign="top" <?php echo esc_html($wrapper_class); ?>> |
|
893 | 892 | <td class="give-docs-link" colspan="2"> |
894 | 893 | <p class="give-docs-link"> |
895 | - <a href="<?php echo esc_url( $value['url'] ); ?>" target="_blank"> |
|
894 | + <a href="<?php echo esc_url($value['url']); ?>" target="_blank"> |
|
896 | 895 | <?php |
897 | 896 | echo sprintf( |
898 | 897 | /* translators: %s Title */ |
899 | - esc_html__( 'Need Help? See docs on "%s"', 'give' ), |
|
900 | - esc_html( $value['title'] ) |
|
898 | + esc_html__('Need Help? See docs on "%s"', 'give'), |
|
899 | + esc_html($value['title']) |
|
901 | 900 | ); |
902 | 901 | ?> |
903 | 902 | <span class="dashicons dashicons-editor-help"></span> |
@@ -911,8 +910,8 @@ discard block |
||
911 | 910 | // You can add or handle your custom field action. |
912 | 911 | default: |
913 | 912 | // Get option value. |
914 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
915 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
913 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
914 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
916 | 915 | break; |
917 | 916 | } |
918 | 917 | } |
@@ -928,15 +927,15 @@ discard block |
||
928 | 927 | * |
929 | 928 | * @return string The HTML description of the field. |
930 | 929 | */ |
931 | - public static function get_field_description( $value ) { |
|
930 | + public static function get_field_description($value) { |
|
932 | 931 | $description = ''; |
933 | 932 | |
934 | 933 | // Support for both 'description' and 'desc' args. |
935 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
936 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
934 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
935 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
937 | 936 | |
938 | - if ( ! empty( $value ) ) { |
|
939 | - $description = '<div class="give-field-description">' . wp_kses_post( $value ) . '</div>'; |
|
937 | + if ( ! empty($value)) { |
|
938 | + $description = '<div class="give-field-description">'.wp_kses_post($value).'</div>'; |
|
940 | 939 | } |
941 | 940 | |
942 | 941 | return $description; |
@@ -953,11 +952,11 @@ discard block |
||
953 | 952 | * |
954 | 953 | * @return array The description and tip as a 2 element array |
955 | 954 | */ |
956 | - public static function get_field_title( $value ) { |
|
957 | - $title = esc_html( $value['title'] ); |
|
955 | + public static function get_field_title($value) { |
|
956 | + $title = esc_html($value['title']); |
|
958 | 957 | |
959 | 958 | // If html tag detected then allow them to print. |
960 | - if ( strip_tags( $title ) ) { |
|
959 | + if (strip_tags($title)) { |
|
961 | 960 | $title = $value['title']; |
962 | 961 | } |
963 | 962 | |
@@ -976,8 +975,8 @@ discard block |
||
976 | 975 | * |
977 | 976 | * @return bool |
978 | 977 | */ |
979 | - public static function save_fields( $options, $option_name = '' ) { |
|
980 | - if ( empty( $_POST ) ) { |
|
978 | + public static function save_fields($options, $option_name = '') { |
|
979 | + if (empty($_POST)) { |
|
981 | 980 | return false; |
982 | 981 | } |
983 | 982 | |
@@ -985,38 +984,38 @@ discard block |
||
985 | 984 | $update_options = array(); |
986 | 985 | |
987 | 986 | // Loop options and get values to save. |
988 | - foreach ( $options as $option ) { |
|
989 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
987 | + foreach ($options as $option) { |
|
988 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
990 | 989 | continue; |
991 | 990 | } |
992 | 991 | |
993 | 992 | // Get posted value. |
994 | - if ( strstr( $option['id'], '[' ) ) { |
|
995 | - parse_str( $option['id'], $option_name_array ); |
|
996 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
997 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
998 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
993 | + if (strstr($option['id'], '[')) { |
|
994 | + parse_str($option['id'], $option_name_array); |
|
995 | + $field_option_name = current(array_keys($option_name_array)); |
|
996 | + $setting_name = key($option_name_array[$field_option_name]); |
|
997 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
999 | 998 | } else { |
1000 | 999 | $field_option_name = $option['id']; |
1001 | 1000 | $setting_name = ''; |
1002 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
1001 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
1003 | 1002 | } |
1004 | 1003 | |
1005 | 1004 | // Format the value based on option type. |
1006 | - switch ( $option['type'] ) { |
|
1005 | + switch ($option['type']) { |
|
1007 | 1006 | case 'checkbox' : |
1008 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
1007 | + $value = is_null($raw_value) ? '' : 'on'; |
|
1009 | 1008 | break; |
1010 | 1009 | case 'wysiwyg' : |
1011 | 1010 | case 'textarea' : |
1012 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
1011 | + $value = wp_kses_post(trim($raw_value)); |
|
1013 | 1012 | break; |
1014 | 1013 | case 'multiselect' : |
1015 | 1014 | case 'chosen' : |
1016 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
1015 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
1017 | 1016 | break; |
1018 | 1017 | default : |
1019 | - $value = give_clean( $raw_value ); |
|
1018 | + $value = give_clean($raw_value); |
|
1020 | 1019 | break; |
1021 | 1020 | } |
1022 | 1021 | |
@@ -1025,37 +1024,37 @@ discard block |
||
1025 | 1024 | * |
1026 | 1025 | * @since 1.8 |
1027 | 1026 | */ |
1028 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
1027 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
1029 | 1028 | |
1030 | 1029 | /** |
1031 | 1030 | * Sanitize the value of an option by option name. |
1032 | 1031 | * |
1033 | 1032 | * @since 1.8 |
1034 | 1033 | */ |
1035 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
1034 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
1036 | 1035 | |
1037 | - if ( is_null( $value ) ) { |
|
1036 | + if (is_null($value)) { |
|
1038 | 1037 | continue; |
1039 | 1038 | } |
1040 | 1039 | |
1041 | 1040 | // Check if option is an array and handle that differently to single values. |
1042 | - if ( $field_option_name && $setting_name ) { |
|
1043 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
1044 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
1041 | + if ($field_option_name && $setting_name) { |
|
1042 | + if ( ! isset($update_options[$field_option_name])) { |
|
1043 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
1045 | 1044 | } |
1046 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
1047 | - $update_options[ $field_option_name ] = array(); |
|
1045 | + if ( ! is_array($update_options[$field_option_name])) { |
|
1046 | + $update_options[$field_option_name] = array(); |
|
1048 | 1047 | } |
1049 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
1048 | + $update_options[$field_option_name][$setting_name] = $value; |
|
1050 | 1049 | } else { |
1051 | - $update_options[ $field_option_name ] = $value; |
|
1050 | + $update_options[$field_option_name] = $value; |
|
1052 | 1051 | } |
1053 | 1052 | } |
1054 | 1053 | |
1055 | 1054 | // Save all options in our array or there own option name i.e. option id. |
1056 | - if ( empty( $option_name ) ) { |
|
1057 | - foreach ( $update_options as $name => $value ) { |
|
1058 | - update_option( $name, $value, false ); |
|
1055 | + if (empty($option_name)) { |
|
1056 | + foreach ($update_options as $name => $value) { |
|
1057 | + update_option($name, $value, false); |
|
1059 | 1058 | |
1060 | 1059 | /** |
1061 | 1060 | * Trigger action. |
@@ -1064,13 +1063,13 @@ discard block |
||
1064 | 1063 | * |
1065 | 1064 | * @since 1.8 |
1066 | 1065 | */ |
1067 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
1066 | + do_action("give_save_option_{$name}", $value, $name); |
|
1068 | 1067 | } |
1069 | 1068 | } else { |
1070 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
1071 | - $update_options = array_merge( $old_options, $update_options ); |
|
1069 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
1070 | + $update_options = array_merge($old_options, $update_options); |
|
1072 | 1071 | |
1073 | - update_option( $option_name, $update_options, false ); |
|
1072 | + update_option($option_name, $update_options, false); |
|
1074 | 1073 | |
1075 | 1074 | /** |
1076 | 1075 | * Trigger action. |
@@ -1079,7 +1078,7 @@ discard block |
||
1079 | 1078 | * |
1080 | 1079 | * @since 1.8 |
1081 | 1080 | */ |
1082 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name, $old_options ); |
|
1081 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name, $old_options); |
|
1083 | 1082 | } |
1084 | 1083 | |
1085 | 1084 | return true; |
@@ -1108,21 +1107,21 @@ discard block |
||
1108 | 1107 | * |
1109 | 1108 | * @return bool |
1110 | 1109 | */ |
1111 | - public static function is_setting_page( $tab = '', $section = '' ) { |
|
1110 | + public static function is_setting_page($tab = '', $section = '') { |
|
1112 | 1111 | $is_setting_page = false; |
1113 | 1112 | |
1114 | - if( ! is_admin() ) { |
|
1113 | + if ( ! is_admin()) { |
|
1115 | 1114 | return $is_setting_page; |
1116 | 1115 | } |
1117 | 1116 | |
1118 | 1117 | // Check fo setting tab. |
1119 | - if ( ! empty( $tab ) ) { |
|
1120 | - $is_setting_page = ( $tab === give_get_current_setting_tab() ); |
|
1118 | + if ( ! empty($tab)) { |
|
1119 | + $is_setting_page = ($tab === give_get_current_setting_tab()); |
|
1121 | 1120 | } |
1122 | 1121 | |
1123 | 1122 | // Check fo setting section. |
1124 | - if ( ! empty( $section ) ) { |
|
1125 | - $is_setting_page = ( $section === give_get_current_setting_section() ); |
|
1123 | + if ( ! empty($section)) { |
|
1124 | + $is_setting_page = ($section === give_get_current_setting_section()); |
|
1126 | 1125 | } |
1127 | 1126 | |
1128 | 1127 | return $is_setting_page; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return static |
53 | 53 | */ |
54 | 54 | static function get_instance() { |
55 | - if ( null === static::$instance ) { |
|
55 | + if (null === static::$instance) { |
|
56 | 56 | self::$instance = new static(); |
57 | 57 | } |
58 | 58 | |
@@ -66,31 +66,31 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function init() { |
68 | 68 | // Load files. |
69 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/ajax-handler.php'; |
|
70 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-setting-field.php'; |
|
71 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/filters.php'; |
|
69 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/ajax-handler.php'; |
|
70 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-setting-field.php'; |
|
71 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/filters.php'; |
|
72 | 72 | |
73 | 73 | // Load email notifications. |
74 | 74 | $this->add_emails_notifications(); |
75 | 75 | |
76 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_metabox_setting_fields' ), 10, 2 ); |
|
77 | - add_action( 'init', array( $this, 'preview_email' ) ); |
|
78 | - add_action( 'init', array( $this, 'send_preview_email' ) ); |
|
79 | - add_action( 'init', array( $this, 'validate_settings' ) ); |
|
76 | + add_filter('give_metabox_form_data_settings', array($this, 'add_metabox_setting_fields'), 10, 2); |
|
77 | + add_action('init', array($this, 'preview_email')); |
|
78 | + add_action('init', array($this, 'send_preview_email')); |
|
79 | + add_action('init', array($this, 'validate_settings')); |
|
80 | 80 | |
81 | 81 | /* @var Give_Email_Notification $email */ |
82 | - foreach ( $this->get_email_notifications() as $email ) { |
|
82 | + foreach ($this->get_email_notifications() as $email) { |
|
83 | 83 | // Setup email section. |
84 | - if( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email ) ) { |
|
85 | - add_filter( 'give_get_sections_emails', array( $email, 'add_section' ) ); |
|
86 | - add_filter( "give_hide_section_{$email->config['id']}_on_emails_page", array( $email, 'hide_section' ) ); |
|
84 | + if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email)) { |
|
85 | + add_filter('give_get_sections_emails', array($email, 'add_section')); |
|
86 | + add_filter("give_hide_section_{$email->config['id']}_on_emails_page", array($email, 'hide_section')); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | // Setup email preview. |
90 | - if ( Give_Email_Notification_Util::is_email_preview_has_header( $email ) ) { |
|
91 | - add_action( "give_{$email->config['id']}_email_preview", array( $this, 'email_preview_header' ) ); |
|
92 | - add_filter( "give_{$email->config['id']}_email_preview_data", array( $this, 'email_preview_data' ) ); |
|
93 | - add_filter( "give_{$email->config['id']}_email_preview_message", array( $this, 'email_preview_message' ), 1, 2 ); |
|
90 | + if (Give_Email_Notification_Util::is_email_preview_has_header($email)) { |
|
91 | + add_action("give_{$email->config['id']}_email_preview", array($this, 'email_preview_header')); |
|
92 | + add_filter("give_{$email->config['id']}_email_preview_data", array($this, 'email_preview_data')); |
|
93 | + add_filter("give_{$email->config['id']}_email_preview_message", array($this, 'email_preview_message'), 1, 2); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
@@ -107,63 +107,63 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return array |
109 | 109 | */ |
110 | - public function add_metabox_setting_fields( $settings, $post_id ) { |
|
110 | + public function add_metabox_setting_fields($settings, $post_id) { |
|
111 | 111 | $emails = $this->get_email_notifications(); |
112 | 112 | |
113 | 113 | // Bailout. |
114 | - if ( empty( $emails ) ) { |
|
114 | + if (empty($emails)) { |
|
115 | 115 | return $settings; |
116 | 116 | } |
117 | 117 | |
118 | 118 | // Email notification setting. |
119 | 119 | $settings['email_notification_options'] = array( |
120 | 120 | 'id' => 'email_notification_options', |
121 | - 'title' => __( 'Email Notifications', 'give' ), |
|
121 | + 'title' => __('Email Notifications', 'give'), |
|
122 | 122 | 'icon-html' => '<span class="dashicons dashicons-email-alt"></span>', |
123 | 123 | 'fields' => array( |
124 | 124 | array( |
125 | - 'name' => __( 'Email Options', 'give' ), |
|
125 | + 'name' => __('Email Options', 'give'), |
|
126 | 126 | 'id' => '_give_email_options', |
127 | 127 | 'type' => 'radio_inline', |
128 | 128 | 'default' => 'global', |
129 | 129 | 'options' => array( |
130 | - 'global' => __( 'Global Options' ), |
|
131 | - 'enabled' => __( 'Customize', 'give' ), |
|
130 | + 'global' => __('Global Options'), |
|
131 | + 'enabled' => __('Customize', 'give'), |
|
132 | 132 | ), |
133 | 133 | ), |
134 | 134 | array( |
135 | 135 | 'id' => '_give_email_template', |
136 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
137 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
136 | + 'name' => esc_html__('Email Template', 'give'), |
|
137 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
138 | 138 | 'type' => 'select', |
139 | 139 | 'default' => 'default', |
140 | 140 | 'options' => give_get_email_templates(), |
141 | 141 | ), |
142 | 142 | array( |
143 | 143 | 'id' => '_give_email_logo', |
144 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
145 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
144 | + 'name' => esc_html__('Logo', 'give'), |
|
145 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
146 | 146 | 'type' => 'file', |
147 | 147 | ), |
148 | 148 | array( |
149 | 149 | 'id' => '_give_from_name', |
150 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
151 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
152 | - 'default' => get_bloginfo( 'name' ), |
|
150 | + 'name' => esc_html__('From Name', 'give'), |
|
151 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
152 | + 'default' => get_bloginfo('name'), |
|
153 | 153 | 'type' => 'text', |
154 | 154 | ), |
155 | 155 | array( |
156 | 156 | 'id' => '_give_from_email', |
157 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
158 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
159 | - 'default' => get_bloginfo( 'admin_email' ), |
|
157 | + 'name' => esc_html__('From Email', 'give'), |
|
158 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
159 | + 'default' => get_bloginfo('admin_email'), |
|
160 | 160 | 'type' => 'text', |
161 | 161 | ), |
162 | 162 | array( |
163 | 163 | 'name' => 'email_notification_docs', |
164 | 164 | 'type' => 'docs_link', |
165 | 165 | 'url' => 'http://docs.givewp.com/email-notification', |
166 | - 'title' => __( 'Email Notification', 'give' ), |
|
166 | + 'title' => __('Email Notification', 'give'), |
|
167 | 167 | ), |
168 | 168 | ), |
169 | 169 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @since 2.0 |
174 | 174 | */ |
175 | - 'sub-fields' => apply_filters( 'give_email_notification_options_metabox_fields', array(), $post_id ), |
|
175 | + 'sub-fields' => apply_filters('give_email_notification_options_metabox_fields', array(), $post_id), |
|
176 | 176 | ); |
177 | 177 | |
178 | 178 | return $settings; |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | */ |
187 | 187 | private function add_emails_notifications() { |
188 | 188 | $this->emails = array( |
189 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-donation-email.php', |
|
190 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-donation-receipt-email.php', |
|
191 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-offline-donation-email.php', |
|
192 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-offline-donation-instruction-email.php', |
|
193 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-donor-register-email.php', |
|
194 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-donor-register-email.php', |
|
195 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-access-email.php', |
|
189 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-donation-email.php', |
|
190 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-donation-receipt-email.php', |
|
191 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-offline-donation-email.php', |
|
192 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-offline-donation-instruction-email.php', |
|
193 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-donor-register-email.php', |
|
194 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-donor-register-email.php', |
|
195 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-access-email.php', |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | /** |
@@ -200,15 +200,15 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @since 2.0 |
202 | 202 | */ |
203 | - $this->emails = apply_filters( 'give_email_notifications', $this->emails, $this ); |
|
203 | + $this->emails = apply_filters('give_email_notifications', $this->emails, $this); |
|
204 | 204 | |
205 | 205 | // Bailout. |
206 | - if ( empty( $this->emails ) ) { |
|
206 | + if (empty($this->emails)) { |
|
207 | 207 | return; |
208 | 208 | } |
209 | 209 | |
210 | 210 | // Initiate email notifications. |
211 | - foreach ( $this->emails as $email ) { |
|
211 | + foreach ($this->emails as $email) { |
|
212 | 212 | $email->init(); |
213 | 213 | } |
214 | 214 | } |
@@ -235,42 +235,42 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function preview_email() { |
237 | 237 | // Bailout. |
238 | - if ( ! Give_Email_Notification_Util::can_preview_email() ) { |
|
238 | + if ( ! Give_Email_Notification_Util::can_preview_email()) { |
|
239 | 239 | return false; |
240 | 240 | } |
241 | 241 | |
242 | 242 | // Security check. |
243 | - give_validate_nonce( $_GET['_wpnonce'], 'give-preview-email' ); |
|
243 | + give_validate_nonce($_GET['_wpnonce'], 'give-preview-email'); |
|
244 | 244 | |
245 | 245 | // Get email type. |
246 | - $email_type = isset( $_GET['email_type'] ) ? esc_attr( $_GET['email_type'] ) : ''; |
|
246 | + $email_type = isset($_GET['email_type']) ? esc_attr($_GET['email_type']) : ''; |
|
247 | 247 | |
248 | 248 | /* @var Give_Email_Notification $email */ |
249 | - foreach ( $this->get_email_notifications() as $email ) { |
|
250 | - if ( $email_type !== $email->config['id'] ) { |
|
249 | + foreach ($this->get_email_notifications() as $email) { |
|
250 | + if ($email_type !== $email->config['id']) { |
|
251 | 251 | continue; |
252 | 252 | } |
253 | 253 | |
254 | 254 | // Set form id. |
255 | - $form_id = empty( $_GET['form_id'] ) ? null : absint( $_GET['form_id'] ); |
|
255 | + $form_id = empty($_GET['form_id']) ? null : absint($_GET['form_id']); |
|
256 | 256 | |
257 | 257 | // Call setup email data to apply filter and other thing to email. |
258 | - $email->send_preview_email( false ); |
|
258 | + $email->send_preview_email(false); |
|
259 | 259 | |
260 | 260 | // Decode message. |
261 | - $email_message = $email->preview_email_template_tags( $email->get_email_message( $form_id ) ); |
|
261 | + $email_message = $email->preview_email_template_tags($email->get_email_message($form_id)); |
|
262 | 262 | |
263 | 263 | // Show formatted text in browser even text/plain content type set for an email. |
264 | 264 | Give()->emails->html = true; |
265 | 265 | |
266 | 266 | Give()->emails->form_id = $form_id; |
267 | 267 | |
268 | - if ( 'text/plain' === $email->config['content_type'] ) { |
|
268 | + if ('text/plain' === $email->config['content_type']) { |
|
269 | 269 | // Give()->emails->__set( 'html', false ); |
270 | - Give()->emails->__set( 'template', 'none' ); |
|
270 | + Give()->emails->__set('template', 'none'); |
|
271 | 271 | } |
272 | 272 | |
273 | - if ( $email_message = Give()->emails->build_email( $email_message ) ) { |
|
273 | + if ($email_message = Give()->emails->build_email($email_message)) { |
|
274 | 274 | |
275 | 275 | /** |
276 | 276 | * Filter the email preview data |
@@ -279,14 +279,14 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @param array |
281 | 281 | */ |
282 | - $email_preview_data = apply_filters( "give_{$email_type}_email_preview_data", array() ); |
|
282 | + $email_preview_data = apply_filters("give_{$email_type}_email_preview_data", array()); |
|
283 | 283 | |
284 | 284 | /** |
285 | 285 | * Fire the give_{$email_type}_email_preview action |
286 | 286 | * |
287 | 287 | * @since 2.0 |
288 | 288 | */ |
289 | - do_action( "give_{$email_type}_email_preview", $email ); |
|
289 | + do_action("give_{$email_type}_email_preview", $email); |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Filter the email message |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param array $email_preview_data |
298 | 298 | * @param Give_Email_Notification $email |
299 | 299 | */ |
300 | - echo apply_filters( "give_{$email_type}_email_preview_message", $email_message, $email_preview_data, $email ); |
|
300 | + echo apply_filters("give_{$email_type}_email_preview_message", $email_message, $email_preview_data, $email); |
|
301 | 301 | |
302 | 302 | exit(); |
303 | 303 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @param Give_Email_Notification $email |
315 | 315 | */ |
316 | - public function email_preview_header( $email ) { |
|
316 | + public function email_preview_header($email) { |
|
317 | 317 | /** |
318 | 318 | * Filter the all email preview headers. |
319 | 319 | * |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * |
322 | 322 | * @param Give_Email_Notification $email |
323 | 323 | */ |
324 | - $email_preview_header = apply_filters( 'give_email_preview_header', give_get_preview_email_header(), $email ); |
|
324 | + $email_preview_header = apply_filters('give_email_preview_header', give_get_preview_email_header(), $email); |
|
325 | 325 | |
326 | 326 | echo $email_preview_header; |
327 | 327 | } |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @return array |
338 | 338 | */ |
339 | - public function email_preview_data( $email_preview_data ) { |
|
340 | - $email_preview_data['payment_id'] = absint( give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' ) ); |
|
341 | - $email_preview_data['user_id'] = absint( give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' ) ); |
|
339 | + public function email_preview_data($email_preview_data) { |
|
340 | + $email_preview_data['payment_id'] = absint(give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id')); |
|
341 | + $email_preview_data['user_id'] = absint(give_check_variable(give_clean($_GET), 'isset', 0, 'user_id')); |
|
342 | 342 | |
343 | 343 | return $email_preview_data; |
344 | 344 | } |
@@ -354,12 +354,12 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return string |
356 | 356 | */ |
357 | - public function email_preview_message( $email_message, $email_preview_data ) { |
|
357 | + public function email_preview_message($email_message, $email_preview_data) { |
|
358 | 358 | if ( |
359 | - ! empty( $email_preview_data['payment_id'] ) |
|
360 | - || ! empty( $email_preview_data['user_id'] ) |
|
359 | + ! empty($email_preview_data['payment_id']) |
|
360 | + || ! empty($email_preview_data['user_id']) |
|
361 | 361 | ) { |
362 | - $email_message = give_do_email_tags( $email_message, $email_preview_data ); |
|
362 | + $email_message = give_do_email_tags($email_message, $email_preview_data); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | return $email_message; |
@@ -374,26 +374,26 @@ discard block |
||
374 | 374 | */ |
375 | 375 | public function send_preview_email() { |
376 | 376 | // Bailout. |
377 | - if ( ! Give_Email_Notification_Util::can_send_preview_email() ) { |
|
377 | + if ( ! Give_Email_Notification_Util::can_send_preview_email()) { |
|
378 | 378 | return false; |
379 | 379 | } |
380 | 380 | |
381 | 381 | // Security check. |
382 | - give_validate_nonce( $_GET['_wpnonce'], 'give-send-preview-email' ); |
|
382 | + give_validate_nonce($_GET['_wpnonce'], 'give-send-preview-email'); |
|
383 | 383 | |
384 | 384 | // Get email type. |
385 | - $email_type = give_check_variable( give_clean( $_GET ), 'isset', '', 'email_type' ); |
|
385 | + $email_type = give_check_variable(give_clean($_GET), 'isset', '', 'email_type'); |
|
386 | 386 | |
387 | 387 | /* @var Give_Email_Notification $email */ |
388 | - foreach ( $this->get_email_notifications() as $email ) { |
|
389 | - if ( $email_type === $email->config['id'] && Give_Email_Notification_Util::is_email_preview( $email ) ) { |
|
388 | + foreach ($this->get_email_notifications() as $email) { |
|
389 | + if ($email_type === $email->config['id'] && Give_Email_Notification_Util::is_email_preview($email)) { |
|
390 | 390 | $email->send_preview_email(); |
391 | 391 | break; |
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | 395 | // Remove the test email query arg. |
396 | - wp_redirect( remove_query_arg( 'give_action' ) ); |
|
396 | + wp_redirect(remove_query_arg('give_action')); |
|
397 | 397 | exit; |
398 | 398 | } |
399 | 399 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @access public |
406 | 406 | */ |
407 | 407 | public function load() { |
408 | - add_action( 'init', array( $this, 'init' ), -1 ); |
|
408 | + add_action('init', array($this, 'init'), -1); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | if ( |
421 | 421 | ! Give_Admin_Settings::is_saving_settings() || |
422 | 422 | 'emails' !== give_get_current_setting_tab() || |
423 | - ! isset( $_GET['section'] ) |
|
423 | + ! isset($_GET['section']) |
|
424 | 424 | ) { |
425 | 425 | return; |
426 | 426 | } |
@@ -428,18 +428,18 @@ discard block |
||
428 | 428 | // Get email type. |
429 | 429 | $email_type = give_get_current_setting_section(); |
430 | 430 | |
431 | - if ( ! empty( $_POST["{$email_type}_recipient"] ) ) { |
|
432 | - $_POST["{$email_type}_recipient"] = array_unique( array_filter( $_POST["{$email_type}_recipient"] ) ); |
|
431 | + if ( ! empty($_POST["{$email_type}_recipient"])) { |
|
432 | + $_POST["{$email_type}_recipient"] = array_unique(array_filter($_POST["{$email_type}_recipient"])); |
|
433 | 433 | } |
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | 437 | // Helper class. |
438 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/abstract-email-notification.php'; |
|
439 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notification-util.php'; |
|
438 | +require_once GIVE_PLUGIN_DIR.'includes/admin/emails/abstract-email-notification.php'; |
|
439 | +require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notification-util.php'; |
|
440 | 440 | |
441 | 441 | // Add backward compatibility. |
442 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/backward-compatibility.php'; |
|
442 | +require_once GIVE_PLUGIN_DIR.'includes/admin/emails/backward-compatibility.php'; |
|
443 | 443 | |
444 | 444 | /** |
445 | 445 | * Initialize functionality. |