-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathwp-react-admin-panel.php
More file actions
84 lines (74 loc) · 1.99 KB
/
wp-react-admin-panel.php
File metadata and controls
84 lines (74 loc) · 1.99 KB
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
<?php
/**
* Plugin Name: WPGens WordPress React Admin Panel
* Description: Example description of this plugin.
* Version: 1.0.0
* Author: Your Name
* Author URI: https://yoursite.com
* Text Domain: plugin-name
* Domain Path: /languages
* Requires at least: 5.9
* Tested up to: 6.1
* Requires PHP: 7.3
*
*/
defined('ABSPATH') || exit;
final class WP_React_Admin_Panel
{
private static $instance;
private $version = '1.0.0';
private function __construct()
{
$this->define_constants();
$this->includes();
}
private function includes()
{
if (is_admin()) {
require_once(PLUGIN_NAME_ABSPATH . 'includes/admin/class-wp-react-admin-panel-menu.php');
require_once(PLUGIN_NAME_ABSPATH . 'includes/admin/class-wp-react-admin-panel-assets.php');
}
require_once(PLUGIN_NAME_ABSPATH . 'includes/admin/class-wp-react-admin-panel-api.php');
}
/**
* Define Plugin Constants.
* @since 1.0
*/
private function define_constants()
{
$this->define('PLUGIN_NAME_DEV', false);
$this->define('PLUGIN_NAME_REST_API_ROUTE', 'plugin-name/v1');
$this->define('PLUGIN_NAME_URL', plugin_dir_url(__FILE__));
$this->define('PLUGIN_NAME_ABSPATH', dirname(__FILE__) . '/');
$this->define('PLUGIN_NAME_VERSION', $this->get_version());
}
/**
* Returns Plugin version for global
* @since 1.0
*/
private function get_version()
{
return $this->version;
}
/**
* Define constant if not already set.
*
* @since 1.0
* @param string $name
* @param string|bool $value
*/
private function define($name, $value)
{
if (!defined($name)) {
define($name, $value);
}
}
public static function get_instance()
{
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
}
WP_React_Admin_Panel::get_instance();