-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathninja-shortcuts.php
74 lines (59 loc) · 2.07 KB
/
ninja-shortcuts.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
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
*
* @wordpress-plugin
* Plugin Name: Ninja Shortcuts
* Plugin URI: https://github.com/nadim-cse
* Description: An Addon for help ninja support agents to nagivate quickly.
* Version: 1.0
* Author: Nadim
* Author URI: https://profiles.wordpress.org/nadimcse/
* Text Domain: ns_addon
*/
defined('ABSPATH') or die;
define('NINJA_SHORTCUTS_VERSION', 1.0);
define('NINJA_SHORTCUTS_DIR_PATH', plugin_dir_path(__FILE__));
define('NINJA_SHORTCUTS_DIR_URL', plugin_dir_url(__FILE__));
if(!class_exists('NinjaShortcuts')){
class NinjaShortcuts
{
public function boot()
{
if (!defined('FLUENTFORM') || !defined('FLUENTCRM')) {
return $this->injectDependency();
}
$this->includeFiles();
$this->registerComponents();
}
protected function includeFiles()
{
include_once NINJA_SHORTCUTS_DIR_PATH . 'inc/MenuSettings.php';
}
protected function registerComponents()
{
new \NinjaShortCuts\inc\MenuSettings();
}
/**
* Notify the user about the FluentForm dependency and instructs to install it.
*/
protected function injectDependency()
{
add_action('admin_notices', function () {
$class = 'notice notice-error';
$message = 'Please install our plugins such Fluent Forms and FluentCRM';
printf('<div class="%1$s"><p>%2$s</p></div>', esc_attr($class), $message);
});
}
}
}
add_action( 'init', function (){
$adminInit = new NinjaShortcuts();
$adminInit->boot();
}, 10 );