# adminify/4.0.5.4/Inc/Classes/Notifications/Upgrade_Notice.php

Adminify – White Label, Admin Menu Editor, Login Customizer, version 4.0.5.4. 113 lines.

- Page: https://pluginprobe.com/plugins/adminify/4.0.5.4/code/Inc/Classes/Notifications/Upgrade_Notice.php
- Raw: https://pluginprobe.com/plugins/adminify/4.0.5.4/raw/Inc/Classes/Notifications/Upgrade_Notice.php
- Modified: 2023-11-01T08:36:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/adminify/4.0.5.4/code/Inc/Classes/Notifications/Upgrade_Notice.php#L10-L20`.

```php
<?php
namespace WPAdminify\Inc\Classes\Notifications;

use WPAdminify\Inc\Classes\Notifications\Model\Popup;
use WPAdminify\Inc\Classes\Pro_Upgrade;
use WPAdminify\Inc\Classes\Helper;

if ( ! class_exists( 'Upgrade_Notice' ) ) {
	/**
	 * Upgrade notice class
	 *
	 * Jewel Theme <support@jeweltheme.com>
	 */
	class Upgrade_Notice extends Popup {


		protected $data = array();

		/**
		 * Constructor method
		 */
		public function __construct() {
			$this->init_data();

			// On sheet data update, remove the popup data, to auto rebuid the data.
			add_action(
				'jltwp_adminify_sheet_promo_data_reset',
				function () {
					$this->delete();
				}
			);

			if ( ! empty( $this->data ) ) {
				parent::__construct();
			}
		}

		/**
		 * Get Contents
		 *
		 * @param [type] $key .
		 *
		 * @author Jewel Theme <support@jeweltheme.com>
		 */
		public function get_content( $key ) {
			return $this->data[ $key ];
		}

		/**
		 * Set Intervals
		 *
		 * @author Jewel Theme <support@jeweltheme.com>
		 */
		public function intervals() {
			$end_date   = $this->get_content( 'end_date' );
			$end_offset = $this->date_diff( $end_date );

			if ( $end_offset < 0 ) {
				return array();
			} // Already Expired .

			if ( 0 === $end_offset ) {
				return array( 0 );
			} // Only Today is Left .

			$intervals = array();

			$start_date   = $this->get_content( 'start_date' );
			$start_offset = $this->date_diff( $start_date );

			// Start Done .
			$start       = $start_offset <= 0 ? 0 : abs( $start_offset );
			$intervals[] = $start;

			// End Calculated .
			$end = $end_offset - $start;

			// Middle Done .
			if ( $end > 3 ) {
				$middle      = round( $end / 2 );
				$end         = $end - $middle;
				$intervals[] = $middle;
			}

			// End Done .
			if ( $end > 0 ) {
				$intervals[] = $end;
			}

			return $intervals;
		}

		/**
		 * Init Data
		 *
		 * @author Jewel Theme <support@jeweltheme.com>
		 */
		public function init_data() {
			$sheet_data = Pro_Upgrade::get_data();

			if ( empty( $sheet_data ) ) {
				return;
			}

			$today = $this->current_time();

			$this->data = Helper::get_merged_data( $sheet_data, $today, $this->date_increment( $today, 10 ) );

			$this->is_active = wp_validate_boolean( $this->data['is_campaign'] );
		}
	}
}

```
