is_allowed_page( $screen ) ) { return; } // Check basic conditions if ( ! self::is_user_allowed() || self::is_dismissed() || ! self::is_campaign_time() || self::has_pro() ) { return; } $this->enqueue_dependencies(); $pointer_content = '
' . esc_html__( 'Create a high-converting knowledge base & FAQ powered by AI with Instant Answers, Advanced Analytics & more.', 'betterdocs' ) . '
'; $pointer_content .= sprintf( '', self::PROMOTION_URL, esc_html__( 'Claim Offer', 'betterdocs' ) ); $allowed_tags = [ 'h3' => [], 'p' => [], 'a' => [ 'class' => [], 'target' => [ '_blank' ], 'href' => [], ], ]; ?> id, $betterdocs_screens, true ); } private static function is_user_allowed(): bool { return current_user_can( 'manage_options' ) || current_user_can( 'edit_docs' ); } private static function is_campaign_time() { $start = new \DateTime( '2025-11-25 12:00:00', new \DateTimeZone( 'UTC' ) ); $end = new \DateTime( '2025-12-04 23:59:59', new \DateTimeZone( 'UTC' ) ); $now = new \DateTime( 'now', new \DateTimeZone( 'UTC' ) ); return $now >= $start && $now <= $end; } private function enqueue_dependencies() { wp_enqueue_script( 'wp-pointer' ); wp_enqueue_style( 'wp-pointer' ); } private static function is_dismissed(): bool { return self::get_introduction_meta( self::DISMISS_ACTION_KEY ); } /** * Get introduction meta for the current user * * @param string|null $key Optional. Specific key to retrieve. * @return mixed */ public static function get_introduction_meta( $key = null ) { $user_id = get_current_user_id(); $introduction_meta = get_user_meta( $user_id, self::USER_META_KEY, true ); if ( ! is_array( $introduction_meta ) ) { $introduction_meta = []; } if ( $key ) { return isset( $introduction_meta[ $key ] ) ? $introduction_meta[ $key ] : false; } return $introduction_meta; } /** * Set introduction meta for the current user * * @param string $key The introduction key to set. * @return void */ public static function set_introduction_viewed( $key ) { $user_id = get_current_user_id(); $introduction_meta = self::get_introduction_meta(); $introduction_meta[ $key ] = true; update_user_meta( $user_id, self::USER_META_KEY, $introduction_meta ); } private static function has_pro(): bool { return is_plugin_active( 'betterdocs-pro/betterdocs-pro.php' ); } }