@@ -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,30 +161,30 @@ 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">' . |
|
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 | 186 | /* Translators: %s: items quantity */ |
187 | - '<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> <span class="lsx-wc-cart-count-badge">' . wp_kses_data( WC()->cart->get_cart_contents_count() ) . '</span>' . |
|
187 | + '<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> <span class="lsx-wc-cart-count-badge">' . wp_kses_data(WC()->cart->get_cart_contents_count()) . '</span>' . |
|
188 | 188 | '</a>' . |
189 | 189 | '<ul role="menu" class=" dropdown-menu lsx-wc-cart-sub-menu">' . |
190 | 190 | '<li>' . |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | '</ul>' . |
194 | 194 | '</li>'; |
195 | 195 | |
196 | - if ( 'top-menu' === $args->theme_location ) { |
|
196 | + if ('top-menu' === $args->theme_location) { |
|
197 | 197 | $items = $item . $items; |
198 | 198 | } else { |
199 | 199 | $items = $items . $item; |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | return $items; |
205 | 205 | } |
206 | 206 | |
207 | - add_filter( 'wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2 ); |
|
207 | + add_filter('wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2); |
|
208 | 208 | |
209 | 209 | endif; |
210 | 210 | |
211 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_before' ) ) : |
|
211 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_before')) : |
|
212 | 212 | |
213 | 213 | /** |
214 | 214 | * Change WC products widget wrapper (before). |
@@ -216,16 +216,16 @@ discard block |
||
216 | 216 | * @package lsx |
217 | 217 | * @subpackage woocommerce |
218 | 218 | */ |
219 | - function lsx_wc_products_widget_wrapper_before( $html ) { |
|
219 | + function lsx_wc_products_widget_wrapper_before($html) { |
|
220 | 220 | $html = '<div class="lsx-woocommerce-slider lsx-woocommerce-shortcode">'; |
221 | 221 | return $html; |
222 | 222 | } |
223 | 223 | |
224 | - add_filter( 'woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15 ); |
|
224 | + add_filter('woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15); |
|
225 | 225 | |
226 | 226 | endif; |
227 | 227 | |
228 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_after' ) ) : |
|
228 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_after')) : |
|
229 | 229 | |
230 | 230 | /** |
231 | 231 | * Change WC products widget wrapper (after). |
@@ -233,16 +233,16 @@ discard block |
||
233 | 233 | * @package lsx |
234 | 234 | * @subpackage woocommerce |
235 | 235 | */ |
236 | - function lsx_wc_products_widget_wrapper_after( $html ) { |
|
236 | + function lsx_wc_products_widget_wrapper_after($html) { |
|
237 | 237 | $html = '</div>'; |
238 | 238 | return $html; |
239 | 239 | } |
240 | 240 | |
241 | - add_filter( 'woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15 ); |
|
241 | + add_filter('woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15); |
|
242 | 242 | |
243 | 243 | endif; |
244 | 244 | |
245 | -if ( ! function_exists( 'lsx_wc_reviews_widget_override' ) ) : |
|
245 | +if ( ! function_exists('lsx_wc_reviews_widget_override')) : |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Override WC ewviews widget. |
@@ -251,18 +251,18 @@ discard block |
||
251 | 251 | * @subpackage woocommerce |
252 | 252 | */ |
253 | 253 | function lsx_wc_reviews_widget_override() { |
254 | - if ( class_exists( 'WC_Widget_Recent_Reviews' ) ) { |
|
255 | - unregister_widget( 'WC_Widget_Recent_Reviews' ); |
|
254 | + if (class_exists('WC_Widget_Recent_Reviews')) { |
|
255 | + unregister_widget('WC_Widget_Recent_Reviews'); |
|
256 | 256 | require get_template_directory() . '/includes/classes/class-lsx-wc-widget-recent-reviews.php'; |
257 | - register_widget( 'LSX_WC_Widget_Recent_Reviews' ); |
|
257 | + register_widget('LSX_WC_Widget_Recent_Reviews'); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - add_action( 'widgets_init', 'lsx_wc_reviews_widget_override', 15 ); |
|
261 | + add_action('widgets_init', 'lsx_wc_reviews_widget_override', 15); |
|
262 | 262 | |
263 | 263 | endif; |
264 | 264 | |
265 | -if ( ! function_exists( 'lsx_wc_change_price_html' ) ) : |
|
265 | +if ( ! function_exists('lsx_wc_change_price_html')) : |
|
266 | 266 | |
267 | 267 | /** |
268 | 268 | * Change WC ZERO price to "free". |
@@ -270,28 +270,28 @@ discard block |
||
270 | 270 | * @package lsx |
271 | 271 | * @subpackage woocommerce |
272 | 272 | */ |
273 | - function lsx_wc_change_price_html( $price, $product ) { |
|
274 | - if ( empty( $product->get_price() ) ) { |
|
275 | - if ( $product->is_on_sale() && $product->get_regular_price() ) { |
|
276 | - $regular_price = wc_get_price_to_display( $product, array( |
|
273 | + function lsx_wc_change_price_html($price, $product) { |
|
274 | + if (empty($product->get_price())) { |
|
275 | + if ($product->is_on_sale() && $product->get_regular_price()) { |
|
276 | + $regular_price = wc_get_price_to_display($product, array( |
|
277 | 277 | 'qty' => 1, |
278 | 278 | 'price' => $product->get_regular_price(), |
279 | - ) ); |
|
279 | + )); |
|
280 | 280 | |
281 | - $price = wc_format_price_range( $regular_price, esc_html__( 'Free!', 'lsx' ) ); |
|
281 | + $price = wc_format_price_range($regular_price, esc_html__('Free!', 'lsx')); |
|
282 | 282 | } else { |
283 | - $price = '<span class="amount">' . esc_html__( 'Free!', 'lsx' ) . '</span>'; |
|
283 | + $price = '<span class="amount">' . esc_html__('Free!', 'lsx') . '</span>'; |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | |
287 | 287 | return $price; |
288 | 288 | } |
289 | 289 | |
290 | - add_filter( 'woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2 ); |
|
290 | + add_filter('woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2); |
|
291 | 291 | |
292 | 292 | endif; |
293 | 293 | |
294 | -if ( ! function_exists( 'lsx_wc_cart_link_fragment' ) ) : |
|
294 | +if ( ! function_exists('lsx_wc_cart_link_fragment')) : |
|
295 | 295 | |
296 | 296 | /** |
297 | 297 | * Cart Fragments. |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @package lsx |
301 | 301 | * @subpackage woocommerce |
302 | 302 | */ |
303 | - function lsx_wc_cart_link_fragment( $fragments ) { |
|
303 | + function lsx_wc_cart_link_fragment($fragments) { |
|
304 | 304 | global $woocommerce; |
305 | 305 | |
306 | 306 | ob_start(); |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | lsx_wc_items_counter(); |
312 | 312 | $items_counter = ob_get_clean(); |
313 | 313 | |
314 | - if ( ! empty( $items_counter ) ) { |
|
315 | - $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'] ); |
|
314 | + if ( ! empty($items_counter)) { |
|
315 | + $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 | 316 | } |
317 | 317 | |
318 | 318 | return $fragments; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | endif; |
322 | 322 | |
323 | -if ( ! function_exists( 'lsx_wc_cart_link' ) ) : |
|
323 | +if ( ! function_exists('lsx_wc_cart_link')) : |
|
324 | 324 | |
325 | 325 | /** |
326 | 326 | * Cart Link. |
@@ -331,16 +331,16 @@ discard block |
||
331 | 331 | */ |
332 | 332 | function lsx_wc_cart_link() { |
333 | 333 | ?> |
334 | - <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"> |
|
334 | + <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"> |
|
335 | 335 | <?php /* Translators: %s: items quantity */ ?> |
336 | - <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> <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data( WC()->cart->get_cart_contents_count() );?></span> |
|
336 | + <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> <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data(WC()->cart->get_cart_contents_count()); ?></span> |
|
337 | 337 | </a> |
338 | 338 | <?php |
339 | 339 | } |
340 | 340 | |
341 | 341 | endif; |
342 | 342 | |
343 | -if ( ! function_exists( 'lsx_wc_items_counter' ) ) : |
|
343 | +if ( ! function_exists('lsx_wc_items_counter')) : |
|
344 | 344 | |
345 | 345 | /** |
346 | 346 | * Add car item hidden items counter. |
@@ -352,21 +352,21 @@ discard block |
||
352 | 352 | $count = (int) WC()->cart->get_cart_contents_count(); |
353 | 353 | $items_counter = ''; |
354 | 354 | |
355 | - if ( ! empty( $count ) ) { |
|
355 | + if ( ! empty($count)) { |
|
356 | 356 | $count -= 3; |
357 | 357 | |
358 | - if ( 1 === $count ) { |
|
359 | - $items_counter = esc_html__( '1 other item in cart', 'lsx' ); |
|
360 | - } elseif ( $count > 1 ) { |
|
358 | + if (1 === $count) { |
|
359 | + $items_counter = esc_html__('1 other item in cart', 'lsx'); |
|
360 | + } elseif ($count > 1) { |
|
361 | 361 | /* Translators: %s: items counter */ |
362 | - $items_counter = sprintf( esc_html__( '%s other items in cart', 'lsx' ), $count ); |
|
362 | + $items_counter = sprintf(esc_html__('%s other items in cart', 'lsx'), $count); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | |
366 | - if ( ! empty( $items_counter ) ) : |
|
366 | + if ( ! empty($items_counter)) : |
|
367 | 367 | ?> |
368 | 368 | <li class="woocommerce-mini-cart-item mini_cart_item" style="display: block;"> |
369 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>"><?php echo esc_html( $items_counter ); ?></a> |
|
369 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>"><?php echo esc_html($items_counter); ?></a> |
|
370 | 370 | </li> |
371 | 371 | <?php |
372 | 372 | endif; |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | |
375 | 375 | endif; |
376 | 376 | |
377 | -if ( ! function_exists( 'lsx_wc_loop_shop_per_page' ) ) : |
|
377 | +if ( ! function_exists('lsx_wc_loop_shop_per_page')) : |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Changes the number of products to display on shop. |
@@ -382,16 +382,16 @@ discard block |
||
382 | 382 | * @package lsx |
383 | 383 | * @subpackage woocommerce |
384 | 384 | */ |
385 | - function lsx_wc_loop_shop_per_page( $items ) { |
|
385 | + function lsx_wc_loop_shop_per_page($items) { |
|
386 | 386 | $items = 20; |
387 | 387 | return $items; |
388 | 388 | } |
389 | 389 | |
390 | - add_filter( 'loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20 ); |
|
390 | + add_filter('loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20); |
|
391 | 391 | |
392 | 392 | endif; |
393 | 393 | |
394 | -if ( ! function_exists( 'lsx_wc_add_to_cart_message_html' ) ) : |
|
394 | +if ( ! function_exists('lsx_wc_add_to_cart_message_html')) : |
|
395 | 395 | |
396 | 396 | /** |
397 | 397 | * Changes the "added to cart" message HTML. |
@@ -399,39 +399,39 @@ discard block |
||
399 | 399 | * @package lsx |
400 | 400 | * @subpackage woocommerce |
401 | 401 | */ |
402 | - function lsx_wc_add_to_cart_message_html( $message, $products ) { |
|
402 | + function lsx_wc_add_to_cart_message_html($message, $products) { |
|
403 | 403 | $message = '<div class="woocommerce-message-added-to-cart">' . $message . '</div>'; |
404 | 404 | return $message; |
405 | 405 | } |
406 | 406 | |
407 | - add_filter( 'wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2 ); |
|
407 | + add_filter('wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2); |
|
408 | 408 | |
409 | 409 | endif; |
410 | 410 | |
411 | -if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.3', '>=' ) ) { |
|
412 | - add_filter( 'woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
411 | +if (defined('WC_VERSION') && version_compare(WC_VERSION, '2.3', '>=')) { |
|
412 | + add_filter('woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
413 | 413 | } else { |
414 | - add_filter( 'add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
414 | + add_filter('add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
415 | 415 | } |
416 | 416 | |
417 | -remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); |
|
417 | +remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 10); |
|
418 | 418 | |
419 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
420 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
421 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 ); |
|
422 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 ); |
|
423 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
419 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
420 | +add_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
421 | +add_action('woocommerce_after_shop_loop', 'woocommerce_result_count', 20); |
|
422 | +add_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 30); |
|
423 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
424 | 424 | |
425 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
426 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); |
|
425 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
426 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30); |
|
427 | 427 | |
428 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
429 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
430 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
431 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 ); |
|
432 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
428 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
429 | +add_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
430 | +add_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
431 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30); |
|
432 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
433 | 433 | |
434 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper' ) ) : |
|
434 | +if ( ! function_exists('lsx_wc_sorting_wrapper')) : |
|
435 | 435 | |
436 | 436 | /** |
437 | 437 | * Sorting wrapper. |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | |
446 | 446 | endif; |
447 | 447 | |
448 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper_close' ) ) : |
|
448 | +if ( ! function_exists('lsx_wc_sorting_wrapper_close')) : |
|
449 | 449 | |
450 | 450 | /** |
451 | 451 | * Sorting wrapper close. |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | |
460 | 460 | endif; |
461 | 461 | |
462 | -if ( ! function_exists( 'lsx_wc_product_columns_wrapper_close' ) ) : |
|
462 | +if ( ! function_exists('lsx_wc_product_columns_wrapper_close')) : |
|
463 | 463 | |
464 | 464 | /** |
465 | 465 | * Product columns wrapper close. |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | |
474 | 474 | endif; |
475 | 475 | |
476 | -if ( ! function_exists( 'lsx_wc_woocommerce_pagination' ) ) : |
|
476 | +if ( ! function_exists('lsx_wc_woocommerce_pagination')) : |
|
477 | 477 | |
478 | 478 | /** |
479 | 479 | * LSX WooCommerce Pagination |
@@ -485,14 +485,14 @@ discard block |
||
485 | 485 | * @subpackage woocommerce |
486 | 486 | */ |
487 | 487 | function lsx_wc_woocommerce_pagination() { |
488 | - if ( woocommerce_products_will_display() ) { |
|
488 | + if (woocommerce_products_will_display()) { |
|
489 | 489 | woocommerce_pagination(); |
490 | 490 | } |
491 | 491 | } |
492 | 492 | |
493 | 493 | endif; |
494 | 494 | |
495 | -if ( ! function_exists( 'lsx_customizer_wc_controls' ) ) : |
|
495 | +if ( ! function_exists('lsx_customizer_wc_controls')) : |
|
496 | 496 | |
497 | 497 | /** |
498 | 498 | * Returns an array of the core panel. |
@@ -502,16 +502,16 @@ discard block |
||
502 | 502 | * |
503 | 503 | * @return $lsx_controls array() |
504 | 504 | */ |
505 | - function lsx_customizer_wc_controls( $lsx_controls ) { |
|
505 | + function lsx_customizer_wc_controls($lsx_controls) { |
|
506 | 506 | $lsx_controls['panels']['lsx-wc'] = array( |
507 | - 'title' => esc_html__( 'WooCommerce', 'lsx' ), |
|
508 | - 'description' => esc_html__( 'Change the WooCommerce settings.', 'lsx' ), |
|
507 | + 'title' => esc_html__('WooCommerce', 'lsx'), |
|
508 | + 'description' => esc_html__('Change the WooCommerce settings.', 'lsx'), |
|
509 | 509 | 'priority' => 23, |
510 | 510 | ); |
511 | 511 | |
512 | 512 | $lsx_controls['sections']['lsx-wc-global'] = array( |
513 | - 'title' => esc_html__( 'Global', 'lsx' ), |
|
514 | - 'description' => esc_html__( 'Change the WooCommerce global settings.', 'lsx' ), |
|
513 | + 'title' => esc_html__('Global', 'lsx'), |
|
514 | + 'description' => esc_html__('Change the WooCommerce global settings.', 'lsx'), |
|
515 | 515 | 'panel' => 'lsx-wc', |
516 | 516 | 'priority' => 1, |
517 | 517 | ); |
@@ -522,8 +522,8 @@ discard block |
||
522 | 522 | ); |
523 | 523 | |
524 | 524 | $lsx_controls['fields']['lsx_wc_mobile_footer_bar_status'] = array( |
525 | - 'label' => esc_html__( 'Footer Bar', 'lsx' ), |
|
526 | - 'description' => esc_html__( 'Enable the mobile footer bar.', 'lsx' ), |
|
525 | + 'label' => esc_html__('Footer Bar', 'lsx'), |
|
526 | + 'description' => esc_html__('Enable the mobile footer bar.', 'lsx'), |
|
527 | 527 | 'section' => 'lsx-wc-global', |
528 | 528 | 'type' => 'checkbox', |
529 | 529 | 'priority' => 1, |
@@ -534,9 +534,9 @@ discard block |
||
534 | 534 | |
535 | 535 | endif; |
536 | 536 | |
537 | -add_filter( 'lsx_customizer_controls', 'lsx_customizer_wc_controls' ); |
|
537 | +add_filter('lsx_customizer_controls', 'lsx_customizer_wc_controls'); |
|
538 | 538 | |
539 | -if ( ! function_exists( 'lsx_wc_footer_bar' ) ) : |
|
539 | +if ( ! function_exists('lsx_wc_footer_bar')) : |
|
540 | 540 | |
541 | 541 | /** |
542 | 542 | * Display WC footer bar. |
@@ -545,46 +545,46 @@ discard block |
||
545 | 545 | * @subpackage woocommerce |
546 | 546 | */ |
547 | 547 | function lsx_wc_footer_bar() { |
548 | - if ( ! empty( get_theme_mod( 'lsx_wc_mobile_footer_bar_status', '1' ) ) ) : |
|
548 | + if ( ! empty(get_theme_mod('lsx_wc_mobile_footer_bar_status', '1'))) : |
|
549 | 549 | ?> |
550 | 550 | <div class="lsx-wc-footer-bar"> |
551 | - <form role="search" method="get" action="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-form"> |
|
551 | + <form role="search" method="get" action="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-form"> |
|
552 | 552 | <fieldset> |
553 | - <legend class="screen-reader-text"><?php esc_html_e( 'Search products', 'lsx' ); ?></legend> |
|
554 | - <input type="search" name="s" placeholder="<?php esc_attr_e( 'Search products…', 'lsx' ); ?>" class="form-control"> |
|
553 | + <legend class="screen-reader-text"><?php esc_html_e('Search products', 'lsx'); ?></legend> |
|
554 | + <input type="search" name="s" placeholder="<?php esc_attr_e('Search products…', 'lsx'); ?>" class="form-control"> |
|
555 | 555 | </fieldset> |
556 | 556 | </form> |
557 | 557 | |
558 | 558 | <ul class="lsx-wc-footer-bar-items"> |
559 | 559 | <li class="lsx-wc-footer-bar-item"> |
560 | - <a href="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
560 | + <a href="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
561 | 561 | <i class="fa fa-home" aria-hidden="true"></i> |
562 | - <span><?php esc_html_e( 'Home', 'lsx' ); ?></span> |
|
562 | + <span><?php esc_html_e('Home', 'lsx'); ?></span> |
|
563 | 563 | </a> |
564 | 564 | </li> |
565 | 565 | |
566 | 566 | <li class="lsx-wc-footer-bar-item"> |
567 | - <a href="<?php echo esc_url( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); ?>" class="lsx-wc-footer-bar-link"> |
|
567 | + <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" class="lsx-wc-footer-bar-link"> |
|
568 | 568 | <i class="fa fa-user" aria-hidden="true"></i> |
569 | - <span><?php esc_html_e( 'Account', 'lsx' ); ?></span> |
|
569 | + <span><?php esc_html_e('Account', 'lsx'); ?></span> |
|
570 | 570 | </a> |
571 | 571 | </li> |
572 | 572 | |
573 | 573 | <li class="lsx-wc-footer-bar-item"> |
574 | 574 | <a href="#" class="lsx-wc-footer-bar-link lsx-wc-footer-bar-link-toogle"> |
575 | 575 | <i class="fa fa-search" aria-hidden="true"></i> |
576 | - <span><?php esc_html_e( 'Search', 'lsx' ); ?></span> |
|
576 | + <span><?php esc_html_e('Search', 'lsx'); ?></span> |
|
577 | 577 | </a> |
578 | 578 | </li> |
579 | 579 | |
580 | 580 | <li class="lsx-wc-footer-bar-item"> |
581 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
581 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
582 | 582 | <i class="fa fa-shopping-basket" aria-hidden="true"></i> |
583 | 583 | <?php $count = WC()->cart->get_cart_contents_count(); ?> |
584 | - <?php if ( ! empty( $count ) ) : ?> |
|
585 | - <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data( $count ); ?></span> |
|
584 | + <?php if ( ! empty($count)) : ?> |
|
585 | + <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data($count); ?></span> |
|
586 | 586 | <?php endif; ?> |
587 | - <span><?php esc_html_e( 'Cart', 'lsx' ); ?></span> |
|
587 | + <span><?php esc_html_e('Cart', 'lsx'); ?></span> |
|
588 | 588 | </a> |
589 | 589 | </li> |
590 | 590 | </ul> |
@@ -593,6 +593,6 @@ discard block |
||
593 | 593 | endif; |
594 | 594 | } |
595 | 595 | |
596 | - add_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
596 | + add_action('lsx_body_bottom', 'lsx_wc_footer_bar', 15); |
|
597 | 597 | |
598 | 598 | endif; |