PluginProbe
MailPoet – Newsletters, Email Marketing, and Automation / 5.38.0
MailPoet – Newsletters, Email Marketing, and Automation v5.38.0
5.38.0 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 All 542 releases
mailpoet / lib / Automation / Engine / API / API.php

API.php in MailPoet – Newsletters, Email Marketing, and Automation 5.38.0, at lib/Automation/Engine/API/API.php

53 lines 1.4 KB
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\Automation\Engine\API;
4
5 if (!defined('ABSPATH')) exit;
6
7
8 use MailPoet\API\REST\API as MailPoetApi;
9 use MailPoet\Automation\Engine\Hooks;
10 use MailPoet\Automation\Engine\WordPress;
11
12 class API extends MailPoetApi {
13 /** @var MailPoetApi */
14 private $api;
15
16 /** @var WordPress */
17 private $wordPress;
18
19 public function __construct(
20 MailPoetApi $api,
21 WordPress $wordPress
22 ) {
23 $this->api = $api;
24 $this->wordPress = $wordPress;
25 }
26
27 public function initialize(): void {
28 $this->wordPress->addAction(MailPoetApi::REST_API_INIT_ACTION, function () {
29 $this->wordPress->doAction(Hooks::API_INITIALIZE, [$this]);
30 });
31 }
32
33 public function registerGetRoute(string $route, string $endpoint): void {
34 $this->api->registerGetRoute($route, $endpoint);
35 }
36
37 public function registerPostRoute(string $route, string $endpoint): void {
38 $this->api->registerPostRoute($route, $endpoint);
39 }
40
41 public function registerPutRoute(string $route, string $endpoint): void {
42 $this->api->registerPutRoute($route, $endpoint);
43 }
44
45 public function registerPatchRoute(string $route, string $endpoint): void {
46 $this->api->registerPatchRoute($route, $endpoint);
47 }
48
49 public function registerDeleteRoute(string $route, string $endpoint): void {
50 $this->api->registerDeleteRoute($route, $endpoint);
51 }
52 }
53