diff options
Diffstat (limited to 'inc/builder/type/header/edd-cart')
5 files changed, 634 insertions, 0 deletions
diff --git a/inc/builder/type/header/edd-cart/assets/js/minified/customizer-preview.min.js b/inc/builder/type/header/edd-cart/assets/js/minified/customizer-preview.min.js new file mode 100644 index 0000000..c764121 --- /dev/null +++ b/inc/builder/type/header/edd-cart/assets/js/minified/customizer-preview.min.js @@ -0,0 +1 @@ +!function(t){var e=".ast-edd-site-header-cart",d=".astra-cart-drawer.edd-active";astra_css("astra-settings[edd-header-cart-icon-color]","color",e+" .ast-edd-cart-menu-wrap .count, "+e+" .ast-edd-cart-menu-wrap .count:after,"+e+" .ast-edd-header-cart-info-wrap"),astra_css("astra-settings[edd-header-cart-icon-color]","border-color",e+" .ast-edd-cart-menu-wrap .count, "+e+" .ast-edd-cart-menu-wrap .count:after"),astra_color_responsive_css("edd-cart-colors","astra-settings[header-edd-cart-text-color]","color",e+" .widget_edd_cart_widget span, "+e+" .widget_edd_cart_widget strong, "+e+" .widget_edd_cart_widget *, "+d+" .widget_edd_cart_widget span, .astra-cart-drawer .widget_edd_cart_widget *, "+d+" .astra-cart-drawer-title"),astra_color_responsive_css("edd-cart-colors","astra-settings[header-edd-cart-link-color]","color",e+" .widget_edd_cart_widget a, "+e+" .widget_edd_cart_widget a.edd-remove-from-cart, "+e+" .widget_edd_cart_widget .cart-total, "+e+" .widget_edd_cart_widget a.edd-remove-from-cart:after, "+d+" .widget_edd_cart_widget a, "+d+" .widget_edd_cart_widget a.edd-remove-from-cart, "+d+" .widget_edd_cart_widget .cart-total, "+d+" .widget_edd_cart_widget a.edd-remove-from-cart:after"),astra_color_responsive_css("edd-cart-colors","astra-settings[header-edd-cart-link-color]","border-color",e+" .widget_edd_cart_widget a.edd-remove-from-cart:after,"+d+" .widget_edd_cart_widget a.edd-remove-from-cart:after,"),astra_color_responsive_css("edd-cart-colors","astra-settings[header-edd-cart-background-color]","background-color",".ast-builder-layout-element "+e+" .widget_edd_cart_widget ,"+d+", "+d+"#astra-mobile-cart-drawer"),astra_color_responsive_css("edd-cart-border-color","astra-settings[header-edd-cart-background-color]","border-color",".ast-builder-layout-element "+e+" .widget_edd_cart_widget, "+d+" .widget_edd_cart_widget"),astra_color_responsive_css("edd-cart-border-bottom-color","astra-settings[header-edd-cart-background-color]","border-bottom-color",".ast-builder-layout-element "+e+" .widget_edd_cart_widget:before, .ast-builder-layout-element "+e+" .widget_edd_cart_widget:after, "+d+" .widget_edd_cart_widget:before, "+d+" .widget_edd_cart_widget:after"),astra_color_responsive_css("edd-cart-colors","astra-settings[header-edd-cart-separator-color]","border-bottom-color",".ast-builder-layout-element "+e+" .widget_edd_cart_widget .edd-cart-item, .ast-builder-layout-element "+e+" .widget_edd_cart_widget .edd-cart-number-of-items, .ast-builder-layout-element "+e+" .widget_edd_cart_widget .edd-cart-meta,"+d+" .widget_edd_cart_widget .edd-cart-item, "+d+" .widget_edd_cart_widget .edd-cart-number-of-items, "+d+" .widget_edd_cart_widget .edd-cart-meta, "+d+" .astra-cart-drawer-header"),astra_color_responsive_css("edd-cart-colors","astra-settings[header-edd-checkout-btn-text-color]","color",e+" .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a, "+d+" .widget_edd_cart_widget .edd_checkout a"),astra_color_responsive_css("edd-cart-colors","astra-settings[header-edd-checkout-btn-background-color]","background-color",e+" .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a,"+d+" .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a"),astra_color_responsive_css("edd-cart-border-color","astra-settings[header-edd-checkout-btn-background-color]","border-color",e+" .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a,"+d+" .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a"),astra_color_responsive_css("edd-cart-colors","astra-settings[header-edd-checkout-btn-text-hover-color]","color",e+" .widget_edd_cart_widget .edd_checkout a:hover, .widget_edd_cart_widget .edd_checkout a:hover,"+d+" .widget_edd_cart_widget .edd_checkout a:hover, .widget_edd_cart_widget .edd_checkout a:hover"),astra_color_responsive_css("edd-cart-colors","astra-settings[header-edd-checkout-btn-bg-hover-color]","background-color",e+" .widget_edd_cart_widget .edd_checkout a:hover, .widget_edd_cart_widget .edd_checkout a:hover, "+d+" .widget_edd_cart_widget .edd_checkout a:hover, .widget_edd_cart_widget .edd_checkout a:hover"),wp.customize("astra-settings[edd-header-cart-icon-style]",function(e){e.bind(function(e){var d=t(document).find(".ast-edd-site-header-cart");d.removeClass("ast-edd-menu-cart-fill ast-edd-menu-cart-outline"),d.addClass("ast-edd-menu-cart-"+e);astra_add_dynamic_css("edd-header-cart-icon-style",".ast-edd-site-header-cart a, .ast-edd-site-header-cart a *{ transition: all 0s; } "),wp.customize.preview.send("refresh")})}),wp.customize("astra-settings[edd-header-cart-icon-color]",function(e){e.bind(function(e){wp.customize.preview.send("refresh")})}),wp.customize("astra-settings[edd-header-cart-icon-radius]",function(e){e.bind(function(e){e=".ast-edd-site-header-cart.ast-edd-menu-cart-outline .ast-addon-cart-wrap, .ast-edd-site-header-cart.ast-edd-menu-cart-fill .ast-addon-cart-wrap, .ast-edd-site-header-cart.ast-edd-menu-cart-outline .count, .ast-edd-site-header-cart.ast-edd-menu-cart-fill .count{ border-radius: "+parseInt(e)+"px } ";astra_add_dynamic_css("edd-header-cart-icon-radius",e)})}),wp.customize("astra-settings[transparent-header-edd-cart-icon-color]",function(e){e.bind(function(e){wp.customize.preview.send("refresh")})}),astra_builder_visibility_css("section-header-edd-cart",".ast-header-edd-cart")}(jQuery);
\ No newline at end of file diff --git a/inc/builder/type/header/edd-cart/assets/js/unminified/customizer-preview.js b/inc/builder/type/header/edd-cart/assets/js/unminified/customizer-preview.js new file mode 100644 index 0000000..87f8cf0 --- /dev/null +++ b/inc/builder/type/header/edd-cart/assets/js/unminified/customizer-preview.js @@ -0,0 +1,161 @@ +/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra
+ * @since x.x.x
+ */
+
+( function( $ ) {
+
+ var selector = '.ast-edd-site-header-cart';
+ var responsive_selector = '.astra-cart-drawer.edd-active';
+
+ // Icon Color.
+ astra_css(
+ 'astra-settings[edd-header-cart-icon-color]',
+ 'color',
+ selector + ' .ast-edd-cart-menu-wrap .count, ' + selector + ' .ast-edd-cart-menu-wrap .count:after,' + selector + ' .ast-edd-header-cart-info-wrap'
+ );
+
+ // Icon Color.
+ astra_css(
+ 'astra-settings[edd-header-cart-icon-color]',
+ 'border-color',
+ selector + ' .ast-edd-cart-menu-wrap .count, ' + selector + ' .ast-edd-cart-menu-wrap .count:after'
+ );
+
+ // EDD Cart Colors.
+ astra_color_responsive_css(
+ 'edd-cart-colors',
+ 'astra-settings[header-edd-cart-text-color]',
+ 'color',
+ selector + ' .widget_edd_cart_widget span, ' + selector + ' .widget_edd_cart_widget strong, ' + selector + ' .widget_edd_cart_widget *, ' + responsive_selector + ' .widget_edd_cart_widget span, .astra-cart-drawer .widget_edd_cart_widget *, ' + responsive_selector + ' .astra-cart-drawer-title'
+ );
+
+ astra_color_responsive_css(
+ 'edd-cart-colors',
+ 'astra-settings[header-edd-cart-link-color]',
+ 'color',
+ selector + ' .widget_edd_cart_widget a, ' + selector + ' .widget_edd_cart_widget a.edd-remove-from-cart, ' + selector + ' .widget_edd_cart_widget .cart-total, ' + selector + ' .widget_edd_cart_widget a.edd-remove-from-cart:after, '+ responsive_selector + ' .widget_edd_cart_widget a, ' + responsive_selector + ' .widget_edd_cart_widget a.edd-remove-from-cart, ' + responsive_selector + ' .widget_edd_cart_widget .cart-total, ' + responsive_selector + ' .widget_edd_cart_widget a.edd-remove-from-cart:after'
+ );
+ astra_color_responsive_css(
+ 'edd-cart-colors',
+ 'astra-settings[header-edd-cart-link-color]',
+ 'border-color',
+ selector + ' .widget_edd_cart_widget a.edd-remove-from-cart:after,' + responsive_selector + ' .widget_edd_cart_widget a.edd-remove-from-cart:after,'
+ );
+
+ astra_color_responsive_css(
+ 'edd-cart-colors',
+ 'astra-settings[header-edd-cart-background-color]',
+ 'background-color',
+ '.ast-builder-layout-element ' + selector + ' .widget_edd_cart_widget ,' + responsive_selector + ', ' + responsive_selector + '#astra-mobile-cart-drawer'
+ );
+
+ astra_color_responsive_css(
+ 'edd-cart-border-color',
+ 'astra-settings[header-edd-cart-background-color]',
+ 'border-color',
+ '.ast-builder-layout-element ' + selector + ' .widget_edd_cart_widget, ' + responsive_selector + ' .widget_edd_cart_widget'
+ );
+
+ astra_color_responsive_css(
+ 'edd-cart-border-bottom-color',
+ 'astra-settings[header-edd-cart-background-color]',
+ 'border-bottom-color',
+ '.ast-builder-layout-element ' + selector + ' .widget_edd_cart_widget:before, .ast-builder-layout-element ' + selector + ' .widget_edd_cart_widget:after, ' + responsive_selector + ' .widget_edd_cart_widget:before, ' + responsive_selector + ' .widget_edd_cart_widget:after'
+ );
+
+ astra_color_responsive_css(
+ 'edd-cart-colors',
+ 'astra-settings[header-edd-cart-separator-color]',
+ 'border-bottom-color',
+ '.ast-builder-layout-element ' + selector + ' .widget_edd_cart_widget .edd-cart-item, .ast-builder-layout-element ' + selector + ' .widget_edd_cart_widget .edd-cart-number-of-items, .ast-builder-layout-element ' + selector + ' .widget_edd_cart_widget .edd-cart-meta,'+ responsive_selector + ' .widget_edd_cart_widget .edd-cart-item, ' + responsive_selector + ' .widget_edd_cart_widget .edd-cart-number-of-items, ' + responsive_selector + ' .widget_edd_cart_widget .edd-cart-meta, ' + responsive_selector + ' .astra-cart-drawer-header'
+ );
+
+ astra_color_responsive_css(
+ 'edd-cart-colors',
+ 'astra-settings[header-edd-checkout-btn-text-color]',
+ 'color',
+ selector + ' .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a, '+ responsive_selector + ' .widget_edd_cart_widget .edd_checkout a'
+ );
+
+ astra_color_responsive_css(
+ 'edd-cart-colors',
+ 'astra-settings[header-edd-checkout-btn-background-color]',
+ 'background-color',
+ selector + ' .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a,' + responsive_selector + ' .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a'
+ );
+
+ astra_color_responsive_css(
+ 'edd-cart-border-color',
+ 'astra-settings[header-edd-checkout-btn-background-color]',
+ 'border-color',
+ selector + ' .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a,' + responsive_selector + ' .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a'
+ );
+
+ astra_color_responsive_css(
+ 'edd-cart-colors',
+ 'astra-settings[header-edd-checkout-btn-text-hover-color]',
+ 'color',
+ selector +' .widget_edd_cart_widget .edd_checkout a:hover, .widget_edd_cart_widget .edd_checkout a:hover,' + responsive_selector +' .widget_edd_cart_widget .edd_checkout a:hover, .widget_edd_cart_widget .edd_checkout a:hover'
+ );
+
+ astra_color_responsive_css(
+ 'edd-cart-colors',
+ 'astra-settings[header-edd-checkout-btn-bg-hover-color]',
+ 'background-color',
+ selector +' .widget_edd_cart_widget .edd_checkout a:hover, .widget_edd_cart_widget .edd_checkout a:hover, ' + responsive_selector + ' .widget_edd_cart_widget .edd_checkout a:hover, .widget_edd_cart_widget .edd_checkout a:hover'
+ );
+
+ /**
+ * Cart icon style
+ */
+ wp.customize( 'astra-settings[edd-header-cart-icon-style]', function( setting ) {
+ setting.bind( function( icon_style ) {
+ var buttons = $(document).find('.ast-edd-site-header-cart');
+ buttons.removeClass('ast-edd-menu-cart-fill ast-edd-menu-cart-outline');
+ buttons.addClass( 'ast-edd-menu-cart-' + icon_style );
+ var dynamicStyle = '.ast-edd-site-header-cart a, .ast-edd-site-header-cart a *{ transition: all 0s; } ';
+ astra_add_dynamic_css( 'edd-header-cart-icon-style', dynamicStyle );
+ wp.customize.preview.send( 'refresh' );
+ } );
+ } );
+
+ /**
+ * EDD Cart Button Color
+ */
+ wp.customize( 'astra-settings[edd-header-cart-icon-color]', function( setting ) {
+ setting.bind( function( cart_icon_color ) {
+ wp.customize.preview.send( 'refresh' );
+ });
+ });
+
+ /**
+ * Button Border Radius
+ */
+ wp.customize( 'astra-settings[edd-header-cart-icon-radius]', function( setting ) {
+ setting.bind( function( border ) {
+
+ var dynamicStyle = '.ast-edd-site-header-cart.ast-edd-menu-cart-outline .ast-addon-cart-wrap, .ast-edd-site-header-cart.ast-edd-menu-cart-fill .ast-addon-cart-wrap, .ast-edd-site-header-cart.ast-edd-menu-cart-outline .count, .ast-edd-site-header-cart.ast-edd-menu-cart-fill .count{ border-radius: ' + ( parseInt( border ) ) + 'px } ';
+ astra_add_dynamic_css( 'edd-header-cart-icon-radius', dynamicStyle );
+
+ } );
+ } );
+
+ /**
+ * Transparent Header EDD-Cart color options - Customizer preview CSS.
+ */
+ wp.customize( 'astra-settings[transparent-header-edd-cart-icon-color]', function( setting ) {
+ setting.bind( function( cart_icon_color ) {
+ wp.customize.preview.send( 'refresh' );
+ });
+ });
+
+ // Advanced Visibility CSS Generation.
+ astra_builder_visibility_css( 'section-header-edd-cart', '.ast-header-edd-cart' );
+
+} )( jQuery );
diff --git a/inc/builder/type/header/edd-cart/class-astra-header-edd-cart-component.php b/inc/builder/type/header/edd-cart/class-astra-header-edd-cart-component.php new file mode 100644 index 0000000..3d927c7 --- /dev/null +++ b/inc/builder/type/header/edd-cart/class-astra-header-edd-cart-component.php @@ -0,0 +1,49 @@ +<?php +/** + * EDD Cart for Astra theme. + * + * @package astra-builder + * @author Astra + * @copyright Copyright (c) 2020, Astra + * @link https://wpastra.com/ + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +define( 'ASTRA_HEADER_EDD_CART_DIR', ASTRA_THEME_DIR . 'inc/builder/type/header/edd-cart' ); +define( 'ASTRA_HEADER_EDD_CART_URI', ASTRA_THEME_URI . 'inc/builder/type/header/edd-cart' ); + +if ( ! class_exists( 'Astra_Header_Edd_Cart_Component' ) ) { + + /** + * Heading Initial Setup + * + * @since 3.0.0 + */ + class Astra_Header_Edd_Cart_Component { + + /** + * Constructor function that initializes required actions and hooks + */ + public function __construct() { + + // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + require_once ASTRA_HEADER_EDD_CART_DIR . '/class-astra-header-edd-cart-loader.php'; + + // Include front end files. + if ( ! is_admin() ) { + require_once ASTRA_HEADER_EDD_CART_DIR . '/dynamic-css/dynamic.css.php'; + } + // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound + } + } + + /** + * Kicking this off by creating an object. + */ + new Astra_Header_Edd_Cart_Component(); + +} diff --git a/inc/builder/type/header/edd-cart/class-astra-header-edd-cart-loader.php b/inc/builder/type/header/edd-cart/class-astra-header-edd-cart-loader.php new file mode 100644 index 0000000..59ef2de --- /dev/null +++ b/inc/builder/type/header/edd-cart/class-astra-header-edd-cart-loader.php @@ -0,0 +1,53 @@ +<?php +/** + * EDD Cart Styling Loader for Astra theme. + * + * @package astra-builder + * @author Astra + * @copyright Copyright (c) 2020, Astra + * @link https://wpastra.com/ + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Customizer Initialization + * + * @since 3.0.0 + */ +class Astra_Header_Edd_Cart_Loader { + + /** + * Constructor + * + * @since 3.0.0 + */ + public function __construct() { + + add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); + } + + /** + * Customizer Preview + * + * @since 3.0.0 + */ + public function preview_scripts() { + /** + * Load unminified if SCRIPT_DEBUG is true. + */ + /* Directory and Extension */ + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + wp_enqueue_script( 'astra-header-builder-edd-cart-customizer-preview-js', ASTRA_HEADER_EDD_CART_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); + } + +} + +/** +* Kicking this off by creating the object of the class. +*/ +new Astra_Header_Edd_Cart_Loader(); diff --git a/inc/builder/type/header/edd-cart/dynamic-css/dynamic.css.php b/inc/builder/type/header/edd-cart/dynamic-css/dynamic.css.php new file mode 100644 index 0000000..401b3ed --- /dev/null +++ b/inc/builder/type/header/edd-cart/dynamic-css/dynamic.css.php @@ -0,0 +1,370 @@ +<?php +/** + * EDD Cart - Dynamic CSS + * + * @package Astra + * @since 3.0.0 + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +/** + * Search + */ +add_filter( 'astra_dynamic_theme_css', 'astra_hb_edd_cart_dynamic_css' ); + +/** + * Dynamic CSS + * + * @param string $dynamic_css Astra Dynamic CSS. + * @param string $dynamic_css_filtered Astra Dynamic CSS Filters. + * @return String Generated dynamic CSS for Search. + * + * @since 3.0.0 + */ +function astra_hb_edd_cart_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { + + if ( ! Astra_Builder_Helper::is_component_loaded( 'edd-cart', 'header' ) ) { + return $dynamic_css; + } + + $selector = '.ast-edd-site-header-cart'; + $trans_header_cart_selector = '.ast-theme-transparent-header .ast-edd-site-header-cart'; + $theme_color = astra_get_option( 'theme-color' ); + $link_color = astra_get_option( 'link-color', $theme_color ); + $header_cart_icon_style = astra_get_option( 'edd-header-cart-icon-style' ); + $header_cart_icon_color = astra_get_option( 'edd-header-cart-icon-color', $theme_color ); + $header_cart_icon_radius = astra_get_option( 'edd-header-cart-icon-radius' ); + $cart_h_color = astra_get_foreground_color( $header_cart_icon_color ); + + $trans_header_cart_icon_color = astra_get_option( 'transparent-header-edd-cart-icon-color', $theme_color ); + $trans_header_cart_h_color = astra_get_foreground_color( $trans_header_cart_icon_color ); + + $btn_color = astra_get_option( 'button-color' ); + $btn_bg_color = astra_get_option( 'button-bg-color', $theme_color ); + + if ( empty( $btn_color ) ) { + $btn_color = astra_get_foreground_color( $theme_color ); + } + + if ( 'none' === $header_cart_icon_style ) { + $header_cart_icon_color = $theme_color; + $trans_header_cart_icon_color = $theme_color; + } + /** + * - EDD cart styles. + */ + $cart_text_color = astra_get_option( 'header-edd-cart-text-color' ); + $cart_link_color = astra_get_option( 'header-edd-cart-link-color', $link_color ); + $cart_bg_color = astra_get_option( 'header-edd-cart-background-color' ); + $cart_separator_color = astra_get_option( 'header-edd-cart-separator-color' ); + + $checkout_button_text_color = astra_get_option( 'header-edd-checkout-btn-text-color', $btn_color ); + $checkout_button_bg_color = astra_get_option( 'header-edd-checkout-btn-background-color', $btn_bg_color ); + $checkout_button_text_h_color = astra_get_option( 'header-edd-checkout-btn-text-hover-color', $btn_color ); + $checkout_button_bg_h_color = astra_get_option( 'header-edd-checkout-btn-bg-hover-color', $btn_bg_color ); + + $header_cart_icon = ''; + $cart_text_color_desktop = ( ! empty( $cart_text_color['desktop'] ) ) ? $cart_text_color['desktop'] : ''; + $cart_text_color_mobile = ( ! empty( $cart_text_color['mobile'] ) ) ? $cart_text_color['mobile'] : ''; + $cart_text_color_tablet = ( ! empty( $cart_text_color['tablet'] ) ) ? $cart_text_color['tablet'] : ''; + + $cart_bg_color_desktop = ( ! empty( $cart_bg_color['desktop'] ) ) ? $cart_bg_color['desktop'] : ''; + $cart_bg_color_mobile = ( ! empty( $cart_bg_color['mobile'] ) ) ? $cart_bg_color['mobile'] : ''; + $cart_bg_color_tablet = ( ! empty( $cart_bg_color['tablet'] ) ) ? $cart_bg_color['tablet'] : ''; + + $cart_link_color_desktop = ( ! empty( $cart_link_color['desktop'] ) ) ? $cart_link_color['desktop'] : ''; + $cart_link_color_mobile = ( ! empty( $cart_link_color['mobile'] ) ) ? $cart_link_color['mobile'] : ''; + $cart_link_color_tablet = ( ! empty( $cart_link_color['tablet'] ) ) ? $cart_link_color['tablet'] : ''; + + $cart_separator_color_desktop = ( ! empty( $cart_separator_color['desktop'] ) ) ? $cart_separator_color['desktop'] : ''; + $cart_separator_color_mobile = ( ! empty( $cart_separator_color['mobile'] ) ) ? $cart_separator_color['mobile'] : ''; + $cart_separator_color_tablet = ( ! empty( $cart_separator_color['tablet'] ) ) ? $cart_separator_color['tablet'] : ''; + + $checkout_button_text_color_desktop = ( ! empty( $checkout_button_text_color['desktop'] ) ) ? $checkout_button_text_color['desktop'] : ''; + $checkout_button_text_color_mobile = ( ! empty( $checkout_button_text_color['mobile'] ) ) ? $checkout_button_text_color['mobile'] : ''; + $checkout_button_text_color_tablet = ( ! empty( $checkout_button_text_color['tablet'] ) ) ? $checkout_button_text_color['tablet'] : ''; + + $checkout_button_bg_color_desktop = ( ! empty( $checkout_button_bg_color['desktop'] ) ) ? $checkout_button_bg_color['desktop'] : ''; + $checkout_button_bg_color_mobile = ( ! empty( $checkout_button_bg_color['mobile'] ) ) ? $checkout_button_bg_color['mobile'] : ''; + $checkout_button_bg_color_tablet = ( ! empty( $checkout_button_bg_color['tablet'] ) ) ? $checkout_button_bg_color['tablet'] : ''; + + $checkout_button_text_h_color_desktop = ( ! empty( $checkout_button_text_h_color['desktop'] ) ) ? $checkout_button_text_h_color['desktop'] : ''; + $checkout_button_text_h_color_mobile = ( ! empty( $checkout_button_text_h_color['mobile'] ) ) ? $checkout_button_text_h_color['mobile'] : ''; + $checkout_button_text_h_color_tablet = ( ! empty( $checkout_button_text_h_color['tablet'] ) ) ? $checkout_button_text_h_color['tablet'] : ''; + + $checkout_button_bg_h_color_desktop = ( ! empty( $checkout_button_bg_h_color['desktop'] ) ) ? $checkout_button_bg_h_color['desktop'] : ''; + $checkout_button_bg_h_color_mobile = ( ! empty( $checkout_button_bg_h_color['mobile'] ) ) ? $checkout_button_bg_h_color['mobile'] : ''; + $checkout_button_bg_h_color_tablet = ( ! empty( $checkout_button_bg_h_color['tablet'] ) ) ? $checkout_button_bg_h_color['tablet'] : ''; + + /** + * EDD Cart CSS. + */ + $css_output_desktop = array( + + $selector . ' .ast-edd-cart-menu-wrap .count, ' . $selector . ' .ast-edd-cart-menu-wrap .count:after' => array( + 'color' => $theme_color, + 'border-color' => $theme_color, + ), + $selector . ' .ast-edd-cart-menu-wrap:hover .count' => array( + 'color' => esc_attr( $cart_h_color ), + 'background-color' => esc_attr( $theme_color ), + ), + $selector . ' .ast-icon-shopping-cart' => array( + 'color' => $theme_color, + ), + $selector . ' .ast-edd-header-cart-info-wrap' => array( + 'color' => esc_attr( $header_cart_icon_color ), + ), + $selector . ' .ast-addon-cart-wrap span.astra-icon:after' => array( + 'color' => esc_attr( $cart_h_color ), + 'background-color' => esc_attr( $header_cart_icon_color ), + ), + /** + * Transparent Header - EDD Cart icon color. + */ + $trans_header_cart_selector . ' .ast-edd-header-cart-info-wrap' => array( + 'color' => esc_attr( $trans_header_cart_icon_color ), + ), + $trans_header_cart_selector . ' .ast-addon-cart-wrap span.astra-icon:after' => array( + 'color' => esc_attr( $trans_header_cart_h_color ), + 'background-color' => esc_attr( $trans_header_cart_icon_color ), + ), + /** + * General EDD Cart tray color for widget + */ + $selector . ' .widget_edd_cart_widget a, ' . $selector . ' .widget_edd_cart_widget a.edd-remove-from-cart, ' . $selector . ' .widget_edd_cart_widget .cart-total' => array( + 'color' => esc_attr( $cart_link_color_desktop ), + ), + $selector . ' .widget_edd_cart_widget a.edd-remove-from-cart:after' => array( + 'color' => esc_attr( $cart_link_color_desktop ), + 'border-color' => esc_attr( $cart_link_color_desktop ), + ), + $selector . ' .widget_edd_cart_widget span, ' . $selector . ' .widget_edd_cart_widget strong, ' . $selector . ' .widget_edd_cart_widget *' => array( + 'color' => esc_attr( $cart_text_color_desktop ), + ), + '.ast-builder-layout-element ' . $selector . ' .widget_edd_cart_widget' => array( + 'background-color' => esc_attr( $cart_bg_color_desktop ), + 'border-color' => esc_attr( $cart_bg_color_desktop ), + ), + '.ast-builder-layout-element ' . $selector . ' .widget_edd_cart_widget:before, .ast-builder-layout-element ' . $selector . ' .widget_edd_cart_widget:after' => array( + 'border-bottom-color' => esc_attr( $cart_bg_color_desktop ), + ), + $selector . ' .widget_edd_cart_widget .edd-cart-item, ' . $selector . ' .widget_edd_cart_widget .edd-cart-number-of-items, ' . $selector . ' .widget_edd_cart_widget .edd-cart-meta' => array( + 'border-bottom-color' => esc_attr( $cart_separator_color_desktop ), + ), + + /** + * Checkout button color for widget + */ + '.ast-edd-site-header-cart .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a' => array( + 'color' => esc_attr( $checkout_button_text_color_desktop ), + 'border-color' => esc_attr( $checkout_button_bg_color_desktop ), + 'background-color' => esc_attr( $checkout_button_bg_color_desktop ), + ), + '.ast-edd-site-header-cart .widget_edd_cart_widget .edd_checkout a:hover, .widget_edd_cart_widget .edd_checkout a:hover' => array( + 'color' => esc_attr( $checkout_button_text_h_color_desktop ), + 'background-color' => esc_attr( $checkout_button_bg_h_color_desktop ), + ), + ); + + $css_output = astra_parse_css( $css_output_desktop ); + + $responsive_selector = '.astra-cart-drawer.edd-active'; + + $css_output_mobile = array( + $responsive_selector . ' .widget_edd_cart_widget a, ' . $responsive_selector . ' .widget_edd_cart_widget a.edd-remove-from-cart, ' . $responsive_selector . ' .widget_edd_cart_widget .cart-total' => array( + 'color' => esc_attr( $cart_link_color_mobile ), + ), + $selector . ' .widget_edd_cart_widget a.edd-remove-from-cart:after' => array( + 'color' => esc_attr( $cart_link_color_mobile ), + 'border-color' => esc_attr( $cart_link_color_mobile ), + ), + $responsive_selector . ' .astra-cart-drawer-title, ' . $responsive_selector . ' .widget_edd_cart_widget span, ' . $responsive_selector . ' .widget_edd_cart_widget strong, ' . $responsive_selector . ' .widget_edd_cart_widget *' => array( + 'color' => esc_attr( $cart_text_color_mobile ), + ), + $responsive_selector => array( + 'background-color' => esc_attr( $cart_bg_color_mobile ), + 'border-color' => esc_attr( $cart_bg_color_mobile ), + ), + $responsive_selector . ' .widget_edd_cart_widget:before, .ast-builder-layout-element ' . $responsive_selector . ' .widget_edd_cart_widget:after' => array( + 'border-bottom-color' => esc_attr( $cart_bg_color_mobile ), + ), + $responsive_selector . ' .widget_edd_cart_widget .edd-cart-item, ' . $responsive_selector . ' .widget_edd_cart_widget .edd-cart-number-of-items, ' . $responsive_selector . ' .widget_edd_cart_widget .edd-cart-meta, ' . + $responsive_selector . ' .astra-cart-drawer-header' => array( + 'border-bottom-color' => esc_attr( $cart_separator_color_mobile ), + ), + /** + * Checkout button color for widget + */ + $responsive_selector . ' .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a' => array( + 'color' => esc_attr( $checkout_button_text_color_mobile ), + 'border-color' => esc_attr( $checkout_button_bg_color_mobile ), + 'background-color' => esc_attr( $checkout_button_bg_color_mobile ), + ), + $responsive_selector . ' .widget_edd_cart_widget .edd_checkout a:hover, .widget_edd_cart_widget .edd_checkout a:hover' => array( + 'color' => esc_attr( $checkout_button_text_h_color_mobile ), + 'background-color' => esc_attr( $checkout_button_bg_h_color_mobile ), + ), + ); + + $css_output_tablet = array( + $responsive_selector . ' .widget_edd_cart_widget a, ' . $responsive_selector . ' .widget_edd_cart_widget a.edd-remove-from-cart, ' . $responsive_selector . ' .widget_edd_cart_widget .cart-total' => array( + 'color' => esc_attr( $cart_link_color_tablet ), + ), + $selector . ' .widget_edd_cart_widget a.edd-remove-from-cart:after' => array( + 'color' => esc_attr( $cart_link_color_tablet ), + 'border-color' => esc_attr( $cart_link_color_tablet ), + ), + $responsive_selector . ' .astra-cart-drawer-title, ' . $responsive_selector . ' .widget_edd_cart_widget span, ' . $responsive_selector . ' .widget_edd_cart_widget strong, ' . $responsive_selector . ' .widget_edd_cart_widget *' => array( + 'color' => esc_attr( $cart_text_color_tablet ), + ), + $responsive_selector => array( + 'background-color' => esc_attr( $cart_bg_color_tablet ), + 'border-color' => esc_attr( $cart_bg_color_tablet ), + ), + $responsive_selector . ' .widget_edd_cart_widget:before, .ast-builder-layout-element ' . $responsive_selector . ' .widget_edd_cart_widget:after' => array( + 'border-bottom-color' => esc_attr( $cart_bg_color_tablet ), + ), + $responsive_selector . ' .widget_edd_cart_widget .edd-cart-item, ' . $responsive_selector . ' .widget_edd_cart_widget .edd-cart-number-of-items, ' . $responsive_selector . ' .widget_edd_cart_widget .edd-cart-meta, ' . + $responsive_selector . ' .astra-cart-drawer-header' => array( + 'border-bottom-color' => esc_attr( $cart_separator_color_tablet ), + ), + /** + * Checkout button color for widget + */ + $responsive_selector . ' .widget_edd_cart_widget .edd_checkout a, .widget_edd_cart_widget .edd_checkout a' => array( + 'color' => esc_attr( $checkout_button_text_color_tablet ), + 'border-color' => esc_attr( $checkout_button_bg_color_tablet ), + 'background-color' => esc_attr( $checkout_button_bg_color_tablet ), + ), + $responsive_selector . ' .widget_edd_cart_widget .edd_checkout a:hover, .widget_edd_cart_widget .edd_checkout a:hover' => array( + 'color' => esc_attr( $checkout_button_text_h_color_tablet ), + 'background-color' => esc_attr( $checkout_button_bg_h_color_tablet ), + ), + ); + + $css_output .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() ); + $css_output .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() ); + + /** + * Header Cart color + */ + if ( 'none' !== $header_cart_icon_style ) { + + /** + * Header Cart Icon colors + */ + $header_cart_icon = array( + + $selector . ' .ast-edd-cart-menu-wrap .count' => array( + 'color' => esc_attr( astra_get_option( 'edd-header-cart-icon-color' ) ), + 'border-color' => esc_attr( astra_get_option( 'edd-header-cart-icon-color' ) ), + ), + $selector . ' .ast-edd-cart-menu-wrap .count:after' => array( + 'color' => esc_attr( astra_get_option( 'edd-header-cart-icon-color' ) ), + 'border-color' => esc_attr( astra_get_option( 'edd-header-cart-icon-color' ) ), + ), + $selector . ' .ast-icon-shopping-cart' => array( + 'color' => esc_attr( astra_get_option( 'edd-header-cart-icon-color' ) ), + ), + + // Default icon colors. + '.ast-edd-cart-menu-wrap .count, .ast-edd-cart-menu-wrap .count:after' => array( + 'border-color' => esc_attr( $header_cart_icon_color ), + 'color' => esc_attr( $header_cart_icon_color ), + ), + // Outline icon hover colors. + $selector . ' .ast-edd-cart-menu-wrap:hover .count' => array( + 'color' => esc_attr( $cart_h_color ), + 'background-color' => esc_attr( $header_cart_icon_color ), + ), + // Outline icon colors. + '.ast-edd-menu-cart-outline .ast-addon-cart-wrap' => array( + 'background' => '#ffffff', + 'color' => esc_attr( $header_cart_icon_color ), + ), + // Outline Info colors. + $selector . ' .ast-menu-cart-outline .ast-edd-header-cart-info-wrap' => array( + 'color' => esc_attr( $header_cart_icon_color ), + ), + // Fill icon Color. + '.ast-edd-site-header-cart.ast-edd-menu-cart-fill .ast-edd-cart-menu-wrap .count,.ast-edd-menu-cart-fill .ast-addon-cart-wrap, .ast-edd-menu-cart-fill .ast-addon-cart-wrap .ast-edd-header-cart-info-wrap, .ast-edd-menu-cart-fill .ast-addon-cart-wrap .ast-icon-shopping-cart' => array( + 'background-color' => esc_attr( $header_cart_icon_color ), + 'color' => esc_attr( $cart_h_color ), + ), + + // Transparent Header - Count colors. + $trans_header_cart_selector . ' .ast-edd-cart-menu-wrap .count' => array( + 'color' => esc_attr( astra_get_option( 'transparent-header-edd-cart-icon-color' ) ), + 'border-color' => esc_attr( astra_get_option( 'transparent-header-edd-cart-icon-color' ) ), + ), + $trans_header_cart_selector . ' .ast-edd-cart-menu-wrap .count:after' => array( + 'color' => esc_attr( astra_get_option( 'transparent-header-edd-cart-icon-color' ) ), + 'border-color' => esc_attr( astra_get_option( 'transparent-header-edd-cart-icon-color' ) ), + ), + $trans_header_cart_selector . ' .ast-icon-shopping-cart' => array( + 'color' => esc_attr( astra_get_option( 'transparent-header-edd-cart-icon-color' ) ), + ), + + // Transparent Header - Default icon colors. + '.ast-theme-transparent-header .ast-edd-cart-menu-wrap .count, .ast-theme-transparent-header .ast-edd-cart-menu-wrap .count:after' => array( + 'border-color' => esc_attr( $trans_header_cart_icon_color ), + 'color' => esc_attr( $trans_header_cart_icon_color ), + ), + // Transparent Header - Outline icon hover colors. + $trans_header_cart_selector . ' .ast-edd-cart-menu-wrap:hover .count' => array( + 'color' => esc_attr( $trans_header_cart_h_color ), + 'background-color' => esc_attr( $trans_header_cart_icon_color ), + ), + // Transparent Header - Outline icon colors. + '.ast-theme-transparent-header .ast-edd-menu-cart-outline .ast-addon-cart-wrap' => array( + 'background' => '#ffffff', + 'color' => esc_attr( $trans_header_cart_icon_color ), + ), + // Transparent Header - Outline Info colors. + $trans_header_cart_selector . ' .ast-menu-cart-outline .ast-edd-header-cart-info-wrap' => array( + 'color' => esc_attr( $trans_header_cart_icon_color ), + ), + // Transparent Header - Fill icon Color. + '.ast-theme-transparent-header .ast-edd-site-header-cart.ast-edd-menu-cart-fill .ast-edd-cart-menu-wrap .count, .ast-theme-transparent-header .ast-edd-menu-cart-fill .ast-addon-cart-wrap, .ast-theme-transparent-header .ast-edd-menu-cart-fill .ast-edd-site-header-cart-wrap .ast-icon-shopping-cart, .ast-theme-transparent-header .ast-edd-site-header-cart .ast-addon-cart-wrap span.astra-icon:after' => array( + 'background-color' => esc_attr( $trans_header_cart_icon_color ), + 'color' => esc_attr( $trans_header_cart_h_color ), + ), + + // Border radius. + '.ast-edd-site-header-cart.ast-edd-menu-cart-outline .ast-addon-cart-wrap, .ast-edd-site-header-cart.ast-edd-menu-cart-fill .ast-addon-cart-wrap, .ast-edd-site-header-cart.ast-edd-menu-cart-outline .count, .ast-edd-site-header-cart.ast-edd-menu-cart-fill .count, .ast-edd-site-header-cart.ast-edd-menu-cart-outline .ast-addon-cart-wrap .ast-edd-header-cart-info-wrap, .ast-edd-site-header-cart.ast-edd-menu-cart-fill .ast-addon-cart-wrap .ast-edd-header-cart-info-wrap' => array( + 'border-radius' => astra_get_css_value( $header_cart_icon_radius, 'px' ), + ), + ); + + // We adding this conditional CSS only to maintain backwards. Remove this condition after 2-3 updates of add-on. + if ( defined( 'ASTRA_EXT_VER' ) && version_compare( ASTRA_EXT_VER, '3.4.2', '<' ) ) { + // Outline cart style border. + $header_cart_icon['.ast-edd-menu-cart-outline .ast-addon-cart-wrap'] = array( + 'background' => '#ffffff', + 'border' => '1px solid ' . $header_cart_icon_color, + 'color' => esc_attr( $header_cart_icon_color ), + ); + // Transparent Header outline cart style border. + $header_cart_icon['.ast-theme-transparent-header .ast-edd-menu-cart-outline .ast-addon-cart-wrap'] = array( + 'background' => '#ffffff', + 'border' => '1px solid ' . $trans_header_cart_icon_color, + 'color' => esc_attr( $trans_header_cart_icon_color ), + ); + } + + $header_cart_icon = astra_parse_css( $header_cart_icon ); + } + + /* Parse CSS from array() */ + $css_output .= $header_cart_icon; + + $css_output .= Astra_Builder_Base_Dynamic_CSS::prepare_visibility_css( 'section-header-edd-cart', '.ast-header-edd-cart' ); + + $dynamic_css .= $css_output; + + return $dynamic_css; +} |