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