Passed
Push — master ( f8fade...909ca9 )
by Warwick
10:39 queued 07:19
created
classes/class-frontend.php 2 patches
Indentation   +959 added lines, -959 removed lines patch added patch discarded remove patch
@@ -9,685 +9,685 @@  discard block
 block discarded – undo
9 9
 
10 10
 class Frontend {
11 11
 
12
-	/**
13
-	 * Holds class instance
14
-	 *
15
-	 * @since 1.0.0
16
-	 *
17
-	 * @var      object \lsx\search\classes\Frontend()
18
-	 */
19
-	protected static $instance = null;
20
-
21
-	public $options = false;
22
-
23
-	public $tabs = false;
24
-
25
-	public $facet_data = false;
26
-
27
-	/**
28
-	 * Determine weather or not search is enabled for this page.
29
-	 *
30
-	 * @var boolean
31
-	 */
32
-	public $search_enabled = false;
33
-
34
-	public $search_core_suffix = false;
35
-
36
-	public $search_prefix = false;
37
-
38
-	/**
39
-	 * Holds the post types enabled
40
-	 *
41
-	 * @var array
42
-	 */
43
-	public $post_types = array();
44
-
45
-	/**
46
-	 * Holds the taxonomies enabled for search
47
-	 *
48
-	 * @var array
49
-	 */
50
-	public $taxonomies = array();
51
-
52
-	/**
53
-	 * If the current search page has posts or not
54
-	 *
55
-	 * @var boolean
56
-	 */
57
-	public $has_posts = false;
58
-
59
-	/**
60
-	 * If we are using the CMB2 options or not.
61
-	 *
62
-	 * @var boolean
63
-	 */
64
-	public $new_options = false;
65
-
66
-	/**
67
-	 * Construct method.
68
-	 */
69
-	public function __construct() {
70
-		$this->options = \lsx\search\includes\get_options();
71
-		$this->load_classes();
72
-
73
-		add_filter( 'wpseo_json_ld_search_url', array( $this, 'change_json_ld_search_url' ), 10, 1 );
74
-		add_action( 'wp', array( $this, 'set_vars' ), 21 );
75
-		add_action( 'wp', array( $this, 'set_facetwp_vars' ), 22 );
76
-		add_action( 'wp', array( $this, 'core' ), 23 );
77
-		add_action( 'lsx_body_top', array( $this, 'check_for_results' ) );
78
-
79
-		add_filter( 'pre_get_posts', array( $this, 'ignore_sticky_search' ) );
80
-		add_action( 'pre_get_posts', array( $this, 'filter_post_types' ) );
81
-
82
-		add_filter( 'lsx_search_post_types', array( $this, 'register_post_types' ) );
83
-		add_filter( 'lsx_search_taxonomies', array( $this, 'register_taxonomies' ) );
84
-		add_filter( 'lsx_search_post_types_plural', array( $this, 'register_post_type_tabs' ) );
85
-		add_filter( 'facetwp_sort_options', array( $this, 'facetwp_sort_options' ), 10, 2 );
86
-		add_filter( 'wp_kses_allowed_html', array( $this, 'kses_allowed_html' ), 20, 2 );
87
-		add_filter( 'get_search_query', array( $this, 'get_search_query' ) );
88
-
89
-		// Redirects.
90
-		add_action( 'template_redirect', array( $this, 'pretty_search_redirect' ) );
91
-		add_filter( 'pre_get_posts', array( $this, 'pretty_search_parse_query' ) );
92
-
93
-		add_action( 'lsx_search_sidebar_top', array( $this, 'search_sidebar_top' ) );
94
-		add_filter( 'facetwp_facet_html', array( $this, 'search_facet_html' ), 10, 2 );
95
-	}
96
-
97
-	/**
98
-	 * Return an instance of this class.
99
-	 *
100
-	 * @since 1.0.0
101
-	 *
102
-	 * @return    object \lsx\member_directory\search\Frontend()    A single instance of this class.
103
-	 */
104
-	public static function get_instance() {
105
-		// If the single instance hasn't been set, set it now.
106
-		if ( null === self::$instance ) {
107
-			self::$instance = new self();
108
-		}
109
-		return self::$instance;
110
-	}
111
-
112
-	/**
113
-	 * Loads the variable classes and the static classes.
114
-	 */
115
-	private function load_classes() {
116
-		require_once LSX_SEARCH_PATH . 'classes/frontend/class-layout.php';
117
-		$this->layout = frontend\Layout::get_instance();
118
-	}
119
-
120
-	/**
121
-	 * Check all settings.
122
-	 */
123
-	public function set_vars() {
124
-		$post_type = '';
125
-
126
-		$this->post_types      = apply_filters( 'lsx_search_post_types', array() );
127
-		$this->taxonomies      = apply_filters( 'lsx_search_taxonomies', array() );
128
-		$this->tabs            = apply_filters( 'lsx_search_post_types_plural', array() );
129
-		$this->options         = apply_filters( 'lsx_search_options', $this->options );
130
-		$this->post_types      = get_post_types();
131
-		$this->post_type_slugs = array(
132
-			'post'        => 'posts',
133
-			'project'     => 'projects',
134
-			'service'     => 'services',
135
-			'team'        => 'team',
136
-			'testimonial' => 'testimonials',
137
-			'video'       => 'videos',
138
-			'product'     => 'products',
139
-		);
140
-		$this->set_search_prefix();
141
-		$this->get_cmb2_options();
142
-		$this->search_enabled = apply_filters( 'lsx_search_enabled', $this->is_search_enabled(), $this );
143
-		$this->search_prefix  = apply_filters( 'lsx_search_prefix', $this->search_prefix, $this );
144
-	}
145
-
146
-	private function get_cmb2_options() {
147
-		$cmb2_options = get_option( 'lsx-search-settings' );
148
-		if ( false !== $cmb2_options && ! empty( $cmb2_options ) ) {
149
-			$this->set_search_prefix( true );
150
-			$this->options['display'] = $cmb2_options;
151
-			foreach ( $this->options['display'] as $option_key => $option_value ) {
152
-				if ( is_array( $option_value ) && ! empty( $option_value ) ) {
153
-					$new_values = array();
154
-					foreach ( $option_value as $empty_key => $key_value ) {
155
-						$new_values[ $key_value ] = 'on';
156
-					}
157
-					$this->options['display'][ $option_key ] = $new_values;
158
-				}
159
-			}
160
-			$this->new_options = true;
161
-			$this->disable_to_search_actions();
162
-		}
163
-	}
164
-
165
-	private function disable_to_search_actions() {
166
-		global $lsx_to_search_fwp, $lsx_to_search;
167
-		if ( null !== $lsx_to_search ) {
168
-			// Redirects.
169
-			remove_filter( 'template_include', array( $lsx_to_search, 'search_template_include' ), 99 );
170
-			remove_action( 'template_redirect', array( $lsx_to_search, 'pretty_search_redirect' ) );
171
-			remove_filter( 'pre_get_posts', array( $lsx_to_search, 'pretty_search_parse_query' ) );
172
-
173
-			// Layout Filter.
174
-			remove_filter( 'lsx_layout', array( $lsx_to_search, 'lsx_layout' ), 20, 1 );
175
-			remove_filter( 'lsx_layout_selector', array( $lsx_to_search, 'lsx_layout_selector' ), 10, 4 );
176
-			remove_filter( 'lsx_to_archive_layout', array( $lsx_to_search, 'lsx_to_search_archive_layout' ), 10, 2 );
177
-
178
-			remove_action( 'lsx_search_sidebar_top', array( $lsx_to_search, 'search_sidebar_top' ) );
179
-			remove_action( 'pre_get_posts', array( $lsx_to_search, 'price_sorting' ), 100 );
180
-
181
-			//add_shortcode( 'lsx_search_form', array( 'LSX_TO_Search_Frontend', 'search_form' ) );
182
-			remove_filter( 'searchwp_short_circuit', array( $lsx_to_search, 'searchwp_short_circuit' ), 10, 2 );
183
-			remove_filter( 'get_search_query', array( $lsx_to_search, 'get_search_query' ) );
184
-			remove_filter( 'body_class', array( $lsx_to_search, 'to_add_search_url_class' ), 20 );
185
-
186
-			remove_filter( 'facetwp_preload_url_vars', array( $lsx_to_search, 'preload_url_vars' ), 10, 1 );
187
-			remove_filter( 'wpseo_json_ld_search_url', array( $lsx_to_search, 'change_json_ld_search_url' ), 10, 1 );
188
-		}
189
-		if ( null !== $lsx_to_search_fwp ) {
190
-			remove_filter( 'facetwp_indexer_row_data', array( $lsx_to_search_fwp, 'facetwp_index_row_data' ), 10, 2 );
191
-			remove_filter( 'facetwp_index_row', array( $lsx_to_search_fwp, 'facetwp_index_row' ), 10, 2 );
192
-
193
-			remove_filter( 'facetwp_sort_options', array( $lsx_to_search_fwp, 'facet_sort_options' ), 10, 2 );
194
-
195
-			remove_filter( 'facetwp_pager_html', array( $lsx_to_search_fwp, 'facetwp_pager_html' ), 10, 2 );
196
-			remove_filter( 'facetwp_result_count', array( $lsx_to_search_fwp, 'facetwp_result_count' ), 10, 2 );
197
-
198
-			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'destination_facet_html' ), 10, 2 );
199
-			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'slide_facet_html' ), 10, 2 );
200
-			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'search_facet_html' ), 10, 2 );
201
-			remove_filter( 'facetwp_load_css', array( $lsx_to_search_fwp, 'facetwp_load_css' ), 10, 1 );
202
-
203
-			if ( class_exists( 'LSX_Currencies' ) ) {
204
-				remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_lsx_currencies' ), 10, 2 );
205
-			} else {
206
-				remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_to_currencies' ), 10, 2 );
207
-			}
208
-		}
209
-	}
210
-
211
-	/**
212
-	 * Returns if the search is enabled.
213
-	 *
214
-	 * @return boolean
215
-	 */
216
-	public function is_search_enabled() {
217
-		$search_enabled = false;
218
-
219
-		if ( false === $this->new_options ) {
220
-			if ( isset( $this->options['display'][ $this->search_prefix . '_enable_' . $this->search_core_suffix ] ) && ( ! empty( $this->options ) ) && 'on' == $this->options['display'][ $this->search_prefix . '_enable_' . $this->search_core_suffix ] ) {
221
-				$search_enabled = true;
222
-			}
223
-		} else {
224
-			$enable_prefix = $this->search_prefix;
225
-			if ( ! empty( $this->options ) && isset( $this->options['display'] ) && isset( $this->options['display'][ $enable_prefix . '_enable' ] ) && 'on' === $this->options['display'][ $enable_prefix . '_enable' ] ) {
226
-				$search_enabled = true;
227
-			}
228
-		}
229
-
230
-		// These are specific plugin exclusions.
231
-		if ( is_tax( array( 'wcpv_product_vendors' ) ) ) {
232
-			$search_enabled = false;
233
-		}
234
-		return $search_enabled;
235
-	}
236
-
237
-	/**
238
-	 * Sets the search prefix.
239
-	 *
240
-	 * @return void
241
-	 */
242
-	private function set_search_prefix( $new_prefixes = false ) {
243
-		$page_for_posts = get_option( 'page_for_posts' );
244
-		if ( false !== $new_prefixes ) {
245
-			$this->taxonomies = array();
246
-			$this->post_types = array();
247
-		}
248
-
249
-		if ( is_search() ) {
250
-			if ( false === $new_prefixes ) {
251
-				$this->search_core_suffix = 'core';
252
-				$this->search_prefix      = 'search';
253
-			} else {
254
-				$this->search_core_suffix = 'enable';
255
-				$this->search_prefix      = 'engine_search';
256
-			}
257
-		} elseif ( is_post_type_archive( $this->post_types ) || is_tax() || is_page( $page_for_posts ) || is_home() || is_category() || is_tag() ) {
258
-			if ( false === $new_prefixes ) {
259
-				$this->search_core_suffix = 'search';
260
-			} else {
261
-				$this->search_core_suffix = 'enable';
262
-			}
263
-
264
-			if ( is_tax() ) {
265
-				$tax = get_query_var( 'taxonomy' );
266
-				$tax = get_taxonomy( $tax );
267
-				$post_type = $tax->object_type[0];
268
-			} else if ( is_page( $page_for_posts ) || is_category() || is_tag() || is_home() ) {
269
-				$post_type = 'post';
270
-			} else {
271
-				$post_type = get_query_var( 'post_type' );
272
-			}
273
-
274
-			if ( false === $new_prefixes ) {
275
-				if ( isset( $this->tabs[ $post_type ] ) ) {
276
-					$this->search_prefix = $this->tabs[ $post_type ] . '_archive';
277
-				}
278
-			} else {
279
-				$this->search_prefix = $post_type . '_search';
280
-			}
281
-		}
282
-	}
283
-
284
-	/**
285
-	 * Sets the FacetWP variables.
286
-	 */
287
-	public function set_facetwp_vars() {
288
-
289
-		if ( class_exists( 'FacetWP' ) ) {
290
-			$facet_data = FWP()->helper->get_facets();
291
-		}
292
-
293
-		$this->facet_data = array();
294
-
295
-		$this->facet_data['search_form'] = array(
296
-			'name' => 'search_form',
297
-			'label' => esc_html__( 'Search Form', 'lsx-search' ),
298
-		);
299
-
300
-		if ( ! empty( $facet_data ) && is_array( $facet_data ) ) {
301
-			foreach ( $facet_data as $facet ) {
302
-				$this->facet_data[ $facet['name'] ] = $facet;
303
-			}
304
-		}
305
-	}
306
-
307
-	/**
308
-	 * Check all settings.
309
-	 */
310
-	public function core() {
311
-
312
-		if ( true === $this->search_enabled ) {
313
-			add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 999 );
314
-
315
-			add_filter( 'lsx_layout', array( $this, 'lsx_layout' ), 20, 1 );
316
-			add_filter( 'lsx_layout_selector', array( $this, 'lsx_layout_selector' ), 10, 4 );
317
-			add_filter( 'lsx_slot_class', array( $this, 'change_slot_column_class' ) );
318
-			add_action( 'lsx_entry_top', array( $this, 'add_label_to_title' ) );
319
-			add_filter( 'body_class', array( $this, 'body_class' ), 10 );
320
-
321
-			add_filter( 'lsx_blog_customizer_top_of_blog_action', array( $this, 'top_of_blog_action' ), 10, 1 );
322
-			add_filter( 'lsx_blog_customizer_blog_description_class', array( $this, 'blog_description_class' ), 10, 1 );
323
-
324
-			if ( class_exists( 'LSX_Videos' ) ) {
325
-				global $lsx_videos_frontend;
326
-				remove_action( 'lsx_content_top', array( $lsx_videos_frontend, 'categories_tabs' ), 15 );
327
-			}
328
-
329
-			add_filter( 'lsx_paging_nav_disable', '__return_true' );
330
-			add_action( 'lsx_content_top', array( $this, 'facet_top_bar' ) );
331
-			add_action( 'lsx_content_top', array( $this, 'facetwp_tempate_open' ) );
332
-			add_action( 'lsx_content_bottom', array( $this, 'facetwp_tempate_close' ) );
333
-			add_action( 'lsx_content_bottom', array( $this, 'facet_bottom_bar' ) );
334
-
335
-			if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) && '1c' !== $this->options['display'][ $this->search_prefix . '_layout' ] ) {
336
-				add_filter( 'lsx_sidebar_enable', array( $this, 'lsx_sidebar_enable' ), 10, 1 );
337
-			}
338
-
339
-			add_action( 'lsx_content_wrap_before', array( $this, 'search_sidebar' ), 150 );
340
-
341
-			if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_category() || is_product_tag() ) ) {
342
-				remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description' );
343
-				remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description' );
344
-				add_filter( 'woocommerce_show_page_title', '__return_false' );
345
-
346
-				add_filter( 'loop_shop_columns', function() {
347
-					return 3;
348
-				} );
349
-
350
-				// Actions added by LSX theme
351
-				remove_action( 'lsx_content_wrap_before', 'lsx_global_header' );
352
-
353
-				// Actions added be LSX theme / woocommerce.php file
354
-				remove_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 );
355
-				remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
356
-				remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 );
357
-				remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 );
358
-				remove_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 );
359
-
360
-				// Actions added be LSX theme / woocommerce.php file
361
-				remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 );
362
-				remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
363
-				remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
364
-				remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 );
365
-				remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 );
366
-			}
367
-		}
368
-	}
369
-
370
-	/**
371
-	 * Adds a search class to the body to allow the styling of the sidebars etc.
372
-	 *
373
-	 * @param  array $classes The classes.
374
-	 * @return array $classes The classes.
375
-	 */
376
-	public function body_class( $classes ) {
377
-		$classes[] = 'lsx-search-enabled';
378
-		return $classes;
379
-	}
380
-
381
-	/**
382
-	 * Moves the blog description to above the content columns.
383
-	 *
384
-	 * @param  string $action
385
-	 * @return string $action
386
-	 */
387
-	public function top_of_blog_action( $action = '' ) {
388
-		$action = 'lsx_content_wrap_before';
389
-		return $action;
390
-	}
391
-
392
-	/**
393
-	 * Adds a class to the blog description.
394
-	 *
395
-	 * @param  string $action
396
-	 * @return string $action
397
-	 */
398
-	public function blog_description_class( $class = '' ) {
399
-		$class .= ' col-md-12 search-description';
400
-		return $class;
401
-	}
402
-
403
-	/**
404
-	 * Check the $wp_query global to see if there are posts in the current query.
405
-	 *
406
-	 * @return void
407
-	 */
408
-	public function check_for_results() {
409
-		if ( true === $this->search_enabled ) {
410
-			global $wp_query;
411
-			if ( empty( $wp_query->posts ) ) {
412
-				$this->has_posts = false;
413
-				remove_action( 'lsx_content_top', array( $this, 'facet_top_bar' ) );
414
-				remove_action( 'lsx_content_bottom', array( $this, 'facet_bottom_bar' ) );
415
-				remove_action( 'lsx_content_wrap_before', array( $this, 'search_sidebar' ), 150 );
416
-			} else {
417
-				$this->has_posts = true;
418
-			}
419
-		}
420
-	}
421
-
422
-	/**
423
-	 * Filter the post types.
424
-	 */
425
-	public function filter_post_types( $query ) {
426
-		if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) {
427
-			if ( ! empty( $this->options ) && ! empty( $this->options['display']['search_enable_core'] ) ) {
428
-				if ( ! empty( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) {
429
-					$post_types = array_keys( $this->options['general']['search_post_types'] );
430
-					$query->set( 'post_type', $post_types );
431
-				}
432
-			}
433
-		}
434
-	}
435
-
436
-	/**
437
-	 * Sets post types with active search options.
438
-	 */
439
-	public function register_post_types( $post_types ) {
440
-		$post_types = array( 'post', 'project', 'service', 'team', 'testimonial', 'video', 'product' );
441
-		return $post_types;
442
-	}
443
-
444
-	/**
445
-	 * Sets taxonomies with active search options.
446
-	 */
447
-	public function register_taxonomies( $taxonomies ) {
448
-		$taxonomies = array( 'category', 'post_tag', 'project-group', 'service-group', 'team_role', 'video-category', 'product_cat', 'product_tag' );
449
-		return $taxonomies;
450
-	}
451
-
452
-	/**
453
-	 * Sets post types with active search options.
454
-	 */
455
-	public function register_post_type_tabs( $post_types_plural ) {
456
-		$post_types_plural = array(
457
-			'post' => 'posts',
458
-			'project' => 'projects',
459
-			'service' => 'services',
460
-			'team' => 'team',
461
-			'testimonial' => 'testimonials',
462
-			'video' => 'videos',
463
-			'product' => 'products', // WooCommerce
464
-		);
465
-		return $post_types_plural;
466
-	}
467
-
468
-	/**
469
-	 * Enqueue styles and scripts.
470
-	 */
471
-	public function assets() {
472
-		add_filter( 'lsx_defer_parsing_of_js', array( $this, 'skip_js_defer' ), 10, 4 );
473
-		wp_enqueue_script( 'touchSwipe', LSX_SEARCH_URL . 'assets/js/vendor/jquery.touchSwipe.min.js', array( 'jquery' ), LSX_SEARCH_VER, true );
474
-		wp_enqueue_script( 'slideandswipe', LSX_SEARCH_URL . 'assets/js/vendor/jquery.slideandswipe.min.js', array( 'jquery', 'touchSwipe' ), LSX_SEARCH_VER, true );
475
-		wp_enqueue_script( 'lsx-search', LSX_SEARCH_URL . 'assets/js/src/lsx-search.js', array( 'jquery', 'touchSwipe', 'slideandswipe', 'jquery-ui-datepicker' ), LSX_SEARCH_VER, true );
476
-
477
-		$params = apply_filters( 'lsx_search_js_params', array(
478
-			'ajax_url' => admin_url( 'admin-ajax.php' ),
479
-		));
480
-
481
-		wp_localize_script( 'lsx-search', 'lsx_customizer_params', $params );
482
-
483
-		wp_enqueue_style( 'lsx-search', LSX_SEARCH_URL . 'assets/css/lsx-search.css', array(), LSX_SEARCH_VER );
484
-		wp_style_add_data( 'lsx-search', 'rtl', 'replace' );
485
-
486
-		if ( true === $this->new_options ) {
487
-			wp_deregister_style( 'lsx_to_search' );
488
-			wp_deregister_script( 'lsx_to_search' );
489
-		}
490
-	}
491
-
492
-	/**
493
-	 * Adds the to-search.min.js and the to-search.js
494
-	 *
495
-	 * @param boolean $should_skip
496
-	 * @param string  $tag
497
-	 * @param string  $handle
498
-	 * @param string  $href
499
-	 * @return boolean
500
-	 */
501
-	public function skip_js_defer( $should_skip, $tag, $handle, $href ) {
502
-		if ( ! is_admin() && ( false !== stripos( $href, 'lsx-search.min.js' ) || false !== stripos( $href, 'lsx-search.js' ) ) ) {
503
-			$should_skip = true;
504
-		}
505
-		return $should_skip;
506
-	}
507
-
508
-	/**
509
-	 * Redirect wordpress to the search template located in the plugin
510
-	 *
511
-	 * @param	$template
512
-	 * @return	$template
513
-	 */
514
-	public function search_template_include( $template ) {
515
-		if ( is_main_query() && is_search() ) {
516
-			if ( file_exists( LSX_SEARCH_PATH . 'templates/search.php' ) ) {
517
-				$template = LSX_SEARCH_PATH . 'templates/search.php';
518
-			}
519
-		}
520
-
521
-		return $template;
522
-	}
523
-
524
-	/**
525
-	 * Ignore sticky posts on Blog search.
526
-	 *
527
-	 * @param [type] $query
528
-	 * @return void
529
-	 */
530
-	public function ignore_sticky_search( $query ) {
531
-		if ( $query->is_main_query() && is_home() ) {
532
-			$query->set( 'ignore_sticky_posts', true );
533
-		}
534
-	}
535
-
536
-	/**
537
-	 * Rewrite the search URL
538
-	 */
539
-	public function pretty_search_redirect() {
540
-		global $wp_rewrite,$wp_query;
541
-
542
-		if ( ! isset( $wp_rewrite ) || ! is_object( $wp_rewrite ) || ! $wp_rewrite->using_permalinks() ) {
543
-			return;
544
-		}
545
-
546
-		$search_base = $wp_rewrite->search_base;
547
-
548
-		if ( is_search() && ! is_admin() && strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) === false ) {
549
-			$search_query = get_query_var( 's' );
550
-			if ( empty( $search_query ) && isset( $_GET['s'] ) ) {
551
-				$search_query = $_GET['s'];
552
-			}
553
-			$engine = '';
554
-
555
-			// If the search was triggered by a supplemental engine.
556
-			if ( isset( $_GET['engine'] ) && 'default' !== $_GET['engine'] ) {
557
-				$engine = sanitize_text_field( wp_unslash( $_GET['engine'] ) );
558
-				$index  = array_search( $engine, $this->post_type_slugs, true );
559
-				if ( false !== $index ) {
560
-					$engine = $index;
561
-				}
562
-				$engine = $engine . '/';
563
-			}
564
-
565
-			$get_array = $_GET;
566
-
567
-			if ( is_array( $get_array ) && ! empty( $get_array ) ) {
568
-				$vars_to_maintain = array();
569
-
570
-				foreach ( $get_array as $ga_key => $ga_value ) {
571
-					if ( false !== strpos( $ga_key, 'fwp_' ) ) {
572
-						$vars_to_maintain[] = $ga_key . '=' . $ga_value;
573
-					}
574
-				}
575
-			}
576
-
577
-			$redirect_url = home_url( "/{$search_base}/" . $engine . urlencode( $search_query ) );
578
-
579
-			if ( ! empty( $vars_to_maintain ) ) {
580
-				$redirect_url .= '?' . implode( '&', $vars_to_maintain );
581
-			}
582
-			wp_redirect( $redirect_url );
583
-			exit();
584
-		}
585
-	}
586
-
587
-	/**
588
-	 * Parse the Query and trigger a search
589
-	 */
590
-	public function pretty_search_parse_query( $query ) {
591
-		$this->post_type_slugs = array(
592
-			'post' => 'posts',
593
-			'project' => 'projects',
594
-			'service' => 'services',
595
-			'team' => 'team',
596
-			'testimonial' => 'testimonials',
597
-			'video' => 'videos',
598
-			'product' => 'products', // WooCommerce
599
-		);
600
-		if ( $query->is_search() && ! is_admin() && $query->is_main_query() ) {
601
-			$search_query = $query->get( 's' );
602
-			$keyword_test = explode( '/', $search_query );
603
-
604
-			$index = array_search( $keyword_test[0], $this->post_type_slugs, true );
605
-			if ( false !== $index ) {
606
-				$engine = $this->post_type_slugs[ $index ];
607
-
608
-				$query->set( 'post_type', $engine );
609
-				$query->set( 'engine', $engine );
610
-
611
-				if ( count( $keyword_test ) > 1 ) {
612
-					$query->set( 's', $keyword_test[1] );
613
-				} elseif ( post_type_exists( $engine ) ) {
614
-					$query->set( 's', '' );
615
-				}
616
-			} else {
617
-				if ( isset( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) {
618
-					$post_types = array_keys( $this->options['general']['search_post_types'] );
619
-					$query->set( 'post_type', $post_types );
620
-				}
621
-			}
622
-		}
623
-		return $query;
624
-	}
625
-
626
-	/**
627
-	 * Change the search slug to /search/ for the JSON+LD output in Yoast SEO
628
-	 *
629
-	 * @return url
630
-	 */
631
-	public function change_json_ld_search_url() {
632
-		return trailingslashit( home_url() ) . 'search/{search_term_string}';
633
-	}
634
-
635
-	/**
636
-	 * A filter to set the layout to 2 column.
637
-	 */
638
-	public function lsx_layout( $layout ) {
639
-		if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) {
640
-			if ( false === $this->has_posts ) {
641
-				$layout = '1c';
642
-			} else {
643
-				$layout = $this->options['display'][ $this->search_prefix . '_layout' ];
644
-			}
645
-		}
646
-		return $layout;
647
-	}
648
-
649
-	/**
650
-	 * Outputs the Search Title Facet
651
-	 */
652
-	public function search_sidebar_top() {
653
-		if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) && true !== apply_filters( 'lsx_search_hide_search_box', false ) ) {
654
-
655
-			if ( ! is_search() ) {
656
-
657
-				foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
658
-
659
-					if ( isset( $this->facet_data[ $facet ] ) && 'search' === $this->facet_data[ $facet ]['type'] ) {
660
-						echo wp_kses_post( '<div class="row">' );
661
-							$this->display_facet_default( $facet );
662
-						echo wp_kses_post( '</div>' );
663
-						unset( $this->options['display'][ $this->search_prefix . '_facets' ][ $facet ] );
664
-					}
665
-				}
666
-			} else {
667
-				echo wp_kses_post( '<div class="row">' );
668
-					$this->display_facet_search();
669
-				echo wp_kses_post( '</div>' );
670
-			}
671
-		}
672
-	}
673
-
674
-	/**
675
-	 * Overrides the search facet HTML
676
-	 * @param $output
677
-	 * @param $params
678
-	 *
679
-	 * @return string
680
-	 */
681
-	public function search_facet_html( $output, $params ) {
682
-		if ( 'search' == $params['facet']['type'] ) {
683
-
684
-			$value = (array) $params['selected_values'];
685
-			$value = empty( $value ) ? '' : stripslashes( $value[0] );
686
-			$placeholder = isset( $params['facet']['placeholder'] ) ? $params['facet']['placeholder'] : __( 'Search...', 'lsx-search' );
687
-			$placeholder = facetwp_i18n( $placeholder );
688
-
689
-			ob_start();
690
-			?>
12
+     /**
13
+      * Holds class instance
14
+      *
15
+      * @since 1.0.0
16
+      *
17
+      * @var      object \lsx\search\classes\Frontend()
18
+      */
19
+     protected static $instance = null;
20
+
21
+     public $options = false;
22
+
23
+     public $tabs = false;
24
+
25
+     public $facet_data = false;
26
+
27
+     /**
28
+      * Determine weather or not search is enabled for this page.
29
+      *
30
+      * @var boolean
31
+      */
32
+     public $search_enabled = false;
33
+
34
+     public $search_core_suffix = false;
35
+
36
+     public $search_prefix = false;
37
+
38
+     /**
39
+      * Holds the post types enabled
40
+      *
41
+      * @var array
42
+      */
43
+     public $post_types = array();
44
+
45
+     /**
46
+      * Holds the taxonomies enabled for search
47
+      *
48
+      * @var array
49
+      */
50
+     public $taxonomies = array();
51
+
52
+     /**
53
+      * If the current search page has posts or not
54
+      *
55
+      * @var boolean
56
+      */
57
+     public $has_posts = false;
58
+
59
+     /**
60
+      * If we are using the CMB2 options or not.
61
+      *
62
+      * @var boolean
63
+      */
64
+     public $new_options = false;
65
+
66
+     /**
67
+      * Construct method.
68
+      */
69
+     public function __construct() {
70
+          $this->options = \lsx\search\includes\get_options();
71
+          $this->load_classes();
72
+
73
+          add_filter( 'wpseo_json_ld_search_url', array( $this, 'change_json_ld_search_url' ), 10, 1 );
74
+          add_action( 'wp', array( $this, 'set_vars' ), 21 );
75
+          add_action( 'wp', array( $this, 'set_facetwp_vars' ), 22 );
76
+          add_action( 'wp', array( $this, 'core' ), 23 );
77
+          add_action( 'lsx_body_top', array( $this, 'check_for_results' ) );
78
+
79
+          add_filter( 'pre_get_posts', array( $this, 'ignore_sticky_search' ) );
80
+          add_action( 'pre_get_posts', array( $this, 'filter_post_types' ) );
81
+
82
+          add_filter( 'lsx_search_post_types', array( $this, 'register_post_types' ) );
83
+          add_filter( 'lsx_search_taxonomies', array( $this, 'register_taxonomies' ) );
84
+          add_filter( 'lsx_search_post_types_plural', array( $this, 'register_post_type_tabs' ) );
85
+          add_filter( 'facetwp_sort_options', array( $this, 'facetwp_sort_options' ), 10, 2 );
86
+          add_filter( 'wp_kses_allowed_html', array( $this, 'kses_allowed_html' ), 20, 2 );
87
+          add_filter( 'get_search_query', array( $this, 'get_search_query' ) );
88
+
89
+          // Redirects.
90
+          add_action( 'template_redirect', array( $this, 'pretty_search_redirect' ) );
91
+          add_filter( 'pre_get_posts', array( $this, 'pretty_search_parse_query' ) );
92
+
93
+          add_action( 'lsx_search_sidebar_top', array( $this, 'search_sidebar_top' ) );
94
+          add_filter( 'facetwp_facet_html', array( $this, 'search_facet_html' ), 10, 2 );
95
+     }
96
+
97
+     /**
98
+      * Return an instance of this class.
99
+      *
100
+      * @since 1.0.0
101
+      *
102
+      * @return    object \lsx\member_directory\search\Frontend()    A single instance of this class.
103
+      */
104
+     public static function get_instance() {
105
+          // If the single instance hasn't been set, set it now.
106
+          if ( null === self::$instance ) {
107
+               self::$instance = new self();
108
+          }
109
+          return self::$instance;
110
+     }
111
+
112
+     /**
113
+      * Loads the variable classes and the static classes.
114
+      */
115
+     private function load_classes() {
116
+          require_once LSX_SEARCH_PATH . 'classes/frontend/class-layout.php';
117
+          $this->layout = frontend\Layout::get_instance();
118
+     }
119
+
120
+     /**
121
+      * Check all settings.
122
+      */
123
+     public function set_vars() {
124
+          $post_type = '';
125
+
126
+          $this->post_types      = apply_filters( 'lsx_search_post_types', array() );
127
+          $this->taxonomies      = apply_filters( 'lsx_search_taxonomies', array() );
128
+          $this->tabs            = apply_filters( 'lsx_search_post_types_plural', array() );
129
+          $this->options         = apply_filters( 'lsx_search_options', $this->options );
130
+          $this->post_types      = get_post_types();
131
+          $this->post_type_slugs = array(
132
+               'post'        => 'posts',
133
+               'project'     => 'projects',
134
+               'service'     => 'services',
135
+               'team'        => 'team',
136
+               'testimonial' => 'testimonials',
137
+               'video'       => 'videos',
138
+               'product'     => 'products',
139
+          );
140
+          $this->set_search_prefix();
141
+          $this->get_cmb2_options();
142
+          $this->search_enabled = apply_filters( 'lsx_search_enabled', $this->is_search_enabled(), $this );
143
+          $this->search_prefix  = apply_filters( 'lsx_search_prefix', $this->search_prefix, $this );
144
+     }
145
+
146
+     private function get_cmb2_options() {
147
+          $cmb2_options = get_option( 'lsx-search-settings' );
148
+          if ( false !== $cmb2_options && ! empty( $cmb2_options ) ) {
149
+               $this->set_search_prefix( true );
150
+               $this->options['display'] = $cmb2_options;
151
+               foreach ( $this->options['display'] as $option_key => $option_value ) {
152
+                    if ( is_array( $option_value ) && ! empty( $option_value ) ) {
153
+                         $new_values = array();
154
+                         foreach ( $option_value as $empty_key => $key_value ) {
155
+                              $new_values[ $key_value ] = 'on';
156
+                         }
157
+                         $this->options['display'][ $option_key ] = $new_values;
158
+                    }
159
+               }
160
+               $this->new_options = true;
161
+               $this->disable_to_search_actions();
162
+          }
163
+     }
164
+
165
+     private function disable_to_search_actions() {
166
+          global $lsx_to_search_fwp, $lsx_to_search;
167
+          if ( null !== $lsx_to_search ) {
168
+               // Redirects.
169
+               remove_filter( 'template_include', array( $lsx_to_search, 'search_template_include' ), 99 );
170
+               remove_action( 'template_redirect', array( $lsx_to_search, 'pretty_search_redirect' ) );
171
+               remove_filter( 'pre_get_posts', array( $lsx_to_search, 'pretty_search_parse_query' ) );
172
+
173
+               // Layout Filter.
174
+               remove_filter( 'lsx_layout', array( $lsx_to_search, 'lsx_layout' ), 20, 1 );
175
+               remove_filter( 'lsx_layout_selector', array( $lsx_to_search, 'lsx_layout_selector' ), 10, 4 );
176
+               remove_filter( 'lsx_to_archive_layout', array( $lsx_to_search, 'lsx_to_search_archive_layout' ), 10, 2 );
177
+
178
+               remove_action( 'lsx_search_sidebar_top', array( $lsx_to_search, 'search_sidebar_top' ) );
179
+               remove_action( 'pre_get_posts', array( $lsx_to_search, 'price_sorting' ), 100 );
180
+
181
+               //add_shortcode( 'lsx_search_form', array( 'LSX_TO_Search_Frontend', 'search_form' ) );
182
+               remove_filter( 'searchwp_short_circuit', array( $lsx_to_search, 'searchwp_short_circuit' ), 10, 2 );
183
+               remove_filter( 'get_search_query', array( $lsx_to_search, 'get_search_query' ) );
184
+               remove_filter( 'body_class', array( $lsx_to_search, 'to_add_search_url_class' ), 20 );
185
+
186
+               remove_filter( 'facetwp_preload_url_vars', array( $lsx_to_search, 'preload_url_vars' ), 10, 1 );
187
+               remove_filter( 'wpseo_json_ld_search_url', array( $lsx_to_search, 'change_json_ld_search_url' ), 10, 1 );
188
+          }
189
+          if ( null !== $lsx_to_search_fwp ) {
190
+               remove_filter( 'facetwp_indexer_row_data', array( $lsx_to_search_fwp, 'facetwp_index_row_data' ), 10, 2 );
191
+               remove_filter( 'facetwp_index_row', array( $lsx_to_search_fwp, 'facetwp_index_row' ), 10, 2 );
192
+
193
+               remove_filter( 'facetwp_sort_options', array( $lsx_to_search_fwp, 'facet_sort_options' ), 10, 2 );
194
+
195
+               remove_filter( 'facetwp_pager_html', array( $lsx_to_search_fwp, 'facetwp_pager_html' ), 10, 2 );
196
+               remove_filter( 'facetwp_result_count', array( $lsx_to_search_fwp, 'facetwp_result_count' ), 10, 2 );
197
+
198
+               remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'destination_facet_html' ), 10, 2 );
199
+               remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'slide_facet_html' ), 10, 2 );
200
+               remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'search_facet_html' ), 10, 2 );
201
+               remove_filter( 'facetwp_load_css', array( $lsx_to_search_fwp, 'facetwp_load_css' ), 10, 1 );
202
+
203
+               if ( class_exists( 'LSX_Currencies' ) ) {
204
+                    remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_lsx_currencies' ), 10, 2 );
205
+               } else {
206
+                    remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_to_currencies' ), 10, 2 );
207
+               }
208
+          }
209
+     }
210
+
211
+     /**
212
+      * Returns if the search is enabled.
213
+      *
214
+      * @return boolean
215
+      */
216
+     public function is_search_enabled() {
217
+          $search_enabled = false;
218
+
219
+          if ( false === $this->new_options ) {
220
+               if ( isset( $this->options['display'][ $this->search_prefix . '_enable_' . $this->search_core_suffix ] ) && ( ! empty( $this->options ) ) && 'on' == $this->options['display'][ $this->search_prefix . '_enable_' . $this->search_core_suffix ] ) {
221
+                    $search_enabled = true;
222
+               }
223
+          } else {
224
+               $enable_prefix = $this->search_prefix;
225
+               if ( ! empty( $this->options ) && isset( $this->options['display'] ) && isset( $this->options['display'][ $enable_prefix . '_enable' ] ) && 'on' === $this->options['display'][ $enable_prefix . '_enable' ] ) {
226
+                    $search_enabled = true;
227
+               }
228
+          }
229
+
230
+          // These are specific plugin exclusions.
231
+          if ( is_tax( array( 'wcpv_product_vendors' ) ) ) {
232
+               $search_enabled = false;
233
+          }
234
+          return $search_enabled;
235
+     }
236
+
237
+     /**
238
+      * Sets the search prefix.
239
+      *
240
+      * @return void
241
+      */
242
+     private function set_search_prefix( $new_prefixes = false ) {
243
+          $page_for_posts = get_option( 'page_for_posts' );
244
+          if ( false !== $new_prefixes ) {
245
+               $this->taxonomies = array();
246
+               $this->post_types = array();
247
+          }
248
+
249
+          if ( is_search() ) {
250
+               if ( false === $new_prefixes ) {
251
+                    $this->search_core_suffix = 'core';
252
+                    $this->search_prefix      = 'search';
253
+               } else {
254
+                    $this->search_core_suffix = 'enable';
255
+                    $this->search_prefix      = 'engine_search';
256
+               }
257
+          } elseif ( is_post_type_archive( $this->post_types ) || is_tax() || is_page( $page_for_posts ) || is_home() || is_category() || is_tag() ) {
258
+               if ( false === $new_prefixes ) {
259
+                    $this->search_core_suffix = 'search';
260
+               } else {
261
+                    $this->search_core_suffix = 'enable';
262
+               }
263
+
264
+               if ( is_tax() ) {
265
+                    $tax = get_query_var( 'taxonomy' );
266
+                    $tax = get_taxonomy( $tax );
267
+                    $post_type = $tax->object_type[0];
268
+               } else if ( is_page( $page_for_posts ) || is_category() || is_tag() || is_home() ) {
269
+                    $post_type = 'post';
270
+               } else {
271
+                    $post_type = get_query_var( 'post_type' );
272
+               }
273
+
274
+               if ( false === $new_prefixes ) {
275
+                    if ( isset( $this->tabs[ $post_type ] ) ) {
276
+                         $this->search_prefix = $this->tabs[ $post_type ] . '_archive';
277
+                    }
278
+               } else {
279
+                    $this->search_prefix = $post_type . '_search';
280
+               }
281
+          }
282
+     }
283
+
284
+     /**
285
+      * Sets the FacetWP variables.
286
+      */
287
+     public function set_facetwp_vars() {
288
+
289
+          if ( class_exists( 'FacetWP' ) ) {
290
+               $facet_data = FWP()->helper->get_facets();
291
+          }
292
+
293
+          $this->facet_data = array();
294
+
295
+          $this->facet_data['search_form'] = array(
296
+               'name' => 'search_form',
297
+               'label' => esc_html__( 'Search Form', 'lsx-search' ),
298
+          );
299
+
300
+          if ( ! empty( $facet_data ) && is_array( $facet_data ) ) {
301
+               foreach ( $facet_data as $facet ) {
302
+                    $this->facet_data[ $facet['name'] ] = $facet;
303
+               }
304
+          }
305
+     }
306
+
307
+     /**
308
+      * Check all settings.
309
+      */
310
+     public function core() {
311
+
312
+          if ( true === $this->search_enabled ) {
313
+               add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 999 );
314
+
315
+               add_filter( 'lsx_layout', array( $this, 'lsx_layout' ), 20, 1 );
316
+               add_filter( 'lsx_layout_selector', array( $this, 'lsx_layout_selector' ), 10, 4 );
317
+               add_filter( 'lsx_slot_class', array( $this, 'change_slot_column_class' ) );
318
+               add_action( 'lsx_entry_top', array( $this, 'add_label_to_title' ) );
319
+               add_filter( 'body_class', array( $this, 'body_class' ), 10 );
320
+
321
+               add_filter( 'lsx_blog_customizer_top_of_blog_action', array( $this, 'top_of_blog_action' ), 10, 1 );
322
+               add_filter( 'lsx_blog_customizer_blog_description_class', array( $this, 'blog_description_class' ), 10, 1 );
323
+
324
+               if ( class_exists( 'LSX_Videos' ) ) {
325
+                    global $lsx_videos_frontend;
326
+                    remove_action( 'lsx_content_top', array( $lsx_videos_frontend, 'categories_tabs' ), 15 );
327
+               }
328
+
329
+               add_filter( 'lsx_paging_nav_disable', '__return_true' );
330
+               add_action( 'lsx_content_top', array( $this, 'facet_top_bar' ) );
331
+               add_action( 'lsx_content_top', array( $this, 'facetwp_tempate_open' ) );
332
+               add_action( 'lsx_content_bottom', array( $this, 'facetwp_tempate_close' ) );
333
+               add_action( 'lsx_content_bottom', array( $this, 'facet_bottom_bar' ) );
334
+
335
+               if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) && '1c' !== $this->options['display'][ $this->search_prefix . '_layout' ] ) {
336
+                    add_filter( 'lsx_sidebar_enable', array( $this, 'lsx_sidebar_enable' ), 10, 1 );
337
+               }
338
+
339
+               add_action( 'lsx_content_wrap_before', array( $this, 'search_sidebar' ), 150 );
340
+
341
+               if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_category() || is_product_tag() ) ) {
342
+                    remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description' );
343
+                    remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description' );
344
+                    add_filter( 'woocommerce_show_page_title', '__return_false' );
345
+
346
+                    add_filter( 'loop_shop_columns', function() {
347
+                         return 3;
348
+                    } );
349
+
350
+                    // Actions added by LSX theme
351
+                    remove_action( 'lsx_content_wrap_before', 'lsx_global_header' );
352
+
353
+                    // Actions added be LSX theme / woocommerce.php file
354
+                    remove_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 );
355
+                    remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
356
+                    remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 );
357
+                    remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 );
358
+                    remove_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 );
359
+
360
+                    // Actions added be LSX theme / woocommerce.php file
361
+                    remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 );
362
+                    remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
363
+                    remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
364
+                    remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 );
365
+                    remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 );
366
+               }
367
+          }
368
+     }
369
+
370
+     /**
371
+      * Adds a search class to the body to allow the styling of the sidebars etc.
372
+      *
373
+      * @param  array $classes The classes.
374
+      * @return array $classes The classes.
375
+      */
376
+     public function body_class( $classes ) {
377
+          $classes[] = 'lsx-search-enabled';
378
+          return $classes;
379
+     }
380
+
381
+     /**
382
+      * Moves the blog description to above the content columns.
383
+      *
384
+      * @param  string $action
385
+      * @return string $action
386
+      */
387
+     public function top_of_blog_action( $action = '' ) {
388
+          $action = 'lsx_content_wrap_before';
389
+          return $action;
390
+     }
391
+
392
+     /**
393
+      * Adds a class to the blog description.
394
+      *
395
+      * @param  string $action
396
+      * @return string $action
397
+      */
398
+     public function blog_description_class( $class = '' ) {
399
+          $class .= ' col-md-12 search-description';
400
+          return $class;
401
+     }
402
+
403
+     /**
404
+      * Check the $wp_query global to see if there are posts in the current query.
405
+      *
406
+      * @return void
407
+      */
408
+     public function check_for_results() {
409
+          if ( true === $this->search_enabled ) {
410
+               global $wp_query;
411
+               if ( empty( $wp_query->posts ) ) {
412
+                    $this->has_posts = false;
413
+                    remove_action( 'lsx_content_top', array( $this, 'facet_top_bar' ) );
414
+                    remove_action( 'lsx_content_bottom', array( $this, 'facet_bottom_bar' ) );
415
+                    remove_action( 'lsx_content_wrap_before', array( $this, 'search_sidebar' ), 150 );
416
+               } else {
417
+                    $this->has_posts = true;
418
+               }
419
+          }
420
+     }
421
+
422
+     /**
423
+      * Filter the post types.
424
+      */
425
+     public function filter_post_types( $query ) {
426
+          if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) {
427
+               if ( ! empty( $this->options ) && ! empty( $this->options['display']['search_enable_core'] ) ) {
428
+                    if ( ! empty( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) {
429
+                         $post_types = array_keys( $this->options['general']['search_post_types'] );
430
+                         $query->set( 'post_type', $post_types );
431
+                    }
432
+               }
433
+          }
434
+     }
435
+
436
+     /**
437
+      * Sets post types with active search options.
438
+      */
439
+     public function register_post_types( $post_types ) {
440
+          $post_types = array( 'post', 'project', 'service', 'team', 'testimonial', 'video', 'product' );
441
+          return $post_types;
442
+     }
443
+
444
+     /**
445
+      * Sets taxonomies with active search options.
446
+      */
447
+     public function register_taxonomies( $taxonomies ) {
448
+          $taxonomies = array( 'category', 'post_tag', 'project-group', 'service-group', 'team_role', 'video-category', 'product_cat', 'product_tag' );
449
+          return $taxonomies;
450
+     }
451
+
452
+     /**
453
+      * Sets post types with active search options.
454
+      */
455
+     public function register_post_type_tabs( $post_types_plural ) {
456
+          $post_types_plural = array(
457
+               'post' => 'posts',
458
+               'project' => 'projects',
459
+               'service' => 'services',
460
+               'team' => 'team',
461
+               'testimonial' => 'testimonials',
462
+               'video' => 'videos',
463
+               'product' => 'products', // WooCommerce
464
+          );
465
+          return $post_types_plural;
466
+     }
467
+
468
+     /**
469
+      * Enqueue styles and scripts.
470
+      */
471
+     public function assets() {
472
+          add_filter( 'lsx_defer_parsing_of_js', array( $this, 'skip_js_defer' ), 10, 4 );
473
+          wp_enqueue_script( 'touchSwipe', LSX_SEARCH_URL . 'assets/js/vendor/jquery.touchSwipe.min.js', array( 'jquery' ), LSX_SEARCH_VER, true );
474
+          wp_enqueue_script( 'slideandswipe', LSX_SEARCH_URL . 'assets/js/vendor/jquery.slideandswipe.min.js', array( 'jquery', 'touchSwipe' ), LSX_SEARCH_VER, true );
475
+          wp_enqueue_script( 'lsx-search', LSX_SEARCH_URL . 'assets/js/src/lsx-search.js', array( 'jquery', 'touchSwipe', 'slideandswipe', 'jquery-ui-datepicker' ), LSX_SEARCH_VER, true );
476
+
477
+          $params = apply_filters( 'lsx_search_js_params', array(
478
+               'ajax_url' => admin_url( 'admin-ajax.php' ),
479
+          ));
480
+
481
+          wp_localize_script( 'lsx-search', 'lsx_customizer_params', $params );
482
+
483
+          wp_enqueue_style( 'lsx-search', LSX_SEARCH_URL . 'assets/css/lsx-search.css', array(), LSX_SEARCH_VER );
484
+          wp_style_add_data( 'lsx-search', 'rtl', 'replace' );
485
+
486
+          if ( true === $this->new_options ) {
487
+               wp_deregister_style( 'lsx_to_search' );
488
+               wp_deregister_script( 'lsx_to_search' );
489
+          }
490
+     }
491
+
492
+     /**
493
+      * Adds the to-search.min.js and the to-search.js
494
+      *
495
+      * @param boolean $should_skip
496
+      * @param string  $tag
497
+      * @param string  $handle
498
+      * @param string  $href
499
+      * @return boolean
500
+      */
501
+     public function skip_js_defer( $should_skip, $tag, $handle, $href ) {
502
+          if ( ! is_admin() && ( false !== stripos( $href, 'lsx-search.min.js' ) || false !== stripos( $href, 'lsx-search.js' ) ) ) {
503
+               $should_skip = true;
504
+          }
505
+          return $should_skip;
506
+     }
507
+
508
+     /**
509
+      * Redirect wordpress to the search template located in the plugin
510
+      *
511
+      * @param	$template
512
+      * @return	$template
513
+      */
514
+     public function search_template_include( $template ) {
515
+          if ( is_main_query() && is_search() ) {
516
+               if ( file_exists( LSX_SEARCH_PATH . 'templates/search.php' ) ) {
517
+                    $template = LSX_SEARCH_PATH . 'templates/search.php';
518
+               }
519
+          }
520
+
521
+          return $template;
522
+     }
523
+
524
+     /**
525
+      * Ignore sticky posts on Blog search.
526
+      *
527
+      * @param [type] $query
528
+      * @return void
529
+      */
530
+     public function ignore_sticky_search( $query ) {
531
+          if ( $query->is_main_query() && is_home() ) {
532
+               $query->set( 'ignore_sticky_posts', true );
533
+          }
534
+     }
535
+
536
+     /**
537
+      * Rewrite the search URL
538
+      */
539
+     public function pretty_search_redirect() {
540
+          global $wp_rewrite,$wp_query;
541
+
542
+          if ( ! isset( $wp_rewrite ) || ! is_object( $wp_rewrite ) || ! $wp_rewrite->using_permalinks() ) {
543
+               return;
544
+          }
545
+
546
+          $search_base = $wp_rewrite->search_base;
547
+
548
+          if ( is_search() && ! is_admin() && strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) === false ) {
549
+               $search_query = get_query_var( 's' );
550
+               if ( empty( $search_query ) && isset( $_GET['s'] ) ) {
551
+                    $search_query = $_GET['s'];
552
+               }
553
+               $engine = '';
554
+
555
+               // If the search was triggered by a supplemental engine.
556
+               if ( isset( $_GET['engine'] ) && 'default' !== $_GET['engine'] ) {
557
+                    $engine = sanitize_text_field( wp_unslash( $_GET['engine'] ) );
558
+                    $index  = array_search( $engine, $this->post_type_slugs, true );
559
+                    if ( false !== $index ) {
560
+                         $engine = $index;
561
+                    }
562
+                    $engine = $engine . '/';
563
+               }
564
+
565
+               $get_array = $_GET;
566
+
567
+               if ( is_array( $get_array ) && ! empty( $get_array ) ) {
568
+                    $vars_to_maintain = array();
569
+
570
+                    foreach ( $get_array as $ga_key => $ga_value ) {
571
+                         if ( false !== strpos( $ga_key, 'fwp_' ) ) {
572
+                              $vars_to_maintain[] = $ga_key . '=' . $ga_value;
573
+                         }
574
+                    }
575
+               }
576
+
577
+               $redirect_url = home_url( "/{$search_base}/" . $engine . urlencode( $search_query ) );
578
+
579
+               if ( ! empty( $vars_to_maintain ) ) {
580
+                    $redirect_url .= '?' . implode( '&', $vars_to_maintain );
581
+               }
582
+               wp_redirect( $redirect_url );
583
+               exit();
584
+          }
585
+     }
586
+
587
+     /**
588
+      * Parse the Query and trigger a search
589
+      */
590
+     public function pretty_search_parse_query( $query ) {
591
+          $this->post_type_slugs = array(
592
+               'post' => 'posts',
593
+               'project' => 'projects',
594
+               'service' => 'services',
595
+               'team' => 'team',
596
+               'testimonial' => 'testimonials',
597
+               'video' => 'videos',
598
+               'product' => 'products', // WooCommerce
599
+          );
600
+          if ( $query->is_search() && ! is_admin() && $query->is_main_query() ) {
601
+               $search_query = $query->get( 's' );
602
+               $keyword_test = explode( '/', $search_query );
603
+
604
+               $index = array_search( $keyword_test[0], $this->post_type_slugs, true );
605
+               if ( false !== $index ) {
606
+                    $engine = $this->post_type_slugs[ $index ];
607
+
608
+                    $query->set( 'post_type', $engine );
609
+                    $query->set( 'engine', $engine );
610
+
611
+                    if ( count( $keyword_test ) > 1 ) {
612
+                         $query->set( 's', $keyword_test[1] );
613
+                    } elseif ( post_type_exists( $engine ) ) {
614
+                         $query->set( 's', '' );
615
+                    }
616
+               } else {
617
+                    if ( isset( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) {
618
+                         $post_types = array_keys( $this->options['general']['search_post_types'] );
619
+                         $query->set( 'post_type', $post_types );
620
+                    }
621
+               }
622
+          }
623
+          return $query;
624
+     }
625
+
626
+     /**
627
+      * Change the search slug to /search/ for the JSON+LD output in Yoast SEO
628
+      *
629
+      * @return url
630
+      */
631
+     public function change_json_ld_search_url() {
632
+          return trailingslashit( home_url() ) . 'search/{search_term_string}';
633
+     }
634
+
635
+     /**
636
+      * A filter to set the layout to 2 column.
637
+      */
638
+     public function lsx_layout( $layout ) {
639
+          if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) {
640
+               if ( false === $this->has_posts ) {
641
+                    $layout = '1c';
642
+               } else {
643
+                    $layout = $this->options['display'][ $this->search_prefix . '_layout' ];
644
+               }
645
+          }
646
+          return $layout;
647
+     }
648
+
649
+     /**
650
+      * Outputs the Search Title Facet
651
+      */
652
+     public function search_sidebar_top() {
653
+          if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) && true !== apply_filters( 'lsx_search_hide_search_box', false ) ) {
654
+
655
+               if ( ! is_search() ) {
656
+
657
+                    foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
658
+
659
+                         if ( isset( $this->facet_data[ $facet ] ) && 'search' === $this->facet_data[ $facet ]['type'] ) {
660
+                              echo wp_kses_post( '<div class="row">' );
661
+                                   $this->display_facet_default( $facet );
662
+                              echo wp_kses_post( '</div>' );
663
+                              unset( $this->options['display'][ $this->search_prefix . '_facets' ][ $facet ] );
664
+                         }
665
+                    }
666
+               } else {
667
+                    echo wp_kses_post( '<div class="row">' );
668
+                         $this->display_facet_search();
669
+                    echo wp_kses_post( '</div>' );
670
+               }
671
+          }
672
+     }
673
+
674
+     /**
675
+      * Overrides the search facet HTML
676
+      * @param $output
677
+      * @param $params
678
+      *
679
+      * @return string
680
+      */
681
+     public function search_facet_html( $output, $params ) {
682
+          if ( 'search' == $params['facet']['type'] ) {
683
+
684
+               $value = (array) $params['selected_values'];
685
+               $value = empty( $value ) ? '' : stripslashes( $value[0] );
686
+               $placeholder = isset( $params['facet']['placeholder'] ) ? $params['facet']['placeholder'] : __( 'Search...', 'lsx-search' );
687
+               $placeholder = facetwp_i18n( $placeholder );
688
+
689
+               ob_start();
690
+               ?>
691 691
 			<div class="col-xs-12 facetwp-item facetwp-form">
692 692
 				<div class="search-form lsx-search-form 2">
693 693
 					<div class="input-group facetwp-search-wrap">
@@ -702,75 +702,75 @@  discard block
 block discarded – undo
702 702
 				</div>
703 703
 			</div>
704 704
 			<?php
705
-			$output = ob_get_clean();
706
-		}
707
-		return $output;
708
-	}
709
-
710
-	/**
711
-	 * Change the primary and secondary column classes.
712
-	 */
713
-	public function lsx_layout_selector( $return_class, $class, $layout, $size ) {
714
-		if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) {
715
-
716
-			if ( '2cl' === $layout || '2cr' === $layout ) {
717
-				$main_class    = 'col-sm-8 col-md-9';
718
-				$sidebar_class = 'col-sm-4 col-md-3';
719
-
720
-				if ( '2cl' === $layout ) {
721
-					$main_class    .= ' col-sm-pull-4 col-md-pull-3 search-sidebar-left';
722
-					$sidebar_class .= ' col-sm-push-8 col-md-push-9';
723
-				}
724
-
725
-				if ( 'main' === $class ) {
726
-					return $main_class;
727
-				}
728
-
729
-				if ( 'sidebar' === $class ) {
730
-					return $sidebar_class;
731
-				}
732
-			}
733
-		}
734
-
735
-		return $return_class;
736
-	}
737
-
738
-	/**
739
-	 * Displays the Alphabet sorter above the facets.
740
-	 *
741
-	 * @return void
742
-	 */
743
-	public function display_alphabet_facet() {
744
-		if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) {
745
-			$az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ];
746
-		} else {
747
-			$az_pagination = false;
748
-		}
749
-		$az_pagination = apply_filters( 'lsx_search_top_az_pagination', $az_pagination );
750
-		if ( false !== $az_pagination && '' !== $az_pagination ) {
751
-			echo do_shortcode( '[facetwp facet="' . $az_pagination . '"]' );
752
-		}
753
-	}
754
-
755
-	/**
756
-	 * Outputs top.
757
-	 */
758
-	public function facet_top_bar() {
759
-		if ( true === apply_filters( 'lsx_search_hide_top_bar', false ) ) {
760
-			return;
761
-		}
762
-
763
-		$show_pagination     = true;
764
-		$pagination_visible  = false;
765
-		$show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] );
766
-		$show_sort_combo     = empty( $this->options['display'][ $this->search_prefix . '_disable_sorting' ] );
767
-
768
-		$show_pagination     = apply_filters( 'lsx_search_top_show_pagination', $show_pagination );
769
-		$pagination_visible  = apply_filters( 'lsx_search_top_pagination_visible', $pagination_visible );
770
-		$show_per_page_combo = apply_filters( 'lsx_search_top_show_per_page_combo', $show_per_page_combo );
771
-		$show_sort_combo     = apply_filters( 'lsx_search_top_show_sort_combo', $show_sort_combo );
772
-		$facet_row_classes   = apply_filters( 'lsx_search_top_facetwp_row_classes', '' );
773
-		?>
705
+               $output = ob_get_clean();
706
+          }
707
+          return $output;
708
+     }
709
+
710
+     /**
711
+      * Change the primary and secondary column classes.
712
+      */
713
+     public function lsx_layout_selector( $return_class, $class, $layout, $size ) {
714
+          if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) {
715
+
716
+               if ( '2cl' === $layout || '2cr' === $layout ) {
717
+                    $main_class    = 'col-sm-8 col-md-9';
718
+                    $sidebar_class = 'col-sm-4 col-md-3';
719
+
720
+                    if ( '2cl' === $layout ) {
721
+                         $main_class    .= ' col-sm-pull-4 col-md-pull-3 search-sidebar-left';
722
+                         $sidebar_class .= ' col-sm-push-8 col-md-push-9';
723
+                    }
724
+
725
+                    if ( 'main' === $class ) {
726
+                         return $main_class;
727
+                    }
728
+
729
+                    if ( 'sidebar' === $class ) {
730
+                         return $sidebar_class;
731
+                    }
732
+               }
733
+          }
734
+
735
+          return $return_class;
736
+     }
737
+
738
+     /**
739
+      * Displays the Alphabet sorter above the facets.
740
+      *
741
+      * @return void
742
+      */
743
+     public function display_alphabet_facet() {
744
+          if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) {
745
+               $az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ];
746
+          } else {
747
+               $az_pagination = false;
748
+          }
749
+          $az_pagination = apply_filters( 'lsx_search_top_az_pagination', $az_pagination );
750
+          if ( false !== $az_pagination && '' !== $az_pagination ) {
751
+               echo do_shortcode( '[facetwp facet="' . $az_pagination . '"]' );
752
+          }
753
+     }
754
+
755
+     /**
756
+      * Outputs top.
757
+      */
758
+     public function facet_top_bar() {
759
+          if ( true === apply_filters( 'lsx_search_hide_top_bar', false ) ) {
760
+               return;
761
+          }
762
+
763
+          $show_pagination     = true;
764
+          $pagination_visible  = false;
765
+          $show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] );
766
+          $show_sort_combo     = empty( $this->options['display'][ $this->search_prefix . '_disable_sorting' ] );
767
+
768
+          $show_pagination     = apply_filters( 'lsx_search_top_show_pagination', $show_pagination );
769
+          $pagination_visible  = apply_filters( 'lsx_search_top_pagination_visible', $pagination_visible );
770
+          $show_per_page_combo = apply_filters( 'lsx_search_top_show_per_page_combo', $show_per_page_combo );
771
+          $show_sort_combo     = apply_filters( 'lsx_search_top_show_sort_combo', $show_sort_combo );
772
+          $facet_row_classes   = apply_filters( 'lsx_search_top_facetwp_row_classes', '' );
773
+          ?>
774 774
 		<div id="facetwp-top">
775 775
 			<?php if ( $show_sort_combo || ( $show_pagination && $show_per_page_combo ) ) { ?>
776 776
 				<div class="row facetwp-top-row-1 hidden-xs <?php echo esc_attr( $facet_row_classes ); ?>">
@@ -801,32 +801,32 @@  discard block
 block discarded – undo
801 801
 			<?php } ?>
802 802
 		</div>
803 803
 		<?php
804
-	}
805
-
806
-	/**
807
-	 * Outputs bottom.
808
-	 */
809
-	public function facet_bottom_bar() {
810
-		if ( true === apply_filters( 'lsx_search_hide_bottom_bar', false ) ) {
811
-			return;
812
-		}
813
-		$show_pagination    = true;
814
-		$pagination_visible = false;
815
-		if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) {
816
-			$az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ];
817
-		} else {
818
-			$az_pagination = false;
819
-		}
820
-
821
-		$show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] );
822
-		$show_sort_combo     = empty( $this->options['display'][ $this->search_prefix . '_search_disable_sorting' ] );
823
-
824
-		$show_pagination     = apply_filters( 'lsx_search_bottom_show_pagination', $show_pagination );
825
-		$pagination_visible  = apply_filters( 'lsx_search_bottom_pagination_visible', $pagination_visible );
826
-		$show_per_page_combo = apply_filters( 'lsx_search_bottom_show_per_page_combo', $show_per_page_combo );
827
-		$show_sort_combo     = apply_filters( 'lsx_search_bottom_show_sort_combo', $show_sort_combo );
828
-
829
-		if ( $show_pagination || ! empty( $az_pagination ) ) { ?>
804
+     }
805
+
806
+     /**
807
+      * Outputs bottom.
808
+      */
809
+     public function facet_bottom_bar() {
810
+          if ( true === apply_filters( 'lsx_search_hide_bottom_bar', false ) ) {
811
+               return;
812
+          }
813
+          $show_pagination    = true;
814
+          $pagination_visible = false;
815
+          if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) {
816
+               $az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ];
817
+          } else {
818
+               $az_pagination = false;
819
+          }
820
+
821
+          $show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] );
822
+          $show_sort_combo     = empty( $this->options['display'][ $this->search_prefix . '_search_disable_sorting' ] );
823
+
824
+          $show_pagination     = apply_filters( 'lsx_search_bottom_show_pagination', $show_pagination );
825
+          $pagination_visible  = apply_filters( 'lsx_search_bottom_pagination_visible', $pagination_visible );
826
+          $show_per_page_combo = apply_filters( 'lsx_search_bottom_show_per_page_combo', $show_per_page_combo );
827
+          $show_sort_combo     = apply_filters( 'lsx_search_bottom_show_sort_combo', $show_sort_combo );
828
+
829
+          if ( $show_pagination || ! empty( $az_pagination ) ) { ?>
830 830
 			<div id="facetwp-bottom">
831 831
 				<div class="row facetwp-bottom-row-1">
832 832
 					<div class="col-xs-12">
@@ -841,61 +841,61 @@  discard block
 block discarded – undo
841 841
 						<?php //} ?>
842 842
 
843 843
 						<?php
844
-						if ( $show_pagination ) {
845
-							$output_pagination = do_shortcode( '[facetwp pager="true"]' );
846
-							if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) {
847
-								foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
848
-									if ( isset( $this->facet_data[ $facet ] ) && in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) {
849
-										$output_pagination = do_shortcode( '[facetwp facet="pager_"]' );
850
-									}
851
-								}
852
-							}
853
-							echo wp_kses_post( $output_pagination );
854
-						?>
844
+                              if ( $show_pagination ) {
845
+                                   $output_pagination = do_shortcode( '[facetwp pager="true"]' );
846
+                                   if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) {
847
+                                        foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
848
+                                             if ( isset( $this->facet_data[ $facet ] ) && in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) {
849
+                                                  $output_pagination = do_shortcode( '[facetwp facet="pager_"]' );
850
+                                             }
851
+                                        }
852
+                                   }
853
+                                   echo wp_kses_post( $output_pagination );
854
+                              ?>
855 855
 						<?php } ?>
856 856
 					</div>
857 857
 				</div>
858 858
 			</div>
859 859
 		<?php }
860
-	}
861
-
862
-	/**
863
-	 * Adds in the closing facetwp div
864
-	 *
865
-	 * @return void
866
-	 */
867
-	public function facetwp_tempate_open() {
868
-		?>
860
+     }
861
+
862
+     /**
863
+      * Adds in the closing facetwp div
864
+      *
865
+      * @return void
866
+      */
867
+     public function facetwp_tempate_open() {
868
+          ?>
869 869
 		<div class="facetwp-template">
870 870
 		<?php
871
-	}
872
-
873
-	/**
874
-	 * Adds in the closing facetwp div
875
-	 *
876
-	 * @return void
877
-	 */
878
-	public function facetwp_tempate_close() {
879
-		?>
871
+     }
872
+
873
+     /**
874
+      * Adds in the closing facetwp div
875
+      *
876
+      * @return void
877
+      */
878
+     public function facetwp_tempate_close() {
879
+          ?>
880 880
 		</div>
881 881
 		<?php
882
-	}
883
-
884
-	/**
885
-	 * Disables default sidebar.
886
-	 */
887
-	public function lsx_sidebar_enable( $sidebar_enabled ) {
888
-		$sidebar_enabled = false;
889
-		return $sidebar_enabled;
890
-	}
891
-
892
-	/**
893
-	 * Outputs custom sidebar.
894
-	 */
895
-	public function search_sidebar() {
896
-
897
-		$this->options = apply_filters( 'lsx_search_sidebar_options', $this->options );
898
-		?>
882
+     }
883
+
884
+     /**
885
+      * Disables default sidebar.
886
+      */
887
+     public function lsx_sidebar_enable( $sidebar_enabled ) {
888
+          $sidebar_enabled = false;
889
+          return $sidebar_enabled;
890
+     }
891
+
892
+     /**
893
+      * Outputs custom sidebar.
894
+      */
895
+     public function search_sidebar() {
896
+
897
+          $this->options = apply_filters( 'lsx_search_sidebar_options', $this->options );
898
+          ?>
899 899
 			<?php do_action( 'lsx_search_sidebar_before' ); ?>
900 900
 
901 901
 			<div id="secondary" class="facetwp-sidebar widget-area <?php echo esc_attr( lsx_sidebar_class() ); ?>" role="complementary">
@@ -920,13 +920,13 @@  discard block
 block discarded – undo
920 920
 
921 921
 							<div class="row">
922 922
 								<?php
923
-								// Slider.
924
-								foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
925
-									if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'alpha', 'search', 'pager', 'sort', 'autocomplete' ) ) ) {
926
-										$this->display_facet_default( $facet );
927
-									}
928
-								}
929
-								?>
923
+                                        // Slider.
924
+                                        foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
925
+                                             if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'alpha', 'search', 'pager', 'sort', 'autocomplete' ) ) ) {
926
+                                                  $this->display_facet_default( $facet );
927
+                                             }
928
+                                        }
929
+                                        ?>
930 930
 							</div>
931 931
 
932 932
 							<div class="row hidden-sm hidden-md hidden-lg ssm-row-margin-top">
@@ -943,33 +943,33 @@  discard block
 block discarded – undo
943 943
 
944 944
 			<?php do_action( 'lsx_search_sidebar_after' ); ?>
945 945
 		<?php
946
-	}
947
-
948
-	/**
949
-	 * Check if the pager facet is on
950
-	 *
951
-	 * @return void
952
-	 */
953
-	public function pager_facet_enabled() {
954
-
955
-		$pager_facet_off = false;
956
-
957
-		if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) {
958
-			foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
959
-				if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) {
960
-					$pager_facet_off = true;
961
-				}
962
-			}
963
-		}
964
-
965
-		return $pager_facet_off;
966
-	}
967
-
968
-	/**
969
-	 * Display facet search.
970
-	 */
971
-	public function display_facet_search() {
972
-		?>
946
+     }
947
+
948
+     /**
949
+      * Check if the pager facet is on
950
+      *
951
+      * @return void
952
+      */
953
+     public function pager_facet_enabled() {
954
+
955
+          $pager_facet_off = false;
956
+
957
+          if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) {
958
+               foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
959
+                    if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) {
960
+                         $pager_facet_off = true;
961
+                    }
962
+               }
963
+          }
964
+
965
+          return $pager_facet_off;
966
+     }
967
+
968
+     /**
969
+      * Display facet search.
970
+      */
971
+     public function display_facet_search() {
972
+          ?>
973 973
 		<div class="col-xs-12 facetwp-item facetwp-form">
974 974
 			<form class="search-form lsx-search-form" action="<?php echo esc_attr( home_url() ); ?>" method="get">
975 975
 				<div class="input-group">
@@ -984,17 +984,17 @@  discard block
 block discarded – undo
984 984
 			</form>
985 985
 		</div>
986 986
 		<?php
987
-	}
987
+     }
988 988
 
989
-	/**
990
-	 * Display facet default.
991
-	 */
992
-	public function display_facet_default( $facet ) {
989
+     /**
990
+      * Display facet default.
991
+      */
992
+     public function display_facet_default( $facet ) {
993 993
 
994
-		$show_collapse = ! isset( $this->options['display'][$this->search_prefix . '_collapse'] ) || 'on' !== $this->options['display'][$this->search_prefix . '_collapse'];
995
-		$col_class = '';
994
+          $show_collapse = ! isset( $this->options['display'][$this->search_prefix . '_collapse'] ) || 'on' !== $this->options['display'][$this->search_prefix . '_collapse'];
995
+          $col_class = '';
996 996
 
997
-		if ( 'search' === $this->facet_data[ $facet ]['type'] ) : ?>
997
+          if ( 'search' === $this->facet_data[ $facet ]['type'] ) : ?>
998 998
 			<?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?>
999 999
 		<?php else : ?>
1000 1000
 			<div class="col-xs-12 facetwp-item parent-facetwp-facet-<?php echo esc_html( $facet ); ?> <?php echo esc_attr( $col_class ); ?>">
@@ -1012,101 +1012,101 @@  discard block
 block discarded – undo
1012 1012
 				<?php } ?>
1013 1013
 			</div>
1014 1014
 		<?php
1015
-		endif;
1016
-	}
1017
-
1018
-	/**
1019
-	 * Changes slot column class.
1020
-	 */
1021
-	public function change_slot_column_class( $class ) {
1022
-		if ( is_post_type_archive( 'video' ) || is_tax( 'video-category' ) ) {
1023
-			$column_class = 'col-xs-12 col-sm-4';
1024
-		}
1025
-
1026
-		return $column_class;
1027
-	}
1028
-
1029
-	/**
1030
-	 * Add post type label to the title.
1031
-	 */
1032
-	public function add_label_to_title() {
1033
-		if ( is_search() ) {
1034
-			if ( ! empty( $this->options['display']['engine_search_enable_pt_label'] ) ) {
1035
-				$post_type = get_post_type();
1036
-				$post_type = str_replace( '_', ' ', $post_type );
1037
-				$post_type = str_replace( '-', ' ', $post_type );
1038
-				if ( 'tribe events' === $post_type ) {
1039
-					$post_type = 'Events';
1040
-				}
1041
-				echo wp_kses_post( ' <span class="label label-default lsx-label-post-type">' . $post_type . '</span>' );
1042
-			}
1043
-		}
1044
-	}
1045
-
1046
-	/**
1047
-	 * Changes the sort options.
1048
-	 */
1049
-	public function facetwp_sort_options( $options, $params ) {
1050
-		$this->set_vars();
1051
-
1052
-		if ( true === $this->search_enabled ) {
1053
-			if ( 'default' !== $params['template_name'] && 'wp' !== $params['template_name'] ) {
1054
-				return $options;
1055
-			}
1056
-
1057
-			if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_date' ] ) ) {
1058
-				unset( $options['date_desc'] );
1059
-				unset( $options['date_asc'] );
1060
-			}
1061
-
1062
-			if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_az_sorting' ] ) ) {
1063
-				unset( $options['title_desc'] );
1064
-				unset( $options['title_asc'] );
1065
-			}
1066
-		}
1067
-
1068
-		return $options;
1069
-	}
1070
-
1071
-	/**
1072
-	 * @param $allowedtags
1073
-	 * @param $context
1074
-	 *
1075
-	 * @return mixed
1076
-	 */
1077
-	public function kses_allowed_html( $allowedtags, $context ) {
1078
-		$allowedtags['a']['data-value'] = true;
1079
-		$allowedtags['a']['data-selection']  = true;
1080
-		$allowedtags['button']['data-toggle'] = true;
1081
-		return $allowedtags;
1082
-	}
1083
-
1084
-	/**
1085
-	 * Change FaceWP result count HTML
1086
-	 */
1087
-	public function get_search_query( $keyword ) {
1088
-		global $wp_rewrite,$wp_query;
1089
-
1090
-		if ( empty( $keyword ) ) {
1091
-			if ( ! isset( $wp_rewrite ) || ! is_object( $wp_rewrite ) || ! $wp_rewrite->using_permalinks() ) {
1092
-				return;
1093
-			}
1094
-			$search_base = $wp_rewrite->search_base;
1095
-			if ( strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) !== false ) {
1096
-				$words = explode( "/{$search_base}/", $_SERVER['REQUEST_URI'] );
1097
-				$limit = count( $words );
1098
-				if ( isset( $words[ $limit - 1 ] ) ) {
1099
-					$keyword = $words[ $limit - 1 ];
1100
-				}
1101
-			}
1102
-		}
1103
-
1104
-		$needle = trim( '/ ' );
1105
-		$words = explode( $needle, $keyword );
1106
-		if ( is_array( $words ) && ! empty( $words ) ) {
1107
-			$keyword = $words[ count( $words ) - 1 ];
1108
-		}
1109
-		$keyword = str_replace( '+', ' ', $keyword );
1110
-		return $keyword;
1111
-	}
1015
+          endif;
1016
+     }
1017
+
1018
+     /**
1019
+      * Changes slot column class.
1020
+      */
1021
+     public function change_slot_column_class( $class ) {
1022
+          if ( is_post_type_archive( 'video' ) || is_tax( 'video-category' ) ) {
1023
+               $column_class = 'col-xs-12 col-sm-4';
1024
+          }
1025
+
1026
+          return $column_class;
1027
+     }
1028
+
1029
+     /**
1030
+      * Add post type label to the title.
1031
+      */
1032
+     public function add_label_to_title() {
1033
+          if ( is_search() ) {
1034
+               if ( ! empty( $this->options['display']['engine_search_enable_pt_label'] ) ) {
1035
+                    $post_type = get_post_type();
1036
+                    $post_type = str_replace( '_', ' ', $post_type );
1037
+                    $post_type = str_replace( '-', ' ', $post_type );
1038
+                    if ( 'tribe events' === $post_type ) {
1039
+                         $post_type = 'Events';
1040
+                    }
1041
+                    echo wp_kses_post( ' <span class="label label-default lsx-label-post-type">' . $post_type . '</span>' );
1042
+               }
1043
+          }
1044
+     }
1045
+
1046
+     /**
1047
+      * Changes the sort options.
1048
+      */
1049
+     public function facetwp_sort_options( $options, $params ) {
1050
+          $this->set_vars();
1051
+
1052
+          if ( true === $this->search_enabled ) {
1053
+               if ( 'default' !== $params['template_name'] && 'wp' !== $params['template_name'] ) {
1054
+                    return $options;
1055
+               }
1056
+
1057
+               if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_date' ] ) ) {
1058
+                    unset( $options['date_desc'] );
1059
+                    unset( $options['date_asc'] );
1060
+               }
1061
+
1062
+               if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_az_sorting' ] ) ) {
1063
+                    unset( $options['title_desc'] );
1064
+                    unset( $options['title_asc'] );
1065
+               }
1066
+          }
1067
+
1068
+          return $options;
1069
+     }
1070
+
1071
+     /**
1072
+      * @param $allowedtags
1073
+      * @param $context
1074
+      *
1075
+      * @return mixed
1076
+      */
1077
+     public function kses_allowed_html( $allowedtags, $context ) {
1078
+          $allowedtags['a']['data-value'] = true;
1079
+          $allowedtags['a']['data-selection']  = true;
1080
+          $allowedtags['button']['data-toggle'] = true;
1081
+          return $allowedtags;
1082
+     }
1083
+
1084
+     /**
1085
+      * Change FaceWP result count HTML
1086
+      */
1087
+     public function get_search_query( $keyword ) {
1088
+          global $wp_rewrite,$wp_query;
1089
+
1090
+          if ( empty( $keyword ) ) {
1091
+               if ( ! isset( $wp_rewrite ) || ! is_object( $wp_rewrite ) || ! $wp_rewrite->using_permalinks() ) {
1092
+                    return;
1093
+               }
1094
+               $search_base = $wp_rewrite->search_base;
1095
+               if ( strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) !== false ) {
1096
+                    $words = explode( "/{$search_base}/", $_SERVER['REQUEST_URI'] );
1097
+                    $limit = count( $words );
1098
+                    if ( isset( $words[ $limit - 1 ] ) ) {
1099
+                         $keyword = $words[ $limit - 1 ];
1100
+                    }
1101
+               }
1102
+          }
1103
+
1104
+          $needle = trim( '/ ' );
1105
+          $words = explode( $needle, $keyword );
1106
+          if ( is_array( $words ) && ! empty( $words ) ) {
1107
+               $keyword = $words[ count( $words ) - 1 ];
1108
+          }
1109
+          $keyword = str_replace( '+', ' ', $keyword );
1110
+          return $keyword;
1111
+     }
1112 1112
 }
Please login to merge, or discard this patch.
Spacing   +331 added lines, -331 removed lines patch added patch discarded remove patch
@@ -70,28 +70,28 @@  discard block
 block discarded – undo
70 70
 		$this->options = \lsx\search\includes\get_options();
71 71
 		$this->load_classes();
72 72
 
73
-		add_filter( 'wpseo_json_ld_search_url', array( $this, 'change_json_ld_search_url' ), 10, 1 );
74
-		add_action( 'wp', array( $this, 'set_vars' ), 21 );
75
-		add_action( 'wp', array( $this, 'set_facetwp_vars' ), 22 );
76
-		add_action( 'wp', array( $this, 'core' ), 23 );
77
-		add_action( 'lsx_body_top', array( $this, 'check_for_results' ) );
78
-
79
-		add_filter( 'pre_get_posts', array( $this, 'ignore_sticky_search' ) );
80
-		add_action( 'pre_get_posts', array( $this, 'filter_post_types' ) );
81
-
82
-		add_filter( 'lsx_search_post_types', array( $this, 'register_post_types' ) );
83
-		add_filter( 'lsx_search_taxonomies', array( $this, 'register_taxonomies' ) );
84
-		add_filter( 'lsx_search_post_types_plural', array( $this, 'register_post_type_tabs' ) );
85
-		add_filter( 'facetwp_sort_options', array( $this, 'facetwp_sort_options' ), 10, 2 );
86
-		add_filter( 'wp_kses_allowed_html', array( $this, 'kses_allowed_html' ), 20, 2 );
87
-		add_filter( 'get_search_query', array( $this, 'get_search_query' ) );
73
+		add_filter('wpseo_json_ld_search_url', array($this, 'change_json_ld_search_url'), 10, 1);
74
+		add_action('wp', array($this, 'set_vars'), 21);
75
+		add_action('wp', array($this, 'set_facetwp_vars'), 22);
76
+		add_action('wp', array($this, 'core'), 23);
77
+		add_action('lsx_body_top', array($this, 'check_for_results'));
78
+
79
+		add_filter('pre_get_posts', array($this, 'ignore_sticky_search'));
80
+		add_action('pre_get_posts', array($this, 'filter_post_types'));
81
+
82
+		add_filter('lsx_search_post_types', array($this, 'register_post_types'));
83
+		add_filter('lsx_search_taxonomies', array($this, 'register_taxonomies'));
84
+		add_filter('lsx_search_post_types_plural', array($this, 'register_post_type_tabs'));
85
+		add_filter('facetwp_sort_options', array($this, 'facetwp_sort_options'), 10, 2);
86
+		add_filter('wp_kses_allowed_html', array($this, 'kses_allowed_html'), 20, 2);
87
+		add_filter('get_search_query', array($this, 'get_search_query'));
88 88
 
89 89
 		// Redirects.
90
-		add_action( 'template_redirect', array( $this, 'pretty_search_redirect' ) );
91
-		add_filter( 'pre_get_posts', array( $this, 'pretty_search_parse_query' ) );
90
+		add_action('template_redirect', array($this, 'pretty_search_redirect'));
91
+		add_filter('pre_get_posts', array($this, 'pretty_search_parse_query'));
92 92
 
93
-		add_action( 'lsx_search_sidebar_top', array( $this, 'search_sidebar_top' ) );
94
-		add_filter( 'facetwp_facet_html', array( $this, 'search_facet_html' ), 10, 2 );
93
+		add_action('lsx_search_sidebar_top', array($this, 'search_sidebar_top'));
94
+		add_filter('facetwp_facet_html', array($this, 'search_facet_html'), 10, 2);
95 95
 	}
96 96
 
97 97
 	/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public static function get_instance() {
105 105
 		// If the single instance hasn't been set, set it now.
106
-		if ( null === self::$instance ) {
106
+		if (null === self::$instance) {
107 107
 			self::$instance = new self();
108 108
 		}
109 109
 		return self::$instance;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * Loads the variable classes and the static classes.
114 114
 	 */
115 115
 	private function load_classes() {
116
-		require_once LSX_SEARCH_PATH . 'classes/frontend/class-layout.php';
116
+		require_once LSX_SEARCH_PATH.'classes/frontend/class-layout.php';
117 117
 		$this->layout = frontend\Layout::get_instance();
118 118
 	}
119 119
 
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 	public function set_vars() {
124 124
 		$post_type = '';
125 125
 
126
-		$this->post_types      = apply_filters( 'lsx_search_post_types', array() );
127
-		$this->taxonomies      = apply_filters( 'lsx_search_taxonomies', array() );
128
-		$this->tabs            = apply_filters( 'lsx_search_post_types_plural', array() );
129
-		$this->options         = apply_filters( 'lsx_search_options', $this->options );
126
+		$this->post_types      = apply_filters('lsx_search_post_types', array());
127
+		$this->taxonomies      = apply_filters('lsx_search_taxonomies', array());
128
+		$this->tabs            = apply_filters('lsx_search_post_types_plural', array());
129
+		$this->options         = apply_filters('lsx_search_options', $this->options);
130 130
 		$this->post_types      = get_post_types();
131 131
 		$this->post_type_slugs = array(
132 132
 			'post'        => 'posts',
@@ -139,22 +139,22 @@  discard block
 block discarded – undo
139 139
 		);
140 140
 		$this->set_search_prefix();
141 141
 		$this->get_cmb2_options();
142
-		$this->search_enabled = apply_filters( 'lsx_search_enabled', $this->is_search_enabled(), $this );
143
-		$this->search_prefix  = apply_filters( 'lsx_search_prefix', $this->search_prefix, $this );
142
+		$this->search_enabled = apply_filters('lsx_search_enabled', $this->is_search_enabled(), $this);
143
+		$this->search_prefix  = apply_filters('lsx_search_prefix', $this->search_prefix, $this);
144 144
 	}
145 145
 
146 146
 	private function get_cmb2_options() {
147
-		$cmb2_options = get_option( 'lsx-search-settings' );
148
-		if ( false !== $cmb2_options && ! empty( $cmb2_options ) ) {
149
-			$this->set_search_prefix( true );
147
+		$cmb2_options = get_option('lsx-search-settings');
148
+		if (false !== $cmb2_options && !empty($cmb2_options)) {
149
+			$this->set_search_prefix(true);
150 150
 			$this->options['display'] = $cmb2_options;
151
-			foreach ( $this->options['display'] as $option_key => $option_value ) {
152
-				if ( is_array( $option_value ) && ! empty( $option_value ) ) {
151
+			foreach ($this->options['display'] as $option_key => $option_value) {
152
+				if (is_array($option_value) && !empty($option_value)) {
153 153
 					$new_values = array();
154
-					foreach ( $option_value as $empty_key => $key_value ) {
155
-						$new_values[ $key_value ] = 'on';
154
+					foreach ($option_value as $empty_key => $key_value) {
155
+						$new_values[$key_value] = 'on';
156 156
 					}
157
-					$this->options['display'][ $option_key ] = $new_values;
157
+					$this->options['display'][$option_key] = $new_values;
158 158
 				}
159 159
 			}
160 160
 			$this->new_options = true;
@@ -164,46 +164,46 @@  discard block
 block discarded – undo
164 164
 
165 165
 	private function disable_to_search_actions() {
166 166
 		global $lsx_to_search_fwp, $lsx_to_search;
167
-		if ( null !== $lsx_to_search ) {
167
+		if (null !== $lsx_to_search) {
168 168
 			// Redirects.
169
-			remove_filter( 'template_include', array( $lsx_to_search, 'search_template_include' ), 99 );
170
-			remove_action( 'template_redirect', array( $lsx_to_search, 'pretty_search_redirect' ) );
171
-			remove_filter( 'pre_get_posts', array( $lsx_to_search, 'pretty_search_parse_query' ) );
169
+			remove_filter('template_include', array($lsx_to_search, 'search_template_include'), 99);
170
+			remove_action('template_redirect', array($lsx_to_search, 'pretty_search_redirect'));
171
+			remove_filter('pre_get_posts', array($lsx_to_search, 'pretty_search_parse_query'));
172 172
 
173 173
 			// Layout Filter.
174
-			remove_filter( 'lsx_layout', array( $lsx_to_search, 'lsx_layout' ), 20, 1 );
175
-			remove_filter( 'lsx_layout_selector', array( $lsx_to_search, 'lsx_layout_selector' ), 10, 4 );
176
-			remove_filter( 'lsx_to_archive_layout', array( $lsx_to_search, 'lsx_to_search_archive_layout' ), 10, 2 );
174
+			remove_filter('lsx_layout', array($lsx_to_search, 'lsx_layout'), 20, 1);
175
+			remove_filter('lsx_layout_selector', array($lsx_to_search, 'lsx_layout_selector'), 10, 4);
176
+			remove_filter('lsx_to_archive_layout', array($lsx_to_search, 'lsx_to_search_archive_layout'), 10, 2);
177 177
 
178
-			remove_action( 'lsx_search_sidebar_top', array( $lsx_to_search, 'search_sidebar_top' ) );
179
-			remove_action( 'pre_get_posts', array( $lsx_to_search, 'price_sorting' ), 100 );
178
+			remove_action('lsx_search_sidebar_top', array($lsx_to_search, 'search_sidebar_top'));
179
+			remove_action('pre_get_posts', array($lsx_to_search, 'price_sorting'), 100);
180 180
 
181 181
 			//add_shortcode( 'lsx_search_form', array( 'LSX_TO_Search_Frontend', 'search_form' ) );
182
-			remove_filter( 'searchwp_short_circuit', array( $lsx_to_search, 'searchwp_short_circuit' ), 10, 2 );
183
-			remove_filter( 'get_search_query', array( $lsx_to_search, 'get_search_query' ) );
184
-			remove_filter( 'body_class', array( $lsx_to_search, 'to_add_search_url_class' ), 20 );
182
+			remove_filter('searchwp_short_circuit', array($lsx_to_search, 'searchwp_short_circuit'), 10, 2);
183
+			remove_filter('get_search_query', array($lsx_to_search, 'get_search_query'));
184
+			remove_filter('body_class', array($lsx_to_search, 'to_add_search_url_class'), 20);
185 185
 
186
-			remove_filter( 'facetwp_preload_url_vars', array( $lsx_to_search, 'preload_url_vars' ), 10, 1 );
187
-			remove_filter( 'wpseo_json_ld_search_url', array( $lsx_to_search, 'change_json_ld_search_url' ), 10, 1 );
186
+			remove_filter('facetwp_preload_url_vars', array($lsx_to_search, 'preload_url_vars'), 10, 1);
187
+			remove_filter('wpseo_json_ld_search_url', array($lsx_to_search, 'change_json_ld_search_url'), 10, 1);
188 188
 		}
189
-		if ( null !== $lsx_to_search_fwp ) {
190
-			remove_filter( 'facetwp_indexer_row_data', array( $lsx_to_search_fwp, 'facetwp_index_row_data' ), 10, 2 );
191
-			remove_filter( 'facetwp_index_row', array( $lsx_to_search_fwp, 'facetwp_index_row' ), 10, 2 );
189
+		if (null !== $lsx_to_search_fwp) {
190
+			remove_filter('facetwp_indexer_row_data', array($lsx_to_search_fwp, 'facetwp_index_row_data'), 10, 2);
191
+			remove_filter('facetwp_index_row', array($lsx_to_search_fwp, 'facetwp_index_row'), 10, 2);
192 192
 
193
-			remove_filter( 'facetwp_sort_options', array( $lsx_to_search_fwp, 'facet_sort_options' ), 10, 2 );
193
+			remove_filter('facetwp_sort_options', array($lsx_to_search_fwp, 'facet_sort_options'), 10, 2);
194 194
 
195
-			remove_filter( 'facetwp_pager_html', array( $lsx_to_search_fwp, 'facetwp_pager_html' ), 10, 2 );
196
-			remove_filter( 'facetwp_result_count', array( $lsx_to_search_fwp, 'facetwp_result_count' ), 10, 2 );
195
+			remove_filter('facetwp_pager_html', array($lsx_to_search_fwp, 'facetwp_pager_html'), 10, 2);
196
+			remove_filter('facetwp_result_count', array($lsx_to_search_fwp, 'facetwp_result_count'), 10, 2);
197 197
 
198
-			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'destination_facet_html' ), 10, 2 );
199
-			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'slide_facet_html' ), 10, 2 );
200
-			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'search_facet_html' ), 10, 2 );
201
-			remove_filter( 'facetwp_load_css', array( $lsx_to_search_fwp, 'facetwp_load_css' ), 10, 1 );
198
+			remove_filter('facetwp_facet_html', array($lsx_to_search_fwp, 'destination_facet_html'), 10, 2);
199
+			remove_filter('facetwp_facet_html', array($lsx_to_search_fwp, 'slide_facet_html'), 10, 2);
200
+			remove_filter('facetwp_facet_html', array($lsx_to_search_fwp, 'search_facet_html'), 10, 2);
201
+			remove_filter('facetwp_load_css', array($lsx_to_search_fwp, 'facetwp_load_css'), 10, 1);
202 202
 
203
-			if ( class_exists( 'LSX_Currencies' ) ) {
204
-				remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_lsx_currencies' ), 10, 2 );
203
+			if (class_exists('LSX_Currencies')) {
204
+				remove_filter('facetwp_render_output', array($lsx_to_search_fwp, 'slide_price_lsx_currencies'), 10, 2);
205 205
 			} else {
206
-				remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_to_currencies' ), 10, 2 );
206
+				remove_filter('facetwp_render_output', array($lsx_to_search_fwp, 'slide_price_to_currencies'), 10, 2);
207 207
 			}
208 208
 		}
209 209
 	}
@@ -216,19 +216,19 @@  discard block
 block discarded – undo
216 216
 	public function is_search_enabled() {
217 217
 		$search_enabled = false;
218 218
 
219
-		if ( false === $this->new_options ) {
220
-			if ( isset( $this->options['display'][ $this->search_prefix . '_enable_' . $this->search_core_suffix ] ) && ( ! empty( $this->options ) ) && 'on' == $this->options['display'][ $this->search_prefix . '_enable_' . $this->search_core_suffix ] ) {
219
+		if (false === $this->new_options) {
220
+			if (isset($this->options['display'][$this->search_prefix.'_enable_'.$this->search_core_suffix]) && (!empty($this->options)) && 'on' == $this->options['display'][$this->search_prefix.'_enable_'.$this->search_core_suffix]) {
221 221
 				$search_enabled = true;
222 222
 			}
223 223
 		} else {
224 224
 			$enable_prefix = $this->search_prefix;
225
-			if ( ! empty( $this->options ) && isset( $this->options['display'] ) && isset( $this->options['display'][ $enable_prefix . '_enable' ] ) && 'on' === $this->options['display'][ $enable_prefix . '_enable' ] ) {
225
+			if (!empty($this->options) && isset($this->options['display']) && isset($this->options['display'][$enable_prefix.'_enable']) && 'on' === $this->options['display'][$enable_prefix.'_enable']) {
226 226
 				$search_enabled = true;
227 227
 			}
228 228
 		}
229 229
 
230 230
 		// These are specific plugin exclusions.
231
-		if ( is_tax( array( 'wcpv_product_vendors' ) ) ) {
231
+		if (is_tax(array('wcpv_product_vendors'))) {
232 232
 			$search_enabled = false;
233 233
 		}
234 234
 		return $search_enabled;
@@ -239,44 +239,44 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @return void
241 241
 	 */
242
-	private function set_search_prefix( $new_prefixes = false ) {
243
-		$page_for_posts = get_option( 'page_for_posts' );
244
-		if ( false !== $new_prefixes ) {
242
+	private function set_search_prefix($new_prefixes = false) {
243
+		$page_for_posts = get_option('page_for_posts');
244
+		if (false !== $new_prefixes) {
245 245
 			$this->taxonomies = array();
246 246
 			$this->post_types = array();
247 247
 		}
248 248
 
249
-		if ( is_search() ) {
250
-			if ( false === $new_prefixes ) {
249
+		if (is_search()) {
250
+			if (false === $new_prefixes) {
251 251
 				$this->search_core_suffix = 'core';
252 252
 				$this->search_prefix      = 'search';
253 253
 			} else {
254 254
 				$this->search_core_suffix = 'enable';
255 255
 				$this->search_prefix      = 'engine_search';
256 256
 			}
257
-		} elseif ( is_post_type_archive( $this->post_types ) || is_tax() || is_page( $page_for_posts ) || is_home() || is_category() || is_tag() ) {
258
-			if ( false === $new_prefixes ) {
257
+		} elseif (is_post_type_archive($this->post_types) || is_tax() || is_page($page_for_posts) || is_home() || is_category() || is_tag()) {
258
+			if (false === $new_prefixes) {
259 259
 				$this->search_core_suffix = 'search';
260 260
 			} else {
261 261
 				$this->search_core_suffix = 'enable';
262 262
 			}
263 263
 
264
-			if ( is_tax() ) {
265
-				$tax = get_query_var( 'taxonomy' );
266
-				$tax = get_taxonomy( $tax );
264
+			if (is_tax()) {
265
+				$tax = get_query_var('taxonomy');
266
+				$tax = get_taxonomy($tax);
267 267
 				$post_type = $tax->object_type[0];
268
-			} else if ( is_page( $page_for_posts ) || is_category() || is_tag() || is_home() ) {
268
+			} else if (is_page($page_for_posts) || is_category() || is_tag() || is_home()) {
269 269
 				$post_type = 'post';
270 270
 			} else {
271
-				$post_type = get_query_var( 'post_type' );
271
+				$post_type = get_query_var('post_type');
272 272
 			}
273 273
 
274
-			if ( false === $new_prefixes ) {
275
-				if ( isset( $this->tabs[ $post_type ] ) ) {
276
-					$this->search_prefix = $this->tabs[ $post_type ] . '_archive';
274
+			if (false === $new_prefixes) {
275
+				if (isset($this->tabs[$post_type])) {
276
+					$this->search_prefix = $this->tabs[$post_type].'_archive';
277 277
 				}
278 278
 			} else {
279
-				$this->search_prefix = $post_type . '_search';
279
+				$this->search_prefix = $post_type.'_search';
280 280
 			}
281 281
 		}
282 282
 	}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	public function set_facetwp_vars() {
288 288
 
289
-		if ( class_exists( 'FacetWP' ) ) {
289
+		if (class_exists('FacetWP')) {
290 290
 			$facet_data = FWP()->helper->get_facets();
291 291
 		}
292 292
 
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
 
295 295
 		$this->facet_data['search_form'] = array(
296 296
 			'name' => 'search_form',
297
-			'label' => esc_html__( 'Search Form', 'lsx-search' ),
297
+			'label' => esc_html__('Search Form', 'lsx-search'),
298 298
 		);
299 299
 
300
-		if ( ! empty( $facet_data ) && is_array( $facet_data ) ) {
301
-			foreach ( $facet_data as $facet ) {
302
-				$this->facet_data[ $facet['name'] ] = $facet;
300
+		if (!empty($facet_data) && is_array($facet_data)) {
301
+			foreach ($facet_data as $facet) {
302
+				$this->facet_data[$facet['name']] = $facet;
303 303
 			}
304 304
 		}
305 305
 	}
@@ -309,60 +309,60 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	public function core() {
311 311
 
312
-		if ( true === $this->search_enabled ) {
313
-			add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 999 );
312
+		if (true === $this->search_enabled) {
313
+			add_action('wp_enqueue_scripts', array($this, 'assets'), 999);
314 314
 
315
-			add_filter( 'lsx_layout', array( $this, 'lsx_layout' ), 20, 1 );
316
-			add_filter( 'lsx_layout_selector', array( $this, 'lsx_layout_selector' ), 10, 4 );
317
-			add_filter( 'lsx_slot_class', array( $this, 'change_slot_column_class' ) );
318
-			add_action( 'lsx_entry_top', array( $this, 'add_label_to_title' ) );
319
-			add_filter( 'body_class', array( $this, 'body_class' ), 10 );
315
+			add_filter('lsx_layout', array($this, 'lsx_layout'), 20, 1);
316
+			add_filter('lsx_layout_selector', array($this, 'lsx_layout_selector'), 10, 4);
317
+			add_filter('lsx_slot_class', array($this, 'change_slot_column_class'));
318
+			add_action('lsx_entry_top', array($this, 'add_label_to_title'));
319
+			add_filter('body_class', array($this, 'body_class'), 10);
320 320
 
321
-			add_filter( 'lsx_blog_customizer_top_of_blog_action', array( $this, 'top_of_blog_action' ), 10, 1 );
322
-			add_filter( 'lsx_blog_customizer_blog_description_class', array( $this, 'blog_description_class' ), 10, 1 );
321
+			add_filter('lsx_blog_customizer_top_of_blog_action', array($this, 'top_of_blog_action'), 10, 1);
322
+			add_filter('lsx_blog_customizer_blog_description_class', array($this, 'blog_description_class'), 10, 1);
323 323
 
324
-			if ( class_exists( 'LSX_Videos' ) ) {
324
+			if (class_exists('LSX_Videos')) {
325 325
 				global $lsx_videos_frontend;
326
-				remove_action( 'lsx_content_top', array( $lsx_videos_frontend, 'categories_tabs' ), 15 );
326
+				remove_action('lsx_content_top', array($lsx_videos_frontend, 'categories_tabs'), 15);
327 327
 			}
328 328
 
329
-			add_filter( 'lsx_paging_nav_disable', '__return_true' );
330
-			add_action( 'lsx_content_top', array( $this, 'facet_top_bar' ) );
331
-			add_action( 'lsx_content_top', array( $this, 'facetwp_tempate_open' ) );
332
-			add_action( 'lsx_content_bottom', array( $this, 'facetwp_tempate_close' ) );
333
-			add_action( 'lsx_content_bottom', array( $this, 'facet_bottom_bar' ) );
329
+			add_filter('lsx_paging_nav_disable', '__return_true');
330
+			add_action('lsx_content_top', array($this, 'facet_top_bar'));
331
+			add_action('lsx_content_top', array($this, 'facetwp_tempate_open'));
332
+			add_action('lsx_content_bottom', array($this, 'facetwp_tempate_close'));
333
+			add_action('lsx_content_bottom', array($this, 'facet_bottom_bar'));
334 334
 
335
-			if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) && '1c' !== $this->options['display'][ $this->search_prefix . '_layout' ] ) {
336
-				add_filter( 'lsx_sidebar_enable', array( $this, 'lsx_sidebar_enable' ), 10, 1 );
335
+			if (!empty($this->options['display'][$this->search_prefix.'_layout']) && '1c' !== $this->options['display'][$this->search_prefix.'_layout']) {
336
+				add_filter('lsx_sidebar_enable', array($this, 'lsx_sidebar_enable'), 10, 1);
337 337
 			}
338 338
 
339
-			add_action( 'lsx_content_wrap_before', array( $this, 'search_sidebar' ), 150 );
339
+			add_action('lsx_content_wrap_before', array($this, 'search_sidebar'), 150);
340 340
 
341
-			if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_category() || is_product_tag() ) ) {
342
-				remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description' );
343
-				remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description' );
344
-				add_filter( 'woocommerce_show_page_title', '__return_false' );
341
+			if (class_exists('WooCommerce') && (is_shop() || is_product_category() || is_product_tag())) {
342
+				remove_action('woocommerce_archive_description', 'woocommerce_taxonomy_archive_description');
343
+				remove_action('woocommerce_archive_description', 'woocommerce_product_archive_description');
344
+				add_filter('woocommerce_show_page_title', '__return_false');
345 345
 
346
-				add_filter( 'loop_shop_columns', function() {
346
+				add_filter('loop_shop_columns', function() {
347 347
 					return 3;
348 348
 				} );
349 349
 
350 350
 				// Actions added by LSX theme
351
-				remove_action( 'lsx_content_wrap_before', 'lsx_global_header' );
351
+				remove_action('lsx_content_wrap_before', 'lsx_global_header');
352 352
 
353 353
 				// Actions added be LSX theme / woocommerce.php file
354
-				remove_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 );
355
-				remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
356
-				remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 );
357
-				remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 );
358
-				remove_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 );
354
+				remove_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9);
355
+				remove_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10);
356
+				remove_action('woocommerce_after_shop_loop', 'woocommerce_result_count', 20);
357
+				remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 30);
358
+				remove_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31);
359 359
 
360 360
 				// Actions added be LSX theme / woocommerce.php file
361
-				remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 );
362
-				remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
363
-				remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
364
-				remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 );
365
-				remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 );
361
+				remove_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9);
362
+				remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10);
363
+				remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20);
364
+				remove_action('woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30);
365
+				remove_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31);
366 366
 			}
367 367
 		}
368 368
 	}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 * @param  array $classes The classes.
374 374
 	 * @return array $classes The classes.
375 375
 	 */
376
-	public function body_class( $classes ) {
376
+	public function body_class($classes) {
377 377
 		$classes[] = 'lsx-search-enabled';
378 378
 		return $classes;
379 379
 	}
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	 * @param  string $action
385 385
 	 * @return string $action
386 386
 	 */
387
-	public function top_of_blog_action( $action = '' ) {
387
+	public function top_of_blog_action($action = '') {
388 388
 		$action = 'lsx_content_wrap_before';
389 389
 		return $action;
390 390
 	}
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 * @param  string $action
396 396
 	 * @return string $action
397 397
 	 */
398
-	public function blog_description_class( $class = '' ) {
398
+	public function blog_description_class($class = '') {
399 399
 		$class .= ' col-md-12 search-description';
400 400
 		return $class;
401 401
 	}
@@ -406,13 +406,13 @@  discard block
 block discarded – undo
406 406
 	 * @return void
407 407
 	 */
408 408
 	public function check_for_results() {
409
-		if ( true === $this->search_enabled ) {
409
+		if (true === $this->search_enabled) {
410 410
 			global $wp_query;
411
-			if ( empty( $wp_query->posts ) ) {
411
+			if (empty($wp_query->posts)) {
412 412
 				$this->has_posts = false;
413
-				remove_action( 'lsx_content_top', array( $this, 'facet_top_bar' ) );
414
-				remove_action( 'lsx_content_bottom', array( $this, 'facet_bottom_bar' ) );
415
-				remove_action( 'lsx_content_wrap_before', array( $this, 'search_sidebar' ), 150 );
413
+				remove_action('lsx_content_top', array($this, 'facet_top_bar'));
414
+				remove_action('lsx_content_bottom', array($this, 'facet_bottom_bar'));
415
+				remove_action('lsx_content_wrap_before', array($this, 'search_sidebar'), 150);
416 416
 			} else {
417 417
 				$this->has_posts = true;
418 418
 			}
@@ -422,12 +422,12 @@  discard block
 block discarded – undo
422 422
 	/**
423 423
 	 * Filter the post types.
424 424
 	 */
425
-	public function filter_post_types( $query ) {
426
-		if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) {
427
-			if ( ! empty( $this->options ) && ! empty( $this->options['display']['search_enable_core'] ) ) {
428
-				if ( ! empty( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) {
429
-					$post_types = array_keys( $this->options['general']['search_post_types'] );
430
-					$query->set( 'post_type', $post_types );
425
+	public function filter_post_types($query) {
426
+		if (!is_admin() && $query->is_main_query() && $query->is_search()) {
427
+			if (!empty($this->options) && !empty($this->options['display']['search_enable_core'])) {
428
+				if (!empty($this->options['general']['search_post_types']) && is_array($this->options['general']['search_post_types'])) {
429
+					$post_types = array_keys($this->options['general']['search_post_types']);
430
+					$query->set('post_type', $post_types);
431 431
 				}
432 432
 			}
433 433
 		}
@@ -436,23 +436,23 @@  discard block
 block discarded – undo
436 436
 	/**
437 437
 	 * Sets post types with active search options.
438 438
 	 */
439
-	public function register_post_types( $post_types ) {
440
-		$post_types = array( 'post', 'project', 'service', 'team', 'testimonial', 'video', 'product' );
439
+	public function register_post_types($post_types) {
440
+		$post_types = array('post', 'project', 'service', 'team', 'testimonial', 'video', 'product');
441 441
 		return $post_types;
442 442
 	}
443 443
 
444 444
 	/**
445 445
 	 * Sets taxonomies with active search options.
446 446
 	 */
447
-	public function register_taxonomies( $taxonomies ) {
448
-		$taxonomies = array( 'category', 'post_tag', 'project-group', 'service-group', 'team_role', 'video-category', 'product_cat', 'product_tag' );
447
+	public function register_taxonomies($taxonomies) {
448
+		$taxonomies = array('category', 'post_tag', 'project-group', 'service-group', 'team_role', 'video-category', 'product_cat', 'product_tag');
449 449
 		return $taxonomies;
450 450
 	}
451 451
 
452 452
 	/**
453 453
 	 * Sets post types with active search options.
454 454
 	 */
455
-	public function register_post_type_tabs( $post_types_plural ) {
455
+	public function register_post_type_tabs($post_types_plural) {
456 456
 		$post_types_plural = array(
457 457
 			'post' => 'posts',
458 458
 			'project' => 'projects',
@@ -469,23 +469,23 @@  discard block
 block discarded – undo
469 469
 	 * Enqueue styles and scripts.
470 470
 	 */
471 471
 	public function assets() {
472
-		add_filter( 'lsx_defer_parsing_of_js', array( $this, 'skip_js_defer' ), 10, 4 );
473
-		wp_enqueue_script( 'touchSwipe', LSX_SEARCH_URL . 'assets/js/vendor/jquery.touchSwipe.min.js', array( 'jquery' ), LSX_SEARCH_VER, true );
474
-		wp_enqueue_script( 'slideandswipe', LSX_SEARCH_URL . 'assets/js/vendor/jquery.slideandswipe.min.js', array( 'jquery', 'touchSwipe' ), LSX_SEARCH_VER, true );
475
-		wp_enqueue_script( 'lsx-search', LSX_SEARCH_URL . 'assets/js/src/lsx-search.js', array( 'jquery', 'touchSwipe', 'slideandswipe', 'jquery-ui-datepicker' ), LSX_SEARCH_VER, true );
472
+		add_filter('lsx_defer_parsing_of_js', array($this, 'skip_js_defer'), 10, 4);
473
+		wp_enqueue_script('touchSwipe', LSX_SEARCH_URL.'assets/js/vendor/jquery.touchSwipe.min.js', array('jquery'), LSX_SEARCH_VER, true);
474
+		wp_enqueue_script('slideandswipe', LSX_SEARCH_URL.'assets/js/vendor/jquery.slideandswipe.min.js', array('jquery', 'touchSwipe'), LSX_SEARCH_VER, true);
475
+		wp_enqueue_script('lsx-search', LSX_SEARCH_URL.'assets/js/src/lsx-search.js', array('jquery', 'touchSwipe', 'slideandswipe', 'jquery-ui-datepicker'), LSX_SEARCH_VER, true);
476 476
 
477
-		$params = apply_filters( 'lsx_search_js_params', array(
478
-			'ajax_url' => admin_url( 'admin-ajax.php' ),
477
+		$params = apply_filters('lsx_search_js_params', array(
478
+			'ajax_url' => admin_url('admin-ajax.php'),
479 479
 		));
480 480
 
481
-		wp_localize_script( 'lsx-search', 'lsx_customizer_params', $params );
481
+		wp_localize_script('lsx-search', 'lsx_customizer_params', $params);
482 482
 
483
-		wp_enqueue_style( 'lsx-search', LSX_SEARCH_URL . 'assets/css/lsx-search.css', array(), LSX_SEARCH_VER );
484
-		wp_style_add_data( 'lsx-search', 'rtl', 'replace' );
483
+		wp_enqueue_style('lsx-search', LSX_SEARCH_URL.'assets/css/lsx-search.css', array(), LSX_SEARCH_VER);
484
+		wp_style_add_data('lsx-search', 'rtl', 'replace');
485 485
 
486
-		if ( true === $this->new_options ) {
487
-			wp_deregister_style( 'lsx_to_search' );
488
-			wp_deregister_script( 'lsx_to_search' );
486
+		if (true === $this->new_options) {
487
+			wp_deregister_style('lsx_to_search');
488
+			wp_deregister_script('lsx_to_search');
489 489
 		}
490 490
 	}
491 491
 
@@ -498,8 +498,8 @@  discard block
 block discarded – undo
498 498
 	 * @param string  $href
499 499
 	 * @return boolean
500 500
 	 */
501
-	public function skip_js_defer( $should_skip, $tag, $handle, $href ) {
502
-		if ( ! is_admin() && ( false !== stripos( $href, 'lsx-search.min.js' ) || false !== stripos( $href, 'lsx-search.js' ) ) ) {
501
+	public function skip_js_defer($should_skip, $tag, $handle, $href) {
502
+		if (!is_admin() && (false !== stripos($href, 'lsx-search.min.js') || false !== stripos($href, 'lsx-search.js'))) {
503 503
 			$should_skip = true;
504 504
 		}
505 505
 		return $should_skip;
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
 	 * @param	$template
512 512
 	 * @return	$template
513 513
 	 */
514
-	public function search_template_include( $template ) {
515
-		if ( is_main_query() && is_search() ) {
516
-			if ( file_exists( LSX_SEARCH_PATH . 'templates/search.php' ) ) {
517
-				$template = LSX_SEARCH_PATH . 'templates/search.php';
514
+	public function search_template_include($template) {
515
+		if (is_main_query() && is_search()) {
516
+			if (file_exists(LSX_SEARCH_PATH.'templates/search.php')) {
517
+				$template = LSX_SEARCH_PATH.'templates/search.php';
518 518
 			}
519 519
 		}
520 520
 
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
 	 * @param [type] $query
528 528
 	 * @return void
529 529
 	 */
530
-	public function ignore_sticky_search( $query ) {
531
-		if ( $query->is_main_query() && is_home() ) {
532
-			$query->set( 'ignore_sticky_posts', true );
530
+	public function ignore_sticky_search($query) {
531
+		if ($query->is_main_query() && is_home()) {
532
+			$query->set('ignore_sticky_posts', true);
533 533
 		}
534 534
 	}
535 535
 
@@ -537,49 +537,49 @@  discard block
 block discarded – undo
537 537
 	 * Rewrite the search URL
538 538
 	 */
539 539
 	public function pretty_search_redirect() {
540
-		global $wp_rewrite,$wp_query;
540
+		global $wp_rewrite, $wp_query;
541 541
 
542
-		if ( ! isset( $wp_rewrite ) || ! is_object( $wp_rewrite ) || ! $wp_rewrite->using_permalinks() ) {
542
+		if (!isset($wp_rewrite) || !is_object($wp_rewrite) || !$wp_rewrite->using_permalinks()) {
543 543
 			return;
544 544
 		}
545 545
 
546 546
 		$search_base = $wp_rewrite->search_base;
547 547
 
548
-		if ( is_search() && ! is_admin() && strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) === false ) {
549
-			$search_query = get_query_var( 's' );
550
-			if ( empty( $search_query ) && isset( $_GET['s'] ) ) {
548
+		if (is_search() && !is_admin() && strpos($_SERVER['REQUEST_URI'], "/{$search_base}/") === false) {
549
+			$search_query = get_query_var('s');
550
+			if (empty($search_query) && isset($_GET['s'])) {
551 551
 				$search_query = $_GET['s'];
552 552
 			}
553 553
 			$engine = '';
554 554
 
555 555
 			// If the search was triggered by a supplemental engine.
556
-			if ( isset( $_GET['engine'] ) && 'default' !== $_GET['engine'] ) {
557
-				$engine = sanitize_text_field( wp_unslash( $_GET['engine'] ) );
558
-				$index  = array_search( $engine, $this->post_type_slugs, true );
559
-				if ( false !== $index ) {
556
+			if (isset($_GET['engine']) && 'default' !== $_GET['engine']) {
557
+				$engine = sanitize_text_field(wp_unslash($_GET['engine']));
558
+				$index  = array_search($engine, $this->post_type_slugs, true);
559
+				if (false !== $index) {
560 560
 					$engine = $index;
561 561
 				}
562
-				$engine = $engine . '/';
562
+				$engine = $engine.'/';
563 563
 			}
564 564
 
565 565
 			$get_array = $_GET;
566 566
 
567
-			if ( is_array( $get_array ) && ! empty( $get_array ) ) {
567
+			if (is_array($get_array) && !empty($get_array)) {
568 568
 				$vars_to_maintain = array();
569 569
 
570
-				foreach ( $get_array as $ga_key => $ga_value ) {
571
-					if ( false !== strpos( $ga_key, 'fwp_' ) ) {
572
-						$vars_to_maintain[] = $ga_key . '=' . $ga_value;
570
+				foreach ($get_array as $ga_key => $ga_value) {
571
+					if (false !== strpos($ga_key, 'fwp_')) {
572
+						$vars_to_maintain[] = $ga_key.'='.$ga_value;
573 573
 					}
574 574
 				}
575 575
 			}
576 576
 
577
-			$redirect_url = home_url( "/{$search_base}/" . $engine . urlencode( $search_query ) );
577
+			$redirect_url = home_url("/{$search_base}/".$engine.urlencode($search_query));
578 578
 
579
-			if ( ! empty( $vars_to_maintain ) ) {
580
-				$redirect_url .= '?' . implode( '&', $vars_to_maintain );
579
+			if (!empty($vars_to_maintain)) {
580
+				$redirect_url .= '?'.implode('&', $vars_to_maintain);
581 581
 			}
582
-			wp_redirect( $redirect_url );
582
+			wp_redirect($redirect_url);
583 583
 			exit();
584 584
 		}
585 585
 	}
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	/**
588 588
 	 * Parse the Query and trigger a search
589 589
 	 */
590
-	public function pretty_search_parse_query( $query ) {
590
+	public function pretty_search_parse_query($query) {
591 591
 		$this->post_type_slugs = array(
592 592
 			'post' => 'posts',
593 593
 			'project' => 'projects',
@@ -597,26 +597,26 @@  discard block
 block discarded – undo
597 597
 			'video' => 'videos',
598 598
 			'product' => 'products', // WooCommerce
599 599
 		);
600
-		if ( $query->is_search() && ! is_admin() && $query->is_main_query() ) {
601
-			$search_query = $query->get( 's' );
602
-			$keyword_test = explode( '/', $search_query );
600
+		if ($query->is_search() && !is_admin() && $query->is_main_query()) {
601
+			$search_query = $query->get('s');
602
+			$keyword_test = explode('/', $search_query);
603 603
 
604
-			$index = array_search( $keyword_test[0], $this->post_type_slugs, true );
605
-			if ( false !== $index ) {
606
-				$engine = $this->post_type_slugs[ $index ];
604
+			$index = array_search($keyword_test[0], $this->post_type_slugs, true);
605
+			if (false !== $index) {
606
+				$engine = $this->post_type_slugs[$index];
607 607
 
608
-				$query->set( 'post_type', $engine );
609
-				$query->set( 'engine', $engine );
608
+				$query->set('post_type', $engine);
609
+				$query->set('engine', $engine);
610 610
 
611
-				if ( count( $keyword_test ) > 1 ) {
612
-					$query->set( 's', $keyword_test[1] );
613
-				} elseif ( post_type_exists( $engine ) ) {
614
-					$query->set( 's', '' );
611
+				if (count($keyword_test) > 1) {
612
+					$query->set('s', $keyword_test[1]);
613
+				} elseif (post_type_exists($engine)) {
614
+					$query->set('s', '');
615 615
 				}
616 616
 			} else {
617
-				if ( isset( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) {
618
-					$post_types = array_keys( $this->options['general']['search_post_types'] );
619
-					$query->set( 'post_type', $post_types );
617
+				if (isset($this->options['general']['search_post_types']) && is_array($this->options['general']['search_post_types'])) {
618
+					$post_types = array_keys($this->options['general']['search_post_types']);
619
+					$query->set('post_type', $post_types);
620 620
 				}
621 621
 			}
622 622
 		}
@@ -629,18 +629,18 @@  discard block
 block discarded – undo
629 629
 	 * @return url
630 630
 	 */
631 631
 	public function change_json_ld_search_url() {
632
-		return trailingslashit( home_url() ) . 'search/{search_term_string}';
632
+		return trailingslashit(home_url()).'search/{search_term_string}';
633 633
 	}
634 634
 
635 635
 	/**
636 636
 	 * A filter to set the layout to 2 column.
637 637
 	 */
638
-	public function lsx_layout( $layout ) {
639
-		if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) {
640
-			if ( false === $this->has_posts ) {
638
+	public function lsx_layout($layout) {
639
+		if (!empty($this->options['display'][$this->search_prefix.'_layout'])) {
640
+			if (false === $this->has_posts) {
641 641
 				$layout = '1c';
642 642
 			} else {
643
-				$layout = $this->options['display'][ $this->search_prefix . '_layout' ];
643
+				$layout = $this->options['display'][$this->search_prefix.'_layout'];
644 644
 			}
645 645
 		}
646 646
 		return $layout;
@@ -650,23 +650,23 @@  discard block
 block discarded – undo
650 650
 	 * Outputs the Search Title Facet
651 651
 	 */
652 652
 	public function search_sidebar_top() {
653
-		if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) && true !== apply_filters( 'lsx_search_hide_search_box', false ) ) {
653
+		if (!empty($this->options['display'][$this->search_prefix.'_facets']) && is_array($this->options['display'][$this->search_prefix.'_facets']) && true !== apply_filters('lsx_search_hide_search_box', false)) {
654 654
 
655
-			if ( ! is_search() ) {
655
+			if (!is_search()) {
656 656
 
657
-				foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
657
+				foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) {
658 658
 
659
-					if ( isset( $this->facet_data[ $facet ] ) && 'search' === $this->facet_data[ $facet ]['type'] ) {
660
-						echo wp_kses_post( '<div class="row">' );
661
-							$this->display_facet_default( $facet );
662
-						echo wp_kses_post( '</div>' );
663
-						unset( $this->options['display'][ $this->search_prefix . '_facets' ][ $facet ] );
659
+					if (isset($this->facet_data[$facet]) && 'search' === $this->facet_data[$facet]['type']) {
660
+						echo wp_kses_post('<div class="row">');
661
+							$this->display_facet_default($facet);
662
+						echo wp_kses_post('</div>');
663
+						unset($this->options['display'][$this->search_prefix.'_facets'][$facet]);
664 664
 					}
665 665
 				}
666 666
 			} else {
667
-				echo wp_kses_post( '<div class="row">' );
667
+				echo wp_kses_post('<div class="row">');
668 668
 					$this->display_facet_search();
669
-				echo wp_kses_post( '</div>' );
669
+				echo wp_kses_post('</div>');
670 670
 			}
671 671
 		}
672 672
 	}
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
 	 *
679 679
 	 * @return string
680 680
 	 */
681
-	public function search_facet_html( $output, $params ) {
682
-		if ( 'search' == $params['facet']['type'] ) {
681
+	public function search_facet_html($output, $params) {
682
+		if ('search' == $params['facet']['type']) {
683 683
 
684 684
 			$value = (array) $params['selected_values'];
685
-			$value = empty( $value ) ? '' : stripslashes( $value[0] );
686
-			$placeholder = isset( $params['facet']['placeholder'] ) ? $params['facet']['placeholder'] : __( 'Search...', 'lsx-search' );
687
-			$placeholder = facetwp_i18n( $placeholder );
685
+			$value = empty($value) ? '' : stripslashes($value[0]);
686
+			$placeholder = isset($params['facet']['placeholder']) ? $params['facet']['placeholder'] : __('Search...', 'lsx-search');
687
+			$placeholder = facetwp_i18n($placeholder);
688 688
 
689 689
 			ob_start();
690 690
 			?>
@@ -692,11 +692,11 @@  discard block
 block discarded – undo
692 692
 				<div class="search-form lsx-search-form 2">
693 693
 					<div class="input-group facetwp-search-wrap">
694 694
 						<div class="field">
695
-							<input class="facetwp-search search-field form-control" type="text" placeholder="<?php echo esc_attr( $placeholder ); ?>" autocomplete="off" value="<?php echo esc_attr( $value ); ?>">
695
+							<input class="facetwp-search search-field form-control" type="text" placeholder="<?php echo esc_attr($placeholder); ?>" autocomplete="off" value="<?php echo esc_attr($value); ?>">
696 696
 						</div>
697 697
 
698 698
 						<div class="field submit-button">
699
-							<button class="search-submit btn facetwp-btn" type="submit"><?php esc_html_e( 'Search', 'lsx-search' ); ?></button>
699
+							<button class="search-submit btn facetwp-btn" type="submit"><?php esc_html_e('Search', 'lsx-search'); ?></button>
700 700
 						</div>
701 701
 					</div>
702 702
 				</div>
@@ -710,23 +710,23 @@  discard block
 block discarded – undo
710 710
 	/**
711 711
 	 * Change the primary and secondary column classes.
712 712
 	 */
713
-	public function lsx_layout_selector( $return_class, $class, $layout, $size ) {
714
-		if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) {
713
+	public function lsx_layout_selector($return_class, $class, $layout, $size) {
714
+		if (!empty($this->options['display'][$this->search_prefix.'_layout'])) {
715 715
 
716
-			if ( '2cl' === $layout || '2cr' === $layout ) {
716
+			if ('2cl' === $layout || '2cr' === $layout) {
717 717
 				$main_class    = 'col-sm-8 col-md-9';
718 718
 				$sidebar_class = 'col-sm-4 col-md-3';
719 719
 
720
-				if ( '2cl' === $layout ) {
720
+				if ('2cl' === $layout) {
721 721
 					$main_class    .= ' col-sm-pull-4 col-md-pull-3 search-sidebar-left';
722 722
 					$sidebar_class .= ' col-sm-push-8 col-md-push-9';
723 723
 				}
724 724
 
725
-				if ( 'main' === $class ) {
725
+				if ('main' === $class) {
726 726
 					return $main_class;
727 727
 				}
728 728
 
729
-				if ( 'sidebar' === $class ) {
729
+				if ('sidebar' === $class) {
730 730
 					return $sidebar_class;
731 731
 				}
732 732
 			}
@@ -741,14 +741,14 @@  discard block
 block discarded – undo
741 741
 	 * @return void
742 742
 	 */
743 743
 	public function display_alphabet_facet() {
744
-		if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) {
745
-			$az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ];
744
+		if (isset($this->options['display'][$this->search_prefix.'_az_pagination'])) {
745
+			$az_pagination = $this->options['display'][$this->search_prefix.'_az_pagination'];
746 746
 		} else {
747 747
 			$az_pagination = false;
748 748
 		}
749
-		$az_pagination = apply_filters( 'lsx_search_top_az_pagination', $az_pagination );
750
-		if ( false !== $az_pagination && '' !== $az_pagination ) {
751
-			echo do_shortcode( '[facetwp facet="' . $az_pagination . '"]' );
749
+		$az_pagination = apply_filters('lsx_search_top_az_pagination', $az_pagination);
750
+		if (false !== $az_pagination && '' !== $az_pagination) {
751
+			echo do_shortcode('[facetwp facet="'.$az_pagination.'"]');
752 752
 		}
753 753
 	}
754 754
 
@@ -756,44 +756,44 @@  discard block
 block discarded – undo
756 756
 	 * Outputs top.
757 757
 	 */
758 758
 	public function facet_top_bar() {
759
-		if ( true === apply_filters( 'lsx_search_hide_top_bar', false ) ) {
759
+		if (true === apply_filters('lsx_search_hide_top_bar', false)) {
760 760
 			return;
761 761
 		}
762 762
 
763 763
 		$show_pagination     = true;
764 764
 		$pagination_visible  = false;
765
-		$show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] );
766
-		$show_sort_combo     = empty( $this->options['display'][ $this->search_prefix . '_disable_sorting' ] );
767
-
768
-		$show_pagination     = apply_filters( 'lsx_search_top_show_pagination', $show_pagination );
769
-		$pagination_visible  = apply_filters( 'lsx_search_top_pagination_visible', $pagination_visible );
770
-		$show_per_page_combo = apply_filters( 'lsx_search_top_show_per_page_combo', $show_per_page_combo );
771
-		$show_sort_combo     = apply_filters( 'lsx_search_top_show_sort_combo', $show_sort_combo );
772
-		$facet_row_classes   = apply_filters( 'lsx_search_top_facetwp_row_classes', '' );
765
+		$show_per_page_combo = empty($this->options['display'][$this->search_prefix.'_disable_per_page']);
766
+		$show_sort_combo     = empty($this->options['display'][$this->search_prefix.'_disable_sorting']);
767
+
768
+		$show_pagination     = apply_filters('lsx_search_top_show_pagination', $show_pagination);
769
+		$pagination_visible  = apply_filters('lsx_search_top_pagination_visible', $pagination_visible);
770
+		$show_per_page_combo = apply_filters('lsx_search_top_show_per_page_combo', $show_per_page_combo);
771
+		$show_sort_combo     = apply_filters('lsx_search_top_show_sort_combo', $show_sort_combo);
772
+		$facet_row_classes   = apply_filters('lsx_search_top_facetwp_row_classes', '');
773 773
 		?>
774 774
 		<div id="facetwp-top">
775
-			<?php if ( $show_sort_combo || ( $show_pagination && $show_per_page_combo ) ) { ?>
776
-				<div class="row facetwp-top-row-1 hidden-xs <?php echo esc_attr( $facet_row_classes ); ?>">
775
+			<?php if ($show_sort_combo || ($show_pagination && $show_per_page_combo)) { ?>
776
+				<div class="row facetwp-top-row-1 hidden-xs <?php echo esc_attr($facet_row_classes); ?>">
777 777
 					<div class="col-xs-12">
778 778
 
779
-						<?php if ( ! empty( $this->options['display'][ $this->search_prefix . '_display_result_count' ] ) && false === apply_filters( 'lsx_search_hide_result_count', false ) ) { ?>
779
+						<?php if (!empty($this->options['display'][$this->search_prefix.'_display_result_count']) && false === apply_filters('lsx_search_hide_result_count', false)) { ?>
780 780
 							<div class="row">
781 781
 								<div class="col-md-12 facetwp-item facetwp-results">
782
-									<h3 class="lsx-search-title lsx-search-title-results"><?php esc_html_e( 'Results', 'lsx-search' ); ?> <?php echo '(' . do_shortcode( '[facetwp counts="true"]' ) . ')&nbsp;'; ?>
783
-									<?php if ( false !== $this->options && isset( $this->options['display'] ) && ( ! empty( $this->options['display'][ $this->search_prefix . '_display_clear_button' ] ) ) && 'on' === $this->options['display'][ $this->search_prefix . '_display_clear_button' ] ) { ?>
784
-										<span class="clear-facets hidden">- <a title="<?php esc_html_e( 'Clear the current search filters.', 'lsx-search' ); ?>" class="facetwp-results-clear" type="button" onclick="<?php echo esc_attr( apply_filters( 'lsx_search_clear_function', 'lsx_search.clearFacets(this);' ) ); ?>"><?php esc_html_e( 'Clear', 'lsx-search' ); ?></a></span>
782
+									<h3 class="lsx-search-title lsx-search-title-results"><?php esc_html_e('Results', 'lsx-search'); ?> <?php echo '('.do_shortcode('[facetwp counts="true"]').')&nbsp;'; ?>
783
+									<?php if (false !== $this->options && isset($this->options['display']) && (!empty($this->options['display'][$this->search_prefix.'_display_clear_button'])) && 'on' === $this->options['display'][$this->search_prefix.'_display_clear_button']) { ?>
784
+										<span class="clear-facets hidden">- <a title="<?php esc_html_e('Clear the current search filters.', 'lsx-search'); ?>" class="facetwp-results-clear" type="button" onclick="<?php echo esc_attr(apply_filters('lsx_search_clear_function', 'lsx_search.clearFacets(this);')); ?>"><?php esc_html_e('Clear', 'lsx-search'); ?></a></span>
785 785
 									<?php } ?>
786 786
 									</h3>
787 787
 								</div>
788 788
 							</div>
789 789
 						<?php } ?>
790 790
 
791
-						<?php do_action( 'lsx_search_facetwp_top_row' ); ?>
791
+						<?php do_action('lsx_search_facetwp_top_row'); ?>
792 792
 
793 793
 						<?php $this->display_alphabet_facet(); ?>
794 794
 
795
-						<?php if ( $show_sort_combo ) { ?>
796
-							<?php echo do_shortcode( '[facetwp sort="true"]' ); ?>
795
+						<?php if ($show_sort_combo) { ?>
796
+							<?php echo do_shortcode('[facetwp sort="true"]'); ?>
797 797
 						<?php } ?>
798 798
 
799 799
 					</div>
@@ -807,30 +807,30 @@  discard block
 block discarded – undo
807 807
 	 * Outputs bottom.
808 808
 	 */
809 809
 	public function facet_bottom_bar() {
810
-		if ( true === apply_filters( 'lsx_search_hide_bottom_bar', false ) ) {
810
+		if (true === apply_filters('lsx_search_hide_bottom_bar', false)) {
811 811
 			return;
812 812
 		}
813 813
 		$show_pagination    = true;
814 814
 		$pagination_visible = false;
815
-		if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) {
816
-			$az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ];
815
+		if (isset($this->options['display'][$this->search_prefix.'_az_pagination'])) {
816
+			$az_pagination = $this->options['display'][$this->search_prefix.'_az_pagination'];
817 817
 		} else {
818 818
 			$az_pagination = false;
819 819
 		}
820 820
 
821
-		$show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] );
822
-		$show_sort_combo     = empty( $this->options['display'][ $this->search_prefix . '_search_disable_sorting' ] );
821
+		$show_per_page_combo = empty($this->options['display'][$this->search_prefix.'_disable_per_page']);
822
+		$show_sort_combo     = empty($this->options['display'][$this->search_prefix.'_search_disable_sorting']);
823 823
 
824
-		$show_pagination     = apply_filters( 'lsx_search_bottom_show_pagination', $show_pagination );
825
-		$pagination_visible  = apply_filters( 'lsx_search_bottom_pagination_visible', $pagination_visible );
826
-		$show_per_page_combo = apply_filters( 'lsx_search_bottom_show_per_page_combo', $show_per_page_combo );
827
-		$show_sort_combo     = apply_filters( 'lsx_search_bottom_show_sort_combo', $show_sort_combo );
824
+		$show_pagination     = apply_filters('lsx_search_bottom_show_pagination', $show_pagination);
825
+		$pagination_visible  = apply_filters('lsx_search_bottom_pagination_visible', $pagination_visible);
826
+		$show_per_page_combo = apply_filters('lsx_search_bottom_show_per_page_combo', $show_per_page_combo);
827
+		$show_sort_combo     = apply_filters('lsx_search_bottom_show_sort_combo', $show_sort_combo);
828 828
 
829
-		if ( $show_pagination || ! empty( $az_pagination ) ) { ?>
829
+		if ($show_pagination || !empty($az_pagination)) { ?>
830 830
 			<div id="facetwp-bottom">
831 831
 				<div class="row facetwp-bottom-row-1">
832 832
 					<div class="col-xs-12">
833
-						<?php do_action( 'lsx_search_facetwp_bottom_row' ); ?>
833
+						<?php do_action('lsx_search_facetwp_bottom_row'); ?>
834 834
 
835 835
 						<?php //if ( $show_sort_combo ) { ?>
836 836
 							<?php //echo do_shortcode( '[facetwp sort="true"]' ); ?>
@@ -841,16 +841,16 @@  discard block
 block discarded – undo
841 841
 						<?php //} ?>
842 842
 
843 843
 						<?php
844
-						if ( $show_pagination ) {
845
-							$output_pagination = do_shortcode( '[facetwp pager="true"]' );
846
-							if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) {
847
-								foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
848
-									if ( isset( $this->facet_data[ $facet ] ) && in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) {
849
-										$output_pagination = do_shortcode( '[facetwp facet="pager_"]' );
844
+						if ($show_pagination) {
845
+							$output_pagination = do_shortcode('[facetwp pager="true"]');
846
+							if (!empty($this->options['display'][$this->search_prefix.'_facets']) && is_array($this->options['display'][$this->search_prefix.'_facets'])) {
847
+								foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) {
848
+									if (isset($this->facet_data[$facet]) && in_array($this->facet_data[$facet]['type'], array('pager'))) {
849
+										$output_pagination = do_shortcode('[facetwp facet="pager_"]');
850 850
 									}
851 851
 								}
852 852
 							}
853
-							echo wp_kses_post( $output_pagination );
853
+							echo wp_kses_post($output_pagination);
854 854
 						?>
855 855
 						<?php } ?>
856 856
 					</div>
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 	/**
885 885
 	 * Disables default sidebar.
886 886
 	 */
887
-	public function lsx_sidebar_enable( $sidebar_enabled ) {
887
+	public function lsx_sidebar_enable($sidebar_enabled) {
888 888
 		$sidebar_enabled = false;
889 889
 		return $sidebar_enabled;
890 890
 	}
@@ -894,19 +894,19 @@  discard block
 block discarded – undo
894 894
 	 */
895 895
 	public function search_sidebar() {
896 896
 
897
-		$this->options = apply_filters( 'lsx_search_sidebar_options', $this->options );
897
+		$this->options = apply_filters('lsx_search_sidebar_options', $this->options);
898 898
 		?>
899
-			<?php do_action( 'lsx_search_sidebar_before' ); ?>
899
+			<?php do_action('lsx_search_sidebar_before'); ?>
900 900
 
901
-			<div id="secondary" class="facetwp-sidebar widget-area <?php echo esc_attr( lsx_sidebar_class() ); ?>" role="complementary">
901
+			<div id="secondary" class="facetwp-sidebar widget-area <?php echo esc_attr(lsx_sidebar_class()); ?>" role="complementary">
902 902
 
903
-				<?php do_action( 'lsx_search_sidebar_top' ); ?>
903
+				<?php do_action('lsx_search_sidebar_top'); ?>
904 904
 
905
-				<?php if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) { ?>
905
+				<?php if (!empty($this->options['display'][$this->search_prefix.'_facets']) && is_array($this->options['display'][$this->search_prefix.'_facets'])) { ?>
906 906
 					<div class="row facetwp-row lsx-search-filer-area">
907
-						<h3 class="facetwp-filter-title"><?php echo esc_html_e( 'Refine by', 'lsx-search' ); ?></h3>
907
+						<h3 class="facetwp-filter-title"><?php echo esc_html_e('Refine by', 'lsx-search'); ?></h3>
908 908
 						<div class="col-xs-12 facetwp-item facetwp-filters-button hidden-sm hidden-md hidden-lg">
909
-							<button class="ssm-toggle-nav btn btn-block" rel="lsx-search-filters"><?php esc_html_e( 'Filters', 'lsx-search' ); ?> <i class="fa fa-chevron-down" aria-hidden="true"></i></button>
909
+							<button class="ssm-toggle-nav btn btn-block" rel="lsx-search-filters"><?php esc_html_e('Filters', 'lsx-search'); ?> <i class="fa fa-chevron-down" aria-hidden="true"></i></button>
910 910
 						</div>
911 911
 
912 912
 						<div class="ssm-overlay ssm-toggle-nav" rel="lsx-search-filters"></div>
@@ -914,16 +914,16 @@  discard block
 block discarded – undo
914 914
 						<div class="col-xs-12 facetwp-item-wrap facetwp-filters-wrap" id="lsx-search-filters">
915 915
 							<div class="row hidden-sm hidden-md hidden-lg ssm-row-margin-bottom">
916 916
 								<div class="col-xs-12 facetwp-item facetwp-filters-button">
917
-									<button class="ssm-close-btn ssm-toggle-nav btn btn-block" rel="lsx-search-filters"><?php esc_html_e( 'Close Filters', 'lsx-search' ); ?> <i class="fa fa-times" aria-hidden="true"></i></button>
917
+									<button class="ssm-close-btn ssm-toggle-nav btn btn-block" rel="lsx-search-filters"><?php esc_html_e('Close Filters', 'lsx-search'); ?> <i class="fa fa-times" aria-hidden="true"></i></button>
918 918
 								</div>
919 919
 							</div>
920 920
 
921 921
 							<div class="row">
922 922
 								<?php
923 923
 								// Slider.
924
-								foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
925
-									if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'alpha', 'search', 'pager', 'sort', 'autocomplete' ) ) ) {
926
-										$this->display_facet_default( $facet );
924
+								foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) {
925
+									if (isset($this->facet_data[$facet]) && !in_array($this->facet_data[$facet]['type'], array('alpha', 'search', 'pager', 'sort', 'autocomplete'))) {
926
+										$this->display_facet_default($facet);
927 927
 									}
928 928
 								}
929 929
 								?>
@@ -931,17 +931,17 @@  discard block
 block discarded – undo
931 931
 
932 932
 							<div class="row hidden-sm hidden-md hidden-lg ssm-row-margin-top">
933 933
 								<div class="col-xs-12 facetwp-item facetwp-filters-button">
934
-									<button class="ssm-apply-btn ssm-toggle-nav btn btn-block" rel="lsx-search-filters"><?php esc_html_e( 'Apply Filters', 'lsx-search' ); ?> <i class="fa fa-check" aria-hidden="true"></i></button>
934
+									<button class="ssm-apply-btn ssm-toggle-nav btn btn-block" rel="lsx-search-filters"><?php esc_html_e('Apply Filters', 'lsx-search'); ?> <i class="fa fa-check" aria-hidden="true"></i></button>
935 935
 								</div>
936 936
 							</div>
937 937
 						</div>
938 938
 					</div>
939 939
 				<?php } ?>
940 940
 
941
-				<?php do_action( 'lsx_search_sidebar_bottom' ); ?>
941
+				<?php do_action('lsx_search_sidebar_bottom'); ?>
942 942
 			</div>
943 943
 
944
-			<?php do_action( 'lsx_search_sidebar_after' ); ?>
944
+			<?php do_action('lsx_search_sidebar_after'); ?>
945 945
 		<?php
946 946
 	}
947 947
 
@@ -954,9 +954,9 @@  discard block
 block discarded – undo
954 954
 
955 955
 		$pager_facet_off = false;
956 956
 
957
-		if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) {
958
-			foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
959
-				if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) {
957
+		if (!empty($this->options['display'][$this->search_prefix.'_facets']) && is_array($this->options['display'][$this->search_prefix.'_facets'])) {
958
+			foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) {
959
+				if (isset($this->facet_data[$facet]) && !in_array($this->facet_data[$facet]['type'], array('pager'))) {
960 960
 					$pager_facet_off = true;
961 961
 				}
962 962
 			}
@@ -971,14 +971,14 @@  discard block
 block discarded – undo
971 971
 	public function display_facet_search() {
972 972
 		?>
973 973
 		<div class="col-xs-12 facetwp-item facetwp-form">
974
-			<form class="search-form lsx-search-form" action="<?php echo esc_attr( home_url() ); ?>" method="get">
974
+			<form class="search-form lsx-search-form" action="<?php echo esc_attr(home_url()); ?>" method="get">
975 975
 				<div class="input-group">
976 976
 					<div class="field">
977
-						<input class="facetwp-search search-field form-control" name="s" type="search" placeholder="<?php esc_html_e( 'Search', 'lsx-search' ); ?>..." autocomplete="off" value="<?php echo get_search_query() ?>">
977
+						<input class="facetwp-search search-field form-control" name="s" type="search" placeholder="<?php esc_html_e('Search', 'lsx-search'); ?>..." autocomplete="off" value="<?php echo get_search_query() ?>">
978 978
 					</div>
979 979
 
980 980
 					<div class="field submit-button">
981
-						<button class="search-submit btn" type="submit"><?php esc_html_e( 'Search', 'lsx-search' ); ?></button>
981
+						<button class="search-submit btn" type="submit"><?php esc_html_e('Search', 'lsx-search'); ?></button>
982 982
 					</div>
983 983
 				</div>
984 984
 			</form>
@@ -989,26 +989,26 @@  discard block
 block discarded – undo
989 989
 	/**
990 990
 	 * Display facet default.
991 991
 	 */
992
-	public function display_facet_default( $facet ) {
992
+	public function display_facet_default($facet) {
993 993
 
994
-		$show_collapse = ! isset( $this->options['display'][$this->search_prefix . '_collapse'] ) || 'on' !== $this->options['display'][$this->search_prefix . '_collapse'];
994
+		$show_collapse = !isset($this->options['display'][$this->search_prefix.'_collapse']) || 'on' !== $this->options['display'][$this->search_prefix.'_collapse'];
995 995
 		$col_class = '';
996 996
 
997
-		if ( 'search' === $this->facet_data[ $facet ]['type'] ) : ?>
998
-			<?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?>
997
+		if ('search' === $this->facet_data[$facet]['type']) : ?>
998
+			<?php echo do_shortcode('[facetwp facet="'.$facet.'"]'); ?>
999 999
 		<?php else : ?>
1000
-			<div class="col-xs-12 facetwp-item parent-facetwp-facet-<?php echo esc_html( $facet ); ?> <?php echo esc_attr( $col_class ); ?>">
1001
-				<?php if ( ! $show_collapse ) { ?>
1000
+			<div class="col-xs-12 facetwp-item parent-facetwp-facet-<?php echo esc_html($facet); ?> <?php echo esc_attr($col_class); ?>">
1001
+				<?php if (!$show_collapse) { ?>
1002 1002
 					<div class="facetwp-collapsed">
1003
-						<h3 class="lsx-search-title"><?php echo wp_kses_post( $this->facet_data[ $facet ]['label'] ); ?></h3>
1004
-						<button title="<?php echo esc_html_e( 'Click to Expand', 'lsx-search' ); ?>" class="facetwp-collapse" type="button" data-toggle="collapse" data-target="#collapse-<?php echo esc_html( $facet ); ?>" aria-expanded="false" aria-controls="collapse-<?php echo esc_html( $facet ); ?>"></button>
1003
+						<h3 class="lsx-search-title"><?php echo wp_kses_post($this->facet_data[$facet]['label']); ?></h3>
1004
+						<button title="<?php echo esc_html_e('Click to Expand', 'lsx-search'); ?>" class="facetwp-collapse" type="button" data-toggle="collapse" data-target="#collapse-<?php echo esc_html($facet); ?>" aria-expanded="false" aria-controls="collapse-<?php echo esc_html($facet); ?>"></button>
1005 1005
 					</div>
1006
-					<div id="collapse-<?php echo esc_html( $facet ); ?>" class="collapse">
1007
-						<?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?>
1006
+					<div id="collapse-<?php echo esc_html($facet); ?>" class="collapse">
1007
+						<?php echo do_shortcode('[facetwp facet="'.$facet.'"]'); ?>
1008 1008
 					</div>
1009 1009
 				<?php } else { ?>
1010
-					<h3 class="lsx-search-title"><?php echo wp_kses_post( $this->facet_data[ $facet ]['label'] ); ?></h3>
1011
-					<?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?>
1010
+					<h3 class="lsx-search-title"><?php echo wp_kses_post($this->facet_data[$facet]['label']); ?></h3>
1011
+					<?php echo do_shortcode('[facetwp facet="'.$facet.'"]'); ?>
1012 1012
 				<?php } ?>
1013 1013
 			</div>
1014 1014
 		<?php
@@ -1018,8 +1018,8 @@  discard block
 block discarded – undo
1018 1018
 	/**
1019 1019
 	 * Changes slot column class.
1020 1020
 	 */
1021
-	public function change_slot_column_class( $class ) {
1022
-		if ( is_post_type_archive( 'video' ) || is_tax( 'video-category' ) ) {
1021
+	public function change_slot_column_class($class) {
1022
+		if (is_post_type_archive('video') || is_tax('video-category')) {
1023 1023
 			$column_class = 'col-xs-12 col-sm-4';
1024 1024
 		}
1025 1025
 
@@ -1030,15 +1030,15 @@  discard block
 block discarded – undo
1030 1030
 	 * Add post type label to the title.
1031 1031
 	 */
1032 1032
 	public function add_label_to_title() {
1033
-		if ( is_search() ) {
1034
-			if ( ! empty( $this->options['display']['engine_search_enable_pt_label'] ) ) {
1033
+		if (is_search()) {
1034
+			if (!empty($this->options['display']['engine_search_enable_pt_label'])) {
1035 1035
 				$post_type = get_post_type();
1036
-				$post_type = str_replace( '_', ' ', $post_type );
1037
-				$post_type = str_replace( '-', ' ', $post_type );
1038
-				if ( 'tribe events' === $post_type ) {
1036
+				$post_type = str_replace('_', ' ', $post_type);
1037
+				$post_type = str_replace('-', ' ', $post_type);
1038
+				if ('tribe events' === $post_type) {
1039 1039
 					$post_type = 'Events';
1040 1040
 				}
1041
-				echo wp_kses_post( ' <span class="label label-default lsx-label-post-type">' . $post_type . '</span>' );
1041
+				echo wp_kses_post(' <span class="label label-default lsx-label-post-type">'.$post_type.'</span>');
1042 1042
 			}
1043 1043
 		}
1044 1044
 	}
@@ -1046,22 +1046,22 @@  discard block
 block discarded – undo
1046 1046
 	/**
1047 1047
 	 * Changes the sort options.
1048 1048
 	 */
1049
-	public function facetwp_sort_options( $options, $params ) {
1049
+	public function facetwp_sort_options($options, $params) {
1050 1050
 		$this->set_vars();
1051 1051
 
1052
-		if ( true === $this->search_enabled ) {
1053
-			if ( 'default' !== $params['template_name'] && 'wp' !== $params['template_name'] ) {
1052
+		if (true === $this->search_enabled) {
1053
+			if ('default' !== $params['template_name'] && 'wp' !== $params['template_name']) {
1054 1054
 				return $options;
1055 1055
 			}
1056 1056
 
1057
-			if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_date' ] ) ) {
1058
-				unset( $options['date_desc'] );
1059
-				unset( $options['date_asc'] );
1057
+			if (!empty($this->options['display'][$this->search_prefix.'_disable_date'])) {
1058
+				unset($options['date_desc']);
1059
+				unset($options['date_asc']);
1060 1060
 			}
1061 1061
 
1062
-			if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_az_sorting' ] ) ) {
1063
-				unset( $options['title_desc'] );
1064
-				unset( $options['title_asc'] );
1062
+			if (!empty($this->options['display'][$this->search_prefix.'_disable_az_sorting'])) {
1063
+				unset($options['title_desc']);
1064
+				unset($options['title_asc']);
1065 1065
 			}
1066 1066
 		}
1067 1067
 
@@ -1074,9 +1074,9 @@  discard block
 block discarded – undo
1074 1074
 	 *
1075 1075
 	 * @return mixed
1076 1076
 	 */
1077
-	public function kses_allowed_html( $allowedtags, $context ) {
1077
+	public function kses_allowed_html($allowedtags, $context) {
1078 1078
 		$allowedtags['a']['data-value'] = true;
1079
-		$allowedtags['a']['data-selection']  = true;
1079
+		$allowedtags['a']['data-selection'] = true;
1080 1080
 		$allowedtags['button']['data-toggle'] = true;
1081 1081
 		return $allowedtags;
1082 1082
 	}
@@ -1084,29 +1084,29 @@  discard block
 block discarded – undo
1084 1084
 	/**
1085 1085
 	 * Change FaceWP result count HTML
1086 1086
 	 */
1087
-	public function get_search_query( $keyword ) {
1088
-		global $wp_rewrite,$wp_query;
1087
+	public function get_search_query($keyword) {
1088
+		global $wp_rewrite, $wp_query;
1089 1089
 
1090
-		if ( empty( $keyword ) ) {
1091
-			if ( ! isset( $wp_rewrite ) || ! is_object( $wp_rewrite ) || ! $wp_rewrite->using_permalinks() ) {
1090
+		if (empty($keyword)) {
1091
+			if (!isset($wp_rewrite) || !is_object($wp_rewrite) || !$wp_rewrite->using_permalinks()) {
1092 1092
 				return;
1093 1093
 			}
1094 1094
 			$search_base = $wp_rewrite->search_base;
1095
-			if ( strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) !== false ) {
1096
-				$words = explode( "/{$search_base}/", $_SERVER['REQUEST_URI'] );
1097
-				$limit = count( $words );
1098
-				if ( isset( $words[ $limit - 1 ] ) ) {
1099
-					$keyword = $words[ $limit - 1 ];
1095
+			if (strpos($_SERVER['REQUEST_URI'], "/{$search_base}/") !== false) {
1096
+				$words = explode("/{$search_base}/", $_SERVER['REQUEST_URI']);
1097
+				$limit = count($words);
1098
+				if (isset($words[$limit - 1])) {
1099
+					$keyword = $words[$limit - 1];
1100 1100
 				}
1101 1101
 			}
1102 1102
 		}
1103 1103
 
1104
-		$needle = trim( '/ ' );
1105
-		$words = explode( $needle, $keyword );
1106
-		if ( is_array( $words ) && ! empty( $words ) ) {
1107
-			$keyword = $words[ count( $words ) - 1 ];
1104
+		$needle = trim('/ ');
1105
+		$words = explode($needle, $keyword);
1106
+		if (is_array($words) && !empty($words)) {
1107
+			$keyword = $words[count($words) - 1];
1108 1108
 		}
1109
-		$keyword = str_replace( '+', ' ', $keyword );
1109
+		$keyword = str_replace('+', ' ', $keyword);
1110 1110
 		return $keyword;
1111 1111
 	}
1112 1112
 }
Please login to merge, or discard this patch.