PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.8.1
GiveWP – Donation Plugin and Fundraising Platform v4.16.8.1
4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 All 254 releases
give / src / Form / LegacyConsumer / ServiceProvider.php

ServiceProvider.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.8.1, at src/Form/LegacyConsumer/ServiceProvider.php

106 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Form\LegacyConsumer;
4
5 use Give\Form\LegacyConsumer\Actions\AddCustomFieldsToLegacyReceipt;
6 use Give\Form\LegacyConsumer\Commands\DeprecateOldTemplateHook;
7 use Give\Helpers\Hooks;
8 use Give\Receipt\DonationReceipt;
9 use Give\ServiceProviders\ServiceProvider as ServiceProviderInterface;
10 use Give_Donate_Form;
11
12 class ServiceProvider implements ServiceProviderInterface
13 {
14
15 /**
16 * @inheritDoc
17 */
18 public function register()
19 {
20 include_once plugin_dir_path(__FILE__) . '/functions.php';
21 give()->bind(
22 DeprecateOldTemplateHook::class,
23 function () {
24 global $wp_filter;
25
26 return new DeprecateOldTemplateHook($wp_filter);
27 }
28 );
29
30 give()->singleton(UniqueIdAttributeGenerator::class);
31 }
32
33 /**
34 * @inheritDoc
35 */
36 public function boot()
37 {
38 give(TemplateHooks::class)->walk(give(Commands\SetupNewTemplateHook::class));
39 if ( ! wp_doing_ajax()) {
40 give(TemplateHooks::class)->walk(give(Commands\DeprecateOldTemplateHook::class));
41 }
42
43 add_action(
44 'give_checkout_error_checks',
45 function () {
46 $formId = absint($_POST['give-form-id']);
47 give(TemplateHooks::class)->walk(new Commands\SetupFieldValidation($formId));
48 }
49 );
50
51 add_action(
52 'give_form_html_tags',
53 /**
54 * @since 2.14.0
55 *
56 * @param array $formHtmlAttributes
57 * @param Give_Donate_Form $form
58 *
59 * @return void
60 */
61 function ($formHtmlAttributes, $form) {
62 return give(TemplateHooks::class)->reduce(
63 new AddEnctypeAttributeInDonationForm($form->ID),
64 $formHtmlAttributes
65 );
66 },
67 10,
68 2
69 );
70
71 add_action(
72 'give_insert_payment',
73 function ($donationID, $donationData) {
74 give(TemplateHooks::class)->walk(new Commands\SetupFieldPersistence($donationID, $donationData));
75 },
76 10,
77 2
78 );
79
80 add_action(
81 'give_new_receipt',
82 function (DonationReceipt $receipt) {
83 give(TemplateHooks::class)->walk(new Commands\SetupFieldReceipt($receipt));
84 }
85 );
86
87 add_action(
88 'give_payment_receipt_after',
89 function ($payment, $receipt_args) {
90 give(TemplateHooks::class)->walk(new Commands\SetupFieldConfirmation($payment, $receipt_args));
91 },
92 10,
93 2
94 );
95
96 add_action(
97 'give_add_email_tags',
98 function () {
99 give(TemplateHooks::class)->walk(new Commands\SetupFieldEmailTag);
100 }
101 );
102
103 Hooks::addAction('give_new_receipt', AddCustomFieldsToLegacyReceipt::class);
104 }
105 }
106