PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.17.0
GiveWP – Donation Plugin and Fundraising Platform v2.17.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
71 lines 1.6 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\Reports\AverageDonation;
6 use Give\API\Endpoints\Reports\FormPerformance;
7 use Give\API\Endpoints\Reports\Income;
8 use Give\API\Endpoints\Reports\IncomeBreakdown;
9 use Give\API\Endpoints\Reports\PaymentMethods;
10 use Give\API\Endpoints\Reports\PaymentStatuses;
11 use Give\API\Endpoints\Reports\RecentDonations;
12 use Give\API\Endpoints\Reports\TopDonors;
13 use Give\API\Endpoints\Reports\TotalDonors;
14 use Give\API\Endpoints\Reports\TotalIncome;
15 use Give\API\Endpoints\Reports\TotalRefunds;
16 use Give\API\Endpoints\Logs\GetLogs;
17 use Give\API\Endpoints\Logs\FlushLogs;
18 use Give\API\Endpoints\Migrations\GetMigrations;
19 use Give\API\Endpoints\Migrations\RunMigration;
20 use Give\API\RestRoute;
21
22 class RestAPI implements ServiceProvider {
23 /**
24 * @var string[] array of RestRoute classes
25 */
26 private $reportRoutes = [
27 PaymentStatuses::class,
28 PaymentMethods::class,
29 FormPerformance::class,
30 TopDonors::class,
31 RecentDonations::class,
32 Income::class,
33 IncomeBreakdown::class,
34 AverageDonation::class,
35 TotalDonors::class,
36 TotalIncome::class,
37 TotalRefunds::class,
38 GetLogs::class,
39 FlushLogs::class,
40 GetMigrations::class,
41 RunMigration::class,
42 ];
43
44 /**
45 * @inheritDoc
46 */
47 public function register() {
48 }
49
50 /**
51 * @inheritDoc
52 */
53 public function boot() {
54 add_action( 'rest_api_init', [ $this, 'registerRoutes' ] );
55 }
56
57 /**
58 * Calls the route registrations within the WordPress REST API hook
59 *
60 * @since 2.8.0
61 */
62 public function registerRoutes() {
63 foreach ( $this->reportRoutes as $route ) {
64 /** @var RestRoute $route */
65 $route = give()->make( $route );
66
67 $route->registerRoute();
68 }
69 }
70 }
71