-
Notifications
You must be signed in to change notification settings - Fork 1
/
murmurations-node.php
90 lines (75 loc) · 2.76 KB
/
murmurations-node.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/**
* Plugin Name: Murmurations Profile Generator
* Plugin URI: https://github.com/MurmurationsNetwork/MurmurationsNodeWP
* Description: Add your profile to the Murmurations distributed data sharing network.
* Version: 1.0.0-beta.12
* Requires at least: 6.4
* Text Domain: murmurations-node
* Author: Murmurations Network
* Author URI: https://murmurations.network
* License: GPLv3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*/
/*
The Murmurations Profile Generator plugin is free software: you can
redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, either version 3 of
the License, or any later version.
Murmurations Profile Generator is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with
the Murmurations Profile Generator plugin. If not, see
https://www.gnu.org/licenses/gpl-3.0.html.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'MurmurationsNode' ) ) {
define( 'MURMURATIONS_NODE_VERSION', '1.0.0-beta.12' );
define( 'MURMURATIONS_NODE_URL', plugin_dir_url( __FILE__ ) );
define( 'MURMURATIONS_NODE_DIR', __DIR__ );
define( 'MURMURATIONS_NODE_TABLE', 'murmurations_profiles' );
class MurmurationsNode {
public function __construct() {
$this->register_autoloads();
$this->register_admin_page();
$this->register_api();
$this->register_upgrade();
}
private function register_autoloads(): void {
spl_autoload_register(
function ( $name ) {
$name = strtolower( $name );
$name = str_replace( '_', '-', $name );
$name = 'class-' . $name;
$file = __DIR__ . '/admin/classes/' . $name . '.php';
if ( file_exists( $file ) ) {
require_once $file;
}
}
);
}
public function register_admin_page(): void {
new Murmurations_Node_Admin_Page();
}
public function register_api(): void {
new Murmurations_Node_API();
}
public function register_upgrade(): void {
new Murmurations_Node_Upgrade();
}
}
new MurmurationsNode();
}
if ( class_exists( 'Murmurations_Node_Activation' ) ) {
register_activation_hook( __FILE__, array( 'Murmurations_Node_Activation', 'activate' ) );
}
if ( class_exists( 'Murmurations_Node_Deactivation' ) ) {
register_deactivation_hook( __FILE__, array( 'Murmurations_Node_Deactivation', 'deactivate' ) );
}
if ( class_exists( 'Murmurations_Node_Uninstall' ) ) {
register_uninstall_hook( __FILE__, array( 'Murmurations_Node_Uninstall', 'uninstall' ) );
}