| @@ -1,19 +1,23 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Defender |
| 4 | 4 | * Plugin URI: https://wpmudev.com/project/wp-defender/ |
| 5 | - * Version: 3.0.1 | |
| 5 | + * Version: 6.3.0 | |
| 6 | 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 | 7 | * Author: WPMU DEV |
| 8 | 8 | * Author URI: https://wpmudev.com/ |
| 9 | 9 | * License: GNU General Public License (Version 2 - GPLv2) |
| 10 | - * Text Domain: wpdef | |
| 10 | + * Text Domain: defender-security | |
| 11 | 11 | * Network: true |
| 12 | - * Requires PHP: 7.2 | |
| 12 | + * Requires PHP: 8.0.0 | |
| 13 | + * Requires at least: 6.4 | |
| 14 | + * | |
| 15 | + * @package WP_Defender | |
| 13 | 16 | */ |
| 17 | + | |
| 14 | 18 | /* |
| 15 | -Copyright 2007-2022 Incsub (http://incsub.com) | |
| 19 | +Copyright 2007-2026 Incsub (https://incsub.com) | |
| 16 | 20 | Author - Hoang Ngo, Anton Shulga |
| 17 | 21 | |
| 18 | 22 | This program is free software; you can redistribute it and/or modify |
| 19 | 23 | it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by |
| @@ -32,15 +36,18 @@ | ||
| 32 | 36 | if ( ! defined( 'ABSPATH' ) ) { |
| 33 | 37 | die; |
| 34 | 38 | } |
| 35 | 39 | if ( ! defined( 'DEFENDER_VERSION' ) ) { |
| 36 | - define( 'DEFENDER_VERSION', '3.0.1' ); | |
| 40 | + define( 'DEFENDER_VERSION', '6.3.0' ); | |
| 37 | 41 | } |
| 42 | +if ( ! defined( 'DEFENDER_RELEASE_DATE' ) ) { | |
| 43 | + define( 'DEFENDER_RELEASE_DATE', '2026-09-22' ); | |
| 44 | +} | |
| 38 | 45 | if ( ! defined( 'DEFENDER_DB_VERSION' ) ) { |
| 39 | - define( 'DEFENDER_DB_VERSION', '3.0.1' ); | |
| 46 | + define( 'DEFENDER_DB_VERSION', '6.3.0' ); | |
| 40 | 47 | } |
| 41 | 48 | if ( ! defined( 'DEFENDER_SUI' ) ) { |
| 42 | - define( 'DEFENDER_SUI', '2-12-8' ); | |
| 49 | + define( 'DEFENDER_SUI', '2-12-24' ); | |
| 43 | 50 | } |
| 44 | 51 | if ( ! defined( 'DEFENDER_PLUGIN_BASENAME' ) ) { |
| 45 | 52 | define( 'DEFENDER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
| 46 | 53 | } |
| @@ -49,14 +56,32 @@ | ||
| 49 | 56 | } |
| 50 | 57 | if ( ! defined( 'WP_DEFENDER_FILE' ) ) { |
| 51 | 58 | define( 'WP_DEFENDER_FILE', __FILE__ ); |
| 52 | 59 | } |
| 60 | +if ( ! defined( 'WP_DEFENDER_BASE_URL' ) ) { | |
| 61 | + define( 'WP_DEFENDER_BASE_URL', plugin_dir_url( WP_DEFENDER_FILE ) ); | |
| 62 | +} | |
| 53 | 63 | if ( ! defined( 'WP_DEFENDER_MIN_PHP_VERSION' ) ) { |
| 54 | - define( 'WP_DEFENDER_MIN_PHP_VERSION', '7.2.0' ); | |
| 64 | + define( 'WP_DEFENDER_MIN_PHP_VERSION', '8.0.0' ); | |
| 55 | 65 | } |
| 56 | 66 | if ( ! defined( 'WP_DEFENDER_PRO_PATH' ) ) { |
| 57 | 67 | define( 'WP_DEFENDER_PRO_PATH', 'wp-defender/wp-defender.php' ); |
| 58 | 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 | +} | |
| 59 | 84 | // If PHP version is downgraded while the plugin is running, deactivate the plugin. |
| 60 | 85 | if ( version_compare( PHP_VERSION, WP_DEFENDER_MIN_PHP_VERSION, '<' ) ) { |
| 61 | 86 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 62 | 87 | include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| @@ -92,14 +117,24 @@ | ||
| 92 | 117 | } |
| 93 | 118 | } |
| 94 | 119 | |
| 95 | 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 | + | |
| 96 | 130 | // Load Action Scheduler package. |
| 97 | 131 | if ( file_exists( WP_DEFENDER_DIR . 'vendor/woocommerce/action-scheduler/action-scheduler.php' ) ) { |
| 98 | 132 | add_action( |
| 99 | 133 | 'plugins_loaded', |
| 100 | - function() { | |
| 134 | + function () { | |
| 101 | 135 | require_once WP_DEFENDER_DIR . 'vendor/woocommerce/action-scheduler/action-scheduler.php'; |
| 136 | + \WP_Defender\ActionScheduler_Setup::init(); | |
| 102 | 137 | }, |
| 103 | 138 | -10 // Don't change the priority to positive number, because to load this before AS initialized. |
| 104 | 139 | ); |
| 105 | 140 | } |
| @@ -105,24 +140,32 @@ | ||
| 105 | 140 | } |
| 106 | 141 | |
| 107 | 142 | require_once WP_DEFENDER_DIR . 'src/functions.php'; |
| 108 | 143 | // Create container. |
| 109 | -$builder = new \DI\ContainerBuilder(); | |
| 110 | 144 | global $wp_defender_di; |
| 111 | -$wp_defender_di = $builder->build(); | |
| 145 | +$wp_defender_di = new \WP_Defender\Component\Container(); | |
| 112 | 146 | global $wp_defender_central; |
| 113 | 147 | $wp_defender_central = new \WP_Defender\Central(); |
| 114 | 148 | do_action( 'wp_defender' ); |
| 115 | 149 | // Initialize bootstrap. |
| 116 | -require_once WP_DEFENDER_DIR . 'src/bootstrap.php'; | |
| 150 | +require_once WP_DEFENDER_DIR . 'src/class-bootstrap.php'; | |
| 117 | 151 | $bootstrap = new \WP_Defender\Bootstrap(); |
| 118 | -$bootstrap->check_if_table_exists(); | |
| 119 | 152 | if ( method_exists( $bootstrap, 'includes' ) ) { |
| 120 | 153 | $bootstrap->includes(); |
| 121 | 154 | } |
| 122 | 155 | |
| 123 | -add_action( 'init', [ ( new \WP_Defender\Upgrader() ), 'run' ] ); | |
| 124 | -add_action( 'admin_enqueue_scripts', [ $bootstrap, 'register_assets' ] ); | |
| 125 | -add_filter( 'admin_body_class', [ $bootstrap, 'add_sui_to_body' ], 99 ); | |
| 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 ); | |
| 126 | 159 | |
| 127 | -register_deactivation_hook( __FILE__, [ $bootstrap, 'deactivation_hook' ] ); | |
| 128 | -register_activation_hook( __FILE__, [ $bootstrap, 'activation_hook' ] ); | |
| 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 | +); | |