-
Notifications
You must be signed in to change notification settings - Fork 6
/
wpvulnerability.php
119 lines (107 loc) · 3.54 KB
/
wpvulnerability.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
119
<?php
/**
* Plugin Name: WPVulnerability
* Plugin URI: https://www.wpvulnerability.com/
* Description: Receive information about possible vulnerabilities in your WordPress from WordPress Vulnerability Database API.
* Requires at least: 4.1
* Requires PHP: 5.6
* Version: 4.0.3
* Author: Javier Casares
* Author URI: https://www.javiercasares.com/
* License: GPL-2.0-or-later
* License URI: https://spdx.org/licenses/GPL-2.0-or-later.html
* Text Domain: wpvulnerability
* Domain Path: /languages
*
* @package WPVulnerability
*
* @version 2.0.0
*/
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
/**
* Set some constants that I can change in future versions.
*/
define( 'WPVULNERABILITY_PLUGIN_VERSION', '4.0.3' );
define( 'WPVULNERABILITY_API_HOST', 'https://www.wpvulnerability.net/' );
define( 'WPVULNERABILITY_CACHE_HOURS', 12 );
/**
* Set some useful constants.
*/
define( 'WPVULNERABILITY_PLUGIN_URL', plugins_url( '/', __FILE__ ) );
define( 'WPVULNERABILITY_PLUGIN_FILE', __FILE__ );
define( 'WPVULNERABILITY_PLUGIN_BASE', plugin_basename( __FILE__ ) );
define( 'WPVULNERABILITY_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
/**
* Initialize the plugin.
*
* @since 2.0.0
*
* @return void
*/
function wpvulnerability_plugin_init() {
/*
* Load the plugin's localization files.
*
* @since 2.0.0
*/
load_plugin_textdomain( 'wpvulnerability', false, dirname( WPVULNERABILITY_PLUGIN_BASE ) . '/languages' );
wpvulnerability_activation();
/*
* Global functions, where the magic happens.
*
* @since 2.0.0
*/
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-general.php';
/*
* The admin panel for the configuration.
*
* @since 2.0.0
*/
if ( is_multisite() && is_network_admin() ) {
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-adminms.php';
} elseif ( ! is_multisite() && is_admin() ) {
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-admin.php';
}
/*
* The functions to work with the data.
*
* @since 2.0.0
*/
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-core.php';
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-plugins.php';
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-themes.php';
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-software.php';
/*
* All the plugin really does.
*
* @since 2.0.0
*/
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-process.php';
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-notifications.php';
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-sitehealth.php';
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-cli.php';
// Update non-cached data.
wpvulnerability_expired_database_data();
}
/*
* Only load if it's admin / super admin.
*/
if (
( ! is_multisite() && is_admin() ) ||
( is_multisite() && ( is_network_admin() || is_main_site() ) ) ||
( defined( 'WP_CLI' ) && WP_CLI ) ||
wp_doing_cron()
) {
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-run.php';
register_activation_hook( WPVULNERABILITY_PLUGIN_FILE, 'wpvulnerability_activation' );
register_deactivation_hook( WPVULNERABILITY_PLUGIN_FILE, 'wpvulnerability_deactivation' );
register_uninstall_hook( WPVULNERABILITY_PLUGIN_FILE, 'wpvulnerability_uninstall' );
add_action( 'plugins_loaded', 'wpvulnerability_plugin_init' );
}
/*
* The plugin really needs this.
*
* @since 3.1.0
*/
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-schedule.php';
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-api.php';