-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog-post-connector.php
71 lines (65 loc) · 1.62 KB
/
blog-post-connector.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
* Plugin Name: Blog Post Connector
* Description: A plugin to publish blogs to your WordPress website.
* Version: 1.0.0Beta
* Author: Website Pro, a WordPress hosting platform.
* Text Domain: blog-post-connector
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
// Autoload the classes using Composer
require_once __DIR__ . '/vendor/autoload.php';
use VPlugins\BlogPostConnector\Auth\Token;
use VPlugins\BlogPostConnector\Updater\Update;
use VPlugins\BlogPostConnector\Webhook\Webhook;
use VPlugins\BlogPostConnector\Endpoints\{
CreatePost,
DeletePost,
UpdatePost,
GetPost,
GetAuthors,
GetCategories,
GetTags,
Status
};
/**
* Endpoint Registry Class
*
* This class is responsible for initializing all endpoints
* and setting up the plugin update mechanism.
*/
class EndpointRegistry {
/**
* List of all endpoint classes.
*
* @var array
*/
private static $endpoints = [
CreatePost::class,
DeletePost::class,
UpdatePost::class,
GetAuthors::class,
GetCategories::class,
Status::class,
Token::class,
GetTags::class,
GetPost::class
];
/**
* Initialize all endpoints and the updater.
*
* This method loops through all endpoints and initializes them.
* It also initializes the plugin updater class.
*/
public static function initialize() {
foreach (self::$endpoints as $endpoint) {
new $endpoint();
}
new Update();
new Webhook();
}
}
// Initialize the plugin endpoints
EndpointRegistry::initialize();