PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.13.1
GiveWP – Donation Plugin and Fundraising Platform v2.13.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 2.31.1 All 253 releases
give / src / Form / LegacyConsumer / ServiceProvider.php
ServiceProvider.php
78 lines 1.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\Helpers\Hooks;
6 use Give\Receipt\DonationReceipt;
7 use Give\ServiceProviders\ServiceProvider as ServiceProviderInterface;
8 use Give\Form\LegacyConsumer\Commands\DeprecateOldTemplateHook;
9
10 class ServiceProvider implements ServiceProviderInterface {
11
12 /**
13 * @inheritDoc
14 */
15 public function register() {
16 include_once plugin_dir_path( __FILE__ ) . '/functions.php';
17 give()->bind(
18 DeprecateOldTemplateHook::class,
19 function() {
20 global $wp_filter;
21 return new DeprecateOldTemplateHook( $wp_filter );
22 }
23 );
24 }
25
26 /**
27 * @inheritDoc
28 */
29 public function boot() {
30
31 give( TemplateHooks::class )->walk( give( Commands\SetupNewTemplateHook::class ) );
32 if ( ! wp_doing_ajax() ) {
33 give( TemplateHooks::class )->walk( give( Commands\DeprecateOldTemplateHook::class ) );
34 }
35
36 add_filter(
37 'give_donation_form_required_fields',
38 function( $requiredFields, $formID ) {
39 return give( TemplateHooks::class )->reduce( new Commands\SetupFieldValidation( $formID ), $requiredFields );
40 },
41 10,
42 2
43 );
44
45 add_action(
46 'give_insert_payment',
47 function( $donationID, $donationData ) {
48 give( TemplateHooks::class )->walk( new Commands\SetupFieldPersistance( $donationID, $donationData ) );
49 },
50 10,
51 2
52 );
53
54 add_action(
55 'give_new_receipt',
56 function( DonationReceipt $receipt ) {
57 give( TemplateHooks::class )->walk( new Commands\SetupFieldReceipt( $receipt ) );
58 }
59 );
60
61 add_action(
62 'give_payment_receipt_after',
63 function( $payment, $receipt_args ) {
64 give( TemplateHooks::class )->walk( new Commands\SetupFieldConfirmation( $payment, $receipt_args ) );
65 },
66 10,
67 2
68 );
69
70 add_action(
71 'give_add_email_tags',
72 function() {
73 give( TemplateHooks::class )->walk( new Commands\SetupFieldEmailTag );
74 }
75 );
76 }
77 }
78