get_option( 'airy_wishlist_page_layout', 'table' ), 'columns' => '3', ), $atts ); $data = Airy_Wishlist_Data::instance(); // Detect a shared wishlist view via public token. // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only public view keyed by an unguessable token, no state change. $token = isset( $_GET['airy_wid'] ) ? sanitize_text_field( wp_unslash( $_GET['airy_wid'] ) ) : ''; // Guests can't use the wishlist when guest wishlists are disabled (shared views are still allowed). if ( '' === $token && ! $data->is_enabled_for_visitor() ) { return $this->get_guest_disabled_notice(); } $is_shared = false; $wishlists = array(); $active_id = 0; // Reset render context. $this->ctx_multiple = false; $this->ctx_wishlists = array(); $this->ctx_active_id = 0; if ( '' !== $token ) { $shared = $data->get_shared_wishlist( $token ); if ( null === $shared ) { return $this->get_shared_not_found(); } $is_shared = true; $items = $shared['items']; } else { // Owner view contains personalised data; prevent full-page caches from serving it to others. if ( ! defined( 'DONOTCACHEPAGE' ) ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- Standard WordPress / cache-plugin no-cache constant. define( 'DONOTCACHEPAGE', true ); } if ( $data->is_multiple_enabled() ) { $wishlists = $data->get_wishlists(); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only list selection; ownership is validated below. $active_id = isset( $_GET['airy_list'] ) ? absint( $_GET['airy_list'] ) : 0; if ( ! $active_id || ! $data->owns_wishlist( $active_id ) ) { $active_id = ! empty( $wishlists ) ? (int) $wishlists[0]->id : 0; } // Expose context to the item renderers (move dropdown, sharing). $this->ctx_multiple = true; $this->ctx_wishlists = $wishlists; $this->ctx_active_id = $active_id; $items = $active_id ? $data->get_items_for( $active_id ) : array(); } else { $items = $data->get_items(); } } ob_start(); do_action( 'airy_wishlist_before_table', $is_shared ); if ( $is_shared ) { $this->render_shared_heading(); } if ( ! $is_shared && $data->is_multiple_enabled() ) { $this->render_wishlist_switcher( $wishlists, $active_id ); } // Stock/price notification opt-in (shown when the feature is enabled). if ( ! $is_shared && 'yes' === get_option( 'airy_wishlist_notify_enabled', 'no' ) ) { if ( is_user_logged_in() ) { // Logged-in customers get the per-wishlist opt-in toggle. $current = null; if ( $data->is_multiple_enabled() ) { foreach ( $wishlists as $wishlist ) { if ( (int) $wishlist->id === (int) $active_id ) { $current = $wishlist; break; } } } else { $current = $data->get_wishlist(); } if ( $current ) { $this->render_notify_toggle( $current ); } } else { // Guests can't receive notifications (no account email); prompt to log in. $this->render_notify_login_prompt(); } } if ( empty( $items ) ) { $this->render_empty_wishlist(); } elseif ( 'grid' === $atts['layout'] ) { $this->render_grid_layout( $items, $atts['columns'], $is_shared ); } else { $this->render_table_layout( $items, $is_shared ); } do_action( 'airy_wishlist_after_table', $is_shared ); return ob_get_clean(); } /** * Message shown when a shared wishlist token is invalid or expired. * * @return string HTML output. */ private function get_shared_not_found() { ob_start(); ?>

notifications_enabled ); ?>
ctx_multiple ) { return; } $targets = array(); foreach ( $this->ctx_wishlists as $wishlist ) { if ( (int) $wishlist->id !== (int) $this->ctx_active_id ) { $targets[] = $wishlist; } } if ( empty( $targets ) ) { return; } ?>
id === (int) $active_id ) { $active = $wishlist; break; } } ?>
id, $base_url ); $is_active = (int) $wishlist->id === (int) $active_id; ?> wishlist_name ); ?>
is_default ) : ?>

render_share_buttons(); ?>
render_wishlist_item( $item, $show_stock, $show_date, $show_add_to_cart, $show_remove ); ?>
1 ) : ?>
variation_id > 0 ? $item->variation_id : $item->product_id; $product = wc_get_product( $product_id ); if ( ! $product ) { return; } // Check if product type allows add to cart. $can_add_to_cart = $product->is_purchasable() && $product->is_in_stock() && ! $product->is_type( 'grouped' ); ?>
product_id . '_' . $item->variation_id, 'airy_remove_nonce' ); ?>
get_image( 'thumbnail' ) ); ?> get_name() ); ?> variation_id > 0 && $product->is_type( 'variation' ) ) { echo '
'; echo wp_kses_post( wc_get_formatted_variation( $product, true ) ); echo '
'; } $this->render_move_control( $item ); ?> get_price_html() ); ?> is_in_stock() ) { echo '' . esc_html__( 'In Stock', 'airy-wishlist' ) . ''; } else { echo '' . esc_html__( 'Out of Stock', 'airy-wishlist' ) . ''; } ?> date_added ) ) ); ?> is_type( 'grouped' ) ) : ?>
render_share_buttons(); ?>
render_grid_item( $item, $is_shared ); ?>
variation_id > 0 ? $item->variation_id : $item->product_id; $product = wc_get_product( $product_id ); if ( ! $product ) { return; } $show_remove = ! $is_shared && 'yes' === get_option( 'airy_wishlist_show_remove_button', 'yes' ); ?>
get_image( 'woocommerce_thumbnail' ) ); ?>
product_id . '_' . $item->variation_id, 'airy_remove_nonce' ); ?>

get_name() ); ?>

variation_id > 0 && $product->is_type( 'variation' ) ) { echo '
'; echo wp_kses_post( wc_get_formatted_variation( $product, true ) ); echo '
'; } ?>
get_price_html() ); ?>
is_purchasable() && $product->is_in_stock() && ! $product->is_type( 'grouped' ) ) : ?> is_type( 'grouped' ) ) : ?> render_move_control( $item ); ?>
ctx_active_id ? $data->get_share_url_for( $this->ctx_active_id ) : $data->get_share_url(); if ( empty( $url ) ) { $url = airy_wishlist_get_url(); } $title = get_option( 'airy_wishlist_sharing_title', __( 'Check out my wishlist!', 'airy-wishlist' ) ); ?>
Facebook Twitter Pinterest WhatsApp Email
'heart', 'show_text' => 'no', ), $atts ); $data = Airy_Wishlist_Data::instance(); $count = $data->is_multiple_enabled() ? $data->get_total_count() : $data->get_count(); $url = $data->get_wishlist_url(); $icon_html = airy_wishlist_get_icon( $atts['icon'] ); ob_start(); ?>
0 ? '' : ' style="display:none;"'; ?>>
0, ), $atts ); if ( ! $atts['product_id'] ) { global $product; if ( $product ) { $atts['product_id'] = $product->get_id(); } } if ( ! $atts['product_id'] ) { return ''; } return airy_wishlist_get_button_html( $atts['product_id'] ); } }