PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.4.0
Defender Security – Malware Scanner, Login Security & Firewall v5.4.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 / helper / analytics / class-antibot.php

class-antibot.php in Defender Security – Malware Scanner, Login Security & Firewall 5.4.0, at src/helper/analytics/class-antibot.php

92 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Responsible for gathering analytics data for the AntiBot feature.
4 *
5 * @package WP_Defender\Helper\Analytics
6 */
7
8 namespace WP_Defender\Helper\Analytics;
9
10 use WP_Defender\Event;
11 use WP_Defender\Traits\Defender_Dashboard_Client;
12 use WP_Defender\Component\IP\Antibot_Global_Firewall;
13 use WP_Defender\Model\Setting\Antibot_Global_Firewall_Setting;
14
15 /**
16 * Gather analytics data required for AntiBot feature.
17 */
18 class Antibot extends Event {
19 use Defender_Dashboard_Client;
20
21 /**
22 * Provides data for the frontend.
23 *
24 * @return array An array of data for the frontend.
25 */
26 public function data_frontend(): array {
27 return array();
28 }
29
30 /**
31 * Converts the current state of the object to an array.
32 *
33 * @return array Returns an associative array of object properties.
34 */
35 public function to_array(): array {
36 return array();
37 }
38
39 /**
40 * Imports data into the model.
41 *
42 * @param array $data Data to be imported into the model.
43 */
44 public function import_data( array $data ) {
45 }
46
47 /**
48 * Removes settings for all submodules.
49 */
50 public function remove_settings() {
51 }
52
53 /**
54 * Delete all the data & the cache.
55 */
56 public function remove_data() {
57 }
58
59 /**
60 * Exports strings.
61 */
62 public function export_strings() {
63 }
64 // End.
65
66 /**
67 * Track feature.
68 *
69 * @param bool $enabled Feature is enabled or not.
70 * @param string $location Options: Feature Page, Dashboard, Onboarding, Hub and Welcome-modal.
71 *
72 * @return void
73 */
74 public function track_antibot( bool $enabled, string $location ) {
75 $event = $enabled ? 'def_antibot_deactivated' : 'def_antibot_activated';
76 $data = array(
77 'Triggered From' => $location,
78 'State' => 'plugin' === wd_di()->get( Antibot_Global_Firewall::class )->get_managed_by()
79 ? 'Managed by Defender Plugin'
80 : 'Managed by WPMU DEV Hosting',
81 'Mode' => wd_di()->get( Antibot_Global_Firewall_Setting::class )->get_mode_label(),
82 );
83 if ( 'Hub' !== $location ) {
84 $data['Connection Method'] = $this->is_dash_activated()
85 ? 'Dashboard Plugin'
86 : 'Hub Connector';
87 }
88
89 $this->track_feature( $event, $data );
90 }
91 }
92