PluginProbe
Post Grid Gutenberg Blocks – PostX / 5.1.0
Post Grid Gutenberg Blocks – PostX v5.1.0
5.1.1 5.1.0 5.0.41 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 All 240 releases
← All changes | includes/notice/class-notice.php +358 -219 5.0.26 → 5.1.0 View file →
@@ -25,10 +25,23 @@
25 25 * @var boolean
26 26 */
27 27 private $notice_js_css_applied = false;
28 28
29 + /**
30 + * Notice Priority
31 + *
32 + * @var string $plugin_notice_priority
33 + */
34 + private $plugin_notice_priority = 1;
29 35
30 36 /**
37 + * Notice Priority
38 + *
39 + * @var string $plugin_notice_priority
40 + */
41 + private $plugin_notice_priority_key = 'postx';
42 +
43 + /**
31 44 * Notice Constructor
32 45 */
33 46 public function __construct() {
34 47 add_action( 'admin_notices', array( $this, 'admin_notices_callback' ) );
@@ -38,8 +51,9 @@
38 51 add_action( 'rest_api_init', array( $this, 'register_rest_route' ) );
39 52
40 53 // Woocommerce Install Action
41 54 // add_action( 'wp_ajax_ultp_install', array( $this, 'install_activate_plugin' ) ); // this ajax not called anywhere in future need to removed, that is arise patchstack security issue
55 + add_filter( 'xpo_active_notice_lists', array( $this, 'handle_xpo_active_notice_lists' ), 99, 1 );
42 56 }
43 57
44 58 /**
45 59 * Registers REST API endpoints.
@@ -80,16 +94,12 @@
80 94 * @return array
81 95 */
82 96 public static function get_hellobar_config() {
83 97 return array(
84 - // Flash sale
85 - 'ultp_helloBar_flash_sale_2026_4' => Xpo::get_transient_without_cache( 'ultp_helloBar_flash_sale_2026_4' ),
86 - // Surprise sale
87 - 'ultp_helloBar_surprise_sale_2026_5' => Xpo::get_transient_without_cache( 'ultp_helloBar_surprise_sale_2026_5' ),
88 - // Massive sale
89 - 'ultp_helloBar_massive_sale_2026_6' => Xpo::get_transient_without_cache( 'ultp_helloBar_massive_sale_2026_6' ),
90 - // Final hours sale
91 - 'ultp_helloBar_final_hours_sale_2026_7' => Xpo::get_transient_without_cache( 'ultp_helloBar_final_hours_sale_2026_7' ),
98 + // Final hours sale.
99 + 'ultp_helloBar_summer_sale_2026_v1' => Xpo::get_transient_without_cache( 'ultp_helloBar_summer_sale_2026_v1' ),
100 + 'ultp_helloBar_summer_sale_2026_v1_2' => Xpo::get_transient_without_cache( 'ultp_helloBar_summer_sale_2026_v1_2' ),
101 + 'ultp_helloBar_base_price_2026' => Xpo::get_transient_without_cache( 'ultp_helloBar_base_price_2026' ),
92 102 );
93 103 }
94 104
95 105 /**
@@ -102,10 +112,17 @@
102 112 $request_params = $request->get_params();
103 113 $type = isset( $request_params['type'] ) ? $request_params['type'] : '';
104 114 $id = isset( $request_params['id'] ) ? $request_params['id'] : '';
105 115
106 - if ( 'hello_bar' === $type && ! empty( $id ) ) {
107 - Xpo::set_transient_without_cache( $id, 'hide', 1296000 );
116 + // Guideline 11 — a dismissal must stick. This previously expired after 15
117 + // days (1296000s), so a dismissed sale bar came back on its own. Passing 0
118 + // stores it with no timeout, which Xpo::get_transient_without_cache() reads
119 + // back indefinitely.
120 + //
121 + // $id names the option that gets written, so it is checked against the
122 + // known hellobar keys rather than trusted from the request.
123 + if ( 'hello_bar' === $type && ! empty( $id ) && array_key_exists( $id, self::get_hellobar_config() ) ) {
124 + Xpo::set_transient_without_cache( $id, 'hide', 0 );
108 125 }
109 126
110 127 return new \WP_REST_Response(
111 128 array(
@@ -122,9 +139,9 @@
122 139 * @return void
123 140 */
124 141 public function set_dismiss_notice_callback() {
125 142
126 - if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['wpnonce'] ?? '' ) ), 'ultp-nonce' ) ) {
143 + if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['wpnonce'] ?? '' ) ), 'ultp-admin-nonce' ) ) {
127 144 return;
128 145 }
129 146
130 147 $durbin_key = sanitize_text_field( wp_unslash( $_GET['ultp_durbin_key'] ?? '' ) );
@@ -169,10 +186,14 @@
169 186 *
170 187 * @return void
171 188 */
172 189 public function ultp_dashboard_notice_callback() {
173 - $this->ultp_dashboard_banner_notice();
174 - $this->ultp_dashboard_content_notice();
190 + if ( $this->is_available_for_notice() ) {
191 + $this->ultp_dashboard_banner_notice();
192 + $this->ultp_dashboard_content_notice();
193 + $this->ultp_dashboard_image_banner_notice();
194 +
195 + }
175 196 }
176 197
177 198 /**
178 199 * Dashboard Banner Notice
@@ -178,12 +199,12 @@
178 199 * Dashboard Banner Notice
179 200 *
180 201 * @return void
181 202 */
182 - public function ultp_dashboard_banner_notice() {
183 - $ultp_db_nonce = wp_create_nonce( 'ultp-nonce' );
203 + public function ultp_dashboard_banner_notice( $return_bool = false ) {
204 + $ultp_db_nonce = wp_create_nonce( 'ultp-admin-nonce' );
184 205 $banner_notices = array(
185 - // FLash sale
206 + // FLash sale.
186 207 array(
187 208 'key' => 'ultp_banner_flash_sale_2026_1',
188 209 'start' => '2026-05-18 00:00 Asia/Dhaka',
189 210 'end' => '2026-05-21 23:59 Asia/Dhaka', // format YY-MM-DD always set time 23:59 and zone Asia/Dhaka.
@@ -290,9 +311,11 @@
290 311
291 312 if ( 'off' === $notice_transient ) {
292 313 continue;
293 314 }
294 -
315 + if ( $return_bool ) { // Early return for Other plugin notice.
316 + return true;
317 + }
295 318 if ( ! $this->notice_js_css_applied ) {
296 319 $this->ultp_banner_notice_js();
297 320 $this->notice_js_css_applied = true;
298 321 }
@@ -303,32 +326,90 @@
303 326 if ( isset( $notice['repeat_interval'] ) && $notice['repeat_interval'] ) {
304 327 $query_args['ultp_interval'] = $notice['repeat_interval'];
305 328 }
306 329 ?>
307 - <style>
308 - @media only screen and (max-width: 1200px) {
309 - .ultp-notice-wrapper.notice .ultp-banner-logo-img {
310 - max-width: 230px;
330 + <style type="text/css">
331 + .ultp-notice-wrapper.ultp-banner-notice {
332 + height: auto !important;
333 + padding: 0 !important;
334 + position: relative;
335 + box-sizing: border-box;
336 + background-repeat: no-repeat;
337 + background-size: cover;
338 + background-position: center;
339 + }
340 + .ultp-notice-wrapper.ultp-banner-notice .ultp-banner-link {
341 + width: 100%;
342 + text-decoration: none;
343 + display: block;
344 + }
345 + .ultp-notice-wrapper.ultp-banner-notice .ultp-banner-content {
346 + display: flex;
347 + justify-content: space-between;
348 + align-items: center;
349 + max-width: 700px;
350 + margin: 0 auto;
351 + padding: 10px 16px;
352 + gap: 16px;
353 + }
354 + .ultp-notice-wrapper.ultp-banner-notice .ultp-banner-side-image {
355 + display: block;
356 + max-width: 100%;
357 + height: auto;
358 + max-height: 32px;
359 + }
360 + .ultp-notice-wrapper.ultp-banner-notice .ultp-banner-main .ultp-banner-main-text {
361 + color: #ffffff;
362 + }
363 + .ultp-notice-wrapper.ultp-banner-notice .ultp-banner-main {
364 + display: flex;
365 + flex-direction: column;
366 + gap: 4px;
367 + align-items: center;
368 + justify-content: center;
369 + font-weight: 700;
370 + font-size: 18px;
371 + color: #333333;
372 + line-height: 1.2;
373 + text-align: center;
374 + }
375 +
376 + @media screen and (max-width: 1100px) {
377 + /* .ultp-notice-wrapper.ultp-banner-notice .ultp-banner-content {
378 + flex-direction: column;
379 + } */
380 + .ultp-notice-wrapper.ultp-banner-notice .ultp-banner-content .ultp-banner-main-text {
381 + display: none;
311 382 }
312 - .ultp-banner-grab-btn-img {
313 - max-width: 130px;
383 + }
384 + @media screen and (max-width: 490px) {
385 + .ultp-notice-wrapper.ultp-banner-notice {
386 + display: none;
314 387 }
315 - .ultp-notice-countdown {
388 + }
389 + @media screen and (max-width: 782px) {
390 + .ultp-notice-wrapper.ultp-banner-notice .ultp-banner-content {
391 + justify-content: center;
392 + padding: 12px 32px 12px 12px;
393 + }
394 + .ultp-notice-wrapper.ultp-banner-notice .ultp-banner-main {
395 + font-size: 22px;
396 + line-height: 28px;
397 + }
398 + }
399 + @media screen and (max-width: 480px) {
400 + .ultp-notice-wrapper.ultp-banner-notice .ultp-banner-content {
401 + padding: 10px 32px 10px 10px;
402 + }
403 + .ultp-notice-wrapper.ultp-banner-notice .ultp-banner-main {
316 404 font-size: 18px;
405 + line-height: 24px;
317 406 }
318 - .ultp-notice-banner-title {
319 - font-size: 20px;
320 - }
321 407 }
322 408 </style>
323 409 <div
324 - class="ultp-notice-wrapper notice"
410 + class="ultp-notice-wrapper ultp-banner-notice notice"
325 411 style="
326 - height:90px;
327 - border-radius: 7px 0px 0px 7px;
328 - padding:0;
329 - position:relative;
330 - box-sizing: border-box;
331 412 border-left: 3px solid <?php echo esc_attr( $notice['brand_color'] ); ?>;
332 413 background-image: url('<?php echo esc_attr( $notice['bg_image'] ); ?>');
333 414 ">
334 415 <a
@@ -348,33 +429,13 @@
348 429 aria-label="<?php esc_html_e( 'Close Banner', 'ultimate-post' ); ?>"
349 430 href="<?php echo esc_url( add_query_arg( $query_args ) ); ?>">
350 431 </a>
351 432
352 - <a style="width:100%;text-decoration: none;" target="_blank" href="<?php echo esc_url( $notice['url'] ); ?>">
353 - <div style="
354 - display: flex;
355 - justify-content: space-between;
356 - align-items: center;
357 - max-width: 1358px;
358 - margin: 0px auto;
359 - padding: 10px 15px;
360 - height: 90px;
361 - box-sizing: border-box;
362 -
363 - ">
364 - <img class="ultp-banner-logo-img" style="" loading="lazy" src="<?php echo esc_url( $notice['left_image'] ); ?>" />
365 - <div style="
366 - display: flex;
367 - flex-direction: column;
368 - gap: 4px;
369 - align-items: center;
370 - justify-content: center;
371 - font-weight: 700;
372 - font-size: 28px;
373 - color: #000;
374 - line-height: 32px;
375 - ">
376 - <span class="ultp-notice-banner-title evgn-titile-text-white" style="color: #fff;">
433 + <a class="ultp-banner-link" target="_blank" href="<?php echo esc_url( $notice['url'] ); ?>">
434 + <div class="ultp-banner-content">
435 + <img class="ultp-banner-side-image" loading="lazy" src="<?php echo esc_url( $notice['left_image'] ); ?>" />
436 + <div class="ultp-banner-main">
437 + <span class="ultp-banner-main-text">
377 438 <?php echo esc_html( $notice['text'] ); ?>
378 439 </span>
379 440 <div
380 441 class="ultp-notice-countdown"
@@ -385,9 +446,9 @@
385 446 data-duration="<?php echo esc_attr( $notice['countdown_duration'] ); ?>">
386 447 00:00:00:00
387 448 </div>
388 449 </div>
389 - <img class="ultp-banner-grab-btn-img" style="" loading="lazy" src="<?php echo esc_url( $notice['right_image'] ); ?>" />
450 + <img class="ultp-banner-side-image" loading="lazy" src="<?php echo esc_url( $notice['right_image'] ); ?>" />
390 451 </div>
391 452 </a>
392 453 </div>
393 454 <?php
@@ -508,8 +569,15 @@
508 569 */
509 570 public function ultp_dashboard_durbin_notice_callback() {
510 571 $durbin_key = 'ultp_durbin_dc1';
511 572
573 + // Guideline 11 — the consent notice is allowed on PostX's own screens and,
574 + // as is standard immediately after activation, on plugins.php. Nowhere else.
575 + global $pagenow;
576 + if ( ! $this->is_postx_screen() && 'plugins.php' !== $pagenow ) {
577 + return;
578 + }
579 +
512 580 if (
513 581 isset( $_GET['ultp_durbin_key'] ) || // phpcs:ignore
514 582 'off' === Xpo::get_transient_without_cache( 'ultp_durbin_notice_' . $durbin_key )
515 583 ) {
@@ -519,9 +587,9 @@
519 587 if ( ! $this->notice_js_css_applied ) {
520 588 $this->notice_js_css_applied = true;
521 589 }
522 590
523 - $ultp_db_nonce = wp_create_nonce( 'ultp-nonce' );
591 + $ultp_db_nonce = wp_create_nonce( 'ultp-admin-nonce' );
524 592
525 593 ?>
526 594 <style>
527 595 .ultp-consent-box {
@@ -630,177 +698,56 @@
630 698 * Dashboard Content Notice
631 699 *
632 700 * @return void
633 701 */
634 - public function ultp_dashboard_content_notice() {
702 + public function ultp_dashboard_content_notice( $return_bool = false ) {
635 703 $content_notices = array(
636 - // Flash sale
637 704 array(
638 - 'key' => 'ultp_dashboard_content_notice_flash_sale_brand_logos',
639 - 'start' => '2026-05-07 00:00 Asia/Dhaka',
640 - 'end' => '2026-05-12 23:59 Asia/Dhaka',
705 + 'key' => 'ultp_dashboard_content_notice_summer_sale_2026_vv1',
706 + 'start' => '2026-07-06 00:00 Asia/Dhaka',
707 + 'end' => '2026-07-12 23:59 Asia/Dhaka',
641 708 'url' => Xpo::generate_utm_link(
642 709 array(
643 - 'utmKey' => 'flash_sale',
710 + 'utmKey' => 'summer_db',
644 711 )
645 712 ),
646 713 'visibility' => ! Xpo::is_lc_active(),
647 - 'content_heading' => __( 'Flash Sale:', 'ultimate-post' ),
648 - 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ),
649 - 'discount_content' => ' up to 45% Off',
650 - 'brand_color' => '#0322ff',
651 - 'icon' => ULTP_URL . 'assets/img/dashboard_banner/brand_logo_round.svg',
652 - 'button_text' => __( 'Claim Your Discount!', 'ultimate-post' ),
653 - 'is_discount_logo' => true,
714 + 'content_heading' => __( 'Summer Sale:', 'ultimate-post' ),
715 + /* translators: %s: discount percentage */
716 + 'content_subheading' => __( 'Enjoy up to %s on PostX Pro.', 'ultimate-post' ),
717 + 'discount_content' => ' 50% OFF',
654 718 'border_color' => '#0322ff',
655 - ),
656 - array(
657 - 'key' => 'ultp_dashboard_content_notice_flash_sale_discount_logo',
658 - 'start' => '2026-05-13 00:00 Asia/Dhaka',
659 - 'end' => '2026-05-17 23:59 Asia/Dhaka',
660 - 'url' => Xpo::generate_utm_link(
661 - array(
662 - 'utmKey' => 'flash_sale',
663 - )
664 - ),
665 - 'visibility' => ! Xpo::is_lc_active(),
666 - 'content_heading' => __( 'Flash Sale:', 'ultimate-post' ),
667 - 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ),
668 - 'discount_content' => ' up to 45% Off',
669 - 'brand_color' => '#0322ff',
670 - 'icon' => ULTP_URL . 'assets/img/dashboard_banner/flash_sale_45_discount_logo.png',
719 + 'icon' => ULTP_URL . 'assets/img/dashboard_banner/brand_logo.svg',
671 720 'button_text' => __( 'Upgrade Now!', 'ultimate-post' ),
672 721 'is_discount_logo' => true,
673 - 'border_color' => '#0322ff',
674 722 ),
675 -
676 - // Surprise Sale
677 723 array(
678 - 'key' => 'ultp_dashboard_content_notice_surprise_sale_brand_logo',
679 - 'start' => '2026-05-22 00:00 Asia/Dhaka',
680 - 'end' => '2026-05-25 23:59 Asia/Dhaka',
724 + 'key' => 'ultp_dashboard_content_notice_summer_sale_2026_vv3',
725 + 'start' => '2026-08-02 00:00 Asia/Dhaka',
726 + 'end' => '2026-08-08 23:59 Asia/Dhaka',
681 727 'url' => Xpo::generate_utm_link(
682 728 array(
683 - 'utmKey' => 'surprise_sale',
729 + 'utmKey' => 'summer_db',
684 730 )
685 731 ),
686 732 'visibility' => ! Xpo::is_lc_active(),
687 - 'content_heading' => __( 'Surprise Sale:', 'ultimate-post' ),
688 - 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ),
689 - 'discount_content' => ' up to 50% Off',
690 - 'brand_color' => '#0322ff',
691 - 'icon' => ULTP_URL . 'assets/img/dashboard_banner/brand_logo_round.svg',
692 - 'button_text' => __( 'Claim Your Discount!', 'ultimate-post' ),
693 - 'is_discount_logo' => true,
733 + 'content_heading' => __( 'Summer Sale:', 'ultimate-post' ),
734 + /* translators: %s: discount percentage */
735 + 'content_subheading' => __( 'Enjoy up to %s on PostX Pro.', 'ultimate-post' ),
736 + 'discount_content' => ' 50% OFF',
694 737 'border_color' => '#0322ff',
695 - ),
696 - array(
697 - 'key' => 'ultp_dashboard_content_notice_surprise_sale_discount_logo',
698 - 'start' => '2026-05-26 00:00 Asia/Dhaka',
699 - 'end' => '2026-05-28 23:59 Asia/Dhaka',
700 - 'url' => Xpo::generate_utm_link(
701 - array(
702 - 'utmKey' => 'surprise_sale',
703 - )
704 - ),
705 - 'visibility' => ! Xpo::is_lc_active(),
706 - 'content_heading' => __( 'Surprise Sale:', 'ultimate-post' ),
707 - 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ),
708 - 'discount_content' => ' up to 50% Off',
709 - 'brand_color' => '#0322ff',
710 738 'icon' => ULTP_URL . 'assets/img/dashboard_banner/flash_sale_50_discount_logo.png',
711 739 'button_text' => __( 'Upgrade Now!', 'ultimate-post' ),
712 740 'is_discount_logo' => true,
713 - 'border_color' => '#0322ff',
714 741 ),
715 742
716 - // Massive Sale
717 - array(
718 - 'key' => 'ultp_dashboard_content_notice_massive_sale_brand_logo',
719 - 'start' => '2026-06-02 00:00 Asia/Dhaka',
720 - 'end' => '2026-06-10 23:59 Asia/Dhaka',
721 - 'url' => Xpo::generate_utm_link(
722 - array(
723 - 'utmKey' => 'massive_sale',
724 - )
725 - ),
726 - 'visibility' => ! Xpo::is_lc_active(),
727 - 'content_heading' => __( 'Massive Sale:', 'ultimate-post' ),
728 - 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ),
729 - 'discount_content' => ' up to 50% Off',
730 - 'brand_color' => '#0322ff',
731 - 'icon' => ULTP_URL . 'assets/img/dashboard_banner/brand_logo_round.svg',
732 - 'button_text' => __( 'Claim Your Discount!', 'ultimate-post' ),
733 - 'is_discount_logo' => true,
734 - 'border_color' => '#0322ff',
735 - ),
736 - array(
737 - 'key' => 'ultp_dashboard_content_notice_massive_sale_discount_logo',
738 - 'start' => '2026-06-11 00:00 Asia/Dhaka',
739 - 'end' => '2026-06-16 23:59 Asia/Dhaka',
740 - 'url' => Xpo::generate_utm_link(
741 - array(
742 - 'utmKey' => 'massive_sale',
743 - )
744 - ),
745 - 'visibility' => ! Xpo::is_lc_active(),
746 - 'content_heading' => __( 'Massive Sale:', 'ultimate-post' ),
747 - 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ),
748 - 'discount_content' => ' up to 50% Off',
749 - 'brand_color' => '#0322ff',
750 - 'icon' => ULTP_URL . 'assets/img/dashboard_banner/flash_sale_50_discount_logo.png',
751 - 'button_text' => __( 'Upgrade Now!', 'ultimate-post' ),
752 - 'is_discount_logo' => true,
753 - 'border_color' => '#0322ff',
754 - ),
755 -
756 - // Final Hours Sale
757 - array(
758 - 'key' => 'ultp_dashboard_content_notice_final_hours_sale_brand_logo',
759 - 'start' => '2026-06-21 00:00 Asia/Dhaka',
760 - 'end' => '2026-06-24 23:59 Asia/Dhaka',
761 - 'url' => Xpo::generate_utm_link(
762 - array(
763 - 'utmKey' => 'final_hour',
764 - )
765 - ),
766 - 'visibility' => ! Xpo::is_lc_active(),
767 - 'content_heading' => __( 'Final Hours Sale:', 'ultimate-post' ),
768 - 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ),
769 - 'discount_content' => ' up to 50% Off',
770 - 'brand_color' => '#0322ff',
771 - 'icon' => ULTP_URL . 'assets/img/dashboard_banner/brand_logo_round.svg',
772 - 'button_text' => __( 'Claim Your Discount!', 'ultimate-post' ),
773 - 'is_discount_logo' => true,
774 - 'border_color' => '#0322ff',
775 - ),
776 - array(
777 - 'key' => 'ultp_dashboard_content_notice_final_hours_sale_discount_logo',
778 - 'start' => '2026-06-25 00:00 Asia/Dhaka',
779 - 'end' => '2026-06-27 23:59 Asia/Dhaka',
780 - 'url' => Xpo::generate_utm_link(
781 - array(
782 - 'utmKey' => 'final_hour',
783 - )
784 - ),
785 - 'visibility' => ! Xpo::is_lc_active(),
786 - 'content_heading' => __( 'Final Hours Sale:', 'ultimate-post' ),
787 - 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ),
788 - 'discount_content' => ' up to 50% Off',
789 - 'brand_color' => '#0322ff',
790 - 'icon' => ULTP_URL . 'assets/img/dashboard_banner/flash_sale_50_discount_logo.png',
791 - 'button_text' => __( 'Upgrade Now!', 'ultimate-post' ),
792 - 'is_discount_logo' => true,
793 - 'border_color' => '#0322ff',
794 - ),
795 -
796 743 );
797 744
798 - $ultp_db_nonce = wp_create_nonce( 'ultp-nonce' );
745 + $ultp_db_nonce = wp_create_nonce( 'ultp-admin-nonce' );
799 746
800 747 foreach ( $content_notices as $key => $notice ) {
801 748 $notice_key = isset( $notice['key'] ) ? $notice['key'] : $this->notice_version;
802 - if ( isset( $_GET['ultp_notice'] ) && $notice_key === $_GET['ultp_notice'] ) {
749 + if ( isset( $_GET['ultp_notice'] ) && $notice_key === sanitize_text_field( wp_unslash( $_GET['ultp_notice'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only; hides the notice on this page view.
803 750 continue;
804 751 } else {
805 752 $border_color = $notice['border_color'];
806 753
@@ -810,9 +757,11 @@
810 757 if ( $current_time >= $notice_start && $current_time <= $notice_end && $notice['visibility'] ) {
811 758 $notice_transient = Xpo::get_transient_without_cache( 'ultp_get_pro_notice_' . $notice_key );
812 759
813 760 if ( 'off' !== $notice_transient ) {
814 -
761 + if ( $return_bool ) { // Early return for Other plugin notice.
762 + return true;
763 + }
815 764 $query_args = array(
816 765 'ultp_notice' => $notice_key,
817 766 'wpnonce' => $ultp_db_nonce,
818 767 );
@@ -921,32 +870,32 @@
921 870 </style>
922 871 <div class="ultp-content-notice-wrapper notice data_collection_notice"
923 872 style="border-left: 3px solid <?php echo esc_attr( $border_color ); ?>;"
924 873 >
925 - <?php
926 - if ( $notice['is_discount_logo'] ) {
927 - ?>
874 + <?php
875 + if ( $notice['is_discount_logo'] ) {
876 + ?>
928 877 <div class="ultp-content-notice-discout-icon"> <img src="<?php echo esc_url( $notice['icon'] ); ?>"/> </div>
929 - <?php
930 - } else {
878 + <?php
879 + } else {
880 + ?>
881 + <div class="ultp-content-notice-icon"> <img src="<?php echo esc_url( $notice['icon'] ); ?>"/> </div>
882 + <?php
883 + }
931 884 ?>
932 - <div class="ultp-content-notice-icon"> <img src="<?php echo esc_url( $notice['icon'] ); ?>"/> </div>
933 - <?php
934 - }
935 - ?>
936 885
937 886 <div class="ultp-notice-content-wrapper">
938 887 <div class="">
939 888 <strong><?php printf( esc_html( $notice['content_heading'] ) ); ?> </strong>
940 - <?php
941 - printf(
942 - wp_kses_post( $notice['content_subheading'] ),
943 - '<strong>' . esc_html( $notice['discount_content'] ) . '</strong>'
944 - );
945 - ?>
889 + <?php
890 + printf(
891 + wp_kses_post( $notice['content_subheading'] ),
892 + '<strong>' . esc_html( $notice['discount_content'] ) . '</strong>'
893 + );
894 + ?>
946 895 </div>
947 896 <div class="ultp-content-notice-buttons">
948 - <?php if ( isset( $notice['is_discount_logo'] ) && $notice['is_discount_logo'] ) : ?>
897 + <?php if ( isset( $notice['is_discount_logo'] ) && $notice['is_discount_logo'] ) : ?>
949 898 <a class="ultp-content-discount_btn" href="<?php echo esc_url( $url ); ?>" target="_blank">
950 899 <?php echo esc_html( $notice['button_text'] ); ?>
951 900 </a>
952 901 <?php else : ?>
@@ -966,11 +915,201 @@
966 915 );
967 916 ?>
968 917 class="ultp-content-notice-close"><span class="ultp-content-notice-close-icon dashicons dashicons-dismiss"> </span></a>
969 918 </div>
970 - <?php
919 + <?php
971 920 }
972 921 }
922 + }
923 + }
924 + }
925 +
926 + /**
927 + * Handle Plugin Notice for all plugins
928 + *
929 + * @param array $active_lists Lists of all active plugin notice.
930 + * @return array
931 + */
932 + public function handle_xpo_active_notice_lists( $active_lists ) {
933 + if ( $this->ultp_dashboard_banner_notice( true ) || $this->ultp_dashboard_content_notice( true ) || $this->ultp_dashboard_image_banner_notice( true ) ) {
934 + $active_lists[ $this->plugin_notice_priority_key ] = $this->plugin_notice_priority;
935 + }
936 + return $active_lists;
937 + }
938 +
939 + /**
940 + * Handle Plugin Notice for all plugins
941 + *
942 + * @return bool
943 + */
944 + /**
945 + * Whether the current admin screen belongs to PostX.
946 + *
947 + * Guideline 11 limits promotional UI to the plugin's own screens. Every PostX
948 + * screen carries `ultp` in its screen id — `toplevel_page_ultp-settings`,
949 + * `postx_page_ultp-setup-wizard`, and the `ultp_builder` / `ultp_templates` /
950 + * `ultp_custom_font` post-type screens.
951 + *
952 + * @return BOOL True when the current screen is a PostX screen.
953 + */
954 + public function is_postx_screen() {
955 + if ( ! function_exists( 'get_current_screen' ) ) {
956 + return false;
957 + }
958 + $screen = get_current_screen();
959 + return $screen && false !== strpos( $screen->id, 'ultp' );
960 + }
961 +
962 + public function is_available_for_notice() {
963 + // Guideline 11 — sale banners and upgrade prompts belong on PostX's own
964 + // screens, not on core screens or other plugins' pages.
965 + if ( ! $this->is_postx_screen() ) {
966 + return false;
967 + }
968 +
969 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Shared across WPXPO plugins (ProductX, WholesaleX, …); renaming breaks them.
970 + $active_notices = apply_filters( 'xpo_active_notice_lists', array() );
971 + if ( empty( $active_notices ) ) {
972 + return true;
973 + }
974 + asort( $active_notices );
975 + return array_key_first( $active_notices ) === $this->plugin_notice_priority_key;
976 + }
977 +
978 + public function ultp_dashboard_image_banner_notice( $return_bool = false ) {
979 + $ultp_db_nonce = wp_create_nonce( 'ultp-admin-nonce' );
980 + $banner_notices = array(
981 + array(
982 + 'key' => 'ultp_summer_sale_2612',
983 + 'start' => '2026-07-20 00:00 Asia/Dhaka', // format YY-MM-DD always set time 00:00 and zone Asia/Dhaka
984 + 'end' => '2026-08-01 23:59 Asia/Dhaka', // format YY-MM-DD always set time 23:59 and zone Asia/Dhaka
985 + 'banner_src' => ULTP_URL . 'assets/img/dashboard_banner/dashboard_banner_summer_sale.png',
986 + 'url' => Xpo::generate_utm_link(
987 + array(
988 + 'utmKey' => 'sub_menu_offer',
989 + )
990 + ),
991 + 'close_color' => '#000000',
992 + 'visibility' => ! Xpo::is_lc_active(),
993 + ),
994 + array(
995 + 'key' => 'ultp_summer_sale_2613',
996 + 'start' => '2026-08-09 00:00 Asia/Dhaka', // format YY-MM-DD always set time 00:00 and zone Asia/Dhaka
997 + 'end' => '2026-08-16 23:59 Asia/Dhaka', // format YY-MM-DD always set time 23:59 and zone Asia/Dhaka
998 + 'banner_src' => ULTP_URL . 'assets/img/dashboard_banner/dashboard_banner_summer_sale.png',
999 + 'url' => Xpo::generate_utm_link(
1000 + array(
1001 + 'utmKey' => 'sub_menu_offer',
1002 + )
1003 + ),
1004 + 'close_color' => '#000000',
1005 + 'visibility' => ! Xpo::is_lc_active(),
1006 + ),
1007 + array(
1008 + 'key' => 'ultp_preco_sale_campaign_262_1',
1009 + 'start' => '2026-08-23 00:00 Asia/Dhaka', // format YY-MM-DD always set time 00:00 and zone Asia/Dhaka
1010 + 'end' => '2026-08-29 23:59 Asia/Dhaka', // format YY-MM-DD always set time 23:59 and zone Asia/Dhaka
1011 + 'banner_src' => ULTP_URL . 'assets/img/dashboard_banner/preco_banner_insider_deal.png',
1012 + 'url' => 'https://www.wpxpo.com/product/wowrecommend/?utm_source=db-postx-notice&utm_medium=insider-deal&utm_campaign=postx-dashboard/#pricing',
1013 + 'close_color' => '#ffffff',
1014 + 'visibility' => ! Xpo::is_lc_active(),
1015 + ),
1016 + array(
1017 + 'key' => 'ultp_preco_sale_campaign_262_2',
1018 + 'start' => '2026-08-30 00:00 Asia/Dhaka', // format YY-MM-DD always set time 00:00 and zone Asia/Dhaka.
1019 + 'end' => '2026-09-19 23:59 Asia/Dhaka', // format YY-MM-DD always set time 23:59 and zone Asia/Dhaka.
1020 + 'banner_src' => ULTP_URL . 'assets/img/dashboard_banner/preco_banner_early_bird.png',
1021 + 'url' => 'https://www.wpxpo.com/product/wowrecommend/?utm_source=db-postx-notice&utm_medium=early-bird&utm_campaign=postx-dashboard/#pricing',
1022 + 'close_color' => '#ffffff',
1023 + 'visibility' => ! Xpo::is_lc_active(),
1024 + ),
1025 + );
1026 +
1027 + foreach ( $banner_notices as $notice ) {
1028 + $notice_key = isset( $notice['key'] ) ? $notice['key'] : $this->notice_version;
1029 + if ( isset( $_GET['ultp_notice'] ) && $notice_key === sanitize_text_field(wp_unslash($_GET['ultp_notice'])) ) { // phpcs:ignore
1030 + continue;
1031 + }
1032 +
1033 + $current_time = gmdate( 'U' );
1034 + $notice_start = gmdate( 'U', strtotime( $notice['start'] ) );
1035 + $notice_end = gmdate( 'U', strtotime( $notice['end'] ) );
1036 + if ( $current_time >= $notice_start && $current_time <= $notice_end && $notice['visibility'] ) {
1037 +
1038 + $notice_transient = Xpo::get_transient_without_cache( 'ultp_get_pro_notice_' . $notice_key );
1039 +
1040 + if ( 'off' === $notice_transient ) {
1041 + continue;
1042 + }
1043 +
1044 + if ( $return_bool ) { // Early return for Other plugin notice.
1045 + return true;
1046 + }
1047 +
1048 + if ( ! $this->notice_js_css_applied ) {
1049 + $this->ultp_banner_notice_js();
1050 + $this->notice_js_css_applied = true;
1051 + }
1052 + $query_args = array(
1053 + 'ultp_notice' => $notice_key,
1054 + 'wpnonce' => $ultp_db_nonce,
1055 + );
1056 + if ( isset( $notice['repeat_interval'] ) && $notice['repeat_interval'] ) {
1057 + $query_args['ultp_interval'] = $notice['repeat_interval'];
1058 + }
1059 + ?>
1060 + <style type="text/css">
1061 + .ultp-notice-wrapper.ultp-image-notice-wrapper {
1062 + padding: 0 !important;
1063 + position: relative;
1064 + box-sizing: border-box;
1065 + overflow: hidden;
1066 + border-radius: 0px;
1067 + border: none !important;
1068 + }
1069 + .ultp-notice-wrapper.ultp-image-notice-wrapper .ultp-image-banner {
1070 + position: relative;
1071 + line-height: 0;
1072 + }
1073 + .ultp-notice-wrapper.ultp-image-notice-wrapper .ultp-btn-image {
1074 + display: block;
1075 + }
1076 + .ultp-notice-wrapper.ultp-image-notice-wrapper .ultp-btn-image img {
1077 + display: block;
1078 + width: 100%;
1079 + height: auto;
1080 + border-radius: 0;
1081 + }
1082 + .ultp-notice-wrapper.ultp-image-notice-wrapper .ultp-content-notice-close {
1083 + top: 4px;
1084 + right: 4px;
1085 + position: absolute;
1086 + z-index: 999;
1087 + }
1088 + @media screen and (max-width: 650px) {
1089 + .ultp-image-notice-wrapper {
1090 + display: none;
1091 + }
1092 + }
1093 + </style>
1094 + <div class="ultp-notice-wrapper ultp-image-notice-wrapper notice wc-install ultp-free-notice">
1095 + <div class="wc-install-body ultp-image-banner">
1096 + <a class="wc-dismiss-notice ultp-content-notice-close" href="
1097 + <?php
1098 + echo esc_url(
1099 + add_query_arg(
1100 + $query_args
1101 + )
1102 + );
1103 + ?>
1104 + "><span class="ultp-content-notice-close-icon dashicons dashicons-dismiss" style="color: <?php echo esc_attr( $notice['close_color'] ); ?>;"> </span></a>
1105 + <a class="ultp-btn-image" target="_blank" href="<?php echo esc_url( $notice['url'] ); ?>">
1106 + <img loading="lazy" src="<?php echo esc_url( $notice['banner_src'] ); ?>" alt="Discount Banner"/>
1107 + </a>
1108 + </div>
1109 + </div>
1110 +
1111 + <?php
973 1112 }
974 1113 }
975 1114 }
976 1115 }