PluginProbe
Post Grid Gutenberg Blocks – PostX / 4.1.19
Post Grid Gutenberg Blocks – PostX v4.1.19
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 4.1.19, at classes/Notice.php

502 lines 19.1 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 = 'v4119';
22
23 public function __construct() {
24 add_filter( 'ultp_dashboard_notice', array( $this, 'dashboard_notice_callback' ) );
25 add_action( 'admin_notices', array( $this, 'ultp_installation_notice_callback' ), 0 );
26 add_action( 'admin_init', array( $this, 'set_dismiss_notice_callback' ) );
27 }
28
29 public function notice_data() {
30 $valid_notices = array();
31 $default_notice = apply_filters( 'ultp_dashboard_notice', array() );
32 if ( is_array( $default_notice ) && count( $default_notice ) > 0 ) {
33 foreach ( $default_notice as $key => $notice ) {
34 $current_time = gmdate( 'U' );
35 if ( $current_time > strtotime( $notice['start'] ) && $current_time < strtotime( $notice['end'] ) && $notice['visibility'] ) {
36 $valid_notices[] = $notice;
37 }
38 }
39 }
40 return $valid_notices;
41 }
42
43
44 /**
45 * Dashboard Notice Data
46 *
47 * @since v.3.1.8
48 * @param NULL
49 * @return NULL
50 */
51 public function dashboard_notice_callback() {
52 return array(
53 array(
54 'key' => 'ultp_blackfriday_sale_24',
55 'start' => '13-11-2024',
56 'end' => '17-11-2024',
57 // 'type' => 'banner',
58 // 'content' => ULTP_URL.'assets/img/dashboard_banner/black_friday_free.jpg',
59 'type' => 'content',
60 'force' => true,
61 'url' => ultimate_post()->get_premium_link('', 'dashboard_db_banner'),
62 'visibility' => !ultimate_post()->is_lc_active(),
63 'priority' => 50,
64 'repeat_interval' => '',
65 ),
66 array(
67 'key' => 'ultp_blackfriday_sale_24_banner_v2',
68 'start' => '18-11-2024',
69 'end' => '12-12-2024',
70 'type' => 'banner',
71 'content' => ULTP_URL.'assets/img/dashboard_banner/postx_black_24.jpg',
72 // 'type' => 'content',
73 'force' => true,
74 'url' => ultimate_post()->get_premium_link('', 'dashboard_db_banner'),
75 'visibility' => !ultimate_post()->is_lc_active(),
76 'priority' => 50,
77 'repeat_interval' => '',
78 )
79 );
80 }
81
82 /**
83 * Promotional Dismiss Notice Option Data
84 *
85 * @since v.2.0.1
86 * @param NULL
87 * @return NULL
88 */
89 public function set_dismiss_notice_callback() {
90 $valid_notices = $this->notice_data();
91
92 if(
93 !( isset($_GET['ultp_dashboard_nonce']) &&
94 wp_verify_nonce(sanitize_key(wp_unslash($_GET['ultp_dashboard_nonce'])), 'ultp-dashboardnonce') )
95 ) {
96 return;
97 }
98 if ( count( $valid_notices ) > 0 ) {
99 foreach ( $valid_notices as $notice ) {
100 $notice_key = isset( $notice['key'] ) ? $notice['key'] : $this->notice_version;
101 if ( isset( $_GET['disable_postx_notice_' .$notice_key ] ) ) { // @codingStandardsIgnoreLine
102 if ( sanitize_key( $_GET['disable_postx_notice_' . $notice_key] ) == 'yes' ) { // @codingStandardsIgnoreLine
103 if ( isset( $notice['repeat_interval'] ) && '' != $notice['repeat_interval'] ) {
104 $interval = (int) $notice['repeat_interval'];
105 ultimate_post()->set_transient_without_cache( 'ultp_get_pro_notice_' . $notice_key, 'off', $interval ); // 30 (2592000) days notice
106 } else {
107 ultimate_post()->set_transient_without_cache( 'ultp_get_pro_notice_' . $notice_key, 'off' ); // 30 (2592000) days notice
108 }
109 }
110 }
111 }
112 }
113 }
114
115 /**
116 * Dismiss Notice HTML Data
117 *
118 * @since v.1.0.0
119 * @param NULL
120 * @return STRING
121 */
122 public function ultp_installation_notice_callback() {
123 $valid_notices = $this->notice_data();
124 $ultp_dashboard_nonce = wp_create_nonce('ultp-dashboardnonce');
125 if ( count( $valid_notices ) > 0 ) {
126 $this->ultp_notice_css();
127 foreach ( $valid_notices as $notice ) {
128 $notice_key = isset( $notice['key'] ) ? $notice['key'] : $this->notice_version;
129 if ( ultimate_post()->get_transient_without_cache('ultp_get_pro_notice_' . $notice_key) != 'off' ) {
130 if ( ( $notice['force'] || get_transient('wpxpo_installation_date') != 'yes' ) ) {
131 if ( ! isset( $_GET['disable_postx_notice_' . $notice_key] ) ) { // @codingStandardsIgnoreLine
132 switch ( $notice['type'] ) {
133 case 'banner': ?>
134 <div class="ultp-notice-wrapper notice wc-install ultp-free-notice">
135 <div class="wc-install-body ultp-image-banner">
136 <a class="wc-dismiss-notice" href="<?php echo esc_url( add_query_arg( array( 'disable_postx_notice_' . $notice_key => 'yes', 'ultp_dashboard_nonce' => $ultp_dashboard_nonce ) ) ); ?>">Dismiss</a>
137 <a class="ultp-btn-image" target="_blank" href="<?php echo esc_url($notice['url']); ?>">
138 <img loading="lazy" src="<?php echo esc_url($notice['content']); ?>" alt="Discount Banner"/>
139 </a>
140 </div>
141 </div>
142 <?php
143 break;
144 case 'content':
145 $icon = ULTP_URL . 'assets/img/logo-sm.svg';
146 $url = 'https://www.wpxpo.com/postx/pricing/?utm_source=db-postx-global&utm_medium=blackfriday-sale&utm_campaign=postx-dashboard';
147 ?>
148 <div class="ultp-notice-wrapper notice data_collection_notice">
149 <?php
150 if ( isset( $icon ) ) {
151 ?>
152 <div class="ultp-notice-icon"> <img src="<?php echo esc_url( $icon ); ?>"/> </div>
153 <?php
154 }
155 ?>
156
157 <div class="ultp-notice-content-wrapper">
158 <!-- <div class="">Sizzling Summer Sale is<strong> LIVE!</strong> Beat the heat with upto <strong>50% DISCOUNT</strong> on PostX Pro</div> -->
159 <div class="">
160 <strong>Black Friday Deal Alert: </strong>
161 PostX on Sale - Enjoy <strong>up to 55% OFF</strong> on the powerful site builder.
162 </div>
163 <div class="ultp-notice-buttons">
164 <a class="ultp-notice-btn button button-primary" href="<?php echo esc_url( $url ); ?>" target="_blank"> Upgrade to Pro </a>
165 <a href=<?php echo esc_url( add_query_arg( array( 'disable_postx_notice_' . $notice_key => 'yes', 'ultp_dashboard_nonce' => $ultp_dashboard_nonce ) ) ); ?> class="ultp-notice-dont-save-money" > I don’t want to save money </a>
166 </div>
167 </div>
168 <a href=<?php echo esc_url( add_query_arg( array( 'disable_postx_notice_' . $notice_key => 'yes', 'ultp_dashboard_nonce' => $ultp_dashboard_nonce ) ) ); ?> class="ultp-notice-close"><span class="ultp-notice-close-icon dashicons dashicons-dismiss"> </span></a>
169 </div>
170 <?php
171 break;
172 }
173 }
174 }
175 }
176 }
177 }
178 }
179
180 /**
181 * Admin Notice CSS File
182 *
183 * @since v.1.0.0
184 * @param NULL
185 * @return STRING
186 */
187 public function ultp_notice_css() {
188 ?>
189 <style type="text/css">
190 .ultp-notice-wrapper {
191 border: 1px solid #c3c4c7;
192 border-left: 3px solid #037fff;
193 margin: 15px 0px !important;
194 display: flex;
195 align-items: center;
196 background: #F7F9FF;
197 width: 100%;
198 padding: 10px 0px;
199 position: relative;
200 box-sizing: border-box;
201 }
202 .ultp-notice-wrapper.notice, .ultp-free-notice.wc-install.notice {
203 margin: 10px 0px;
204 width: calc( 100% - 20px );
205 }
206 .wrap .ultp-notice-wrapper.notice, .wrap .ultp-free-notice.wc-install {
207 width: 100%;
208 }
209 .ultp-notice-icon {
210 margin-left: 15px;
211 }
212 .ultp-notice-icon img {
213 max-width: 42px;
214 width: 100%;
215 }
216 .ultp-notice-content-wrapper {
217 display: flex;
218 flex-direction: column;
219 gap: 8px;
220 font-size: 14px;
221 line-height: 20px;
222 margin-left: 15px;
223 }
224 .ultp-notice-buttons {
225 display: flex;
226 align-items: center;
227 gap: 15px;
228 }
229 .ultp-notice-dont-save-money {
230 font-size: 12px;
231 }
232 .ultp-notice-close {
233 position: absolute;
234 right: 2px;
235 top: 5px;
236 text-decoration: unset;
237 color: #b6b6b6;
238 font-family: dashicons;
239 font-size: 16px;
240 font-style: normal;
241 font-weight: 400;
242 line-height: 20px;
243 }
244 .ultp-notice-close-icon {
245 font-size: 14px;
246 }
247 .ultp-free-notice.wc-install {
248 display: flex;
249 align-items: center;
250 background: #fff;
251 margin-top: 20px;
252 width: 100%;
253 box-sizing: border-box;
254 border: 1px solid #ccd0d4;
255 padding: 4px;
256 border-radius: 4px;
257 border-left: 3px solid #007fe1;
258 line-height: 0;
259 }
260 .ultp-free-notice.wc-install img {
261 margin-right: 0;
262 max-width: 100%;
263 }
264 .ultp-free-notice .wc-install-body {
265 -ms-flex: 1;
266 flex: 1;
267 position: relative;
268 padding: 10px;
269 }
270 .ultp-free-notice .wc-install-body.ultp-image-banner{
271 padding: 0px;
272 }
273 .ultp-free-notice .wc-install-body h3 {
274 margin-top: 0;
275 font-size: 24px;
276 margin-bottom: 15px;
277 }
278 .ultp-install-btn {
279 margin-top: 15px;
280 display: inline-block;
281 }
282 .ultp-free-notice .wc-install .dashicons{
283 display: none;
284 animation: dashicons-spin 1s infinite;
285 animation-timing-function: linear;
286 }
287 .ultp-free-notice.wc-install.loading .dashicons {
288 display: inline-block;
289 margin-top: 12px;
290 margin-right: 5px;
291 }
292 .ultp-free-notice .wc-install-body h3 {
293 font-size: 20px;
294 margin-bottom: 5px;
295 }
296 .ultp-free-notice .wc-install-body > div {
297 max-width: 100%;
298 margin-bottom: 10px;
299 }
300 .ultp-free-notice .button-hero {
301 padding: 8px 14px !important;
302 min-height: inherit !important;
303 line-height: 1 !important;
304 box-shadow: none;
305 border: none;
306 transition: 400ms;
307 }
308 .ultp-free-notice .ultp-btn-notice-pro {
309 background: #2271b1;
310 color: #fff;
311 }
312 .ultp-free-notice .ultp-btn-notice-pro:hover,
313 .ultp-free-notice .ultp-btn-notice-pro:focus {
314 background: #185a8f;
315 }
316 .ultp-free-notice .button-hero:hover,
317 .ultp-free-notice .button-hero:focus {
318 border: none;
319 box-shadow: none;
320 }
321 @keyframes dashicons-spin {
322 0% {
323 transform: rotate( 0deg );
324 }
325 100% {
326 transform: rotate( 360deg );
327 }
328 }
329 .ultp-free-notice .wc-dismiss-notice {
330 color: #fff;
331 background-color: #000000;
332 padding-top: 0px;
333 position: absolute;
334 right: 0;
335 top: 0px;
336 padding: 10px 10px 14px;
337 border-radius: 0 0 0 4px;
338 display: inline-block;
339 transition: 400ms;
340 }
341 .ultp-free-notice .wc-dismiss-notice:hover {
342 color:red;
343 }
344 .ultp-free-notice .wc-dismiss-notice .dashicons{
345 display: inline-block;
346 text-decoration: none;
347 animation: none;
348 font-size: 16px;
349 }
350 /* ===== Eid Banner Css ===== */
351 .ultp-free-notice .wc-install-body {
352 background: linear-gradient(90deg,rgb(0,110,188) 0%,rgb(2,17,196) 100%);
353 }
354 .ultp-free-notice p{
355 color: #fff;
356 margin: 5px 0px;
357 font-size: 16px;
358 font-weight: 300;
359 letter-spacing: 1px;
360 }
361 .ultp-free-notice p.ultp-enjoy-offer {
362 display: inline;
363 font-weight: bold;
364
365 }
366 .ultp-free-notice .ultp-get-now {
367 font-size: 14px;
368 color: #fff;
369 background: #14a8ff;
370 padding: 8px 12px;
371 border-radius: 4px;
372 text-decoration: none;
373 margin-left: 10px;
374 position: relative;
375 top: -4px;
376 transition: 400ms;
377 }
378 .ultp-free-notice .ultp-get-now:hover{
379 background: #068fe0;
380 }
381 .ultp-free-notice .ultp-dismiss {
382 color: #fff;
383 background-color: #000964;
384 padding-top: 0px;
385 position: absolute;
386 right: 0;
387 top: 0px;
388 padding: 10px 8px 12px;
389 border-radius: 0 0 0 4px;
390 display: inline-block;
391 transition: 400ms;
392 }
393 .ultp-free-notice .ultp-dismiss:hover {
394 color: #d2d2d2;
395 }
396 /*----- ULTP Into Notice ------*/
397 .notice.notice-success.ultp-notice {
398 border-left-color: #4D4DFF;
399 padding: 0;
400 }
401 .ultp-notice-container {
402 display: flex;
403 }
404 .ultp-notice-container a{
405 text-decoration: none;
406 }
407 .ultp-notice-container a:visited{
408 color: white;
409 }
410 .ultp-notice-container img {
411 height: 100px;
412 width: 100px;
413 }
414 .ultp-notice-image {
415 padding-top: 15px;
416 padding-left: 12px;
417 padding-right: 12px;
418 background-color: #f4f4ff;
419 }
420 .ultp-notice-image img{
421 max-width: 100%;
422 }
423 .ultp-notice-content {
424 width: 100%;
425 padding: 16px;
426 display: flex;
427 flex-direction: column;
428 gap: 8px;
429 }
430 .ultp-notice-ultp-button {
431 max-width: fit-content;
432 padding: 8px 15px;
433 font-size: 16px;
434 color: white;
435 background-color: #4D4DFF;
436 border: none;
437 border-radius: 2px;
438 cursor: pointer;
439 margin-top: 6px;
440 text-decoration: none;
441 }
442 .ultp-notice-heading {
443 font-size: 18px;
444 font-weight: 500;
445 color: #1b2023;
446 }
447 .ultp-notice-content-header {
448 display: flex;
449 justify-content: space-between;
450 align-items: center;
451 }
452 .ultp-notice-close .dashicons-no-alt {
453 font-size: 25px;
454 height: 26px;
455 width: 25px;
456 cursor: pointer;
457 color: #585858;
458 }
459 .ultp-notice-close .dashicons-no-alt:hover {
460 color: red;
461 }
462 .ultp-notice-content-body {
463 font-size: 14px;
464 color: #343b40;
465 }
466 .ultp-notice-wholesalex-button:hover {
467 background-color: #6C6CFF;
468 color: white;
469 }
470 span.ultp-bold {
471 font-weight: bold;
472 }
473 a.ultp-pro-dismiss:focus {
474 outline: none;
475 box-shadow: unset;
476 }
477 .ultp-free-notice .loading, .ultp-notice .loading {
478 width: 16px;
479 height: 16px;
480 border: 3px solid #FFF;
481 border-bottom-color: transparent;
482 border-radius: 50%;
483 display: inline-block;
484 box-sizing: border-box;
485 animation: rotation 1s linear infinite;
486 margin-left: 10px;
487 }
488 a.ultp-notice-ultp-button:hover {
489 color: #fff !important;
490 }
491 @keyframes rotation {
492 0% {
493 transform: rotate(0deg);
494 }
495 100% {
496 transform: rotate(360deg);
497 }
498 }
499 </style>
500 <?php
501 }
502 }