| @@ -6,13 +6,76 @@ | ||
| 6 | 6 | |
| 7 | 7 | // use WP_Query; |
| 8 | 8 | |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || die(); | |
| 10 | +defined('ABSPATH') || die(); | |
| 11 | 11 | |
| 12 | -trait Global_Widget_Template { | |
| 12 | +trait Global_Widget_Template | |
| 13 | +{ | |
| 13 | 14 | |
| 14 | - protected function register_global_template_wc_rating( $rating, $count = 0 ) { | |
| 15 | + protected function register_templates_grid_columns_markup($settings) | |
| 16 | + { ?> | |
| 17 | + <ul class="usk-grid-header-tabs"> | |
| 18 | + <?php if (in_array("list-2", $settings['filter_column_lists'])): ?> | |
| 19 | + <li class="usk-grid-tabs-list"> | |
| 20 | + <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-1 usk-list-layout"> | |
| 21 | + <span class="usk-icon-grid-list"></span> | |
| 22 | + </a> | |
| 23 | + </li> | |
| 24 | + <?php | |
| 25 | + endif; | |
| 26 | + if (in_array('grid-2', $settings['filter_column_lists'])): | |
| 27 | + ?> | |
| 28 | + <li class="usk-grid-tabs-list"> | |
| 29 | + <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-2"> | |
| 30 | + <span class="usk-icon-grid-2"></span> | |
| 31 | + </a> | |
| 32 | + </li> | |
| 33 | + <?php | |
| 34 | + endif; | |
| 35 | + if (in_array('grid-3', $settings['filter_column_lists'])): | |
| 36 | + ?> | |
| 37 | + <li class="usk-grid-tabs-list"> | |
| 38 | + <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-3"> | |
| 39 | + <span class="usk-icon-grid-3"></span> | |
| 40 | + </a> | |
| 41 | + </li> | |
| 42 | + <?php | |
| 43 | + endif; | |
| 44 | + if (in_array('grid-4', $settings['filter_column_lists'])): | |
| 45 | + ?> | |
| 46 | + <li class="usk-grid-tabs-list"> | |
| 47 | + <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-4"> | |
| 48 | + <span class="usk-icon-grid-4"></span> | |
| 49 | + </a> | |
| 50 | + </li> | |
| 51 | + <?php | |
| 52 | + endif; | |
| 53 | + if (in_array('grid-5', $settings['filter_column_lists'])): | |
| 54 | + ?> | |
| 55 | + <li class="usk-grid-tabs-list"> | |
| 56 | + <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-5"> | |
| 57 | + <span class="usk-icon-grid-5"></span> | |
| 58 | + </a> | |
| 59 | + </li> | |
| 60 | + <?php | |
| 61 | + endif; | |
| 62 | + if (in_array('grid-6', $settings['filter_column_lists'])): | |
| 63 | + ?> | |
| 64 | + <li class="usk-grid-tabs-list"> | |
| 65 | + <a class="tab-option" href="javascript:void(0)" data-grid-column="usk-grid-6"> | |
| 66 | + <span class="usk-icon-grid-6"></span> | |
| 67 | + </a> | |
| 68 | + </li> | |
| 69 | + <?php | |
| 70 | + endif; | |
| 71 | + ?> | |
| 72 | + </ul> | |
| 73 | + <?php | |
| 74 | + } | |
| 75 | + | |
| 76 | + protected function register_global_template_wc_rating($rating, $count = 0) | |
| 77 | + { | |
| 15 | 78 | $html = ''; |
| 16 | 79 | if ( |
| 17 | 80 | 0 <= $rating |
| 18 | 81 | ) { |
| @@ -17,36 +80,36 @@ | ||
| 17 | 80 | 0 <= $rating |
| 18 | 81 | ) { |
| 19 | 82 | /* translators: %s: rating */ |
| 20 | 83 | // $label = sprintf(__('Rated %s out of 5', 'woocommerce'), $rating); |
| 21 | - $html = '<div class="star-rating" role="img">' . wc_get_star_rating_html( $rating, $count ) . '</div>'; | |
| 84 | + $html = '<div class="star-rating" role="img">' . wc_get_star_rating_html($rating, $count) . '</div>'; | |
| 22 | 85 | } |
| 23 | 86 | |
| 24 | - return apply_filters( 'woocommerce_product_get_rating_html', $html, $rating, $count ); | |
| 87 | + return apply_filters('woocommerce_product_get_rating_html', $html, $rating, $count); | |
| 25 | 88 | } |
| 26 | - public function register_global_template_add_to_wishlist( $tooltip_position ) { | |
| 27 | - $settings = $this->get_settings_for_display(); | |
| 89 | + public function register_global_template_add_to_wishlist($tooltip_position, $settings) | |
| 90 | + { | |
| 28 | 91 | global $product; |
| 29 | - $user_id = get_current_user_id(); | |
| 30 | - $product_id = $product->get_ID(); | |
| 31 | - $wishlist = ultimate_store_kit_get_wishlist( $user_id ); | |
| 32 | - $is_wishlisted = in_array( $product_id, $wishlist ); | |
| 33 | - if ( ! empty( $is_wishlisted ) ) { | |
| 34 | - $selected = ' usk-active'; | |
| 35 | - $tooltip = __( 'View Wishlist', 'ultimate-store-kit' ); | |
| 36 | - $redirect_url = wc_get_account_endpoint_url( 'wishlist' ); | |
| 92 | + $user_id = get_current_user_id(); | |
| 93 | + $product_id = $product->get_ID(); | |
| 94 | + $wishlist = ultimate_store_kit_get_wishlist($user_id); | |
| 95 | + $is_wishlisted = in_array($product_id, $wishlist); | |
| 96 | + if (!empty($is_wishlisted)) { | |
| 97 | + $selected = ' usk-active'; | |
| 98 | + $tooltip = __('View Wishlist', 'ultimate-store-kit'); | |
| 99 | + $redirect_url = wc_get_account_endpoint_url('wishlist'); | |
| 37 | 100 | } else { |
| 38 | - $selected = ''; | |
| 39 | - $tooltip = __( 'Add to Wishlist', 'ultimate-store-kit' ); | |
| 101 | + $selected = ''; | |
| 102 | + $tooltip = __('Add to Wishlist', 'ultimate-store-kit'); | |
| 40 | 103 | $redirect_url = "javascript:void(0);"; |
| 41 | 104 | } ?> |
| 42 | - <?php if ( $settings['show_wishlist'] == 'yes' ) : ?> | |
| 43 | - <a href="<?php echo esc_url( $redirect_url ); ?>" | |
| 44 | - class="usk-action-btn ajax_add_to_wishlist usk-shoping-icon-wishlist usk-btn usk-wishlist<?php echo esc_attr( $selected ); ?>" | |
| 45 | - data-product_id="<?php echo absint( $product_id ); ?>" aria-label="<?php echo esc_html( $tooltip ); ?>" | |
| 46 | - data-aria_label="<?php echo esc_html__( 'View Wishlist', 'ultimate-store-kit' ); ?>" | |
| 47 | - data-redirect_url="<?php echo esc_url( wc_get_account_endpoint_url( 'wishlist' ) ); ?>" | |
| 48 | - data-microtip-position="<?php echo esc_attr( $tooltip_position ); ?>" role="tooltip"> | |
| 105 | + <?php if (isset($settings['show_wishlist']) ? $settings['show_wishlist'] : true): ?> | |
| 106 | + <a href="<?php echo esc_url($redirect_url); ?>" | |
| 107 | + class="usk-action-btn ajax_add_to_wishlist usk-shoping-icon-wishlist usk-btn usk-wishlist<?php echo esc_attr($selected); ?>" | |
| 108 | + data-product_id="<?php echo absint($product_id); ?>" aria-label="<?php echo esc_attr($tooltip); ?>" | |
| 109 | + data-aria_label="<?php echo esc_attr__('View Wishlist', 'ultimate-store-kit'); ?>" | |
| 110 | + data-redirect_url="<?php echo esc_url(wc_get_account_endpoint_url('wishlist')); ?>" | |
| 111 | + data-microtip-position="<?php echo esc_attr($tooltip_position); ?>" role="tooltip"> | |
| 49 | 112 | <i class="icon usk-icon-heart-full"></i> |
| 50 | 113 | </a> |
| 51 | 114 | <?php endif; ?> |
| 52 | 115 | <?php |
| @@ -51,45 +114,45 @@ | ||
| 51 | 114 | <?php endif; ?> |
| 52 | 115 | <?php |
| 53 | 116 | } |
| 54 | 117 | |
| 55 | - function register_global_template_add_to_compare( $tooltip_position ) { | |
| 118 | + function register_global_template_add_to_compare($tooltip_position, $settings) | |
| 119 | + { | |
| 56 | 120 | global $product; |
| 57 | - $settings = $this->get_settings_for_display(); | |
| 58 | - $user_id = get_current_user_id(); | |
| 59 | - $product_id = $product->get_ID(); | |
| 60 | - $compare_products = usk_get_compare_products( $user_id ); | |
| 61 | - $is_compared = in_array( $product_id, $compare_products ); | |
| 121 | + $user_id = get_current_user_id(); | |
| 122 | + $product_id = $product->get_ID(); | |
| 123 | + $compare_products = ultimate_store_kit_get_compare_products($user_id); | |
| 124 | + $is_compared = in_array($product_id, $compare_products); | |
| 62 | 125 | |
| 63 | 126 | $compare_page_id = ''; |
| 64 | - if ( function_exists( 'ultimate_store_kit_compare_product_page' ) && $comparePage = ultimate_store_kit_compare_product_page() ) { | |
| 127 | + if (function_exists('ultimate_store_kit_compare_product_page') && $comparePage = ultimate_store_kit_compare_product_page()) { | |
| 65 | 128 | $compare_page_id = $comparePage; |
| 66 | 129 | } |
| 67 | 130 | |
| 68 | 131 | $compare_redirect_link = home_url(); |
| 69 | - if ( $compare_page_id ) { | |
| 70 | - $compare_redirect_link = get_page_link( $compare_page_id ); | |
| 132 | + if ($compare_page_id) { | |
| 133 | + $compare_redirect_link = get_page_link($compare_page_id); | |
| 71 | 134 | } |
| 72 | 135 | |
| 73 | - if ( ! empty( $is_compared ) ) { | |
| 74 | - $tooltip = __( 'View Compare', 'ultimate-store-kit' ); | |
| 75 | - $selected = 'usk-active'; | |
| 136 | + if (!empty($is_compared)) { | |
| 137 | + $tooltip = __('View Compare', 'ultimate-store-kit'); | |
| 138 | + $selected = 'usk-active'; | |
| 76 | 139 | $compare_page_link = home_url(); |
| 77 | - if ( $compare_page_id ) { | |
| 78 | - $compare_page_link = get_page_link( $compare_page_id ); | |
| 140 | + if ($compare_page_id) { | |
| 141 | + $compare_page_link = get_page_link($compare_page_id); | |
| 79 | 142 | } |
| 80 | 143 | } else { |
| 81 | - $tooltip = __( 'Add to Compare', 'ultimate-store-kit' ); | |
| 144 | + $tooltip = __('Add to Compare', 'ultimate-store-kit'); | |
| 82 | 145 | $selected = ''; |
| 83 | 146 | $compare_page_link = "javascript:void(0);"; |
| 84 | 147 | } ?> |
| 85 | - <?php if ( $settings['show_compare'] == 'yes' ) : ?> | |
| 86 | - <a href="<?php echo esc_url( $compare_page_link ); ?>" | |
| 87 | - class="usk-action-btn ajax_add_to_compare usk-compare <?php echo esc_attr( $selected ); ?>" | |
| 88 | - data-product_id="<?php echo esc_attr( $product_id ); ?>" | |
| 89 | - data-redirect_url="<?php echo esc_url( $compare_redirect_link ); ?>" aria-label="<?php echo esc_html( $tooltip ); ?>" | |
| 90 | - data-aria_label="<?php echo esc_html__( 'View Compare', 'ultimate-store-kit' ); ?>" | |
| 91 | - data-microtip-position="<?php echo esc_attr( $tooltip_position ); ?>" role="tooltip"> | |
| 148 | + <?php if (isset($settings['show_compare']) && $settings['show_compare'] == 'yes'): ?> | |
| 149 | + <a href="<?php echo esc_url($compare_page_link); ?>" | |
| 150 | + class="usk-action-btn ajax_add_to_compare usk-compare <?php echo esc_attr($selected); ?>" | |
| 151 | + data-product_id="<?php echo esc_attr($product_id); ?>" | |
| 152 | + data-redirect_url="<?php echo esc_url($compare_redirect_link); ?>" aria-label="<?php echo esc_attr($tooltip); ?>" | |
| 153 | + data-aria_label="<?php echo esc_attr__('View Compare', 'ultimate-store-kit'); ?>" | |
| 154 | + data-microtip-position="<?php echo esc_attr($tooltip_position); ?>" role="tooltip"> | |
| 92 | 155 | <i class="icon usk-icon-compare"></i> |
| 93 | 156 | </a> |
| 94 | 157 | <?php |
| 95 | 158 | ?> |
| @@ -97,112 +160,115 @@ | ||
| 97 | 160 | <?php |
| 98 | 161 | |
| 99 | 162 | } |
| 100 | 163 | |
| 101 | - | |
| 102 | - protected function register_global_template_quick_view( $product_id, $tooltip_position ) { | |
| 103 | - $settings = $this->get_settings_for_display(); | |
| 104 | - if ( 'yes' == $settings['show_quick_view'] ) : ?> | |
| 105 | - <?php wp_nonce_field( 'ajax-usk-quick-view-nonce', 'usk-quick-view-modal-sc' ); | |
| 164 | + protected function register_global_template_quick_view($product_id, $tooltip_position, $settings) | |
| 165 | + { | |
| 166 | + // $settings = $this->get_settings_for_display(); | |
| 167 | + if (isset($settings['show_quick_view']) ? $settings['show_quick_view'] : true): ?> | |
| 168 | + <?php wp_nonce_field('ajax-usk-quick-view-nonce', 'usk-quick-view-modal-sc'); | |
| 106 | 169 | ?> |
| 107 | 170 | <a class="usk-action-btn usk-shoping-icon-quickview quick_view usk-view usk-btn" href="javascript:void(0)" |
| 108 | - data-id="<?php echo absint( $product_id ); ?>" aria-label="<?php echo esc_html__( 'Quick View' ); ?>" | |
| 109 | - data-microtip-position="<?php echo esc_attr( $tooltip_position ); ?>" role="tooltip"> | |
| 171 | + data-id="<?php echo absint($product_id); ?>" | |
| 172 | + aria-label="<?php echo esc_attr__('Quick View', 'ultimate-store-kit'); ?>" | |
| 173 | + data-microtip-position="<?php echo esc_attr($tooltip_position); ?>" role="tooltip"> | |
| 110 | 174 | <i class="icon usk-icon-preview"></i> |
| 111 | 175 | </a> |
| 112 | 176 | <?php endif; |
| 113 | 177 | } |
| 114 | - protected function register_global_template_add_to_cart( $tooltip_position ) { | |
| 178 | + protected function register_global_template_add_to_cart($tooltip_position, $settings) | |
| 179 | + { | |
| 115 | 180 | global $product; |
| 116 | - $settings = $this->get_settings_for_display(); | |
| 117 | - if ( 'yes' == $settings['show_cart'] ) : ?> | |
| 118 | - <?php if ( $product ) { | |
| 119 | - $defaults = [ | |
| 120 | - 'quantity' => 1, | |
| 121 | - 'class' => implode( | |
| 181 | + if (isset($settings['show_cart']) ? $settings['show_cart'] : true): ?> | |
| 182 | + <?php if ($product) { | |
| 183 | + $defaults = [ | |
| 184 | + 'quantity' => 1, | |
| 185 | + 'class' => implode( | |
| 122 | 186 | ' ', |
| 123 | 187 | array_filter( |
| 124 | - [ | |
| 188 | + [ | |
| 125 | 189 | 'usk-cart', |
| 126 | 190 | 'usk-action-btn', |
| 127 | 191 | 'product_type_' . $product->get_type(), |
| 128 | 192 | $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', |
| 129 | - $product->supports( 'ajax_add_to_cart' ) && $product->is_purchasable() && $product->is_in_stock() ? 'ajax_add_to_cart' : '', | |
| 193 | + $product->supports('ajax_add_to_cart') && $product->is_purchasable() && $product->is_in_stock() ? 'ajax_add_to_cart' : '', | |
| 130 | 194 | ] |
| 131 | 195 | ) |
| 132 | 196 | ), |
| 133 | - 'attributes' => [ | |
| 134 | - 'data-product_id' => $product->get_id(), | |
| 135 | - 'data-product_sku' => $product->get_sku(), | |
| 197 | + 'attributes' => [ | |
| 198 | + 'data-product_id' => $product->get_id(), | |
| 199 | + 'data-product_sku' => $product->get_sku(), | |
| 136 | 200 | 'data-microtip-position' => $tooltip_position, |
| 137 | - 'aria-label' => $product->add_to_cart_text(), | |
| 138 | - 'rel' => 'nofollow', | |
| 139 | - 'role' => 'tooltip', | |
| 201 | + 'aria-label' => $product->add_to_cart_text(), | |
| 202 | + 'rel' => 'nofollow', | |
| 203 | + 'role' => 'tooltip', | |
| 140 | 204 | ], |
| 141 | 205 | ]; |
| 142 | - $args = apply_filters( 'woocommerce_loop_add_to_cart_args', wp_parse_args( $defaults ), $product ); | |
| 143 | - if ( isset( $args['attributes']['aria-label'] ) ) { | |
| 144 | - $args['attributes']['aria-label'] = wp_strip_all_tags( $args['attributes']['aria-label'] ); | |
| 206 | + $args = apply_filters('woocommerce_loop_add_to_cart_args', wp_parse_args($defaults), $product); | |
| 207 | + if (isset($args['attributes']['aria-label'])) { | |
| 208 | + $args['attributes']['aria-label'] = wp_strip_all_tags($args['attributes']['aria-label']); | |
| 145 | 209 | } |
| 146 | - echo wp_kses_post( apply_filters( | |
| 210 | + echo wp_kses_post(apply_filters( | |
| 147 | 211 | 'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok. |
| 148 | 212 | sprintf( |
| 149 | 213 | '<a href="%s" data-quantity="%s" class="%s" %s><i class="icon usk-icon-cart"></i></a>', |
| 150 | - esc_url( $product->add_to_cart_url() ), | |
| 151 | - esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ), | |
| 152 | - esc_attr( isset( $args['class'] ) ? $args['class'] : 'button' ), | |
| 153 | - isset( $args['attributes'] ) ? wc_implode_html_attributes( $args['attributes'] ) : '' | |
| 214 | + esc_url($product->add_to_cart_url()), | |
| 215 | + esc_attr(isset($args['quantity']) ? $args['quantity'] : 1), | |
| 216 | + esc_attr(isset($args['class']) ? $args['class'] : 'button'), | |
| 217 | + isset($args['attributes']) ? wc_implode_html_attributes($args['attributes']) : '' | |
| 154 | 218 | ), |
| 155 | 219 | $product, |
| 156 | 220 | $args |
| 157 | - ) ); | |
| 221 | + )); | |
| 158 | 222 | } |
| 159 | 223 | ; ?> |
| 160 | 224 | <?php endif; |
| 161 | 225 | } |
| 162 | - protected function register_global_template_badge_label() { | |
| 163 | - $settings = $this->get_settings_for_display(); | |
| 226 | + protected function register_global_template_badge_label($settings) | |
| 227 | + { | |
| 228 | + // print_r($settings); | |
| 164 | 229 | global $product; |
| 165 | - if ( $product->is_on_sale() && $settings['show_sale_badge'] ) : | |
| 166 | - printf( '<div class="usk-badge-wrap usk-sale-badge"><span class="usk-badge">%1$s</span></div>', esc_html__( 'Sale', 'ultimate-store-kit' ) ); | |
| 230 | + if ($product->is_on_sale() && (isset($settings['show_sale_badge']) ? $settings['show_sale_badge'] : true)): | |
| 231 | + printf('<div class="usk-badge-wrap usk-sale-badge"><span class="usk-badge">%1$s</span></div>', esc_html__('Sale', 'ultimate-store-kit')); | |
| 167 | 232 | endif; |
| 168 | - if ( $settings['show_discount_badge'] ) : | |
| 233 | + if (isset($settings['show_discount_badge']) ? $settings['show_discount_badge'] : true): | |
| 169 | 234 | $this->usk_get_badge_label_percentage(); |
| 170 | 235 | endif; |
| 171 | - if ( ( $settings['show_stock_status'] === 'yes' ) ) : | |
| 172 | - if ( $product->get_stock_status() === 'instock' ) { | |
| 173 | - $stock_status = esc_html__( 'In Stock', 'ultimate-store-kit' ); | |
| 236 | + if (isset($settings['show_stock_status']) && $settings['show_stock_status'] === 'yes'): | |
| 237 | + if ($product->get_stock_status() === 'instock') { | |
| 238 | + $stock_status = esc_html__('In Stock', 'ultimate-store-kit'); | |
| 174 | 239 | } else { |
| 175 | - $stock_status = esc_html__( 'Out of Stock', 'ultimate-store-kit' ); | |
| 240 | + $stock_status = esc_html__('Out of Stock', 'ultimate-store-kit'); | |
| 176 | 241 | } |
| 177 | 242 | |
| 178 | - printf( '<div class="usk-badge-wrap usk-stock-status-badge"><span class="usk-badge">%1$s</span></div>', esc_html( $stock_status ) ); | |
| 243 | + printf('<div class="usk-badge-wrap usk-stock-status-badge"><span class="usk-badge">%1$s</span></div>', esc_html($stock_status)); | |
| 179 | 244 | endif; |
| 180 | - if ( $product->is_featured() && $settings['show_trending_badge'] ) : | |
| 181 | - printf( '<div class="usk-badge-wrap usk-trending-badge"><span class="usk-badge">%1$s</span></div>', esc_html__( 'Trending', 'ultimate-store-kit' ) ); | |
| 245 | + if ($product->is_featured() && (isset($settings['show_trending_badge']) ? $settings['show_trending_badge'] : true)): | |
| 246 | + printf('<div class="usk-badge-wrap usk-trending-badge"><span class="usk-badge">%1$s</span></div>', esc_html__('Trending', 'ultimate-store-kit')); | |
| 182 | 247 | endif; |
| 183 | - if ( $settings['show_new_badge'] ) : | |
| 184 | - $newness_days = $settings['newness_days']; | |
| 185 | - $created_date = strtotime( $product->get_date_created() ); | |
| 186 | - $valid_date = time() - ( 60 * 60 * 24 * $newness_days ); | |
| 187 | - if ( $valid_date < $created_date ) { | |
| 188 | - printf( '<div class="usk-badge-wrap usk-new-badge"><span class="usk-badge">%s</span></div>', esc_html__( 'New', 'ultimate-store-kit' ) ); | |
| 248 | + if (isset($settings['show_new_badge']) ? $settings['show_new_badge'] : true): | |
| 249 | + $newness_days = isset($settings['newness_days']) ? $settings['newness_days'] : 60; | |
| 250 | + $created_date = strtotime($product->get_date_created()); | |
| 251 | + $valid_date = time() - (60 * 60 * 24 * $newness_days); | |
| 252 | + if ($valid_date < $created_date) { | |
| 253 | + printf('<div class="usk-badge-wrap usk-new-badge"><span class="usk-badge">%s</span></div>', esc_html__('New', 'ultimate-store-kit')); | |
| 189 | 254 | } |
| 190 | 255 | endif; |
| 191 | 256 | } |
| 192 | - protected function register_global_template_navigation() { | |
| 193 | - $settings = $this->get_settings_for_display(); | |
| 257 | + protected function register_global_template_navigation() | |
| 258 | + { | |
| 259 | + $settings = $this->get_settings_for_display(); | |
| 194 | 260 | $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? ' usk-visible@m' : ''; |
| 195 | 261 | |
| 196 | - if ( 'arrows' == $settings['navigation'] ) : ?> | |
| 262 | + if ('arrows' == $settings['navigation']): ?> | |
| 197 | 263 | <div style="direction: ltr;" |
| 198 | - class="usk-position-z-index usk-position-<?php echo esc_html( $settings['arrows_position'] . $hide_arrow_on_mobile ); ?>"> | |
| 264 | + class="usk-position-z-index usk-position-<?php echo esc_attr($settings['arrows_position'] . $hide_arrow_on_mobile); ?>"> | |
| 199 | 265 | <div class="usk-arrows-container usk-slidenav-container"> |
| 200 | 266 | <a href="" class="usk-navigation-prev usk-slidenav-previous usk-icon usk-slidenav"> |
| 201 | - <i class="usk-icon-arrow-left-<?php echo esc_html( $settings['nav_arrows_icon'] ); ?>" aria-hidden="true"></i> | |
| 267 | + <i class="usk-icon-arrow-left-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" aria-hidden="true"></i> | |
| 202 | 268 | </a> |
| 203 | 269 | <a href="" class="usk-navigation-next usk-slidenav-next usk-icon usk-slidenav"> |
| 204 | - <i class="usk-icon-arrow-right-<?php echo esc_html( $settings['nav_arrows_icon'] ); ?>" | |
| 270 | + <i class="usk-icon-arrow-right-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" | |
| 205 | 271 | aria-hidden="true"></i> |
| 206 | 272 | </a> |
| 207 | 273 | </div> |
| 208 | 274 | </div> |
| @@ -207,47 +273,49 @@ | ||
| 207 | 273 | </div> |
| 208 | 274 | </div> |
| 209 | 275 | <?php endif; |
| 210 | 276 | } |
| 211 | - protected function register_global_template_pagination() { | |
| 277 | + protected function register_global_template_pagination() | |
| 278 | + { | |
| 212 | 279 | $settings = $this->get_settings_for_display(); |
| 213 | 280 | |
| 214 | - if ( 'dots' == $settings['navigation'] or 'arrows-fraction' == $settings['navigation'] ) : ?> | |
| 215 | - <div class="usk-position-z-index usk-position-<?php echo esc_html( $settings['dots_position'] ); ?>"> | |
| 281 | + if ('dots' == $settings['navigation'] or 'arrows-fraction' == $settings['navigation']): ?> | |
| 282 | + <div class="usk-position-z-index usk-position-<?php echo esc_attr($settings['dots_position']); ?>"> | |
| 216 | 283 | <div class="usk-dots-container"> |
| 217 | 284 | <div class="swiper-pagination"></div> |
| 218 | 285 | </div> |
| 219 | 286 | </div> |
| 220 | 287 | |
| 221 | - <?php elseif ( 'progressbar' == $settings['navigation'] ) : ?> | |
| 288 | + <?php elseif ('progressbar' == $settings['navigation']): ?> | |
| 222 | 289 | <div |
| 223 | - class="swiper-pagination usk-position-z-index usk-position-<?php echo esc_html( $settings['progress_position'] ); ?>"> | |
| 290 | + class="swiper-pagination usk-position-z-index usk-position-<?php echo esc_attr($settings['progress_position']); ?>"> | |
| 224 | 291 | </div> |
| 225 | 292 | <?php endif; |
| 226 | 293 | } |
| 227 | - protected function register_global_template_both_navigation() { | |
| 228 | - $settings = $this->get_settings_for_display(); | |
| 294 | + protected function register_global_template_both_navigation() | |
| 295 | + { | |
| 296 | + $settings = $this->get_settings_for_display(); | |
| 229 | 297 | $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'usk-visible@m usk-flex' : 'usk-flex'; |
| 230 | 298 | |
| 231 | 299 | ?> |
| 232 | - <div class="usk-position-z-index usk-position-<?php echo esc_html( $settings['both_position'] ); ?>"> | |
| 300 | + <div class="usk-position-z-index usk-position-<?php echo esc_attr($settings['both_position']); ?>"> | |
| 233 | 301 | <div class="usk-arrows-dots-container usk-slidenav-container "> |
| 234 | 302 | |
| 235 | 303 | <div class="usk-flex usk-flex-middle"> |
| 236 | - <div class="<?php echo esc_html( $hide_arrow_on_mobile ); ?>"> | |
| 304 | + <div class="<?php echo esc_attr($hide_arrow_on_mobile); ?>"> | |
| 237 | 305 | <a href="" class="usk-navigation-prev usk-slidenav-previous usk-icon usk-slidenav"> |
| 238 | - <i class="usk-icon-arrow-left-<?php echo esc_html( $settings['nav_arrows_icon'] ); ?>" | |
| 306 | + <i class="usk-icon-arrow-left-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" | |
| 239 | 307 | aria-hidden="true"></i> |
| 240 | 308 | </a> |
| 241 | 309 | </div> |
| 242 | 310 | |
| 243 | - <?php if ( 'center' !== $settings['both_position'] ) : ?> | |
| 311 | + <?php if ('center' !== $settings['both_position']): ?> | |
| 244 | 312 | <div class="swiper-pagination"></div> |
| 245 | 313 | <?php endif; ?> |
| 246 | 314 | |
| 247 | - <div class="<?php echo esc_html( $hide_arrow_on_mobile ); ?>"> | |
| 315 | + <div class="<?php echo esc_attr($hide_arrow_on_mobile); ?>"> | |
| 248 | 316 | <a href="" class="usk-navigation-next usk-slidenav-next usk-icon usk-slidenav"> |
| 249 | - <i class="usk-icon-arrow-right-<?php echo esc_html( $settings['nav_arrows_icon'] ); ?>" | |
| 317 | + <i class="usk-icon-arrow-right-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" | |
| 250 | 318 | aria-hidden="true"></i> |
| 251 | 319 | </a> |
| 252 | 320 | </div> |
| 253 | 321 | |
| @@ -255,29 +323,30 @@ | ||
| 255 | 323 | </div> |
| 256 | 324 | </div> |
| 257 | 325 | <?php |
| 258 | 326 | } |
| 259 | - protected function register_global_template_arrows_fraction() { | |
| 260 | - $settings = $this->get_settings_for_display(); | |
| 327 | + protected function register_global_template_arrows_fraction() | |
| 328 | + { | |
| 329 | + $settings = $this->get_settings_for_display(); | |
| 261 | 330 | $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'usk-visible@m' : ''; ?> |
| 262 | - <div class="usk-position-z-index usk-position-<?php echo esc_html( $settings['arrows_fraction_position'] ); ?>"> | |
| 331 | + <div class="usk-position-z-index usk-position-<?php echo esc_attr($settings['arrows_fraction_position']); ?>"> | |
| 263 | 332 | <div class="usk-arrows-fraction-container usk-slidenav-container "> |
| 264 | 333 | |
| 265 | 334 | <div class="usk-flex usk-flex-middle"> |
| 266 | - <div class="<?php echo esc_html( $hide_arrow_on_mobile ); ?>"> | |
| 335 | + <div class="<?php echo esc_attr($hide_arrow_on_mobile); ?>"> | |
| 267 | 336 | <a href="" class="usk-navigation-prev usk-slidenav-previous usk-icon usk-slidenav"> |
| 268 | - <i class="usk-icon-arrow-left-<?php echo esc_html( $settings['nav_arrows_icon'] ); ?>" | |
| 337 | + <i class="usk-icon-arrow-left-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" | |
| 269 | 338 | aria-hidden="true"></i> |
| 270 | 339 | </a> |
| 271 | 340 | </div> |
| 272 | 341 | |
| 273 | - <?php if ( 'center' !== $settings['arrows_fraction_position'] ) : ?> | |
| 342 | + <?php if ('center' !== $settings['arrows_fraction_position']): ?> | |
| 274 | 343 | <div class="swiper-pagination"></div> |
| 275 | 344 | <?php endif; ?> |
| 276 | 345 | |
| 277 | - <div class="<?php echo esc_html( $hide_arrow_on_mobile ); ?>"> | |
| 346 | + <div class="<?php echo esc_attr($hide_arrow_on_mobile); ?>"> | |
| 278 | 347 | <a href="" class="usk-navigation-next usk-slidenav-next usk-icon usk-slidenav"> |
| 279 | - <i class="usk-icon-arrow-right-<?php echo esc_html( $settings['nav_arrows_icon'] ); ?>" | |
| 348 | + <i class="usk-icon-arrow-right-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" | |
| 280 | 349 | aria-hidden="true"></i> |
| 281 | 350 | </a> |
| 282 | 351 | </div> |
| 283 | 352 | |
| @@ -285,18 +354,19 @@ | ||
| 285 | 354 | </div> |
| 286 | 355 | </div> |
| 287 | 356 | <?php |
| 288 | 357 | } |
| 289 | - protected function usk_register_global_template_carousel_footer() { | |
| 358 | + protected function usk_register_global_template_carousel_footer() | |
| 359 | + { | |
| 290 | 360 | $settings = $this->get_settings_for_display(); ?> |
| 291 | 361 | </div> |
| 292 | - <?php if ( 'yes' === $settings['show_scrollbar'] ) : ?> | |
| 362 | + <?php if ('yes' === $settings['show_scrollbar']): ?> | |
| 293 | 363 | <div class="swiper-scrollbar"></div> |
| 294 | 364 | <?php endif; ?> |
| 295 | 365 | </div> |
| 296 | - <?php if ( 'both' == $settings['navigation'] ) : ?> | |
| 366 | + <?php if ('both' == $settings['navigation']): ?> | |
| 297 | 367 | <?php $this->register_global_template_both_navigation(); ?> |
| 298 | - <?php if ( 'center' === $settings['both_position'] ) : ?> | |
| 368 | + <?php if ('center' === $settings['both_position']): ?> | |
| 299 | 369 | <div class="usk-position-z-index usk-position-bottom"> |
| 300 | 370 | <div class="usk-dots-container"> |
| 301 | 371 | <div class="swiper-pagination"></div> |
| 302 | 372 | </div> |
| @@ -301,16 +371,16 @@ | ||
| 301 | 371 | <div class="swiper-pagination"></div> |
| 302 | 372 | </div> |
| 303 | 373 | </div> |
| 304 | 374 | <?php endif; ?> |
| 305 | - <?php elseif ( 'arrows-fraction' == $settings['navigation'] ) : ?> | |
| 375 | + <?php elseif ('arrows-fraction' == $settings['navigation']): ?> | |
| 306 | 376 | <?php $this->register_global_template_arrows_fraction(); ?> |
| 307 | - <?php if ( 'center' === $settings['arrows_fraction_position'] ) : ?> | |
| 377 | + <?php if ('center' === $settings['arrows_fraction_position']): ?> | |
| 308 | 378 | <div class="usk-dots-container"> |
| 309 | 379 | <div class="swiper-pagination"></div> |
| 310 | 380 | </div> |
| 311 | 381 | <?php endif; ?> |
| 312 | - <?php else : ?> | |
| 382 | + <?php else: ?> | |
| 313 | 383 | <?php $this->register_global_template_pagination() ?> |
| 314 | 384 | <?php $this->register_global_template_navigation() ?> |
| 315 | 385 | <?php endif; ?> |
| 316 | 386 | </div> |
| @@ -318,33 +388,34 @@ | ||
| 318 | 388 | </div> |
| 319 | 389 | |
| 320 | 390 | <?php |
| 321 | 391 | } |
| 322 | - protected function register_global_template_carousel_header() { | |
| 392 | + protected function register_global_template_carousel_header() | |
| 393 | + { | |
| 323 | 394 | $settings = $this->get_settings_for_display(); |
| 324 | - $this->add_render_attribute( 'usk-carousel-wrapper', 'class', [ '' . $this->get_name() . '', 'usk-grid-carousel', 'usk-content-position-' . $settings['alignment'] . '' ] ); | |
| 325 | - $id = 'ultimate-store-kit-' . $this->get_id(); | |
| 326 | - $elementor_vp_lg = get_option( 'elementor_viewport_lg' ); | |
| 327 | - $elementor_vp_md = get_option( 'elementor_viewport_md' ); | |
| 328 | - $viewport_lg = ! empty( $elementor_vp_lg ) ? $elementor_vp_lg - 1 : 1023; | |
| 329 | - $viewport_md = ! empty( $elementor_vp_md ) ? $elementor_vp_md - 1 : 767; | |
| 330 | - $this->add_render_attribute( 'carousel', 'id', $id ); | |
| 331 | - $this->add_render_attribute( 'carousel', 'class', [ 'usk-carousel', 'usk-carousel-layout', 'elementor-swiper' ] ); | |
| 332 | - if ( 'arrows' == $settings['navigation'] ) { | |
| 333 | - $this->add_render_attribute( 'carousel', 'class', 'usk-arrows-align-' . $settings['arrows_position'] ); | |
| 334 | - } elseif ( 'dots' == $settings['navigation'] ) { | |
| 335 | - $this->add_render_attribute( 'carousel', 'class', 'usk-dots-align-' . $settings['dots_position'] ); | |
| 336 | - } elseif ( 'both' == $settings['navigation'] ) { | |
| 337 | - $this->add_render_attribute( 'carousel', 'class', 'usk-arrows-dots-align-' . $settings['both_position'] ); | |
| 338 | - } elseif ( 'arrows-fraction' == $settings['navigation'] ) { | |
| 339 | - $this->add_render_attribute( 'carousel', 'class', 'usk-arrows-dots-align-' . $settings['arrows_fraction_position'] ); | |
| 395 | + $this->add_render_attribute('usk-carousel-wrapper', 'class', ['' . $this->get_name() . '', 'usk-grid-carousel']); | |
| 396 | + $id = 'ultimate-store-kit-' . $this->get_id(); | |
| 397 | + $elementor_vp_lg = get_option('elementor_viewport_lg'); | |
| 398 | + $elementor_vp_md = get_option('elementor_viewport_md'); | |
| 399 | + $viewport_lg = !empty($elementor_vp_lg) ? $elementor_vp_lg - 1 : 1023; | |
| 400 | + $viewport_md = !empty($elementor_vp_md) ? $elementor_vp_md - 1 : 767; | |
| 401 | + $this->add_render_attribute('carousel', 'id', $id); | |
| 402 | + $this->add_render_attribute('carousel', 'class', ['usk-carousel', 'usk-carousel-layout', 'elementor-swiper']); | |
| 403 | + if ('arrows' == $settings['navigation']) { | |
| 404 | + $this->add_render_attribute('carousel', 'class', 'usk-arrows-align-' . $settings['arrows_position']); | |
| 405 | + } elseif ('dots' == $settings['navigation']) { | |
| 406 | + $this->add_render_attribute('carousel', 'class', 'usk-dots-align-' . $settings['dots_position']); | |
| 407 | + } elseif ('both' == $settings['navigation']) { | |
| 408 | + $this->add_render_attribute('carousel', 'class', 'usk-arrows-dots-align-' . $settings['both_position']); | |
| 409 | + } elseif ('arrows-fraction' == $settings['navigation']) { | |
| 410 | + $this->add_render_attribute('carousel', 'class', 'usk-arrows-dots-align-' . $settings['arrows_fraction_position']); | |
| 340 | 411 | } |
| 341 | 412 | |
| 342 | - if ( 'arrows-fraction' == $settings['navigation'] ) { | |
| 413 | + if ('arrows-fraction' == $settings['navigation']) { | |
| 343 | 414 | $pagination_type = 'fraction'; |
| 344 | - } elseif ( 'both' == $settings['navigation'] or 'dots' == $settings['navigation'] ) { | |
| 415 | + } elseif ('both' == $settings['navigation'] or 'dots' == $settings['navigation']) { | |
| 345 | 416 | $pagination_type = 'bullets'; |
| 346 | - } elseif ( 'progressbar' == $settings['navigation'] ) { | |
| 417 | + } elseif ('progressbar' == $settings['navigation']) { | |
| 347 | 418 | $pagination_type = 'progressbar'; |
| 348 | 419 | } else { |
| 349 | 420 | $pagination_type = ''; |
| 350 | 421 | } |
| @@ -349,118 +420,119 @@ | ||
| 349 | 420 | $pagination_type = ''; |
| 350 | 421 | } |
| 351 | 422 | |
| 352 | 423 | $this->add_render_attribute( |
| 353 | - [ | |
| 354 | - 'carousel' => [ | |
| 355 | - 'data-settings' => [ | |
| 356 | - wp_json_encode( array_filter( [ | |
| 357 | - "autoplay" => ( "yes" == $settings["autoplay"] ) ? [ "delay" => $settings["autoplay_speed"] ] : false, | |
| 358 | - "loop" => ( $settings["loop"] == "yes" ) ? true : false, | |
| 359 | - "speed" => $settings["speed"]["size"], | |
| 360 | - "pauseOnHover" => ( "yes" == $settings["pauseonhover"] ) ? true : false, | |
| 361 | - "slidesPerView" => isset( $settings["columns_mobile"] ) ? (int) $settings["columns_mobile"] : 1, | |
| 362 | - "slidesPerGroup" => isset( $settings["slides_to_scroll_mobile"] ) ? (int) $settings["slides_to_scroll_mobile"] : 1, | |
| 363 | - "spaceBetween" => $settings["items_gap"]["size"], | |
| 364 | - "centeredSlides" => ( $settings["centered_slides"] === "yes" ) ? true : false, | |
| 365 | - "grabCursor" => ( $settings["grab_cursor"] === "yes" ) ? true : false, | |
| 366 | - "effect" => $settings["skin"], | |
| 367 | - "observer" => ( $settings["observer"] ) ? true : false, | |
| 368 | - "observeParents" => ( $settings["observer"] ) ? true : false, | |
| 424 | + [ | |
| 425 | + 'carousel' => [ | |
| 426 | + 'data-settings' => [ | |
| 427 | + wp_json_encode(array_filter([ | |
| 428 | + "autoplay" => ("yes" == $settings["autoplay"]) ? ["delay" => $settings["autoplay_speed"]] : false, | |
| 429 | + "loop" => ($settings["loop"] == "yes") ? true : false, | |
| 430 | + "speed" => $settings["speed"]["size"], | |
| 431 | + "pauseOnHover" => ("yes" == $settings["pauseonhover"]) ? true : false, | |
| 432 | + "slidesPerView" => isset($settings["columns_mobile"]) ? (int) $settings["columns_mobile"] : 1, | |
| 433 | + "slidesPerGroup" => isset($settings["slides_to_scroll_mobile"]) ? (int) $settings["slides_to_scroll_mobile"] : 1, | |
| 434 | + "spaceBetween" => !empty($settings["items_gap_mobile"]["size"]) ? (int)$settings["items_gap_mobile"]["size"] : 0, | |
| 435 | + "centeredSlides" => ($settings["centered_slides"] === "yes") ? true : false, | |
| 436 | + "grabCursor" => ($settings["grab_cursor"] === "yes") ? true : false, | |
| 437 | + "effect" => $settings["skin"], | |
| 438 | + "observer" => ($settings["observer"]) ? true : false, | |
| 439 | + "observeParents" => ($settings["observer"]) ? true : false, | |
| 369 | 440 | // "direction" => $settings['direction'], |
| 370 | 441 | "watchSlidesVisibility" => true, |
| 371 | - "watchSlidesProgress" => true, | |
| 372 | - "breakpoints" => [ | |
| 373 | - (int) $viewport_md => [ | |
| 374 | - "slidesPerView" => isset( $settings["columns_tablet"] ) ? (int) $settings["columns_tablet"] : 2, | |
| 375 | - "spaceBetween" => $settings["items_gap"]["size"], | |
| 376 | - "slidesPerGroup" => isset( $settings["slides_to_scroll_tablet"] ) ? (int) $settings["slides_to_scroll_tablet"] : 1, | |
| 442 | + "watchSlidesProgress" => true, | |
| 443 | + "breakpoints" => [ | |
| 444 | + (int) $viewport_md => [ | |
| 445 | + "slidesPerView" => isset($settings["columns_tablet"]) ? (int) $settings["columns_tablet"] : 2, | |
| 446 | + "spaceBetween" => !empty($settings["items_gap_tablet"]["size"]) ? (int)$settings["items_gap_tablet"]["size"] : 0, | |
| 447 | + "slidesPerGroup" => isset($settings["slides_to_scroll_tablet"]) ? (int) $settings["slides_to_scroll_tablet"] : 1, | |
| 377 | 448 | ], |
| 378 | - (int) $viewport_lg => [ | |
| 379 | - "slidesPerView" => isset( $settings["columns"] ) ? (int) $settings["columns"] : 3, | |
| 380 | - "spaceBetween" => $settings["items_gap"]["size"], | |
| 381 | - "slidesPerGroup" => isset( $settings["slides_to_scroll"] ) ? (int) $settings["slides_to_scroll"] : 1, | |
| 449 | + (int) $viewport_lg => [ | |
| 450 | + "slidesPerView" => isset($settings["columns"]) ? (int) $settings["columns"] : 3, | |
| 451 | + "spaceBetween" => !empty($settings["items_gap"]["size"]) ? (int)$settings["items_gap"]["size"] : 0, | |
| 452 | + "slidesPerGroup" => isset($settings["slides_to_scroll"]) ? (int) $settings["slides_to_scroll"] : 1, | |
| 382 | 453 | ] |
| 383 | 454 | ], |
| 384 | - "navigation" => [ | |
| 455 | + "navigation" => [ | |
| 385 | 456 | "nextEl" => "#" . $id . " .usk-navigation-next", |
| 386 | 457 | "prevEl" => "#" . $id . " .usk-navigation-prev", |
| 387 | 458 | ], |
| 388 | - "pagination" => [ | |
| 389 | - "el" => "#" . $id . " .swiper-pagination", | |
| 390 | - "type" => $pagination_type, | |
| 391 | - "clickable" => "true", | |
| 392 | - 'dynamicBullets' => ( "yes" == $settings["dynamic_bullets"] ) ? true : false, | |
| 459 | + "pagination" => [ | |
| 460 | + "el" => "#" . $id . " .swiper-pagination", | |
| 461 | + "type" => $pagination_type, | |
| 462 | + "clickable" => "true", | |
| 463 | + 'dynamicBullets' => ("yes" == $settings["dynamic_bullets"]) ? true : false, | |
| 393 | 464 | ], |
| 394 | - "scrollbar" => [ | |
| 395 | - "el" => "#" . $id . " .swiper-scrollbar", | |
| 465 | + "scrollbar" => [ | |
| 466 | + "el" => "#" . $id . " .swiper-scrollbar", | |
| 396 | 467 | "hide" => "true", |
| 397 | 468 | ], |
| 398 | - 'coverflowEffect' => [ | |
| 399 | - 'rotate' => ( "yes" == $settings["coverflow_toggle"] ) ? $settings["coverflow_rotate"]["size"] : 50, | |
| 400 | - 'stretch' => ( "yes" == $settings["coverflow_toggle"] ) ? $settings["coverflow_stretch"]["size"] : 0, | |
| 401 | - 'depth' => ( "yes" == $settings["coverflow_toggle"] ) ? $settings["coverflow_depth"]["size"] : 100, | |
| 402 | - 'modifier' => ( "yes" == $settings["coverflow_toggle"] ) ? $settings["coverflow_modifier"]["size"] : 1, | |
| 469 | + 'coverflowEffect' => [ | |
| 470 | + 'rotate' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_rotate"]["size"] : 50, | |
| 471 | + 'stretch' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_stretch"]["size"] : 0, | |
| 472 | + 'depth' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_depth"]["size"] : 100, | |
| 473 | + 'modifier' => ("yes" == $settings["coverflow_toggle"]) ? $settings["coverflow_modifier"]["size"] : 1, | |
| 403 | 474 | 'slideShadows' => true, |
| 404 | 475 | ], |
| 405 | 476 | |
| 406 | - ] ) ) | |
| 477 | + ])) | |
| 407 | 478 | ] |
| 408 | 479 | ] |
| 409 | 480 | ] |
| 410 | 481 | ); |
| 411 | 482 | |
| 412 | - $swiper_class = Plugin::$instance->experiments->is_feature_active( 'e_swiper_latest' ) ? 'swiper' : 'swiper-container'; | |
| 413 | - $this->add_render_attribute( 'swiper', 'class', 'swiper-carousel ' . $swiper_class ); | |
| 483 | + $this->add_render_attribute('swiper', 'class', 'swiper-carousel swiper'); | |
| 414 | 484 | |
| 415 | 485 | ?> |
| 416 | 486 | |
| 417 | 487 | <div class="ultimate-store-kit"> |
| 418 | - <div <?php $this->print_render_attribute_string( 'usk-carousel-wrapper' ); ?>> | |
| 419 | - <div <?php $this->print_render_attribute_string( 'carousel' ); ?>> | |
| 420 | - <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'swiper' ) ); ?>> | |
| 488 | + <div <?php $this->print_render_attribute_string('usk-carousel-wrapper'); ?>> | |
| 489 | + <div <?php $this->print_render_attribute_string('carousel'); ?>> | |
| 490 | + <div <?php $this->print_render_attribute_string('swiper'); ?>> | |
| 421 | 491 | <div class="swiper-wrapper"> |
| 422 | 492 | <?php |
| 423 | 493 | } |
| 424 | - protected function usk_get_badge_label_percentage() { | |
| 494 | + protected function usk_get_badge_label_percentage() | |
| 495 | + { | |
| 425 | 496 | global $product; |
| 426 | - if ( $product->is_on_sale() ) { | |
| 497 | + if ($product->is_on_sale()) { | |
| 427 | 498 | $percentage = ''; |
| 428 | - if ( $product->get_type() == 'variable' ) { | |
| 499 | + if ($product->get_type() == 'variable') { | |
| 429 | 500 | $available_variations = $product->get_variation_prices(); |
| 430 | - $max_percentage = 0; | |
| 431 | - foreach ( $available_variations['regular_price'] as $key => $regular_price ) { | |
| 432 | - $sale_price = $available_variations['sale_price'][ $key ]; | |
| 433 | - if ( $sale_price < $regular_price ) { | |
| 434 | - $percentage = round( ( ( $regular_price - $sale_price ) / $regular_price ) * 100 ); | |
| 435 | - if ( $percentage > $max_percentage ) { | |
| 501 | + $max_percentage = 0; | |
| 502 | + foreach ($available_variations['regular_price'] as $key => $regular_price) { | |
| 503 | + $sale_price = $available_variations['sale_price'][$key]; | |
| 504 | + if ($sale_price < $regular_price) { | |
| 505 | + $percentage = round((($regular_price - $sale_price) / $regular_price) * 100); | |
| 506 | + if ($percentage > $max_percentage) { | |
| 436 | 507 | $max_percentage = $percentage; |
| 437 | 508 | } |
| 438 | 509 | } |
| 439 | 510 | } |
| 440 | 511 | $percentage = $max_percentage; |
| 441 | - } elseif ( ( $product->get_type() == 'simple' || $product->get_type() == 'external' ) ) { | |
| 442 | - $percentage = round( ( ( $product->get_regular_price() - $product->get_sale_price() ) / $product->get_regular_price() ) * 100 ); | |
| 512 | + } elseif (($product->get_type() == 'simple' || $product->get_type() == 'external')) { | |
| 513 | + $percentage = round((($product->get_regular_price() - $product->get_sale_price()) / $product->get_regular_price()) * 100); | |
| 443 | 514 | } |
| 444 | - if ( $percentage ) { | |
| 445 | - printf( '<div class="usk-badge-wrap usk-percantage-badge"><span class="usk-badge">%1$s%2$s</span></div>', esc_html( $percentage ), esc_html__( '% off', 'ultimate-store-kit' ) ); | |
| 515 | + if ($percentage) { | |
| 516 | + printf('<div class="usk-badge-wrap usk-percantage-badge"><span class="usk-badge">%1$s%2$s</span></div>', esc_html($percentage), esc_html__('% off', 'ultimate-store-kit')); | |
| 446 | 517 | } |
| 447 | 518 | } |
| 448 | 519 | } |
| 449 | - protected function render_navigation() { | |
| 450 | - $settings = $this->get_settings_for_display(); | |
| 520 | + protected function render_navigation() | |
| 521 | + { | |
| 522 | + $settings = $this->get_settings_for_display(); | |
| 451 | 523 | $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? ' bdt-visible@m' : ''; |
| 452 | 524 | |
| 453 | - if ( 'arrows' == $settings['navigation'] ) : ?> | |
| 525 | + if ('arrows' == $settings['navigation']): ?> | |
| 454 | 526 | <div |
| 455 | - class="bdt-position-z-index bdt-position-<?php echo esc_attr( $settings['arrows_position'] . $hide_arrow_on_mobile ); ?>"> | |
| 527 | + class="bdt-position-z-index bdt-position-<?php echo esc_attr($settings['arrows_position'] . $hide_arrow_on_mobile); ?>"> | |
| 456 | 528 | <div class="bdt-arrows-container bdt-slidenav-container"> |
| 457 | 529 | <a href="" class="bdt-navigation-prev bdt-slidenav-previous bdt-icon bdt-slidenav"> |
| 458 | - <i class="ep-icon-arrow-left-<?php echo esc_attr( $settings['nav_arrows_icon'] ); ?>" | |
| 530 | + <i class="usk-icon-arrow-left-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" | |
| 459 | 531 | aria-hidden="true"></i> |
| 460 | 532 | </a> |
| 461 | 533 | <a href="" class="bdt-navigation-next bdt-slidenav-next bdt-icon bdt-slidenav"> |
| 462 | - <i class="ep-icon-arrow-right-<?php echo esc_attr( $settings['nav_arrows_icon'] ); ?>" | |
| 534 | + <i class="usk-icon-arrow-right-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" | |
| 463 | 535 | aria-hidden="true"></i> |
| 464 | 536 | </a> |
| 465 | 537 | </div> |
| 466 | 538 | </div> |
| @@ -467,13 +539,14 @@ | ||
| 467 | 539 | <?php |
| 468 | 540 | endif; |
| 469 | 541 | } |
| 470 | 542 | |
| 471 | - protected function render_pagination() { | |
| 543 | + protected function render_pagination() | |
| 544 | + { | |
| 472 | 545 | $settings = $this->get_settings_for_display(); |
| 473 | 546 | |
| 474 | - if ( 'dots' == $settings['navigation'] or 'arrows-fraction' == $settings['navigation'] ) : ?> | |
| 475 | - <div class="bdt-position-z-index bdt-position-<?php echo esc_attr( $settings['dots_position'] ); ?>"> | |
| 547 | + if ('dots' == $settings['navigation'] or 'arrows-fraction' == $settings['navigation']): ?> | |
| 548 | + <div class="bdt-position-z-index bdt-position-<?php echo esc_attr($settings['dots_position']); ?>"> | |
| 476 | 549 | <div class="bdt-dots-container"> |
| 477 | 550 | <div class="swiper-pagination"></div> |
| 478 | 551 | </div> |
| 479 | 552 | </div> |
| @@ -478,43 +551,44 @@ | ||
| 478 | 551 | </div> |
| 479 | 552 | </div> |
| 480 | 553 | |
| 481 | 554 | <?php |
| 482 | - elseif ( 'progressbar' == $settings['navigation'] ) : ?> | |
| 555 | + elseif ('progressbar' == $settings['navigation']): ?> | |
| 483 | 556 | <div |
| 484 | - class="swiper-pagination bdt-position-z-index bdt-position-<?php echo esc_attr( $settings['progress_position'] ); ?>"> | |
| 557 | + class="swiper-pagination bdt-position-z-index bdt-position-<?php echo esc_attr($settings['progress_position']); ?>"> | |
| 485 | 558 | </div> |
| 486 | 559 | <?php |
| 487 | 560 | endif; |
| 488 | 561 | } |
| 489 | 562 | |
| 490 | - protected function render_both_navigation() { | |
| 491 | - $settings = $this->get_settings_for_display(); | |
| 563 | + protected function render_both_navigation() | |
| 564 | + { | |
| 565 | + $settings = $this->get_settings_for_display(); | |
| 492 | 566 | $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'bdt-visible@m' : ''; |
| 493 | 567 | |
| 494 | 568 | ?> |
| 495 | - <div class="bdt-position-z-index bdt-position-<?php echo esc_attr( $settings['both_position'] ); ?>"> | |
| 569 | + <div class="bdt-position-z-index bdt-position-<?php echo esc_attr($settings['both_position']); ?>"> | |
| 496 | 570 | <div class="bdt-arrows-dots-container bdt-slidenav-container "> |
| 497 | 571 | |
| 498 | 572 | <div class="bdt-flex bdt-flex-middle"> |
| 499 | 573 | <div class="<?php |
| 500 | - echo esc_attr( $hide_arrow_on_mobile ); ?>"> | |
| 574 | + echo esc_attr($hide_arrow_on_mobile); ?>"> | |
| 501 | 575 | <a href="" class="bdt-navigation-prev bdt-slidenav-previous bdt-icon bdt-slidenav"> |
| 502 | - <i class="ep-icon-arrow-left-<?php echo esc_attr( $settings['nav_arrows_icon'] ); ?>" | |
| 576 | + <i class="usk-icon-arrow-left-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" | |
| 503 | 577 | aria-hidden="true"></i> |
| 504 | 578 | </a> |
| 505 | 579 | </div> |
| 506 | 580 | |
| 507 | 581 | <?php |
| 508 | - if ( 'center' !== $settings['both_position'] ) : ?> | |
| 582 | + if ('center' !== $settings['both_position']): ?> | |
| 509 | 583 | <div class="swiper-pagination"></div> |
| 510 | 584 | <?php |
| 511 | 585 | endif; ?> |
| 512 | 586 | |
| 513 | 587 | <div class="<?php |
| 514 | - echo esc_attr( $hide_arrow_on_mobile ); ?>"> | |
| 588 | + echo esc_attr($hide_arrow_on_mobile); ?>"> | |
| 515 | 589 | <a href="" class="bdt-navigation-next bdt-slidenav-next bdt-icon bdt-slidenav"> |
| 516 | - <i class="ep-icon-arrow-right-<?php echo esc_attr( $settings['nav_arrows_icon'] ); ?>" | |
| 590 | + <i class="usk-icon-arrow-right-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" | |
| 517 | 591 | aria-hidden="true"></i> |
| 518 | 592 | </a> |
| 519 | 593 | </div> |
| 520 | 594 | |
| @@ -522,34 +596,35 @@ | ||
| 522 | 596 | </div> |
| 523 | 597 | </div> |
| 524 | 598 | <?php |
| 525 | 599 | } |
| 526 | - protected function render_arrows_fraction() { | |
| 527 | - $settings = $this->get_settings_for_display(); | |
| 600 | + protected function render_arrows_fraction() | |
| 601 | + { | |
| 602 | + $settings = $this->get_settings_for_display(); | |
| 528 | 603 | $hide_arrow_on_mobile = $settings['hide_arrow_on_mobile'] ? 'bdt-visible@m' : ''; ?> |
| 529 | 604 | <div |
| 530 | - class="bdt-position-z-index bdt-position-<?php echo esc_attr( $settings['arrows_fraction_position'] ); ?>"> | |
| 605 | + class="bdt-position-z-index bdt-position-<?php echo esc_attr($settings['arrows_fraction_position']); ?>"> | |
| 531 | 606 | <div class="bdt-arrows-fraction-container bdt-slidenav-container "> |
| 532 | 607 | |
| 533 | 608 | <div class="bdt-flex bdt-flex-middle"> |
| 534 | 609 | <div class="<?php |
| 535 | - echo esc_attr( $hide_arrow_on_mobile ); ?>"> | |
| 610 | + echo esc_attr($hide_arrow_on_mobile); ?>"> | |
| 536 | 611 | <a href="" class="bdt-navigation-prev bdt-slidenav-previous bdt-icon bdt-slidenav"> |
| 537 | - <i class="ep-icon-arrow-left-<?php echo esc_attr( $settings['nav_arrows_icon'] ); ?>" | |
| 612 | + <i class="usk-icon-arrow-left-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" | |
| 538 | 613 | aria-hidden="true"></i> |
| 539 | 614 | </a> |
| 540 | 615 | </div> |
| 541 | 616 | |
| 542 | 617 | <?php |
| 543 | - if ( 'center' !== $settings['arrows_fraction_position'] ) : ?> | |
| 618 | + if ('center' !== $settings['arrows_fraction_position']): ?> | |
| 544 | 619 | <div class="swiper-pagination"></div> |
| 545 | 620 | <?php |
| 546 | 621 | endif; ?> |
| 547 | 622 | |
| 548 | 623 | <div class="<?php |
| 549 | - echo esc_attr( $hide_arrow_on_mobile ); ?>"> | |
| 624 | + echo esc_attr($hide_arrow_on_mobile); ?>"> | |
| 550 | 625 | <a href="" class="bdt-navigation-next bdt-slidenav-next bdt-icon bdt-slidenav"> |
| 551 | - <i class="ep-icon-arrow-right-<?php echo esc_attr( $settings['nav_arrows_icon'] ); ?>" | |
| 626 | + <i class="usk-icon-arrow-right-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" | |
| 552 | 627 | aria-hidden="true"></i> |
| 553 | 628 | </a> |
| 554 | 629 | </div> |
| 555 | 630 | |
| @@ -557,13 +632,14 @@ | ||
| 557 | 632 | </div> |
| 558 | 633 | </div> |
| 559 | 634 | <?php |
| 560 | 635 | } |
| 561 | - protected function render_footer() { | |
| 636 | + protected function render_footer() | |
| 637 | + { | |
| 562 | 638 | $settings = $this->get_settings_for_display(); ?> |
| 563 | 639 | </div> |
| 564 | 640 | <?php |
| 565 | - if ( 'yes' === $settings['show_scrollbar'] ) : ?> | |
| 641 | + if ('yes' === $settings['show_scrollbar']): ?> | |
| 566 | 642 | <div class="swiper-scrollbar"></div> |
| 567 | 643 | <?php |
| 568 | 644 | endif; ?> |
| 569 | 645 | </div> |
| @@ -568,12 +644,12 @@ | ||
| 568 | 644 | endif; ?> |
| 569 | 645 | </div> |
| 570 | 646 | |
| 571 | 647 | <?php |
| 572 | - if ( 'both' == $settings['navigation'] ) : ?> | |
| 648 | + if ('both' == $settings['navigation']): ?> | |
| 573 | 649 | <?php $this->render_both_navigation(); ?> |
| 574 | 650 | <?php |
| 575 | - if ( 'center' === $settings['both_position'] ) : ?> | |
| 651 | + if ('center' === $settings['both_position']): ?> | |
| 576 | 652 | <div class="bdt-position-z-index bdt-position-bottom"> |
| 577 | 653 | <div class="bdt-dots-container"> |
| 578 | 654 | <div class="swiper-pagination"></div> |
| 579 | 655 | </div> |
| @@ -580,12 +656,12 @@ | ||
| 580 | 656 | </div> |
| 581 | 657 | <?php |
| 582 | 658 | endif; ?> |
| 583 | 659 | <?php |
| 584 | - elseif ( 'arrows-fraction' == $settings['navigation'] ) : ?> | |
| 660 | + elseif ('arrows-fraction' == $settings['navigation']): ?> | |
| 585 | 661 | <?php $this->render_arrows_fraction(); ?> |
| 586 | 662 | <?php |
| 587 | - if ( 'center' === $settings['arrows_fraction_position'] ) : ?> | |
| 663 | + if ('center' === $settings['arrows_fraction_position']): ?> | |
| 588 | 664 | <div class="bdt-dots-container"> |
| 589 | 665 | <div class="swiper-pagination"></div> |
| 590 | 666 | </div> |
| 591 | 667 | <?php |
| @@ -590,9 +666,9 @@ | ||
| 590 | 666 | </div> |
| 591 | 667 | <?php |
| 592 | 668 | endif; ?> |
| 593 | 669 | <?php |
| 594 | - else : ?> | |
| 670 | + else: ?> | |
| 595 | 671 | <?php $this->render_pagination(); ?> |
| 596 | 672 | <?php $this->render_navigation(); ?> |
| 597 | 673 | <?php |
| 598 | 674 | endif; ?> |