'hello_bar', 'methods' => 'POST', 'callback' => array( $this, 'hello_bar_callback' ), 'permission_callback' => function () { return current_user_can( 'manage_options' ); }, ), ); foreach ( $routes as $route ) { register_rest_route( 'ultp', $route['endpoint'], array( array( 'methods' => $route['methods'], 'callback' => $route['callback'], 'permission_callback' => $route['permission_callback'], ), ) ); } } /** * Hellobar config * * @return array */ public static function get_hellobar_config() { return array( // Flash sale 'ultp_helloBar_flash_sale_2026_4' => Xpo::get_transient_without_cache( 'ultp_helloBar_flash_sale_2026_4' ), // Surprise sale 'ultp_helloBar_surprise_sale_2026_5' => Xpo::get_transient_without_cache( 'ultp_helloBar_surprise_sale_2026_5' ), // Massive sale 'ultp_helloBar_massive_sale_2026_6' => Xpo::get_transient_without_cache( 'ultp_helloBar_massive_sale_2026_6' ), // Final hours sale 'ultp_helloBar_final_hours_sale_2026_7' => Xpo::get_transient_without_cache( 'ultp_helloBar_final_hours_sale_2026_7' ), ); } /** * Handles Hello Bar dismissal action via REST API . * * @param \WP_REST_Request $request REST request object . * @return \WP_REST_Response */ public function hello_bar_callback( \WP_REST_Request $request ) { $request_params = $request->get_params(); $type = isset( $request_params['type'] ) ? $request_params['type'] : ''; $id = isset( $request_params['id'] ) ? $request_params['id'] : ''; if ( 'hello_bar' === $type && ! empty( $id ) ) { Xpo::set_transient_without_cache( $id, 'hide', 1296000 ); } return new \WP_REST_Response( array( 'success' => true, 'message' => __( 'Hello Bar Action performed', 'ultimate-post' ), ), 200 ); } /** * Set Notice Dismiss Callback * * @return void */ public function set_dismiss_notice_callback() { if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['wpnonce'] ?? '' ) ), 'ultp-nonce' ) ) { return; } $durbin_key = sanitize_text_field( wp_unslash( $_GET['ultp_durbin_key'] ?? '' ) ); // Durbin notice dismiss. if ( ! empty( $durbin_key ) ) { Xpo::set_transient_without_cache( 'ultp_durbin_notice_' . $durbin_key, 'off' ); if ( 'get' === sanitize_text_field( wp_unslash( $_GET['ultp_get_durbin'] ?? '' ) ) ) { DurbinClient::send( DurbinClient::ACTIVATE_ACTION ); } } // Install notice dismiss. $install_key = sanitize_text_field( wp_unslash( $_GET['ultp_install_key'] ?? '' ) ); if ( ! empty( $install_key ) ) { Xpo::set_transient_without_cache( 'ultp_install_notice_' . $install_key, 'off' ); } $notice_key = sanitize_text_field( wp_unslash( $_GET['ultp_notice'] ?? '' ) ); if ( ! empty( $notice_key ) ) { $interval = (int) sanitize_text_field( wp_unslash( $_GET['ultp_interval'] ?? '' ) ); if ( ! empty( $interval ) ) { Xpo::set_transient_without_cache( 'ultp_get_pro_notice_' . $notice_key, 'off', $interval ); } else { Xpo::set_transient_without_cache( 'ultp_get_pro_notice_' . $notice_key, 'off' ); } } } /** * Admin Notices Callback * * @return void */ public function admin_notices_callback() { $this->ultp_dashboard_notice_callback(); $this->ultp_dashboard_durbin_notice_callback(); } /** * Admin Dashboard Notice Callback * * @return void */ public function ultp_dashboard_notice_callback() { $this->ultp_dashboard_banner_notice(); $this->ultp_dashboard_content_notice(); } /** * Dashboard Banner Notice * * @return void */ public function ultp_dashboard_banner_notice() { $ultp_db_nonce = wp_create_nonce( 'ultp-nonce' ); $banner_notices = array( // FLash sale array( 'key' => 'ultp_banner_flash_sale_2026_1', 'start' => '2026-05-18 00:00 Asia/Dhaka', 'end' => '2026-05-21 23:59 Asia/Dhaka', // format YY-MM-DD always set time 23:59 and zone Asia/Dhaka. 'brand_color' => '#0322ff', 'left_image' => ULTP_URL . 'assets/img/dashboard_banner/flash_sale/offer.png', 'right_image' => ULTP_URL . 'assets/img/dashboard_banner/flash_sale/btn.png', 'bg_image' => ULTP_URL . 'assets/img/dashboard_banner/flash_sale/bg.png', 'text' => 'Deal ending soon', 'countdown_duration' => 259200, // Duration in seconds. // 'countdown_color' => '#0322ff', 'countdown_color' => '#3CF357', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'flash_sale_content', ) ), 'visibility' => ! Xpo::is_lc_active(), ), // surprise sale array( 'key' => 'ultp_banner_surprise_sale_2026_1', 'start' => '2026-05-29 00:00 Asia/Dhaka', 'end' => '2026-06-01 23:59 Asia/Dhaka', // format YY-MM-DD always set time 23:59 and zone Asia/Dhaka. 'brand_color' => '#0322ff', 'left_image' => ULTP_URL . 'assets/img/dashboard_banner/surprise_sale/offer.png', 'right_image' => ULTP_URL . 'assets/img/dashboard_banner/surprise_sale/btn.png', 'bg_image' => ULTP_URL . 'assets/img/dashboard_banner/surprise_sale/bg.png', 'text' => 'Limited Time Offer', 'countdown_duration' => 259200, // Duration in seconds. // 'countdown_color' => '#0322ff', 'countdown_color' => '#3CF357', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'surprise_sale_content', ) ), 'visibility' => ! Xpo::is_lc_active(), ), // massive sale array( 'key' => 'ultp_banner_massive_sale_2026_1', 'start' => '2026-06-17 00:00 Asia/Dhaka', 'end' => '2026-06-20 23:59 Asia/Dhaka', // format YY-MM-DD always set time 23:59 and zone Asia/Dhaka. 'brand_color' => '#0322ff', 'left_image' => ULTP_URL . 'assets/img/dashboard_banner/massive_sale/offer.png', 'right_image' => ULTP_URL . 'assets/img/dashboard_banner/massive_sale/btn.png', 'bg_image' => ULTP_URL . 'assets/img/dashboard_banner/massive_sale/bg.png', 'text' => 'Deal ending soon', 'countdown_duration' => 259200, // Duration in seconds. // 'countdown_color' => '#0322ff', 'countdown_color' => '#3CF357', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'massive_sale_content', ) ), 'visibility' => ! Xpo::is_lc_active(), ), // Final hours sale array( 'key' => 'ultp_banner_final_hours_sale_2026_1', 'start' => '2026-06-28 00:00 Asia/Dhaka', 'end' => '2026-06-30 23:59 Asia/Dhaka', // format YY-MM-DD always set time 23:59 and zone Asia/Dhaka. 'brand_color' => '#0322ff', 'left_image' => ULTP_URL . 'assets/img/dashboard_banner/final_hours_sale/offer.png', 'right_image' => ULTP_URL . 'assets/img/dashboard_banner/final_hours_sale/btn.png', 'bg_image' => ULTP_URL . 'assets/img/dashboard_banner/final_hours_sale/bg.png', 'text' => 'Hurry Before It Ends!', 'countdown_duration' => 259200, // Duration in seconds. // 'countdown_color' => '#0322ff', 'countdown_color' => '#3CF357', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'final_hours_content', ) ), 'visibility' => ! Xpo::is_lc_active(), ), ); foreach ( $banner_notices as $notice ) { $notice_key = isset( $notice['key'] ) ? $notice['key'] : $this->notice_version; if ( isset( $_GET['ultp_notice'] ) && $notice_key === sanitize_text_field(wp_unslash($_GET['ultp_notice'])) ) { // phpcs:ignore continue; } $current_time = gmdate( 'U' ); $notice_start = gmdate( 'U', strtotime( $notice['start'] ) ); $notice_end = gmdate( 'U', strtotime( $notice['end'] ) ); if ( $current_time >= $notice_start && $current_time <= $notice_end && $notice['visibility'] ) { $notice_transient = Xpo::get_transient_without_cache( 'ultp_get_pro_notice_' . $notice_key ); if ( 'off' === $notice_transient ) { continue; } if ( ! $this->notice_js_css_applied ) { $this->ultp_banner_notice_js(); $this->notice_js_css_applied = true; } $query_args = array( 'ultp_notice' => $notice_key, 'wpnonce' => $ultp_db_nonce, ); if ( isset( $notice['repeat_interval'] ) && $notice['repeat_interval'] ) { $query_args['ultp_interval'] = $notice['repeat_interval']; } ?>
00:00:00:00
notice_js_css_applied ) { $this->notice_js_css_applied = true; } $ultp_db_nonce = wp_create_nonce( 'ultp-nonce' ); ?> 'ultp_dashboard_content_notice_flash_sale_brand_logos', 'start' => '2026-05-07 00:00 Asia/Dhaka', 'end' => '2026-05-12 23:59 Asia/Dhaka', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'flash_sale', ) ), 'visibility' => ! Xpo::is_lc_active(), 'content_heading' => __( 'Flash Sale:', 'ultimate-post' ), 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ), 'discount_content' => ' up to 45% Off', 'brand_color' => '#0322ff', 'icon' => ULTP_URL . 'assets/img/dashboard_banner/brand_logo_round.svg', 'button_text' => __( 'Claim Your Discount!', 'ultimate-post' ), 'is_discount_logo' => true, 'border_color' => '#0322ff', ), array( 'key' => 'ultp_dashboard_content_notice_flash_sale_discount_logo', 'start' => '2026-05-13 00:00 Asia/Dhaka', 'end' => '2026-05-17 23:59 Asia/Dhaka', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'flash_sale', ) ), 'visibility' => ! Xpo::is_lc_active(), 'content_heading' => __( 'Flash Sale:', 'ultimate-post' ), 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ), 'discount_content' => ' up to 45% Off', 'brand_color' => '#0322ff', 'icon' => ULTP_URL . 'assets/img/dashboard_banner/flash_sale_45_discount_logo.png', 'button_text' => __( 'Upgrade Now!', 'ultimate-post' ), 'is_discount_logo' => true, 'border_color' => '#0322ff', ), // Surprise Sale array( 'key' => 'ultp_dashboard_content_notice_surprise_sale_brand_logo', 'start' => '2026-05-22 00:00 Asia/Dhaka', 'end' => '2026-05-25 23:59 Asia/Dhaka', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'surprise_sale', ) ), 'visibility' => ! Xpo::is_lc_active(), 'content_heading' => __( 'Surprise Sale:', 'ultimate-post' ), 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ), 'discount_content' => ' up to 50% Off', 'brand_color' => '#0322ff', 'icon' => ULTP_URL . 'assets/img/dashboard_banner/brand_logo_round.svg', 'button_text' => __( 'Claim Your Discount!', 'ultimate-post' ), 'is_discount_logo' => true, 'border_color' => '#0322ff', ), array( 'key' => 'ultp_dashboard_content_notice_surprise_sale_discount_logo', 'start' => '2026-05-26 00:00 Asia/Dhaka', 'end' => '2026-05-28 23:59 Asia/Dhaka', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'surprise_sale', ) ), 'visibility' => ! Xpo::is_lc_active(), 'content_heading' => __( 'Surprise Sale:', 'ultimate-post' ), 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ), 'discount_content' => ' up to 50% Off', 'brand_color' => '#0322ff', 'icon' => ULTP_URL . 'assets/img/dashboard_banner/flash_sale_50_discount_logo.png', 'button_text' => __( 'Upgrade Now!', 'ultimate-post' ), 'is_discount_logo' => true, 'border_color' => '#0322ff', ), // Massive Sale array( 'key' => 'ultp_dashboard_content_notice_massive_sale_brand_logo', 'start' => '2026-06-02 00:00 Asia/Dhaka', 'end' => '2026-06-10 23:59 Asia/Dhaka', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'massive_sale', ) ), 'visibility' => ! Xpo::is_lc_active(), 'content_heading' => __( 'Massive Sale:', 'ultimate-post' ), 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ), 'discount_content' => ' up to 50% Off', 'brand_color' => '#0322ff', 'icon' => ULTP_URL . 'assets/img/dashboard_banner/brand_logo_round.svg', 'button_text' => __( 'Claim Your Discount!', 'ultimate-post' ), 'is_discount_logo' => true, 'border_color' => '#0322ff', ), array( 'key' => 'ultp_dashboard_content_notice_massive_sale_discount_logo', 'start' => '2026-06-11 00:00 Asia/Dhaka', 'end' => '2026-06-16 23:59 Asia/Dhaka', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'massive_sale', ) ), 'visibility' => ! Xpo::is_lc_active(), 'content_heading' => __( 'Massive Sale:', 'ultimate-post' ), 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ), 'discount_content' => ' up to 50% Off', 'brand_color' => '#0322ff', 'icon' => ULTP_URL . 'assets/img/dashboard_banner/flash_sale_50_discount_logo.png', 'button_text' => __( 'Upgrade Now!', 'ultimate-post' ), 'is_discount_logo' => true, 'border_color' => '#0322ff', ), // Final Hours Sale array( 'key' => 'ultp_dashboard_content_notice_final_hours_sale_brand_logo', 'start' => '2026-06-21 00:00 Asia/Dhaka', 'end' => '2026-06-24 23:59 Asia/Dhaka', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'final_hour', ) ), 'visibility' => ! Xpo::is_lc_active(), 'content_heading' => __( 'Final Hours Sale:', 'ultimate-post' ), 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ), 'discount_content' => ' up to 50% Off', 'brand_color' => '#0322ff', 'icon' => ULTP_URL . 'assets/img/dashboard_banner/brand_logo_round.svg', 'button_text' => __( 'Claim Your Discount!', 'ultimate-post' ), 'is_discount_logo' => true, 'border_color' => '#0322ff', ), array( 'key' => 'ultp_dashboard_content_notice_final_hours_sale_discount_logo', 'start' => '2026-06-25 00:00 Asia/Dhaka', 'end' => '2026-06-27 23:59 Asia/Dhaka', 'url' => Xpo::generate_utm_link( array( 'utmKey' => 'final_hour', ) ), 'visibility' => ! Xpo::is_lc_active(), 'content_heading' => __( 'Final Hours Sale:', 'ultimate-post' ), 'content_subheading' => __( 'Enjoy %s on PostX Pro.', 'ultimate-post' ), 'discount_content' => ' up to 50% Off', 'brand_color' => '#0322ff', 'icon' => ULTP_URL . 'assets/img/dashboard_banner/flash_sale_50_discount_logo.png', 'button_text' => __( 'Upgrade Now!', 'ultimate-post' ), 'is_discount_logo' => true, 'border_color' => '#0322ff', ), ); $ultp_db_nonce = wp_create_nonce( 'ultp-nonce' ); foreach ( $content_notices as $key => $notice ) { $notice_key = isset( $notice['key'] ) ? $notice['key'] : $this->notice_version; if ( isset( $_GET['ultp_notice'] ) && $notice_key === $_GET['ultp_notice'] ) { continue; } else { $border_color = $notice['border_color']; $current_time = gmdate( 'U' ); $notice_start = gmdate( 'U', strtotime( $notice['start'] ) ); $notice_end = gmdate( 'U', strtotime( $notice['end'] ) ); if ( $current_time >= $notice_start && $current_time <= $notice_end && $notice['visibility'] ) { $notice_transient = Xpo::get_transient_without_cache( 'ultp_get_pro_notice_' . $notice_key ); if ( 'off' !== $notice_transient ) { $query_args = array( 'ultp_notice' => $notice_key, 'wpnonce' => $ultp_db_nonce, ); if ( isset( $notice['repeat_interval'] ) && $notice['repeat_interval'] ) { $query_args['ultp_interval'] = $notice['repeat_interval']; } $url = isset( $notice['url'] ) ? $notice['url'] : Xpo::generate_utm_link( array( 'utmKey' => 'content_notice', ) ); ?>
' . esc_html( $notice['discount_content'] ) . '' ); ?>
class="ultp-content-notice-close">