0 ) { foreach ( $default_notice as $key => $notice ) { $current_time = gmdate( 'U' ); if ( $current_time > strtotime( $notice['start'] ) && $current_time < strtotime( $notice['end'] ) && $notice['visibility'] ) { $valid_notices[] = $notice; } } } return $valid_notices; } /** * Dashboard Notice Data * * @since v.3.1.8 * @param NULL * @return NULL */ public function dashboard_notice_callback() { return array( array( 'key' => 'ultp_40k_installation', 'start' => '7-03-2024', 'end' => '13-03-2024', // 'type' => 'banner', // 'content' => ULTP_URL.'assets/img/dashboard_banner/black_friday_free.jpg', 'type' => 'content', 'force' => true, 'url' => ultimate_post()->get_premium_link('', 'dashboard_db_banner'), 'visibility' => !ultimate_post()->is_lc_active(), 'priority' => 50, 'repeat_interval' => '', ) ); } /** * Promotional Dismiss Notice Option Data * * @since v.2.0.1 * @param NULL * @return NULL */ public function set_dismiss_notice_callback() { $valid_notices = $this->notice_data(); if( !( isset($_GET['ultp_dashboard_nonce']) && wp_verify_nonce(sanitize_key(wp_unslash($_GET['ultp_dashboard_nonce'])), 'ultp-dashboardnonce') )) { return; } if ( count( $valid_notices ) > 0 ) { foreach ( $valid_notices as $notice ) { $notice_key = isset( $notice['key'] ) ? $notice['key'] : $this->notice_version; if ( isset( $_GET['disable_postx_notice_' .$notice_key ] ) ) { // @codingStandardsIgnoreLine if ( sanitize_key( $_GET['disable_postx_notice_' . $notice_key] ) == 'yes' ) { // @codingStandardsIgnoreLine if ( isset( $notice['repeat_interval'] ) && '' != $notice['repeat_interval'] ) { $interval = (int) $notice['repeat_interval']; ultimate_post()->set_transient_without_cache( 'ultp_get_pro_notice_' . $notice_key, 'off', $interval ); // 30 (2592000) days notice } else { ultimate_post()->set_transient_without_cache( 'ultp_get_pro_notice_' . $notice_key, 'off' ); // 30 (2592000) days notice } } } } } } /** * Dismiss Notice HTML Data * * @since v.1.0.0 * @param NULL * @return STRING */ public function ultp_installation_notice_callback() { $valid_notices = $this->notice_data(); $ultp_dashboard_nonce = wp_create_nonce('ultp-dashboardnonce'); if ( count( $valid_notices ) > 0 ) { $this->ultp_notice_css(); foreach ( $valid_notices as $notice ) { $notice_key = isset( $notice['key'] ) ? $notice['key'] : $this->notice_version; if ( ultimate_post()->get_transient_without_cache('ultp_get_pro_notice_' . $notice_key) != 'off' ) { if ( ( $notice['force'] || get_transient('wpxpo_installation_date') != 'yes' ) ) { if ( ! isset( $_GET['disable_postx_notice_' . $notice_key] ) ) { // @codingStandardsIgnoreLine switch ( $notice['type'] ) { case 'banner': ?>
Dismiss Discount Banner
Cheers to 40k+ Active Installations! Millions to come. Let's celebrate with a flat 40% off on PostX Pro
'yes', 'ultp_dashboard_nonce' => $ultp_dashboard_nonce ) ) ); ?> class="ultp-notice-close">
get_option_without_cache($option_name,array()); if(!isset($notice_data) || !is_array($notice_data)) { $notice_data = array(); } $notice_data[$key] = $value; if($expiration) { $expire_notice_key = 'timeout_'.$key; $notice_data[$expire_notice_key] = time() + $expiration; } update_option( $option_name, $notice_data ); } } public function get_notice($key='') { if($key) { $option_name = 'ultp_notice'; $notice_data = ultimate_post()->get_option_without_cache($option_name,array()); if(!isset($notice_data) || !is_array($notice_data)) { return false; } if(isset($notice_data[$key])) { $expire_notice_key = 'timeout_'.$key; if(isset($notice_data[$expire_notice_key]) && $notice_data[$expire_notice_key]< time() ) { unset($notice_data[$key]); unset($notice_data[$expire_notice_key]); update_option( $option_name, $notice_data); return false; } return $notice_data[$key]; } } return false; } }