forked from robicse11127/wp-vue-kickstart
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.php
More file actions
114 lines (96 loc) · 2.45 KB
/
Copy pathplugin.php
File metadata and controls
114 lines (96 loc) · 2.45 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
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
<?php
/**
* @link https://wp-vue-kickstart.com
* @since 1.0.0
* @package WP_Vue_KickStart
*
* Plugin Name: WP Vue KickStart
* Plugin URI: https://wp-vue-kickstart.com
* Description: A wp vue starter for plugin development.
* Version: 1.0.0
* Author: Md. Rabiul Islam Robi
* Author URI: https://robizstory.me
* License: GPL v3
* Text-Domain: textdomain
*/
if( ! defined( 'ABSPATH' ) ) exit(); // No direct access allowed
/**
* Require Autoloader
*/
require_once 'vendor/autoload.php';
use WPVK\Api\Api;
use WPVK\Includes\Admin;
use WPVK\Includes\Frontend;
final class WP_Vue_Kickstart {
/**
* Define Plugin Version
*/
const VERSION = '1.0.0';
/**
* Construct Function
*/
public function __construct() {
$this->plugin_constants();
register_activation_hook( __FILE__, [ $this, 'activate' ] );
register_deactivation_hook( __FILE__, [ $this, 'deactivate' ] );
add_action( 'plugins_loaded', [ $this, 'init_plugin' ] );
}
/**
* Plugin Constants
* @since 1.0.0
*/
public function plugin_constants() {
define( 'WPVK_VERSION', self::VERSION );
define( 'WPVK_PLUGIN_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
define( 'WPVK_PLUGIN_URL', trailingslashit( plugins_url( '', __FILE__ ) ) );
define( 'WPVK_NONCE', 'b?le*;K7.T2jk_*(+3&[G[xAc8O~Fv)2T/Zk9N:GKBkn$piN0.N%N~X91VbCn@.4' );
}
/**
* Singletone Instance
* @since 1.0.0
*/
public static function init() {
static $instance = false;
if( !$instance ) {
$instance = new self();
}
return $instance;
}
/**
* On Plugin Activation
* @since 1.0.0
*/
public function activate() {
$is_installed = get_option( 'wpvk_is_installed' );
if( ! $is_installed ) {
update_option( 'wpvk_is_installed', time() );
}
update_option( 'wpvk_is_installed', WPVK_VERSION );
}
/**
* On Plugin De-actiavtion
* @since 1.0.0
*/
public function deactivate() {
// On plugin deactivation
}
/**
* Init Plugin
* @since 1.0.0
*/
public function init_plugin() {
// init
new Admin();
new Frontend();
new Api();
}
}
/**
* Initialize Main Plugin
* @since 1.0.0
*/
function wp_vue_kickstart() {
return WP_Vue_Kickstart::init();
}
// Run the Plugin
wp_vue_kickstart();