-
Notifications
You must be signed in to change notification settings - Fork 0
/
nadi.php
92 lines (74 loc) · 2.3 KB
/
nadi.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
<?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.
*
* @link https://nadi.pro
* @since 1.0.0
*
* @wordpress-plugin
* Plugin Name: Nadi
* Plugin URI: https://github.com/nadi-pro/nadi-wordpress
* Description: Monitoring applications made simple for developers. Monitor applications crashes with Nadi, your Crash Care Companion
* Version: 1.0.0
* Author: Nadi Pro
* Author URI: https://nadi.pro/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: nadi
* Domain Path: /languages
*/
use Nadi\WordPress\Handler\HandleExceptionEvent;
use Nadi\WordPress\Nadi;
// If this file is called directly, abort.
if (! defined('WPINC')) {
exit;
}
// Don't load during plugin updates to prevent function signature changes causing issues between versions.
if (is_admin()) {
if (isset($_GET['action']) && $_GET['action'] === 'upgrade-plugin') {
return;
}
if (isset($_POST['action']) && $_POST['action'] === 'update-plugin') {
return;
}
}
define('NADI_VERSION', '1.0.0');
define('NADI_DIR', plugin_dir_path(__FILE__));
define('NADI_START', microtime(true));
require_once NADI_DIR.'/classes/Composer.php';
require_once NADI_DIR.'/classes/PHP.php';
if (! PHP::isValid()) {
add_action('admin_notices', 'PHP::notice');
return;
}
if (! Composer::isInstalled()) {
add_action('admin_notices', 'Composer::notice');
return;
}
require NADI_DIR.'/vendor/autoload.php';
/** Activation */
function activate_nadi()
{
if (! Composer::isInstalled()) {
Composer::install();
Composer::installDependencies();
}
Nadi::activate();
}
function deactivate_nadi()
{
Nadi::deactivate();
}
register_activation_hook(__FILE__, 'activate_nadi');
register_deactivation_hook(__FILE__, 'deactivate_nadi');
set_exception_handler([HandleExceptionEvent::class, 'make']);
$nadi = (new Nadi())
->setRequestMethod($_SERVER['REQUEST_METHOD'])
->setPostData($_POST)
->setup()
->run();