PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.1.3
Adminify – White Label, Admin Menu Editor, Login Customizer v4.1.3
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Classes / Notifications / Upgrade_Notice.php

Upgrade_Notice.php in Adminify – White Label, Admin Menu Editor, Login Customizer 4.1.3, at Inc/Classes/Notifications/Upgrade_Notice.php

113 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WPAdminify\Inc\Classes\Notifications;
3
4 use WPAdminify\Inc\Classes\Notifications\Model\Popup;
5 use WPAdminify\Inc\Classes\Pro_Upgrade;
6 use WPAdminify\Inc\Classes\Helper;
7
8 if ( ! class_exists( 'Upgrade_Notice' ) ) {
9 /**
10 * Upgrade notice class
11 *
12 * Jewel Theme <support@jeweltheme.com>
13 */
14 class Upgrade_Notice extends Popup {
15
16
17 protected $data = array();
18
19 /**
20 * Constructor method
21 */
22 public function __construct() {
23 $this->init_data();
24
25 // On sheet data update, remove the popup data, to auto rebuid the data.
26 add_action(
27 'jltwp_adminify_sheet_promo_data_reset',
28 function () {
29 $this->delete();
30 }
31 );
32
33 if ( ! empty( $this->data ) ) {
34 parent::__construct();
35 }
36 }
37
38 /**
39 * Get Contents
40 *
41 * @param [type] $key .
42 *
43 * @author Jewel Theme <support@jeweltheme.com>
44 */
45 public function get_content( $key ) {
46 return $this->data[ $key ];
47 }
48
49 /**
50 * Set Intervals
51 *
52 * @author Jewel Theme <support@jeweltheme.com>
53 */
54 public function intervals() {
55 $end_date = $this->get_content( 'end_date' );
56 $end_offset = $this->date_diff( $end_date );
57
58 if ( $end_offset < 0 ) {
59 return array();
60 } // Already Expired .
61
62 if ( 0 === $end_offset ) {
63 return array( 0 );
64 } // Only Today is Left .
65
66 $intervals = array();
67
68 $start_date = $this->get_content( 'start_date' );
69 $start_offset = $this->date_diff( $start_date );
70
71 // Start Done .
72 $start = $start_offset <= 0 ? 0 : abs( $start_offset );
73 $intervals[] = $start;
74
75 // End Calculated .
76 $end = $end_offset - $start;
77
78 // Middle Done .
79 if ( $end > 3 ) {
80 $middle = round( $end / 2 );
81 $end = $end - $middle;
82 $intervals[] = $middle;
83 }
84
85 // End Done .
86 if ( $end > 0 ) {
87 $intervals[] = $end;
88 }
89
90 return $intervals;
91 }
92
93 /**
94 * Init Data
95 *
96 * @author Jewel Theme <support@jeweltheme.com>
97 */
98 public function init_data() {
99 $sheet_data = Pro_Upgrade::get_data();
100
101 if ( empty( $sheet_data ) ) {
102 return;
103 }
104
105 $today = $this->current_time();
106
107 $this->data = Helper::get_merged_data( $sheet_data, $today, $this->date_increment( $today, 10 ) );
108
109 $this->is_active = wp_validate_boolean( $this->data['is_campaign'] );
110 }
111 }
112 }
113