| @@ -40,73 +40,17 @@ | ||
| 40 | 40 | /** |
| 41 | 41 | * Load all modules. |
| 42 | 42 | */ |
| 43 | 43 | public function init_modules(): void { |
| 44 | + add_action( 'admin_init', array( $this, 'maybe_redirect_after_activation' ), 1 ); | |
| 44 | 45 | $this->init_modules_common(); |
| 45 | - $this->init_free_dashboard(); | |
| 46 | - $this->init_black_friday(); | |
| 47 | 46 | } |
| 48 | 47 | |
| 49 | 48 | /** |
| 50 | - * Load Free Dashboard module. | |
| 49 | + * Deactivation clears only free version cron hooks. | |
| 51 | 50 | */ |
| 52 | - public function init_free_dashboard(): void { | |
| 53 | - $file_path = defender_path( 'extra/free-dashboard/module.php' ); | |
| 54 | - if ( file_exists( $file_path ) ) { | |
| 55 | - require_once $file_path; | |
| 56 | - | |
| 57 | - add_filter( 'wdev_email_message_' . DEFENDER_PLUGIN_BASENAME, array( $this, 'defender_ads_message' ) ); | |
| 58 | - | |
| 59 | - $screen_prefix = 'defender'; | |
| 60 | - $screen_suffix = is_multisite() ? '-network' : ''; | |
| 61 | - | |
| 62 | - $free_install_date = get_site_option( Rate::SLUG_FREE_INSTALL_DATE, false ); | |
| 63 | - | |
| 64 | - do_action( | |
| 65 | - 'wpmudev_register_notices', | |
| 66 | - 'defender', | |
| 67 | - array( | |
| 68 | - 'basename' => DEFENDER_PLUGIN_BASENAME, | |
| 69 | - 'title' => 'Defender', | |
| 70 | - 'wp_slug' => 'defender-security', | |
| 71 | - 'cta_email' => __( 'Get Secure!', 'defender-security' ), | |
| 72 | - 'installed_on' => $free_install_date ?: time(), | |
| 73 | - 'screens' => array( | |
| 74 | - 'toplevel_page_wp-defender' . $screen_suffix, | |
| 75 | - $screen_prefix . '_page_wdf-hardener' . $screen_suffix, | |
| 76 | - $screen_prefix . '_page_wdf-scan' . $screen_suffix, | |
| 77 | - $screen_prefix . '_page_wdf-logging' . $screen_suffix, | |
| 78 | - $screen_prefix . '_page_wdf-ip-lockout' . $screen_suffix, | |
| 79 | - $screen_prefix . '_page_wdf-waf' . $screen_suffix, | |
| 80 | - $screen_prefix . '_page_wdf-2fa' . $screen_suffix, | |
| 81 | - $screen_prefix . '_page_wdf-advanced-tools' . $screen_suffix, | |
| 82 | - $screen_prefix . '_page_wdf-notification' . $screen_suffix, | |
| 83 | - $screen_prefix . '_page_wdf-setting' . $screen_suffix, | |
| 84 | - ), | |
| 85 | - ) | |
| 86 | - ); | |
| 87 | - } | |
| 88 | - } | |
| 89 | - | |
| 90 | - /** | |
| 91 | - * Load the black friday module. | |
| 92 | - * | |
| 93 | - * @return void | |
| 94 | - * @since 5.6.2 | |
| 95 | - */ | |
| 96 | - public function init_black_friday(): void { | |
| 97 | - if ( ! class_exists( '\WPMUDEV\Modules\BlackFriday\Campaign' ) ) { | |
| 98 | - $file_path = defender_path( 'extra/wpmudev-black-friday/campaign.php' ); | |
| 99 | - if ( file_exists( $file_path ) ) { | |
| 100 | - require_once $file_path; | |
| 101 | - new \WPMUDEV\Modules\BlackFriday\Campaign(); | |
| 102 | - } | |
| 103 | - } | |
| 104 | - } | |
| 105 | - | |
| 106 | - /** | |
| 107 | - * @return string | |
| 108 | - */ | |
| 109 | - public function defender_ads_message(): string { | |
| 110 | - return __( "You're awesome for installing Defender! Are you interested in how to make the most of this plugin? We've collected all the best security resources we know in a single email - just for users of Defender!", 'defender-security' ); | |
| 51 | + public function deactivation_hook(): void { | |
| 52 | + $this->deactivation_hook_common(); | |
| 53 | + wp_clear_scheduled_hook( 'audit_clean_up_logs' ); | |
| 54 | + wp_clear_scheduled_hook( 'wpdef_quarantine_delete_expired' ); | |
| 111 | 55 | } |
| 112 | 56 | } |