PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 3.12.0
GiveWP – Donation Plugin and Fundraising Platform v3.12.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 / ServiceProviders / RestAPI.php
RestAPI.php
99 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\ServiceProviders;
4
5 use Give\API\Endpoints\Logs\FlushLogs;
6 use Give\API\Endpoints\Logs\GetLogs;
7 use Give\API\Endpoints\Migrations\GetMigrations;
8 use Give\API\Endpoints\Migrations\RunMigration;
9 use Give\API\Endpoints\Reports\AverageDonation;
10 use Give\API\Endpoints\Reports\FormPerformance;
11 use Give\API\Endpoints\Reports\Income;
12 use Give\API\Endpoints\Reports\IncomeBreakdown;
13 use Give\API\Endpoints\Reports\PaymentMethods;
14 use Give\API\Endpoints\Reports\PaymentStatuses;
15 use Give\API\Endpoints\Reports\RecentDonations;
16 use Give\API\Endpoints\Reports\TopDonors;
17 use Give\API\Endpoints\Reports\TotalDonors;
18 use Give\API\Endpoints\Reports\TotalIncome;
19 use Give\API\Endpoints\Reports\TotalRefunds;
20 use Give\API\RestRoute;
21 use Give\DonationForms\V2\Endpoints\FormActions;
22 use Give\DonationForms\V2\Endpoints\ListDonationForms;
23 use Give\DonationForms\V2\Endpoints\SwitchDonationFormView;
24 use Give\Donations\Endpoints\DonationActions;
25 use Give\Donations\Endpoints\ListDonations;
26 use Give\Donations\Endpoints\SwitchDonationView;
27 use Give\Donors\Endpoints\DeleteDonor;
28 use Give\Donors\Endpoints\ListDonors;
29 use Give\Donors\Endpoints\SwitchDonorView;
30 use Give\Subscriptions\Endpoints\ListSubscriptions;
31 use Give\Subscriptions\Endpoints\SubscriptionActions;
32 use Give\Subscriptions\Endpoints\SwitchSubscriptionView;
33
34 class RestAPI implements ServiceProvider
35 {
36 /**
37 * @var string[] array of RestRoute classes
38 */
39 private $reportRoutes = [
40 PaymentStatuses::class,
41 PaymentMethods::class,
42 FormPerformance::class,
43 TopDonors::class,
44 RecentDonations::class,
45 Income::class,
46 IncomeBreakdown::class,
47 AverageDonation::class,
48 TotalDonors::class,
49 TotalIncome::class,
50 TotalRefunds::class,
51 GetLogs::class,
52 FlushLogs::class,
53 ListDonationForms::class,
54 ListDonors::class,
55 ListDonations::class,
56 ListSubscriptions::class,
57 SwitchDonorView::class,
58 SwitchDonationView::class,
59 SwitchDonationFormView::class,
60 SwitchSubscriptionView::class,
61 DonationActions::class,
62 SubscriptionActions::class,
63 DeleteDonor::class,
64 FormActions::class,
65 GetMigrations::class,
66 RunMigration::class,
67 ];
68
69 /**
70 * @inheritDoc
71 */
72 public function register()
73 {
74 }
75
76 /**
77 * @inheritDoc
78 */
79 public function boot()
80 {
81 add_action('rest_api_init', [$this, 'registerRoutes']);
82 }
83
84 /**
85 * Calls the route registrations within the WordPress REST API hook
86 *
87 * @since 2.8.0
88 */
89 public function registerRoutes()
90 {
91 foreach ($this->reportRoutes as $route) {
92 /** @var RestRoute $route */
93 $route = give()->make($route);
94
95 $route->registerRoute();
96 }
97 }
98 }
99