-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbr-api-plugin.php
118 lines (99 loc) · 2.19 KB
/
br-api-plugin.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
<?php
/**
*
* Plugin Name: WP Vue API
* Plugin URI: https://www.wordpress.org
* Description: A WP API for vue.
* Version: 1.0.0
* Author: Rajan Dangi
* Author URI: https://www.wordpress.org
* License: GPL v3
* Text-Domain: textdomain
*/
/**
* No direct access allowed
*/
if (!defined('ABSPATH')) exit();
/**
* Require Auto-Loader
*/
require_once 'vendor/autoload.php';
use WPVABR\Api\Api;
final class WP_Vue_API_BR
{
/**
* 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('WPVABR_VERSION', self::VERSION);
define('WPVABR_PLUGIN_PATH', trailingslashit(plugin_dir_path(__FILE__)));
define('WPVABR_PLUGIN_URL', trailingslashit(plugins_url('', __FILE__)));
define('WPVABR_NONCE', 'b?l#3&45@_*(+3&[G[xAc8O~Fv)*36*7^_$piN0.N%[email protected]');
}
/**
* Single tone 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('wpvabr_is_installed');
if (!$is_installed) {
update_option('wpvabr_is_installed', time());
}
update_option('wpvabr_is_installed', WPVABR_VERSION);
}
/**
* On Plugin De-activation
* @since 1.0.0
*/
public function deactivate()
{
// On plugin deactivation
}
/**
* Init Plugin
* @since 1.0.0
*/
public function init_plugin()
{
new Api();
}
}
/**
* Initialize Main Plugin
* @since 1.0.0
*/
function wp_vue_api_br()
{
return WP_Vue_API_BR::init();
}
// Run the Plugin
wp_vue_api_br();