@@ -4,13 +4,13 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | // Exit if accessed directly. |
7 | -if ( ! defined( 'ABSPATH' ) ) { |
|
7 | +if ( ! defined('ABSPATH')) { |
|
8 | 8 | exit; |
9 | 9 | } |
10 | 10 | |
11 | 11 | /** @var $donor Give_Donor */ |
12 | 12 | $donor = $args[0]; |
13 | -$donor = new Give_Donor( $donor->id ); |
|
13 | +$donor = new Give_Donor($donor->id); |
|
14 | 14 | |
15 | 15 | $give_settings = $args[1]; // Give settings. |
16 | 16 | $atts = $args[2]; // Shortcode attributes. |
@@ -20,24 +20,24 @@ discard block |
||
20 | 20 | <div class="give-donor__header"> |
21 | 21 | <?php |
22 | 22 | // Maybe display the Avatar. |
23 | - if ( true === $atts['show_avatar'] ) { |
|
24 | - echo give_get_donor_avatar( $donor ); |
|
23 | + if (true === $atts['show_avatar']) { |
|
24 | + echo give_get_donor_avatar($donor); |
|
25 | 25 | } |
26 | 26 | ?> |
27 | 27 | |
28 | 28 | <div class="give-donor__details"> |
29 | - <?php if ( true === $atts['show_name'] ) : ?> |
|
30 | - <h3 class="give-donor__name"><?php esc_html_e( $donor->name ); ?></h3> |
|
29 | + <?php if (true === $atts['show_name']) : ?> |
|
30 | + <h3 class="give-donor__name"><?php esc_html_e($donor->name); ?></h3> |
|
31 | 31 | <?php endif; ?> |
32 | 32 | |
33 | - <?php if ( true === $atts['show_total'] ) : ?> |
|
33 | + <?php if (true === $atts['show_total']) : ?> |
|
34 | 34 | <span class="give-donor__total"> |
35 | 35 | <?php |
36 | 36 | // If not filtered by form ID then display total donations |
37 | 37 | // Else filtered by form ID, only display donations made for this form. |
38 | 38 | $donated_amount = $donor->purchase_value; |
39 | 39 | |
40 | - if ( ! empty( $atts['form_id'] ) ) { |
|
40 | + if ( ! empty($atts['form_id'])) { |
|
41 | 41 | $donated_amount = Give_Donor_Stats::donated( |
42 | 42 | array( |
43 | 43 | 'donor' => $donor->id, |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | ); |
47 | 47 | } |
48 | 48 | |
49 | - echo give_currency_filter( give_format_amount( $donated_amount, array( 'sanitize' => false ) ) ); |
|
49 | + echo give_currency_filter(give_format_amount($donated_amount, array('sanitize' => false))); |
|
50 | 50 | ?> |
51 | 51 | </span> |
52 | 52 | <?php endif; ?> |
53 | 53 | |
54 | - <?php if ( true === $atts['show_time'] ) : ?> |
|
54 | + <?php if (true === $atts['show_time']) : ?> |
|
55 | 55 | <span class="give-donor__timestamp"> |
56 | 56 | <?php |
57 | 57 | // If not filtered by form ID then display the "Donor Since" text. |
58 | 58 | // If filtered by form ID then display the last donation date. |
59 | - echo $donor->get_last_donation_date( true ); |
|
59 | + echo $donor->get_last_donation_date(true); |
|
60 | 60 | ?> |
61 | 61 | </span> |
62 | 62 | <?php endif; ?> |
@@ -64,25 +64,25 @@ discard block |
||
64 | 64 | </div> |
65 | 65 | |
66 | 66 | <?php |
67 | - $comment = give_get_donor_latest_comment( $donor->id, $atts['form_id'] ); |
|
67 | + $comment = give_get_donor_latest_comment($donor->id, $atts['form_id']); |
|
68 | 68 | |
69 | - if ( true === $atts['show_comments'] && absint( $atts['comment_length'] ) && $comment instanceof WP_Comment ) : |
|
69 | + if (true === $atts['show_comments'] && absint($atts['comment_length']) && $comment instanceof WP_Comment) : |
|
70 | 70 | ?> |
71 | 71 | <div class="give-donor__content"> |
72 | 72 | <?php |
73 | - if ( $atts['comment_length'] < strlen( $comment->comment_content ) ) { |
|
73 | + if ($atts['comment_length'] < strlen($comment->comment_content)) { |
|
74 | 74 | echo sprintf( |
75 | 75 | '<p class="give-donor__comment_excerpt">%s…<span> <a class="give-donor__read-more">%s</a></span></p>', |
76 | - substr( $comment->comment_content, 0, $atts['comment_length'] ), |
|
76 | + substr($comment->comment_content, 0, $atts['comment_length']), |
|
77 | 77 | $atts['readmore_text'] |
78 | 78 | ); |
79 | 79 | |
80 | 80 | echo sprintf( |
81 | 81 | '<div class="give-donor__comment" style="display: none">%s</div>', |
82 | - apply_filters( 'the_content', $comment->comment_content ) |
|
82 | + apply_filters('the_content', $comment->comment_content) |
|
83 | 83 | ); |
84 | 84 | } else { |
85 | - echo apply_filters( 'the_content', $comment->comment_content ); |
|
85 | + echo apply_filters('the_content', $comment->comment_content); |
|
86 | 86 | } |
87 | 87 | ?> |
88 | 88 | </div> |
@@ -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.0' ); |
|
418 | + if ( ! defined('GIVE_VERSION')) { |
|
419 | + define('GIVE_VERSION', '2.2.0'); |
|
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 |
@@ -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 | |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | /** |
31 | 31 | * Fire the action |
32 | 32 | */ |
33 | - do_action( 'give_donation-receipt_email_notification', $payment_id ); |
|
33 | + do_action('give_donation-receipt_email_notification', $payment_id); |
|
34 | 34 | |
35 | 35 | // If admin notifications are on, send the admin notice. |
36 | - if ( $admin_notice && give_is_setting_enabled( Give_Email_Notification::get_instance('new-donation' )->get_notification_status() ) ) { |
|
36 | + if ($admin_notice && give_is_setting_enabled(Give_Email_Notification::get_instance('new-donation')->get_notification_status())) { |
|
37 | 37 | /** |
38 | 38 | * Fires in the donation email receipt. |
39 | 39 | * |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param int $payment_id Payment id. |
45 | 45 | * @param mixed $payment_data Payment meta data. |
46 | 46 | */ |
47 | - do_action( 'give_new-donation_email_notification', $payment_id, give_get_payment_meta( $payment_id ) ); |
|
47 | + do_action('give_new-donation_email_notification', $payment_id, give_get_payment_meta($payment_id)); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return void |
59 | 59 | */ |
60 | -function give_admin_email_notice( $payment_id ) { |
|
60 | +function give_admin_email_notice($payment_id) { |
|
61 | 61 | /** |
62 | 62 | * Fires in the donation email receipt. |
63 | 63 | * |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | * @param int $payment_id Payment id. |
69 | 69 | * @param mixed $payment_data Payment meta data. |
70 | 70 | */ |
71 | - do_action( 'give_new-donation_email_notification', $payment_id ); |
|
71 | + do_action('give_new-donation_email_notification', $payment_id); |
|
72 | 72 | } |
73 | 73 | |
74 | -add_action( 'give_admin_donation_email', 'give_admin_email_notice' ); |
|
74 | +add_action('give_admin_donation_email', 'give_admin_email_notice'); |
|
75 | 75 | |
76 | 76 | |
77 | 77 | /** |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | */ |
85 | 85 | function give_get_default_donation_notification_email() { |
86 | 86 | |
87 | - $default_email_body = __( 'Hi there,', 'give' ) . "\n\n"; |
|
88 | - $default_email_body .= __( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' {site_url}' . ".\n\n"; |
|
89 | - $default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {name}' . "\n"; |
|
90 | - $default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
91 | - $default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
92 | - $default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n"; |
|
93 | - $default_email_body .= __( 'Thank you,', 'give' ) . "\n\n"; |
|
94 | - $default_email_body .= '{sitename}' . "\n"; |
|
87 | + $default_email_body = __('Hi there,', 'give')."\n\n"; |
|
88 | + $default_email_body .= __('This email is to inform you that a new donation has been made on your website:', 'give').' {site_url}'.".\n\n"; |
|
89 | + $default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {name}'."\n"; |
|
90 | + $default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
91 | + $default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
92 | + $default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n"; |
|
93 | + $default_email_body .= __('Thank you,', 'give')."\n\n"; |
|
94 | + $default_email_body .= '{sitename}'."\n"; |
|
95 | 95 | |
96 | - return apply_filters( 'give_default_donation_notification_email', $default_email_body ); |
|
96 | + return apply_filters('give_default_donation_notification_email', $default_email_body); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -107,21 +107,21 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function give_get_default_donation_receipt_email() { |
109 | 109 | |
110 | - $default_email_body = __( 'Dear', 'give' ) . " {name},\n\n"; |
|
111 | - $default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
112 | - $default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
113 | - $default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
114 | - $default_email_body .= '<strong>' . __( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n"; |
|
115 | - $default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
116 | - $default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n"; |
|
117 | - $default_email_body .= '<strong>' . __( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n"; |
|
118 | - $default_email_body .= '<strong>' . __( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n"; |
|
119 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
110 | + $default_email_body = __('Dear', 'give')." {name},\n\n"; |
|
111 | + $default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
112 | + $default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
113 | + $default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
114 | + $default_email_body .= '<strong>'.__('Donation Date:', 'give').'</strong> {date}'."\n"; |
|
115 | + $default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
116 | + $default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n"; |
|
117 | + $default_email_body .= '<strong>'.__('Payment ID:', 'give').'</strong> {payment_id}'."\n"; |
|
118 | + $default_email_body .= '<strong>'.__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n"; |
|
119 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
120 | 120 | $default_email_body .= "\n\n"; |
121 | - $default_email_body .= __( 'Sincerely,', 'give' ) . "\n"; |
|
122 | - $default_email_body .= '{sitename}' . "\n"; |
|
121 | + $default_email_body .= __('Sincerely,', 'give')."\n"; |
|
122 | + $default_email_body .= '{sitename}'."\n"; |
|
123 | 123 | |
124 | - return apply_filters( 'give_default_donation_receipt_email', $default_email_body ); |
|
124 | + return apply_filters('give_default_donation_receipt_email', $default_email_body); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -134,22 +134,22 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return array $email_names |
136 | 136 | */ |
137 | -function give_get_email_names( $user_info, $payment = false ) { |
|
137 | +function give_get_email_names($user_info, $payment = false) { |
|
138 | 138 | $email_names = array(); |
139 | 139 | |
140 | - if ( is_a( $payment, 'Give_Payment' ) ) { |
|
140 | + if (is_a($payment, 'Give_Payment')) { |
|
141 | 141 | |
142 | - if ( $payment->user_id > 0 ) { |
|
142 | + if ($payment->user_id > 0) { |
|
143 | 143 | |
144 | - $user_data = get_userdata( $payment->user_id ); |
|
144 | + $user_data = get_userdata($payment->user_id); |
|
145 | 145 | $email_names['name'] = $payment->first_name; |
146 | - $email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name ); |
|
146 | + $email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name); |
|
147 | 147 | $email_names['username'] = $user_data->user_login; |
148 | 148 | |
149 | - } elseif ( ! empty( $payment->first_name ) ) { |
|
149 | + } elseif ( ! empty($payment->first_name)) { |
|
150 | 150 | |
151 | 151 | $email_names['name'] = $payment->first_name; |
152 | - $email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name ); |
|
152 | + $email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name); |
|
153 | 153 | $email_names['username'] = $payment->first_name; |
154 | 154 | |
155 | 155 | } else { |
@@ -161,29 +161,29 @@ discard block |
||
161 | 161 | } else { |
162 | 162 | |
163 | 163 | // Support for old serialized data. |
164 | - if ( is_serialized( $user_info ) ) { |
|
164 | + if (is_serialized($user_info)) { |
|
165 | 165 | |
166 | 166 | // Security check. |
167 | - preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches ); |
|
168 | - if ( ! empty( $matches ) ) { |
|
167 | + preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches); |
|
168 | + if ( ! empty($matches)) { |
|
169 | 169 | return array( |
170 | 170 | 'name' => '', |
171 | 171 | 'fullname' => '', |
172 | 172 | 'username' => '', |
173 | 173 | ); |
174 | 174 | } else { |
175 | - $user_info = maybe_unserialize( $user_info ); |
|
175 | + $user_info = maybe_unserialize($user_info); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
180 | - $user_data = get_userdata( $user_info['id'] ); |
|
179 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
180 | + $user_data = get_userdata($user_info['id']); |
|
181 | 181 | $email_names['name'] = $user_info['first_name']; |
182 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
182 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
183 | 183 | $email_names['username'] = $user_data->user_login; |
184 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
184 | + } elseif (isset($user_info['first_name'])) { |
|
185 | 185 | $email_names['name'] = $user_info['first_name']; |
186 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
186 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
187 | 187 | $email_names['username'] = $user_info['first_name']; |
188 | 188 | } else { |
189 | 189 | $email_names['name'] = $user_info['email']; |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | } // End if(). |
193 | 193 | |
194 | 194 | // Set title prefix to name, if non empty. |
195 | - if ( ! empty( $user_info['title'] ) && ! empty( $user_info['last_name'] ) ) { |
|
196 | - $email_names['name'] = give_get_donor_name_with_title_prefixes( $user_info['title'], $user_info['last_name'] ); |
|
195 | + if ( ! empty($user_info['title']) && ! empty($user_info['last_name'])) { |
|
196 | + $email_names['name'] = give_get_donor_name_with_title_prefixes($user_info['title'], $user_info['last_name']); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | // Set title prefix to fullname, if non empty. |
200 | - if ( ! empty( $user_info['title'] ) && ! empty( $email_names['fullname'] ) ) { |
|
201 | - $email_names['fullname'] = give_get_donor_name_with_title_prefixes( $user_info['title'], $email_names['fullname'] ); |
|
200 | + if ( ! empty($user_info['title']) && ! empty($email_names['fullname'])) { |
|
201 | + $email_names['fullname'] = give_get_donor_name_with_title_prefixes($user_info['title'], $email_names['fullname']); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | return $email_names; |
@@ -212,37 +212,37 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @since 1.8.14 |
214 | 214 | */ |
215 | -function give_admin_email_user_donor_disconnection( $user_id, $donor_id ) { |
|
215 | +function give_admin_email_user_donor_disconnection($user_id, $donor_id) { |
|
216 | 216 | |
217 | - $user_id = absint( $user_id ); |
|
218 | - $donor_id = absint( $donor_id ); |
|
217 | + $user_id = absint($user_id); |
|
218 | + $donor_id = absint($donor_id); |
|
219 | 219 | |
220 | 220 | // Bail Out, if user id doesn't exists. |
221 | - if ( empty( $user_id ) ) { |
|
221 | + if (empty($user_id)) { |
|
222 | 222 | return; |
223 | 223 | } |
224 | 224 | |
225 | 225 | // Bail Out, if donor id doesn't exists. |
226 | - if ( empty( $donor_id ) ) { |
|
226 | + if (empty($donor_id)) { |
|
227 | 227 | return; |
228 | 228 | } |
229 | 229 | |
230 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
230 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
231 | 231 | |
232 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
232 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
233 | 233 | |
234 | 234 | /* translators: %s: payment id */ |
235 | - $subject = __( 'Attention: User tries to login whose Donor profile is disconnected!', 'give' ); |
|
235 | + $subject = __('Attention: User tries to login whose Donor profile is disconnected!', 'give'); |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Filters the Donor-User Disconnection notification subject. |
239 | 239 | * |
240 | 240 | * @since 1.8.14 |
241 | 241 | */ |
242 | - $subject = apply_filters( 'give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags( $subject ) ); |
|
242 | + $subject = apply_filters('give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags($subject)); |
|
243 | 243 | |
244 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
245 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
244 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
245 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
246 | 246 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
247 | 247 | |
248 | 248 | /** |
@@ -250,25 +250,25 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @since 1.8.14 |
252 | 252 | */ |
253 | - $headers = apply_filters( 'give_admin_donor_user_disconnection_notification_headers', $headers ); |
|
253 | + $headers = apply_filters('give_admin_donor_user_disconnection_notification_headers', $headers); |
|
254 | 254 | |
255 | - $message = __( 'Hi Admin,', 'give' ) . "\n\n"; |
|
256 | - $message .= __( 'This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give' ) . "\n\n"; |
|
257 | - $message .= __( 'Do you want to reconnect User and Donor profile again?', 'give' ) . "\n\n"; |
|
255 | + $message = __('Hi Admin,', 'give')."\n\n"; |
|
256 | + $message .= __('This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give')."\n\n"; |
|
257 | + $message .= __('Do you want to reconnect User and Donor profile again?', 'give')."\n\n"; |
|
258 | 258 | $message .= sprintf( |
259 | 259 | '<a href="%1$s">%2$s</a>', |
260 | - esc_url( admin_url() . 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&user_id=' . $user_id . '&give-messages[]=reconnect-user' ), |
|
261 | - __( 'Reconnect User', 'give' ) . "\n\n" |
|
260 | + esc_url(admin_url().'edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&user_id='.$user_id.'&give-messages[]=reconnect-user'), |
|
261 | + __('Reconnect User', 'give')."\n\n" |
|
262 | 262 | ); |
263 | - $message .= __( 'Thank you,', 'give' ) . "\n\n"; |
|
264 | - $message .= '{sitename}' . "\n"; |
|
263 | + $message .= __('Thank you,', 'give')."\n\n"; |
|
264 | + $message .= '{sitename}'."\n"; |
|
265 | 265 | |
266 | 266 | $emails = Give()->emails; |
267 | - $emails->__set( 'from_name', $from_name ); |
|
268 | - $emails->__set( 'from_email', $from_email ); |
|
269 | - $emails->__set( 'headers', $headers ); |
|
270 | - $emails->__set( 'heading', __( 'User - Donor Profile Disconnection', 'give' ) ); |
|
267 | + $emails->__set('from_name', $from_name); |
|
268 | + $emails->__set('from_email', $from_email); |
|
269 | + $emails->__set('headers', $headers); |
|
270 | + $emails->__set('heading', __('User - Donor Profile Disconnection', 'give')); |
|
271 | 271 | |
272 | - $emails->send( give_get_admin_notice_emails(), $subject, give_do_email_tags( $message ) ); |
|
272 | + $emails->send(give_get_admin_notice_emails(), $subject, give_do_email_tags($message)); |
|
273 | 273 | |
274 | 274 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Exit if accessed directly. |
26 | -if ( ! defined( 'ABSPATH' ) ) { |
|
26 | +if ( ! defined('ABSPATH')) { |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * @param callable $func Hook to run when email tag is found |
57 | 57 | * @param string $context Email tag category |
58 | 58 | */ |
59 | - public function add( $tag, $description, $func, $context = '' ) { |
|
60 | - if ( is_callable( $func ) ) { |
|
61 | - $this->tags[ $tag ] = array( |
|
59 | + public function add($tag, $description, $func, $context = '') { |
|
60 | + if (is_callable($func)) { |
|
61 | + $this->tags[$tag] = array( |
|
62 | 62 | 'tag' => $tag, |
63 | 63 | 'description' => $description, |
64 | 64 | 'func' => $func, |
65 | - 'context' => give_check_variable( $context, 'empty', 'general' ), |
|
65 | + 'context' => give_check_variable($context, 'empty', 'general'), |
|
66 | 66 | ); |
67 | 67 | } |
68 | 68 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @param string $tag Email tag to remove hook from |
76 | 76 | */ |
77 | - public function remove( $tag ) { |
|
78 | - unset( $this->tags[ $tag ] ); |
|
77 | + public function remove($tag) { |
|
78 | + unset($this->tags[$tag]); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return bool |
89 | 89 | */ |
90 | - public function email_tag_exists( $tag ) { |
|
91 | - return array_key_exists( $tag, $this->tags ); |
|
90 | + public function email_tag_exists($tag) { |
|
91 | + return array_key_exists($tag, $this->tags); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -102,23 +102,23 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array |
104 | 104 | */ |
105 | - public function get_tags( $context_type = 'all', $field = '' ) { |
|
105 | + public function get_tags($context_type = 'all', $field = '') { |
|
106 | 106 | $tags = $this->tags; |
107 | 107 | |
108 | - if ( 'all' !== $context_type ) { |
|
108 | + if ('all' !== $context_type) { |
|
109 | 109 | $tags = array(); |
110 | 110 | |
111 | - foreach ( $this->tags as $tag ) { |
|
112 | - if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) { |
|
111 | + foreach ($this->tags as $tag) { |
|
112 | + if (empty($tag['context']) || $context_type !== $tag['context']) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | |
116 | - $tags[ $tag['tag'] ] = $tag; |
|
116 | + $tags[$tag['tag']] = $tag; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - if ( ! empty( $tags ) && ! empty( $field ) ) { |
|
121 | - $tags = wp_list_pluck( $tags, $field ); |
|
120 | + if ( ! empty($tags) && ! empty($field)) { |
|
121 | + $tags = wp_list_pluck($tags, $field); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | return $tags; |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return string Content with email tags filtered out. |
138 | 138 | */ |
139 | - public function do_tags( $content, $tag_args ) { |
|
139 | + public function do_tags($content, $tag_args) { |
|
140 | 140 | |
141 | 141 | // Check if there is at least one tag added. |
142 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
142 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
143 | 143 | return $content; |
144 | 144 | } |
145 | 145 | |
146 | 146 | $this->tag_args = $tag_args; |
147 | 147 | |
148 | - $new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); |
|
148 | + $new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); |
|
149 | 149 | |
150 | 150 | $this->tag_args = null; |
151 | 151 | |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return mixed |
163 | 163 | */ |
164 | - public function do_tag( $m ) { |
|
164 | + public function do_tag($m) { |
|
165 | 165 | |
166 | 166 | // Get tag |
167 | 167 | $tag = $m[1]; |
168 | 168 | |
169 | 169 | // Return tag if tag not set |
170 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
170 | + if ( ! $this->email_tag_exists($tag)) { |
|
171 | 171 | return $m[0]; |
172 | 172 | } |
173 | 173 | |
174 | - return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag ); |
|
174 | + return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | } |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param callable $func Hook to run when email tag is found |
187 | 187 | * @param string $context Email tag category |
188 | 188 | */ |
189 | -function give_add_email_tag( $tag, $description, $func, $context = '' ) { |
|
190 | - Give()->email_tags->add( $tag, $description, $func, $context ); |
|
189 | +function give_add_email_tag($tag, $description, $func, $context = '') { |
|
190 | + Give()->email_tags->add($tag, $description, $func, $context); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @param string $tag Email tag to remove hook from |
199 | 199 | */ |
200 | -function give_remove_email_tag( $tag ) { |
|
201 | - Give()->email_tags->remove( $tag ); |
|
200 | +function give_remove_email_tag($tag) { |
|
201 | + Give()->email_tags->remove($tag); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return bool |
212 | 212 | */ |
213 | -function give_email_tag_exists( $tag ) { |
|
214 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
213 | +function give_email_tag_exists($tag) { |
|
214 | + return Give()->email_tags->email_tag_exists($tag); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | $email_tags = give_get_email_tags(); |
239 | 239 | |
240 | 240 | ob_start(); |
241 | - if ( count( $email_tags ) > 0 ) : ?> |
|
241 | + if (count($email_tags) > 0) : ?> |
|
242 | 242 | <div class="give-email-tags-wrap"> |
243 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
243 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
244 | 244 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
245 | 245 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> |
246 | 246 | </span> |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @return string Content with email tags filtered out. |
266 | 266 | */ |
267 | -function give_do_email_tags( $content, $tag_args ) { |
|
267 | +function give_do_email_tags($content, $tag_args) { |
|
268 | 268 | // Backward compatibility < 2.0 |
269 | - if ( ! is_array( $tag_args ) && is_numeric( $tag_args ) ) { |
|
270 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
269 | + if ( ! is_array($tag_args) && is_numeric($tag_args)) { |
|
270 | + $tag_args = array('payment_id' => $tag_args); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | $email_tags = Give()->email_tags instanceof Give_Email_Template_Tags |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | : new Give_Email_Template_Tags(); |
276 | 276 | |
277 | 277 | // Replace all tags |
278 | - $content = $email_tags->do_tags( $content, $tag_args ); |
|
278 | + $content = $email_tags->do_tags($content, $tag_args); |
|
279 | 279 | |
280 | 280 | /** |
281 | 281 | * Filter the filtered content text. |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @since 1.0 |
284 | 284 | * @since 2.0 $payment_meta, $payment_id removed and $tag_args added. |
285 | 285 | */ |
286 | - $content = apply_filters( 'give_email_template_tags', $content, $tag_args ); |
|
286 | + $content = apply_filters('give_email_template_tags', $content, $tag_args); |
|
287 | 287 | |
288 | 288 | // Return content |
289 | 289 | return $content; |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @since 1.0 |
304 | 304 | */ |
305 | - do_action( 'give_add_email_tags' ); |
|
305 | + do_action('give_add_email_tags'); |
|
306 | 306 | } |
307 | 307 | |
308 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
308 | +add_action('init', 'give_load_email_tags', - 999); |
|
309 | 309 | |
310 | 310 | |
311 | 311 | /** |
@@ -320,67 +320,67 @@ discard block |
||
320 | 320 | /* Donation Payment */ |
321 | 321 | array( |
322 | 322 | 'tag' => 'donation', |
323 | - 'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
323 | + 'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'), |
|
324 | 324 | 'function' => 'give_email_tag_donation', |
325 | 325 | 'context' => 'donation', |
326 | 326 | ), |
327 | 327 | array( |
328 | 328 | 'tag' => 'amount', |
329 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
329 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
330 | 330 | 'function' => 'give_email_tag_amount', |
331 | 331 | 'context' => 'donation', |
332 | 332 | ), |
333 | 333 | array( |
334 | 334 | 'tag' => 'price', |
335 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
335 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
336 | 336 | 'function' => 'give_email_tag_price', |
337 | 337 | 'context' => 'donation', |
338 | 338 | ), |
339 | 339 | array( |
340 | 340 | 'tag' => 'billing_address', |
341 | - 'description' => esc_html__( 'The donor\'s billing address.', 'give' ), |
|
341 | + 'description' => esc_html__('The donor\'s billing address.', 'give'), |
|
342 | 342 | 'function' => 'give_email_tag_billing_address', |
343 | 343 | 'context' => 'donation', |
344 | 344 | ), |
345 | 345 | array( |
346 | 346 | 'tag' => 'date', |
347 | - 'description' => esc_html__( 'The date of the donation.', 'give' ), |
|
347 | + 'description' => esc_html__('The date of the donation.', 'give'), |
|
348 | 348 | 'function' => 'give_email_tag_date', |
349 | 349 | 'context' => 'donation', |
350 | 350 | ), |
351 | 351 | array( |
352 | 352 | 'tag' => 'payment_id', |
353 | - 'description' => esc_html__( 'The unique ID number for this donation.', 'give' ), |
|
353 | + 'description' => esc_html__('The unique ID number for this donation.', 'give'), |
|
354 | 354 | 'function' => 'give_email_tag_payment_id', |
355 | 355 | 'context' => 'donation', |
356 | 356 | ), |
357 | 357 | array( |
358 | 358 | 'tag' => 'payment_method', |
359 | - 'description' => esc_html__( 'The method of payment used for this donation.', 'give' ), |
|
359 | + 'description' => esc_html__('The method of payment used for this donation.', 'give'), |
|
360 | 360 | 'function' => 'give_email_tag_payment_method', |
361 | 361 | 'context' => 'donation', |
362 | 362 | ), |
363 | 363 | array( |
364 | 364 | 'tag' => 'payment_total', |
365 | - 'description' => esc_html__( 'The payment total for this donation.', 'give' ), |
|
365 | + 'description' => esc_html__('The payment total for this donation.', 'give'), |
|
366 | 366 | 'function' => 'give_email_tag_payment_total', |
367 | 367 | 'context' => 'donation', |
368 | 368 | ), |
369 | 369 | array( |
370 | 370 | 'tag' => 'receipt_id', |
371 | - 'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ), |
|
371 | + 'description' => esc_html__('The unique ID number for this donation receipt.', 'give'), |
|
372 | 372 | 'function' => 'give_email_tag_receipt_id', |
373 | 373 | 'context' => 'donation', |
374 | 374 | ), |
375 | 375 | array( |
376 | 376 | 'tag' => 'receipt_link', |
377 | - 'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
377 | + 'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
378 | 378 | 'function' => 'give_email_tag_receipt_link', |
379 | 379 | 'context' => 'donation', |
380 | 380 | ), |
381 | 381 | array( |
382 | 382 | 'tag' => 'receipt_link_url', |
383 | - 'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
383 | + 'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
384 | 384 | 'function' => 'give_email_tag_receipt_link_url', |
385 | 385 | 'context' => 'donation', |
386 | 386 | ), |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | /* Donation Form */ |
389 | 389 | array( |
390 | 390 | 'tag' => 'form_title', |
391 | - 'description' => esc_html__( 'The donation form name.', 'give' ), |
|
391 | + 'description' => esc_html__('The donation form name.', 'give'), |
|
392 | 392 | 'function' => 'give_email_tag_form_title', |
393 | 393 | 'context' => 'form', |
394 | 394 | ), |
@@ -396,37 +396,37 @@ discard block |
||
396 | 396 | /* Donor */ |
397 | 397 | array( |
398 | 398 | 'tag' => 'name', |
399 | - 'description' => esc_html__( 'The donor\'s first name.', 'give' ), |
|
399 | + 'description' => esc_html__('The donor\'s first name.', 'give'), |
|
400 | 400 | 'function' => 'give_email_tag_first_name', |
401 | 401 | 'context' => 'donor', |
402 | 402 | ), |
403 | 403 | array( |
404 | 404 | 'tag' => 'fullname', |
405 | - 'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ), |
|
405 | + 'description' => esc_html__('The donor\'s full name, first and last.', 'give'), |
|
406 | 406 | 'function' => 'give_email_tag_fullname', |
407 | 407 | 'context' => 'donor', |
408 | 408 | ), |
409 | 409 | array( |
410 | 410 | 'tag' => 'username', |
411 | - 'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
411 | + 'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
412 | 412 | 'function' => 'give_email_tag_username', |
413 | 413 | 'context' => 'donor', |
414 | 414 | ), |
415 | 415 | array( |
416 | 416 | 'tag' => 'company_name', |
417 | - 'description' => esc_html__( 'Company name.', 'give' ), |
|
417 | + 'description' => esc_html__('Company name.', 'give'), |
|
418 | 418 | 'function' => 'give_email_tag_company_name', |
419 | 419 | 'context' => 'donation', |
420 | 420 | ), |
421 | 421 | array( |
422 | 422 | 'tag' => 'user_email', |
423 | - 'description' => esc_html__( 'The donor\'s email address.', 'give' ), |
|
423 | + 'description' => esc_html__('The donor\'s email address.', 'give'), |
|
424 | 424 | 'function' => 'give_email_tag_user_email', |
425 | 425 | 'context' => 'donor', |
426 | 426 | ), |
427 | 427 | array( |
428 | 428 | 'tag' => 'email_access_link', |
429 | - 'description' => esc_html__( 'The donor\'s email access link.', 'give' ), |
|
429 | + 'description' => esc_html__('The donor\'s email access link.', 'give'), |
|
430 | 430 | 'function' => 'give_email_tag_email_access_link', |
431 | 431 | 'context' => 'donor', |
432 | 432 | ), |
@@ -434,35 +434,35 @@ discard block |
||
434 | 434 | /* General */ |
435 | 435 | array( |
436 | 436 | 'tag' => 'sitename', |
437 | - 'description' => esc_html__( 'The name of your site.', 'give' ), |
|
437 | + 'description' => esc_html__('The name of your site.', 'give'), |
|
438 | 438 | 'function' => 'give_email_tag_sitename', |
439 | 439 | 'context' => 'general', |
440 | 440 | ), |
441 | 441 | |
442 | 442 | array( |
443 | 443 | 'tag' => 'reset_password_link', |
444 | - 'description' => esc_html__( 'The reset password link for user.', 'give' ), |
|
444 | + 'description' => esc_html__('The reset password link for user.', 'give'), |
|
445 | 445 | 'function' => 'give_email_tag_reset_password_link', |
446 | 446 | 'context' => 'general', |
447 | 447 | ), |
448 | 448 | |
449 | 449 | array( |
450 | 450 | 'tag' => 'admin_email', |
451 | - 'description' => esc_html__( 'The custom admin email which is set inside Emails > Contact Information. By default this tag will use your WordPress admin email.', 'give' ), |
|
451 | + 'description' => esc_html__('The custom admin email which is set inside Emails > Contact Information. By default this tag will use your WordPress admin email.', 'give'), |
|
452 | 452 | 'function' => 'give_email_admin_email', |
453 | 453 | 'context' => 'general', |
454 | 454 | ), |
455 | 455 | |
456 | 456 | array( |
457 | 457 | 'tag' => 'site_url', |
458 | - 'description' => esc_html__( 'The website URL.', 'give' ), |
|
458 | + 'description' => esc_html__('The website URL.', 'give'), |
|
459 | 459 | 'function' => 'give_email_site_url', |
460 | 460 | 'context' => 'general', |
461 | 461 | ), |
462 | 462 | |
463 | 463 | array( |
464 | 464 | 'tag' => 'offline_mailing_address', |
465 | - 'description' => esc_html__( 'The Offline Mailing Address which is used for the Offline Donations Payment Gateway.', 'give' ), |
|
465 | + 'description' => esc_html__('The Offline Mailing Address which is used for the Offline Donations Payment Gateway.', 'give'), |
|
466 | 466 | 'function' => 'give_email_offline_mailing_address', |
467 | 467 | 'context' => 'general', |
468 | 468 | ), |
@@ -470,21 +470,21 @@ discard block |
||
470 | 470 | ); |
471 | 471 | |
472 | 472 | // Apply give_email_tags filter |
473 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
473 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
474 | 474 | |
475 | 475 | // Add email tags |
476 | - foreach ( $email_tags as $email_tag ) { |
|
476 | + foreach ($email_tags as $email_tag) { |
|
477 | 477 | give_add_email_tag( |
478 | 478 | $email_tag['tag'], |
479 | 479 | $email_tag['description'], |
480 | 480 | $email_tag['function'], |
481 | - ( ! empty( $email_tag['context'] ) ? $email_tag['context'] : '' ) |
|
481 | + ( ! empty($email_tag['context']) ? $email_tag['context'] : '') |
|
482 | 482 | ); |
483 | 483 | } |
484 | 484 | |
485 | 485 | } |
486 | 486 | |
487 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
487 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
488 | 488 | |
489 | 489 | |
490 | 490 | /** |
@@ -496,24 +496,24 @@ discard block |
||
496 | 496 | * |
497 | 497 | * @return string $firstname |
498 | 498 | */ |
499 | -function give_email_tag_first_name( $tag_args ) { |
|
499 | +function give_email_tag_first_name($tag_args) { |
|
500 | 500 | $user_info = array(); |
501 | 501 | $firstname = ''; |
502 | 502 | |
503 | 503 | // Backward compatibility. |
504 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
504 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
505 | 505 | |
506 | - switch ( true ) { |
|
507 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
508 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
509 | - $email_names = give_get_email_names( $donor_info ); |
|
506 | + switch (true) { |
|
507 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
508 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
509 | + $email_names = give_get_email_names($donor_info); |
|
510 | 510 | $firstname = $email_names['name']; |
511 | 511 | |
512 | 512 | break; |
513 | 513 | |
514 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
514 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
515 | 515 | $firstname = Give()->donor_meta->get_meta( |
516 | - Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ), |
|
516 | + Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']), |
|
517 | 517 | '_give_donor_first_name', |
518 | 518 | true |
519 | 519 | ); |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | * |
525 | 525 | * @since 2.0 |
526 | 526 | */ |
527 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
528 | - $firstname = Give()->donor_meta->get_meta( $tag_args['donor_id'], '_give_donor_first_name', true ); |
|
527 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
528 | + $firstname = Give()->donor_meta->get_meta($tag_args['donor_id'], '_give_donor_first_name', true); |
|
529 | 529 | break; |
530 | 530 | } |
531 | 531 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * @param string $firstname |
538 | 538 | * @param array $tag_args |
539 | 539 | */ |
540 | - $firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args ); |
|
540 | + $firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args); |
|
541 | 541 | |
542 | 542 | return $firstname; |
543 | 543 | } |
@@ -551,21 +551,21 @@ discard block |
||
551 | 551 | * |
552 | 552 | * @return string $fullname |
553 | 553 | */ |
554 | -function give_email_tag_fullname( $tag_args ) { |
|
554 | +function give_email_tag_fullname($tag_args) { |
|
555 | 555 | $fullname = ''; |
556 | 556 | |
557 | 557 | // Backward compatibility. |
558 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
558 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
559 | 559 | |
560 | - switch ( true ) { |
|
561 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
562 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
563 | - $email_names = give_get_email_names( $donor_info ); |
|
560 | + switch (true) { |
|
561 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
562 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
563 | + $email_names = give_get_email_names($donor_info); |
|
564 | 564 | $fullname = $email_names['fullname']; |
565 | 565 | break; |
566 | 566 | |
567 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
568 | - $fullname = Give()->donors->get_column_by( 'name', 'user_id', $tag_args['user_id'] ); |
|
567 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
568 | + $fullname = Give()->donors->get_column_by('name', 'user_id', $tag_args['user_id']); |
|
569 | 569 | break; |
570 | 570 | |
571 | 571 | /** |
@@ -573,8 +573,8 @@ discard block |
||
573 | 573 | * |
574 | 574 | * @since 2.0 |
575 | 575 | */ |
576 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
577 | - $fullname = Give()->donors->get_column( 'name', $tag_args['donor_id'] ); |
|
576 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
577 | + $fullname = Give()->donors->get_column('name', $tag_args['donor_id']); |
|
578 | 578 | break; |
579 | 579 | } |
580 | 580 | |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | * @param string $fullname |
587 | 587 | * @param array $tag_args |
588 | 588 | */ |
589 | - $fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args ); |
|
589 | + $fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args); |
|
590 | 590 | |
591 | 591 | return $fullname; |
592 | 592 | } |
@@ -600,21 +600,21 @@ discard block |
||
600 | 600 | * |
601 | 601 | * @return string username. |
602 | 602 | */ |
603 | -function give_email_tag_username( $tag_args ) { |
|
603 | +function give_email_tag_username($tag_args) { |
|
604 | 604 | $username = ''; |
605 | 605 | |
606 | 606 | // Backward compatibility. |
607 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
607 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
608 | 608 | |
609 | - switch ( true ) { |
|
610 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
611 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
612 | - $email_names = give_get_email_names( $donor_info ); |
|
609 | + switch (true) { |
|
610 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
611 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
612 | + $email_names = give_get_email_names($donor_info); |
|
613 | 613 | $username = $email_names['username']; |
614 | 614 | break; |
615 | 615 | |
616 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
617 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
616 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
617 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
618 | 618 | $username = $user_info->user_login; |
619 | 619 | break; |
620 | 620 | |
@@ -623,9 +623,9 @@ discard block |
||
623 | 623 | * |
624 | 624 | * @since 2.0 |
625 | 625 | */ |
626 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
627 | - if ( $user_id = Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ) { |
|
628 | - $user_info = get_user_by( 'id', $user_id ); |
|
626 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
627 | + if ($user_id = Give()->donors->get_column('user_id', $tag_args['donor_id'])) { |
|
628 | + $user_info = get_user_by('id', $user_id); |
|
629 | 629 | $username = $user_info->user_login; |
630 | 630 | } |
631 | 631 | break; |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | * @param string $username |
640 | 640 | * @param array $tag_args |
641 | 641 | */ |
642 | - $username = apply_filters( 'give_email_tag_username', $username, $tag_args ); |
|
642 | + $username = apply_filters('give_email_tag_username', $username, $tag_args); |
|
643 | 643 | |
644 | 644 | return $username; |
645 | 645 | } |
@@ -653,19 +653,19 @@ discard block |
||
653 | 653 | * |
654 | 654 | * @return string user_email |
655 | 655 | */ |
656 | -function give_email_tag_user_email( $tag_args ) { |
|
656 | +function give_email_tag_user_email($tag_args) { |
|
657 | 657 | $email = ''; |
658 | 658 | |
659 | 659 | // Backward compatibility. |
660 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
660 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
661 | 661 | |
662 | - switch ( true ) { |
|
663 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
664 | - $email = give_get_donation_donor_email( $tag_args['payment_id'] ); |
|
662 | + switch (true) { |
|
663 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
664 | + $email = give_get_donation_donor_email($tag_args['payment_id']); |
|
665 | 665 | break; |
666 | 666 | |
667 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
668 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
667 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
668 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
669 | 669 | $email = $user_info->user_email; |
670 | 670 | break; |
671 | 671 | |
@@ -674,8 +674,8 @@ discard block |
||
674 | 674 | * |
675 | 675 | * @since 2.0 |
676 | 676 | */ |
677 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
678 | - $email = Give()->donors->get_column( 'email', $tag_args['donor_id'] ); |
|
677 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
678 | + $email = Give()->donors->get_column('email', $tag_args['donor_id']); |
|
679 | 679 | break; |
680 | 680 | } |
681 | 681 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * @param string $email |
688 | 688 | * @param array $tag_args |
689 | 689 | */ |
690 | - $email = apply_filters( 'give_email_tag_user_email', $email, $tag_args ); |
|
690 | + $email = apply_filters('give_email_tag_user_email', $email, $tag_args); |
|
691 | 691 | |
692 | 692 | return $email; |
693 | 693 | } |
@@ -701,22 +701,22 @@ discard block |
||
701 | 701 | * |
702 | 702 | * @return string billing_address |
703 | 703 | */ |
704 | -function give_email_tag_billing_address( $tag_args ) { |
|
704 | +function give_email_tag_billing_address($tag_args) { |
|
705 | 705 | $address = ''; |
706 | 706 | |
707 | 707 | // Backward compatibility. |
708 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
708 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
709 | 709 | |
710 | - switch ( true ) { |
|
711 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
712 | - $donation_address = give_get_donation_address( $tag_args['payment_id'] ); |
|
710 | + switch (true) { |
|
711 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
712 | + $donation_address = give_get_donation_address($tag_args['payment_id']); |
|
713 | 713 | |
714 | 714 | $billing_address = array(); |
715 | 715 | $billing_address['street_address'] = ''; |
716 | 716 | $billing_address['street_address'] .= $donation_address['line1']; |
717 | 717 | |
718 | - if ( ! empty( $donation_address['line2'] ) ) { |
|
719 | - $billing_address['street_address'] .= "\n" . $donation_address['line2']; |
|
718 | + if ( ! empty($donation_address['line2'])) { |
|
719 | + $billing_address['street_address'] .= "\n".$donation_address['line2']; |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | $billing_address['city'] = $donation_address['city']; |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | $billing_address['postal_code'] = $donation_address['zip']; |
725 | 725 | $billing_address['country'] = $donation_address['country']; |
726 | 726 | |
727 | - $address = give_get_formatted_address( $billing_address ); |
|
727 | + $address = give_get_formatted_address($billing_address); |
|
728 | 728 | |
729 | 729 | break; |
730 | 730 | } |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | * @param string $address |
738 | 738 | * @param array $tag_args |
739 | 739 | */ |
740 | - $address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args ); |
|
740 | + $address = apply_filters('give_email_tag_billing_address', $address, $tag_args); |
|
741 | 741 | |
742 | 742 | return $address; |
743 | 743 | } |
@@ -751,15 +751,15 @@ discard block |
||
751 | 751 | * |
752 | 752 | * @return string $date Post Date. |
753 | 753 | */ |
754 | -function give_email_tag_date( $tag_args ) { |
|
754 | +function give_email_tag_date($tag_args) { |
|
755 | 755 | $date = ''; |
756 | 756 | |
757 | 757 | // Backward compatibility. |
758 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
758 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
759 | 759 | |
760 | - switch ( true ) { |
|
761 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
762 | - $date = date_i18n( give_date_format(), get_the_date( 'U', $tag_args['payment_id'] ) ); |
|
760 | + switch (true) { |
|
761 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
762 | + $date = date_i18n(give_date_format(), get_the_date('U', $tag_args['payment_id'])); |
|
763 | 763 | break; |
764 | 764 | } |
765 | 765 | |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | * @param string $date |
772 | 772 | * @param array $tag_args |
773 | 773 | */ |
774 | - $date = apply_filters( 'give_email_tag_date', $date, $tag_args ); |
|
774 | + $date = apply_filters('give_email_tag_date', $date, $tag_args); |
|
775 | 775 | |
776 | 776 | return $date; |
777 | 777 | } |
@@ -785,16 +785,16 @@ discard block |
||
785 | 785 | * |
786 | 786 | * @return string amount |
787 | 787 | */ |
788 | -function give_email_tag_amount( $tag_args ) { |
|
788 | +function give_email_tag_amount($tag_args) { |
|
789 | 789 | $amount = ''; |
790 | 790 | |
791 | 791 | // Backward compatibility. |
792 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
792 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
793 | 793 | |
794 | - switch ( true ) { |
|
795 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
796 | - $give_amount = give_donation_amount( $tag_args['payment_id'], true ); |
|
797 | - $amount = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
794 | + switch (true) { |
|
795 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
796 | + $give_amount = give_donation_amount($tag_args['payment_id'], true); |
|
797 | + $amount = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
798 | 798 | break; |
799 | 799 | } |
800 | 800 | |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | * @param string $amount |
807 | 807 | * @param array $tag_args |
808 | 808 | */ |
809 | - $amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args ); |
|
809 | + $amount = apply_filters('give_email_tag_amount', $amount, $tag_args); |
|
810 | 810 | |
811 | 811 | return $amount; |
812 | 812 | } |
@@ -820,8 +820,8 @@ discard block |
||
820 | 820 | * |
821 | 821 | * @return string price |
822 | 822 | */ |
823 | -function give_email_tag_price( $tag_args ) { |
|
824 | - return give_email_tag_amount( $tag_args ); |
|
823 | +function give_email_tag_price($tag_args) { |
|
824 | + return give_email_tag_amount($tag_args); |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | /** |
@@ -833,15 +833,15 @@ discard block |
||
833 | 833 | * |
834 | 834 | * @return int payment_id |
835 | 835 | */ |
836 | -function give_email_tag_payment_id( $tag_args ) { |
|
836 | +function give_email_tag_payment_id($tag_args) { |
|
837 | 837 | $payment_id = ''; |
838 | 838 | |
839 | 839 | // Backward compatibility. |
840 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
840 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
841 | 841 | |
842 | - switch ( true ) { |
|
843 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
844 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
842 | + switch (true) { |
|
843 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
844 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
845 | 845 | break; |
846 | 846 | } |
847 | 847 | |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | * @param string $payment_id |
854 | 854 | * @param array $tag_args |
855 | 855 | */ |
856 | - return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args ); |
|
856 | + return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args); |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | /** |
@@ -865,15 +865,15 @@ discard block |
||
865 | 865 | * |
866 | 866 | * @return string receipt_id |
867 | 867 | */ |
868 | -function give_email_tag_receipt_id( $tag_args ) { |
|
868 | +function give_email_tag_receipt_id($tag_args) { |
|
869 | 869 | $receipt_id = ''; |
870 | 870 | |
871 | 871 | // Backward compatibility. |
872 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
872 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
873 | 873 | |
874 | - switch ( true ) { |
|
875 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
876 | - $receipt_id = give_get_payment_key( $tag_args['payment_id'] ); |
|
874 | + switch (true) { |
|
875 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
876 | + $receipt_id = give_get_payment_key($tag_args['payment_id']); |
|
877 | 877 | break; |
878 | 878 | } |
879 | 879 | |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | * @param string $receipt_id |
886 | 886 | * @param array $tag_args |
887 | 887 | */ |
888 | - return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args ); |
|
888 | + return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args); |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | /** |
@@ -897,21 +897,21 @@ discard block |
||
897 | 897 | * |
898 | 898 | * @return string $form_title |
899 | 899 | */ |
900 | -function give_email_tag_donation( $tag_args ) { |
|
900 | +function give_email_tag_donation($tag_args) { |
|
901 | 901 | $donation_form_title = ''; |
902 | 902 | |
903 | 903 | // Backward compatibility. |
904 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
904 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
905 | 905 | |
906 | - switch ( true ) { |
|
907 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
908 | - $level_title = give_has_variable_prices( give_get_payment_form_id( $tag_args['payment_id'] ) ); |
|
906 | + switch (true) { |
|
907 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
908 | + $level_title = give_has_variable_prices(give_get_payment_form_id($tag_args['payment_id'])); |
|
909 | 909 | $separator = $level_title ? '-' : ''; |
910 | 910 | $donation_form_title = strip_tags( |
911 | 911 | give_check_variable( |
912 | 912 | give_get_donation_form_title( |
913 | 913 | $tag_args['payment_id'], |
914 | - array( 'separator' => $separator, ) |
|
914 | + array('separator' => $separator,) |
|
915 | 915 | ), |
916 | 916 | 'empty', |
917 | 917 | '' |
@@ -944,15 +944,15 @@ discard block |
||
944 | 944 | * |
945 | 945 | * @return string $form_title |
946 | 946 | */ |
947 | -function give_email_tag_form_title( $tag_args ) { |
|
947 | +function give_email_tag_form_title($tag_args) { |
|
948 | 948 | $donation_form_title = ''; |
949 | 949 | |
950 | 950 | // Backward compatibility. |
951 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
951 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
952 | 952 | |
953 | - switch ( true ) { |
|
954 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
955 | - $donation_form_title = give_get_payment_meta( $tag_args['payment_id'], '_give_payment_form_title' ); |
|
953 | + switch (true) { |
|
954 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
955 | + $donation_form_title = give_get_payment_meta($tag_args['payment_id'], '_give_payment_form_title'); |
|
956 | 956 | break; |
957 | 957 | } |
958 | 958 | |
@@ -981,15 +981,15 @@ discard block |
||
981 | 981 | * |
982 | 982 | * @return string $company_name |
983 | 983 | */ |
984 | -function give_email_tag_company_name( $tag_args ) { |
|
984 | +function give_email_tag_company_name($tag_args) { |
|
985 | 985 | $company_name = ''; |
986 | 986 | |
987 | 987 | // Backward compatibility. |
988 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
988 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
989 | 989 | |
990 | - switch ( true ) { |
|
991 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
992 | - $company_name = give_get_payment_meta( $tag_args['payment_id'], '_give_donation_company', true ); |
|
990 | + switch (true) { |
|
991 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
992 | + $company_name = give_get_payment_meta($tag_args['payment_id'], '_give_donation_company', true); |
|
993 | 993 | break; |
994 | 994 | } |
995 | 995 | |
@@ -1017,18 +1017,18 @@ discard block |
||
1017 | 1017 | * |
1018 | 1018 | * @return string gateway |
1019 | 1019 | */ |
1020 | -function give_email_tag_payment_method( $tag_args ) { |
|
1020 | +function give_email_tag_payment_method($tag_args) { |
|
1021 | 1021 | $payment_method = ''; |
1022 | 1022 | |
1023 | 1023 | // Backward compatibility. |
1024 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1024 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1025 | 1025 | |
1026 | 1026 | // Backward compatibility. |
1027 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1027 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1028 | 1028 | |
1029 | - switch ( true ) { |
|
1030 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1031 | - $payment_method = give_get_gateway_checkout_label( give_get_payment_gateway( $tag_args['payment_id'] ) ); |
|
1029 | + switch (true) { |
|
1030 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1031 | + $payment_method = give_get_gateway_checkout_label(give_get_payment_gateway($tag_args['payment_id'])); |
|
1032 | 1032 | break; |
1033 | 1033 | } |
1034 | 1034 | |
@@ -1059,15 +1059,15 @@ discard block |
||
1059 | 1059 | * |
1060 | 1060 | * @return string |
1061 | 1061 | */ |
1062 | -function give_email_tag_payment_total( $tag_args ) { |
|
1062 | +function give_email_tag_payment_total($tag_args) { |
|
1063 | 1063 | $payment_total = ''; |
1064 | 1064 | |
1065 | 1065 | // Backward compatibility. |
1066 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1066 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1067 | 1067 | |
1068 | - switch ( true ) { |
|
1069 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1070 | - $payment_total = give_currency_filter( give_get_payment_total( $tag_args['payment_id'] ) ); |
|
1068 | + switch (true) { |
|
1069 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1070 | + $payment_total = give_currency_filter(give_get_payment_total($tag_args['payment_id'])); |
|
1071 | 1071 | break; |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1095,11 +1095,11 @@ discard block |
||
1095 | 1095 | * |
1096 | 1096 | * @return string |
1097 | 1097 | */ |
1098 | -function give_email_tag_sitename( $tag_args = array() ) { |
|
1099 | - $sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
1098 | +function give_email_tag_sitename($tag_args = array()) { |
|
1099 | + $sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
1100 | 1100 | |
1101 | 1101 | // Backward compatibility. |
1102 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1102 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1103 | 1103 | |
1104 | 1104 | /** |
1105 | 1105 | * Filter the {sitename} email template tag output. |
@@ -1125,26 +1125,26 @@ discard block |
||
1125 | 1125 | * |
1126 | 1126 | * @return string receipt_link |
1127 | 1127 | */ |
1128 | -function give_email_tag_receipt_link( $tag_args ) { |
|
1128 | +function give_email_tag_receipt_link($tag_args) { |
|
1129 | 1129 | // Backward compatibility. |
1130 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1130 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1131 | 1131 | |
1132 | - $receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1132 | + $receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1133 | 1133 | |
1134 | 1134 | // Bailout. |
1135 | - if ( give_get_option( 'email_template' ) === 'none' ) { |
|
1135 | + if (give_get_option('email_template') === 'none') { |
|
1136 | 1136 | return $receipt_url; |
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | |
1140 | - $receipt_url = esc_url( add_query_arg( array( |
|
1141 | - 'payment_key' => give_get_payment_key( $tag_args['payment_id'] ), |
|
1142 | - ), give_get_history_page_uri() ) ); |
|
1140 | + $receipt_url = esc_url(add_query_arg(array( |
|
1141 | + 'payment_key' => give_get_payment_key($tag_args['payment_id']), |
|
1142 | + ), give_get_history_page_uri())); |
|
1143 | 1143 | |
1144 | 1144 | $formatted = sprintf( |
1145 | 1145 | '<a href="%1$s">%2$s</a>', |
1146 | 1146 | $receipt_url, |
1147 | - __( 'View it in your browser »', 'give' ) |
|
1147 | + __('View it in your browser »', 'give') |
|
1148 | 1148 | ); |
1149 | 1149 | |
1150 | 1150 | /** |
@@ -1173,11 +1173,11 @@ discard block |
||
1173 | 1173 | * |
1174 | 1174 | * @return string receipt_url |
1175 | 1175 | */ |
1176 | -function give_email_tag_receipt_link_url( $tag_args ) { |
|
1176 | +function give_email_tag_receipt_link_url($tag_args) { |
|
1177 | 1177 | // Backward compatibility. |
1178 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1178 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1179 | 1179 | |
1180 | - $receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1180 | + $receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1181 | 1181 | |
1182 | 1182 | /** |
1183 | 1183 | * Filter the {receipt_link_url} email template tag output. |
@@ -1204,13 +1204,13 @@ discard block |
||
1204 | 1204 | * |
1205 | 1205 | * @return string |
1206 | 1206 | */ |
1207 | -function give_get_receipt_url( $payment_id ) { |
|
1207 | +function give_get_receipt_url($payment_id) { |
|
1208 | 1208 | $receipt_url = ''; |
1209 | 1209 | |
1210 | - if ( $payment_id ) { |
|
1211 | - $receipt_url = esc_url( add_query_arg( array( |
|
1212 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
1213 | - ), give_get_history_page_uri() ) ); |
|
1210 | + if ($payment_id) { |
|
1211 | + $receipt_url = esc_url(add_query_arg(array( |
|
1212 | + 'payment_key' => give_get_payment_key($payment_id), |
|
1213 | + ), give_get_history_page_uri())); |
|
1214 | 1214 | } |
1215 | 1215 | |
1216 | 1216 | return $receipt_url; |
@@ -1226,22 +1226,22 @@ discard block |
||
1226 | 1226 | * |
1227 | 1227 | * @return string |
1228 | 1228 | */ |
1229 | -function give_email_tag_email_access_link( $tag_args ) { |
|
1229 | +function give_email_tag_email_access_link($tag_args) { |
|
1230 | 1230 | $donor_id = 0; |
1231 | 1231 | $donor = array(); |
1232 | 1232 | $email_access_link = ''; |
1233 | 1233 | |
1234 | 1234 | // Backward compatibility. |
1235 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1235 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1236 | 1236 | |
1237 | - switch ( true ) { |
|
1238 | - case ! empty( $tag_args['donor_id'] ): |
|
1237 | + switch (true) { |
|
1238 | + case ! empty($tag_args['donor_id']): |
|
1239 | 1239 | $donor_id = $tag_args['donor_id']; |
1240 | - $donor = Give()->donors->get_by( 'id', $tag_args['donor_id'] ); |
|
1240 | + $donor = Give()->donors->get_by('id', $tag_args['donor_id']); |
|
1241 | 1241 | break; |
1242 | 1242 | |
1243 | - case ! empty( $tag_args['user_id'] ): |
|
1244 | - $donor = Give()->donors->get_by( 'user_id', $tag_args['user_id'] ); |
|
1243 | + case ! empty($tag_args['user_id']): |
|
1244 | + $donor = Give()->donors->get_by('user_id', $tag_args['user_id']); |
|
1245 | 1245 | $donor_id = $donor->id; |
1246 | 1246 | break; |
1247 | 1247 | |
@@ -1250,11 +1250,11 @@ discard block |
||
1250 | 1250 | } |
1251 | 1251 | |
1252 | 1252 | // Set email access link if donor exist. |
1253 | - if ( $donor_id ) { |
|
1254 | - $verify_key = wp_generate_password( 20, false ); |
|
1253 | + if ($donor_id) { |
|
1254 | + $verify_key = wp_generate_password(20, false); |
|
1255 | 1255 | |
1256 | 1256 | // Generate a new verify key |
1257 | - Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key ); |
|
1257 | + Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key); |
|
1258 | 1258 | // update verify key in email tags. |
1259 | 1259 | $tag_args['verify_key'] = $verify_key; |
1260 | 1260 | |
@@ -1269,28 +1269,28 @@ discard block |
||
1269 | 1269 | ); |
1270 | 1270 | |
1271 | 1271 | // Add Payment Key to email access url, if it exists. |
1272 | - if ( ! empty( $_GET['payment_key'] ) ) { |
|
1272 | + if ( ! empty($_GET['payment_key'])) { |
|
1273 | 1273 | $access_url = add_query_arg( |
1274 | 1274 | array( |
1275 | - 'payment_key' => give_clean( $_GET['payment_key'] ), |
|
1275 | + 'payment_key' => give_clean($_GET['payment_key']), |
|
1276 | 1276 | ), |
1277 | 1277 | $access_url |
1278 | 1278 | ); |
1279 | 1279 | } |
1280 | 1280 | |
1281 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1281 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1282 | 1282 | $email_access_link = sprintf( |
1283 | 1283 | '<a href="%1$s" target="_blank">%2$s</a>', |
1284 | - esc_url( $access_url ), |
|
1285 | - __( 'View your donation history »', 'give' ) |
|
1284 | + esc_url($access_url), |
|
1285 | + __('View your donation history »', 'give') |
|
1286 | 1286 | ); |
1287 | 1287 | |
1288 | 1288 | } else { |
1289 | 1289 | |
1290 | 1290 | $email_access_link = sprintf( |
1291 | 1291 | '%1$s: %2$s', |
1292 | - __( 'View your donation history', 'give' ), |
|
1293 | - esc_url( $access_url ) |
|
1292 | + __('View your donation history', 'give'), |
|
1293 | + esc_url($access_url) |
|
1294 | 1294 | ); |
1295 | 1295 | } |
1296 | 1296 | } |
@@ -1322,23 +1322,23 @@ discard block |
||
1322 | 1322 | * |
1323 | 1323 | * @return array |
1324 | 1324 | */ |
1325 | -function __give_20_bc_str_type_email_tag_param( $tag_args ) { |
|
1326 | - if ( ! is_array( $tag_args ) ) { |
|
1327 | - switch ( true ) { |
|
1328 | - case ( 'give_payment' === get_post_type( $tag_args ) ): |
|
1329 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
1325 | +function __give_20_bc_str_type_email_tag_param($tag_args) { |
|
1326 | + if ( ! is_array($tag_args)) { |
|
1327 | + switch (true) { |
|
1328 | + case ('give_payment' === get_post_type($tag_args)): |
|
1329 | + $tag_args = array('payment_id' => $tag_args); |
|
1330 | 1330 | break; |
1331 | 1331 | |
1332 | - case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ): |
|
1333 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1332 | + case ( ! is_wp_error(get_user_by('id', $tag_args))): |
|
1333 | + $tag_args = array('user_id' => $tag_args); |
|
1334 | 1334 | break; |
1335 | 1335 | |
1336 | - case ( Give()->donors->get_by( 'id', $tag_args ) ): |
|
1337 | - $tag_args = array( 'donor_id' => $tag_args ); |
|
1336 | + case (Give()->donors->get_by('id', $tag_args)): |
|
1337 | + $tag_args = array('donor_id' => $tag_args); |
|
1338 | 1338 | break; |
1339 | 1339 | |
1340 | - case ( Give()->donors->get_by( 'user_id', $tag_args ) ): |
|
1341 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1340 | + case (Give()->donors->get_by('user_id', $tag_args)): |
|
1341 | + $tag_args = array('user_id' => $tag_args); |
|
1342 | 1342 | break; |
1343 | 1343 | } |
1344 | 1344 | } |
@@ -1356,36 +1356,36 @@ discard block |
||
1356 | 1356 | * |
1357 | 1357 | * @return array |
1358 | 1358 | */ |
1359 | -function give_email_tag_reset_password_link( $tag_args, $payment_id ) { |
|
1359 | +function give_email_tag_reset_password_link($tag_args, $payment_id) { |
|
1360 | 1360 | |
1361 | 1361 | $reset_password_url = ''; |
1362 | 1362 | |
1363 | - switch ( true ) { |
|
1364 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1365 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
1363 | + switch (true) { |
|
1364 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1365 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
1366 | 1366 | break; |
1367 | 1367 | |
1368 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
1369 | - $reset_password_url = give_get_reset_password_url( $tag_args['user_id'] ); |
|
1368 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
1369 | + $reset_password_url = give_get_reset_password_url($tag_args['user_id']); |
|
1370 | 1370 | break; |
1371 | 1371 | |
1372 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
1373 | - $reset_password_url = give_get_reset_password_url( Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ); |
|
1372 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
1373 | + $reset_password_url = give_get_reset_password_url(Give()->donors->get_column('user_id', $tag_args['donor_id'])); |
|
1374 | 1374 | break; |
1375 | 1375 | } |
1376 | 1376 | |
1377 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1377 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1378 | 1378 | // Generate link, if Email content type is html. |
1379 | 1379 | $reset_password_link = sprintf( |
1380 | 1380 | '<a href="%1$s" target="_blank">%2$s</a>', |
1381 | - esc_url( $reset_password_url ), |
|
1382 | - __( 'Reset your password »', 'give' ) |
|
1381 | + esc_url($reset_password_url), |
|
1382 | + __('Reset your password »', 'give') |
|
1383 | 1383 | ); |
1384 | 1384 | } else { |
1385 | 1385 | $reset_password_link = sprintf( |
1386 | 1386 | '%1$s: %2$s', |
1387 | - __( 'Reset your password', 'give' ), |
|
1388 | - esc_url( $reset_password_url ) |
|
1387 | + __('Reset your password', 'give'), |
|
1388 | + esc_url($reset_password_url) |
|
1389 | 1389 | ); |
1390 | 1390 | } |
1391 | 1391 | |
@@ -1414,21 +1414,21 @@ discard block |
||
1414 | 1414 | * |
1415 | 1415 | * @return mixed|string |
1416 | 1416 | */ |
1417 | -function give_get_reset_password_url( $user_id ) { |
|
1417 | +function give_get_reset_password_url($user_id) { |
|
1418 | 1418 | $reset_password_url = ''; |
1419 | 1419 | |
1420 | 1420 | // Proceed further only, if user_id exists. |
1421 | - if ( $user_id ) { |
|
1421 | + if ($user_id) { |
|
1422 | 1422 | |
1423 | 1423 | // Get User Object Details. |
1424 | - $user = get_user_by( 'ID', $user_id ); |
|
1424 | + $user = get_user_by('ID', $user_id); |
|
1425 | 1425 | |
1426 | 1426 | // Prepare Reset Password URL. |
1427 | - $reset_password_url = esc_url( add_query_arg( array( |
|
1427 | + $reset_password_url = esc_url(add_query_arg(array( |
|
1428 | 1428 | 'action' => 'rp', |
1429 | - 'key' => get_password_reset_key( $user ), |
|
1429 | + 'key' => get_password_reset_key($user), |
|
1430 | 1430 | 'login' => $user->user_login, |
1431 | - ), wp_login_url() ) ); |
|
1431 | + ), wp_login_url())); |
|
1432 | 1432 | } |
1433 | 1433 | |
1434 | 1434 | return $reset_password_url; |
@@ -1443,15 +1443,15 @@ discard block |
||
1443 | 1443 | */ |
1444 | 1444 | function give_email_admin_email() { |
1445 | 1445 | |
1446 | - $admin_email = give_get_option( 'contact_admin_email' ); |
|
1446 | + $admin_email = give_get_option('contact_admin_email'); |
|
1447 | 1447 | |
1448 | - if ( empty( $admin_email ) ) { |
|
1449 | - give_delete_option( 'contact_admin_email' ); |
|
1448 | + if (empty($admin_email)) { |
|
1449 | + give_delete_option('contact_admin_email'); |
|
1450 | 1450 | } |
1451 | 1451 | |
1452 | - return ( ! empty( $admin_email ) ) |
|
1452 | + return ( ! empty($admin_email)) |
|
1453 | 1453 | ? $admin_email |
1454 | - : get_bloginfo( 'admin_email' ); |
|
1454 | + : get_bloginfo('admin_email'); |
|
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | /** |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | * @return string |
1463 | 1463 | */ |
1464 | 1464 | function give_email_site_url() { |
1465 | - return get_bloginfo( 'url' ); |
|
1465 | + return get_bloginfo('url'); |
|
1466 | 1466 | } |
1467 | 1467 | |
1468 | 1468 | |
@@ -1474,10 +1474,10 @@ discard block |
||
1474 | 1474 | * @return string |
1475 | 1475 | */ |
1476 | 1476 | function give_email_offline_mailing_address() { |
1477 | - $offline_address = give_get_option( 'contact_offline_mailing_address' ); |
|
1477 | + $offline_address = give_get_option('contact_offline_mailing_address'); |
|
1478 | 1478 | |
1479 | - if ( false === $offline_address ) { |
|
1480 | - return sprintf( ' <em>%s</em></em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', get_bloginfo( 'sitename' ) ); |
|
1479 | + if (false === $offline_address) { |
|
1480 | + return sprintf(' <em>%s</em></em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', get_bloginfo('sitename')); |
|
1481 | 1481 | } |
1482 | 1482 | |
1483 | 1483 | return $offline_address; |
@@ -1495,94 +1495,94 @@ discard block |
||
1495 | 1495 | * |
1496 | 1496 | * @return mixed |
1497 | 1497 | */ |
1498 | -function __give_render_metadata_email_tag( $content, $tag_args ) { |
|
1499 | - preg_match_all( "/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches ); |
|
1498 | +function __give_render_metadata_email_tag($content, $tag_args) { |
|
1499 | + preg_match_all("/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches); |
|
1500 | 1500 | |
1501 | - if ( ! empty( $matches[0] ) ) { |
|
1501 | + if ( ! empty($matches[0])) { |
|
1502 | 1502 | $search = $replace = array(); |
1503 | - foreach ( $matches[0] as $index => $meta_tag ) { |
|
1504 | - if ( in_array( $meta_tag, $search ) ) { |
|
1503 | + foreach ($matches[0] as $index => $meta_tag) { |
|
1504 | + if (in_array($meta_tag, $search)) { |
|
1505 | 1505 | continue; |
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | $search[] = $meta_tag; |
1509 | 1509 | |
1510 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1511 | - $meta_tag_arr = array_map( 'trim', explode( ' ', $meta_tag, 2 ) ); |
|
1512 | - $meta_tag = current( $meta_tag_arr ); |
|
1510 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1511 | + $meta_tag_arr = array_map('trim', explode(' ', $meta_tag, 2)); |
|
1512 | + $meta_tag = current($meta_tag_arr); |
|
1513 | 1513 | |
1514 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1515 | - $type = current( explode( '_', $meta_tag, 2 ) ); |
|
1516 | - $meta_name = preg_replace( "/^{$type}_/", '', $meta_tag ); |
|
1514 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1515 | + $type = current(explode('_', $meta_tag, 2)); |
|
1516 | + $meta_name = preg_replace("/^{$type}_/", '', $meta_tag); |
|
1517 | 1517 | |
1518 | - switch ( $type ) { |
|
1518 | + switch ($type) { |
|
1519 | 1519 | case 'donation': |
1520 | 1520 | |
1521 | 1521 | //Bailout. |
1522 | - if ( ! isset( $tag_args['payment_id'] ) ) { |
|
1522 | + if ( ! isset($tag_args['payment_id'])) { |
|
1523 | 1523 | $replace[] = ''; |
1524 | 1524 | continue; |
1525 | 1525 | } |
1526 | 1526 | |
1527 | - $meta_data = give_get_meta( absint( $tag_args['payment_id'] ), $meta_name, true, '' ); |
|
1527 | + $meta_data = give_get_meta(absint($tag_args['payment_id']), $meta_name, true, ''); |
|
1528 | 1528 | |
1529 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1529 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1530 | 1530 | $replace[] = $meta_data; |
1531 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1532 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1531 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1532 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1533 | 1533 | } |
1534 | 1534 | |
1535 | 1535 | break; |
1536 | 1536 | |
1537 | 1537 | case 'form': |
1538 | - $form_id = isset( $tag_args['form_id'] ) ? absint( $tag_args['form_id'] ) : 0; |
|
1538 | + $form_id = isset($tag_args['form_id']) ? absint($tag_args['form_id']) : 0; |
|
1539 | 1539 | |
1540 | 1540 | // Bailout. |
1541 | - if ( ! $form_id && isset( $tag_args['payment_id'] ) ) { |
|
1542 | - $form_id = give_get_payment_form_id( $tag_args['payment_id'] ); |
|
1541 | + if ( ! $form_id && isset($tag_args['payment_id'])) { |
|
1542 | + $form_id = give_get_payment_form_id($tag_args['payment_id']); |
|
1543 | 1543 | } |
1544 | 1544 | |
1545 | - $meta_data = give_get_meta( $form_id, $meta_name, true, '' ); |
|
1546 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1545 | + $meta_data = give_get_meta($form_id, $meta_name, true, ''); |
|
1546 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1547 | 1547 | $replace[] = $meta_data; |
1548 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1549 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1548 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1549 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1550 | 1550 | } |
1551 | 1551 | break; |
1552 | 1552 | |
1553 | 1553 | case 'donor': |
1554 | - $donor_id = isset( $tag_args['donor_id'] ) ? absint( $tag_args['donor_id'] ) : 0; |
|
1554 | + $donor_id = isset($tag_args['donor_id']) ? absint($tag_args['donor_id']) : 0; |
|
1555 | 1555 | |
1556 | 1556 | // Bailout. |
1557 | - if ( ! $donor_id ) { |
|
1558 | - if ( isset( $tag_args['payment_id'] ) ) { |
|
1559 | - $donor_id = give_get_payment_donor_id( $tag_args['payment_id'] ); |
|
1560 | - } elseif ( isset( $tag_args['user_id'] ) ) { |
|
1561 | - $donor_id = Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ); |
|
1557 | + if ( ! $donor_id) { |
|
1558 | + if (isset($tag_args['payment_id'])) { |
|
1559 | + $donor_id = give_get_payment_donor_id($tag_args['payment_id']); |
|
1560 | + } elseif (isset($tag_args['user_id'])) { |
|
1561 | + $donor_id = Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']); |
|
1562 | 1562 | } |
1563 | 1563 | } |
1564 | 1564 | |
1565 | - $meta_data = Give()->donor_meta->get_meta( $donor_id, $meta_name, true ); |
|
1565 | + $meta_data = Give()->donor_meta->get_meta($donor_id, $meta_name, true); |
|
1566 | 1566 | |
1567 | - if( empty( $meta_data ) && in_array( $meta_name, array_keys( Give()->donors->get_columns() ) ) ) { |
|
1568 | - $meta_data = Give()->donors->get_column_by( $meta_name, 'id', $donor_id ); |
|
1567 | + if (empty($meta_data) && in_array($meta_name, array_keys(Give()->donors->get_columns()))) { |
|
1568 | + $meta_data = Give()->donors->get_column_by($meta_name, 'id', $donor_id); |
|
1569 | 1569 | } |
1570 | 1570 | |
1571 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1571 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1572 | 1572 | $replace[] = $meta_data; |
1573 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1574 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1573 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1574 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1575 | 1575 | } |
1576 | 1576 | |
1577 | 1577 | break; |
1578 | 1578 | |
1579 | 1579 | default: |
1580 | - $replace[] = end( $search ); |
|
1580 | + $replace[] = end($search); |
|
1581 | 1581 | } |
1582 | 1582 | } |
1583 | 1583 | |
1584 | - if ( ! empty( $search ) && ! empty( $replace ) ) { |
|
1585 | - $content = str_replace( $search, $replace, $content ); |
|
1584 | + if ( ! empty($search) && ! empty($replace)) { |
|
1585 | + $content = str_replace($search, $replace, $content); |
|
1586 | 1586 | } |
1587 | 1587 | } |
1588 | 1588 | |
@@ -1590,4 +1590,4 @@ discard block |
||
1590 | 1590 | return $content; |
1591 | 1591 | } |
1592 | 1592 | |
1593 | -add_filter( 'give_email_template_tags', '__give_render_metadata_email_tag', 10, 2 ); |
|
1593 | +add_filter('give_email_template_tags', '__give_render_metadata_email_tag', 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 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @since 1.0 |
21 | 21 | */ |
22 | -class Give_Forms_Widget extends WP_Widget{ |
|
22 | +class Give_Forms_Widget extends WP_Widget { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * The widget class name |
@@ -31,19 +31,19 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * Instantiate the class |
33 | 33 | */ |
34 | - public function __construct(){ |
|
35 | - $this->self = get_class( $this ); |
|
34 | + public function __construct() { |
|
35 | + $this->self = get_class($this); |
|
36 | 36 | |
37 | 37 | parent::__construct( |
38 | - strtolower( $this->self ), |
|
39 | - esc_html__( 'Give - Donation Form', 'give' ), |
|
38 | + strtolower($this->self), |
|
39 | + esc_html__('Give - Donation Form', 'give'), |
|
40 | 40 | array( |
41 | - 'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ) |
|
41 | + 'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give') |
|
42 | 42 | ) |
43 | 43 | ); |
44 | 44 | |
45 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
46 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) ); |
|
45 | + add_action('widgets_init', array($this, 'widget_init')); |
|
46 | + add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -53,19 +53,19 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return void |
55 | 55 | */ |
56 | - public function admin_widget_scripts( $hook ){ |
|
56 | + public function admin_widget_scripts($hook) { |
|
57 | 57 | // Directories of assets |
58 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
59 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
60 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
58 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
59 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
60 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
61 | 61 | |
62 | 62 | // Use minified libraries if SCRIPT_DEBUG is turned off |
63 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
63 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
64 | 64 | |
65 | 65 | // Widget Script |
66 | - if ( 'widgets.php' === $hook ) { |
|
66 | + if ('widgets.php' === $hook) { |
|
67 | 67 | |
68 | - wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
68 | + wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | * before_widget, and after_widget. |
77 | 77 | * @param array $instance The settings for the particular instance of the widget. |
78 | 78 | */ |
79 | - public function widget( $args, $instance ){ |
|
80 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
81 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
79 | + public function widget($args, $instance) { |
|
80 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
81 | + $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
|
82 | 82 | |
83 | 83 | echo $args['before_widget']; |
84 | 84 | |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @since 1.0 |
89 | 89 | */ |
90 | - do_action( 'give_before_forms_widget' ); |
|
90 | + do_action('give_before_forms_widget'); |
|
91 | 91 | |
92 | - echo $title ? $args['before_title'] . $title . $args['after_title'] : ''; |
|
92 | + echo $title ? $args['before_title'].$title.$args['after_title'] : ''; |
|
93 | 93 | |
94 | - give_get_donation_form( $instance ); |
|
94 | + give_get_donation_form($instance); |
|
95 | 95 | |
96 | 96 | echo $args['after_widget']; |
97 | 97 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @since 1.0 |
102 | 102 | */ |
103 | - do_action( 'give_after_forms_widget' ); |
|
103 | + do_action('give_after_forms_widget'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string |
112 | 112 | */ |
113 | - public function form( $instance ){ |
|
113 | + public function form($instance) { |
|
114 | 114 | $defaults = array( |
115 | 115 | 'title' => '', |
116 | 116 | 'id' => '', |
@@ -120,84 +120,84 @@ discard block |
||
120 | 120 | 'continue_button_title' => '', |
121 | 121 | ); |
122 | 122 | |
123 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
123 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
124 | 124 | |
125 | 125 | // Backward compatibility: Set float labels as default if, it was set as empty previous. |
126 | - $instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels']; |
|
126 | + $instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels']; |
|
127 | 127 | |
128 | 128 | // Query Give Forms |
129 | 129 | $args = array( |
130 | 130 | 'post_type' => 'give_forms', |
131 | - 'posts_per_page' => - 1, |
|
131 | + 'posts_per_page' => -1, |
|
132 | 132 | 'post_status' => 'publish', |
133 | 133 | ); |
134 | 134 | |
135 | - $give_forms = get_posts( $args ); |
|
135 | + $give_forms = get_posts($args); |
|
136 | 136 | ?> |
137 | 137 | <div class="give_forms_widget_container"> |
138 | 138 | |
139 | 139 | <?php // Widget: widget Title. ?> |
140 | 140 | <p> |
141 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label> |
|
142 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br> |
|
143 | - <small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small> |
|
141 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label> |
|
142 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br> |
|
143 | + <small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small> |
|
144 | 144 | </p> |
145 | 145 | |
146 | 146 | <?php // Widget: Give Form?> |
147 | 147 | <p> |
148 | - <label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label> |
|
149 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"> |
|
150 | - <option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option> |
|
151 | - <?php foreach ( $give_forms as $give_form ) { ?> |
|
152 | - <?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?> |
|
153 | - <option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $form_title; ?></option> |
|
148 | + <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label> |
|
149 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>"> |
|
150 | + <option value="current"><?php esc_html_e('- Select -', 'give'); ?></option> |
|
151 | + <?php foreach ($give_forms as $give_form) { ?> |
|
152 | + <?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?> |
|
153 | + <option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $form_title; ?></option> |
|
154 | 154 | <?php } ?> |
155 | 155 | </select><br> |
156 | - <small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small> |
|
156 | + <small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small> |
|
157 | 157 | </p> |
158 | 158 | |
159 | 159 | <?php // Widget: Display Style ?> |
160 | 160 | <p class="give_forms_display_style_setting_row"> |
161 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br> |
|
162 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label> |
|
163 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label> |
|
164 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label> |
|
165 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-button" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br> |
|
161 | + <label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br> |
|
162 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label> |
|
163 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label> |
|
164 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label> |
|
165 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-button" name="<?php echo $this->get_field_name('display_style'); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br> |
|
166 | 166 | <small class="give-field-description"> |
167 | - <?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?> |
|
167 | + <?php echo esc_html__('Select a Give Form style.', 'give'); ?> |
|
168 | 168 | </small> |
169 | 169 | </p> |
170 | 170 | |
171 | 171 | <?php // Widget: Continue Button Title. ?> |
172 | 172 | <p class="give_forms_continue_button_title_setting_row"> |
173 | - <label for="<?php echo $this->get_field_id( 'continue_button_title' ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label> |
|
174 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'continue_button_title' ); ?>" name="<?php echo $this->get_field_name( 'continue_button_title' ); ?>" value="<?php esc_attr_e( $instance['continue_button_title'] ); ?>" /><br> |
|
175 | - <small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small> |
|
173 | + <label for="<?php echo $this->get_field_id('continue_button_title'); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label> |
|
174 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('continue_button_title'); ?>" name="<?php echo $this->get_field_name('continue_button_title'); ?>" value="<?php esc_attr_e($instance['continue_button_title']); ?>" /><br> |
|
175 | + <small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small> |
|
176 | 176 | </p> |
177 | 177 | |
178 | 178 | <?php // Widget: Floating Labels ?> |
179 | 179 | <p> |
180 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br> |
|
181 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label> |
|
182 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label> |
|
183 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br> |
|
180 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br> |
|
181 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label> |
|
182 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label> |
|
183 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br> |
|
184 | 184 | <small class="give-field-description"> |
185 | 185 | <?php |
186 | 186 | printf( |
187 | 187 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
188 | - __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), |
|
189 | - esc_url( 'http://docs.givewp.com/form-floating-labels' ) |
|
188 | + __('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), |
|
189 | + esc_url('http://docs.givewp.com/form-floating-labels') |
|
190 | 190 | ); |
191 | 191 | ?></small> |
192 | 192 | </p> |
193 | 193 | |
194 | 194 | <?php // Widget: Display Content ?> |
195 | 195 | <p> |
196 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br> |
|
197 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-none" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label> |
|
198 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-above" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label> |
|
199 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-below" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br> |
|
200 | - <small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small> |
|
196 | + <label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br> |
|
197 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-none" name="<?php echo $this->get_field_name('show_content'); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label> |
|
198 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-above" name="<?php echo $this->get_field_name('show_content'); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label> |
|
199 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-below" name="<?php echo $this->get_field_name('show_content'); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br> |
|
200 | + <small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small> |
|
201 | 201 | </div> |
202 | 202 | <?php |
203 | 203 | } |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return void |
209 | 209 | */ |
210 | - function widget_init(){ |
|
211 | - register_widget( $this->self ); |
|
210 | + function widget_init() { |
|
211 | + register_widget($this->self); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * |
220 | 220 | * @return array |
221 | 221 | */ |
222 | - public function update( $new_instance, $old_instance ){ |
|
222 | + public function update($new_instance, $old_instance) { |
|
223 | 223 | $this->flush_widget_cache(); |
224 | 224 | |
225 | 225 | return $new_instance; |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @return void |
232 | 232 | */ |
233 | - public function flush_widget_cache(){ |
|
234 | - wp_cache_delete( $this->self, 'widget' ); |
|
233 | + public function flush_widget_cache() { |
|
234 | + wp_cache_delete($this->self, 'widget'); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 |
@@ -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 | |
@@ -26,34 +26,34 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_set_settings_with_disable_prefix( $old_settings, $settings ) { |
|
29 | +function give_set_settings_with_disable_prefix($old_settings, $settings) { |
|
30 | 30 | // Bailout. |
31 | - if ( ! function_exists( 'give_v18_renamed_core_settings' ) ) { |
|
31 | + if ( ! function_exists('give_v18_renamed_core_settings')) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | 35 | // Get old setting names. |
36 | - $old_settings = array_flip( give_v18_renamed_core_settings() ); |
|
36 | + $old_settings = array_flip(give_v18_renamed_core_settings()); |
|
37 | 37 | $update_setting = false; |
38 | 38 | |
39 | - foreach ( $settings as $key => $value ) { |
|
39 | + foreach ($settings as $key => $value) { |
|
40 | 40 | |
41 | 41 | // Check 1. Check if new option is really updated or not. |
42 | 42 | // Check 2. Continue if key is not renamed. |
43 | - if ( ! isset( $old_settings[ $key ] ) ) { |
|
43 | + if ( ! isset($old_settings[$key])) { |
|
44 | 44 | continue; |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set old setting. |
48 | - $settings[ $old_settings[ $key ] ] = 'on'; |
|
48 | + $settings[$old_settings[$key]] = 'on'; |
|
49 | 49 | |
50 | 50 | // Do not need to set old setting if new setting is not set. |
51 | 51 | if ( |
52 | - ( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) ) |
|
53 | - || ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) ) |
|
52 | + (give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_'))) |
|
53 | + || ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_'))) |
|
54 | 54 | |
55 | 55 | ) { |
56 | - unset( $settings[ $old_settings[ $key ] ] ); |
|
56 | + unset($settings[$old_settings[$key]]); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Tell bot to update setting. |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update setting if any old setting set. |
64 | - if ( $update_setting ) { |
|
65 | - update_option( 'give_settings', $settings, false ); |
|
64 | + if ($update_setting) { |
|
65 | + update_option('give_settings', $settings, false); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 ); |
|
69 | +add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Check spam through Akismet. |
@@ -80,45 +80,45 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return bool|mixed |
82 | 82 | */ |
83 | -function give_akismet( $spam ) { |
|
83 | +function give_akismet($spam) { |
|
84 | 84 | |
85 | 85 | // Bail out, If spam. |
86 | - if ( $spam ) { |
|
86 | + if ($spam) { |
|
87 | 87 | return $spam; |
88 | 88 | } |
89 | 89 | |
90 | 90 | // Bail out, if Akismet key not exist. |
91 | - if ( ! give_check_akismet_key() ) { |
|
91 | + if ( ! give_check_akismet_key()) { |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // Build args array. |
96 | 96 | $args = array(); |
97 | 97 | |
98 | - $args['comment_author'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : ''; |
|
99 | - $args['comment_author_email'] = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false; |
|
100 | - $args['blog'] = get_option( 'home' ); |
|
98 | + $args['comment_author'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : ''; |
|
99 | + $args['comment_author_email'] = isset($_POST['give_email']) ? $_POST['give_email'] : false; |
|
100 | + $args['blog'] = get_option('home'); |
|
101 | 101 | $args['blog_lang'] = get_locale(); |
102 | - $args['blog_charset'] = get_option( 'blog_charset' ); |
|
102 | + $args['blog_charset'] = get_option('blog_charset'); |
|
103 | 103 | $args['user_ip'] = $_SERVER['REMOTE_ADDR']; |
104 | 104 | $args['user_agent'] = $_SERVER['HTTP_USER_AGENT']; |
105 | 105 | $args['referrer'] = $_SERVER['HTTP_REFERER']; |
106 | 106 | $args['comment_type'] = 'contact-form'; |
107 | 107 | |
108 | - $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ); |
|
108 | + $ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'); |
|
109 | 109 | |
110 | - foreach ( $_SERVER as $key => $value ) { |
|
111 | - if ( ! in_array( $key, (array) $ignore ) ) { |
|
110 | + foreach ($_SERVER as $key => $value) { |
|
111 | + if ( ! in_array($key, (array) $ignore)) { |
|
112 | 112 | $args["$key"] = $value; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | // It will return Akismet spam detect API response. |
117 | - return give_akismet_spam_check( $args ); |
|
117 | + return give_akismet_spam_check($args); |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
121 | -add_filter( 'give_spam', 'give_akismet' ); |
|
121 | +add_filter('give_spam', 'give_akismet'); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Check Akismet API Key. |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | * @return bool |
129 | 129 | */ |
130 | 130 | function give_check_akismet_key() { |
131 | - if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { // Akismet v3.0+ |
|
131 | + if (is_callable(array('Akismet', 'get_api_key'))) { // Akismet v3.0+ |
|
132 | 132 | return (bool) Akismet::get_api_key(); |
133 | 133 | } |
134 | 134 | |
135 | - if ( function_exists( 'akismet_get_key' ) ) { |
|
135 | + if (function_exists('akismet_get_key')) { |
|
136 | 136 | return (bool) akismet_get_key(); |
137 | 137 | } |
138 | 138 | |
@@ -148,26 +148,26 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return bool|mixed |
150 | 150 | */ |
151 | -function give_akismet_spam_check( $args ) { |
|
151 | +function give_akismet_spam_check($args) { |
|
152 | 152 | global $akismet_api_host, $akismet_api_port; |
153 | 153 | |
154 | 154 | $spam = false; |
155 | - $query_string = http_build_query( $args ); |
|
155 | + $query_string = http_build_query($args); |
|
156 | 156 | |
157 | - if ( is_callable( array( 'Akismet', 'http_post' ) ) ) { // Akismet v3.0+ |
|
158 | - $response = Akismet::http_post( $query_string, 'comment-check' ); |
|
157 | + if (is_callable(array('Akismet', 'http_post'))) { // Akismet v3.0+ |
|
158 | + $response = Akismet::http_post($query_string, 'comment-check'); |
|
159 | 159 | } else { |
160 | - $response = akismet_http_post( $query_string, $akismet_api_host, |
|
161 | - '/1.1/comment-check', $akismet_api_port ); |
|
160 | + $response = akismet_http_post($query_string, $akismet_api_host, |
|
161 | + '/1.1/comment-check', $akismet_api_port); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // It's spam if response status is true. |
165 | - if ( 'true' === $response[1] ) { |
|
165 | + if ('true' === $response[1]) { |
|
166 | 166 | $spam = true; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Allow developer to modified Akismet spam detection response. |
170 | - return apply_filters( 'give_akismet_spam_check', $spam, $args ); |
|
170 | + return apply_filters('give_akismet_spam_check', $spam, $args); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,15 +180,15 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return array |
182 | 182 | */ |
183 | -function give_bc_v1817_iranian_currency_code( $currencies ) { |
|
184 | - if ( ! give_has_upgrade_completed( 'v1817_update_donation_iranian_currency_code' ) ) { |
|
183 | +function give_bc_v1817_iranian_currency_code($currencies) { |
|
184 | + if ( ! give_has_upgrade_completed('v1817_update_donation_iranian_currency_code')) { |
|
185 | 185 | $currencies['RIAL'] = $currencies['IRR']; |
186 | 186 | } |
187 | 187 | |
188 | 188 | return $currencies; |
189 | 189 | } |
190 | 190 | |
191 | -add_filter( 'give_currencies', 'give_bc_v1817_iranian_currency_code', 0 ); |
|
191 | +add_filter('give_currencies', 'give_bc_v1817_iranian_currency_code', 0); |
|
192 | 192 | |
193 | 193 | |
194 | 194 | /** |
@@ -202,25 +202,23 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return string |
204 | 204 | */ |
205 | -function give_format_price_for_right_to_left_supported_currency( $formatted_amount, $currency_args, $price ) { |
|
206 | - if ( ! give_is_right_to_left_supported_currency( $currency_args['currency_code'] ) ) { |
|
205 | +function give_format_price_for_right_to_left_supported_currency($formatted_amount, $currency_args, $price) { |
|
206 | + if ( ! give_is_right_to_left_supported_currency($currency_args['currency_code'])) { |
|
207 | 207 | return $formatted_amount; |
208 | 208 | } |
209 | 209 | |
210 | 210 | $formatted_amount = ( |
211 | 211 | 'before' === (string) $currency_args['position'] ? |
212 | - '‫' . $price . $currency_args['symbol'] . '‬' : |
|
213 | - '‪' . $price . $currency_args['symbol'] . '‬' |
|
212 | + '‫'.$price.$currency_args['symbol'].'‬' : '‪'.$price.$currency_args['symbol'].'‬' |
|
214 | 213 | ); |
215 | 214 | |
216 | 215 | $formatted_amount = $currency_args['decode_currency'] ? |
217 | - html_entity_decode( $formatted_amount, ENT_COMPAT, 'UTF-8' ) : |
|
218 | - $formatted_amount; |
|
216 | + html_entity_decode($formatted_amount, ENT_COMPAT, 'UTF-8') : $formatted_amount; |
|
219 | 217 | |
220 | 218 | return $formatted_amount; |
221 | 219 | } |
222 | 220 | |
223 | -add_filter( 'give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3 ); |
|
221 | +add_filter('give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3); |
|
224 | 222 | |
225 | 223 | /** |
226 | 224 | * Validate active gateway value before returning result. |
@@ -231,31 +229,31 @@ discard block |
||
231 | 229 | * |
232 | 230 | * @return array |
233 | 231 | */ |
234 | -function __give_validate_active_gateways( $value ) { |
|
235 | - $gateways = array_keys( give_get_payment_gateways() ); |
|
236 | - $active_gateways = is_array( $value ) ? array_keys( $value ) : array(); |
|
232 | +function __give_validate_active_gateways($value) { |
|
233 | + $gateways = array_keys(give_get_payment_gateways()); |
|
234 | + $active_gateways = is_array($value) ? array_keys($value) : array(); |
|
237 | 235 | |
238 | 236 | // Remove deactivated payment gateways. |
239 | - if( ! empty( $active_gateways ) ) { |
|
240 | - foreach ( $active_gateways as $index => $gateway_id ) { |
|
241 | - if( ! in_array( $gateway_id, $gateways ) ) { |
|
242 | - unset( $value[$gateway_id] ); |
|
237 | + if ( ! empty($active_gateways)) { |
|
238 | + foreach ($active_gateways as $index => $gateway_id) { |
|
239 | + if ( ! in_array($gateway_id, $gateways)) { |
|
240 | + unset($value[$gateway_id]); |
|
243 | 241 | } |
244 | 242 | } |
245 | 243 | } |
246 | 244 | |
247 | - if ( empty( $value ) ) { |
|
245 | + if (empty($value)) { |
|
248 | 246 | /** |
249 | 247 | * Filter the default active gateway |
250 | 248 | * |
251 | 249 | * @since 2.1.0 |
252 | 250 | */ |
253 | - $value = apply_filters( 'give_default_active_gateways', array( |
|
251 | + $value = apply_filters('give_default_active_gateways', array( |
|
254 | 252 | 'manual' => 1, |
255 | - ) ); |
|
253 | + )); |
|
256 | 254 | } |
257 | 255 | |
258 | 256 | return $value; |
259 | 257 | } |
260 | 258 | |
261 | -add_filter( 'give_get_option_gateways', '__give_validate_active_gateways', 10, 1 ); |
|
259 | +add_filter('give_get_option_gateways', '__give_validate_active_gateways', 10, 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 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param $data |
23 | 23 | */ |
24 | -function give_process_gateway_select( $data ) { |
|
25 | - if ( isset( $_POST['gateway_submit'] ) ) { |
|
26 | - wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) ); |
|
24 | +function give_process_gateway_select($data) { |
|
25 | + if (isset($_POST['gateway_submit'])) { |
|
26 | + wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode']))); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -add_action( 'give_gateway_select', 'give_process_gateway_select' ); |
|
31 | +add_action('give_gateway_select', 'give_process_gateway_select'); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Loads a payment gateway via AJAX. |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function give_load_ajax_gateway() { |
41 | 41 | |
42 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, CSRF ok. |
|
42 | + $post_data = give_clean($_POST); // WPCS: input var ok, CSRF ok. |
|
43 | 43 | |
44 | - if ( isset( $post_data['give_payment_mode'] ) ) { |
|
44 | + if (isset($post_data['give_payment_mode'])) { |
|
45 | 45 | |
46 | - $form_id_prefix = ! empty( $post_data['give_form_id_prefix'] ) ? $post_data['give_form_id_prefix'] : ''; |
|
46 | + $form_id_prefix = ! empty($post_data['give_form_id_prefix']) ? $post_data['give_form_id_prefix'] : ''; |
|
47 | 47 | |
48 | 48 | $args = array( |
49 | 49 | 'id_prefix' => $form_id_prefix, |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @since 1.7 |
56 | 56 | */ |
57 | - do_action( 'give_donation_form', $post_data['give_form_id'], $args ); |
|
57 | + do_action('give_donation_form', $post_data['give_form_id'], $args); |
|
58 | 58 | |
59 | 59 | exit(); |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | -add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' ); |
|
64 | -add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' ); |
|
63 | +add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway'); |
|
64 | +add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway'); |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Create wp nonce using Ajax call. |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | * @return void |
74 | 74 | */ |
75 | 75 | function give_donation_form_nonce() { |
76 | - if ( isset( $_POST['give_form_id'] ) ) { |
|
76 | + if (isset($_POST['give_form_id'])) { |
|
77 | 77 | |
78 | 78 | // Get donation form id. |
79 | - $form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0; |
|
79 | + $form_id = is_numeric($_POST['give_form_id']) ? absint($_POST['give_form_id']) : 0; |
|
80 | 80 | |
81 | 81 | // Send nonce json data. |
82 | - wp_send_json_success( wp_create_nonce( "give_donation_form_nonce_{$form_id}" ) ); |
|
82 | + wp_send_json_success(wp_create_nonce("give_donation_form_nonce_{$form_id}")); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | -add_action( 'wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce' ); |
|
87 | -add_action( 'wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce' ); |
|
86 | +add_action('wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce'); |
|
87 | +add_action('wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce'); |
|
88 | 88 | |
89 | 89 | |
90 | 90 | /** |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | * @return void |
97 | 97 | */ |
98 | 98 | function __give_donation_form_reset_all_nonce() { |
99 | - if ( isset( $_POST['give_form_id'] ) ) { |
|
99 | + if (isset($_POST['give_form_id'])) { |
|
100 | 100 | |
101 | 101 | // Get donation form id. |
102 | - $form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0; |
|
102 | + $form_id = is_numeric($_POST['give_form_id']) ? absint($_POST['give_form_id']) : 0; |
|
103 | 103 | |
104 | 104 | $data = array( |
105 | - 'give_form_hash' => wp_create_nonce( "give_donation_form_nonce_{$form_id}" ), |
|
106 | - 'give_form_user_register_hash' => wp_create_nonce( "give_form_create_user_nonce_{$form_id}" ) |
|
105 | + 'give_form_hash' => wp_create_nonce("give_donation_form_nonce_{$form_id}"), |
|
106 | + 'give_form_user_register_hash' => wp_create_nonce("give_form_create_user_nonce_{$form_id}") |
|
107 | 107 | ); |
108 | 108 | |
109 | 109 | /** |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | * @since 2.2.0 |
113 | 113 | * |
114 | 114 | */ |
115 | - $data = apply_filters( 'give_donation_form_reset_all_nonce_data', $data ); |
|
115 | + $data = apply_filters('give_donation_form_reset_all_nonce_data', $data); |
|
116 | 116 | |
117 | 117 | // Send nonce json data. |
118 | - wp_send_json_success( $data ); |
|
118 | + wp_send_json_success($data); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | -add_action( 'wp_ajax_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce' ); |
|
123 | -add_action( 'wp_ajax_nopriv_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce' ); |
|
122 | +add_action('wp_ajax_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce'); |
|
123 | +add_action('wp_ajax_nopriv_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce'); |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Sets an error within the donation form if no gateways are enabled. |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | function give_no_gateway_error() { |
134 | 134 | $gateways = give_get_enabled_payment_gateways(); |
135 | 135 | |
136 | - if ( empty( $gateways ) ) { |
|
137 | - give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) ); |
|
136 | + if (empty($gateways)) { |
|
137 | + give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give')); |
|
138 | 138 | } else { |
139 | - give_unset_error( 'no_gateways' ); |
|
139 | + give_unset_error('no_gateways'); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | -add_action( 'init', 'give_no_gateway_error' ); |
|
143 | +add_action('init', 'give_no_gateway_error'); |
@@ -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 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | // Set cache group id. |
55 | 55 | $current_blog_id = get_current_blog_id(); |
56 | 56 | $this->incrementer_name = "give-cache-incrementer-sessions-{$current_blog_id}"; |
57 | - $incrementer_value = wp_cache_get( $this->incrementer_name ); |
|
58 | - $incrementer_value = ! empty( $incrementer_value ) ? $incrementer_value : microtime( true ); |
|
57 | + $incrementer_value = wp_cache_get($this->incrementer_name); |
|
58 | + $incrementer_value = ! empty($incrementer_value) ? $incrementer_value : microtime(true); |
|
59 | 59 | $this->cache_group = "{$this->cache_group}_{$current_blog_id}_{$incrementer_value}"; |
60 | 60 | |
61 | 61 | $this->register_table(); |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | UNIQUE KEY session_id (session_id) |
102 | 102 | ) {$charset_collate};"; |
103 | 103 | |
104 | - require_once ABSPATH . 'wp-admin/includes/upgrade.php'; |
|
105 | - dbDelta( $sql ); |
|
104 | + require_once ABSPATH.'wp-admin/includes/upgrade.php'; |
|
105 | + dbDelta($sql); |
|
106 | 106 | |
107 | - update_option( $this->table_name . '_db_version', $this->version, false ); |
|
107 | + update_option($this->table_name.'_db_version', $this->version, false); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @return mixed |
120 | 120 | */ |
121 | - public function get_session( $donor_id, $default = false ) { |
|
121 | + public function get_session($donor_id, $default = false) { |
|
122 | 122 | global $wpdb; |
123 | 123 | |
124 | - if ( defined( 'WP_SETUP_CONFIG' ) ) { |
|
124 | + if (defined('WP_SETUP_CONFIG')) { |
|
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | |
128 | - if ( ! ( $value = wp_cache_get( $donor_id, $this->cache_group ) ) ) { // @codingStandardsIgnoreLine |
|
128 | + if ( ! ($value = wp_cache_get($donor_id, $this->cache_group))) { // @codingStandardsIgnoreLine |
|
129 | 129 | |
130 | 130 | // @codingStandardsIgnoreStart |
131 | 131 | $value = $wpdb->get_var( |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | ); |
141 | 141 | // @codingStandardsIgnoreEnd |
142 | 142 | |
143 | - if ( is_null( $value ) ) { |
|
143 | + if (is_null($value)) { |
|
144 | 144 | $value = $default; |
145 | 145 | } |
146 | 146 | |
147 | - wp_cache_add( $donor_id, $value, $this->cache_group ); |
|
147 | + wp_cache_add($donor_id, $value, $this->cache_group); |
|
148 | 148 | } |
149 | 149 | |
150 | - return maybe_unserialize( $value ); |
|
150 | + return maybe_unserialize($value); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @param string $donor_id Donor ID. |
157 | 157 | * @param int $timestamp Timestamp to expire the cookie. |
158 | 158 | */ |
159 | - public function update_session_timestamp( $donor_id, $timestamp ) { |
|
159 | + public function update_session_timestamp($donor_id, $timestamp) { |
|
160 | 160 | global $wpdb; |
161 | 161 | |
162 | 162 | // @codingStandardsIgnoreStart. |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @param int $donor_id Customer ID. |
185 | 185 | */ |
186 | - public function delete_session( $donor_id ) { |
|
186 | + public function delete_session($donor_id) { |
|
187 | 187 | global $wpdb; |
188 | 188 | |
189 | - wp_cache_delete( $donor_id, $this->cache_group ); |
|
189 | + wp_cache_delete($donor_id, $this->cache_group); |
|
190 | 190 | |
191 | 191 | // @codingStandardsIgnoreStart |
192 | 192 | $wpdb->delete( |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | public function delete_expired_sessions() { |
210 | 210 | global $wpdb; |
211 | 211 | |
212 | - wp_cache_set( $this->incrementer_name, microtime( true ) ); |
|
212 | + wp_cache_set($this->incrementer_name, microtime(true)); |
|
213 | 213 | |
214 | 214 | // @codingStandardsIgnoreStart |
215 | 215 | $wpdb->query( |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | * @param array $data Data. |
233 | 233 | * @param array $format Array for data format of each key:value in data. |
234 | 234 | */ |
235 | - public function __replace( $table_name, $data, $format = null ) { |
|
235 | + public function __replace($table_name, $data, $format = null) { |
|
236 | 236 | global $wpdb; |
237 | 237 | |
238 | - wp_cache_set( $data['session_key'], $data['session_value'], $this->cache_group, $data['session_expiry'] - time() ); |
|
238 | + wp_cache_set($data['session_key'], $data['session_value'], $this->cache_group, $data['session_expiry'] - time()); |
|
239 | 239 | |
240 | 240 | |
241 | 241 | // @codingStandardsIgnoreStart |
@@ -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,117 +212,117 @@ 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 | - 'close' => __( 'Close', 'give' ), |
|
234 | - 'confirm' => __( 'Confirm', 'give' ), |
|
235 | - 'confirm_action' => __( 'Confirm Action', 'give' ), |
|
236 | - 'confirm_deletion' => __( 'Confirm Deletion', 'give' ), |
|
237 | - 'confirm_delete_donation' => __( 'Confirm Delete Donation', 'give' ), |
|
238 | - 'confirm_resend' => __( 'Confirm re-send', 'give' ), |
|
239 | - 'confirm_bulk_action' => __( 'Confirm bulk action', 'give' ), |
|
240 | - 'restart_upgrade' => __( 'Do you want to restart the update process?', 'give' ), |
|
241 | - 'restart_update' => __( 'It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ), |
|
242 | - 'stop_upgrade' => __( 'Do you want to stop the update process now?', 'give' ), |
|
243 | - 'import_failed' => __( 'Import failed', 'give' ), |
|
244 | - 'flush_success' => __( 'Flush success', 'give' ), |
|
245 | - 'flush_error' => __( 'Flush error', 'give' ), |
|
246 | - 'no_form_selected' => __( 'No form selected', 'give' ), |
|
247 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
248 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
249 | - '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' ), |
|
250 | - 'delete_test_donor' => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ), |
|
251 | - 'delete_import_donor' => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ), |
|
252 | - '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 | + 'close' => __('Close', 'give'), |
|
234 | + 'confirm' => __('Confirm', 'give'), |
|
235 | + 'confirm_action' => __('Confirm Action', 'give'), |
|
236 | + 'confirm_deletion' => __('Confirm Deletion', 'give'), |
|
237 | + 'confirm_delete_donation' => __('Confirm Delete Donation', 'give'), |
|
238 | + 'confirm_resend' => __('Confirm re-send', 'give'), |
|
239 | + 'confirm_bulk_action' => __('Confirm bulk action', 'give'), |
|
240 | + 'restart_upgrade' => __('Do you want to restart the update process?', 'give'), |
|
241 | + 'restart_update' => __('It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give'), |
|
242 | + 'stop_upgrade' => __('Do you want to stop the update process now?', 'give'), |
|
243 | + 'import_failed' => __('Import failed', 'give'), |
|
244 | + 'flush_success' => __('Flush success', 'give'), |
|
245 | + 'flush_error' => __('Flush error', 'give'), |
|
246 | + 'no_form_selected' => __('No form selected', 'give'), |
|
247 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
248 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
249 | + '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'), |
|
250 | + 'delete_test_donor' => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'), |
|
251 | + 'delete_import_donor' => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'), |
|
252 | + 'price_format_guide' => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator), |
|
253 | 253 | /* translators : %s: Donation form options metabox */ |
254 | - 'confirm_before_remove_row_text' => __( 'Do you want to delete this item?', 'give' ), |
|
255 | - 'matched_success_failure_page' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
256 | - 'dismiss_notice_text' => __( 'Dismiss this notice.', 'give' ), |
|
257 | - 'search_placeholder' => __( 'Type to search all forms', 'give' ), |
|
258 | - 'search_placeholder_donor' => __( 'Type to search all donors', 'give' ), |
|
259 | - 'search_placeholder_country' => __( 'Type to search all countries', 'give' ), |
|
260 | - 'search_placeholder_state' => __( 'Type to search all states/provinces', 'give' ), |
|
261 | - 'unlock_donor_fields_title' => __( 'Action forbidden', 'give' ), |
|
262 | - 'unlock_donor_fields_message' => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ), |
|
263 | - 'remove_from_bulk_delete' => __( 'Remove from Bulk Delete', 'give' ), |
|
254 | + 'confirm_before_remove_row_text' => __('Do you want to delete this item?', 'give'), |
|
255 | + 'matched_success_failure_page' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
256 | + 'dismiss_notice_text' => __('Dismiss this notice.', 'give'), |
|
257 | + 'search_placeholder' => __('Type to search all forms', 'give'), |
|
258 | + 'search_placeholder_donor' => __('Type to search all donors', 'give'), |
|
259 | + 'search_placeholder_country' => __('Type to search all countries', 'give'), |
|
260 | + 'search_placeholder_state' => __('Type to search all states/provinces', 'give'), |
|
261 | + 'unlock_donor_fields_title' => __('Action forbidden', 'give'), |
|
262 | + 'unlock_donor_fields_message' => __('To edit first name and last name, please go to user profile of the donor.', 'give'), |
|
263 | + 'remove_from_bulk_delete' => __('Remove from Bulk Delete', 'give'), |
|
264 | 264 | 'donors_bulk_action' => array( |
265 | 265 | 'no_donor_selected' => array( |
266 | - 'title' => __( 'No donors selected', 'give' ), |
|
267 | - 'desc' => __( 'You must choose at least one or more donors to delete.', 'give' ) |
|
266 | + 'title' => __('No donors selected', 'give'), |
|
267 | + 'desc' => __('You must choose at least one or more donors to delete.', 'give') |
|
268 | 268 | ), |
269 | 269 | 'no_action_selected' => array( |
270 | - 'title' => __( 'No action selected', 'give' ), |
|
271 | - 'desc' => __( 'You must select a bulk action to proceed.', 'give' ), |
|
270 | + 'title' => __('No action selected', 'give'), |
|
271 | + 'desc' => __('You must select a bulk action to proceed.', 'give'), |
|
272 | 272 | ), |
273 | 273 | ), |
274 | 274 | 'donations_bulk_action' => array( |
275 | 275 | 'titles' => array( |
276 | - 'zero' => __( 'No payments selected', 'give' ), |
|
276 | + 'zero' => __('No payments selected', 'give'), |
|
277 | 277 | ), |
278 | 278 | 'delete' => array( |
279 | - 'zero' => __( 'You must choose at least one or more donations to delete.', 'give' ), |
|
280 | - 'single' => __( 'Are you sure you want to permanently delete this donation?', 'give' ), |
|
281 | - 'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ), |
|
279 | + 'zero' => __('You must choose at least one or more donations to delete.', 'give'), |
|
280 | + 'single' => __('Are you sure you want to permanently delete this donation?', 'give'), |
|
281 | + 'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'), |
|
282 | 282 | ), |
283 | 283 | 'resend-receipt' => array( |
284 | - 'zero' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ), |
|
285 | - 'single' => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ), |
|
286 | - 'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ), |
|
284 | + 'zero' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'), |
|
285 | + 'single' => __('Are you sure you want to resend the email receipt to this recipient?', 'give'), |
|
286 | + 'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'), |
|
287 | 287 | ), |
288 | 288 | 'set-to-status' => array( |
289 | - 'zero' => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ), |
|
290 | - 'single' => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ), |
|
291 | - 'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ), |
|
289 | + 'zero' => __('You must choose at least one or more donations to set status to {status}.', 'give'), |
|
290 | + 'single' => __('Are you sure you want to set status of this donation to {status}?', 'give'), |
|
291 | + 'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'), |
|
292 | 292 | ), |
293 | 293 | ), |
294 | 294 | 'updates' => array( |
295 | - 'ajax_error' => __( 'Please reload this page and try again', 'give' ), |
|
295 | + 'ajax_error' => __('Please reload this page and try again', 'give'), |
|
296 | 296 | ), |
297 | 297 | 'metabox_fields' => array( |
298 | 298 | 'media' => array( |
299 | - 'button_title' => __( 'Choose Image', 'give' ), |
|
299 | + 'button_title' => __('Choose Image', 'give'), |
|
300 | 300 | ), |
301 | 301 | 'file' => array( |
302 | - 'button_title' => __( 'Choose File', 'give' ), |
|
302 | + 'button_title' => __('Choose File', 'give'), |
|
303 | 303 | ), |
304 | 304 | ), |
305 | 305 | 'chosen' => array( |
306 | - 'no_results_msg' => __( 'No results match {search_term}', 'give' ), |
|
307 | - 'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ), |
|
306 | + 'no_results_msg' => __('No results match {search_term}', 'give'), |
|
307 | + 'ajax_search_msg' => __('Searching results for match {search_term}', 'give'), |
|
308 | 308 | ), |
309 | - 'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ), |
|
310 | - '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' ), |
|
311 | - 'error_message' => __( 'Something went wrong kindly try again!', 'give' ), |
|
309 | + 'db_update_confirmation_msg_button' => __('Run Updates', 'give'), |
|
310 | + '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'), |
|
311 | + 'error_message' => __('Something went wrong kindly try again!', 'give'), |
|
312 | 312 | 'give_donation_import' => 'give_donation_import', |
313 | 313 | 'core_settings_import' => 'give_core_settings_import', |
314 | - 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ), |
|
314 | + 'setting_not_save_message' => __('Changes you made may not be saved.', 'give'), |
|
315 | 315 | 'give_donation_amounts' => array( |
316 | - 'minimum' => apply_filters( 'give_donation_minimum_limit', 1 ), |
|
317 | - 'maximum' => apply_filters( 'give_donation_maximum_limit', 999999.99 ), |
|
316 | + 'minimum' => apply_filters('give_donation_minimum_limit', 1), |
|
317 | + 'maximum' => apply_filters('give_donation_maximum_limit', 999999.99), |
|
318 | 318 | ), |
319 | - 'chosen_add_title_prefix' => __( 'No result found. Press enter to add', 'give' ), |
|
320 | - 'db_update_nonce' => wp_create_nonce( Give_Updates::$background_updater->get_identifier() ), |
|
319 | + 'chosen_add_title_prefix' => __('No result found. Press enter to add', 'give'), |
|
320 | + 'db_update_nonce' => wp_create_nonce(Give_Updates::$background_updater->get_identifier()), |
|
321 | 321 | 'ajax' => give_test_ajax_works(), |
322 | 322 | 'date_format' => give_get_localized_date_format_to_js(), |
323 | 323 | ); |
324 | 324 | |
325 | - wp_localize_script( 'give-admin-scripts', 'give_vars', $localized_data ); |
|
325 | + wp_localize_script('give-admin-scripts', 'give_vars', $localized_data); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | <style type="text/css" media="screen"> |
334 | 334 | @font-face { |
335 | 335 | font-family: 'give-icomoon'; |
336 | - src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?ngjl88'; ?>'); |
|
337 | - src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
338 | - url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
339 | - url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
336 | + src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?ngjl88'; ?>'); |
|
337 | + src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'), |
|
338 | + url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'), |
|
339 | + url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg'); |
|
340 | 340 | font-weight: normal; |
341 | 341 | font-style: normal; |
342 | 342 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @since 2.1.0 |
360 | 360 | */ |
361 | 361 | public function public_enqueue_styles() { |
362 | - wp_enqueue_style( 'give-styles' ); |
|
362 | + wp_enqueue_style('give-styles'); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -371,17 +371,17 @@ discard block |
||
371 | 371 | public function public_enqueue_scripts() { |
372 | 372 | |
373 | 373 | // Call Babel Polyfill with common handle so that it is compatible with plugins and themes. |
374 | - if ( ! wp_script_is( 'babel-polyfill', 'enqueued' ) ) { |
|
374 | + if ( ! wp_script_is('babel-polyfill', 'enqueued')) { |
|
375 | 375 | wp_enqueue_script( |
376 | 376 | 'babel-polyfill', |
377 | - GIVE_PLUGIN_URL . 'assets/dist/js/babel-polyfill.js', |
|
378 | - array( 'jquery' ), |
|
377 | + GIVE_PLUGIN_URL.'assets/dist/js/babel-polyfill.js', |
|
378 | + array('jquery'), |
|
379 | 379 | GIVE_VERSION, |
380 | 380 | false |
381 | 381 | ); |
382 | 382 | } |
383 | 383 | |
384 | - wp_enqueue_script( 'give' ); |
|
384 | + wp_enqueue_script('give'); |
|
385 | 385 | |
386 | 386 | $this->public_localize_scripts(); |
387 | 387 | } |
@@ -400,22 +400,22 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @return string $message Send notice message for email access. |
402 | 402 | */ |
403 | - $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' ) ); |
|
403 | + $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')); |
|
404 | 404 | |
405 | - $localize_give_vars = apply_filters( 'give_global_script_vars', array( |
|
405 | + $localize_give_vars = apply_filters('give_global_script_vars', array( |
|
406 | 406 | 'ajaxurl' => give_get_ajax_url(), |
407 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
407 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
408 | 408 | // Do not use this nonce. Its deprecated. |
409 | 409 | 'currency' => give_get_currency(), |
410 | - 'currency_sign' => give_currency_filter( '' ), |
|
410 | + 'currency_sign' => give_currency_filter(''), |
|
411 | 411 | 'currency_pos' => give_get_currency_position(), |
412 | 412 | 'thousands_separator' => give_get_price_thousand_separator(), |
413 | 413 | 'decimal_separator' => give_get_price_decimal_separator(), |
414 | - 'no_gateway' => __( 'Please select a payment method.', 'give' ), |
|
415 | - 'bad_minimum' => __( 'The minimum custom donation amount for this form is', 'give' ), |
|
416 | - 'bad_maximum' => __( 'The maximum custom donation amount for this form is', 'give' ), |
|
417 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
418 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
414 | + 'no_gateway' => __('Please select a payment method.', 'give'), |
|
415 | + 'bad_minimum' => __('The minimum custom donation amount for this form is', 'give'), |
|
416 | + 'bad_maximum' => __('The maximum custom donation amount for this form is', 'give'), |
|
417 | + 'general_loading' => __('Loading...', 'give'), |
|
418 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
419 | 419 | 'number_decimals' => give_get_price_decimals(), |
420 | 420 | 'give_version' => GIVE_VERSION, |
421 | 421 | 'magnific_options' => apply_filters( |
@@ -429,32 +429,32 @@ discard block |
||
429 | 429 | 'give_form_translation_js', |
430 | 430 | array( |
431 | 431 | // Field name Validation message. |
432 | - 'payment-mode' => __( 'Please select payment mode.', 'give' ), |
|
433 | - 'give_first' => __( 'Please enter your first name.', 'give' ), |
|
434 | - 'give_email' => __( 'Please enter a valid email address.', 'give' ), |
|
435 | - 'give_user_login' => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ), |
|
436 | - 'give_user_pass' => __( 'Enter a password.', 'give' ), |
|
437 | - 'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ), |
|
438 | - 'give_agree_to_terms' => __( 'You must agree to the terms and conditions.', 'give' ), |
|
432 | + 'payment-mode' => __('Please select payment mode.', 'give'), |
|
433 | + 'give_first' => __('Please enter your first name.', 'give'), |
|
434 | + 'give_email' => __('Please enter a valid email address.', 'give'), |
|
435 | + 'give_user_login' => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'), |
|
436 | + 'give_user_pass' => __('Enter a password.', 'give'), |
|
437 | + 'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'), |
|
438 | + 'give_agree_to_terms' => __('You must agree to the terms and conditions.', 'give'), |
|
439 | 439 | ) |
440 | 440 | ), |
441 | 441 | 'confirm_email_sent_message' => $message, |
442 | - 'ajax_vars' => apply_filters( 'give_global_ajax_vars', array( |
|
442 | + 'ajax_vars' => apply_filters('give_global_ajax_vars', array( |
|
443 | 443 | 'ajaxurl' => give_get_ajax_url(), |
444 | - 'ajaxNonce' => wp_create_nonce( 'give_ajax_nonce' ), |
|
445 | - 'loading' => __( 'Loading', 'give' ), |
|
444 | + 'ajaxNonce' => wp_create_nonce('give_ajax_nonce'), |
|
445 | + 'loading' => __('Loading', 'give'), |
|
446 | 446 | // General loading message. |
447 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
447 | + 'select_option' => __('Please select an option', 'give'), |
|
448 | 448 | // Variable pricing error with multi-donation option enabled. |
449 | - 'default_gateway' => give_get_default_gateway( null ), |
|
450 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
449 | + 'default_gateway' => give_get_default_gateway(null), |
|
450 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
451 | 451 | 'number_decimals' => give_get_price_decimals(), |
452 | - ) ), |
|
452 | + )), |
|
453 | 453 | 'cookie_hash' => COOKIEHASH, |
454 | - 'delete_session_nonce_cookie' => absint( Give()->session->is_delete_nonce_cookie() ) |
|
455 | - ) ); |
|
454 | + 'delete_session_nonce_cookie' => absint(Give()->session->is_delete_nonce_cookie()) |
|
455 | + )); |
|
456 | 456 | |
457 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_vars ); |
|
457 | + wp_localize_script('give', 'give_global_vars', $localize_give_vars); |
|
458 | 458 | |
459 | 459 | } |
460 | 460 | |
@@ -468,15 +468,15 @@ discard block |
||
468 | 468 | */ |
469 | 469 | public function get_frontend_stylesheet_uri() { |
470 | 470 | |
471 | - $file = 'give' . $this->direction . '.css'; |
|
471 | + $file = 'give'.$this->direction.'.css'; |
|
472 | 472 | $templates_dir = give_get_theme_template_dir_name(); |
473 | 473 | |
474 | 474 | // Directory paths to CSS files to support checking via file_exists(). |
475 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
476 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
477 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
478 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
479 | - $give_plugin_style_sheet = trailingslashit( GIVE_PLUGIN_DIR ) . 'assets/dist/css/' . $file; |
|
475 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
476 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$this->direction.'.css'; |
|
477 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
478 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$this->direction.'.css'; |
|
479 | + $give_plugin_style_sheet = trailingslashit(GIVE_PLUGIN_DIR).'assets/dist/css/'.$file; |
|
480 | 480 | $uri = false; |
481 | 481 | |
482 | 482 | /** |
@@ -487,23 +487,23 @@ discard block |
||
487 | 487 | * c. followed by non minified version, even if SCRIPT_DEBUG is not enabled. This allows users to copy just give.css to their theme. |
488 | 488 | * d. Finally, fallback to the standard Give version. This is the default styles included within the plugin. |
489 | 489 | */ |
490 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
491 | - if ( ! empty( $nonmin ) ) { |
|
492 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
490 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
491 | + if ( ! empty($nonmin)) { |
|
492 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$this->direction.'.css'; |
|
493 | 493 | } else { |
494 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
494 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
495 | 495 | } |
496 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
497 | - if ( ! empty( $nonmin ) ) { |
|
498 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css'; |
|
496 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
497 | + if ( ! empty($nonmin)) { |
|
498 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$this->direction.'.css'; |
|
499 | 499 | } else { |
500 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
500 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
501 | 501 | } |
502 | - } elseif ( file_exists( $give_plugin_style_sheet ) ) { |
|
503 | - $uri = trailingslashit( GIVE_PLUGIN_URL ) . 'assets/dist/css/' . $file; |
|
502 | + } elseif (file_exists($give_plugin_style_sheet)) { |
|
503 | + $uri = trailingslashit(GIVE_PLUGIN_URL).'assets/dist/css/'.$file; |
|
504 | 504 | } |
505 | 505 | |
506 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
506 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
507 | 507 | |
508 | 508 | } |
509 | 509 | |
@@ -515,19 +515,19 @@ discard block |
||
515 | 515 | // Enqueue the bundled block JS file |
516 | 516 | wp_enqueue_script( |
517 | 517 | 'give-blocks-js', |
518 | - GIVE_PLUGIN_URL . 'assets/dist/js/gutenberg.js', |
|
519 | - array( 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api' ), |
|
518 | + GIVE_PLUGIN_URL.'assets/dist/js/gutenberg.js', |
|
519 | + array('wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api'), |
|
520 | 520 | GIVE_VERSION |
521 | 521 | ); |
522 | 522 | |
523 | 523 | // Enqueue public styles |
524 | - wp_enqueue_style( 'give-styles' ); |
|
524 | + wp_enqueue_style('give-styles'); |
|
525 | 525 | |
526 | 526 | // Enqueue the bundled block css file |
527 | 527 | wp_enqueue_style( |
528 | 528 | 'give-blocks-css', |
529 | - GIVE_PLUGIN_URL . 'assets/dist/css/gutenberg.css', |
|
530 | - array( 'wp-blocks' ), |
|
529 | + GIVE_PLUGIN_URL.'assets/dist/css/gutenberg.css', |
|
530 | + array('wp-blocks'), |
|
531 | 531 | GIVE_VERSION |
532 | 532 | ); |
533 | 533 |