' : ''; $classes = get_option( 'yith_wcwl_use_button' ) == 'yes' ? 'class="add_to_wishlist single_add_to_wishlist button alt"' : 'class="add_to_wishlist"'; $html = '
'; $html .= ''; $html .= ''; $html .= '
' . apply_filters( 'yith-wcwl-browse-wishlist-label', __( 'Browse Wishlist', 'yith-woocommerce-wishlist' ) ) . '
'; $html .= '
'; $html .= '
'; $html .= '
'; return $html; } /** * Build the "Add to cart" HTML. * * @deprecated * @param string $url * @param string $stock_status * @param string $type * @return string * @static * @since 1.0.0 */ public static function add_to_cart_button( $product_id, $stock_status ) { _deprecated_function( 'add_to_cart_button', '2.0.0', 'wc_get_template( "loop/add-to-cart.php" )' ); global $yith_wcwl, $product; if ( function_exists( 'get_product' ) ) $product = get_product( $product_id ); else $product = new WC_Product( $product_id ); $url = $product->product_type == 'external' ? $yith_wcwl->get_affiliate_product_url( $product_id ) : $yith_wcwl->get_addtocart_url( $product_id ); $label_option = get_option( 'yith_wcwl_add_to_cart_text' ); $localize_label = function_exists( 'icl_translate' ) ? icl_translate( 'Plugins', 'plugin_yit_wishlist_button', $label_option ) : $label_option; $label = $product->product_type == 'variable' ? apply_filters( 'variable_add_to_cart_text', __('Select options', 'yith-woocommerce-wishlist') ) : apply_filters( 'yith_wcwl_add_to_cart_label', $localize_label ); $icon = get_option( 'yith_wcwl_use_button' ) == 'yes' && get_option( 'yith_wcwl_add_to_cart_icon' ) != 'none' ? '' : ''; $cartlink = ''; $redirect_to_cart = get_option( 'yith_wcwl_redirect_cart' ) == 'yes' && $product->product_type != 'variable' ? 'true' : 'false'; $style = ''; //indicates the style (background-color and font color) if( get_option( 'yith_wcwl_use_button' ) == 'yes' ) { if( $product->product_type == 'external' ) { $cartlink .= '' . $icon . $label . ''; } else { if( $product->product_type == 'external' ) { $cartlink .= '' . $icon . $label . ''; } else { $cartlink .= '' . $icon . $label . ''; } } return $cartlink; } /** * Build share HTML. * * @deprecated * @param string $url * @return string $string * @static * @since 1.0.0 */ public static function get_share_links( $url ) { _deprecated_function( 'get_share_links', '2.0.0', 'share.php template' ); $normal_url = $url; $url = urlencode( $url ); $title = apply_filters( 'plugin_text', urlencode( get_option( 'yith_wcwl_socials_title' ) ) ); $twitter_summary = str_replace( '%wishlist_url%', '', get_option( 'yith_wcwl_socials_text' ) ); $summary = urlencode( str_replace( '%wishlist_url%', $normal_url, get_option( 'yith_wcwl_socials_text' ) ) ); $imageurl = urlencode( get_option( 'yith_wcwl_socials_image_url' ) ); $html = '
'; $html .= apply_filters( 'yith_wcwl_socials_share_title', '' . __( 'Share on:', 'yith-woocommerce-wishlist' ) . '' ); $html .= ''; $html .= '
'; return $html; } /** * Adds classes to add-to-cart button * * @param $button_html string * @param $product \WC_Product * @return string * @static * @since 2.0.0 */ public static function alter_add_to_cart_button( $button_html, $product ){ // retrieve options $label_option = get_option( 'yith_wcwl_add_to_cart_text' ); $label = $product->is_type( 'variable' ) ? apply_filters( 'variable_add_to_cart_text', __('Select options', 'yith-woocommerce-wishlist') ) : apply_filters( 'yith_wcwl_add_to_cart_label', $label_option ); $icon = ''; if( get_option( 'yith_wcwl_frontend_css' ) != 'yes' && get_option( 'yith_wcwl_use_button' ) == 'yes' && get_option( 'yith_wcwl_add_to_cart_icon' ) != 'none' ) { $icon = ''; } // customize $match = array(); preg_match( '/.*<\/a>/', $button_html, $match ); if( ! empty( $match ) && isset( $match[1] ) ){ $button_html = str_replace( $match[1], $match[1] . ' add_to_cart button alt', $button_html ); } preg_match( '/(.*)<\/a>/', $button_html, $match ); if( ! empty( $match ) && isset( $match[1] ) ){ $button_html = str_replace( $match[1], $icon . ' ' . $label, $button_html ); } return $button_html; } } }