Anonymizer.php
4 weeks ago
ConsentManager.php
4 weeks ago
ConsentNoticeService.php
4 weeks ago
HttpClient.php
4 weeks ago
NoticeManager.php
4 weeks ago
UsageTracker.php
4 weeks ago
NoticeManager.php
36 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AmeliaVendor\Melograno\UsageTracker\Core; |
| 6 | |
| 7 | class NoticeManager |
| 8 | { |
| 9 | private string $optionName; |
| 10 | |
| 11 | public function __construct(string $optionName) |
| 12 | { |
| 13 | $this->optionName = $optionName; |
| 14 | } |
| 15 | |
| 16 | public function isArmed(): bool |
| 17 | { |
| 18 | return get_option($this->optionName) === 'yes'; |
| 19 | } |
| 20 | |
| 21 | public function arm(): void |
| 22 | { |
| 23 | update_option($this->optionName, 'yes', true); |
| 24 | } |
| 25 | |
| 26 | public function dismiss(): void |
| 27 | { |
| 28 | update_option($this->optionName, 'no', true); |
| 29 | } |
| 30 | |
| 31 | public function delete(): void |
| 32 | { |
| 33 | delete_option($this->optionName); |
| 34 | } |
| 35 | } |
| 36 |