PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 3.15.0
GiveWP – Donation Plugin and Fundraising Platform v3.15.0
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 2.31.1 All 253 releases
give / src / Form / LegacyConsumer / ServiceProvider.php
ServiceProvider.php
102 lines 2.8 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\Commands\DeprecateOldTemplateHook;
6 use Give\Receipt\DonationReceipt;
7 use Give\ServiceProviders\ServiceProvider as ServiceProviderInterface;
8 use Give_Donate_Form;
9
10 class ServiceProvider implements ServiceProviderInterface
11 {
12
13 /**
14 * @inheritDoc
15 */
16 public function register()
17 {
18 include_once plugin_dir_path(__FILE__) . '/functions.php';
19 give()->bind(
20 DeprecateOldTemplateHook::class,
21 function () {
22 global $wp_filter;
23
24 return new DeprecateOldTemplateHook($wp_filter);
25 }
26 );
27
28 give()->singleton(UniqueIdAttributeGenerator::class);
29 }
30
31 /**
32 * @inheritDoc
33 */
34 public function boot()
35 {
36 give(TemplateHooks::class)->walk(give(Commands\SetupNewTemplateHook::class));
37 if ( ! wp_doing_ajax()) {
38 give(TemplateHooks::class)->walk(give(Commands\DeprecateOldTemplateHook::class));
39 }
40
41 add_action(
42 'give_checkout_error_checks',
43 function () {
44 $formId = absint($_POST['give-form-id']);
45 give(TemplateHooks::class)->walk(new Commands\SetupFieldValidation($formId));
46 }
47 );
48
49 add_action(
50 'give_form_html_tags',
51 /**
52 * @since 2.14.0
53 *
54 * @param array $formHtmlAttributes
55 * @param Give_Donate_Form $form
56 *
57 * @return void
58 */
59 function ($formHtmlAttributes, $form) {
60 return give(TemplateHooks::class)->reduce(
61 new AddEnctypeAttributeInDonationForm($form->ID),
62 $formHtmlAttributes
63 );
64 },
65 10,
66 2
67 );
68
69 add_action(
70 'give_insert_payment',
71 function ($donationID, $donationData) {
72 give(TemplateHooks::class)->walk(new Commands\SetupFieldPersistence($donationID, $donationData));
73 },
74 10,
75 2
76 );
77
78 add_action(
79 'give_new_receipt',
80 function (DonationReceipt $receipt) {
81 give(TemplateHooks::class)->walk(new Commands\SetupFieldReceipt($receipt));
82 }
83 );
84
85 add_action(
86 'give_payment_receipt_after',
87 function ($payment, $receipt_args) {
88 give(TemplateHooks::class)->walk(new Commands\SetupFieldConfirmation($payment, $receipt_args));
89 },
90 10,
91 2
92 );
93
94 add_action(
95 'give_add_email_tags',
96 function () {
97 give(TemplateHooks::class)->walk(new Commands\SetupFieldEmailTag);
98 }
99 );
100 }
101 }
102