PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 3.3.2
WP STAGING – WordPress Backup, Restore, Migration & Clone v3.3.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 / Basic / Notices / BasicNotices.php
wp-staging / Basic / Notices Last commit date
BasicNotices.php 2 years ago RatingNotice.php 2 years ago
BasicNotices.php
79 lines
1 <?php
2
3 namespace WPStaging\Basic\Notices;
4
5 use Exception;
6 use WPStaging\Basic\Ajax\ProCronsCleaner;
7 use WPStaging\Core\WPStaging;
8 use WPStaging\Framework\Assets\Assets;
9 use WPStaging\Framework\Notices\FreeBackupUpdateNotice;
10 use WPStaging\Framework\Notices\Notices;
11 use WPStaging\Framework\Traits\NoticesTrait;
12
13 class BasicNotices
14 {
15 use NoticesTrait;
16
17 /** @var bool */
18 private $showAllNotices;
19
20 /** @var RatingNotice */
21 private $ratingNotice;
22
23 /** @var ProCronsCleaner */
24 private $proCronsCleaner;
25
26 /** @var Assets */
27 private $assets;
28
29 /**
30 * @var FreeBackupUpdateNotice
31 */
32 private $freeBackupUpdateNotice;
33
34 public function __construct(Assets $assets, RatingNotice $ratingNotice, ProCronsCleaner $proCronsCleaner, FreeBackupUpdateNotice $freeBackupUpdateNotice)
35 {
36 $this->showAllNotices = Notices::SHOW_ALL_NOTICES;
37 $this->noticesViewPath = trailingslashit($this->getPluginPath()) . "Backend/views/notices/";
38 $this->assets = $assets;
39 $this->ratingNotice = $ratingNotice;
40 $this->proCronsCleaner = $proCronsCleaner;
41 $this->freeBackupUpdateNotice = $freeBackupUpdateNotice;
42 }
43
44 /**
45 * Load admin notices for FREE version only
46 * @throws Exception
47 */
48 public function renderNotices()
49 {
50 $viewsNoticesPath = $this->noticesViewPath;
51
52 // Only show below notices on WP Staging admin pages
53 if (!$this->isWPStagingAdminPage()) {
54 return;
55 }
56
57 // Show notice "rate the plugin"
58 // We used to have this message on all pages but added a new nonce based authentication check.
59 // As the nonce is not loaded on all pages we had to move this message to wp staging pages only.
60 // @todo add our nonce to all wp staging pages and move this message back to all pages
61 if ($this->showAllNotices || $this->ratingNotice->shouldShowRatingNotice()) {
62 require_once "{$viewsNoticesPath}rating.php";
63 }
64
65 if ($this->showAllNotices || $this->proCronsCleaner->haveProCrons()) {
66 require_once "{$viewsNoticesPath}pro-crons-notice.php";
67 }
68
69 // Show notice WP STAGING is not tested with current WordPress version
70 if ($this->showAllNotices || version_compare(WPStaging::getInstance()->get('WPSTG_COMPATIBLE'), get_bloginfo("version"), "<")) {
71 require_once "{$viewsNoticesPath}wp-version-compatible-message.php";
72 }
73
74 if ($this->showAllNotices || $this->freeBackupUpdateNotice->isEnabled()) {
75 require_once "{$viewsNoticesPath}free-backup-update-notice.php";
76 }
77 }
78 }
79