self::$_post_id, ); $inline_tags = array( '', rtrim( Tag::TYPE_ESI, '.' ), Tag::TYPE_ESI . 'yith_wcwl_add', ); $inline_tags = implode( ',', array_map( function($val){ return 'public:' . LSWCP_TAG_PREFIX . '_' . $val; }, $inline_tags ) ); $inline_tags .= ',' . LSWCP_TAG_PREFIX . '_tag_priv'; do_action( 'litespeed_esi_combine', 'yith_wcwl_add' ); $inline_params = array( 'val' => $template, 'tag' => $inline_tags, 'control' => 'private,no-vary,max-age=' . Conf::cls()->conf( Base::O_CACHE_TTL_PRIV ), ); return apply_filters( 'litespeed_esi_url', 'yith_wcwl_add', 'YITH ADD TO WISHLIST', $params, 'private,no-vary', false, false, false, $inline_params ); } /** * Hooked to the litespeed_esi_load-yith_wcwl_add action. * * This will load the add to wishlist button html for output. * * @since 1.1.0 * @access public */ public static function load_add_to_wishlist( $params ) { // global $post, $wp_query; // $post = get_post( $params[ self::ESI_PARAM_POSTID ] ); // $wp_query->setup_postdata( $post ); echo \YITH_WCWL_Shortcode::add_to_wishlist( array( 'product_id' => $params[ self::ESI_PARAM_POSTID ] ) ); do_action( 'litespeed_control_set_private', 'yith wishlist' ); do_action( 'litespeed_vary_no' ); } /** * Generate ESI inline value * * @since 3.4.2 */ public static function inline_add_to_wishlist( $res, $params ) { if ( ! is_array( $res ) ) { $res = array(); } $pid = $params[ self::ESI_PARAM_POSTID ]; $res[ 'val' ] = \YITH_WCWL_Shortcode::add_to_wishlist( array( 'product_id' => $pid ) ); $res[ 'control' ] = 'private,no-vary,max-age=' . Conf::cls()->conf( Base::O_CACHE_TTL_PRIV ); $inline_tags = array( '', rtrim( Tag::TYPE_ESI, '.' ), Tag::TYPE_ESI . 'yith_wcwl_add', ); $inline_tags = implode( ',', array_map( function( $val ) { return 'public:' . LSWCP_TAG_PREFIX . '_' . $val; }, $inline_tags ) ); $inline_tags .= ',' . LSWCP_TAG_PREFIX . '_tag_priv'; $res[ 'tag' ] = $inline_tags; return $res; } }