-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelegant-themes.php
117 lines (97 loc) · 2.31 KB
/
elegant-themes.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
/**
* Plugin Name: Elegant Themes
* Plugin URI: https://nibirahmed.com
* Description: Handle ajax and create users.
* Version: 1.0.0
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: Nibir Ahmed
* Author URI: https://nibirahmed.com/
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Update URI: https://nibirahmed.com
* Text Domain: nibir
* Domain Path: /languages
*/
use ElegantThemes\Admin;
use ElegantThemes\Admin\Installer;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
require_once __DIR__ . "/vendor/autoload.php";
/**
*
* Main Plugin Class
*
*/
final class ElegantThemes {
/**
* Plugin Version
*/
const version = '1.0.0';
/**
* Constructor
*
* @return void
*/
private function __construct() {
$this->define_constants();
register_activation_hook( __FILE__, [$this, 'activate'] );
add_action( 'plugins_loaded', [$this, 'init_plugin'] );
}
/**
* Initializes the plugin
*
* @return void
*/
public function init_plugin() {
if ( is_admin() ) {
new Admin();
}
}
/**
* Initializing the plugin singleton instance
*
* @return \ElegantThemes
*/
public static function init() {
static $instance = false;
if ( ! $instance ) {
$instance = new self();
}
return $instance;
}
/**
* Defining Constants
*
* @return void
*/
public function define_constants() {
define( 'ElegantThemes_VERSION', self::version );
define( 'ElegantThemes_FILE', __FILE__ );
define( 'ElegantThemes_PATH', __DIR__ );
define( 'ElegantThemes_URL', plugins_url( '', ElegantThemes_FILE ) );
define( 'ElegantThemes_ASSETS', ElegantThemes_URL . '/assets' );
define( 'CE_TD', 'nibir' );
}
/**
* Do things while activating the plugin
*
* @return void
*/
public function activate() {
$installer = new Installer();
$installer->add_version();
}
}
/**
* Run the plugin
*
* @return void
*/
function ElegantThemes() {
return ElegantThemes::init();
}
// Kick start the plugin
ElegantThemes();