PluginProbe
Post Grid Gutenberg Blocks – PostX / 3.0.1
Post Grid Gutenberg Blocks – PostX v3.0.1
5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 2.1.2 All 237 releases
ultimate-post / classes / Notice.php

Notice.php in Post Grid Gutenberg Blocks – PostX 3.0.1, at classes/Notice.php

259 lines 8.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Notice Action.
4 *
5 * @package ULTP\Notice
6 * @since v.1.0.0
7 */
8 namespace ULTP;
9
10 defined('ABSPATH') || exit;
11
12 /**
13 * Notice class.
14 */
15 class Notice {
16 /**
17 * Setup class.
18 *
19 * @since v.1.0.0
20 */
21 private $notice_version = 'v12';
22
23 public function __construct(){
24 $default_notice = ultimate_post()->get_notice_data();
25 if (count($default_notice) > 0) {
26 foreach ($default_notice as $key => $notice) {
27 $current_time = date('U');
28 if ($current_time > strtotime($notice['start']) && $current_time < strtotime($notice['end'])) {
29 $this->type = $notice['type'];
30 $this->content = $notice['content'];
31 $this->force = $notice['force'];
32 // add_action('admin_notices', array($this, 'ultp_installation_notice_callback'));
33 }
34 }
35 }
36 add_action('admin_init', array($this, 'set_dismiss_notice_callback'));
37 }
38
39 /**
40 * Promotional Dismiss Notice Option Data
41 *
42 * @since v.2.0.1
43 * @param NULL
44 * @return NULL
45 */
46 public function set_dismiss_notice_callback() {
47 if (!isset($_GET['disable_postx_notice_' . $this->notice_version])) {
48 return ;
49 }
50 if (sanitize_key($_GET['disable_postx_notice_' . $this->notice_version]) == 'yes') {
51 set_transient( 'ultp_get_pro_notice_' . $this->notice_version, 'off', 2592000 ); // 30 days notice
52 }
53 }
54
55 /**
56 * Dismiss Notice HTML Data
57 *
58 * @since v.1.0.0
59 * @param NULL
60 * @return STRING
61 */
62 public function ultp_installation_notice_callback() {
63 if (ultimate_post()->get_tran('ultp_get_pro_notice_' . $this->notice_version) != 'off') {
64 if (!ultimate_post()->is_lc_active() && ($this->force || get_transient('wpxpo_installation_date') != 'yes')) {
65 if (!isset($_GET['disable_postx_notice_' . $this->notice_version])) {
66 $this->ultp_notice_css();
67 ?>
68 <div class="wc-install ultp-free-notice">
69 <?php
70 switch ($this->type) {
71 case 'banner': ?>
72 <div class="wc-install-body ultp-image-banner">
73 <a class="wc-dismiss-notice" href="<?php echo esc_url( add_query_arg( 'disable_postx_notice_' . $this->notice_version, 'yes' ) ); ?>">
74 Dismiss
75 </a>
76 <a class="ultp-btn-image" target="_blank" href="<?php echo esc_url(ultimate_post()->get_premium_link('', 'dashboard_db_banner')); ?>">
77 <img loading="lazy" src="<?php echo esc_url($this->content); ?>" alt="Discount Banner"/>
78 </a>
79 </div>
80 <?php break;
81 case 'content': ?>
82 <div class="wc-install-body">
83 <?php echo $this->content; ?>
84 <!-- <a class="button button-primary button-hero ultp-btn-notice-pro" target="_blank" href="< ?php echo esc_url(ultimate_post()->get_premium_link('','dashboard_db_banner')); ? >"><span class="dashicons dashicons-image-rotate"></span>< ?php esc_html_e('Upgrading to Pro', 'ultimate-post'); ?></a>
85 <a class="button-secondary button-large" href="< ?php echo esc_url( add_query_arg( 'disable_postx_notice_' . $this->notice_version, 'yes' ) ); ? >">< ?php esc_html_e('No Thanks / Close.', 'ultimate-post'); ? ></a> -->
86 </div>
87 <?php break;
88 }
89 ?>
90 </div>
91 <?php
92 }
93 }
94 }
95 }
96
97 /**
98 * Admin Notice CSS File
99 *
100 * @since v.1.0.0
101 * @param NULL
102 * @return STRING
103 */
104 public function ultp_notice_css() {
105 ?>
106 <style type="text/css">
107 .ultp-free-notice.wc-install {
108 display: flex;
109 align-items: center;
110 background: #fff;
111 margin-top: 40px;
112 width: calc(100% - 50px);
113 border: 1px solid #ccd0d4;
114 padding: 4px;
115 border-radius: 4px;
116 border-left: 3px solid #007fe1;
117 line-height: 0;
118 }
119 .ultp-free-notice.wc-install img {
120 margin-right: 0;
121 max-width: 100%;
122 }
123 .ultp-free-notice .wc-install-body {
124 -ms-flex: 1;
125 flex: 1;
126 position: relative;
127 padding: 10px;
128 }
129 .ultp-free-notice .wc-install-body.ultp-image-banner{
130 padding: 0px;
131 }
132 .ultp-free-notice .wc-install-body h3 {
133 margin-top: 0;
134 font-size: 24px;
135 margin-bottom: 15px;
136 }
137 .ultp-install-btn {
138 margin-top: 15px;
139 display: inline-block;
140 }
141 .ultp-free-notice .wc-install .dashicons{
142 display: none;
143 animation: dashicons-spin 1s infinite;
144 animation-timing-function: linear;
145 }
146 .ultp-free-notice.wc-install.loading .dashicons {
147 display: inline-block;
148 margin-top: 12px;
149 margin-right: 5px;
150 }
151 .ultp-free-notice .wc-install-body h3 {
152 font-size: 20px;
153 margin-bottom: 5px;
154 }
155 .ultp-free-notice .wc-install-body > div {
156 max-width: 100%;
157 margin-bottom: 10px;
158 }
159 .ultp-free-notice .button-hero {
160 padding: 8px 14px !important;
161 min-height: inherit !important;
162 line-height: 1 !important;
163 box-shadow: none;
164 border: none;
165 transition: 400ms;
166 }
167 .ultp-free-notice .ultp-btn-notice-pro {
168 background: #2271b1;
169 color: #fff;
170 }
171 .ultp-free-notice .ultp-btn-notice-pro:hover,
172 .ultp-free-notice .ultp-btn-notice-pro:focus {
173 background: #185a8f;
174 }
175 .ultp-free-notice .button-hero:hover,
176 .ultp-free-notice .button-hero:focus {
177 border: none;
178 box-shadow: none;
179 }
180 @keyframes dashicons-spin {
181 0% {
182 transform: rotate( 0deg );
183 }
184 100% {
185 transform: rotate( 360deg );
186 }
187 }
188 .ultp-free-notice .wc-dismiss-notice {
189 color: #fff;
190 background-color: #000000;
191 padding-top: 0px;
192 position: absolute;
193 right: 0;
194 top: 0px;
195 padding: 10px 10px 14px;
196 border-radius: 0 0 0 4px;
197 display: inline-block;
198 transition: 400ms;
199 }
200 .ultp-free-notice .wc-dismiss-notice:hover {
201 color:red;
202 }
203 .ultp-free-notice .wc-dismiss-notice .dashicons{
204 display: inline-block;
205 text-decoration: none;
206 animation: none;
207 font-size: 16px;
208 }
209 /* ===== Eid Banner Css ===== */
210 .ultp-free-notice .wc-install-body {
211 background: linear-gradient(90deg,rgb(0,110,188) 0%,rgb(2,17,196) 100%);
212 }
213 .ultp-free-notice p{
214 color: #fff;
215 margin: 5px 0px;
216 font-size: 16px;
217 font-weight: 300;
218 letter-spacing: 1px;
219 }
220 .ultp-free-notice p.ultp-enjoy-offer {
221 display: inline;
222 font-weight: bold;
223
224 }
225 .ultp-free-notice .ultp-get-now {
226 font-size: 14px;
227 color: #fff;
228 background: #14a8ff;
229 padding: 8px 12px;
230 border-radius: 4px;
231 text-decoration: none;
232 margin-left: 10px;
233 position: relative;
234 top: -4px;
235 transition: 400ms;
236 }
237 .ultp-free-notice .ultp-get-now:hover{
238 background: #068fe0;
239 }
240 .ultp-free-notice .ultp-dismiss {
241 color: #fff;
242 background-color: #000964;
243 padding-top: 0px;
244 position: absolute;
245 right: 0;
246 top: 0px;
247 padding: 10px 8px 12px;
248 border-radius: 0 0 0 4px;
249 display: inline-block;
250 transition: 400ms;
251 }
252 .ultp-free-notice .ultp-dismiss:hover {
253 color: #d2d2d2;
254 }
255 </style>
256 <?php
257 }
258
259 }