@@ -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,25 +121,25 @@ discard block |
||
121 | 121 | * @package lsx |
122 | 122 | * @subpackage woocommerce |
123 | 123 | */ |
124 | - function lsx_wc_disable_lsx_banner_plugin( $disabled ) { |
|
124 | + function lsx_wc_disable_lsx_banner_plugin($disabled) { |
|
125 | 125 | global $post; |
126 | 126 | |
127 | - if ( is_cart() || is_checkout() || is_account_page() ) { |
|
127 | + if (is_cart() || is_checkout() || is_account_page()) { |
|
128 | 128 | $disabled = true; |
129 | 129 | } |
130 | 130 | |
131 | - if ( $post && class_exists( 'WC_Wishlists_Pages' ) && WC_Wishlists_Pages::is_wishlist_page( $post->post_name ) ) { |
|
131 | + if ($post && class_exists('WC_Wishlists_Pages') && WC_Wishlists_Pages::is_wishlist_page($post->post_name)) { |
|
132 | 132 | $disabled = true; |
133 | 133 | } |
134 | 134 | |
135 | 135 | return $disabled; |
136 | 136 | } |
137 | 137 | |
138 | - add_filter( 'lsx_banner_plugin_disable', 'lsx_wc_disable_lsx_banner_plugin' ); |
|
138 | + add_filter('lsx_banner_plugin_disable', 'lsx_wc_disable_lsx_banner_plugin'); |
|
139 | 139 | |
140 | 140 | endif; |
141 | 141 | |
142 | -if ( ! function_exists( 'lsx_wc_disable_lsx_banner' ) ) : |
|
142 | +if ( ! function_exists('lsx_wc_disable_lsx_banner')) : |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Disable LSX Banners banner in some WC pages. |
@@ -147,19 +147,19 @@ discard block |
||
147 | 147 | * @package lsx |
148 | 148 | * @subpackage woocommerce |
149 | 149 | */ |
150 | - function lsx_wc_disable_lsx_banner( $disabled ) { |
|
151 | - if ( is_shop() || is_product_category() || is_product_tag() || is_product() ) { |
|
150 | + function lsx_wc_disable_lsx_banner($disabled) { |
|
151 | + if (is_shop() || is_product_category() || is_product_tag() || is_product()) { |
|
152 | 152 | $disabled = true; |
153 | 153 | } |
154 | 154 | |
155 | 155 | return $disabled; |
156 | 156 | } |
157 | 157 | |
158 | - add_filter( 'lsx_banner_disable', 'lsx_wc_disable_lsx_banner' ); |
|
158 | + add_filter('lsx_banner_disable', 'lsx_wc_disable_lsx_banner'); |
|
159 | 159 | |
160 | 160 | endif; |
161 | 161 | |
162 | -if ( ! function_exists( 'lsx_wc_add_cart' ) ) : |
|
162 | +if ( ! function_exists('lsx_wc_add_cart')) : |
|
163 | 163 | |
164 | 164 | /** |
165 | 165 | * Adds WC cart to the header. |
@@ -167,32 +167,32 @@ discard block |
||
167 | 167 | * @package lsx |
168 | 168 | * @subpackage template-tags |
169 | 169 | */ |
170 | - function lsx_wc_add_cart( $items, $args ) { |
|
171 | - $cart_menu_item_position = apply_filters( 'lsx_wc_cart_menu_item_position', 'primary' ); |
|
170 | + function lsx_wc_add_cart($items, $args) { |
|
171 | + $cart_menu_item_position = apply_filters('lsx_wc_cart_menu_item_position', 'primary'); |
|
172 | 172 | |
173 | - if ( $cart_menu_item_position === $args->theme_location ) { |
|
174 | - $customizer_option = get_theme_mod( 'lsx_header_wc_cart', false ); |
|
173 | + if ($cart_menu_item_position === $args->theme_location) { |
|
174 | + $customizer_option = get_theme_mod('lsx_header_wc_cart', false); |
|
175 | 175 | |
176 | - if ( ! empty( $customizer_option ) ) { |
|
176 | + if ( ! empty($customizer_option)) { |
|
177 | 177 | ob_start(); |
178 | - the_widget( 'WC_Widget_Cart', 'title=' ); |
|
178 | + the_widget('WC_Widget_Cart', 'title='); |
|
179 | 179 | $widget = ob_get_clean(); |
180 | 180 | |
181 | - if ( is_cart() ) { |
|
181 | + if (is_cart()) { |
|
182 | 182 | $item_class = 'current-menu-item'; |
183 | 183 | } else { |
184 | 184 | $item_class = ''; |
185 | 185 | } |
186 | 186 | |
187 | 187 | $item_class = 'menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown lsx-wc-cart-menu-item ' . $class; |
188 | - $item_class = apply_filters( 'lsx_wc_cart_menu_item_class', $item_class ); |
|
188 | + $item_class = apply_filters('lsx_wc_cart_menu_item_class', $item_class); |
|
189 | 189 | |
190 | 190 | $item = '<li class="' . $item_class . '">' . |
191 | - '<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">' . |
|
192 | - '<span class="lsx-wc-cart-amount">' . wp_kses_data( WC()->cart->get_cart_subtotal() ) . '</span>' . |
|
191 | + '<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">' . |
|
192 | + '<span class="lsx-wc-cart-amount">' . wp_kses_data(WC()->cart->get_cart_subtotal()) . '</span>' . |
|
193 | 193 | /* Translators: %s: items quantity */ |
194 | - '<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>' . |
|
195 | - ( ! empty( WC()->cart->get_cart_contents_count() ) ? '<span class="lsx-wc-cart-count-badge">' . wp_kses_data( WC()->cart->get_cart_contents_count() ) . '</span>' : '' ) . |
|
194 | + '<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>' . |
|
195 | + ( ! empty(WC()->cart->get_cart_contents_count()) ? '<span class="lsx-wc-cart-count-badge">' . wp_kses_data(WC()->cart->get_cart_contents_count()) . '</span>' : '') . |
|
196 | 196 | '</a>' . |
197 | 197 | '<ul role="menu" class=" dropdown-menu lsx-wc-cart-sub-menu">' . |
198 | 198 | '<li>' . |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | '</ul>' . |
202 | 202 | '</li>'; |
203 | 203 | |
204 | - if ( 'top-menu' === $args->theme_location ) { |
|
204 | + if ('top-menu' === $args->theme_location) { |
|
205 | 205 | $items = $item . $items; |
206 | 206 | } else { |
207 | 207 | $items = $items . $item; |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | return $items; |
213 | 213 | } |
214 | 214 | |
215 | - add_filter( 'wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2 ); |
|
215 | + add_filter('wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2); |
|
216 | 216 | |
217 | 217 | endif; |
218 | 218 | |
219 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_before' ) ) : |
|
219 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_before')) : |
|
220 | 220 | |
221 | 221 | /** |
222 | 222 | * Change WC products widget wrapper (before). |
@@ -224,16 +224,16 @@ discard block |
||
224 | 224 | * @package lsx |
225 | 225 | * @subpackage woocommerce |
226 | 226 | */ |
227 | - function lsx_wc_products_widget_wrapper_before( $html ) { |
|
227 | + function lsx_wc_products_widget_wrapper_before($html) { |
|
228 | 228 | $html = '<div class="lsx-woocommerce-slider lsx-woocommerce-shortcode">'; |
229 | 229 | return $html; |
230 | 230 | } |
231 | 231 | |
232 | - add_filter( 'woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15 ); |
|
232 | + add_filter('woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15); |
|
233 | 233 | |
234 | 234 | endif; |
235 | 235 | |
236 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_after' ) ) : |
|
236 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_after')) : |
|
237 | 237 | |
238 | 238 | /** |
239 | 239 | * Change WC products widget wrapper (after). |
@@ -241,16 +241,16 @@ discard block |
||
241 | 241 | * @package lsx |
242 | 242 | * @subpackage woocommerce |
243 | 243 | */ |
244 | - function lsx_wc_products_widget_wrapper_after( $html ) { |
|
244 | + function lsx_wc_products_widget_wrapper_after($html) { |
|
245 | 245 | $html = '</div>'; |
246 | 246 | return $html; |
247 | 247 | } |
248 | 248 | |
249 | - add_filter( 'woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15 ); |
|
249 | + add_filter('woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15); |
|
250 | 250 | |
251 | 251 | endif; |
252 | 252 | |
253 | -if ( ! function_exists( 'lsx_wc_reviews_widget_override' ) ) : |
|
253 | +if ( ! function_exists('lsx_wc_reviews_widget_override')) : |
|
254 | 254 | |
255 | 255 | /** |
256 | 256 | * Override WC ewviews widget. |
@@ -259,18 +259,18 @@ discard block |
||
259 | 259 | * @subpackage woocommerce |
260 | 260 | */ |
261 | 261 | function lsx_wc_reviews_widget_override() { |
262 | - if ( class_exists( 'WC_Widget_Recent_Reviews' ) ) { |
|
263 | - unregister_widget( 'WC_Widget_Recent_Reviews' ); |
|
262 | + if (class_exists('WC_Widget_Recent_Reviews')) { |
|
263 | + unregister_widget('WC_Widget_Recent_Reviews'); |
|
264 | 264 | require get_template_directory() . '/includes/classes/class-lsx-wc-widget-recent-reviews.php'; |
265 | - register_widget( 'LSX_WC_Widget_Recent_Reviews' ); |
|
265 | + register_widget('LSX_WC_Widget_Recent_Reviews'); |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | - add_action( 'widgets_init', 'lsx_wc_reviews_widget_override', 15 ); |
|
269 | + add_action('widgets_init', 'lsx_wc_reviews_widget_override', 15); |
|
270 | 270 | |
271 | 271 | endif; |
272 | 272 | |
273 | -if ( ! function_exists( 'lsx_wc_change_price_html' ) ) : |
|
273 | +if ( ! function_exists('lsx_wc_change_price_html')) : |
|
274 | 274 | |
275 | 275 | /** |
276 | 276 | * Change WC ZERO price to "free". |
@@ -278,28 +278,28 @@ discard block |
||
278 | 278 | * @package lsx |
279 | 279 | * @subpackage woocommerce |
280 | 280 | */ |
281 | - function lsx_wc_change_price_html( $price, $product ) { |
|
282 | - if ( empty( $product->get_price() ) ) { |
|
283 | - if ( $product->is_on_sale() && $product->get_regular_price() ) { |
|
284 | - $regular_price = wc_get_price_to_display( $product, array( |
|
281 | + function lsx_wc_change_price_html($price, $product) { |
|
282 | + if (empty($product->get_price())) { |
|
283 | + if ($product->is_on_sale() && $product->get_regular_price()) { |
|
284 | + $regular_price = wc_get_price_to_display($product, array( |
|
285 | 285 | 'qty' => 1, |
286 | 286 | 'price' => $product->get_regular_price(), |
287 | - ) ); |
|
287 | + )); |
|
288 | 288 | |
289 | - $price = wc_format_price_range( $regular_price, esc_html__( 'Free!', 'lsx' ) ); |
|
289 | + $price = wc_format_price_range($regular_price, esc_html__('Free!', 'lsx')); |
|
290 | 290 | } else { |
291 | - $price = '<span class="amount">' . esc_html__( 'Free!', 'lsx' ) . '</span>'; |
|
291 | + $price = '<span class="amount">' . esc_html__('Free!', 'lsx') . '</span>'; |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | 295 | return $price; |
296 | 296 | } |
297 | 297 | |
298 | - add_filter( 'woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2 ); |
|
298 | + add_filter('woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2); |
|
299 | 299 | |
300 | 300 | endif; |
301 | 301 | |
302 | -if ( ! function_exists( 'lsx_wc_cart_link_fragment' ) ) : |
|
302 | +if ( ! function_exists('lsx_wc_cart_link_fragment')) : |
|
303 | 303 | |
304 | 304 | /** |
305 | 305 | * Cart Fragments. |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @package lsx |
309 | 309 | * @subpackage woocommerce |
310 | 310 | */ |
311 | - function lsx_wc_cart_link_fragment( $fragments ) { |
|
311 | + function lsx_wc_cart_link_fragment($fragments) { |
|
312 | 312 | global $woocommerce; |
313 | 313 | |
314 | 314 | ob_start(); |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | lsx_wc_items_counter(); |
320 | 320 | $items_counter = ob_get_clean(); |
321 | 321 | |
322 | - if ( ! empty( $items_counter ) ) { |
|
323 | - $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'] ); |
|
322 | + if ( ! empty($items_counter)) { |
|
323 | + $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']); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | return $fragments; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | |
329 | 329 | endif; |
330 | 330 | |
331 | -if ( ! function_exists( 'lsx_wc_cart_link' ) ) : |
|
331 | +if ( ! function_exists('lsx_wc_cart_link')) : |
|
332 | 332 | |
333 | 333 | /** |
334 | 334 | * Cart Link. |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | */ |
340 | 340 | function lsx_wc_cart_link() { |
341 | 341 | ?> |
342 | - <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"> |
|
343 | - <span class="lsx-wc-cart-amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> |
|
342 | + <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"> |
|
343 | + <span class="lsx-wc-cart-amount"><?php echo wp_kses_data(WC()->cart->get_cart_subtotal()); ?></span> |
|
344 | 344 | |
345 | 345 | <?php /* Translators: %s: items quantity */ ?> |
346 | - <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> |
|
346 | + <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> |
|
347 | 347 | |
348 | - <?php if ( ! empty( WC()->cart->get_cart_contents_count() ) ) : ?> |
|
349 | - <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data( WC()->cart->get_cart_contents_count() );?></span> |
|
348 | + <?php if ( ! empty(WC()->cart->get_cart_contents_count())) : ?> |
|
349 | + <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data(WC()->cart->get_cart_contents_count()); ?></span> |
|
350 | 350 | <?php endif; ?> |
351 | 351 | </a> |
352 | 352 | <?php |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | endif; |
356 | 356 | |
357 | -if ( ! function_exists( 'lsx_wc_items_counter' ) ) : |
|
357 | +if ( ! function_exists('lsx_wc_items_counter')) : |
|
358 | 358 | |
359 | 359 | /** |
360 | 360 | * Add car item hidden items counter. |
@@ -366,21 +366,21 @@ discard block |
||
366 | 366 | $count = (int) WC()->cart->get_cart_contents_count(); |
367 | 367 | $items_counter = ''; |
368 | 368 | |
369 | - if ( ! empty( $count ) ) { |
|
369 | + if ( ! empty($count)) { |
|
370 | 370 | $count -= 3; |
371 | 371 | |
372 | - if ( 1 === $count ) { |
|
373 | - $items_counter = esc_html__( '1 other item in cart', 'lsx' ); |
|
374 | - } elseif ( $count > 1 ) { |
|
372 | + if (1 === $count) { |
|
373 | + $items_counter = esc_html__('1 other item in cart', 'lsx'); |
|
374 | + } elseif ($count > 1) { |
|
375 | 375 | /* Translators: %s: items counter */ |
376 | - $items_counter = sprintf( esc_html__( '%s other items in cart', 'lsx' ), $count ); |
|
376 | + $items_counter = sprintf(esc_html__('%s other items in cart', 'lsx'), $count); |
|
377 | 377 | } |
378 | 378 | } |
379 | 379 | |
380 | - if ( ! empty( $items_counter ) ) : |
|
380 | + if ( ! empty($items_counter)) : |
|
381 | 381 | ?> |
382 | 382 | <li class="woocommerce-mini-cart-item mini_cart_item" style="display: block;"> |
383 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>"><?php echo esc_html( $items_counter ); ?></a> |
|
383 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>"><?php echo esc_html($items_counter); ?></a> |
|
384 | 384 | </li> |
385 | 385 | <?php |
386 | 386 | endif; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | |
389 | 389 | endif; |
390 | 390 | |
391 | -if ( ! function_exists( 'lsx_wc_loop_shop_per_page' ) ) : |
|
391 | +if ( ! function_exists('lsx_wc_loop_shop_per_page')) : |
|
392 | 392 | |
393 | 393 | /** |
394 | 394 | * Changes the number of products to display on shop. |
@@ -396,16 +396,16 @@ discard block |
||
396 | 396 | * @package lsx |
397 | 397 | * @subpackage woocommerce |
398 | 398 | */ |
399 | - function lsx_wc_loop_shop_per_page( $items ) { |
|
399 | + function lsx_wc_loop_shop_per_page($items) { |
|
400 | 400 | $items = 20; |
401 | 401 | return $items; |
402 | 402 | } |
403 | 403 | |
404 | - add_filter( 'loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20 ); |
|
404 | + add_filter('loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20); |
|
405 | 405 | |
406 | 406 | endif; |
407 | 407 | |
408 | -if ( ! function_exists( 'lsx_wc_add_to_cart_message_html' ) ) : |
|
408 | +if ( ! function_exists('lsx_wc_add_to_cart_message_html')) : |
|
409 | 409 | |
410 | 410 | /** |
411 | 411 | * Changes the "added to cart" message HTML. |
@@ -413,39 +413,39 @@ discard block |
||
413 | 413 | * @package lsx |
414 | 414 | * @subpackage woocommerce |
415 | 415 | */ |
416 | - function lsx_wc_add_to_cart_message_html( $message, $products ) { |
|
416 | + function lsx_wc_add_to_cart_message_html($message, $products) { |
|
417 | 417 | $message = '<div class="woocommerce-message-added-to-cart">' . $message . '</div>'; |
418 | 418 | return $message; |
419 | 419 | } |
420 | 420 | |
421 | - add_filter( 'wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2 ); |
|
421 | + add_filter('wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2); |
|
422 | 422 | |
423 | 423 | endif; |
424 | 424 | |
425 | -if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.3', '>=' ) ) { |
|
426 | - add_filter( 'woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
425 | +if (defined('WC_VERSION') && version_compare(WC_VERSION, '2.3', '>=')) { |
|
426 | + add_filter('woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
427 | 427 | } else { |
428 | - add_filter( 'add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
428 | + add_filter('add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
429 | 429 | } |
430 | 430 | |
431 | -remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); |
|
431 | +remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 10); |
|
432 | 432 | |
433 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
434 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
435 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 ); |
|
436 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 ); |
|
437 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
433 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
434 | +add_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
435 | +add_action('woocommerce_after_shop_loop', 'woocommerce_result_count', 20); |
|
436 | +add_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 30); |
|
437 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
438 | 438 | |
439 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
440 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); |
|
439 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
440 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30); |
|
441 | 441 | |
442 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
443 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
444 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
445 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 ); |
|
446 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
442 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
443 | +add_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
444 | +add_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
445 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30); |
|
446 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
447 | 447 | |
448 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper' ) ) : |
|
448 | +if ( ! function_exists('lsx_wc_sorting_wrapper')) : |
|
449 | 449 | |
450 | 450 | /** |
451 | 451 | * Sorting wrapper. |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | |
460 | 460 | endif; |
461 | 461 | |
462 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper_close' ) ) : |
|
462 | +if ( ! function_exists('lsx_wc_sorting_wrapper_close')) : |
|
463 | 463 | |
464 | 464 | /** |
465 | 465 | * Sorting wrapper close. |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | |
474 | 474 | endif; |
475 | 475 | |
476 | -if ( ! function_exists( 'lsx_wc_product_columns_wrapper_close' ) ) : |
|
476 | +if ( ! function_exists('lsx_wc_product_columns_wrapper_close')) : |
|
477 | 477 | |
478 | 478 | /** |
479 | 479 | * Product columns wrapper close. |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | |
488 | 488 | endif; |
489 | 489 | |
490 | -if ( ! function_exists( 'lsx_wc_woocommerce_pagination' ) ) : |
|
490 | +if ( ! function_exists('lsx_wc_woocommerce_pagination')) : |
|
491 | 491 | |
492 | 492 | /** |
493 | 493 | * LSX WooCommerce Pagination |
@@ -499,14 +499,14 @@ discard block |
||
499 | 499 | * @subpackage woocommerce |
500 | 500 | */ |
501 | 501 | function lsx_wc_woocommerce_pagination() { |
502 | - if ( woocommerce_products_will_display() ) { |
|
502 | + if (woocommerce_products_will_display()) { |
|
503 | 503 | woocommerce_pagination(); |
504 | 504 | } |
505 | 505 | } |
506 | 506 | |
507 | 507 | endif; |
508 | 508 | |
509 | -if ( ! function_exists( 'lsx_customizer_wc_controls' ) ) : |
|
509 | +if ( ! function_exists('lsx_customizer_wc_controls')) : |
|
510 | 510 | |
511 | 511 | /** |
512 | 512 | * Returns an array of the core panel. |
@@ -516,10 +516,10 @@ discard block |
||
516 | 516 | * |
517 | 517 | * @return $lsx_controls array() |
518 | 518 | */ |
519 | - function lsx_customizer_wc_controls( $lsx_controls ) { |
|
519 | + function lsx_customizer_wc_controls($lsx_controls) { |
|
520 | 520 | $lsx_controls['panels']['lsx-wc'] = array( |
521 | - 'title' => esc_html__( 'WooCommerce', 'lsx' ), |
|
522 | - 'description' => esc_html__( 'Change the WooCommerce settings.', 'lsx' ), |
|
521 | + 'title' => esc_html__('WooCommerce', 'lsx'), |
|
522 | + 'description' => esc_html__('Change the WooCommerce settings.', 'lsx'), |
|
523 | 523 | 'priority' => 23, |
524 | 524 | ); |
525 | 525 | |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | */ |
529 | 529 | |
530 | 530 | $lsx_controls['sections']['lsx-wc-global'] = array( |
531 | - 'title' => esc_html__( 'Global', 'lsx' ), |
|
532 | - 'description' => esc_html__( 'Change the WooCommerce global settings.', 'lsx' ), |
|
531 | + 'title' => esc_html__('Global', 'lsx'), |
|
532 | + 'description' => esc_html__('Change the WooCommerce global settings.', 'lsx'), |
|
533 | 533 | 'panel' => 'lsx-wc', |
534 | 534 | 'priority' => 1, |
535 | 535 | ); |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | ); |
541 | 541 | |
542 | 542 | $lsx_controls['fields']['lsx_wc_mobile_footer_bar_status'] = array( |
543 | - 'label' => esc_html__( 'Footer Bar', 'lsx' ), |
|
544 | - 'description' => esc_html__( 'Enable the mobile footer bar.', 'lsx' ), |
|
543 | + 'label' => esc_html__('Footer Bar', 'lsx'), |
|
544 | + 'description' => esc_html__('Enable the mobile footer bar.', 'lsx'), |
|
545 | 545 | 'section' => 'lsx-wc-global', |
546 | 546 | 'type' => 'checkbox', |
547 | 547 | 'priority' => 1, |
@@ -552,8 +552,8 @@ discard block |
||
552 | 552 | */ |
553 | 553 | |
554 | 554 | $lsx_controls['sections']['lsx-wc-cart'] = array( |
555 | - 'title' => esc_html__( 'Cart', 'lsx' ), |
|
556 | - 'description' => esc_html__( 'Change the WooCommerce cart settings.', 'lsx' ), |
|
555 | + 'title' => esc_html__('Cart', 'lsx'), |
|
556 | + 'description' => esc_html__('Change the WooCommerce cart settings.', 'lsx'), |
|
557 | 557 | 'panel' => 'lsx-wc', |
558 | 558 | 'priority' => 2, |
559 | 559 | ); |
@@ -564,8 +564,8 @@ discard block |
||
564 | 564 | ); |
565 | 565 | |
566 | 566 | $lsx_controls['fields']['lsx_header_wc_cart'] = array( |
567 | - 'label' => esc_html__( 'Menu Item', 'lsx' ), |
|
568 | - 'description' => esc_html__( 'Enable the cart menu item.', 'lsx' ), |
|
567 | + 'label' => esc_html__('Menu Item', 'lsx'), |
|
568 | + 'description' => esc_html__('Enable the cart menu item.', 'lsx'), |
|
569 | 569 | 'section' => 'lsx-wc-cart', |
570 | 570 | 'type' => 'checkbox', |
571 | 571 | 'priority' => 1, |
@@ -576,9 +576,9 @@ discard block |
||
576 | 576 | |
577 | 577 | endif; |
578 | 578 | |
579 | -add_filter( 'lsx_customizer_controls', 'lsx_customizer_wc_controls' ); |
|
579 | +add_filter('lsx_customizer_controls', 'lsx_customizer_wc_controls'); |
|
580 | 580 | |
581 | -if ( ! function_exists( 'lsx_wc_footer_bar' ) ) : |
|
581 | +if ( ! function_exists('lsx_wc_footer_bar')) : |
|
582 | 582 | |
583 | 583 | /** |
584 | 584 | * Display WC footer bar. |
@@ -587,46 +587,46 @@ discard block |
||
587 | 587 | * @subpackage woocommerce |
588 | 588 | */ |
589 | 589 | function lsx_wc_footer_bar() { |
590 | - if ( ! empty( get_theme_mod( 'lsx_wc_mobile_footer_bar_status', '1' ) ) ) : |
|
590 | + if ( ! empty(get_theme_mod('lsx_wc_mobile_footer_bar_status', '1'))) : |
|
591 | 591 | ?> |
592 | 592 | <div class="lsx-wc-footer-bar"> |
593 | - <form role="search" method="get" action="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-form"> |
|
593 | + <form role="search" method="get" action="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-form"> |
|
594 | 594 | <fieldset> |
595 | - <legend class="screen-reader-text"><?php esc_html_e( 'Search products', 'lsx' ); ?></legend> |
|
596 | - <input type="search" name="s" placeholder="<?php esc_attr_e( 'Search products…', 'lsx' ); ?>" class="form-control"> |
|
595 | + <legend class="screen-reader-text"><?php esc_html_e('Search products', 'lsx'); ?></legend> |
|
596 | + <input type="search" name="s" placeholder="<?php esc_attr_e('Search products…', 'lsx'); ?>" class="form-control"> |
|
597 | 597 | </fieldset> |
598 | 598 | </form> |
599 | 599 | |
600 | 600 | <ul class="lsx-wc-footer-bar-items"> |
601 | 601 | <li class="lsx-wc-footer-bar-item"> |
602 | - <a href="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
602 | + <a href="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
603 | 603 | <i class="fa fa-home" aria-hidden="true"></i> |
604 | - <span><?php esc_html_e( 'Home', 'lsx' ); ?></span> |
|
604 | + <span><?php esc_html_e('Home', 'lsx'); ?></span> |
|
605 | 605 | </a> |
606 | 606 | </li> |
607 | 607 | |
608 | 608 | <li class="lsx-wc-footer-bar-item"> |
609 | - <a href="<?php echo esc_url( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); ?>" class="lsx-wc-footer-bar-link"> |
|
609 | + <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" class="lsx-wc-footer-bar-link"> |
|
610 | 610 | <i class="fa fa-user" aria-hidden="true"></i> |
611 | - <span><?php esc_html_e( 'Account', 'lsx' ); ?></span> |
|
611 | + <span><?php esc_html_e('Account', 'lsx'); ?></span> |
|
612 | 612 | </a> |
613 | 613 | </li> |
614 | 614 | |
615 | 615 | <li class="lsx-wc-footer-bar-item"> |
616 | 616 | <a href="#" class="lsx-wc-footer-bar-link lsx-wc-footer-bar-link-toogle"> |
617 | 617 | <i class="fa fa-search" aria-hidden="true"></i> |
618 | - <span><?php esc_html_e( 'Search', 'lsx' ); ?></span> |
|
618 | + <span><?php esc_html_e('Search', 'lsx'); ?></span> |
|
619 | 619 | </a> |
620 | 620 | </li> |
621 | 621 | |
622 | 622 | <li class="lsx-wc-footer-bar-item"> |
623 | - <a href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
623 | + <a href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
624 | 624 | <i class="fa fa-shopping-basket" aria-hidden="true"></i> |
625 | 625 | <?php $count = WC()->cart->get_cart_contents_count(); ?> |
626 | - <?php if ( ! empty( $count ) ) : ?> |
|
627 | - <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data( $count ); ?></span> |
|
626 | + <?php if ( ! empty($count)) : ?> |
|
627 | + <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data($count); ?></span> |
|
628 | 628 | <?php endif; ?> |
629 | - <span><?php esc_html_e( 'Cart', 'lsx' ); ?></span> |
|
629 | + <span><?php esc_html_e('Cart', 'lsx'); ?></span> |
|
630 | 630 | </a> |
631 | 631 | </li> |
632 | 632 | </ul> |
@@ -635,11 +635,11 @@ discard block |
||
635 | 635 | endif; |
636 | 636 | } |
637 | 637 | |
638 | - add_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
638 | + add_action('lsx_body_bottom', 'lsx_wc_footer_bar', 15); |
|
639 | 639 | |
640 | 640 | endif; |
641 | 641 | |
642 | -if ( ! function_exists( 'lsx_wc_body_class' ) ) : |
|
642 | +if ( ! function_exists('lsx_wc_body_class')) : |
|
643 | 643 | |
644 | 644 | /** |
645 | 645 | * Changes body class. |
@@ -647,16 +647,16 @@ discard block |
||
647 | 647 | * @package lsx |
648 | 648 | * @subpackage woocommerce |
649 | 649 | */ |
650 | - function lsx_wc_body_class( $classes ) { |
|
650 | + function lsx_wc_body_class($classes) { |
|
651 | 651 | global $post; |
652 | 652 | |
653 | - if ( $post && class_exists( 'WC_Wishlists_Pages' ) && WC_Wishlists_Pages::is_wishlist_page( $post->post_name ) ) { |
|
653 | + if ($post && class_exists('WC_Wishlists_Pages') && WC_Wishlists_Pages::is_wishlist_page($post->post_name)) { |
|
654 | 654 | $classes[] = 'woocommerce-page woocommerce-wishlist'; |
655 | 655 | } |
656 | 656 | |
657 | 657 | return $classes; |
658 | 658 | } |
659 | 659 | |
660 | - add_filter( 'body_class', 'lsx_wc_body_class', 2999 ); |
|
660 | + add_filter('body_class', 'lsx_wc_body_class', 2999); |
|
661 | 661 | |
662 | 662 | endif; |