| @@ -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 | } |