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

132 lines 4.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: 3.1.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: wpdef
11 * Network: true
12 * Requires PHP: 7.2
13 */
14 /*
15 Copyright 2007-2022 Incsub (https://incsub.com)
16 Author - Hoang Ngo, Anton Shulga
17
18 This program is free software; you can redistribute it and/or modify
19 it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by
20 the Free Software Foundation.
21
22 This program is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 GNU General Public License for more details.
26
27 You should have received a copy of the GNU General Public License
28 along with this program; if not, write to the Free Software
29 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 */
31
32 if ( ! defined( 'ABSPATH' ) ) {
33 die;
34 }
35 if ( ! defined( 'DEFENDER_VERSION' ) ) {
36 define( 'DEFENDER_VERSION', '3.1.0' );
37 }
38 if ( ! defined( 'DEFENDER_DB_VERSION' ) ) {
39 define( 'DEFENDER_DB_VERSION', '3.1.0' );
40 }
41 if ( ! defined( 'DEFENDER_SUI' ) ) {
42 define( 'DEFENDER_SUI', '2-12-8' );
43 }
44 if ( ! defined( 'DEFENDER_PLUGIN_BASENAME' ) ) {
45 define( 'DEFENDER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
46 }
47 if ( ! defined( 'WP_DEFENDER_DIR' ) ) {
48 define( 'WP_DEFENDER_DIR', plugin_dir_path( __FILE__ ) );
49 }
50 if ( ! defined( 'WP_DEFENDER_FILE' ) ) {
51 define( 'WP_DEFENDER_FILE', __FILE__ );
52 }
53 if ( ! defined( 'WP_DEFENDER_MIN_PHP_VERSION' ) ) {
54 define( 'WP_DEFENDER_MIN_PHP_VERSION', '7.2.0' );
55 }
56 if ( ! defined( 'WP_DEFENDER_PRO_PATH' ) ) {
57 define( 'WP_DEFENDER_PRO_PATH', 'wp-defender/wp-defender.php' );
58 }
59 if ( ! defined( 'WP_DEFENDER_PRO' ) ) {
60 define( 'WP_DEFENDER_PRO', false );
61 }
62 // If PHP version is downgraded while the plugin is running, deactivate the plugin.
63 if ( version_compare( PHP_VERSION, WP_DEFENDER_MIN_PHP_VERSION, '<' ) ) {
64 if ( ! function_exists( 'is_plugin_active' ) ) {
65 include_once ABSPATH . 'wp-admin/includes/plugin.php';
66 }
67 if ( is_plugin_active( DEFENDER_PLUGIN_BASENAME ) ) {
68 deactivate_plugins( DEFENDER_PLUGIN_BASENAME );
69 return;
70 }
71 }
72
73 /**
74 * Run upgrade process.
75 *
76 * @since 2.4.6
77 */
78 if ( DEFENDER_PLUGIN_BASENAME !== plugin_basename( __FILE__ ) ) {
79 $pro_installed = file_exists( WP_PLUGIN_DIR . '/' . WP_DEFENDER_PRO_PATH );
80
81 if ( ! function_exists( 'is_plugin_active' ) ) {
82 include_once ABSPATH . 'wp-admin/includes/plugin.php';
83 }
84
85 if ( is_plugin_active( WP_DEFENDER_PRO_PATH ) ) {
86 deactivate_plugins( plugin_basename( __FILE__ ) );
87 return;
88 } elseif (
89 $pro_installed &&
90 ! defined( 'WP_UNINSTALL_PLUGIN' ) &&
91 is_plugin_active( DEFENDER_PLUGIN_BASENAME )
92 ) {
93 deactivate_plugins( DEFENDER_PLUGIN_BASENAME );
94 activate_plugin( plugin_basename( __FILE__ ) );
95 }
96 }
97
98 require_once WP_DEFENDER_DIR . 'vendor/autoload.php';
99 // Load Action Scheduler package.
100 if ( file_exists( WP_DEFENDER_DIR . 'vendor/woocommerce/action-scheduler/action-scheduler.php' ) ) {
101 add_action(
102 'plugins_loaded',
103 function() {
104 require_once WP_DEFENDER_DIR . 'vendor/woocommerce/action-scheduler/action-scheduler.php';
105 },
106 -10 // Don't change the priority to positive number, because to load this before AS initialized.
107 );
108 }
109
110 require_once WP_DEFENDER_DIR . 'src/functions.php';
111 // Create container.
112 $builder = new \DI\ContainerBuilder();
113 global $wp_defender_di;
114 $wp_defender_di = $builder->build();
115 global $wp_defender_central;
116 $wp_defender_central = new \WP_Defender\Central();
117 do_action( 'wp_defender' );
118 // Initialize bootstrap.
119 require_once WP_DEFENDER_DIR . 'src/bootstrap.php';
120 $bootstrap = new \WP_Defender\Bootstrap();
121 $bootstrap->check_if_table_exists();
122 if ( method_exists( $bootstrap, 'includes' ) ) {
123 $bootstrap->includes();
124 }
125
126 add_action( 'init', [ ( new \WP_Defender\Upgrader() ), 'run' ] );
127 add_action( 'admin_enqueue_scripts', [ $bootstrap, 'register_assets' ] );
128 add_filter( 'admin_body_class', [ $bootstrap, 'add_sui_to_body' ], 99 );
129
130 register_deactivation_hook( __FILE__, [ $bootstrap, 'deactivation_hook' ] );
131 register_activation_hook( __FILE__, [ $bootstrap, 'activation_hook' ] );
132