| 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: 4.7 |
| 7 |
* Requires PHP: 7.0 |
| 8 |
* Version: 5.1.6 |
| 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.6 |
| 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.6' ); |
| 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 |
/* |
| 39 |
* WordPress core function polyfills (wp_date, wp_timezone, wp_doing_cron, ...). |
| 40 |
* Loaded first so every module can call the core functions unconditionally. |
| 41 |
* |
| 42 |
* @since 5.1.3 |
| 43 |
*/ |
| 44 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-compat.php'; |
| 45 |
|
| 46 |
// Handle front-end email opt-out requests early. |
| 47 |
if ( isset( $_GET['wpvulnerability_disable_email'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 48 |
// Load pluggable functions so wp_verify_nonce() is available. |
| 49 |
if ( ! function_exists( 'wp_verify_nonce' ) ) { |
| 50 |
require_once ABSPATH . WPINC . '/pluggable.php'; |
| 51 |
} |
| 52 |
|
| 53 |
if ( ! defined( 'SECURE_AUTH_COOKIE' ) ) { |
| 54 |
if ( ! function_exists( 'wp_cookie_constants' ) ) { |
| 55 |
require_once ABSPATH . WPINC . '/default-constants.php'; |
| 56 |
} |
| 57 |
|
| 58 |
if ( function_exists( 'wp_cookie_constants' ) ) { |
| 59 |
wp_cookie_constants(); |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
if ( ! function_exists( 'wpvulnerability_normalize_notify_settings' ) ) { |
| 64 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-general.php'; |
| 65 |
} |
| 66 |
|
| 67 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-notifications.php'; |
| 68 |
|
| 69 |
if ( function_exists( 'wpvulnerability_disable_notifications_via_url' ) ) { |
| 70 |
wpvulnerability_disable_notifications_via_url(); |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* Initialize the plugin. |
| 76 |
* |
| 77 |
* @since 2.0.0 |
| 78 |
* |
| 79 |
* @return void |
| 80 |
*/ |
| 81 |
function wpvulnerability_plugin_init() { |
| 82 |
wpvulnerability_initialize_plugin_data(); |
| 83 |
|
| 84 |
/* |
| 85 |
* Global functions, where the magic happens. |
| 86 |
* |
| 87 |
* @since 2.0.0 |
| 88 |
*/ |
| 89 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-general.php'; |
| 90 |
|
| 91 |
/* |
| 92 |
* The admin panel for the configuration. |
| 93 |
* |
| 94 |
* @since 2.0.0 |
| 95 |
*/ |
| 96 |
if ( is_multisite() && ( is_network_admin() || ( wp_doing_ajax() && is_admin() ) ) ) { |
| 97 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-adminms.php'; |
| 98 |
} elseif ( ! is_multisite() && is_admin() ) { |
| 99 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-admin.php'; |
| 100 |
} |
| 101 |
|
| 102 |
/* |
| 103 |
* The functions to work with the data. |
| 104 |
* |
| 105 |
* @since 2.0.0 |
| 106 |
*/ |
| 107 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-core.php'; |
| 108 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-plugins.php'; |
| 109 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-themes.php'; |
| 110 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-software.php'; |
| 111 |
|
| 112 |
/* |
| 113 |
* All the plugin really does. |
| 114 |
* |
| 115 |
* @since 2.0.0 |
| 116 |
*/ |
| 117 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-process.php'; |
| 118 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-notifications.php'; |
| 119 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-sitehealth.php'; |
| 120 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/class-wpvulnerability-cli.php'; |
| 121 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/class-wpvulnerability-config-cli.php'; |
| 122 |
} |
| 123 |
|
| 124 |
/* |
| 125 |
* Only load if it's admin / super admin. |
| 126 |
*/ |
| 127 |
if ( |
| 128 |
( ! is_multisite() && is_admin() ) || |
| 129 |
( is_multisite() && ( is_network_admin() || is_main_site() ) ) || |
| 130 |
( defined( 'WP_CLI' ) && WP_CLI ) || // @phpstan-ignore booleanAnd.rightAlwaysFalse (WP_CLI is false in bootstrap but true at runtime) |
| 131 |
( 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. |
| 132 |
) { |
| 133 |
|
| 134 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-run.php'; |
| 135 |
register_activation_hook( WPVULNERABILITY_PLUGIN_FILE, 'wpvulnerability_activation' ); |
| 136 |
register_deactivation_hook( WPVULNERABILITY_PLUGIN_FILE, 'wpvulnerability_deactivation' ); |
| 137 |
// Uninstall is handled by uninstall.php (it supersedes register_uninstall_hook |
| 138 |
// and enforces the delete_on_uninstall opt-in); see docs/known-issues.md KI-3. |
| 139 |
add_action( 'init', 'wpvulnerability_plugin_init' ); |
| 140 |
} |
| 141 |
|
| 142 |
/* |
| 143 |
* The plugin really needs this. |
| 144 |
* |
| 145 |
* @since 3.1.0 |
| 146 |
*/ |
| 147 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-schedule.php'; |
| 148 |
require_once WPVULNERABILITY_PLUGIN_PATH . '/wpvulnerability-api.php'; |
| 149 |
|
| 150 |
/** |
| 151 |
* Load plugin translations on init. |
| 152 |
* |
| 153 |
* Explicitly loading the textdomain on init prevents the |
| 154 |
* "_load_textdomain_just_in_time() was called incorrectly" notice |
| 155 |
* on WordPress 6.7+. |
| 156 |
* |
| 157 |
* @since 5.1.2 |
| 158 |
* |
| 159 |
* @return void |
| 160 |
*/ |
| 161 |
function wpvulnerability_load_textdomain() { |
| 162 |
load_plugin_textdomain( 'wpvulnerability', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 163 |
} |
| 164 |
add_action( 'init', 'wpvulnerability_load_textdomain' ); |
| 165 |
|