-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-assistent.php
More file actions
64 lines (51 loc) · 1.65 KB
/
github-assistent.php
File metadata and controls
64 lines (51 loc) · 1.65 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
<?php
/**
* Plugin Name: github-assistent
* Plugin URI: https://tanjim-chowdhury.web.app/
* Description: Handle the basics with this plugin.
* Version: 1.01.1
* Author: Tanjim Chowdhury
* Author URI: https://tanjim-chowdhury.web.app/
*/
if (!defined('ABSPATH')) {exit;}
require_once __DIR__ . "/vendor/autoload.php";
final class Github_Assistent {
const version = "1.01.1";
private function __construct (){
$this->define_constants();
register_activation_hook(__FILE__ , [$this , "activate"]);
add_action("plugins_loaded",[$this , "init_plugin"]);
}
public static function init(){
static $instance = false;
if(!$instance){
return new self();
};
return $instance;
}
public function define_constants(){
define("Assistent_VERSION" , self::version);
define("Assistent_FILE" , __FILE__);
define("Assistent_PATH" , __DIR__);
define("Assistent_URL" , plugins_url("", Assistent_FILE));
define("Assistent_ASSETS", Assistent_URL. "/assets");
}
public function init_plugin(){
if (is_admin()){
new Tanjim\GithubAssistent\Admin();
} else{
new \Tanjim\GithubAssistent\Frontend();
}
}
public function activate (){
$installed = get_option("assistent_installed");
if(! $installed){
update_option("assistent_installed" , time());
}
update_option("ninja_version" , Assistent_VERSION);
}
}
function github_assistent () {
return Github_Assistent::init();
}
github_assistent();