| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: WPVulnerability |
| 4 |
* Plugin URI: https://www.wpvulnerability.com/plugin/ |
| 5 |
* Description: Receive information about possible vulnerabilities in your WordPress from WordPress Vulnerability Database API. |
| 6 |
* Requires at least: 5.6 |
| 7 |
* Requires PHP: 7.0 |
| 8 |
* Version: 5.1.1 |
| 9 |
* Author: ROBOTSTXT |
| 10 |
* Author URI: https://www.robotstxt.es/ |
| 11 |
* License: GPL-3.0-or-later |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt |
| 13 |
* Text Domain: wpvulnerability |
| 14 |
* Domain Path: /languages |
| 15 |
* Network: true |
| 16 |
* |
| 17 |
* @package WPVulnerability |
| 18 |
* |
| 19 |
* @version 5.1.1 |
| 20 |
*/ |
| 21 |
|
| 22 |
defined( 'ABSPATH' ) || die( 'No script kiddies please!' ); |
| 23 |
|
| 24 |
/** |
| 25 |
* Set some constants that I can change in future versions. |
| 26 |
*/ |
| 27 |
define( 'WPVULNERABILITY_PLUGIN_VERSION', '5.1.1' ); |
| 28 |
define( 'WPVULNERABILITY_API_HOST', 'https://www.wpvulnerability.net/' ); |
| 29 |
|
| 30 |
/** |
| 31 |
* Set some useful constants. |
| 32 |
*/ |
| 33 |
define( 'WPVULNERABILITY_PLUGIN_URL', plugins_url( '/', __FILE__ ) ); |
| 34 |
define( 'WPVULNERABILITY_PLUGIN_FILE', __FILE__ ); |
| 35 |
define( 'WPVULNERABILITY_PLUGIN_BASE', plugin_basename( __FILE__ ) ); |
| 36 |
define( 'WPVULNERABILITY_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
| 37 |
|
| 38 |
// Handle front-end email opt-out requests early. |
| 39 |
if ( isset( $_GET['wpvulnerability_disable_email'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 40 |
// Load pluggable functions so wp_verify_nonce() is available. |
| 41 |
if ( ! function_exists( 'wp_verify_nonce' ) ) { |
| 42 |
require_once ABSPATH . WPINC . '/pluggable.php'; |
| 43 |
} |
| 44 |
|
| 45 |
if ( ! defined( 'SECURE_AUTH_COOKIE' ) ) { |
| 46 |
if ( ! function_exists( 'wp_cookie_constants' ) ) { |
| 47 |
require_once ABSPATH . WPINC . '/default-constants.php'; |
| 48 |
} |
| 49 |
|
| 50 |
if ( function_exists( 'wp_cookie_constants' ) ) { |
| 51 |
wp_cookie_constants(); |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
if ( ! function_exists( 'wpvulnerability_normalize_notify_settings' ) ) { |
| 56 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-general.php'; |
| 57 |
} |
| 58 |
|
| 59 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-notifications.php'; |
| 60 |
|
| 61 |
if ( function_exists( 'wpvulnerability_disable_notifications_via_url' ) ) { |
| 62 |
wpvulnerability_disable_notifications_via_url(); |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
/** |
| 67 |
* Initialize the plugin. |
| 68 |
* |
| 69 |
* @since 2.0.0 |
| 70 |
* |
| 71 |
* @return void |
| 72 |
*/ |
| 73 |
function wpvulnerability_plugin_init() { |
| 74 |
wpvulnerability_initialize_plugin_data(); |
| 75 |
|
| 76 |
/* |
| 77 |
* Global functions, where the magic happens. |
| 78 |
* |
| 79 |
* @since 2.0.0 |
| 80 |
*/ |
| 81 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-general.php'; |
| 82 |
|
| 83 |
/* |
| 84 |
* The admin panel for the configuration. |
| 85 |
* |
| 86 |
* @since 2.0.0 |
| 87 |
*/ |
| 88 |
if ( is_multisite() && ( is_network_admin() || ( wp_doing_ajax() && is_admin() ) ) ) { |
| 89 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-adminms.php'; |
| 90 |
} elseif ( ! is_multisite() && is_admin() ) { |
| 91 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-admin.php'; |
| 92 |
} |
| 93 |
|
| 94 |
/* |
| 95 |
* The functions to work with the data. |
| 96 |
* |
| 97 |
* @since 2.0.0 |
| 98 |
*/ |
| 99 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-core.php'; |
| 100 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-plugins.php'; |
| 101 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-themes.php'; |
| 102 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-software.php'; |
| 103 |
|
| 104 |
/* |
| 105 |
* All the plugin really does. |
| 106 |
* |
| 107 |
* @since 2.0.0 |
| 108 |
*/ |
| 109 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-process.php'; |
| 110 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-notifications.php'; |
| 111 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-sitehealth.php'; |
| 112 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/class-wpvulnerability-cli.php'; |
| 113 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/class-wpvulnerability-config-cli.php'; |
| 114 |
} |
| 115 |
|
| 116 |
/* |
| 117 |
* Only load if it's admin / super admin. |
| 118 |
*/ |
| 119 |
if ( |
| 120 |
( ! is_multisite() && is_admin() ) || |
| 121 |
( is_multisite() && ( is_network_admin() || is_main_site() ) ) || |
| 122 |
( defined( 'WP_CLI' ) && WP_CLI ) || // @phpstan-ignore booleanAnd.rightAlwaysFalse (WP_CLI is false in bootstrap but true at runtime) |
| 123 |
( wp_doing_cron() && ( ! is_multisite() || is_main_site() ) ) // Cron events only run on the main site (see wpvulnerability-schedule.php); skip full module loading on subsite cron. |
| 124 |
) { |
| 125 |
|
| 126 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-run.php'; |
| 127 |
register_activation_hook( WPVULNERABILITY_PLUGIN_FILE, 'wpvulnerability_activation' ); |
| 128 |
register_deactivation_hook( WPVULNERABILITY_PLUGIN_FILE, 'wpvulnerability_deactivation' ); |
| 129 |
register_uninstall_hook( WPVULNERABILITY_PLUGIN_FILE, 'wpvulnerability_uninstall' ); |
| 130 |
add_action( 'init', 'wpvulnerability_plugin_init' ); |
| 131 |
} |
| 132 |
|
| 133 |
/* |
| 134 |
* The plugin really needs this. |
| 135 |
* |
| 136 |
* @since 3.1.0 |
| 137 |
*/ |
| 138 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-schedule.php'; |
| 139 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-api.php'; |
| 140 |
|