PluginProbe
Post Grid Gutenberg Blocks – PostX / 3.1.7
Post Grid Gutenberg Blocks – PostX v3.1.7
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.1.7, at classes/Notice.php

408 lines 13.0 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 = 'v13';
22 private $valid_notices = array();
23 public function __construct(){
24 $default_notice = ultimate_post()->get_notice_data('banner', $this->notice_version);
25
26 $this->valid_notices = array();
27 if (is_array($default_notice ) && count($default_notice) > 0) {
28 foreach ($default_notice as $key => $notice) {
29 $current_time = date('U');
30 if ($current_time > strtotime($notice['start']) && $current_time < strtotime($notice['end']) && $notice['visibility']) {
31 $this->valid_notices[] = $notice;
32 }
33 }
34 }
35
36 if (count($this->valid_notices) > 0) {
37 add_action('admin_notices',array($this,'ultp_installation_notice_callback'));
38 }
39 add_action('admin_init', array($this, 'set_dismiss_notice_callback'));
40 }
41
42 /**
43 * Promotional Dismiss Notice Option Data
44 *
45 * @since v.2.0.1
46 * @param NULL
47 * @return NULL
48 */
49 public function set_dismiss_notice_callback() {
50 if(count($this->valid_notices)>0) {
51 foreach ($this->valid_notices as $notice) {
52 $notice_key = isset($notice['key'])?$notice['key']:$this->notice_version;
53 if (isset($_GET['disable_postx_notice_' .$notice_key ])) {
54 if (sanitize_key($_GET['disable_postx_notice_' . $notice_key]) == 'yes') {
55 // set_transient( 'ultp_get_pro_notice_' . $this->notice_version, 'off', 2592000 ); // 30 days notice
56 if(isset($notice['repeat_interval']) && ''!=$notice['repeat_interval']) {
57 $interval = (int) $notice['repeat_interval'];
58 ultimate_post()->set_transient_without_cache('ultp_get_pro_notice_' . $notice_key, 'off', $interval ); // 30 (2592000) days notice
59 } else {
60
61 ultimate_post()->set_transient_without_cache('ultp_get_pro_notice_' . $notice_key, 'off' ); // 30 (2592000) days notice
62 }
63 }
64 }
65
66
67 }
68 }
69 }
70
71 /**
72 * Dismiss Notice HTML Data
73 *
74 * @since v.1.0.0
75 * @param NULL
76 * @return STRING
77 */
78 public function ultp_installation_notice_callback() {
79 // ultimate_post()->get_tran('ultp_get_pro_notice_' . $this->notice_version) != 'off'
80 if(count($this->valid_notices)>0) {
81 foreach ($this->valid_notices as $notice) {
82 $notice_key = isset($notice['key'])?$notice['key']:$this->notice_version;
83 if (ultimate_post()->get_transient_without_cache('ultp_get_pro_notice_' . $notice_key) != 'off') {
84 // if (!ultimate_post()->is_lc_active() && ($this->force || get_transient('wpxpo_installation_date') != 'yes')) {
85 if ( ($notice['force'] || get_transient('wpxpo_installation_date') != 'yes') ) {
86 if (!isset($_GET['disable_postx_notice_' . $notice_key])) {
87 $this->ultp_notice_css();
88
89 ?>
90
91
92 <?php
93 switch ($notice['type']) {
94 case 'banner':
95 ?>
96 <div class="wc-install ultp-free-notice">
97 <div class="wc-install-body ultp-image-banner">
98 <a class="wc-dismiss-notice" href="<?php echo esc_url( add_query_arg( 'disable_postx_notice_' . $notice_key, 'yes' ) ); ?>">
99 Dismiss
100 </a>
101 <a class="ultp-btn-image" target="_blank" href="<?php echo esc_url($notice['url']); ?>">
102 <img loading="lazy" src="<?php echo esc_url($notice['content']); ?>" alt="Discount Banner"/>
103 </a>
104 </div>
105 </div>
106 <?php
107 break;
108 case 'content':
109 echo $notice['content'];
110 ?>
111 <?php break;
112 }
113 ?>
114
115 <?php
116 }
117 }
118 }
119 }
120 }
121
122 }
123
124 /**
125 * Admin Notice CSS File
126 *
127 * @since v.1.0.0
128 * @param NULL
129 * @return STRING
130 */
131 public function ultp_notice_css() {
132 ?>
133 <style type="text/css">
134 .ultp-free-notice.wc-install {
135 display: flex;
136 align-items: center;
137 background: #fff;
138 margin-top: 40px;
139 width: calc(100% - 50px);
140 border: 1px solid #ccd0d4;
141 padding: 4px;
142 border-radius: 4px;
143 border-left: 3px solid #007fe1;
144 line-height: 0;
145 }
146 .ultp-free-notice.wc-install img {
147 margin-right: 0;
148 max-width: 100%;
149 }
150 .ultp-free-notice .wc-install-body {
151 -ms-flex: 1;
152 flex: 1;
153 position: relative;
154 padding: 10px;
155 }
156 .ultp-free-notice .wc-install-body.ultp-image-banner{
157 padding: 0px;
158 }
159 .ultp-free-notice .wc-install-body h3 {
160 margin-top: 0;
161 font-size: 24px;
162 margin-bottom: 15px;
163 }
164 .ultp-install-btn {
165 margin-top: 15px;
166 display: inline-block;
167 }
168 .ultp-free-notice .wc-install .dashicons{
169 display: none;
170 animation: dashicons-spin 1s infinite;
171 animation-timing-function: linear;
172 }
173 .ultp-free-notice.wc-install.loading .dashicons {
174 display: inline-block;
175 margin-top: 12px;
176 margin-right: 5px;
177 }
178 .ultp-free-notice .wc-install-body h3 {
179 font-size: 20px;
180 margin-bottom: 5px;
181 }
182 .ultp-free-notice .wc-install-body > div {
183 max-width: 100%;
184 margin-bottom: 10px;
185 }
186 .ultp-free-notice .button-hero {
187 padding: 8px 14px !important;
188 min-height: inherit !important;
189 line-height: 1 !important;
190 box-shadow: none;
191 border: none;
192 transition: 400ms;
193 }
194 .ultp-free-notice .ultp-btn-notice-pro {
195 background: #2271b1;
196 color: #fff;
197 }
198 .ultp-free-notice .ultp-btn-notice-pro:hover,
199 .ultp-free-notice .ultp-btn-notice-pro:focus {
200 background: #185a8f;
201 }
202 .ultp-free-notice .button-hero:hover,
203 .ultp-free-notice .button-hero:focus {
204 border: none;
205 box-shadow: none;
206 }
207 @keyframes dashicons-spin {
208 0% {
209 transform: rotate( 0deg );
210 }
211 100% {
212 transform: rotate( 360deg );
213 }
214 }
215 .ultp-free-notice .wc-dismiss-notice {
216 color: #fff;
217 background-color: #000000;
218 padding-top: 0px;
219 position: absolute;
220 right: 0;
221 top: 0px;
222 padding: 10px 10px 14px;
223 border-radius: 0 0 0 4px;
224 display: inline-block;
225 transition: 400ms;
226 }
227 .ultp-free-notice .wc-dismiss-notice:hover {
228 color:red;
229 }
230 .ultp-free-notice .wc-dismiss-notice .dashicons{
231 display: inline-block;
232 text-decoration: none;
233 animation: none;
234 font-size: 16px;
235 }
236 /* ===== Eid Banner Css ===== */
237 .ultp-free-notice .wc-install-body {
238 background: linear-gradient(90deg,rgb(0,110,188) 0%,rgb(2,17,196) 100%);
239 }
240 .ultp-free-notice p{
241 color: #fff;
242 margin: 5px 0px;
243 font-size: 16px;
244 font-weight: 300;
245 letter-spacing: 1px;
246 }
247 .ultp-free-notice p.ultp-enjoy-offer {
248 display: inline;
249 font-weight: bold;
250
251 }
252 .ultp-free-notice .ultp-get-now {
253 font-size: 14px;
254 color: #fff;
255 background: #14a8ff;
256 padding: 8px 12px;
257 border-radius: 4px;
258 text-decoration: none;
259 margin-left: 10px;
260 position: relative;
261 top: -4px;
262 transition: 400ms;
263 }
264 .ultp-free-notice .ultp-get-now:hover{
265 background: #068fe0;
266 }
267 .ultp-free-notice .ultp-dismiss {
268 color: #fff;
269 background-color: #000964;
270 padding-top: 0px;
271 position: absolute;
272 right: 0;
273 top: 0px;
274 padding: 10px 8px 12px;
275 border-radius: 0 0 0 4px;
276 display: inline-block;
277 transition: 400ms;
278 }
279 .ultp-free-notice .ultp-dismiss:hover {
280 color: #d2d2d2;
281 }
282 /*----- ULTP Into Notice ------*/
283 .notice.notice-success.ultp-notice {
284 border-left-color: #4D4DFF;
285 padding: 0;
286 }
287
288 .ultp-notice-container {
289 display: flex;
290 }
291
292 .ultp-notice-container a{
293 text-decoration: none;
294 }
295
296 .ultp-notice-container a:visited{
297 color: white;
298 }
299 .ultp-notice-container img {
300 height: 100px;
301 width: 100px;
302
303 }
304
305 .ultp-notice-image {
306 padding-top: 15px;
307 padding-left: 12px;
308 padding-right: 12px;
309 background-color: #f4f4ff;
310 /* max-width: 40px; */
311 }
312 .ultp-notice-image img{
313 max-width: 100%;
314 /* height: 300px; */
315 }
316
317 .ultp-notice-content {
318 width: 100%;
319 padding: 16px;
320 display: flex;
321 flex-direction: column;
322 gap: 8px;
323 }
324
325 .ultp-notice-ultp-button {
326 max-width: fit-content;
327 padding: 8px 15px;
328 font-size: 16px;
329 color: white;
330 background-color: #4D4DFF;
331 border: none;
332 border-radius: 2px;
333 cursor: pointer;
334 margin-top: 6px;
335 text-decoration: none;
336 }
337
338 .ultp-notice-heading {
339 font-size: 18px;
340 font-weight: 500;
341 color: #1b2023;
342 }
343
344 .ultp-notice-content-header {
345 display: flex;
346 justify-content: space-between;
347 align-items: center;
348 }
349
350 .ultp-notice-close .dashicons-no-alt {
351 font-size: 25px;
352 height: 26px;
353 width: 25px;
354 cursor: pointer;
355 color: #585858;
356 }
357
358 .ultp-notice-close .dashicons-no-alt:hover {
359 color: red;
360 }
361
362 .ultp-notice-content-body {
363 font-size: 14px;
364 color: #343b40;
365 }
366
367 .ultp-notice-wholesalex-button:hover {
368 background-color: #6C6CFF;
369 color: white;
370 }
371
372 span.ultp-bold {
373 font-weight: bold;
374 }
375 a.ultp-pro-dismiss:focus {
376 outline: none;
377 box-shadow: unset;
378 }
379 .loading {
380 width: 16px;
381 height: 16px;
382 border: 3px solid #FFF;
383 border-bottom-color: transparent;
384 border-radius: 50%;
385 display: inline-block;
386 box-sizing: border-box;
387 animation: rotation 1s linear infinite;
388 margin-left: 10px;
389 }
390 a.ultp-notice-ultp-button:hover {
391 color: #fff !important;
392 }
393 @keyframes rotation {
394 0% {
395 transform: rotate(0deg);
396 }
397
398 100% {
399 transform: rotate(360deg);
400 }
401 }
402 /*----- End WholesaleX Into Notice ------*/
403
404 </style>
405 <?php
406 }
407
408 }