-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhostkit.php
executable file
·192 lines (143 loc) · 3.61 KB
/
hostkit.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php
/**
* hostkit is the ultimate whmcs plugin and addon for WordPress.
*
* @link http://ava.to
* @since 0.1
* @package hostkit
*
* @wordpress-plugin
* Plugin Name: hostkit
* Plugin URI: http://hostkit.ava.to/
* Description: hostkit
* Version: 0.1
* Author: Avato
* Author URI: http://ava.to
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: hostkit
* Domain Path: /languages
*
* WordPress -
* Requires at least: 4.2
* Tested up to: 4.2.3
*
*/
if ( ! defined( 'WPINC' ) ) die;
if ( ! class_exists( 'Hostkit' ) ) :
final class Hostkit {
/**
* declare the instance
*
*
* @since 0.1
*/
private static $instance;
public $version = '0.1';
/**
* Main Instance
*
* Insures that only one instance of the plugin exists in memory at any one
* time. Also prevents needing to define globals all over the place.
*
* @since 0.0.1
* @return instance
*/
public static function instance() {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Hostkit ) ) {
self::$instance = new Hostkit;
self::$instance->setup_constants();
self::$instance->includes();
self::$instance->get_options();
add_action( 'init', array( self::$instance, 'setup_objects' ), -1 );
}
return self::$instance;
}
/**
* Throw error on object clone
*
* The whole idea of the singleton design pattern is that there is a single
* object therefore, we don't want the object to be cloned.
*
* @since 0.0.1
* @access protected
* @return void
*/
public function __clone() {
// Cloning instances of the class is forbidden
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'hostkit' ), '1.0' );
}
/**
* Disable unserializing of the class
*
* @since 0.0.1
* @access protected
* @return void
*/
public function __wakeup() {
// Unserializing instances of the class is forbidden
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'hostkit' ), '1.0' );
}
/**
* Setup plugin constants
*
* @access private
* @since 0.0.1
* @return void
*/
private function setup_constants() {
// Plugin Folder Path
if ( ! defined( 'HOSTKIT_DIR' ) ) {
define( 'HOSTKIT_DIR', plugin_dir_path( __FILE__ ) );
}
// Plugin Folder URL
if ( ! defined( 'HOSTKIT_URL' ) ) {
define( 'HOSTKIT_URL', plugin_dir_url( __FILE__ ) );
}
// Plugin Folder Path
if ( ! defined( 'HOSTKIT_VERSION' ) ) {
define( 'HOSTKIT_VERSION', $this->version );
}
}
/**
* Include required files
*
* @access private
* @since 0.0.1
* @return void
*/
private function includes() {
// utility files
if ( is_admin() ){
require_once HOSTKIT_DIR . 'includes/admin/class-hk-admin.php';
}
require_once HOSTKIT_DIR . 'includes/utilities/avi-form.php';
require_once HOSTKIT_DIR . 'includes/utilities/hk-string.php';
require_once HOSTKIT_DIR . 'includes/hk-functions.php';
require_once HOSTKIT_DIR . 'includes/whmcs/hk-whmcs-functions.php';
require_once HOSTKIT_DIR . 'includes/class-hk-ajax.php';
}
/**
* Setup all objects
*
* @access private
* @since 0.0.1
* @return void
*/
public function setup_objects() {
// self::$instance->system = new wp_systemAvi();
}
public function get_options(){
return;
}
}
endif; // End if class_exists check
/**
*
* @since 0.1
* @return Hostkit instance
*/
function HKit() {
return Hostkit::instance();
}
HKit();