@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | * @subpackage layout |
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,14 +19,14 @@ discard block |
||
19 | 19 | * @subpackage woocommerce |
20 | 20 | */ |
21 | 21 | function lsx_wc_support() { |
22 | - add_theme_support( 'woocommerce' ); |
|
22 | + add_theme_support('woocommerce'); |
|
23 | 23 | } |
24 | 24 | |
25 | - add_action( 'after_setup_theme', 'lsx_wc_support' ); |
|
25 | + add_action('after_setup_theme', 'lsx_wc_support'); |
|
26 | 26 | |
27 | 27 | endif; |
28 | 28 | |
29 | -if ( ! function_exists( 'lsx_wc_scripts_add_styles' ) ) : |
|
29 | +if ( ! function_exists('lsx_wc_scripts_add_styles')) : |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * WooCommerce enqueue styles. |
@@ -35,25 +35,25 @@ discard block |
||
35 | 35 | * @subpackage woocommerce |
36 | 36 | */ |
37 | 37 | function lsx_wc_scripts_add_styles() { |
38 | - wp_enqueue_style( 'woocommerce-lsx', get_template_directory_uri() . '/assets/css/woocommerce.css', array( 'lsx_main' ), LSX_VERSION ); |
|
39 | - wp_style_add_data( 'woocommerce-lsx', 'rtl', 'replace' ); |
|
38 | + wp_enqueue_style('woocommerce-lsx', get_template_directory_uri() . '/assets/css/woocommerce.css', array('lsx_main'), LSX_VERSION); |
|
39 | + wp_style_add_data('woocommerce-lsx', 'rtl', 'replace'); |
|
40 | 40 | |
41 | 41 | // Remove select2 added by WooCommerce |
42 | 42 | |
43 | - if ( ! is_admin() ) { |
|
44 | - wp_dequeue_style( 'select2' ); |
|
45 | - wp_deregister_style( 'select2' ); |
|
43 | + if ( ! is_admin()) { |
|
44 | + wp_dequeue_style('select2'); |
|
45 | + wp_deregister_style('select2'); |
|
46 | 46 | |
47 | - wp_dequeue_script( 'select2' ); |
|
47 | + wp_dequeue_script('select2'); |
|
48 | 48 | //wp_deregister_script( 'select2' ); |
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | - add_action( 'wp_enqueue_scripts', 'lsx_wc_scripts_add_styles' ); |
|
52 | + add_action('wp_enqueue_scripts', 'lsx_wc_scripts_add_styles'); |
|
53 | 53 | |
54 | 54 | endif; |
55 | 55 | |
56 | -if ( ! function_exists( 'lsx_wc_form_field_args' ) ) : |
|
56 | +if ( ! function_exists('lsx_wc_form_field_args')) : |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * WooCommerce form fields. |
@@ -61,17 +61,17 @@ discard block |
||
61 | 61 | * @package lsx |
62 | 62 | * @subpackage woocommerce |
63 | 63 | */ |
64 | - function lsx_wc_form_field_args( $args, $key, $value ) { |
|
64 | + function lsx_wc_form_field_args($args, $key, $value) { |
|
65 | 65 | $args['input_class'][] = 'form-control'; |
66 | 66 | |
67 | 67 | return $args; |
68 | 68 | } |
69 | 69 | |
70 | - add_action( 'woocommerce_form_field_args', 'lsx_wc_form_field_args', 10, 3 ); |
|
70 | + add_action('woocommerce_form_field_args', 'lsx_wc_form_field_args', 10, 3); |
|
71 | 71 | |
72 | 72 | endif; |
73 | 73 | |
74 | -if ( ! function_exists( 'lsx_wc_theme_wrapper_start' ) ) : |
|
74 | +if ( ! function_exists('lsx_wc_theme_wrapper_start')) : |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * WooCommerce wrapper start. |
@@ -81,18 +81,18 @@ discard block |
||
81 | 81 | */ |
82 | 82 | function lsx_wc_theme_wrapper_start() { |
83 | 83 | lsx_content_wrap_before(); |
84 | - echo '<div id="primary" class="content-area ' . esc_attr( lsx_main_class() ) . '">'; |
|
84 | + echo '<div id="primary" class="content-area ' . esc_attr(lsx_main_class()) . '">'; |
|
85 | 85 | lsx_content_before(); |
86 | 86 | echo '<main id="main" class="site-main" role="main">'; |
87 | 87 | lsx_content_top(); |
88 | 88 | } |
89 | 89 | |
90 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); |
|
91 | - add_action( 'woocommerce_before_main_content', 'lsx_wc_theme_wrapper_start' ); |
|
90 | + remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); |
|
91 | + add_action('woocommerce_before_main_content', 'lsx_wc_theme_wrapper_start'); |
|
92 | 92 | |
93 | 93 | endif; |
94 | 94 | |
95 | -if ( ! function_exists( 'lsx_wc_theme_wrapper_end' ) ) : |
|
95 | +if ( ! function_exists('lsx_wc_theme_wrapper_end')) : |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * WooCommerce wrapper end. |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | lsx_content_wrap_after(); |
109 | 109 | } |
110 | 110 | |
111 | - remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); |
|
112 | - add_action( 'woocommerce_after_main_content', 'lsx_wc_theme_wrapper_end' ); |
|
111 | + remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); |
|
112 | + add_action('woocommerce_after_main_content', 'lsx_wc_theme_wrapper_end'); |
|
113 | 113 | |
114 | 114 | endif; |
115 | 115 | |
116 | -if ( ! function_exists( 'lsx_wc_disable_lsx_banner_plugin' ) ) : |
|
116 | +if ( ! function_exists('lsx_wc_disable_lsx_banner_plugin')) : |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Disable LSX Banners plugin in some WC pages. |
@@ -121,19 +121,19 @@ discard block |
||
121 | 121 | * @package lsx |
122 | 122 | * @subpackage woocommerce |
123 | 123 | */ |
124 | - function lsx_wc_disable_lsx_banner_plugin( $disabled ) { |
|
125 | - if ( is_cart() || is_checkout() || is_account_page() ) { |
|
124 | + function lsx_wc_disable_lsx_banner_plugin($disabled) { |
|
125 | + if (is_cart() || is_checkout() || is_account_page()) { |
|
126 | 126 | $disabled = true; |
127 | 127 | } |
128 | 128 | |
129 | 129 | return $disabled; |
130 | 130 | } |
131 | 131 | |
132 | - add_filter( 'lsx_banner_plugin_disable', 'lsx_wc_disable_lsx_banner_plugin' ); |
|
132 | + add_filter('lsx_banner_plugin_disable', 'lsx_wc_disable_lsx_banner_plugin'); |
|
133 | 133 | |
134 | 134 | endif; |
135 | 135 | |
136 | -if ( ! function_exists( 'lsx_wc_disable_lsx_banner' ) ) : |
|
136 | +if ( ! function_exists('lsx_wc_disable_lsx_banner')) : |
|
137 | 137 | |
138 | 138 | /** |
139 | 139 | * Disable LSX Banners banner in some WC pages. |
@@ -141,19 +141,19 @@ discard block |
||
141 | 141 | * @package lsx |
142 | 142 | * @subpackage woocommerce |
143 | 143 | */ |
144 | - function lsx_wc_disable_lsx_banner( $disabled ) { |
|
145 | - if ( is_shop() || is_product_category() || is_product_tag() || is_product() ) { |
|
144 | + function lsx_wc_disable_lsx_banner($disabled) { |
|
145 | + if (is_shop() || is_product_category() || is_product_tag() || is_product()) { |
|
146 | 146 | $disabled = true; |
147 | 147 | } |
148 | 148 | |
149 | 149 | return $disabled; |
150 | 150 | } |
151 | 151 | |
152 | - add_filter( 'lsx_banner_disable', 'lsx_wc_disable_lsx_banner' ); |
|
152 | + add_filter('lsx_banner_disable', 'lsx_wc_disable_lsx_banner'); |
|
153 | 153 | |
154 | 154 | endif; |
155 | 155 | |
156 | -if ( ! function_exists( 'lsx_wc_add_cart' ) ) : |
|
156 | +if ( ! function_exists('lsx_wc_add_cart')) : |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Adds WC cart to the header. |
@@ -161,27 +161,27 @@ discard block |
||
161 | 161 | * @package lsx |
162 | 162 | * @subpackage template-tags |
163 | 163 | */ |
164 | - function lsx_wc_add_cart( $items, $args ) { |
|
165 | - $cart_menu_item_position = apply_filters( 'lsx_wc_cart_menu_item_position', 'primary' ); |
|
164 | + function lsx_wc_add_cart($items, $args) { |
|
165 | + $cart_menu_item_position = apply_filters('lsx_wc_cart_menu_item_position', 'primary'); |
|
166 | 166 | |
167 | - if ( $cart_menu_item_position === $args->theme_location ) { |
|
168 | - $customizer_option = get_theme_mod( 'lsx_header_wc_cart', false ); |
|
167 | + if ($cart_menu_item_position === $args->theme_location) { |
|
168 | + $customizer_option = get_theme_mod('lsx_header_wc_cart', false); |
|
169 | 169 | |
170 | - if ( ! empty( $customizer_option ) ) { |
|
170 | + if ( ! empty($customizer_option)) { |
|
171 | 171 | ob_start(); |
172 | - the_widget( 'WC_Widget_Cart', 'title=' ); |
|
172 | + the_widget('WC_Widget_Cart', 'title='); |
|
173 | 173 | $widget = ob_get_clean(); |
174 | 174 | |
175 | - if ( is_cart() ) { |
|
175 | + if (is_cart()) { |
|
176 | 176 | $class = 'current-menu-item'; |
177 | 177 | } else { |
178 | 178 | $class = ''; |
179 | 179 | } |
180 | 180 | |
181 | - $item = '<li class="' . apply_filters( 'lsx_wc_cart_menu_item_class', 'menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown lsx-wc-cart-menu-item ' . $class ) . '">' . |
|
182 | - '<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">' . |
|
181 | + $item = '<li class="' . apply_filters('lsx_wc_cart_menu_item_class', 'menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown lsx-wc-cart-menu-item ' . $class) . '">' . |
|
182 | + '<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">' . |
|
183 | 183 | /* Translators: %s: items quantity */ |
184 | - '<span class="lsx-wc-cart-amount">' . wp_kses_data( WC()->cart->get_cart_subtotal() ) . '</span> <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>' . |
|
184 | + '<span class="lsx-wc-cart-amount">' . wp_kses_data(WC()->cart->get_cart_subtotal()) . '</span> <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>' . |
|
185 | 185 | '</a>' . |
186 | 186 | '<ul role="menu" class=" dropdown-menu lsx-wc-cart-sub-menu">' . |
187 | 187 | '<li>' . |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | '</ul>' . |
191 | 191 | '</li>'; |
192 | 192 | |
193 | - if ( 'top-menu' === $args->theme_location ) { |
|
193 | + if ('top-menu' === $args->theme_location) { |
|
194 | 194 | $items = $item . $items; |
195 | 195 | } else { |
196 | 196 | $items = $items . $item; |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | return $items; |
202 | 202 | } |
203 | 203 | |
204 | - add_filter( 'wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2 ); |
|
204 | + add_filter('wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2); |
|
205 | 205 | |
206 | 206 | endif; |
207 | 207 | |
208 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_before' ) ) : |
|
208 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_before')) : |
|
209 | 209 | |
210 | 210 | /** |
211 | 211 | * Change WC products widget wrapper (before). |
@@ -213,16 +213,16 @@ discard block |
||
213 | 213 | * @package lsx |
214 | 214 | * @subpackage woocommerce |
215 | 215 | */ |
216 | - function lsx_wc_products_widget_wrapper_before( $html ) { |
|
216 | + function lsx_wc_products_widget_wrapper_before($html) { |
|
217 | 217 | $html = '<div class="lsx-woocommerce-slider lsx-woocommerce-shortcode">'; |
218 | 218 | return $html; |
219 | 219 | } |
220 | 220 | |
221 | - add_filter( 'woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15 ); |
|
221 | + add_filter('woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15); |
|
222 | 222 | |
223 | 223 | endif; |
224 | 224 | |
225 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_after' ) ) : |
|
225 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_after')) : |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * Change WC products widget wrapper (after). |
@@ -230,16 +230,16 @@ discard block |
||
230 | 230 | * @package lsx |
231 | 231 | * @subpackage woocommerce |
232 | 232 | */ |
233 | - function lsx_wc_products_widget_wrapper_after( $html ) { |
|
233 | + function lsx_wc_products_widget_wrapper_after($html) { |
|
234 | 234 | $html = '</div>'; |
235 | 235 | return $html; |
236 | 236 | } |
237 | 237 | |
238 | - add_filter( 'woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15 ); |
|
238 | + add_filter('woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15); |
|
239 | 239 | |
240 | 240 | endif; |
241 | 241 | |
242 | -if ( ! function_exists( 'lsx_wc_reviews_widget_override' ) ) : |
|
242 | +if ( ! function_exists('lsx_wc_reviews_widget_override')) : |
|
243 | 243 | |
244 | 244 | /** |
245 | 245 | * Override WC ewviews widget. |
@@ -248,18 +248,18 @@ discard block |
||
248 | 248 | * @subpackage woocommerce |
249 | 249 | */ |
250 | 250 | function lsx_wc_reviews_widget_override() { |
251 | - if ( class_exists( 'WC_Widget_Recent_Reviews' ) ) { |
|
252 | - unregister_widget( 'WC_Widget_Recent_Reviews' ); |
|
251 | + if (class_exists('WC_Widget_Recent_Reviews')) { |
|
252 | + unregister_widget('WC_Widget_Recent_Reviews'); |
|
253 | 253 | require get_template_directory() . '/includes/classes/class-lsx-wc-widget-recent-reviews.php'; |
254 | - register_widget( 'LSX_WC_Widget_Recent_Reviews' ); |
|
254 | + register_widget('LSX_WC_Widget_Recent_Reviews'); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | - add_action( 'widgets_init', 'lsx_wc_reviews_widget_override', 15 ); |
|
258 | + add_action('widgets_init', 'lsx_wc_reviews_widget_override', 15); |
|
259 | 259 | |
260 | 260 | endif; |
261 | 261 | |
262 | -if ( ! function_exists( 'lsx_wc_change_price_html' ) ) : |
|
262 | +if ( ! function_exists('lsx_wc_change_price_html')) : |
|
263 | 263 | |
264 | 264 | /** |
265 | 265 | * Change WC ZERO price to "free". |
@@ -267,28 +267,28 @@ discard block |
||
267 | 267 | * @package lsx |
268 | 268 | * @subpackage woocommerce |
269 | 269 | */ |
270 | - function lsx_wc_change_price_html( $price, $product ) { |
|
271 | - if ( empty( $product->get_price() ) ) { |
|
272 | - if ( $product->is_on_sale() && $product->get_regular_price() ) { |
|
273 | - $regular_price = wc_get_price_to_display( $product, array( |
|
270 | + function lsx_wc_change_price_html($price, $product) { |
|
271 | + if (empty($product->get_price())) { |
|
272 | + if ($product->is_on_sale() && $product->get_regular_price()) { |
|
273 | + $regular_price = wc_get_price_to_display($product, array( |
|
274 | 274 | 'qty' => 1, |
275 | 275 | 'price' => $product->get_regular_price(), |
276 | - ) ); |
|
276 | + )); |
|
277 | 277 | |
278 | - $price = wc_format_price_range( $regular_price, esc_html__( 'Free!', 'lsx' ) ); |
|
278 | + $price = wc_format_price_range($regular_price, esc_html__('Free!', 'lsx')); |
|
279 | 279 | } else { |
280 | - $price = '<span class="amount">' . esc_html__( 'Free!', 'lsx' ) . '</span>'; |
|
280 | + $price = '<span class="amount">' . esc_html__('Free!', 'lsx') . '</span>'; |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
284 | 284 | return $price; |
285 | 285 | } |
286 | 286 | |
287 | - add_filter( 'woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2 ); |
|
287 | + add_filter('woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2); |
|
288 | 288 | |
289 | 289 | endif; |
290 | 290 | |
291 | -if ( ! function_exists( 'lsx_wc_cart_link_fragment' ) ) : |
|
291 | +if ( ! function_exists('lsx_wc_cart_link_fragment')) : |
|
292 | 292 | |
293 | 293 | /** |
294 | 294 | * Cart Fragments. |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @package lsx |
298 | 298 | * @subpackage woocommerce |
299 | 299 | */ |
300 | - function lsx_wc_cart_link_fragment( $fragments ) { |
|
300 | + function lsx_wc_cart_link_fragment($fragments) { |
|
301 | 301 | global $woocommerce; |
302 | 302 | |
303 | 303 | ob_start(); |
@@ -308,8 +308,8 @@ discard block |
||
308 | 308 | lsx_wc_items_counter(); |
309 | 309 | $items_counter = ob_get_clean(); |
310 | 310 | |
311 | - if ( ! empty( $items_counter ) ) { |
|
312 | - $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'] ); |
|
311 | + if ( ! empty($items_counter)) { |
|
312 | + $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']); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | return $fragments; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | endif; |
319 | 319 | |
320 | -if ( ! function_exists( 'lsx_wc_cart_link' ) ) : |
|
320 | +if ( ! function_exists('lsx_wc_cart_link')) : |
|
321 | 321 | |
322 | 322 | /** |
323 | 323 | * Cart Link. |
@@ -328,16 +328,16 @@ discard block |
||
328 | 328 | */ |
329 | 329 | function lsx_wc_cart_link() { |
330 | 330 | ?> |
331 | - <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"> |
|
331 | + <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"> |
|
332 | 332 | <?php /* Translators: %s: items quantity */ ?> |
333 | - <span class="lsx-wc-cart-amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> <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> |
|
333 | + <span class="lsx-wc-cart-amount"><?php echo wp_kses_data(WC()->cart->get_cart_subtotal()); ?></span> <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> |
|
334 | 334 | </a> |
335 | 335 | <?php |
336 | 336 | } |
337 | 337 | |
338 | 338 | endif; |
339 | 339 | |
340 | -if ( ! function_exists( 'lsx_wc_items_counter' ) ) : |
|
340 | +if ( ! function_exists('lsx_wc_items_counter')) : |
|
341 | 341 | |
342 | 342 | /** |
343 | 343 | * Add car item hidden items counter. |
@@ -349,21 +349,21 @@ discard block |
||
349 | 349 | $count = (int) WC()->cart->get_cart_contents_count(); |
350 | 350 | $items_counter = ''; |
351 | 351 | |
352 | - if ( ! empty( $count ) ) { |
|
352 | + if ( ! empty($count)) { |
|
353 | 353 | $count -= 3; |
354 | 354 | |
355 | - if ( 1 === $count ) { |
|
356 | - $items_counter = esc_html__( '1 other item in cart', 'lsx' ); |
|
357 | - } elseif ( $count > 1 ) { |
|
355 | + if (1 === $count) { |
|
356 | + $items_counter = esc_html__('1 other item in cart', 'lsx'); |
|
357 | + } elseif ($count > 1) { |
|
358 | 358 | /* Translators: %s: items counter */ |
359 | - $items_counter = sprintf( esc_html__( '%s other items in cart', 'lsx' ), $count ); |
|
359 | + $items_counter = sprintf(esc_html__('%s other items in cart', 'lsx'), $count); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
363 | - if ( ! empty( $items_counter ) ) : |
|
363 | + if ( ! empty($items_counter)) : |
|
364 | 364 | ?> |
365 | 365 | <li class="woocommerce-mini-cart-item mini_cart_item" style="display: block;"> |
366 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>"><?php echo esc_html( $items_counter ); ?></a> |
|
366 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>"><?php echo esc_html($items_counter); ?></a> |
|
367 | 367 | </li> |
368 | 368 | <?php |
369 | 369 | endif; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | |
372 | 372 | endif; |
373 | 373 | |
374 | -if ( ! function_exists( 'lsx_wc_loop_shop_per_page' ) ) : |
|
374 | +if ( ! function_exists('lsx_wc_loop_shop_per_page')) : |
|
375 | 375 | |
376 | 376 | /** |
377 | 377 | * Changes the number of products to display on shop. |
@@ -379,16 +379,16 @@ discard block |
||
379 | 379 | * @package lsx |
380 | 380 | * @subpackage woocommerce |
381 | 381 | */ |
382 | - function lsx_wc_loop_shop_per_page( $items ) { |
|
382 | + function lsx_wc_loop_shop_per_page($items) { |
|
383 | 383 | $items = 20; |
384 | 384 | return $items; |
385 | 385 | } |
386 | 386 | |
387 | - add_filter( 'loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20 ); |
|
387 | + add_filter('loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20); |
|
388 | 388 | |
389 | 389 | endif; |
390 | 390 | |
391 | -if ( ! function_exists( 'lsx_wc_add_to_cart_message_html' ) ) : |
|
391 | +if ( ! function_exists('lsx_wc_add_to_cart_message_html')) : |
|
392 | 392 | |
393 | 393 | /** |
394 | 394 | * Changes the "added to cart" message HTML. |
@@ -396,39 +396,39 @@ discard block |
||
396 | 396 | * @package lsx |
397 | 397 | * @subpackage woocommerce |
398 | 398 | */ |
399 | - function lsx_wc_add_to_cart_message_html( $message, $products ) { |
|
399 | + function lsx_wc_add_to_cart_message_html($message, $products) { |
|
400 | 400 | $message = '<div class="woocommerce-message-added-to-cart">' . $message . '</div>'; |
401 | 401 | return $message; |
402 | 402 | } |
403 | 403 | |
404 | - add_filter( 'wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2 ); |
|
404 | + add_filter('wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2); |
|
405 | 405 | |
406 | 406 | endif; |
407 | 407 | |
408 | -if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.3', '>=' ) ) { |
|
409 | - add_filter( 'woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
408 | +if (defined('WC_VERSION') && version_compare(WC_VERSION, '2.3', '>=')) { |
|
409 | + add_filter('woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
410 | 410 | } else { |
411 | - add_filter( 'add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
411 | + add_filter('add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
412 | 412 | } |
413 | 413 | |
414 | -remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); |
|
414 | +remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 10); |
|
415 | 415 | |
416 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
417 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
418 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 ); |
|
419 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 ); |
|
420 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
416 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
417 | +add_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
418 | +add_action('woocommerce_after_shop_loop', 'woocommerce_result_count', 20); |
|
419 | +add_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 30); |
|
420 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
421 | 421 | |
422 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
423 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); |
|
422 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
423 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30); |
|
424 | 424 | |
425 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
426 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
427 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
428 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 ); |
|
429 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
425 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
426 | +add_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
427 | +add_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
428 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30); |
|
429 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
430 | 430 | |
431 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper' ) ) : |
|
431 | +if ( ! function_exists('lsx_wc_sorting_wrapper')) : |
|
432 | 432 | |
433 | 433 | /** |
434 | 434 | * Sorting wrapper. |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | |
443 | 443 | endif; |
444 | 444 | |
445 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper_close' ) ) : |
|
445 | +if ( ! function_exists('lsx_wc_sorting_wrapper_close')) : |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Sorting wrapper close. |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | |
457 | 457 | endif; |
458 | 458 | |
459 | -if ( ! function_exists( 'lsx_wc_product_columns_wrapper_close' ) ) : |
|
459 | +if ( ! function_exists('lsx_wc_product_columns_wrapper_close')) : |
|
460 | 460 | |
461 | 461 | /** |
462 | 462 | * Product columns wrapper close. |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | endif; |
472 | 472 | |
473 | -if ( ! function_exists( 'lsx_wc_woocommerce_pagination' ) ) : |
|
473 | +if ( ! function_exists('lsx_wc_woocommerce_pagination')) : |
|
474 | 474 | |
475 | 475 | /** |
476 | 476 | * LSX WooCommerce Pagination |
@@ -482,14 +482,14 @@ discard block |
||
482 | 482 | * @subpackage woocommerce |
483 | 483 | */ |
484 | 484 | function lsx_wc_woocommerce_pagination() { |
485 | - if ( woocommerce_products_will_display() ) { |
|
485 | + if (woocommerce_products_will_display()) { |
|
486 | 486 | woocommerce_pagination(); |
487 | 487 | } |
488 | 488 | } |
489 | 489 | |
490 | 490 | endif; |
491 | 491 | |
492 | -if ( ! function_exists( 'lsx_customizer_wc_controls' ) ) : |
|
492 | +if ( ! function_exists('lsx_customizer_wc_controls')) : |
|
493 | 493 | |
494 | 494 | /** |
495 | 495 | * Returns an array of the core panel. |
@@ -499,16 +499,16 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @return $lsx_controls array() |
501 | 501 | */ |
502 | - function lsx_customizer_wc_controls( $lsx_controls ) { |
|
502 | + function lsx_customizer_wc_controls($lsx_controls) { |
|
503 | 503 | $lsx_controls['panels']['lsx-wc'] = array( |
504 | - 'title' => esc_html__( 'WooCommerce', 'lsx' ), |
|
505 | - 'description' => esc_html__( 'Change the WooCommerce settings.', 'lsx' ), |
|
504 | + 'title' => esc_html__('WooCommerce', 'lsx'), |
|
505 | + 'description' => esc_html__('Change the WooCommerce settings.', 'lsx'), |
|
506 | 506 | 'priority' => 23, |
507 | 507 | ); |
508 | 508 | |
509 | 509 | $lsx_controls['sections']['lsx-wc-global'] = array( |
510 | - 'title' => esc_html__( 'Global', 'lsx' ), |
|
511 | - 'description' => esc_html__( 'Change the WooCommerce global settings.', 'lsx' ), |
|
510 | + 'title' => esc_html__('Global', 'lsx'), |
|
511 | + 'description' => esc_html__('Change the WooCommerce global settings.', 'lsx'), |
|
512 | 512 | 'panel' => 'lsx-wc', |
513 | 513 | 'priority' => 1, |
514 | 514 | ); |
@@ -519,8 +519,8 @@ discard block |
||
519 | 519 | ); |
520 | 520 | |
521 | 521 | $lsx_controls['fields']['lsx_wc_mobile_footer_bar_status'] = array( |
522 | - 'label' => esc_html__( 'Footer Bar', 'lsx' ), |
|
523 | - 'description' => esc_html__( 'Enable the mobile footer bar.', 'lsx' ), |
|
522 | + 'label' => esc_html__('Footer Bar', 'lsx'), |
|
523 | + 'description' => esc_html__('Enable the mobile footer bar.', 'lsx'), |
|
524 | 524 | 'section' => 'lsx-wc-global', |
525 | 525 | 'type' => 'checkbox', |
526 | 526 | 'priority' => 1, |
@@ -531,9 +531,9 @@ discard block |
||
531 | 531 | |
532 | 532 | endif; |
533 | 533 | |
534 | -add_filter( 'lsx_customizer_controls', 'lsx_customizer_wc_controls' ); |
|
534 | +add_filter('lsx_customizer_controls', 'lsx_customizer_wc_controls'); |
|
535 | 535 | |
536 | -if ( ! function_exists( 'lsx_wc_footer_bar' ) ) : |
|
536 | +if ( ! function_exists('lsx_wc_footer_bar')) : |
|
537 | 537 | |
538 | 538 | /** |
539 | 539 | * Display WC footer bar. |
@@ -542,46 +542,46 @@ discard block |
||
542 | 542 | * @subpackage woocommerce |
543 | 543 | */ |
544 | 544 | function lsx_wc_footer_bar() { |
545 | - if ( ! empty( get_theme_mod( 'lsx_wc_mobile_footer_bar_status', '1' ) ) ) : |
|
545 | + if ( ! empty(get_theme_mod('lsx_wc_mobile_footer_bar_status', '1'))) : |
|
546 | 546 | ?> |
547 | 547 | <div class="lsx-wc-footer-bar"> |
548 | - <form role="search" method="get" action="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-form"> |
|
548 | + <form role="search" method="get" action="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-form"> |
|
549 | 549 | <fieldset> |
550 | - <legend class="screen-reader-text"><?php esc_html_e( 'Search products', 'lsx' ); ?></legend> |
|
551 | - <input type="search" name="s" placeholder="<?php esc_attr_e( 'Search products…', 'lsx' ); ?>" class="form-control"> |
|
550 | + <legend class="screen-reader-text"><?php esc_html_e('Search products', 'lsx'); ?></legend> |
|
551 | + <input type="search" name="s" placeholder="<?php esc_attr_e('Search products…', 'lsx'); ?>" class="form-control"> |
|
552 | 552 | </fieldset> |
553 | 553 | </form> |
554 | 554 | |
555 | 555 | <ul class="lsx-wc-footer-bar-items"> |
556 | 556 | <li class="lsx-wc-footer-bar-item"> |
557 | - <a href="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
557 | + <a href="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
558 | 558 | <i class="fa fa-home" aria-hidden="true"></i> |
559 | - <span><?php esc_html_e( 'Home', 'lsx' ); ?></span> |
|
559 | + <span><?php esc_html_e('Home', 'lsx'); ?></span> |
|
560 | 560 | </a> |
561 | 561 | </li> |
562 | 562 | |
563 | 563 | <li class="lsx-wc-footer-bar-item"> |
564 | - <a href="<?php echo esc_url( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); ?>" class="lsx-wc-footer-bar-link"> |
|
564 | + <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" class="lsx-wc-footer-bar-link"> |
|
565 | 565 | <i class="fa fa-user" aria-hidden="true"></i> |
566 | - <span><?php esc_html_e( 'Account', 'lsx' ); ?></span> |
|
566 | + <span><?php esc_html_e('Account', 'lsx'); ?></span> |
|
567 | 567 | </a> |
568 | 568 | </li> |
569 | 569 | |
570 | 570 | <li class="lsx-wc-footer-bar-item"> |
571 | 571 | <a href="#" class="lsx-wc-footer-bar-link lsx-wc-footer-bar-link-toogle"> |
572 | 572 | <i class="fa fa-search" aria-hidden="true"></i> |
573 | - <span><?php esc_html_e( 'Search', 'lsx' ); ?></span> |
|
573 | + <span><?php esc_html_e('Search', 'lsx'); ?></span> |
|
574 | 574 | </a> |
575 | 575 | </li> |
576 | 576 | |
577 | 577 | <li class="lsx-wc-footer-bar-item"> |
578 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
578 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
579 | 579 | <i class="fa fa-shopping-basket" aria-hidden="true"></i> |
580 | 580 | <?php $count = WC()->cart->get_cart_contents_count(); ?> |
581 | - <?php if ( ! empty( $count ) ) : ?> |
|
582 | - <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data( $count ); ?></span> |
|
581 | + <?php if ( ! empty($count)) : ?> |
|
582 | + <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data($count); ?></span> |
|
583 | 583 | <?php endif; ?> |
584 | - <span><?php esc_html_e( 'Cart', 'lsx' ); ?></span> |
|
584 | + <span><?php esc_html_e('Cart', 'lsx'); ?></span> |
|
585 | 585 | </a> |
586 | 586 | </li> |
587 | 587 | </ul> |
@@ -590,6 +590,6 @@ discard block |
||
590 | 590 | endif; |
591 | 591 | } |
592 | 592 | |
593 | - add_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
593 | + add_action('lsx_body_bottom', 'lsx_wc_footer_bar', 15); |
|
594 | 594 | |
595 | 595 | endif; |