PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.4.0
Defender Security – Malware Scanner, Login Security & Firewall v5.4.0
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 5.4.0, at wp-defender.php

161 lines 5.4 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: 5.4.0
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: 7.4
13 * Requires at least: 6.4
14 *
15 * @package WP_Defender
16 */
17
18 /*
19 Copyright 2007-2025 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', '5.4.0' );
41 }
42 if ( ! defined( 'DEFENDER_DB_VERSION' ) ) {
43 define( 'DEFENDER_DB_VERSION', '5.4.0' );
44 }
45 if ( ! defined( 'DEFENDER_SUI' ) ) {
46 define( 'DEFENDER_SUI', '2-12-24' );
47 }
48 if ( ! defined( 'DEFENDER_PLUGIN_BASENAME' ) ) {
49 define( 'DEFENDER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
50 }
51 if ( ! defined( 'WP_DEFENDER_DIR' ) ) {
52 define( 'WP_DEFENDER_DIR', plugin_dir_path( __FILE__ ) );
53 }
54 if ( ! defined( 'WP_DEFENDER_FILE' ) ) {
55 define( 'WP_DEFENDER_FILE', __FILE__ );
56 }
57 if ( ! defined( 'WP_DEFENDER_BASE_URL' ) ) {
58 define( 'WP_DEFENDER_BASE_URL', plugin_dir_url( WP_DEFENDER_FILE ) );
59 }
60 if ( ! defined( 'WP_DEFENDER_MIN_PHP_VERSION' ) ) {
61 define( 'WP_DEFENDER_MIN_PHP_VERSION', '7.4' );
62 }
63 if ( ! defined( 'WP_DEFENDER_PRO_PATH' ) ) {
64 define( 'WP_DEFENDER_PRO_PATH', 'wp-defender/wp-defender.php' );
65 }
66 if ( ! defined( 'WP_DEFENDER_PRO' ) ) {
67 define( 'WP_DEFENDER_PRO', false );
68 }
69 if ( ! defined( 'WP_DEFENDER_SUPPORT_LINK' ) ) {
70 define( 'WP_DEFENDER_SUPPORT_LINK', 'https://wpmudev.com/hub2/support/#get-support' );
71 }
72 if ( ! defined( 'WP_DEFENDER_POT_FILENAME' ) ) {
73 define( 'WP_DEFENDER_POT_FILENAME', 'defender-security.pot' );
74 }
75 if ( ! defined( 'FS_METHOD' ) ) {
76 define( 'FS_METHOD', 'direct' );
77 }
78 if ( ! defined( 'WP_DEFENDER_DOCS_LINK' ) ) {
79 define( 'WP_DEFENDER_DOCS_LINK', 'https://wpmudev.com/docs/wpmu-dev-plugins/defender/' );
80 }
81 // If PHP version is downgraded while the plugin is running, deactivate the plugin.
82 if ( version_compare( PHP_VERSION, WP_DEFENDER_MIN_PHP_VERSION, '<' ) ) {
83 if ( ! function_exists( 'is_plugin_active' ) ) {
84 include_once ABSPATH . 'wp-admin/includes/plugin.php';
85 }
86 if ( is_plugin_active( DEFENDER_PLUGIN_BASENAME ) ) {
87 deactivate_plugins( DEFENDER_PLUGIN_BASENAME );
88 return;
89 }
90 }
91
92 /**
93 * Run upgrade process.
94 *
95 * @since 2.4.6
96 */
97 if ( DEFENDER_PLUGIN_BASENAME !== plugin_basename( __FILE__ ) ) {
98 $pro_installed = file_exists( WP_PLUGIN_DIR . '/' . WP_DEFENDER_PRO_PATH );
99
100 if ( ! function_exists( 'is_plugin_active' ) ) {
101 include_once ABSPATH . 'wp-admin/includes/plugin.php';
102 }
103
104 if ( is_plugin_active( WP_DEFENDER_PRO_PATH ) ) {
105 deactivate_plugins( plugin_basename( __FILE__ ) );
106 return;
107 } elseif (
108 $pro_installed &&
109 ! defined( 'WP_UNINSTALL_PLUGIN' ) &&
110 is_plugin_active( DEFENDER_PLUGIN_BASENAME )
111 ) {
112 deactivate_plugins( DEFENDER_PLUGIN_BASENAME );
113 activate_plugin( plugin_basename( __FILE__ ) );
114 }
115 }
116
117 require_once WP_DEFENDER_DIR . 'vendor/autoload.php';
118 // Load Action Scheduler package.
119 if ( file_exists( WP_DEFENDER_DIR . 'vendor/woocommerce/action-scheduler/action-scheduler.php' ) ) {
120 add_action(
121 'plugins_loaded',
122 function () {
123 require_once WP_DEFENDER_DIR . 'vendor/woocommerce/action-scheduler/action-scheduler.php';
124 \WP_Defender\ActionScheduler_Setup::init();
125 },
126 -10 // Don't change the priority to positive number, because to load this before AS initialized.
127 );
128 }
129
130 require_once WP_DEFENDER_DIR . 'src/functions.php';
131 // Create container.
132 $builder = new \WPMU_DEV\Defender\Vendor\DI\ContainerBuilder();
133 global $wp_defender_di;
134 $wp_defender_di = $builder->build();
135 global $wp_defender_central;
136 $wp_defender_central = new \WP_Defender\Central();
137 do_action( 'wp_defender' );
138 // Initialize bootstrap.
139 require_once WP_DEFENDER_DIR . 'src/class-bootstrap.php';
140 $bootstrap = new \WP_Defender\Bootstrap();
141 if ( method_exists( $bootstrap, 'includes' ) ) {
142 $bootstrap->includes();
143 }
144
145 add_action( 'init', array( ( new \WP_Defender\Upgrader() ), 'run' ) );
146 add_action( 'admin_enqueue_scripts', array( $bootstrap, 'register_assets' ) );
147 add_filter( 'admin_body_class', array( $bootstrap, 'add_sui_to_body' ), 99 );
148
149 register_deactivation_hook( __FILE__, array( $bootstrap, 'deactivation_hook' ) );
150 register_activation_hook( __FILE__, array( $bootstrap, 'activation_hook' ) );
151
152 // Declare incompatibility with WooCommerce Checkout block.
153 add_action(
154 'before_woocommerce_init',
155 function () {
156 if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
157 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', WP_DEFENDER_FILE, false );
158 }
159 }
160 );
161