PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 3.8.2
WP STAGING – WordPress Backup, Restore, Migration & Clone v3.8.2
4.9.2 4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Framework / Notices / DismissNotice.php
wp-staging / Framework / Notices Last commit date
BackupPluginsNotice.php 2 years ago BooleanNotice.php 2 years ago DisabledItemsNotice.php 2 years ago DismissNotice.php 2 years ago FreeBackupUpdateNotice.php 2 years ago Notices.php 2 years ago NoticesHandler.php 2 years ago ObjectCacheNotice.php 2 years ago OutdatedWpStagingNotice.php 3 years ago WarningsNotice.php 2 years ago
DismissNotice.php
86 lines
1 <?php
2
3 namespace WPStaging\Framework\Notices;
4
5 use WPStaging\Core\WPStaging;
6 use WPStaging\Framework\ThirdParty\WordFence;
7 use WPStaging\Pro\Notices\DismissNotice as DismissProNotice;
8
9 /**
10 * Dismiss notice depending upon post request
11 */
12 class DismissNotice
13 {
14 /**
15 * @var DisabledItemsNotice
16 */
17 private $disabledItemsNotice;
18
19 /**
20 * @var WarningsNotice
21 */
22 private $warningsNotice;
23
24 /**
25 * @var WordFence
26 */
27 private $wordFence;
28
29 /**
30 * @var ObjectCacheNotice
31 */
32 private $objectCacheNotice;
33
34 /**
35 * @var FreeBackupUpdateNotice
36 */
37 private $freeBackupUpdateNotice;
38
39 public function __construct(DisabledItemsNotice $disabledItemsNotice, WarningsNotice $warningsNotice, WordFence $wordFence, ObjectCacheNotice $objectCacheNotice, FreeBackupUpdateNotice $freeBackupUpdateNotice)
40 {
41 $this->disabledItemsNotice = $disabledItemsNotice;
42 $this->warningsNotice = $warningsNotice;
43 $this->wordFence = $wordFence;
44 $this->objectCacheNotice = $objectCacheNotice;
45 $this->freeBackupUpdateNotice = $freeBackupUpdateNotice;
46 }
47
48 public function dismiss($noticeToDismiss)
49 {
50 if ($noticeToDismiss === 'disabled_items' && $this->disabledItemsNotice->disable() !== false) {
51 wp_send_json(true);
52 return;
53 }
54
55 if ($noticeToDismiss === 'warnings_notice' && $this->warningsNotice->disable() !== false) {
56 wp_send_json(true);
57 return;
58 }
59
60 // Dismiss wordfence user.ini renamed notice
61 if ($noticeToDismiss === WordFence::NOTICE_NAME && $this->wordFence->disable() !== false) {
62 wp_send_json(true);
63 return;
64 }
65
66 if ($noticeToDismiss === ObjectCacheNotice::NOTICE_DISMISS_ACTION && $this->objectCacheNotice->disable() !== false) {
67 wp_send_json(true);
68 return;
69 }
70
71 if ($noticeToDismiss === FreeBackupUpdateNotice::OPTION_NAME_FREE_BACKUP_NOTICE_DISMISSED && $this->freeBackupUpdateNotice->disable() !== false) {
72 wp_send_json(true);
73 return;
74 }
75
76 if (!WPStaging::isPro()) {
77 wp_send_json(null);
78 return;
79 }
80
81 /** @var DismissProNotice $dismissProNotice */
82 $dismissProNotice = WPStaging::make(DismissProNotice::class);
83 $dismissProNotice->dismiss($noticeToDismiss);
84 }
85 }
86