PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.2.2
Defender Security – Malware Scanner, Login Security & Firewall v6.2.2
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / wp-defender.php

wp-defender.php in Defender Security – Malware Scanner, Login Security & Firewall 6.2.2, at wp-defender.php

172 lines 5.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Defender
4 * Plugin URI: https://wpmudev.com/project/wp-defender/
5 * Version: 6.2.2
6 * Description: Get regular security scans, vulnerability reports, safety recommendations and customized hardening for your site in just a few clicks. Defender is the analyst and enforcer who never sleeps.
7 * Author: WPMU DEV
8 * Author URI: https://wpmudev.com/
9 * License: GNU General Public License (Version 2 - GPLv2)
10 * Text Domain: defender-security
11 * Network: true
12 * Requires PHP: 8.0.0
13 * Requires at least: 6.4
14 *
15 * @package WP_Defender
16 */
17
18 /*
19 Copyright 2007-2026 Incsub (https://incsub.com)
20 Author - Hoang Ngo, Anton Shulga
21
22 This program is free software; you can redistribute it and/or modify
23 it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by
24 the Free Software Foundation.
25
26 This program is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 GNU General Public License for more details.
30
31 You should have received a copy of the GNU General Public License
32 along with this program; if not, write to the Free Software
33 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 */
35
36 if ( ! defined( 'ABSPATH' ) ) {
37 die;
38 }
39 if ( ! defined( 'DEFENDER_VERSION' ) ) {
40 define( 'DEFENDER_VERSION', '6.2.2' );
41 }
42 if ( ! defined( 'DEFENDER_RELEASE_DATE' ) ) {
43 define( 'DEFENDER_RELEASE_DATE', '2026-08-24' );
44 }
45 if ( ! defined( 'DEFENDER_DB_VERSION' ) ) {
46 define( 'DEFENDER_DB_VERSION', '6.2.2' );
47 }
48 if ( ! defined( 'DEFENDER_SUI' ) ) {
49 define( 'DEFENDER_SUI', '2-12-24' );
50 }
51 if ( ! defined( 'DEFENDER_PLUGIN_BASENAME' ) ) {
52 define( 'DEFENDER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
53 }
54 if ( ! defined( 'WP_DEFENDER_DIR' ) ) {
55 define( 'WP_DEFENDER_DIR', plugin_dir_path( __FILE__ ) );
56 }
57 if ( ! defined( 'WP_DEFENDER_FILE' ) ) {
58 define( 'WP_DEFENDER_FILE', __FILE__ );
59 }
60 if ( ! defined( 'WP_DEFENDER_BASE_URL' ) ) {
61 define( 'WP_DEFENDER_BASE_URL', plugin_dir_url( WP_DEFENDER_FILE ) );
62 }
63 if ( ! defined( 'WP_DEFENDER_MIN_PHP_VERSION' ) ) {
64 define( 'WP_DEFENDER_MIN_PHP_VERSION', '8.0.0' );
65 }
66 if ( ! defined( 'WP_DEFENDER_PRO_PATH' ) ) {
67 define( 'WP_DEFENDER_PRO_PATH', 'wp-defender/wp-defender.php' );
68 }
69 if ( ! defined( 'WP_DEFENDER_PRO' ) ) {
70 define( 'WP_DEFENDER_PRO', false );
71 }
72 if ( ! defined( 'WP_DEFENDER_SUPPORT_LINK' ) ) {
73 define( 'WP_DEFENDER_SUPPORT_LINK', 'https://wpmudev.com/hub2/support/#get-support' );
74 }
75 if ( ! defined( 'WP_DEFENDER_POT_FILENAME' ) ) {
76 define( 'WP_DEFENDER_POT_FILENAME', 'defender-security.pot' );
77 }
78 if ( ! defined( 'FS_METHOD' ) ) {
79 define( 'FS_METHOD', 'direct' );
80 }
81 if ( ! defined( 'WP_DEFENDER_DOCS_LINK' ) ) {
82 define( 'WP_DEFENDER_DOCS_LINK', 'https://wpmudev.com/docs/wpmu-dev-plugins/defender/' );
83 }
84 // If PHP version is downgraded while the plugin is running, deactivate the plugin.
85 if ( version_compare( PHP_VERSION, WP_DEFENDER_MIN_PHP_VERSION, '<' ) ) {
86 if ( ! function_exists( 'is_plugin_active' ) ) {
87 include_once ABSPATH . 'wp-admin/includes/plugin.php';
88 }
89 if ( is_plugin_active( DEFENDER_PLUGIN_BASENAME ) ) {
90 deactivate_plugins( DEFENDER_PLUGIN_BASENAME );
91 return;
92 }
93 }
94
95 /**
96 * Run upgrade process.
97 *
98 * @since 2.4.6
99 */
100 if ( DEFENDER_PLUGIN_BASENAME !== plugin_basename( __FILE__ ) ) {
101 $pro_installed = file_exists( WP_PLUGIN_DIR . '/' . WP_DEFENDER_PRO_PATH );
102
103 if ( ! function_exists( 'is_plugin_active' ) ) {
104 include_once ABSPATH . 'wp-admin/includes/plugin.php';
105 }
106
107 if ( is_plugin_active( WP_DEFENDER_PRO_PATH ) ) {
108 deactivate_plugins( plugin_basename( __FILE__ ) );
109 return;
110 } elseif (
111 $pro_installed &&
112 ! defined( 'WP_UNINSTALL_PLUGIN' ) &&
113 is_plugin_active( DEFENDER_PLUGIN_BASENAME )
114 ) {
115 deactivate_plugins( DEFENDER_PLUGIN_BASENAME );
116 activate_plugin( plugin_basename( __FILE__ ) );
117 }
118 }
119
120 require_once WP_DEFENDER_DIR . 'vendor/autoload.php';
121 /**
122 * Backward compatibility: old Recaptcha controller now aliases to Captcha.
123 *
124 * @deprecated 5.8.0 Use Captcha instead.
125 */
126 if ( ! class_exists( '\\WP_Defender\\Controller\\Recaptcha', false ) ) {
127 class_alias( \WP_Defender\Controller\Captcha::class, '\\WP_Defender\\Controller\\Recaptcha' );
128 }
129
130 // Load Action Scheduler package.
131 if ( file_exists( WP_DEFENDER_DIR . 'vendor/woocommerce/action-scheduler/action-scheduler.php' ) ) {
132 add_action(
133 'plugins_loaded',
134 function () {
135 require_once WP_DEFENDER_DIR . 'vendor/woocommerce/action-scheduler/action-scheduler.php';
136 \WP_Defender\ActionScheduler_Setup::init();
137 },
138 -10 // Don't change the priority to positive number, because to load this before AS initialized.
139 );
140 }
141
142 require_once WP_DEFENDER_DIR . 'src/functions.php';
143 // Create container.
144 global $wp_defender_di;
145 $wp_defender_di = new \WP_Defender\Component\Container();
146 global $wp_defender_central;
147 $wp_defender_central = new \WP_Defender\Central();
148 do_action( 'wp_defender' );
149 // Initialize bootstrap.
150 require_once WP_DEFENDER_DIR . 'src/class-bootstrap.php';
151 $bootstrap = new \WP_Defender\Bootstrap();
152 if ( method_exists( $bootstrap, 'includes' ) ) {
153 $bootstrap->includes();
154 }
155
156 add_action( 'init', array( ( new \WP_Defender\Upgrader() ), 'run' ) );
157 add_action( 'admin_enqueue_scripts', array( $bootstrap, 'register_assets' ) );
158 add_filter( 'admin_body_class', array( $bootstrap, 'add_sui_to_body' ), 99 );
159
160 register_deactivation_hook( __FILE__, array( $bootstrap, 'deactivation_hook' ) );
161 register_activation_hook( __FILE__, array( $bootstrap, 'activation_hook' ) );
162
163 // Declare incompatibility with WooCommerce Checkout block.
164 add_action(
165 'before_woocommerce_init',
166 function () {
167 if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
168 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', WP_DEFENDER_FILE, false );
169 }
170 }
171 );
172