PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.3.0
Adminify – White Label, Admin Menu Editor, Login Customizer v4.3.0
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.3.0, at Inc/Classes/Notifications/Upgrade_Notice.php

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