@@ -6,11 +6,11 @@ discard block |
||
| 6 | 6 | * @subpackage woocommerce |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -if ( ! function_exists( 'lsx_wc_support' ) ) : |
|
| 13 | +if ( ! function_exists('lsx_wc_support')) : |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * WooCommerce support. |
@@ -19,17 +19,17 @@ discard block |
||
| 19 | 19 | * @subpackage woocommerce |
| 20 | 20 | */ |
| 21 | 21 | function lsx_wc_support() { |
| 22 | - add_theme_support( 'woocommerce' ); |
|
| 23 | - add_theme_support( 'wc-product-gallery-zoom' ); |
|
| 24 | - add_theme_support( 'wc-product-gallery-lightbox' ); |
|
| 25 | - add_theme_support( 'wc-product-gallery-slider' ); |
|
| 22 | + add_theme_support('woocommerce'); |
|
| 23 | + add_theme_support('wc-product-gallery-zoom'); |
|
| 24 | + add_theme_support('wc-product-gallery-lightbox'); |
|
| 25 | + add_theme_support('wc-product-gallery-slider'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - add_action( 'after_setup_theme', 'lsx_wc_support' ); |
|
| 28 | + add_action('after_setup_theme', 'lsx_wc_support'); |
|
| 29 | 29 | |
| 30 | 30 | endif; |
| 31 | 31 | |
| 32 | -if ( ! function_exists( 'lsx_wc_scripts_add_styles' ) ) : |
|
| 32 | +if ( ! function_exists('lsx_wc_scripts_add_styles')) : |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * WooCommerce enqueue styles. |
@@ -38,33 +38,33 @@ discard block |
||
| 38 | 38 | * @subpackage woocommerce |
| 39 | 39 | */ |
| 40 | 40 | function lsx_wc_scripts_add_styles() { |
| 41 | - wp_enqueue_style( 'woocommerce-lsx', get_template_directory_uri() . '/assets/css/woocommerce.css', array( 'lsx_main' ), LSX_VERSION ); |
|
| 42 | - wp_style_add_data( 'woocommerce-lsx', 'rtl', 'replace' ); |
|
| 41 | + wp_enqueue_style('woocommerce-lsx', get_template_directory_uri() . '/assets/css/woocommerce.css', array('lsx_main'), LSX_VERSION); |
|
| 42 | + wp_style_add_data('woocommerce-lsx', 'rtl', 'replace'); |
|
| 43 | 43 | |
| 44 | 44 | // Remove select2 added by WooCommerce. |
| 45 | - if ( ! is_admin() ) { |
|
| 46 | - wp_dequeue_style( 'select2' ); |
|
| 47 | - wp_deregister_style( 'select2' ); |
|
| 45 | + if ( ! is_admin()) { |
|
| 46 | + wp_dequeue_style('select2'); |
|
| 47 | + wp_deregister_style('select2'); |
|
| 48 | 48 | |
| 49 | - wp_dequeue_script( 'select2' ); |
|
| 50 | - wp_deregister_script( 'select2' ); |
|
| 49 | + wp_dequeue_script('select2'); |
|
| 50 | + wp_deregister_script('select2'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Adds select2 if on Cart or Checkout Page. |
| 54 | - if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { |
|
| 55 | - wp_enqueue_script( 'select2' ); |
|
| 56 | - wp_enqueue_style( 'select2' ); |
|
| 54 | + if ( ! is_woocommerce() && ! is_cart() && ! is_checkout()) { |
|
| 55 | + wp_enqueue_script('select2'); |
|
| 56 | + wp_enqueue_style('select2'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Remove WC Shipping Multiple Addresses specific script causing issues on checkout. |
| 60 | - wp_dequeue_script( 'wcms-country-select' ); |
|
| 60 | + wp_dequeue_script('wcms-country-select'); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - add_action( 'wp_enqueue_scripts', 'lsx_wc_scripts_add_styles' ); |
|
| 63 | + add_action('wp_enqueue_scripts', 'lsx_wc_scripts_add_styles'); |
|
| 64 | 64 | |
| 65 | 65 | endif; |
| 66 | 66 | |
| 67 | -if ( ! function_exists( 'lsx_wc_form_field_args' ) ) : |
|
| 67 | +if ( ! function_exists('lsx_wc_form_field_args')) : |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * WooCommerce form fields. |
@@ -72,17 +72,17 @@ discard block |
||
| 72 | 72 | * @package lsx |
| 73 | 73 | * @subpackage woocommerce |
| 74 | 74 | */ |
| 75 | - function lsx_wc_form_field_args( $args, $key, $value ) { |
|
| 75 | + function lsx_wc_form_field_args($args, $key, $value) { |
|
| 76 | 76 | $args['input_class'][] = 'form-control'; |
| 77 | 77 | |
| 78 | 78 | return $args; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - add_action( 'woocommerce_form_field_args', 'lsx_wc_form_field_args', 10, 3 ); |
|
| 81 | + add_action('woocommerce_form_field_args', 'lsx_wc_form_field_args', 10, 3); |
|
| 82 | 82 | |
| 83 | 83 | endif; |
| 84 | 84 | |
| 85 | -if ( ! function_exists( 'lsx_wc_theme_wrapper_start' ) ) : |
|
| 85 | +if ( ! function_exists('lsx_wc_theme_wrapper_start')) : |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * WooCommerce wrapper start. |
@@ -92,18 +92,18 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | function lsx_wc_theme_wrapper_start() { |
| 94 | 94 | lsx_content_wrap_before(); |
| 95 | - echo '<div id="primary" class="content-area ' . esc_attr( lsx_main_class() ) . '">'; |
|
| 95 | + echo '<div id="primary" class="content-area ' . esc_attr(lsx_main_class()) . '">'; |
|
| 96 | 96 | lsx_content_before(); |
| 97 | 97 | echo '<main id="main" class="site-main" role="main">'; |
| 98 | 98 | lsx_content_top(); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); |
|
| 102 | - add_action( 'woocommerce_before_main_content', 'lsx_wc_theme_wrapper_start' ); |
|
| 101 | + remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); |
|
| 102 | + add_action('woocommerce_before_main_content', 'lsx_wc_theme_wrapper_start'); |
|
| 103 | 103 | |
| 104 | 104 | endif; |
| 105 | 105 | |
| 106 | -if ( ! function_exists( 'lsx_wc_theme_wrapper_end' ) ) : |
|
| 106 | +if ( ! function_exists('lsx_wc_theme_wrapper_end')) : |
|
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | 109 | * WooCommerce wrapper end. |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | lsx_content_wrap_after(); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); |
|
| 123 | - add_action( 'woocommerce_after_main_content', 'lsx_wc_theme_wrapper_end' ); |
|
| 122 | + remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); |
|
| 123 | + add_action('woocommerce_after_main_content', 'lsx_wc_theme_wrapper_end'); |
|
| 124 | 124 | |
| 125 | 125 | endif; |
| 126 | 126 | |
| 127 | -if ( ! function_exists( 'lsx_wc_disable_lsx_banner_plugin' ) ) : |
|
| 127 | +if ( ! function_exists('lsx_wc_disable_lsx_banner_plugin')) : |
|
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * Disable LSX Banners plugin in some WC pages. |
@@ -132,25 +132,25 @@ discard block |
||
| 132 | 132 | * @package lsx |
| 133 | 133 | * @subpackage woocommerce |
| 134 | 134 | */ |
| 135 | - function lsx_wc_disable_lsx_banner_plugin( $disabled ) { |
|
| 135 | + function lsx_wc_disable_lsx_banner_plugin($disabled) { |
|
| 136 | 136 | global $post; |
| 137 | 137 | |
| 138 | - if ( is_cart() || is_checkout() || is_account_page() ) { |
|
| 138 | + if (is_cart() || is_checkout() || is_account_page()) { |
|
| 139 | 139 | $disabled = true; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ( $post && class_exists( 'WC_Wishlists_Pages' ) && WC_Wishlists_Pages::is_wishlist_page( $post->post_name ) ) { |
|
| 142 | + if ($post && class_exists('WC_Wishlists_Pages') && WC_Wishlists_Pages::is_wishlist_page($post->post_name)) { |
|
| 143 | 143 | $disabled = true; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | return $disabled; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - add_filter( 'lsx_banner_plugin_disable', 'lsx_wc_disable_lsx_banner_plugin' ); |
|
| 149 | + add_filter('lsx_banner_plugin_disable', 'lsx_wc_disable_lsx_banner_plugin'); |
|
| 150 | 150 | |
| 151 | 151 | endif; |
| 152 | 152 | |
| 153 | -if ( ! function_exists( 'lsx_wc_disable_lsx_banner' ) ) : |
|
| 153 | +if ( ! function_exists('lsx_wc_disable_lsx_banner')) : |
|
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | 156 | * Disable LSX Banners banner in some WC pages. |
@@ -158,19 +158,19 @@ discard block |
||
| 158 | 158 | * @package lsx |
| 159 | 159 | * @subpackage woocommerce |
| 160 | 160 | */ |
| 161 | - function lsx_wc_disable_lsx_banner( $disabled ) { |
|
| 162 | - if ( is_shop() || is_product_category() || is_product_tag() || is_product() ) { |
|
| 161 | + function lsx_wc_disable_lsx_banner($disabled) { |
|
| 162 | + if (is_shop() || is_product_category() || is_product_tag() || is_product()) { |
|
| 163 | 163 | $disabled = true; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | return $disabled; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - add_filter( 'lsx_banner_disable', 'lsx_wc_disable_lsx_banner' ); |
|
| 169 | + add_filter('lsx_banner_disable', 'lsx_wc_disable_lsx_banner'); |
|
| 170 | 170 | |
| 171 | 171 | endif; |
| 172 | 172 | |
| 173 | -if ( ! function_exists( 'lsx_wc_add_cart' ) ) : |
|
| 173 | +if ( ! function_exists('lsx_wc_add_cart')) : |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Adds WC cart to the header. |
@@ -178,34 +178,34 @@ discard block |
||
| 178 | 178 | * @package lsx |
| 179 | 179 | * @subpackage template-tags |
| 180 | 180 | */ |
| 181 | - function lsx_wc_add_cart( $items, $args ) { |
|
| 182 | - $cart_menu_item_position = apply_filters( 'lsx_wc_cart_menu_item_position', 'primary' ); |
|
| 181 | + function lsx_wc_add_cart($items, $args) { |
|
| 182 | + $cart_menu_item_position = apply_filters('lsx_wc_cart_menu_item_position', 'primary'); |
|
| 183 | 183 | |
| 184 | 184 | $cart_logged_out_position = $cart_menu_item_position . '_logged_out'; |
| 185 | 185 | |
| 186 | - if ( $cart_menu_item_position === $args->theme_location || $cart_logged_out_position === $args->theme_location ) { |
|
| 187 | - $customizer_option = get_theme_mod( 'lsx_header_wc_cart', false ); |
|
| 186 | + if ($cart_menu_item_position === $args->theme_location || $cart_logged_out_position === $args->theme_location) { |
|
| 187 | + $customizer_option = get_theme_mod('lsx_header_wc_cart', false); |
|
| 188 | 188 | |
| 189 | - if ( ! empty( $customizer_option ) ) { |
|
| 189 | + if ( ! empty($customizer_option)) { |
|
| 190 | 190 | ob_start(); |
| 191 | - the_widget( 'WC_Widget_Cart', 'title=' ); |
|
| 191 | + the_widget('WC_Widget_Cart', 'title='); |
|
| 192 | 192 | $widget = ob_get_clean(); |
| 193 | 193 | |
| 194 | - if ( is_cart() ) { |
|
| 194 | + if (is_cart()) { |
|
| 195 | 195 | $class = 'current-menu-item'; |
| 196 | 196 | } else { |
| 197 | 197 | $class = ''; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | $item_class = 'menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown lsx-wc-cart-menu-item ' . $class; |
| 201 | - $item_class = apply_filters( 'lsx_wc_cart_menu_item_class', $item_class ); |
|
| 201 | + $item_class = apply_filters('lsx_wc_cart_menu_item_class', $item_class); |
|
| 202 | 202 | |
| 203 | 203 | $item = '<li class="' . $item_class . '">' . |
| 204 | - '<a title="' . esc_attr__( 'View your shopping cart', 'lsx' ) . '" href="' . esc_url( wc_get_cart_url() ) . '" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true">' . |
|
| 205 | - '<span class="lsx-wc-cart-amount">' . wp_kses_data( WC()->cart->get_cart_subtotal() ) . '</span>' . |
|
| 204 | + '<a title="' . esc_attr__('View your shopping cart', 'lsx') . '" href="' . esc_url(wc_get_cart_url()) . '" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true">' . |
|
| 205 | + '<span class="lsx-wc-cart-amount">' . wp_kses_data(WC()->cart->get_cart_subtotal()) . '</span>' . |
|
| 206 | 206 | /* Translators: %s: items quantity */ |
| 207 | - '<span class="lsx-wc-cart-count">' . wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx' ), WC()->cart->get_cart_contents_count() ) ) . '</span>' . |
|
| 208 | - ( ! empty( WC()->cart->get_cart_contents_count() ) ? '<span class="lsx-wc-cart-count-badge">' . wp_kses_data( WC()->cart->get_cart_contents_count() ) . '</span>' : '' ) . |
|
| 207 | + '<span class="lsx-wc-cart-count">' . wp_kses_data(sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx'), WC()->cart->get_cart_contents_count())) . '</span>' . |
|
| 208 | + ( ! empty(WC()->cart->get_cart_contents_count()) ? '<span class="lsx-wc-cart-count-badge">' . wp_kses_data(WC()->cart->get_cart_contents_count()) . '</span>' : '') . |
|
| 209 | 209 | '</a>' . |
| 210 | 210 | '<ul role="menu" class=" dropdown-menu lsx-wc-cart-sub-menu">' . |
| 211 | 211 | '<li>' . |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | '</ul>' . |
| 215 | 215 | '</li>'; |
| 216 | 216 | |
| 217 | - if ( 'top-menu' === $args->theme_location ) { |
|
| 217 | + if ('top-menu' === $args->theme_location) { |
|
| 218 | 218 | $items = $item . $items; |
| 219 | 219 | } else { |
| 220 | 220 | $items = $items . $item; |
@@ -225,11 +225,11 @@ discard block |
||
| 225 | 225 | return $items; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - add_filter( 'wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2 ); |
|
| 228 | + add_filter('wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2); |
|
| 229 | 229 | |
| 230 | 230 | endif; |
| 231 | 231 | |
| 232 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_before' ) ) : |
|
| 232 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_before')) : |
|
| 233 | 233 | |
| 234 | 234 | /** |
| 235 | 235 | * Change WC products widget wrapper (before). |
@@ -237,16 +237,16 @@ discard block |
||
| 237 | 237 | * @package lsx |
| 238 | 238 | * @subpackage woocommerce |
| 239 | 239 | */ |
| 240 | - function lsx_wc_products_widget_wrapper_before( $html ) { |
|
| 240 | + function lsx_wc_products_widget_wrapper_before($html) { |
|
| 241 | 241 | $html = '<div class="lsx-woocommerce-slider lsx-woocommerce-shortcode">'; |
| 242 | 242 | return $html; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - add_filter( 'woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15 ); |
|
| 245 | + add_filter('woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15); |
|
| 246 | 246 | |
| 247 | 247 | endif; |
| 248 | 248 | |
| 249 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_after' ) ) : |
|
| 249 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_after')) : |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Change WC products widget wrapper (after). |
@@ -254,16 +254,16 @@ discard block |
||
| 254 | 254 | * @package lsx |
| 255 | 255 | * @subpackage woocommerce |
| 256 | 256 | */ |
| 257 | - function lsx_wc_products_widget_wrapper_after( $html ) { |
|
| 257 | + function lsx_wc_products_widget_wrapper_after($html) { |
|
| 258 | 258 | $html = '</div>'; |
| 259 | 259 | return $html; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - add_filter( 'woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15 ); |
|
| 262 | + add_filter('woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15); |
|
| 263 | 263 | |
| 264 | 264 | endif; |
| 265 | 265 | |
| 266 | -if ( ! function_exists( 'lsx_wc_reviews_widget_override' ) ) : |
|
| 266 | +if ( ! function_exists('lsx_wc_reviews_widget_override')) : |
|
| 267 | 267 | |
| 268 | 268 | /** |
| 269 | 269 | * Override WC ewviews widget. |
@@ -272,18 +272,18 @@ discard block |
||
| 272 | 272 | * @subpackage woocommerce |
| 273 | 273 | */ |
| 274 | 274 | function lsx_wc_reviews_widget_override() { |
| 275 | - if ( class_exists( 'WC_Widget_Recent_Reviews' ) ) { |
|
| 276 | - unregister_widget( 'WC_Widget_Recent_Reviews' ); |
|
| 275 | + if (class_exists('WC_Widget_Recent_Reviews')) { |
|
| 276 | + unregister_widget('WC_Widget_Recent_Reviews'); |
|
| 277 | 277 | require get_template_directory() . '/includes/classes/class-lsx-wc-widget-recent-reviews.php'; |
| 278 | - register_widget( 'LSX_WC_Widget_Recent_Reviews' ); |
|
| 278 | + register_widget('LSX_WC_Widget_Recent_Reviews'); |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - add_action( 'widgets_init', 'lsx_wc_reviews_widget_override', 15 ); |
|
| 282 | + add_action('widgets_init', 'lsx_wc_reviews_widget_override', 15); |
|
| 283 | 283 | |
| 284 | 284 | endif; |
| 285 | 285 | |
| 286 | -if ( ! function_exists( 'lsx_wc_change_price_html' ) ) : |
|
| 286 | +if ( ! function_exists('lsx_wc_change_price_html')) : |
|
| 287 | 287 | |
| 288 | 288 | /** |
| 289 | 289 | * Change WC ZERO price to "free". |
@@ -295,28 +295,28 @@ discard block |
||
| 295 | 295 | * @param $product WC_Product |
| 296 | 296 | * @return string |
| 297 | 297 | */ |
| 298 | - function lsx_wc_change_price_html( $price, $product ) { |
|
| 299 | - if ( empty( $product->get_price() ) ) { |
|
| 300 | - if ( $product->is_on_sale() && $product->get_regular_price() ) { |
|
| 301 | - $regular_price = wc_get_price_to_display( $product, array( |
|
| 298 | + function lsx_wc_change_price_html($price, $product) { |
|
| 299 | + if (empty($product->get_price())) { |
|
| 300 | + if ($product->is_on_sale() && $product->get_regular_price()) { |
|
| 301 | + $regular_price = wc_get_price_to_display($product, array( |
|
| 302 | 302 | 'qty' => 1, |
| 303 | 303 | 'price' => $product->get_regular_price(), |
| 304 | - ) ); |
|
| 304 | + )); |
|
| 305 | 305 | |
| 306 | - $price = wc_format_price_range( $regular_price, esc_html__( 'Free!', 'lsx' ) ); |
|
| 306 | + $price = wc_format_price_range($regular_price, esc_html__('Free!', 'lsx')); |
|
| 307 | 307 | } else { |
| 308 | - $price = '<span class="amount">' . esc_html__( 'Free!', 'lsx' ) . '</span>'; |
|
| 308 | + $price = '<span class="amount">' . esc_html__('Free!', 'lsx') . '</span>'; |
|
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | return $price; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - add_filter( 'woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2 ); |
|
| 315 | + add_filter('woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2); |
|
| 316 | 316 | |
| 317 | 317 | endif; |
| 318 | 318 | |
| 319 | -if ( ! function_exists( 'lsx_wc_cart_link_fragment' ) ) : |
|
| 319 | +if ( ! function_exists('lsx_wc_cart_link_fragment')) : |
|
| 320 | 320 | |
| 321 | 321 | /** |
| 322 | 322 | * Cart Fragments. |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | * @package lsx |
| 326 | 326 | * @subpackage woocommerce |
| 327 | 327 | */ |
| 328 | - function lsx_wc_cart_link_fragment( $fragments ) { |
|
| 328 | + function lsx_wc_cart_link_fragment($fragments) { |
|
| 329 | 329 | global $woocommerce; |
| 330 | 330 | |
| 331 | 331 | ob_start(); |
@@ -336,8 +336,8 @@ discard block |
||
| 336 | 336 | lsx_wc_items_counter(); |
| 337 | 337 | $items_counter = ob_get_clean(); |
| 338 | 338 | |
| 339 | - if ( ! empty( $items_counter ) ) { |
|
| 340 | - $fragments['div.widget_shopping_cart_content'] = preg_replace( '/(.+)(<\/ul>)[\s\n]*(<p class="woocommerce-mini-cart__total)(.+)/', '$1' . $items_counter . '$2$3$4', $fragments['div.widget_shopping_cart_content'] ); |
|
| 339 | + if ( ! empty($items_counter)) { |
|
| 340 | + $fragments['div.widget_shopping_cart_content'] = preg_replace('/(.+)(<\/ul>)[\s\n]*(<p class="woocommerce-mini-cart__total)(.+)/', '$1' . $items_counter . '$2$3$4', $fragments['div.widget_shopping_cart_content']); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | return $fragments; |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | endif; |
| 347 | 347 | |
| 348 | -if ( ! function_exists( 'lsx_wc_cart_link' ) ) : |
|
| 348 | +if ( ! function_exists('lsx_wc_cart_link')) : |
|
| 349 | 349 | |
| 350 | 350 | /** |
| 351 | 351 | * Cart Link. |
@@ -356,14 +356,14 @@ discard block |
||
| 356 | 356 | */ |
| 357 | 357 | function lsx_wc_cart_link() { |
| 358 | 358 | ?> |
| 359 | - <a title="<?php esc_attr_e( 'View your shopping cart', 'lsx' ); ?>" href="<?php echo esc_url( wc_get_cart_url() ); ?>" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true"> |
|
| 360 | - <span class="lsx-wc-cart-amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> |
|
| 359 | + <a title="<?php esc_attr_e('View your shopping cart', 'lsx'); ?>" href="<?php echo esc_url(wc_get_cart_url()); ?>" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true"> |
|
| 360 | + <span class="lsx-wc-cart-amount"><?php echo wp_kses_data(WC()->cart->get_cart_subtotal()); ?></span> |
|
| 361 | 361 | |
| 362 | 362 | <?php /* Translators: %s: items quantity */ ?> |
| 363 | - <span class="lsx-wc-cart-count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx' ), WC()->cart->get_cart_contents_count() ) );?></span> |
|
| 363 | + <span class="lsx-wc-cart-count"><?php echo wp_kses_data(sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx'), WC()->cart->get_cart_contents_count())); ?></span> |
|
| 364 | 364 | |
| 365 | - <?php if ( ! empty( WC()->cart->get_cart_contents_count() ) ) : ?> |
|
| 366 | - <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data( WC()->cart->get_cart_contents_count() );?></span> |
|
| 365 | + <?php if ( ! empty(WC()->cart->get_cart_contents_count())) : ?> |
|
| 366 | + <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data(WC()->cart->get_cart_contents_count()); ?></span> |
|
| 367 | 367 | <?php endif; ?> |
| 368 | 368 | </a> |
| 369 | 369 | <?php |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | endif; |
| 373 | 373 | |
| 374 | -if ( ! function_exists( 'lsx_wc_items_counter' ) ) : |
|
| 374 | +if ( ! function_exists('lsx_wc_items_counter')) : |
|
| 375 | 375 | |
| 376 | 376 | /** |
| 377 | 377 | * Add car item hidden items counter. |
@@ -383,21 +383,21 @@ discard block |
||
| 383 | 383 | $count = (int) WC()->cart->get_cart_contents_count(); |
| 384 | 384 | $items_counter = ''; |
| 385 | 385 | |
| 386 | - if ( ! empty( $count ) ) { |
|
| 386 | + if ( ! empty($count)) { |
|
| 387 | 387 | $count -= 3; |
| 388 | 388 | |
| 389 | - if ( 1 === $count ) { |
|
| 390 | - $items_counter = esc_html__( '1 other item in cart', 'lsx' ); |
|
| 391 | - } elseif ( $count > 1 ) { |
|
| 389 | + if (1 === $count) { |
|
| 390 | + $items_counter = esc_html__('1 other item in cart', 'lsx'); |
|
| 391 | + } elseif ($count > 1) { |
|
| 392 | 392 | /* Translators: %s: items counter */ |
| 393 | - $items_counter = sprintf( esc_html__( '%s other items in cart', 'lsx' ), $count ); |
|
| 393 | + $items_counter = sprintf(esc_html__('%s other items in cart', 'lsx'), $count); |
|
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - if ( ! empty( $items_counter ) ) : |
|
| 397 | + if ( ! empty($items_counter)) : |
|
| 398 | 398 | ?> |
| 399 | 399 | <li class="woocommerce-mini-cart-item mini_cart_item" style="display: block;"> |
| 400 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>"><?php echo esc_html( $items_counter ); ?></a> |
|
| 400 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>"><?php echo esc_html($items_counter); ?></a> |
|
| 401 | 401 | </li> |
| 402 | 402 | <?php |
| 403 | 403 | endif; |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | |
| 406 | 406 | endif; |
| 407 | 407 | |
| 408 | -if ( ! function_exists( 'lsx_wc_loop_shop_per_page' ) ) : |
|
| 408 | +if ( ! function_exists('lsx_wc_loop_shop_per_page')) : |
|
| 409 | 409 | |
| 410 | 410 | /** |
| 411 | 411 | * Changes the number of products to display on shop. |
@@ -413,16 +413,16 @@ discard block |
||
| 413 | 413 | * @package lsx |
| 414 | 414 | * @subpackage woocommerce |
| 415 | 415 | */ |
| 416 | - function lsx_wc_loop_shop_per_page( $items ) { |
|
| 416 | + function lsx_wc_loop_shop_per_page($items) { |
|
| 417 | 417 | $items = 20; |
| 418 | 418 | return $items; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - add_filter( 'loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20 ); |
|
| 421 | + add_filter('loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20); |
|
| 422 | 422 | |
| 423 | 423 | endif; |
| 424 | 424 | |
| 425 | -if ( ! function_exists( 'lsx_wc_add_to_cart_message_html' ) ) : |
|
| 425 | +if ( ! function_exists('lsx_wc_add_to_cart_message_html')) : |
|
| 426 | 426 | |
| 427 | 427 | /** |
| 428 | 428 | * Changes the "added to cart" message HTML. |
@@ -430,39 +430,39 @@ discard block |
||
| 430 | 430 | * @package lsx |
| 431 | 431 | * @subpackage woocommerce |
| 432 | 432 | */ |
| 433 | - function lsx_wc_add_to_cart_message_html( $message, $products ) { |
|
| 433 | + function lsx_wc_add_to_cart_message_html($message, $products) { |
|
| 434 | 434 | $message = '<div class="woocommerce-message-added-to-cart">' . $message . '</div>'; |
| 435 | 435 | return $message; |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - add_filter( 'wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2 ); |
|
| 438 | + add_filter('wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2); |
|
| 439 | 439 | |
| 440 | 440 | endif; |
| 441 | 441 | |
| 442 | -if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.3', '>=' ) ) { |
|
| 443 | - add_filter( 'woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
| 442 | +if (defined('WC_VERSION') && version_compare(WC_VERSION, '2.3', '>=')) { |
|
| 443 | + add_filter('woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
| 444 | 444 | } else { |
| 445 | - add_filter( 'add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
| 445 | + add_filter('add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | -remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); |
|
| 448 | +remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 10); |
|
| 449 | 449 | |
| 450 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
| 451 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
| 452 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 ); |
|
| 453 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 ); |
|
| 454 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
| 450 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
| 451 | +add_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
| 452 | +add_action('woocommerce_after_shop_loop', 'woocommerce_result_count', 20); |
|
| 453 | +add_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 30); |
|
| 454 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
| 455 | 455 | |
| 456 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
| 457 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); |
|
| 456 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
| 457 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30); |
|
| 458 | 458 | |
| 459 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
| 460 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
| 461 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
| 462 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 ); |
|
| 463 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
| 459 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
| 460 | +add_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
| 461 | +add_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
| 462 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30); |
|
| 463 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
| 464 | 464 | |
| 465 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper' ) ) : |
|
| 465 | +if ( ! function_exists('lsx_wc_sorting_wrapper')) : |
|
| 466 | 466 | |
| 467 | 467 | /** |
| 468 | 468 | * Sorting wrapper. |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | |
| 477 | 477 | endif; |
| 478 | 478 | |
| 479 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper_close' ) ) : |
|
| 479 | +if ( ! function_exists('lsx_wc_sorting_wrapper_close')) : |
|
| 480 | 480 | |
| 481 | 481 | /** |
| 482 | 482 | * Sorting wrapper close. |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | |
| 491 | 491 | endif; |
| 492 | 492 | |
| 493 | -if ( ! function_exists( 'lsx_wc_product_columns_wrapper_close' ) ) : |
|
| 493 | +if ( ! function_exists('lsx_wc_product_columns_wrapper_close')) : |
|
| 494 | 494 | |
| 495 | 495 | /** |
| 496 | 496 | * Product columns wrapper close. |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | |
| 505 | 505 | endif; |
| 506 | 506 | |
| 507 | -if ( ! function_exists( 'lsx_wc_woocommerce_pagination' ) ) : |
|
| 507 | +if ( ! function_exists('lsx_wc_woocommerce_pagination')) : |
|
| 508 | 508 | |
| 509 | 509 | /** |
| 510 | 510 | * LSX WooCommerce Pagination |
@@ -516,14 +516,14 @@ discard block |
||
| 516 | 516 | * @subpackage woocommerce |
| 517 | 517 | */ |
| 518 | 518 | function lsx_wc_woocommerce_pagination() { |
| 519 | - if ( woocommerce_products_will_display() ) { |
|
| 519 | + if (woocommerce_products_will_display()) { |
|
| 520 | 520 | woocommerce_pagination(); |
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | endif; |
| 525 | 525 | |
| 526 | -if ( ! function_exists( 'lsx_customizer_wc_controls' ) ) : |
|
| 526 | +if ( ! function_exists('lsx_customizer_wc_controls')) : |
|
| 527 | 527 | |
| 528 | 528 | /** |
| 529 | 529 | * Returns an array of the core panel. |
@@ -533,10 +533,10 @@ discard block |
||
| 533 | 533 | * |
| 534 | 534 | * @return $lsx_controls array() |
| 535 | 535 | */ |
| 536 | - function lsx_customizer_wc_controls( $lsx_controls ) { |
|
| 536 | + function lsx_customizer_wc_controls($lsx_controls) { |
|
| 537 | 537 | $lsx_controls['panels']['lsx-wc'] = array( |
| 538 | - 'title' => esc_html__( 'WooCommerce', 'lsx' ), |
|
| 539 | - 'description' => esc_html__( 'Change the WooCommerce settings.', 'lsx' ), |
|
| 538 | + 'title' => esc_html__('WooCommerce', 'lsx'), |
|
| 539 | + 'description' => esc_html__('Change the WooCommerce settings.', 'lsx'), |
|
| 540 | 540 | 'priority' => 23, |
| 541 | 541 | ); |
| 542 | 542 | |
@@ -545,8 +545,8 @@ discard block |
||
| 545 | 545 | */ |
| 546 | 546 | |
| 547 | 547 | $lsx_controls['sections']['lsx-wc-global'] = array( |
| 548 | - 'title' => esc_html__( 'Global', 'lsx' ), |
|
| 549 | - 'description' => esc_html__( 'Change the WooCommerce global settings.', 'lsx' ), |
|
| 548 | + 'title' => esc_html__('Global', 'lsx'), |
|
| 549 | + 'description' => esc_html__('Change the WooCommerce global settings.', 'lsx'), |
|
| 550 | 550 | 'panel' => 'lsx-wc', |
| 551 | 551 | 'priority' => 1, |
| 552 | 552 | ); |
@@ -557,8 +557,8 @@ discard block |
||
| 557 | 557 | ); |
| 558 | 558 | |
| 559 | 559 | $lsx_controls['fields']['lsx_wc_mobile_footer_bar_status'] = array( |
| 560 | - 'label' => esc_html__( 'Footer Bar', 'lsx' ), |
|
| 561 | - 'description' => esc_html__( 'Enable the mobile footer bar.', 'lsx' ), |
|
| 560 | + 'label' => esc_html__('Footer Bar', 'lsx'), |
|
| 561 | + 'description' => esc_html__('Enable the mobile footer bar.', 'lsx'), |
|
| 562 | 562 | 'section' => 'lsx-wc-global', |
| 563 | 563 | 'type' => 'checkbox', |
| 564 | 564 | 'priority' => 1, |
@@ -569,8 +569,8 @@ discard block |
||
| 569 | 569 | */ |
| 570 | 570 | |
| 571 | 571 | $lsx_controls['sections']['lsx-wc-cart'] = array( |
| 572 | - 'title' => esc_html__( 'Cart', 'lsx' ), |
|
| 573 | - 'description' => esc_html__( 'Change the WooCommerce cart settings.', 'lsx' ), |
|
| 572 | + 'title' => esc_html__('Cart', 'lsx'), |
|
| 573 | + 'description' => esc_html__('Change the WooCommerce cart settings.', 'lsx'), |
|
| 574 | 574 | 'panel' => 'lsx-wc', |
| 575 | 575 | 'priority' => 2, |
| 576 | 576 | ); |
@@ -581,8 +581,8 @@ discard block |
||
| 581 | 581 | ); |
| 582 | 582 | |
| 583 | 583 | $lsx_controls['fields']['lsx_header_wc_cart'] = array( |
| 584 | - 'label' => esc_html__( 'Menu Item', 'lsx' ), |
|
| 585 | - 'description' => esc_html__( 'Enable the cart menu item.', 'lsx' ), |
|
| 584 | + 'label' => esc_html__('Menu Item', 'lsx'), |
|
| 585 | + 'description' => esc_html__('Enable the cart menu item.', 'lsx'), |
|
| 586 | 586 | 'section' => 'lsx-wc-cart', |
| 587 | 587 | 'type' => 'checkbox', |
| 588 | 588 | 'priority' => 1, |
@@ -591,11 +591,11 @@ discard block |
||
| 591 | 591 | return $lsx_controls; |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | - add_filter( 'lsx_customizer_controls', 'lsx_customizer_wc_controls' ); |
|
| 594 | + add_filter('lsx_customizer_controls', 'lsx_customizer_wc_controls'); |
|
| 595 | 595 | |
| 596 | 596 | endif; |
| 597 | 597 | |
| 598 | -if ( ! function_exists( 'lsx_wc_footer_bar' ) ) : |
|
| 598 | +if ( ! function_exists('lsx_wc_footer_bar')) : |
|
| 599 | 599 | |
| 600 | 600 | /** |
| 601 | 601 | * Display WC footer bar. |
@@ -604,46 +604,46 @@ discard block |
||
| 604 | 604 | * @subpackage woocommerce |
| 605 | 605 | */ |
| 606 | 606 | function lsx_wc_footer_bar() { |
| 607 | - if ( ! empty( get_theme_mod( 'lsx_wc_mobile_footer_bar_status', '1' ) ) ) : |
|
| 607 | + if ( ! empty(get_theme_mod('lsx_wc_mobile_footer_bar_status', '1'))) : |
|
| 608 | 608 | ?> |
| 609 | 609 | <div class="lsx-wc-footer-bar"> |
| 610 | - <form role="search" method="get" action="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-form"> |
|
| 610 | + <form role="search" method="get" action="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-form"> |
|
| 611 | 611 | <fieldset> |
| 612 | - <legend class="screen-reader-text"><?php esc_html_e( 'Search products', 'lsx' ); ?></legend> |
|
| 613 | - <input type="search" name="s" placeholder="<?php esc_attr_e( 'Search products...', 'lsx' ); ?>" class="form-control"> |
|
| 612 | + <legend class="screen-reader-text"><?php esc_html_e('Search products', 'lsx'); ?></legend> |
|
| 613 | + <input type="search" name="s" placeholder="<?php esc_attr_e('Search products...', 'lsx'); ?>" class="form-control"> |
|
| 614 | 614 | </fieldset> |
| 615 | 615 | </form> |
| 616 | 616 | |
| 617 | 617 | <ul class="lsx-wc-footer-bar-items"> |
| 618 | 618 | <li class="lsx-wc-footer-bar-item"> |
| 619 | - <a href="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
| 619 | + <a href="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
| 620 | 620 | <i class="fa fa-home" aria-hidden="true"></i> |
| 621 | - <span><?php esc_html_e( 'Home', 'lsx' ); ?></span> |
|
| 621 | + <span><?php esc_html_e('Home', 'lsx'); ?></span> |
|
| 622 | 622 | </a> |
| 623 | 623 | </li> |
| 624 | 624 | |
| 625 | 625 | <li class="lsx-wc-footer-bar-item"> |
| 626 | - <a href="<?php echo esc_url( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); ?>" class="lsx-wc-footer-bar-link"> |
|
| 626 | + <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" class="lsx-wc-footer-bar-link"> |
|
| 627 | 627 | <i class="fa fa-user" aria-hidden="true"></i> |
| 628 | - <span><?php esc_html_e( 'Account', 'lsx' ); ?></span> |
|
| 628 | + <span><?php esc_html_e('Account', 'lsx'); ?></span> |
|
| 629 | 629 | </a> |
| 630 | 630 | </li> |
| 631 | 631 | |
| 632 | 632 | <li class="lsx-wc-footer-bar-item"> |
| 633 | 633 | <a href="#" class="lsx-wc-footer-bar-link lsx-wc-footer-bar-link-toogle"> |
| 634 | 634 | <i class="fa fa-search" aria-hidden="true"></i> |
| 635 | - <span><?php esc_html_e( 'Search', 'lsx' ); ?></span> |
|
| 635 | + <span><?php esc_html_e('Search', 'lsx'); ?></span> |
|
| 636 | 636 | </a> |
| 637 | 637 | </li> |
| 638 | 638 | |
| 639 | 639 | <li class="lsx-wc-footer-bar-item"> |
| 640 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
| 640 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
| 641 | 641 | <i class="fa fa-shopping-basket" aria-hidden="true"></i> |
| 642 | 642 | <?php $count = WC()->cart->get_cart_contents_count(); ?> |
| 643 | - <?php if ( ! empty( $count ) ) : ?> |
|
| 644 | - <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data( $count ); ?></span> |
|
| 643 | + <?php if ( ! empty($count)) : ?> |
|
| 644 | + <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data($count); ?></span> |
|
| 645 | 645 | <?php endif; ?> |
| 646 | - <span><?php esc_html_e( 'Cart', 'lsx' ); ?></span> |
|
| 646 | + <span><?php esc_html_e('Cart', 'lsx'); ?></span> |
|
| 647 | 647 | </a> |
| 648 | 648 | </li> |
| 649 | 649 | </ul> |
@@ -652,11 +652,11 @@ discard block |
||
| 652 | 652 | endif; |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | - add_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
| 655 | + add_action('lsx_body_bottom', 'lsx_wc_footer_bar', 15); |
|
| 656 | 656 | |
| 657 | 657 | endif; |
| 658 | 658 | |
| 659 | -if ( ! function_exists( 'lsx_wc_body_class' ) ) : |
|
| 659 | +if ( ! function_exists('lsx_wc_body_class')) : |
|
| 660 | 660 | |
| 661 | 661 | /** |
| 662 | 662 | * Changes body class. |
@@ -664,25 +664,25 @@ discard block |
||
| 664 | 664 | * @package lsx |
| 665 | 665 | * @subpackage woocommerce |
| 666 | 666 | */ |
| 667 | - function lsx_wc_body_class( $classes ) { |
|
| 667 | + function lsx_wc_body_class($classes) { |
|
| 668 | 668 | global $post; |
| 669 | 669 | |
| 670 | - if ( $post && class_exists( 'WC_Wishlists_Pages' ) && WC_Wishlists_Pages::is_wishlist_page( $post->post_name ) ) { |
|
| 670 | + if ($post && class_exists('WC_Wishlists_Pages') && WC_Wishlists_Pages::is_wishlist_page($post->post_name)) { |
|
| 671 | 671 | $classes[] = 'woocommerce-page woocommerce-wishlist'; |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | - if ( ! empty( get_theme_mod( 'lsx_wc_mobile_footer_bar_status', '1' ) ) ) { |
|
| 674 | + if ( ! empty(get_theme_mod('lsx_wc_mobile_footer_bar_status', '1'))) { |
|
| 675 | 675 | $classes[] = 'lsx-wc-has-footer-bar'; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | return $classes; |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | - add_filter( 'body_class', 'lsx_wc_body_class', 2999 ); |
|
| 681 | + add_filter('body_class', 'lsx_wc_body_class', 2999); |
|
| 682 | 682 | |
| 683 | 683 | endif; |
| 684 | 684 | |
| 685 | -if ( ! function_exists( 'lsx_wc_downloadable_products' ) ) : |
|
| 685 | +if ( ! function_exists('lsx_wc_downloadable_products')) : |
|
| 686 | 686 | |
| 687 | 687 | /** |
| 688 | 688 | * Changes downloads "download" button text. |
@@ -690,19 +690,19 @@ discard block |
||
| 690 | 690 | * @package lsx |
| 691 | 691 | * @subpackage woocommerce |
| 692 | 692 | */ |
| 693 | - function lsx_wc_downloadable_products( $downloads ) { |
|
| 694 | - foreach ( $downloads as $i => $download ) { |
|
| 695 | - $downloads[ $i ]['download_name'] = esc_html__( 'Download', 'lsx' ); |
|
| 693 | + function lsx_wc_downloadable_products($downloads) { |
|
| 694 | + foreach ($downloads as $i => $download) { |
|
| 695 | + $downloads[$i]['download_name'] = esc_html__('Download', 'lsx'); |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | return $downloads; |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | - add_filter( 'woocommerce_customer_get_downloadable_products', 'lsx_wc_downloadable_products', 2999 ); |
|
| 701 | + add_filter('woocommerce_customer_get_downloadable_products', 'lsx_wc_downloadable_products', 2999); |
|
| 702 | 702 | |
| 703 | 703 | endif; |
| 704 | 704 | |
| 705 | -if ( ! function_exists( 'lsx_wc_move_bundle_products' ) ) : |
|
| 705 | +if ( ! function_exists('lsx_wc_move_bundle_products')) : |
|
| 706 | 706 | |
| 707 | 707 | /** |
| 708 | 708 | * WooCommerce - Move the bundle products to a tab. |
@@ -710,46 +710,46 @@ discard block |
||
| 710 | 710 | * @package lsx |
| 711 | 711 | * @subpackage woocommerce |
| 712 | 712 | */ |
| 713 | - function lsx_wc_move_bundle_products( $tabs ) { |
|
| 713 | + function lsx_wc_move_bundle_products($tabs) { |
|
| 714 | 714 | global $product, $post; |
| 715 | 715 | |
| 716 | - if ( method_exists( $product , 'get_bundled_items' ) ) { |
|
| 716 | + if (method_exists($product, 'get_bundled_items')) { |
|
| 717 | 717 | $bundled_items = $product->get_bundled_items(); |
| 718 | 718 | |
| 719 | - if ( ! empty( $bundled_items ) ) { |
|
| 719 | + if ( ! empty($bundled_items)) { |
|
| 720 | 720 | $tabs['bundled_products'] = array( |
| 721 | - 'title' => __( 'Included Products', 'lsx' ), |
|
| 721 | + 'title' => __('Included Products', 'lsx'), |
|
| 722 | 722 | 'priority' => 10, |
| 723 | 723 | 'callback' => 'lsx_wc_bundle_products', |
| 724 | 724 | ); |
| 725 | 725 | } |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - if ( isset( $tabs['description'] ) ) { |
|
| 728 | + if (isset($tabs['description'])) { |
|
| 729 | 729 | $tabs['description']['priority'] = 5; |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - if ( isset( $tabs['reviews'] ) ) { |
|
| 732 | + if (isset($tabs['reviews'])) { |
|
| 733 | 733 | $tabs['reviews']['priority'] = 15; |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | - if ( isset( $tabs['product_enquiry'] ) ) { |
|
| 736 | + if (isset($tabs['product_enquiry'])) { |
|
| 737 | 737 | $tabs['product_enquiry']['priority'] = 20; |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | return $tabs; |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | - add_action( 'woocommerce_product_tabs', 'lsx_wc_move_bundle_products', 50 ); |
|
| 743 | + add_action('woocommerce_product_tabs', 'lsx_wc_move_bundle_products', 50); |
|
| 744 | 744 | |
| 745 | 745 | endif; |
| 746 | 746 | |
| 747 | -if ( ! function_exists( 'lsx_wc_bundle_products' ) ) : |
|
| 747 | +if ( ! function_exists('lsx_wc_bundle_products')) : |
|
| 748 | 748 | |
| 749 | 749 | function lsx_wc_bundle_products() { |
| 750 | 750 | global $product, $post; |
| 751 | 751 | |
| 752 | - if ( method_exists( $product , 'get_bundled_items' ) ) { |
|
| 752 | + if (method_exists($product, 'get_bundled_items')) { |
|
| 753 | 753 | $bundled_items = $product->get_bundled_items(); |
| 754 | 754 | |
| 755 | 755 | // do_action( 'woocommerce_before_bundled_items', $product ); |
@@ -765,16 +765,16 @@ discard block |
||
| 765 | 765 | // $this->widget_start( $args, $instance ); |
| 766 | 766 | |
| 767 | 767 | // @codingStandardsIgnoreLine |
| 768 | - echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ); |
|
| 768 | + echo apply_filters('woocommerce_before_widget_product_list', '<ul class="product_list_widget">'); |
|
| 769 | 769 | |
| 770 | - foreach ( $bundled_items as $bundled_item ) { |
|
| 771 | - $product = wc_get_product( $bundled_item->item_data['product_id'] ); |
|
| 772 | - wc_get_template( 'content-widget-product.php' ); |
|
| 770 | + foreach ($bundled_items as $bundled_item) { |
|
| 771 | + $product = wc_get_product($bundled_item->item_data['product_id']); |
|
| 772 | + wc_get_template('content-widget-product.php'); |
|
| 773 | 773 | $product = $product_original; |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | // @codingStandardsIgnoreLine |
| 777 | - echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ); |
|
| 777 | + echo apply_filters('woocommerce_after_widget_product_list', '</ul>'); |
|
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | // $this->widget_end( $args ); |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | endif; |
| 784 | 784 | |
| 785 | 785 | |
| 786 | -if ( ! function_exists( 'lsx_wc_product_searchform' ) ) : |
|
| 786 | +if ( ! function_exists('lsx_wc_product_searchform')) : |
|
| 787 | 787 | /** |
| 788 | 788 | * woo_custom_product_searchform |
| 789 | 789 | * |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | * @since 1.0 |
| 792 | 792 | * @return void |
| 793 | 793 | */ |
| 794 | - function lsx_wc_product_searchform( $form ) { |
|
| 794 | + function lsx_wc_product_searchform($form) { |
|
| 795 | 795 | |
| 796 | 796 | $form = ' |
| 797 | 797 | <form role="search" method="get" class="search-form form-inline" id="searchform" action="<?php echo esc_url( home_url( \'/\' ) ); ?>"> |
@@ -812,53 +812,53 @@ discard block |
||
| 812 | 812 | |
| 813 | 813 | } |
| 814 | 814 | endif; |
| 815 | -add_filter( 'get_product_search_form' , 'lsx_wc_product_searchform', 10, 1 ); |
|
| 815 | +add_filter('get_product_search_form', 'lsx_wc_product_searchform', 10, 1); |
|
| 816 | 816 | |
| 817 | 817 | /** |
| 818 | 818 | * Add in nav classes for the Product Tabs |
| 819 | 819 | */ |
| 820 | 820 | function woocommerce_output_product_data_tabs() { |
| 821 | - $html = wc_get_template_html( 'single-product/tabs/tabs.php' ); |
|
| 821 | + $html = wc_get_template_html('single-product/tabs/tabs.php'); |
|
| 822 | 822 | |
| 823 | 823 | //$html = str_replace( 'woocommerce-wc-tabs nav nav-tabs-wrapper', 'woocommerce-tabs wc-tabs-wrapper', $html ); |
| 824 | - $html = str_replace( '"tabs wc-tabs', '"nav nav-tabs wc-tabs', $html ); |
|
| 825 | - echo wp_kses_post( $html ); |
|
| 824 | + $html = str_replace('"tabs wc-tabs', '"nav nav-tabs wc-tabs', $html); |
|
| 825 | + echo wp_kses_post($html); |
|
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | /** |
| 829 | 829 | * Output the pagination. |
| 830 | 830 | */ |
| 831 | 831 | function woocommerce_pagination() { |
| 832 | - if ( ! wc_get_loop_prop( 'is_paginated' ) || ! woocommerce_products_will_display() ) { |
|
| 832 | + if ( ! wc_get_loop_prop('is_paginated') || ! woocommerce_products_will_display()) { |
|
| 833 | 833 | return; |
| 834 | 834 | } |
| 835 | 835 | $args = array( |
| 836 | - 'total' => wc_get_loop_prop( 'total_pages' ), |
|
| 837 | - 'current' => wc_get_loop_prop( 'current_page' ), |
|
| 836 | + 'total' => wc_get_loop_prop('total_pages'), |
|
| 837 | + 'current' => wc_get_loop_prop('current_page'), |
|
| 838 | 838 | ); |
| 839 | 839 | |
| 840 | - if ( wc_get_loop_prop( 'is_shortcode' ) ) { |
|
| 841 | - $args['base'] = esc_url_raw( add_query_arg( 'product-page', '%#%', false ) ); |
|
| 840 | + if (wc_get_loop_prop('is_shortcode')) { |
|
| 841 | + $args['base'] = esc_url_raw(add_query_arg('product-page', '%#%', false)); |
|
| 842 | 842 | $args['format'] = '?product-page = %#%'; |
| 843 | 843 | } else { |
| 844 | - $args['base'] = esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', get_pagenum_link( 999999999, false ) ) ) ); |
|
| 844 | + $args['base'] = esc_url_raw(str_replace(999999999, '%#%', remove_query_arg('add-to-cart', get_pagenum_link(999999999, false)))); |
|
| 845 | 845 | $args['format'] = ''; |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | - echo wp_kses_post( '<div class="lsx-pagination-wrapper">' ); |
|
| 849 | - $template = wc_get_template_html( 'loop/pagination.php', $args ); |
|
| 850 | - $template = str_replace( 'woocommerce-pagination', 'lsx-pagination', $template ); |
|
| 851 | - echo wp_kses_post( $template ); |
|
| 852 | - echo wp_kses_post( '</div>' ); |
|
| 848 | + echo wp_kses_post('<div class="lsx-pagination-wrapper">'); |
|
| 849 | + $template = wc_get_template_html('loop/pagination.php', $args); |
|
| 850 | + $template = str_replace('woocommerce-pagination', 'lsx-pagination', $template); |
|
| 851 | + echo wp_kses_post($template); |
|
| 852 | + echo wp_kses_post('</div>'); |
|
| 853 | 853 | } |
| 854 | 854 | |
| 855 | -function lsx_wc_pagination_args( $args ) { |
|
| 856 | - $args['prev_text'] = '<span class="meta-nav">←</span> ' . esc_html__( 'Previous', 'lsx' ); |
|
| 857 | - $args['next_text'] = esc_html__( 'Next', 'lsx' ) . ' <span class="meta-nav">→</span>'; |
|
| 858 | - $args['type'] = 'plain'; |
|
| 855 | +function lsx_wc_pagination_args($args) { |
|
| 856 | + $args['prev_text'] = '<span class="meta-nav">←</span> ' . esc_html__('Previous', 'lsx'); |
|
| 857 | + $args['next_text'] = esc_html__('Next', 'lsx') . ' <span class="meta-nav">→</span>'; |
|
| 858 | + $args['type'] = 'plain'; |
|
| 859 | 859 | return $args; |
| 860 | 860 | } |
| 861 | -add_filter( 'woocommerce_pagination_args', 'lsx_wc_pagination_args',10 ,1 ); |
|
| 861 | +add_filter('woocommerce_pagination_args', 'lsx_wc_pagination_args', 10, 1); |
|
| 862 | 862 | |
| 863 | 863 | |
| 864 | 864 | /** |
@@ -868,22 +868,22 @@ discard block |
||
| 868 | 868 | * |
| 869 | 869 | * @return array |
| 870 | 870 | */ |
| 871 | -function lsx_wc_product_widget_template( $located, $template_name ) { |
|
| 872 | - if ( 'content-widget-product.php' === $template_name || 'content-widget-review.php' === $template_name ) { |
|
| 871 | +function lsx_wc_product_widget_template($located, $template_name) { |
|
| 872 | + if ('content-widget-product.php' === $template_name || 'content-widget-review.php' === $template_name) { |
|
| 873 | 873 | |
| 874 | 874 | $new_location = get_stylesheet_directory() . '/partials/' . $template_name; |
| 875 | - if ( file_exists( $new_location ) ) { |
|
| 875 | + if (file_exists($new_location)) { |
|
| 876 | 876 | $located = $new_location; |
| 877 | 877 | } else { |
| 878 | 878 | $new_location = get_parent_theme_file_path() . '/partials/' . $template_name; |
| 879 | - if ( file_exists( $new_location ) ) { |
|
| 879 | + if (file_exists($new_location)) { |
|
| 880 | 880 | $located = $new_location; |
| 881 | 881 | } |
| 882 | 882 | } |
| 883 | 883 | } |
| 884 | 884 | return $located; |
| 885 | 885 | } |
| 886 | -add_filter( 'wc_get_template', 'lsx_wc_product_widget_template',90 ,2 ); |
|
| 886 | +add_filter('wc_get_template', 'lsx_wc_product_widget_template', 90, 2); |
|
| 887 | 887 | /* |
| 888 | 888 | |
| 889 | 889 | */ |