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 / Revenue / RevenueServiceProvider.php

RevenueServiceProvider.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.8.1, at src/Revenue/RevenueServiceProvider.php

64 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Revenue;
4
5 use Give\Framework\Migrations\MigrationsRegister;
6 use Give\Helpers\Hooks;
7 use Give\Revenue\Listeners\DeleteRevenueWhenDonationPostDeleted;
8 use Give\Revenue\Listeners\DeleteRevenueWhenDonationDeleted;
9 use Give\Revenue\Listeners\UpdateRevenueWhenDonationUpdated;
10 use Give\Revenue\Migrations\AddPastDonationsToRevenueTable;
11 use Give\Revenue\Migrations\CreateRevenueTable;
12 use Give\Revenue\Migrations\RemoveRevenueForeignKeys;
13 use Give\ServiceProviders\ServiceProvider;
14
15 class RevenueServiceProvider implements ServiceProvider
16 {
17 /**
18 * @inheritDoc
19 *
20 * @since 2.9.0
21 */
22 public function register()
23 {
24 global $wpdb;
25
26 $wpdb->give_revenue = "{$wpdb->prefix}give_revenue";
27 }
28
29 /**
30 * @inheritDoc
31 *
32 * @since 4.14.0 rename delete_post handler to DeleteRevenueWhenDonationPostDeleted and add givewp_donation_deleted listener
33 * @since 3.3.0 added support for givewp_donation_updated and updated give_updated_edited_donation implementation
34 * @since 2.9.0
35 */
36 public function boot()
37 {
38 $this->registerMigrations();
39
40 Hooks::addAction('delete_post', DeleteRevenueWhenDonationPostDeleted::class);
41 Hooks::addAction('givewp_donation_deleted', DeleteRevenueWhenDonationDeleted::class);
42 Hooks::addAction('give_insert_payment', DonationHandler::class, 'handle', 999, 1);
43 Hooks::addAction('give_register_updates', AddPastDonationsToRevenueTable::class, 'register', 10, 1);
44 Hooks::addAction('givewp_donation_updated', UpdateRevenueWhenDonationUpdated::class);
45 Hooks::addAction('give_updated_edited_donation',LegacyListeners\UpdateRevenueWhenDonationAmountUpdated::class);
46 }
47
48 /**
49 * Registers database migrations with the MigrationsRunner
50 */
51 private function registerMigrations()
52 {
53 /** @var MigrationsRegister $register */
54 $register = give(MigrationsRegister::class);
55
56 $register->addMigrations(
57 [
58 CreateRevenueTable::class,
59 RemoveRevenueForeignKeys::class,
60 ]
61 );
62 }
63 }
64