PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.6.0
Defender Security – Malware Scanner, Login Security & Firewall v5.6.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 / src / class-bootstrap.php

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

96 lines 2.8 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 $this->init_modules_common();
45 $this->init_free_dashboard();
46 }
47
48 /**
49 * Load Free Dashboard module.
50 */
51 public function init_free_dashboard(): void {
52 $file_path = defender_path( 'extra/free-dashboard/module.php' );
53 if ( file_exists( $file_path ) ) {
54 require_once $file_path;
55
56 add_filter( 'wdev_email_message_' . DEFENDER_PLUGIN_BASENAME, array( $this, 'defender_ads_message' ) );
57
58 $screen_prefix = 'defender';
59 $screen_suffix = is_multisite() ? '-network' : '';
60
61 $free_install_date = get_site_option( Rate::SLUG_FREE_INSTALL_DATE, false );
62
63 do_action(
64 'wpmudev_register_notices',
65 'defender',
66 array(
67 'basename' => DEFENDER_PLUGIN_BASENAME,
68 'title' => 'Defender',
69 'wp_slug' => 'defender-security',
70 'cta_email' => __( 'Get Secure!', 'defender-security' ),
71 'installed_on' => $free_install_date ?: time(),
72 'screens' => array(
73 'toplevel_page_wp-defender' . $screen_suffix,
74 $screen_prefix . '_page_wdf-hardener' . $screen_suffix,
75 $screen_prefix . '_page_wdf-scan' . $screen_suffix,
76 $screen_prefix . '_page_wdf-logging' . $screen_suffix,
77 $screen_prefix . '_page_wdf-ip-lockout' . $screen_suffix,
78 $screen_prefix . '_page_wdf-waf' . $screen_suffix,
79 $screen_prefix . '_page_wdf-2fa' . $screen_suffix,
80 $screen_prefix . '_page_wdf-advanced-tools' . $screen_suffix,
81 $screen_prefix . '_page_wdf-notification' . $screen_suffix,
82 $screen_prefix . '_page_wdf-setting' . $screen_suffix,
83 ),
84 )
85 );
86 }
87 }
88
89 /**
90 * @return string
91 */
92 public function defender_ads_message(): string {
93 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' );
94 }
95 }
96