| @@ -99,9 +99,8 @@ | ||
| 99 | 99 | if ( $this->wpmudev->is_wpmu_hosting() ) { |
| 100 | 100 | add_action( 'init', array( $this, 'sync_state' ) ); |
| 101 | 101 | } |
| 102 | 102 | add_action( 'init', array( $this, 'handle_expired_membership' ) ); |
| 103 | - add_action( 'init', array( $this->service, 'maybe_set_notice_time' ) ); | |
| 104 | 103 | } |
| 105 | 104 | |
| 106 | 105 | /** |
| 107 | 106 | * Handle request to save settings. |
| @@ -167,13 +166,8 @@ | ||
| 167 | 166 | } |
| 168 | 167 | } |
| 169 | 168 | |
| 170 | 169 | Config_Hub_Helper::set_clear_active_flag(); |
| 171 | - | |
| 172 | - // Hide the Antibot notice on the Dashboard page. | |
| 173 | - if ( isset( $data['enabled'] ) && true === (bool) $data['enabled'] ) { | |
| 174 | - delete_site_option( Antibot_Global_Firewall_Component::NOTICE_SLUG ); | |
| 175 | - } | |
| 176 | 170 | // Maybe track. |
| 177 | 171 | if ( ! defender_is_wp_cli() && $old_enabled !== $data['enabled'] ) { |
| 178 | 172 | wd_di()->get( Antibot_Analytics::class )->track_antibot( $old_enabled, $location ); |
| 179 | 173 | } |
| @@ -212,20 +206,8 @@ | ||
| 212 | 206 | ); |
| 213 | 207 | } |
| 214 | 208 | |
| 215 | 209 | /** |
| 216 | - * Hide the Antibot notice. | |
| 217 | - * | |
| 218 | - * @return Response | |
| 219 | - * @defender_route | |
| 220 | - */ | |
| 221 | - public function hide_antibot_notice(): Response { | |
| 222 | - delete_site_option( Antibot_Global_Firewall_Component::NOTICE_SLUG ); | |
| 223 | - | |
| 224 | - return new Response( true, array() ); | |
| 225 | - } | |
| 226 | - | |
| 227 | - /** | |
| 228 | 210 | * Queue assets and require data. |
| 229 | 211 | * |
| 230 | 212 | * @return void |
| 231 | 213 | */ |
| @@ -240,23 +222,8 @@ | ||
| 240 | 222 | * |
| 241 | 223 | * @return array |
| 242 | 224 | */ |
| 243 | 225 | public function data_frontend(): array { |
| 244 | - /** | |
| 245 | - * Show the onboarding reminder notice if: | |
| 246 | - * 1. If the reminder time is set and the time difference is greater than a week. | |
| 247 | - * 2. No click on the Cross icon before. | |
| 248 | - * 3. This is not on Unlimited hosting. | |
| 249 | - */ | |
| 250 | - $is_reminder = false; | |
| 251 | - $last_reminder = (int) get_site_option( Onboard::REMINDER_KEY, 0 ); | |
| 252 | - if ( $last_reminder > 0 ) { | |
| 253 | - $time_diff = time() - $last_reminder; | |
| 254 | - if ( $time_diff > WEEK_IN_SECONDS ) { | |
| 255 | - $is_reminder = true; | |
| 256 | - } | |
| 257 | - } | |
| 258 | - | |
| 259 | 226 | $model_export = $this->model->export(); |
| 260 | 227 | $model_export['managed_by'] = $this->service->get_managed_by(); |
| 261 | 228 | $module_name = Antibot_Global_Firewall_Setting::get_module_name(); |
| 262 | 229 | |
| @@ -263,33 +230,30 @@ | ||
| 263 | 230 | return array_merge( |
| 264 | 231 | array( |
| 265 | 232 | 'model' => $model_export, |
| 266 | 233 | 'misc' => array( |
| 267 | - 'module_slug' => Antibot_Global_Firewall_Setting::get_module_slug(), | |
| 268 | - 'module_name' => $module_name, | |
| 269 | - 'show_notice' => $is_reminder | |
| 270 | - && (bool) get_site_option( Antibot_Global_Firewall_Component::NOTICE_SLUG ) | |
| 271 | - && ! defender_is_unlimited_hosting(), | |
| 272 | - 'sync_schedule' => __( 'Twice Daily', 'defender-security' ), | |
| 273 | - 'ips_count' => $this->service->get_blocklisted_ip_count(), | |
| 274 | - 'blocklist_stats_full' => $this->service->get_cached_blocklist_stats_data(), | |
| 275 | - 'frontend_is_enabled' => $this->service->frontend_is_enabled(), | |
| 276 | - 'frontend_mode' => $this->service->frontend_mode(), | |
| 277 | - 'is_active' => $this->service->is_active(), | |
| 278 | - 'show_stats_button' => ! $this->wpmudev->is_whitelabel_enabled(), | |
| 279 | - 'show_checker' => ! $this->wpmudev->is_wpmu_hosting() | |
| 234 | + 'module_slug' => Antibot_Global_Firewall_Setting::get_module_slug(), | |
| 235 | + 'module_name' => $module_name, | |
| 236 | + 'show_notice' => false, | |
| 237 | + 'sync_schedule' => __( 'Twice Daily', 'defender-security' ), | |
| 238 | + 'ips_count' => $this->service->get_blocklisted_ip_count(), | |
| 239 | + 'blocklist_stats_full' => $this->service->get_cached_blocklist_stats_data(), | |
| 240 | + 'frontend_is_enabled' => $this->service->frontend_is_enabled(), | |
| 241 | + 'frontend_mode' => $this->service->frontend_mode(), | |
| 242 | + 'is_active' => $this->service->is_active(), | |
| 243 | + 'show_stats_button' => ! $this->wpmudev->is_whitelabel_enabled(), | |
| 244 | + 'show_checker' => ! $this->wpmudev->is_wpmu_hosting() | |
| 280 | 245 | || $this->wpmudev->is_wpmu_dev_admin() |
| 281 | 246 | || ! ( $this->service->is_active_via_hosting() && $this->wpmudev->is_whitelabel_enabled() ), |
| 282 | - 'active_tooltip_text' => __( 'List of exploit attempts detected and blocked across all connected sites by AntiBot Firewall.', 'defender-security' ), | |
| 283 | - 'inactive_tooltip_text' => sprintf( | |
| 247 | + 'active_tooltip_text' => __( 'List of exploit attempts detected and blocked across all connected sites by AntiBot Firewall.', 'defender-security' ), | |
| 248 | + 'inactive_tooltip_text' => sprintf( | |
| 284 | 249 | /* translators: %s: Module name. */ |
| 285 | 250 | __( '%s is Inactive.', 'defender-security' ), |
| 286 | 251 | $module_name |
| 287 | 252 | ), |
| 288 | - 'current_user' => esc_html( wp_get_current_user()->display_name ?? __( 'User', 'defender-security' ) ), | |
| 289 | - 'is_expired_membership' => $this->is_expired_membership_type(), | |
| 290 | - 'should_show_global_notice' => $this->service->should_show_global_notice(), | |
| 291 | - 'show_antibot_options' => $this->service->get_states_of_antibot_options_for_different_hosting_types(), | |
| 253 | + 'current_user' => esc_html( wp_get_current_user()->display_name ?? __( 'User', 'defender-security' ) ), | |
| 254 | + 'is_expired_membership' => $this->is_expired_membership_type(), | |
| 255 | + 'show_antibot_options' => $this->service->get_states_of_antibot_options_for_different_hosting_types(), | |
| 292 | 256 | ), |
| 293 | 257 | ), |
| 294 | 258 | $this->dump_routes_and_nonces() |
| 295 | 259 | ); |
| @@ -382,11 +346,13 @@ | ||
| 382 | 346 | */ |
| 383 | 347 | public function remove_data() { |
| 384 | 348 | $this->service->delete_blocklist(); |
| 385 | 349 | |
| 350 | + delete_site_option( Antibot_Global_Firewall_Component::DOWNLOAD_SYNC_NEXT_RUN_OPTION ); | |
| 351 | + // Don't display Antibot global notice. We can delete slugs about this notice in the future. | |
| 386 | 352 | delete_site_option( Antibot_Global_Firewall_Component::NOTICE_SLUG ); |
| 387 | - delete_site_option( Antibot_Global_Firewall_Component::DOWNLOAD_SYNC_NEXT_RUN_OPTION ); | |
| 388 | 353 | delete_site_option( Antibot_Global_Firewall_Component::GLOBAL_NOTICE_TIME_OPTION ); |
| 354 | + // Blocklist stats data. | |
| 389 | 355 | delete_site_transient( Antibot_Global_Firewall_Component::BLOCKLIST_STATS_KEY . '_' . Antibot_Global_Firewall_Setting::MODE_BASIC ); |
| 390 | 356 | delete_site_transient( Antibot_Global_Firewall_Component::BLOCKLIST_STATS_KEY . '_' . Antibot_Global_Firewall_Setting::MODE_STRICT ); |
| 391 | 357 | delete_site_transient( Antibot_Global_Firewall_Component::BLOCKLIST_STATS_FULL_KEY ); |
| 392 | 358 | delete_site_transient( Antibot_Global_Firewall_Component::IS_SWITCHING_TO_PLUGIN_IN_PROGRESS ); |
| @@ -752,10 +718,8 @@ | ||
| 752 | 718 | 'Feedback' => $data['feedback'], |
| 753 | 719 | ) |
| 754 | 720 | ); |
| 755 | 721 | } |
| 756 | - // Dismiss the global notice. | |
| 757 | - $this->service->dismiss_global_notice(); | |
| 758 | 722 | |
| 759 | 723 | $message = sprintf( |
| 760 | 724 | /* translators: 1: Open tag, 2: Close tag */ |
| 761 | 725 | __( '%1$sThanks for your feedback!%2$s It helps us make Defender even better.', 'defender-security' ), |
| @@ -767,27 +731,8 @@ | ||
| 767 | 731 | true, |
| 768 | 732 | array( |
| 769 | 733 | 'message' => $message, |
| 770 | 734 | 'auto_close' => true, |
| 771 | - ) | |
| 772 | - ); | |
| 773 | - } | |
| 774 | - | |
| 775 | - /** | |
| 776 | - * Dismiss the global notice. | |
| 777 | - * | |
| 778 | - * @defender_route | |
| 779 | - * @return Response | |
| 780 | - */ | |
| 781 | - public function dismiss_global_notice(): Response { | |
| 782 | - $this->service->dismiss_global_notice(); | |
| 783 | - | |
| 784 | - return new Response( | |
| 785 | - true, | |
| 786 | - array( | |
| 787 | - 'message' => __( 'The global notice has been dismissed.', 'defender-security' ), | |
| 788 | - 'success' => true, | |
| 789 | - 'show_notice' => false, | |
| 790 | 735 | ) |
| 791 | 736 | ); |
| 792 | 737 | } |
| 793 | 738 | } |