PluginProbe
MailPoet – Newsletters, Email Marketing, and Automation / 5.34.1
MailPoet – Newsletters, Email Marketing, and Automation v5.34.1
5.37.0 5.36.1 5.36.0 5.35.1 5.35.0 5.34.3 5.34.2 5.34.1 5.34.0 5.33.1 5.33.0 5.32.0 5.31.0 5.30.0 5.29.0 5.28.1 5.28.0 5.27.0 5.26.0 5.26.1 5.25.0 5.24.0 4.43.0 4.43.1 4.44.0 All 541 releases
mailpoet / lib / Form / RestApi / Api.php
Api.php
35 lines 811 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types = 1);
2
3 namespace MailPoet\Form\RestApi;
4
5 if (!defined('ABSPATH')) exit;
6
7
8 use MailPoet\API\REST\API as RestApi;
9 use MailPoet\Form\RestApi\Endpoints\FormsBulkActionEndpoint;
10 use MailPoet\Form\RestApi\Endpoints\FormsListingEndpoint;
11 use MailPoet\WP\Functions as WPFunctions;
12
13 class Api {
14 /** @var RestApi */
15 private $api;
16
17 /** @var WPFunctions */
18 private $wp;
19
20 public function __construct(
21 RestApi $api,
22 WPFunctions $wp
23 ) {
24 $this->api = $api;
25 $this->wp = $wp;
26 }
27
28 public function initialize(): void {
29 $this->wp->addAction(RestApi::REST_API_INIT_ACTION, function (): void {
30 $this->api->registerGetRoute('forms', FormsListingEndpoint::class);
31 $this->api->registerPostRoute('forms/bulk-action', FormsBulkActionEndpoint::class);
32 });
33 }
34 }
35