@@ -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,32 +161,32 @@ 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 | $item_class = 'current-menu-item'; |
177 | 177 | } else { |
178 | 178 | $item_class = ''; |
179 | 179 | } |
180 | 180 | |
181 | 181 | $item_class = 'menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown lsx-wc-cart-menu-item ' . $class; |
182 | - $item_class = apply_filters( 'lsx_wc_cart_menu_item_class', $item_class ); |
|
182 | + $item_class = apply_filters('lsx_wc_cart_menu_item_class', $item_class); |
|
183 | 183 | |
184 | 184 | $item = '<li class="' . $item_class . '">' . |
185 | - '<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">' . |
|
186 | - '<span class="lsx-wc-cart-amount">' . wp_kses_data( WC()->cart->get_cart_subtotal() ) . '</span>' . |
|
185 | + '<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">' . |
|
186 | + '<span class="lsx-wc-cart-amount">' . wp_kses_data(WC()->cart->get_cart_subtotal()) . '</span>' . |
|
187 | 187 | /* Translators: %s: items quantity */ |
188 | - '<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>' . |
|
189 | - ( ! empty( WC()->cart->get_cart_contents_count() ) ? '<span class="lsx-wc-cart-count-badge">' . wp_kses_data( WC()->cart->get_cart_contents_count() ) . '</span>' : '' ) . |
|
188 | + '<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>' . |
|
189 | + ( ! empty(WC()->cart->get_cart_contents_count()) ? '<span class="lsx-wc-cart-count-badge">' . wp_kses_data(WC()->cart->get_cart_contents_count()) . '</span>' : '') . |
|
190 | 190 | '</a>' . |
191 | 191 | '<ul role="menu" class=" dropdown-menu lsx-wc-cart-sub-menu">' . |
192 | 192 | '<li>' . |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | '</ul>' . |
196 | 196 | '</li>'; |
197 | 197 | |
198 | - if ( 'top-menu' === $args->theme_location ) { |
|
198 | + if ('top-menu' === $args->theme_location) { |
|
199 | 199 | $items = $item . $items; |
200 | 200 | } else { |
201 | 201 | $items = $items . $item; |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | return $items; |
207 | 207 | } |
208 | 208 | |
209 | - add_filter( 'wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2 ); |
|
209 | + add_filter('wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2); |
|
210 | 210 | |
211 | 211 | endif; |
212 | 212 | |
213 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_before' ) ) : |
|
213 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_before')) : |
|
214 | 214 | |
215 | 215 | /** |
216 | 216 | * Change WC products widget wrapper (before). |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | * @package lsx |
219 | 219 | * @subpackage woocommerce |
220 | 220 | */ |
221 | - function lsx_wc_products_widget_wrapper_before( $html ) { |
|
221 | + function lsx_wc_products_widget_wrapper_before($html) { |
|
222 | 222 | $html = '<div class="lsx-woocommerce-slider lsx-woocommerce-shortcode">'; |
223 | 223 | return $html; |
224 | 224 | } |
225 | 225 | |
226 | - add_filter( 'woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15 ); |
|
226 | + add_filter('woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15); |
|
227 | 227 | |
228 | 228 | endif; |
229 | 229 | |
230 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_after' ) ) : |
|
230 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_after')) : |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Change WC products widget wrapper (after). |
@@ -235,16 +235,16 @@ discard block |
||
235 | 235 | * @package lsx |
236 | 236 | * @subpackage woocommerce |
237 | 237 | */ |
238 | - function lsx_wc_products_widget_wrapper_after( $html ) { |
|
238 | + function lsx_wc_products_widget_wrapper_after($html) { |
|
239 | 239 | $html = '</div>'; |
240 | 240 | return $html; |
241 | 241 | } |
242 | 242 | |
243 | - add_filter( 'woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15 ); |
|
243 | + add_filter('woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15); |
|
244 | 244 | |
245 | 245 | endif; |
246 | 246 | |
247 | -if ( ! function_exists( 'lsx_wc_reviews_widget_override' ) ) : |
|
247 | +if ( ! function_exists('lsx_wc_reviews_widget_override')) : |
|
248 | 248 | |
249 | 249 | /** |
250 | 250 | * Override WC ewviews widget. |
@@ -253,18 +253,18 @@ discard block |
||
253 | 253 | * @subpackage woocommerce |
254 | 254 | */ |
255 | 255 | function lsx_wc_reviews_widget_override() { |
256 | - if ( class_exists( 'WC_Widget_Recent_Reviews' ) ) { |
|
257 | - unregister_widget( 'WC_Widget_Recent_Reviews' ); |
|
256 | + if (class_exists('WC_Widget_Recent_Reviews')) { |
|
257 | + unregister_widget('WC_Widget_Recent_Reviews'); |
|
258 | 258 | require get_template_directory() . '/includes/classes/class-lsx-wc-widget-recent-reviews.php'; |
259 | - register_widget( 'LSX_WC_Widget_Recent_Reviews' ); |
|
259 | + register_widget('LSX_WC_Widget_Recent_Reviews'); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | - add_action( 'widgets_init', 'lsx_wc_reviews_widget_override', 15 ); |
|
263 | + add_action('widgets_init', 'lsx_wc_reviews_widget_override', 15); |
|
264 | 264 | |
265 | 265 | endif; |
266 | 266 | |
267 | -if ( ! function_exists( 'lsx_wc_change_price_html' ) ) : |
|
267 | +if ( ! function_exists('lsx_wc_change_price_html')) : |
|
268 | 268 | |
269 | 269 | /** |
270 | 270 | * Change WC ZERO price to "free". |
@@ -272,28 +272,28 @@ discard block |
||
272 | 272 | * @package lsx |
273 | 273 | * @subpackage woocommerce |
274 | 274 | */ |
275 | - function lsx_wc_change_price_html( $price, $product ) { |
|
276 | - if ( empty( $product->get_price() ) ) { |
|
277 | - if ( $product->is_on_sale() && $product->get_regular_price() ) { |
|
278 | - $regular_price = wc_get_price_to_display( $product, array( |
|
275 | + function lsx_wc_change_price_html($price, $product) { |
|
276 | + if (empty($product->get_price())) { |
|
277 | + if ($product->is_on_sale() && $product->get_regular_price()) { |
|
278 | + $regular_price = wc_get_price_to_display($product, array( |
|
279 | 279 | 'qty' => 1, |
280 | 280 | 'price' => $product->get_regular_price(), |
281 | - ) ); |
|
281 | + )); |
|
282 | 282 | |
283 | - $price = wc_format_price_range( $regular_price, esc_html__( 'Free!', 'lsx' ) ); |
|
283 | + $price = wc_format_price_range($regular_price, esc_html__('Free!', 'lsx')); |
|
284 | 284 | } else { |
285 | - $price = '<span class="amount">' . esc_html__( 'Free!', 'lsx' ) . '</span>'; |
|
285 | + $price = '<span class="amount">' . esc_html__('Free!', 'lsx') . '</span>'; |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
289 | 289 | return $price; |
290 | 290 | } |
291 | 291 | |
292 | - add_filter( 'woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2 ); |
|
292 | + add_filter('woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2); |
|
293 | 293 | |
294 | 294 | endif; |
295 | 295 | |
296 | -if ( ! function_exists( 'lsx_wc_cart_link_fragment' ) ) : |
|
296 | +if ( ! function_exists('lsx_wc_cart_link_fragment')) : |
|
297 | 297 | |
298 | 298 | /** |
299 | 299 | * Cart Fragments. |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * @package lsx |
303 | 303 | * @subpackage woocommerce |
304 | 304 | */ |
305 | - function lsx_wc_cart_link_fragment( $fragments ) { |
|
305 | + function lsx_wc_cart_link_fragment($fragments) { |
|
306 | 306 | global $woocommerce; |
307 | 307 | |
308 | 308 | ob_start(); |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | lsx_wc_items_counter(); |
314 | 314 | $items_counter = ob_get_clean(); |
315 | 315 | |
316 | - if ( ! empty( $items_counter ) ) { |
|
317 | - $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'] ); |
|
316 | + if ( ! empty($items_counter)) { |
|
317 | + $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']); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | return $fragments; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | |
323 | 323 | endif; |
324 | 324 | |
325 | -if ( ! function_exists( 'lsx_wc_cart_link' ) ) : |
|
325 | +if ( ! function_exists('lsx_wc_cart_link')) : |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * Cart Link. |
@@ -333,14 +333,14 @@ discard block |
||
333 | 333 | */ |
334 | 334 | function lsx_wc_cart_link() { |
335 | 335 | ?> |
336 | - <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"> |
|
337 | - <span class="lsx-wc-cart-amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> |
|
336 | + <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"> |
|
337 | + <span class="lsx-wc-cart-amount"><?php echo wp_kses_data(WC()->cart->get_cart_subtotal()); ?></span> |
|
338 | 338 | |
339 | 339 | <?php /* Translators: %s: items quantity */ ?> |
340 | - <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> |
|
340 | + <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> |
|
341 | 341 | |
342 | - <?php if ( ! empty( WC()->cart->get_cart_contents_count() ) ) : ?> |
|
343 | - <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data( WC()->cart->get_cart_contents_count() );?></span> |
|
342 | + <?php if ( ! empty(WC()->cart->get_cart_contents_count())) : ?> |
|
343 | + <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data(WC()->cart->get_cart_contents_count()); ?></span> |
|
344 | 344 | <?php endif; ?> |
345 | 345 | </a> |
346 | 346 | <?php |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | |
349 | 349 | endif; |
350 | 350 | |
351 | -if ( ! function_exists( 'lsx_wc_items_counter' ) ) : |
|
351 | +if ( ! function_exists('lsx_wc_items_counter')) : |
|
352 | 352 | |
353 | 353 | /** |
354 | 354 | * Add car item hidden items counter. |
@@ -360,21 +360,21 @@ discard block |
||
360 | 360 | $count = (int) WC()->cart->get_cart_contents_count(); |
361 | 361 | $items_counter = ''; |
362 | 362 | |
363 | - if ( ! empty( $count ) ) { |
|
363 | + if ( ! empty($count)) { |
|
364 | 364 | $count -= 3; |
365 | 365 | |
366 | - if ( 1 === $count ) { |
|
367 | - $items_counter = esc_html__( '1 other item in cart', 'lsx' ); |
|
368 | - } elseif ( $count > 1 ) { |
|
366 | + if (1 === $count) { |
|
367 | + $items_counter = esc_html__('1 other item in cart', 'lsx'); |
|
368 | + } elseif ($count > 1) { |
|
369 | 369 | /* Translators: %s: items counter */ |
370 | - $items_counter = sprintf( esc_html__( '%s other items in cart', 'lsx' ), $count ); |
|
370 | + $items_counter = sprintf(esc_html__('%s other items in cart', 'lsx'), $count); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | - if ( ! empty( $items_counter ) ) : |
|
374 | + if ( ! empty($items_counter)) : |
|
375 | 375 | ?> |
376 | 376 | <li class="woocommerce-mini-cart-item mini_cart_item" style="display: block;"> |
377 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>"><?php echo esc_html( $items_counter ); ?></a> |
|
377 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>"><?php echo esc_html($items_counter); ?></a> |
|
378 | 378 | </li> |
379 | 379 | <?php |
380 | 380 | endif; |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | endif; |
384 | 384 | |
385 | -if ( ! function_exists( 'lsx_wc_loop_shop_per_page' ) ) : |
|
385 | +if ( ! function_exists('lsx_wc_loop_shop_per_page')) : |
|
386 | 386 | |
387 | 387 | /** |
388 | 388 | * Changes the number of products to display on shop. |
@@ -390,16 +390,16 @@ discard block |
||
390 | 390 | * @package lsx |
391 | 391 | * @subpackage woocommerce |
392 | 392 | */ |
393 | - function lsx_wc_loop_shop_per_page( $items ) { |
|
393 | + function lsx_wc_loop_shop_per_page($items) { |
|
394 | 394 | $items = 20; |
395 | 395 | return $items; |
396 | 396 | } |
397 | 397 | |
398 | - add_filter( 'loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20 ); |
|
398 | + add_filter('loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20); |
|
399 | 399 | |
400 | 400 | endif; |
401 | 401 | |
402 | -if ( ! function_exists( 'lsx_wc_add_to_cart_message_html' ) ) : |
|
402 | +if ( ! function_exists('lsx_wc_add_to_cart_message_html')) : |
|
403 | 403 | |
404 | 404 | /** |
405 | 405 | * Changes the "added to cart" message HTML. |
@@ -407,39 +407,39 @@ discard block |
||
407 | 407 | * @package lsx |
408 | 408 | * @subpackage woocommerce |
409 | 409 | */ |
410 | - function lsx_wc_add_to_cart_message_html( $message, $products ) { |
|
410 | + function lsx_wc_add_to_cart_message_html($message, $products) { |
|
411 | 411 | $message = '<div class="woocommerce-message-added-to-cart">' . $message . '</div>'; |
412 | 412 | return $message; |
413 | 413 | } |
414 | 414 | |
415 | - add_filter( 'wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2 ); |
|
415 | + add_filter('wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2); |
|
416 | 416 | |
417 | 417 | endif; |
418 | 418 | |
419 | -if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.3', '>=' ) ) { |
|
420 | - add_filter( 'woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
419 | +if (defined('WC_VERSION') && version_compare(WC_VERSION, '2.3', '>=')) { |
|
420 | + add_filter('woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
421 | 421 | } else { |
422 | - add_filter( 'add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
422 | + add_filter('add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
423 | 423 | } |
424 | 424 | |
425 | -remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); |
|
425 | +remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 10); |
|
426 | 426 | |
427 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
428 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
429 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 ); |
|
430 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 ); |
|
431 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
427 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
428 | +add_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
429 | +add_action('woocommerce_after_shop_loop', 'woocommerce_result_count', 20); |
|
430 | +add_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 30); |
|
431 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
432 | 432 | |
433 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
434 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); |
|
433 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
434 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30); |
|
435 | 435 | |
436 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
437 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
438 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
439 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 ); |
|
440 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
436 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
437 | +add_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
438 | +add_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
439 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30); |
|
440 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
441 | 441 | |
442 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper' ) ) : |
|
442 | +if ( ! function_exists('lsx_wc_sorting_wrapper')) : |
|
443 | 443 | |
444 | 444 | /** |
445 | 445 | * Sorting wrapper. |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | |
454 | 454 | endif; |
455 | 455 | |
456 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper_close' ) ) : |
|
456 | +if ( ! function_exists('lsx_wc_sorting_wrapper_close')) : |
|
457 | 457 | |
458 | 458 | /** |
459 | 459 | * Sorting wrapper close. |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | |
468 | 468 | endif; |
469 | 469 | |
470 | -if ( ! function_exists( 'lsx_wc_product_columns_wrapper_close' ) ) : |
|
470 | +if ( ! function_exists('lsx_wc_product_columns_wrapper_close')) : |
|
471 | 471 | |
472 | 472 | /** |
473 | 473 | * Product columns wrapper close. |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | |
482 | 482 | endif; |
483 | 483 | |
484 | -if ( ! function_exists( 'lsx_wc_woocommerce_pagination' ) ) : |
|
484 | +if ( ! function_exists('lsx_wc_woocommerce_pagination')) : |
|
485 | 485 | |
486 | 486 | /** |
487 | 487 | * LSX WooCommerce Pagination |
@@ -493,14 +493,14 @@ discard block |
||
493 | 493 | * @subpackage woocommerce |
494 | 494 | */ |
495 | 495 | function lsx_wc_woocommerce_pagination() { |
496 | - if ( woocommerce_products_will_display() ) { |
|
496 | + if (woocommerce_products_will_display()) { |
|
497 | 497 | woocommerce_pagination(); |
498 | 498 | } |
499 | 499 | } |
500 | 500 | |
501 | 501 | endif; |
502 | 502 | |
503 | -if ( ! function_exists( 'lsx_customizer_wc_controls' ) ) : |
|
503 | +if ( ! function_exists('lsx_customizer_wc_controls')) : |
|
504 | 504 | |
505 | 505 | /** |
506 | 506 | * Returns an array of the core panel. |
@@ -510,16 +510,16 @@ discard block |
||
510 | 510 | * |
511 | 511 | * @return $lsx_controls array() |
512 | 512 | */ |
513 | - function lsx_customizer_wc_controls( $lsx_controls ) { |
|
513 | + function lsx_customizer_wc_controls($lsx_controls) { |
|
514 | 514 | $lsx_controls['panels']['lsx-wc'] = array( |
515 | - 'title' => esc_html__( 'WooCommerce', 'lsx' ), |
|
516 | - 'description' => esc_html__( 'Change the WooCommerce settings.', 'lsx' ), |
|
515 | + 'title' => esc_html__('WooCommerce', 'lsx'), |
|
516 | + 'description' => esc_html__('Change the WooCommerce settings.', 'lsx'), |
|
517 | 517 | 'priority' => 23, |
518 | 518 | ); |
519 | 519 | |
520 | 520 | $lsx_controls['sections']['lsx-wc-global'] = array( |
521 | - 'title' => esc_html__( 'Global', 'lsx' ), |
|
522 | - 'description' => esc_html__( 'Change the WooCommerce global settings.', 'lsx' ), |
|
521 | + 'title' => esc_html__('Global', 'lsx'), |
|
522 | + 'description' => esc_html__('Change the WooCommerce global settings.', 'lsx'), |
|
523 | 523 | 'panel' => 'lsx-wc', |
524 | 524 | 'priority' => 1, |
525 | 525 | ); |
@@ -530,8 +530,8 @@ discard block |
||
530 | 530 | ); |
531 | 531 | |
532 | 532 | $lsx_controls['fields']['lsx_wc_mobile_footer_bar_status'] = array( |
533 | - 'label' => esc_html__( 'Footer Bar', 'lsx' ), |
|
534 | - 'description' => esc_html__( 'Enable the mobile footer bar.', 'lsx' ), |
|
533 | + 'label' => esc_html__('Footer Bar', 'lsx'), |
|
534 | + 'description' => esc_html__('Enable the mobile footer bar.', 'lsx'), |
|
535 | 535 | 'section' => 'lsx-wc-global', |
536 | 536 | 'type' => 'checkbox', |
537 | 537 | 'priority' => 1, |
@@ -542,9 +542,9 @@ discard block |
||
542 | 542 | |
543 | 543 | endif; |
544 | 544 | |
545 | -add_filter( 'lsx_customizer_controls', 'lsx_customizer_wc_controls' ); |
|
545 | +add_filter('lsx_customizer_controls', 'lsx_customizer_wc_controls'); |
|
546 | 546 | |
547 | -if ( ! function_exists( 'lsx_wc_footer_bar' ) ) : |
|
547 | +if ( ! function_exists('lsx_wc_footer_bar')) : |
|
548 | 548 | |
549 | 549 | /** |
550 | 550 | * Display WC footer bar. |
@@ -553,46 +553,46 @@ discard block |
||
553 | 553 | * @subpackage woocommerce |
554 | 554 | */ |
555 | 555 | function lsx_wc_footer_bar() { |
556 | - if ( ! empty( get_theme_mod( 'lsx_wc_mobile_footer_bar_status', '1' ) ) ) : |
|
556 | + if ( ! empty(get_theme_mod('lsx_wc_mobile_footer_bar_status', '1'))) : |
|
557 | 557 | ?> |
558 | 558 | <div class="lsx-wc-footer-bar"> |
559 | - <form role="search" method="get" action="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-form"> |
|
559 | + <form role="search" method="get" action="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-form"> |
|
560 | 560 | <fieldset> |
561 | - <legend class="screen-reader-text"><?php esc_html_e( 'Search products', 'lsx' ); ?></legend> |
|
562 | - <input type="search" name="s" placeholder="<?php esc_attr_e( 'Search products…', 'lsx' ); ?>" class="form-control"> |
|
561 | + <legend class="screen-reader-text"><?php esc_html_e('Search products', 'lsx'); ?></legend> |
|
562 | + <input type="search" name="s" placeholder="<?php esc_attr_e('Search products…', 'lsx'); ?>" class="form-control"> |
|
563 | 563 | </fieldset> |
564 | 564 | </form> |
565 | 565 | |
566 | 566 | <ul class="lsx-wc-footer-bar-items"> |
567 | 567 | <li class="lsx-wc-footer-bar-item"> |
568 | - <a href="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
568 | + <a href="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
569 | 569 | <i class="fa fa-home" aria-hidden="true"></i> |
570 | - <span><?php esc_html_e( 'Home', 'lsx' ); ?></span> |
|
570 | + <span><?php esc_html_e('Home', 'lsx'); ?></span> |
|
571 | 571 | </a> |
572 | 572 | </li> |
573 | 573 | |
574 | 574 | <li class="lsx-wc-footer-bar-item"> |
575 | - <a href="<?php echo esc_url( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); ?>" class="lsx-wc-footer-bar-link"> |
|
575 | + <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" class="lsx-wc-footer-bar-link"> |
|
576 | 576 | <i class="fa fa-user" aria-hidden="true"></i> |
577 | - <span><?php esc_html_e( 'Account', 'lsx' ); ?></span> |
|
577 | + <span><?php esc_html_e('Account', 'lsx'); ?></span> |
|
578 | 578 | </a> |
579 | 579 | </li> |
580 | 580 | |
581 | 581 | <li class="lsx-wc-footer-bar-item"> |
582 | 582 | <a href="#" class="lsx-wc-footer-bar-link lsx-wc-footer-bar-link-toogle"> |
583 | 583 | <i class="fa fa-search" aria-hidden="true"></i> |
584 | - <span><?php esc_html_e( 'Search', 'lsx' ); ?></span> |
|
584 | + <span><?php esc_html_e('Search', 'lsx'); ?></span> |
|
585 | 585 | </a> |
586 | 586 | </li> |
587 | 587 | |
588 | 588 | <li class="lsx-wc-footer-bar-item"> |
589 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
589 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
590 | 590 | <i class="fa fa-shopping-basket" aria-hidden="true"></i> |
591 | 591 | <?php $count = WC()->cart->get_cart_contents_count(); ?> |
592 | - <?php if ( ! empty( $count ) ) : ?> |
|
593 | - <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data( $count ); ?></span> |
|
592 | + <?php if ( ! empty($count)) : ?> |
|
593 | + <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data($count); ?></span> |
|
594 | 594 | <?php endif; ?> |
595 | - <span><?php esc_html_e( 'Cart', 'lsx' ); ?></span> |
|
595 | + <span><?php esc_html_e('Cart', 'lsx'); ?></span> |
|
596 | 596 | </a> |
597 | 597 | </li> |
598 | 598 | </ul> |
@@ -601,6 +601,6 @@ discard block |
||
601 | 601 | endif; |
602 | 602 | } |
603 | 603 | |
604 | - add_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
604 | + add_action('lsx_body_bottom', 'lsx_wc_footer_bar', 15); |
|
605 | 605 | |
606 | 606 | endif; |