PluginProbe
Simple Analytics / 1.112
Simple Analytics v1.112
1.112 1.111 1.110 1.109 1.108 1.107 1.106 1.73 1.74 1.75 1.76 1.77 1.78 1.79 1.8 1.80 1.81 1.82 1.83 1.84 1.85 1.86 1.87 1.88 1.89 All 101 releases
← All changes | src/Plugin.php +5 -7 1.106 → 1.112 View file →
@@ -35,9 +35,8 @@
35 35 public function boot(): void
36 36 {
37 37 $this->hooks->addAction('init', \Closure::fromCallable([$this, 'onInit']));
38 38 $this->hooks->onActivation(\Closure::fromCallable([$this, 'onActivation']));
39 - $this->hooks->onDeactivation(\Closure::fromCallable([$this, 'onUninstall']));
40 39
41 40 if ($this->hooks->isAdmin()) {
42 41 $this->adminPage->register();
43 42 AddPluginSettingsLink::register();
@@ -45,15 +44,18 @@
45 44 }
46 45
47 46 public function onInit(): void
48 47 {
49 - $tracking = ! $this->trackingRules->hasExcludedIp() && ! $this->trackingRules->hasExcludedUserRole();
48 + $hasExcludedIp = $this->trackingRules->hasExcludedIp();
49 + $hasExcludedUserRole = $this->trackingRules->hasExcludedUserRole();
50 + $tracking = ! $hasExcludedIp && ! $hasExcludedUserRole;
50 51
51 52 if ($tracking) {
52 53 $this->scripts->push(new AnalyticsScript);
53 54 } else {
54 55 $this->scripts->push(new InactiveScript);
55 - AddInactiveComment::register();
56 + $reason = $hasExcludedIp ? 'Exclude IP Address' : 'Exclude User Role';
57 + AddInactiveComment::register($reason);
56 58 }
57 59
58 60 if ($tracking && $this->settings->get(SettingName::NOSCRIPT)) {
59 61 AddNoScriptTag::register();
@@ -77,9 +79,5 @@
77 79 // Legacy. Update the option introduced in a previous release to use autoloading.
78 80 $this->settings->update(SettingName::CUSTOM_DOMAIN, $this->settings->get(SettingName::CUSTOM_DOMAIN), true);
79 81 }
80 82
81 - public function onUninstall(): void
82 - {
83 - foreach (SettingName::cases() as $key) $this->settings->delete($key);
84 - }
85 83 }