PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / trunk
Defender Security – Malware Scanner, Login Security & Firewall vtrunk
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 3.1.1 All 140 releases
defender-security / src / class-bootstrap.php

class-bootstrap.php in Defender Security – Malware Scanner, Login Security & Firewall trunk, at src/class-bootstrap.php

56 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WP_Defender;
4
5 use WP_Defender\Traits\Defender_Bootstrap;
6 use WP_Defender\Component\Rate;
7
8 /**
9 * Class Bootstrap
10 *
11 * @package WP_Defender
12 */
13 class Bootstrap {
14 use Defender_Bootstrap;
15
16 /**
17 * Activation.
18 */
19 public function activation_hook(): void {
20 $this->activation_hook_common();
21 $this->set_free_installation_timestamp();
22 }
23
24 /**
25 * Add option with plugin install date.
26 *
27 * @since 2.4
28 */
29 protected function set_free_installation_timestamp(): void {
30 // Let's equate the plugin installation and postponed notice dates. This will simplify future checks.
31 $install_date = (int) get_site_option( Rate::SLUG_FREE_INSTALL_DATE, 0 );
32 if ( 0 === $install_date ) {
33 update_site_option( Rate::SLUG_FREE_INSTALL_DATE, time() );
34 update_site_option( Rate::SLUG_POSTPONED_NOTICE_DATE, time() );
35 } else {
36 update_site_option( Rate::SLUG_POSTPONED_NOTICE_DATE, $install_date );
37 }
38 }
39
40 /**
41 * Load all modules.
42 */
43 public function init_modules(): void {
44 add_action( 'admin_init', array( $this, 'maybe_redirect_after_activation' ), 1 );
45 $this->init_modules_common();
46 }
47
48 /**
49 * Deactivation clears only free version cron hooks.
50 */
51 public function deactivation_hook(): void {
52 $this->deactivation_hook_common();
53 wp_clear_scheduled_hook( 'audit_clean_up_logs' );
54 }
55 }
56