PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.7
GiveWP – Donation Plugin and Fundraising Platform v4.16.7
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / DonorDashboards / Admin / UpgradeNotice.php
UpgradeNotice.php
85 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\DonorDashboards\Admin;
4
5 class UpgradeNotice
6 {
7
8 /**
9 * Register upgrade notice
10 *
11 * @since 2.10.0
12 * @return void
13 *
14 */
15 public function register()
16 {
17 if ($this->shouldRenderOutput()) {
18 $this->renderOutput();
19 }
20 }
21
22 /**
23 * Return true if notice should be rendered, false if not
24 *
25 * @since 2.10.0
26 * @return boolean
27 *
28 */
29 protected function shouldRenderOutput()
30 {
31 if ( ! give_is_admin_page()) {
32 return false;
33 }
34
35 $donorDashboardPageIsSet = ! empty(give_get_option('donor_dashboard_page')) && get_post_status(
36 give_get_option('donor_dashboard_page')
37 );
38 $historyPageIsSet = ! empty(give_get_option('history_page'));
39
40 return ! $donorDashboardPageIsSet && $historyPageIsSet;
41 }
42
43 /**
44 * Render notice output
45 *
46 * @since 2.10.0
47 * @return void
48 *
49 */
50 protected function renderOutput()
51 {
52 echo $this->getOutput();
53 }
54
55 /**
56 * Get notice output
57 *
58 * @since 2.10.0
59 * @return string
60 *
61 */
62 protected function getOutput()
63 {
64 ob_start();
65 $output = '';
66 require $this->getTemplatePath();
67 $output = ob_get_contents();
68 ob_end_clean();
69
70 return $output;
71 }
72
73 /**
74 * Get template path for notice output
75 *
76 * @since 2.10.0
77 * @return string
78 *
79 */
80 protected function getTemplatePath()
81 {
82 return GIVE_PLUGIN_DIR . '/src/DonorDashboards/resources/views/upgradenotice.php';
83 }
84 }
85