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

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