Passed
Push — fix/bugherd-fixes ( 7511a1 )
by Virginia
03:49
created
classes/class-frontend.php 1 patch
Spacing   +308 added lines, -308 removed lines patch added patch discarded remove patch
@@ -70,26 +70,26 @@  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' ) );
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 78
 
79
-		add_action( 'pre_get_posts', array( $this, 'filter_post_types' ) );
79
+		add_action('pre_get_posts', array($this, 'filter_post_types'));
80 80
 
81
-		add_filter( 'lsx_search_post_types', array( $this, 'register_post_types' ) );
82
-		add_filter( 'lsx_search_taxonomies', array( $this, 'register_taxonomies' ) );
83
-		add_filter( 'lsx_search_post_types_plural', array( $this, 'register_post_type_tabs' ) );
84
-		add_filter( 'facetwp_sort_options', array( $this, 'facetwp_sort_options' ), 10, 2 );
85
-		add_filter( 'wp_kses_allowed_html', array( $this, 'kses_allowed_html' ), 20, 2 );
81
+		add_filter('lsx_search_post_types', array($this, 'register_post_types'));
82
+		add_filter('lsx_search_taxonomies', array($this, 'register_taxonomies'));
83
+		add_filter('lsx_search_post_types_plural', array($this, 'register_post_type_tabs'));
84
+		add_filter('facetwp_sort_options', array($this, 'facetwp_sort_options'), 10, 2);
85
+		add_filter('wp_kses_allowed_html', array($this, 'kses_allowed_html'), 20, 2);
86 86
 
87 87
 		// Redirects.
88
-		add_action( 'template_redirect', array( $this, 'pretty_search_redirect' ) );
89
-		add_filter( 'pre_get_posts', array( $this, 'pretty_search_parse_query' ) );
88
+		add_action('template_redirect', array($this, 'pretty_search_redirect'));
89
+		add_filter('pre_get_posts', array($this, 'pretty_search_parse_query'));
90 90
 
91
-		add_action( 'lsx_search_sidebar_top', array( $this, 'search_sidebar_top' ) );
92
-		add_filter( 'facetwp_facet_html', array( $this, 'search_facet_html' ), 10, 2 );
91
+		add_action('lsx_search_sidebar_top', array($this, 'search_sidebar_top'));
92
+		add_filter('facetwp_facet_html', array($this, 'search_facet_html'), 10, 2);
93 93
 	}
94 94
 
95 95
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public static function get_instance() {
103 103
 		// If the single instance hasn't been set, set it now.
104
-		if ( null === self::$instance ) {
104
+		if (null === self::$instance) {
105 105
 			self::$instance = new self();
106 106
 		}
107 107
 		return self::$instance;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * Loads the variable classes and the static classes.
112 112
 	 */
113 113
 	private function load_classes() {
114
-		require_once LSX_SEARCH_PATH . 'classes/frontend/class-layout.php';
114
+		require_once LSX_SEARCH_PATH.'classes/frontend/class-layout.php';
115 115
 		$this->layout = frontend\Layout::get_instance();
116 116
 	}
117 117
 
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 	public function set_vars() {
122 122
 		$post_type = '';
123 123
 
124
-		$this->post_types      = apply_filters( 'lsx_search_post_types', array() );
125
-		$this->taxonomies      = apply_filters( 'lsx_search_taxonomies', array() );
126
-		$this->tabs            = apply_filters( 'lsx_search_post_types_plural', array() );
127
-		$this->options         = apply_filters( 'lsx_search_options', $this->options );
124
+		$this->post_types      = apply_filters('lsx_search_post_types', array());
125
+		$this->taxonomies      = apply_filters('lsx_search_taxonomies', array());
126
+		$this->tabs            = apply_filters('lsx_search_post_types_plural', array());
127
+		$this->options         = apply_filters('lsx_search_options', $this->options);
128 128
 		$this->post_types      = get_post_types();
129 129
 		$this->post_type_slugs = array(
130 130
 			'post'        => 'posts',
@@ -137,22 +137,22 @@  discard block
 block discarded – undo
137 137
 		);
138 138
 		$this->set_search_prefix();
139 139
 		$this->get_cmb2_options();
140
-		$this->search_enabled = apply_filters( 'lsx_search_enabled', $this->is_search_enabled(), $this );
141
-		$this->search_prefix  = apply_filters( 'lsx_search_prefix', $this->search_prefix, $this );
140
+		$this->search_enabled = apply_filters('lsx_search_enabled', $this->is_search_enabled(), $this);
141
+		$this->search_prefix  = apply_filters('lsx_search_prefix', $this->search_prefix, $this);
142 142
 	}
143 143
 
144 144
 	private function get_cmb2_options() {
145
-		$cmb2_options = get_option( 'lsx-search-settings' );
146
-		if ( false !== $cmb2_options && ! empty( $cmb2_options ) ) {
147
-			$this->set_search_prefix( true );
145
+		$cmb2_options = get_option('lsx-search-settings');
146
+		if (false !== $cmb2_options && !empty($cmb2_options)) {
147
+			$this->set_search_prefix(true);
148 148
 			$this->options['display'] = $cmb2_options;
149
-			foreach ( $this->options['display'] as $option_key => $option_value ) {
150
-				if ( is_array( $option_value ) && ! empty( $option_value ) ) {
149
+			foreach ($this->options['display'] as $option_key => $option_value) {
150
+				if (is_array($option_value) && !empty($option_value)) {
151 151
 					$new_values = array();
152
-					foreach ( $option_value as $empty_key => $key_value ) {
153
-						$new_values[ $key_value ] = 'on';
152
+					foreach ($option_value as $empty_key => $key_value) {
153
+						$new_values[$key_value] = 'on';
154 154
 					}
155
-					$this->options['display'][ $option_key ] = $new_values;
155
+					$this->options['display'][$option_key] = $new_values;
156 156
 				}
157 157
 			}
158 158
 			$this->new_options = true;
@@ -162,46 +162,46 @@  discard block
 block discarded – undo
162 162
 
163 163
 	private function disable_to_search_actions() {
164 164
 		global $lsx_to_search_fwp, $lsx_to_search;
165
-		if ( null !== $lsx_to_search ) {
165
+		if (null !== $lsx_to_search) {
166 166
 			// Redirects.
167
-			remove_filter( 'template_include', array( $lsx_to_search, 'search_template_include' ), 99 );
168
-			remove_action( 'template_redirect', array( $lsx_to_search, 'pretty_search_redirect' ) );
169
-			remove_filter( 'pre_get_posts', array( $lsx_to_search, 'pretty_search_parse_query' ) );
167
+			remove_filter('template_include', array($lsx_to_search, 'search_template_include'), 99);
168
+			remove_action('template_redirect', array($lsx_to_search, 'pretty_search_redirect'));
169
+			remove_filter('pre_get_posts', array($lsx_to_search, 'pretty_search_parse_query'));
170 170
 
171 171
 			// Layout Filter.
172
-			remove_filter( 'lsx_layout', array( $lsx_to_search, 'lsx_layout' ), 20, 1 );
173
-			remove_filter( 'lsx_layout_selector', array( $lsx_to_search, 'lsx_layout_selector' ), 10, 4 );
174
-			remove_filter( 'lsx_to_archive_layout', array( $lsx_to_search, 'lsx_to_search_archive_layout' ), 10, 2 );
172
+			remove_filter('lsx_layout', array($lsx_to_search, 'lsx_layout'), 20, 1);
173
+			remove_filter('lsx_layout_selector', array($lsx_to_search, 'lsx_layout_selector'), 10, 4);
174
+			remove_filter('lsx_to_archive_layout', array($lsx_to_search, 'lsx_to_search_archive_layout'), 10, 2);
175 175
 
176
-			remove_action( 'lsx_search_sidebar_top', array( $lsx_to_search, 'search_sidebar_top' ) );
177
-			remove_action( 'pre_get_posts', array( $lsx_to_search, 'price_sorting' ), 100 );
176
+			remove_action('lsx_search_sidebar_top', array($lsx_to_search, 'search_sidebar_top'));
177
+			remove_action('pre_get_posts', array($lsx_to_search, 'price_sorting'), 100);
178 178
 
179 179
 			//add_shortcode( 'lsx_search_form', array( 'LSX_TO_Search_Frontend', 'search_form' ) );
180
-			remove_filter( 'searchwp_short_circuit', array( $lsx_to_search, 'searchwp_short_circuit' ), 10, 2 );
181
-			remove_filter( 'get_search_query', array( $lsx_to_search, 'get_search_query' ) );
182
-			remove_filter( 'body_class', array( $lsx_to_search, 'to_add_search_url_class' ), 20 );
180
+			remove_filter('searchwp_short_circuit', array($lsx_to_search, 'searchwp_short_circuit'), 10, 2);
181
+			remove_filter('get_search_query', array($lsx_to_search, 'get_search_query'));
182
+			remove_filter('body_class', array($lsx_to_search, 'to_add_search_url_class'), 20);
183 183
 
184
-			remove_filter( 'facetwp_preload_url_vars', array( $lsx_to_search, 'preload_url_vars' ), 10, 1 );
185
-			remove_filter( 'wpseo_json_ld_search_url', array( $lsx_to_search, 'change_json_ld_search_url' ), 10, 1 );
184
+			remove_filter('facetwp_preload_url_vars', array($lsx_to_search, 'preload_url_vars'), 10, 1);
185
+			remove_filter('wpseo_json_ld_search_url', array($lsx_to_search, 'change_json_ld_search_url'), 10, 1);
186 186
 		}
187
-		if ( null !== $lsx_to_search_fwp ) {
188
-			remove_filter( 'facetwp_indexer_row_data', array( $lsx_to_search_fwp, 'facetwp_index_row_data' ), 10, 2 );
189
-			remove_filter( 'facetwp_index_row', array( $lsx_to_search_fwp, 'facetwp_index_row' ), 10, 2 );
187
+		if (null !== $lsx_to_search_fwp) {
188
+			remove_filter('facetwp_indexer_row_data', array($lsx_to_search_fwp, 'facetwp_index_row_data'), 10, 2);
189
+			remove_filter('facetwp_index_row', array($lsx_to_search_fwp, 'facetwp_index_row'), 10, 2);
190 190
 
191
-			remove_filter( 'facetwp_sort_options', array( $lsx_to_search_fwp, 'facet_sort_options' ), 10, 2 );
191
+			remove_filter('facetwp_sort_options', array($lsx_to_search_fwp, 'facet_sort_options'), 10, 2);
192 192
 
193
-			remove_filter( 'facetwp_pager_html', array( $lsx_to_search_fwp, 'facetwp_pager_html' ), 10, 2 );
194
-			remove_filter( 'facetwp_result_count', array( $lsx_to_search_fwp, 'facetwp_result_count' ), 10, 2 );
193
+			remove_filter('facetwp_pager_html', array($lsx_to_search_fwp, 'facetwp_pager_html'), 10, 2);
194
+			remove_filter('facetwp_result_count', array($lsx_to_search_fwp, 'facetwp_result_count'), 10, 2);
195 195
 
196
-			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'destination_facet_html' ), 10, 2 );
197
-			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'slide_facet_html' ), 10, 2 );
198
-			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'search_facet_html' ), 10, 2 );
199
-			remove_filter( 'facetwp_load_css', array( $lsx_to_search_fwp, 'facetwp_load_css' ), 10, 1 );
196
+			remove_filter('facetwp_facet_html', array($lsx_to_search_fwp, 'destination_facet_html'), 10, 2);
197
+			remove_filter('facetwp_facet_html', array($lsx_to_search_fwp, 'slide_facet_html'), 10, 2);
198
+			remove_filter('facetwp_facet_html', array($lsx_to_search_fwp, 'search_facet_html'), 10, 2);
199
+			remove_filter('facetwp_load_css', array($lsx_to_search_fwp, 'facetwp_load_css'), 10, 1);
200 200
 
201
-			if ( class_exists( 'LSX_Currencies' ) ) {
202
-				remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_lsx_currencies' ), 10, 2 );
201
+			if (class_exists('LSX_Currencies')) {
202
+				remove_filter('facetwp_render_output', array($lsx_to_search_fwp, 'slide_price_lsx_currencies'), 10, 2);
203 203
 			} else {
204
-				remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_to_currencies' ), 10, 2 );
204
+				remove_filter('facetwp_render_output', array($lsx_to_search_fwp, 'slide_price_to_currencies'), 10, 2);
205 205
 			}
206 206
 		}
207 207
 	}
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
 	public function is_search_enabled() {
215 215
 		$search_enabled = false;
216 216
 
217
-		if ( false === $this->new_options ) {
218
-			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 ] ) {
217
+		if (false === $this->new_options) {
218
+			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 219
 				$search_enabled = true;
220 220
 			}
221 221
 		} else {
222 222
 			$enable_prefix = $this->search_prefix;
223
-			if ( ! empty( $this->options ) && isset( $this->options['display'] ) && isset( $this->options['display'][ $enable_prefix . '_enable' ] ) && 'on' === $this->options['display'][ $enable_prefix . '_enable' ] ) {
223
+			if (!empty($this->options) && isset($this->options['display']) && isset($this->options['display'][$enable_prefix.'_enable']) && 'on' === $this->options['display'][$enable_prefix.'_enable']) {
224 224
 				$search_enabled = true;
225 225
 			}
226 226
 		}
@@ -232,44 +232,44 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @return void
234 234
 	 */
235
-	private function set_search_prefix( $new_prefixes = false ) {
236
-		$page_for_posts = get_option( 'page_for_posts' );
237
-		if ( false !== $new_prefixes ) {
235
+	private function set_search_prefix($new_prefixes = false) {
236
+		$page_for_posts = get_option('page_for_posts');
237
+		if (false !== $new_prefixes) {
238 238
 			$this->taxonomies = array();
239 239
 			$this->post_types = array();
240 240
 		}
241 241
 
242
-		if ( is_search() ) {
243
-			if ( false === $new_prefixes ) {
242
+		if (is_search()) {
243
+			if (false === $new_prefixes) {
244 244
 				$this->search_core_suffix = 'core';
245 245
 				$this->search_prefix      = 'search';
246 246
 			} else {
247 247
 				$this->search_core_suffix = 'enable';
248 248
 				$this->search_prefix      = 'engine_search';
249 249
 			}
250
-		} elseif ( is_post_type_archive( $this->post_types ) || is_tax() || is_page( $page_for_posts ) || is_home() || is_category() || is_tag() ) {
251
-			if ( false === $new_prefixes ) {
250
+		} elseif (is_post_type_archive($this->post_types) || is_tax() || is_page($page_for_posts) || is_home() || is_category() || is_tag()) {
251
+			if (false === $new_prefixes) {
252 252
 				$this->search_core_suffix = 'search';
253 253
 			} else {
254 254
 				$this->search_core_suffix = 'enable';
255 255
 			}
256 256
 
257
-			if ( is_tax() ) {
258
-				$tax = get_query_var( 'taxonomy' );
259
-				$tax = get_taxonomy( $tax );
257
+			if (is_tax()) {
258
+				$tax = get_query_var('taxonomy');
259
+				$tax = get_taxonomy($tax);
260 260
 				$post_type = $tax->object_type[0];
261
-			} else if ( is_page( $page_for_posts ) || is_category() || is_tag() || is_home() ) {
261
+			} else if (is_page($page_for_posts) || is_category() || is_tag() || is_home()) {
262 262
 				$post_type = 'post';
263 263
 			} else {
264
-				$post_type = get_query_var( 'post_type' );
264
+				$post_type = get_query_var('post_type');
265 265
 			}
266 266
 
267
-			if ( false === $new_prefixes ) {
268
-				if ( isset( $this->tabs[ $post_type ] ) ) {
269
-					$this->search_prefix = $this->tabs[ $post_type ] . '_archive';
267
+			if (false === $new_prefixes) {
268
+				if (isset($this->tabs[$post_type])) {
269
+					$this->search_prefix = $this->tabs[$post_type].'_archive';
270 270
 				}
271 271
 			} else {
272
-				$this->search_prefix = $post_type . '_search';
272
+				$this->search_prefix = $post_type.'_search';
273 273
 			}
274 274
 		}
275 275
 	}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function set_facetwp_vars() {
281 281
 
282
-		if ( class_exists( 'FacetWP' ) ) {
282
+		if (class_exists('FacetWP')) {
283 283
 			$facet_data = FWP()->helper->get_facets();
284 284
 		}
285 285
 
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
 
288 288
 		$this->facet_data['search_form'] = array(
289 289
 			'name' => 'search_form',
290
-			'label' => esc_html__( 'Search Form', 'lsx-search' ),
290
+			'label' => esc_html__('Search Form', 'lsx-search'),
291 291
 		);
292 292
 
293
-		if ( ! empty( $facet_data ) && is_array( $facet_data ) ) {
294
-			foreach ( $facet_data as $facet ) {
295
-				$this->facet_data[ $facet['name'] ] = $facet;
293
+		if (!empty($facet_data) && is_array($facet_data)) {
294
+			foreach ($facet_data as $facet) {
295
+				$this->facet_data[$facet['name']] = $facet;
296 296
 			}
297 297
 		}
298 298
 	}
@@ -302,61 +302,61 @@  discard block
 block discarded – undo
302 302
 	 */
303 303
 	public function core() {
304 304
 
305
-		if ( true === $this->search_enabled ) {
306
-			add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 999 );
305
+		if (true === $this->search_enabled) {
306
+			add_action('wp_enqueue_scripts', array($this, 'assets'), 999);
307 307
 
308
-			add_filter( 'lsx_layout', array( $this, 'lsx_layout' ), 20, 1 );
309
-			add_filter( 'lsx_layout_selector', array( $this, 'lsx_layout_selector' ), 10, 4 );
310
-			add_filter( 'lsx_slot_class', array( $this, 'change_slot_column_class' ) );
311
-			add_action( 'lsx_entry_top', array( $this, 'add_label_to_title' ) );
312
-			add_filter( 'body_class', array( $this, 'body_class' ), 10 );
308
+			add_filter('lsx_layout', array($this, 'lsx_layout'), 20, 1);
309
+			add_filter('lsx_layout_selector', array($this, 'lsx_layout_selector'), 10, 4);
310
+			add_filter('lsx_slot_class', array($this, 'change_slot_column_class'));
311
+			add_action('lsx_entry_top', array($this, 'add_label_to_title'));
312
+			add_filter('body_class', array($this, 'body_class'), 10);
313 313
 
314
-			add_filter( 'lsx_blog_customizer_top_of_blog_action', array( $this, 'top_of_blog_action' ), 10, 1 );
315
-			add_filter( 'lsx_blog_customizer_blog_description_class', array( $this, 'blog_description_class' ), 10, 1 );
314
+			add_filter('lsx_blog_customizer_top_of_blog_action', array($this, 'top_of_blog_action'), 10, 1);
315
+			add_filter('lsx_blog_customizer_blog_description_class', array($this, 'blog_description_class'), 10, 1);
316 316
 
317
-			if ( class_exists( 'LSX_Videos' ) ) {
317
+			if (class_exists('LSX_Videos')) {
318 318
 				global $lsx_videos_frontend;
319
-				remove_action( 'lsx_content_top', array( $lsx_videos_frontend, 'categories_tabs' ), 15 );
319
+				remove_action('lsx_content_top', array($lsx_videos_frontend, 'categories_tabs'), 15);
320 320
 			}
321 321
 
322
-			add_filter( 'lsx_paging_nav_disable', '__return_true' );
323
-			add_action( 'lsx_content_top', array( $this, 'facet_top_bar' ) );
324
-			add_action( 'lsx_content_top', array( $this, 'facetwp_tempate_open' ) );
325
-			add_action( 'lsx_content_bottom', array( $this, 'facetwp_tempate_close' ) );
326
-			add_action( 'lsx_content_bottom', array( $this, 'facet_bottom_bar' ) );
322
+			add_filter('lsx_paging_nav_disable', '__return_true');
323
+			add_action('lsx_content_top', array($this, 'facet_top_bar'));
324
+			add_action('lsx_content_top', array($this, 'facetwp_tempate_open'));
325
+			add_action('lsx_content_bottom', array($this, 'facetwp_tempate_close'));
326
+			add_action('lsx_content_bottom', array($this, 'facet_bottom_bar'));
327 327
 
328
-			if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) && '1c' !== $this->options['display'][ $this->search_prefix . '_layout' ] ) {
329
-				add_filter( 'lsx_sidebar_enable', array( $this, 'lsx_sidebar_enable' ), 10, 1 );
328
+			if (!empty($this->options['display'][$this->search_prefix.'_layout']) && '1c' !== $this->options['display'][$this->search_prefix.'_layout']) {
329
+				add_filter('lsx_sidebar_enable', array($this, 'lsx_sidebar_enable'), 10, 1);
330 330
 			}
331 331
 
332
-			add_action( 'lsx_content_wrap_before', array( $this, 'search_sidebar' ), 150 );
332
+			add_action('lsx_content_wrap_before', array($this, 'search_sidebar'), 150);
333 333
 
334
-			if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_category() || is_product_tag() ) ) {
335
-				remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description' );
336
-				remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description' );
337
-				add_filter( 'woocommerce_show_page_title', '__return_false' );
334
+			if (class_exists('WooCommerce') && (is_shop() || is_product_category() || is_product_tag())) {
335
+				remove_action('woocommerce_archive_description', 'woocommerce_taxonomy_archive_description');
336
+				remove_action('woocommerce_archive_description', 'woocommerce_product_archive_description');
337
+				add_filter('woocommerce_show_page_title', '__return_false');
338 338
 
339
-				add_filter( 'loop_shop_columns', function() {
339
+				add_filter('loop_shop_columns', function() {
340 340
 					return 3;
341 341
 				} );
342 342
 
343 343
 				// Actions added by LSX theme
344
-				remove_action( 'lsx_content_wrap_before', 'lsx_global_header' );
345
-				add_action( 'lsx_content_wrap_before', array( $this, 'wc_archive_header' ), 140 );
344
+				remove_action('lsx_content_wrap_before', 'lsx_global_header');
345
+				add_action('lsx_content_wrap_before', array($this, 'wc_archive_header'), 140);
346 346
 
347 347
 				// Actions added be LSX theme / woocommerce.php file
348
-				remove_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 );
349
-				remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
350
-				remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 );
351
-				remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 );
352
-				remove_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 );
348
+				remove_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9);
349
+				remove_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10);
350
+				remove_action('woocommerce_after_shop_loop', 'woocommerce_result_count', 20);
351
+				remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 30);
352
+				remove_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31);
353 353
 
354 354
 				// Actions added be LSX theme / woocommerce.php file
355
-				remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 );
356
-				remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
357
-				remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
358
-				remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 );
359
-				remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 );
355
+				remove_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9);
356
+				remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10);
357
+				remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20);
358
+				remove_action('woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30);
359
+				remove_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31);
360 360
 			}
361 361
 		}
362 362
 	}
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	 * @param  array $classes The classes.
368 368
 	 * @return array $classes The classes.
369 369
 	 */
370
-	public function body_class( $classes ) {
370
+	public function body_class($classes) {
371 371
 		$classes[] = 'lsx-search-enabled';
372 372
 		return $classes;
373 373
 	}
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 	 * @param  string $action
379 379
 	 * @return string $action
380 380
 	 */
381
-	public function top_of_blog_action( $action = '' ) {
381
+	public function top_of_blog_action($action = '') {
382 382
 		$action = 'lsx_content_wrap_before';
383 383
 		return $action;
384 384
 	}
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 * @param  string $action
390 390
 	 * @return string $action
391 391
 	 */
392
-	public function blog_description_class( $class = '' ) {
392
+	public function blog_description_class($class = '') {
393 393
 		$class .= ' col-md-12 search-description';
394 394
 		return $class;
395 395
 	}
@@ -400,13 +400,13 @@  discard block
 block discarded – undo
400 400
 	 * @return void
401 401
 	 */
402 402
 	public function check_for_results() {
403
-		if ( true === $this->search_enabled ) {
403
+		if (true === $this->search_enabled) {
404 404
 			global $wp_query;
405
-			if ( empty( $wp_query->posts ) ) {
405
+			if (empty($wp_query->posts)) {
406 406
 				$this->has_posts = false;
407
-				remove_action( 'lsx_content_top', array( $this, 'facet_top_bar' ) );
408
-				remove_action( 'lsx_content_bottom', array( $this, 'facet_bottom_bar' ) );
409
-				remove_action( 'lsx_content_wrap_before', array( $this, 'search_sidebar' ), 150 );
407
+				remove_action('lsx_content_top', array($this, 'facet_top_bar'));
408
+				remove_action('lsx_content_bottom', array($this, 'facet_bottom_bar'));
409
+				remove_action('lsx_content_wrap_before', array($this, 'search_sidebar'), 150);
410 410
 			} else {
411 411
 				$this->has_posts = true;
412 412
 			}
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	/**
417 417
 	 * Filter the post types.
418 418
 	 */
419
-	public function filter_post_types( $query ) {
420
-		if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) {
421
-			if ( ! empty( $this->options ) && ! empty( $this->options['display']['search_enable_core'] ) ) {
422
-				if ( ! empty( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) {
423
-					$post_types = array_keys( $this->options['general']['search_post_types'] );
424
-					$query->set( 'post_type', $post_types );
419
+	public function filter_post_types($query) {
420
+		if (!is_admin() && $query->is_main_query() && $query->is_search()) {
421
+			if (!empty($this->options) && !empty($this->options['display']['search_enable_core'])) {
422
+				if (!empty($this->options['general']['search_post_types']) && is_array($this->options['general']['search_post_types'])) {
423
+					$post_types = array_keys($this->options['general']['search_post_types']);
424
+					$query->set('post_type', $post_types);
425 425
 				}
426 426
 			}
427 427
 		}
@@ -430,23 +430,23 @@  discard block
 block discarded – undo
430 430
 	/**
431 431
 	 * Sets post types with active search options.
432 432
 	 */
433
-	public function register_post_types( $post_types ) {
434
-		$post_types = array( 'post', 'project', 'service', 'team', 'testimonial', 'video', 'product' );
433
+	public function register_post_types($post_types) {
434
+		$post_types = array('post', 'project', 'service', 'team', 'testimonial', 'video', 'product');
435 435
 		return $post_types;
436 436
 	}
437 437
 
438 438
 	/**
439 439
 	 * Sets taxonomies with active search options.
440 440
 	 */
441
-	public function register_taxonomies( $taxonomies ) {
442
-		$taxonomies = array( 'category', 'post_tag', 'project-group', 'service-group', 'team_role', 'video-category', 'product_cat', 'product_tag' );
441
+	public function register_taxonomies($taxonomies) {
442
+		$taxonomies = array('category', 'post_tag', 'project-group', 'service-group', 'team_role', 'video-category', 'product_cat', 'product_tag');
443 443
 		return $taxonomies;
444 444
 	}
445 445
 
446 446
 	/**
447 447
 	 * Sets post types with active search options.
448 448
 	 */
449
-	public function register_post_type_tabs( $post_types_plural ) {
449
+	public function register_post_type_tabs($post_types_plural) {
450 450
 		$post_types_plural = array(
451 451
 			'post' => 'posts',
452 452
 			'project' => 'projects',
@@ -463,23 +463,23 @@  discard block
 block discarded – undo
463 463
 	 * Enqueue styles and scripts.
464 464
 	 */
465 465
 	public function assets() {
466
-		add_filter( 'lsx_defer_parsing_of_js', array( $this, 'skip_js_defer' ), 10, 4 );
467
-		wp_enqueue_script( 'touchSwipe', LSX_SEARCH_URL . 'assets/js/vendor/jquery.touchSwipe.min.js', array( 'jquery' ), LSX_SEARCH_VER, true );
468
-		wp_enqueue_script( 'slideandswipe', LSX_SEARCH_URL . 'assets/js/vendor/jquery.slideandswipe.min.js', array( 'jquery', 'touchSwipe' ), LSX_SEARCH_VER, true );
469
-		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 );
466
+		add_filter('lsx_defer_parsing_of_js', array($this, 'skip_js_defer'), 10, 4);
467
+		wp_enqueue_script('touchSwipe', LSX_SEARCH_URL.'assets/js/vendor/jquery.touchSwipe.min.js', array('jquery'), LSX_SEARCH_VER, true);
468
+		wp_enqueue_script('slideandswipe', LSX_SEARCH_URL.'assets/js/vendor/jquery.slideandswipe.min.js', array('jquery', 'touchSwipe'), LSX_SEARCH_VER, true);
469
+		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);
470 470
 
471
-		$params = apply_filters( 'lsx_search_js_params', array(
472
-			'ajax_url' => admin_url( 'admin-ajax.php' ),
471
+		$params = apply_filters('lsx_search_js_params', array(
472
+			'ajax_url' => admin_url('admin-ajax.php'),
473 473
 		));
474 474
 
475
-		wp_localize_script( 'lsx-search', 'lsx_customizer_params', $params );
475
+		wp_localize_script('lsx-search', 'lsx_customizer_params', $params);
476 476
 
477
-		wp_enqueue_style( 'lsx-search', LSX_SEARCH_URL . 'assets/css/lsx-search.css', array(), LSX_SEARCH_VER );
478
-		wp_style_add_data( 'lsx-search', 'rtl', 'replace' );
477
+		wp_enqueue_style('lsx-search', LSX_SEARCH_URL.'assets/css/lsx-search.css', array(), LSX_SEARCH_VER);
478
+		wp_style_add_data('lsx-search', 'rtl', 'replace');
479 479
 
480
-		if ( true === $this->new_options ) {
481
-			wp_deregister_style( 'lsx_to_search' );
482
-			wp_deregister_script( 'lsx_to_search' );
480
+		if (true === $this->new_options) {
481
+			wp_deregister_style('lsx_to_search');
482
+			wp_deregister_script('lsx_to_search');
483 483
 		}
484 484
 	}
485 485
 
@@ -492,8 +492,8 @@  discard block
 block discarded – undo
492 492
 	 * @param string  $href
493 493
 	 * @return boolean
494 494
 	 */
495
-	public function skip_js_defer( $should_skip, $tag, $handle, $href ) {
496
-		if ( ! is_admin() && ( false !== stripos( $href, 'lsx-search.min.js' ) || false !== stripos( $href, 'lsx-search.js' ) ) ) {
495
+	public function skip_js_defer($should_skip, $tag, $handle, $href) {
496
+		if (!is_admin() && (false !== stripos($href, 'lsx-search.min.js') || false !== stripos($href, 'lsx-search.js'))) {
497 497
 			$should_skip = true;
498 498
 		}
499 499
 		return $should_skip;
@@ -505,10 +505,10 @@  discard block
 block discarded – undo
505 505
 	 * @param	$template
506 506
 	 * @return	$template
507 507
 	 */
508
-	public function search_template_include( $template ) {
509
-		if ( is_main_query() && is_search() ) {
510
-			if ( file_exists( LSX_SEARCH_PATH . 'templates/search.php' ) ) {
511
-				$template = LSX_SEARCH_PATH . 'templates/search.php';
508
+	public function search_template_include($template) {
509
+		if (is_main_query() && is_search()) {
510
+			if (file_exists(LSX_SEARCH_PATH.'templates/search.php')) {
511
+				$template = LSX_SEARCH_PATH.'templates/search.php';
512 512
 			}
513 513
 		}
514 514
 
@@ -519,44 +519,44 @@  discard block
 block discarded – undo
519 519
 	 * Rewrite the search URL
520 520
 	 */
521 521
 	public function pretty_search_redirect() {
522
-		global $wp_rewrite,$wp_query;
522
+		global $wp_rewrite, $wp_query;
523 523
 
524
-		if ( ! isset( $wp_rewrite ) || ! is_object( $wp_rewrite ) || ! $wp_rewrite->using_permalinks() ) {
524
+		if (!isset($wp_rewrite) || !is_object($wp_rewrite) || !$wp_rewrite->using_permalinks()) {
525 525
 			return;
526 526
 		}
527 527
 
528 528
 		$search_base = $wp_rewrite->search_base;
529 529
 
530
-		if ( is_search() && ! is_admin() && strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) === false ) {
531
-			$search_query = get_query_var( 's' );
530
+		if (is_search() && !is_admin() && strpos($_SERVER['REQUEST_URI'], "/{$search_base}/") === false) {
531
+			$search_query = get_query_var('s');
532 532
 			$engine = '';
533 533
 
534 534
 			// If the search was triggered by a supplemental engine.
535
-			if ( isset( $_GET['engine'] ) && 'default' !== $_GET['engine'] ) {
535
+			if (isset($_GET['engine']) && 'default' !== $_GET['engine']) {
536 536
 				$engine = $_GET['engine'];
537
-				set_query_var( 'engine', $engine );
538
-				$engine = array_search( $engine, $this->post_type_slugs, true ) . '/';
537
+				set_query_var('engine', $engine);
538
+				$engine = array_search($engine, $this->post_type_slugs, true).'/';
539 539
 			}
540 540
 
541 541
 			$get_array = $_GET;
542 542
 
543
-			if ( is_array( $get_array ) && ! empty( $get_array ) ) {
543
+			if (is_array($get_array) && !empty($get_array)) {
544 544
 				$vars_to_maintain = array();
545 545
 
546
-				foreach ( $get_array as $ga_key => $ga_value ) {
547
-					if ( false !== strpos( $ga_key, 'fwp_' ) ) {
548
-						$vars_to_maintain[] = $ga_key . '=' . $ga_value;
546
+				foreach ($get_array as $ga_key => $ga_value) {
547
+					if (false !== strpos($ga_key, 'fwp_')) {
548
+						$vars_to_maintain[] = $ga_key.'='.$ga_value;
549 549
 					}
550 550
 				}
551 551
 			}
552 552
 
553
-			$redirect_url = home_url( "/{$search_base}/" . $engine . urlencode( $search_query ) );
553
+			$redirect_url = home_url("/{$search_base}/".$engine.urlencode($search_query));
554 554
 
555
-			if ( ! empty( $vars_to_maintain ) ) {
556
-				$redirect_url .= '?' . implode( '&', $vars_to_maintain );
555
+			if (!empty($vars_to_maintain)) {
556
+				$redirect_url .= '?'.implode('&', $vars_to_maintain);
557 557
 			}
558 558
 
559
-			wp_redirect( $redirect_url );
559
+			wp_redirect($redirect_url);
560 560
 			exit();
561 561
 		}
562 562
 	}
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 	/**
565 565
 	 * Parse the Query and trigger a search
566 566
 	 */
567
-	public function pretty_search_parse_query( $query ) {
567
+	public function pretty_search_parse_query($query) {
568 568
 		$this->post_type_slugs = array(
569 569
 			'post' => 'posts',
570 570
 			'project' => 'projects',
@@ -574,26 +574,26 @@  discard block
 block discarded – undo
574 574
 			'video' => 'videos',
575 575
 			'product' => 'products', // WooCommerce
576 576
 		);
577
-		if ( $query->is_search() && ! is_admin() && $query->is_main_query() ) {
578
-			$search_query = $query->get( 's' );
579
-			$keyword_test = explode( '/', $search_query );
577
+		if ($query->is_search() && !is_admin() && $query->is_main_query()) {
578
+			$search_query = $query->get('s');
579
+			$keyword_test = explode('/', $search_query);
580 580
 
581
-			$index = array_search( $keyword_test[0], $this->post_type_slugs, true );
582
-			if ( false !== $index ) {
583
-				$engine = $this->post_type_slugs[ $index ];
581
+			$index = array_search($keyword_test[0], $this->post_type_slugs, true);
582
+			if (false !== $index) {
583
+				$engine = $this->post_type_slugs[$index];
584 584
 
585
-				$query->set( 'post_type', $engine );
586
-				$query->set( 'engine', $engine );
585
+				$query->set('post_type', $engine);
586
+				$query->set('engine', $engine);
587 587
 
588
-				if ( count( $keyword_test ) > 1 ) {
589
-					$query->set( 's', $keyword_test[1] );
590
-				} elseif ( post_type_exists( $engine ) ) {
591
-					$query->set( 's', '' );
588
+				if (count($keyword_test) > 1) {
589
+					$query->set('s', $keyword_test[1]);
590
+				} elseif (post_type_exists($engine)) {
591
+					$query->set('s', '');
592 592
 				}
593 593
 			} else {
594
-				if ( isset( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) {
595
-					$post_types = array_keys( $this->options['general']['search_post_types'] );
596
-					$query->set( 'post_type', $post_types );
594
+				if (isset($this->options['general']['search_post_types']) && is_array($this->options['general']['search_post_types'])) {
595
+					$post_types = array_keys($this->options['general']['search_post_types']);
596
+					$query->set('post_type', $post_types);
597 597
 				}
598 598
 			}
599 599
 		}
@@ -607,18 +607,18 @@  discard block
 block discarded – undo
607 607
 	 * @return url
608 608
 	 */
609 609
 	public function change_json_ld_search_url() {
610
-		return trailingslashit( home_url() ) . 'search/{search_term_string}';
610
+		return trailingslashit(home_url()).'search/{search_term_string}';
611 611
 	}
612 612
 
613 613
 	/**
614 614
 	 * A filter to set the layout to 2 column.
615 615
 	 */
616
-	public function lsx_layout( $layout ) {
617
-		if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) {
618
-			if ( false === $this->has_posts ) {
616
+	public function lsx_layout($layout) {
617
+		if (!empty($this->options['display'][$this->search_prefix.'_layout'])) {
618
+			if (false === $this->has_posts) {
619 619
 				$layout = '1c';
620 620
 			} else {
621
-				$layout = $this->options['display'][ $this->search_prefix . '_layout' ];
621
+				$layout = $this->options['display'][$this->search_prefix.'_layout'];
622 622
 			}
623 623
 		}
624 624
 		return $layout;
@@ -628,23 +628,23 @@  discard block
 block discarded – undo
628 628
 	 * Outputs the Search Title Facet
629 629
 	 */
630 630
 	public function search_sidebar_top() {
631
-		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 ) ) {
631
+		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)) {
632 632
 
633
-			if ( ! is_search() ) {
633
+			if (!is_search()) {
634 634
 
635
-				foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
635
+				foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) {
636 636
 
637
-					if ( isset( $this->facet_data[ $facet ] ) && 'search' === $this->facet_data[ $facet ]['type'] ) {
638
-						echo wp_kses_post( '<div class="row">' );
639
-							$this->display_facet_default( $facet );
640
-						echo wp_kses_post( '</div>' );
641
-						unset( $this->options['display'][ $this->search_prefix . '_facets' ][ $facet ] );
637
+					if (isset($this->facet_data[$facet]) && 'search' === $this->facet_data[$facet]['type']) {
638
+						echo wp_kses_post('<div class="row">');
639
+							$this->display_facet_default($facet);
640
+						echo wp_kses_post('</div>');
641
+						unset($this->options['display'][$this->search_prefix.'_facets'][$facet]);
642 642
 					}
643 643
 				}
644 644
 			} else {
645
-				echo wp_kses_post( '<div class="row">' );
645
+				echo wp_kses_post('<div class="row">');
646 646
 					$this->display_facet_search();
647
-				echo wp_kses_post( '</div>' );
647
+				echo wp_kses_post('</div>');
648 648
 			}
649 649
 		}
650 650
 	}
@@ -656,13 +656,13 @@  discard block
 block discarded – undo
656 656
 	 *
657 657
 	 * @return string
658 658
 	 */
659
-	public function search_facet_html( $output, $params ) {
660
-		if ( 'search' == $params['facet']['type'] ) {
659
+	public function search_facet_html($output, $params) {
660
+		if ('search' == $params['facet']['type']) {
661 661
 
662 662
 			$value = (array) $params['selected_values'];
663
-			$value = empty( $value ) ? '' : stripslashes( $value[0] );
664
-			$placeholder = isset( $params['facet']['placeholder'] ) ? $params['facet']['placeholder'] : __( 'Search...', 'lsx-search' );
665
-			$placeholder = facetwp_i18n( $placeholder );
663
+			$value = empty($value) ? '' : stripslashes($value[0]);
664
+			$placeholder = isset($params['facet']['placeholder']) ? $params['facet']['placeholder'] : __('Search...', 'lsx-search');
665
+			$placeholder = facetwp_i18n($placeholder);
666 666
 
667 667
 			ob_start();
668 668
 			?>
@@ -670,11 +670,11 @@  discard block
 block discarded – undo
670 670
 				<div class="search-form lsx-search-form 2">
671 671
 					<div class="input-group facetwp-search-wrap">
672 672
 						<div class="field">
673
-							<input class="facetwp-search search-field form-control" type="text" placeholder="<?php echo esc_attr( $placeholder ); ?>" autocomplete="off" value="<?php echo esc_attr( $value ); ?>">
673
+							<input class="facetwp-search search-field form-control" type="text" placeholder="<?php echo esc_attr($placeholder); ?>" autocomplete="off" value="<?php echo esc_attr($value); ?>">
674 674
 						</div>
675 675
 
676 676
 						<div class="field submit-button">
677
-							<button class="search-submit btn facetwp-btn" type="submit"><?php esc_html_e( 'Search', 'lsx-search' ); ?></button>
677
+							<button class="search-submit btn facetwp-btn" type="submit"><?php esc_html_e('Search', 'lsx-search'); ?></button>
678 678
 						</div>
679 679
 					</div>
680 680
 				</div>
@@ -688,23 +688,23 @@  discard block
 block discarded – undo
688 688
 	/**
689 689
 	 * Change the primary and secondary column classes.
690 690
 	 */
691
-	public function lsx_layout_selector( $return_class, $class, $layout, $size ) {
692
-		if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) {
691
+	public function lsx_layout_selector($return_class, $class, $layout, $size) {
692
+		if (!empty($this->options['display'][$this->search_prefix.'_layout'])) {
693 693
 
694
-			if ( '2cl' === $layout || '2cr' === $layout ) {
694
+			if ('2cl' === $layout || '2cr' === $layout) {
695 695
 				$main_class    = 'col-sm-8 col-md-9';
696 696
 				$sidebar_class = 'col-sm-4 col-md-3';
697 697
 
698
-				if ( '2cl' === $layout ) {
698
+				if ('2cl' === $layout) {
699 699
 					$main_class    .= ' col-sm-pull-4 col-md-pull-3';
700 700
 					$sidebar_class .= ' col-sm-push-8 col-md-push-9';
701 701
 				}
702 702
 
703
-				if ( 'main' === $class ) {
703
+				if ('main' === $class) {
704 704
 					return $main_class;
705 705
 				}
706 706
 
707
-				if ( 'sidebar' === $class ) {
707
+				if ('sidebar' === $class) {
708 708
 					return $sidebar_class;
709 709
 				}
710 710
 			}
@@ -719,14 +719,14 @@  discard block
 block discarded – undo
719 719
 	 * @return void
720 720
 	 */
721 721
 	public function display_alphabet_facet() {
722
-		if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) {
723
-			$az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ];
722
+		if (isset($this->options['display'][$this->search_prefix.'_az_pagination'])) {
723
+			$az_pagination = $this->options['display'][$this->search_prefix.'_az_pagination'];
724 724
 		} else {
725 725
 			$az_pagination = false;
726 726
 		}
727
-		$az_pagination = apply_filters( 'lsx_search_top_az_pagination', $az_pagination );
728
-		if ( false !== $az_pagination && '' !== $az_pagination ) {
729
-			echo do_shortcode( '[facetwp facet="' . $az_pagination . '"]' );
727
+		$az_pagination = apply_filters('lsx_search_top_az_pagination', $az_pagination);
728
+		if (false !== $az_pagination && '' !== $az_pagination) {
729
+			echo do_shortcode('[facetwp facet="'.$az_pagination.'"]');
730 730
 		}
731 731
 	}
732 732
 
@@ -734,43 +734,43 @@  discard block
 block discarded – undo
734 734
 	 * Outputs top.
735 735
 	 */
736 736
 	public function facet_top_bar() {
737
-		if ( true === apply_filters( 'lsx_search_hide_top_bar', false ) ) {
737
+		if (true === apply_filters('lsx_search_hide_top_bar', false)) {
738 738
 			return;
739 739
 		}
740 740
 		$show_pagination     = true;
741 741
 		$pagination_visible  = false;
742
-		$show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] );
743
-		$show_sort_combo     = empty( $this->options['display'][ $this->search_prefix . '_disable_all_sorting' ] );
744
-
745
-		$show_pagination     = apply_filters( 'lsx_search_top_show_pagination', $show_pagination );
746
-		$pagination_visible  = apply_filters( 'lsx_search_top_pagination_visible', $pagination_visible );
747
-		$show_per_page_combo = apply_filters( 'lsx_search_top_show_per_page_combo', $show_per_page_combo );
748
-		$show_sort_combo     = apply_filters( 'lsx_search_top_show_sort_combo', $show_sort_combo );
749
-		$facet_row_classes   = apply_filters( 'lsx_search_top_facetwp_row_classes', '' );
742
+		$show_per_page_combo = empty($this->options['display'][$this->search_prefix.'_disable_per_page']);
743
+		$show_sort_combo     = empty($this->options['display'][$this->search_prefix.'_disable_all_sorting']);
744
+
745
+		$show_pagination     = apply_filters('lsx_search_top_show_pagination', $show_pagination);
746
+		$pagination_visible  = apply_filters('lsx_search_top_pagination_visible', $pagination_visible);
747
+		$show_per_page_combo = apply_filters('lsx_search_top_show_per_page_combo', $show_per_page_combo);
748
+		$show_sort_combo     = apply_filters('lsx_search_top_show_sort_combo', $show_sort_combo);
749
+		$facet_row_classes   = apply_filters('lsx_search_top_facetwp_row_classes', '');
750 750
 		?>
751 751
 		<div id="facetwp-top">
752
-			<?php if ( $show_sort_combo || ( $show_pagination && $show_per_page_combo ) ) { ?>
753
-				<div class="row facetwp-top-row-1 hidden-xs <?php echo esc_attr( $facet_row_classes ); ?>">
752
+			<?php if ($show_sort_combo || ($show_pagination && $show_per_page_combo)) { ?>
753
+				<div class="row facetwp-top-row-1 hidden-xs <?php echo esc_attr($facet_row_classes); ?>">
754 754
 					<div class="col-xs-12">
755 755
 
756
-						<?php if ( ! empty( $this->options['display'][ $this->search_prefix . '_display_result_count' ] ) && false === apply_filters( 'lsx_search_hide_result_count', false ) ) { ?>
756
+						<?php if (!empty($this->options['display'][$this->search_prefix.'_display_result_count']) && false === apply_filters('lsx_search_hide_result_count', false)) { ?>
757 757
 							<div class="row">
758 758
 								<div class="col-md-12 facetwp-item facetwp-results">
759
-									<h3 class="lsx-search-title lsx-search-title-results"><?php esc_html_e( 'Results', 'lsx-search' ); ?> <?php echo '(' . do_shortcode( '[facetwp counts="true"]' ) . ')&nbsp;'; ?>
760
-									<?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' ] ) { ?>
761
-										<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>
759
+									<h3 class="lsx-search-title lsx-search-title-results"><?php esc_html_e('Results', 'lsx-search'); ?> <?php echo '('.do_shortcode('[facetwp counts="true"]').')&nbsp;'; ?>
760
+									<?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']) { ?>
761
+										<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>
762 762
 									<?php } ?>
763 763
 									</h3>
764 764
 								</div>
765 765
 							</div>
766 766
 						<?php } ?>
767 767
 
768
-						<?php do_action( 'lsx_search_facetwp_top_row' ); ?>
768
+						<?php do_action('lsx_search_facetwp_top_row'); ?>
769 769
 
770 770
 						<?php $this->display_alphabet_facet(); ?>
771 771
 
772
-						<?php if ( $show_sort_combo ) { ?>
773
-							<?php echo do_shortcode( '[facetwp sort="true"]' ); ?>
772
+						<?php if ($show_sort_combo) { ?>
773
+							<?php echo do_shortcode('[facetwp sort="true"]'); ?>
774 774
 						<?php } ?>
775 775
 
776 776
 					</div>
@@ -784,30 +784,30 @@  discard block
 block discarded – undo
784 784
 	 * Outputs bottom.
785 785
 	 */
786 786
 	public function facet_bottom_bar() {
787
-		if ( true === apply_filters( 'lsx_search_hide_bottom_bar', false ) ) {
787
+		if (true === apply_filters('lsx_search_hide_bottom_bar', false)) {
788 788
 			return;
789 789
 		}
790 790
 		$show_pagination    = true;
791 791
 		$pagination_visible = false;
792
-		if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) {
793
-			$az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ];
792
+		if (isset($this->options['display'][$this->search_prefix.'_az_pagination'])) {
793
+			$az_pagination = $this->options['display'][$this->search_prefix.'_az_pagination'];
794 794
 		} else {
795 795
 			$az_pagination = false;
796 796
 		}
797 797
 
798
-		$show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] );
799
-		$show_sort_combo     = empty( $this->options['display'][ $this->search_prefix . '_disable_all_sorting' ] );
798
+		$show_per_page_combo = empty($this->options['display'][$this->search_prefix.'_disable_per_page']);
799
+		$show_sort_combo     = empty($this->options['display'][$this->search_prefix.'_disable_all_sorting']);
800 800
 
801
-		$show_pagination     = apply_filters( 'lsx_search_bottom_show_pagination', $show_pagination );
802
-		$pagination_visible  = apply_filters( 'lsx_search_bottom_pagination_visible', $pagination_visible );
803
-		$show_per_page_combo = apply_filters( 'lsx_search_bottom_show_per_page_combo', $show_per_page_combo );
804
-		$show_sort_combo     = apply_filters( 'lsx_search_bottom_show_sort_combo', $show_sort_combo );
801
+		$show_pagination     = apply_filters('lsx_search_bottom_show_pagination', $show_pagination);
802
+		$pagination_visible  = apply_filters('lsx_search_bottom_pagination_visible', $pagination_visible);
803
+		$show_per_page_combo = apply_filters('lsx_search_bottom_show_per_page_combo', $show_per_page_combo);
804
+		$show_sort_combo     = apply_filters('lsx_search_bottom_show_sort_combo', $show_sort_combo);
805 805
 
806
-		if ( $show_pagination || ! empty( $az_pagination ) ) { ?>
806
+		if ($show_pagination || !empty($az_pagination)) { ?>
807 807
 			<div id="facetwp-bottom">
808 808
 				<div class="row facetwp-bottom-row-1">
809 809
 					<div class="col-xs-12">
810
-						<?php do_action( 'lsx_search_facetwp_bottom_row' ); ?>
810
+						<?php do_action('lsx_search_facetwp_bottom_row'); ?>
811 811
 
812 812
 						<?php //if ( $show_sort_combo ) { ?>
813 813
 							<?php //echo do_shortcode( '[facetwp sort="true"]' ); ?>
@@ -818,16 +818,16 @@  discard block
 block discarded – undo
818 818
 						<?php //} ?>
819 819
 
820 820
 						<?php
821
-						if ( $show_pagination ) {
822
-							$output_pagination = do_shortcode( '[facetwp pager="true"]' );
823
-							if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) {
824
-								foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
825
-									if ( isset( $this->facet_data[ $facet ] ) && in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) {
826
-										$output_pagination = do_shortcode( '[facetwp facet="pager_"]' );
821
+						if ($show_pagination) {
822
+							$output_pagination = do_shortcode('[facetwp pager="true"]');
823
+							if (!empty($this->options['display'][$this->search_prefix.'_facets']) && is_array($this->options['display'][$this->search_prefix.'_facets'])) {
824
+								foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) {
825
+									if (isset($this->facet_data[$facet]) && in_array($this->facet_data[$facet]['type'], array('pager'))) {
826
+										$output_pagination = do_shortcode('[facetwp facet="pager_"]');
827 827
 									}
828 828
 								}
829 829
 							}
830
-							echo wp_kses_post( $output_pagination );
830
+							echo wp_kses_post($output_pagination);
831 831
 						?>
832 832
 						<?php } ?>
833 833
 					</div>
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 	/**
862 862
 	 * Disables default sidebar.
863 863
 	 */
864
-	public function lsx_sidebar_enable( $sidebar_enabled ) {
864
+	public function lsx_sidebar_enable($sidebar_enabled) {
865 865
 		$sidebar_enabled = false;
866 866
 		return $sidebar_enabled;
867 867
 	}
@@ -871,19 +871,19 @@  discard block
 block discarded – undo
871 871
 	 */
872 872
 	public function search_sidebar() {
873 873
 
874
-		$this->options = apply_filters( 'lsx_search_sidebar_options', $this->options );
874
+		$this->options = apply_filters('lsx_search_sidebar_options', $this->options);
875 875
 		?>
876
-			<?php do_action( 'lsx_search_sidebar_before' ); ?>
876
+			<?php do_action('lsx_search_sidebar_before'); ?>
877 877
 
878
-			<div id="secondary" class="facetwp-sidebar widget-area <?php echo esc_attr( lsx_sidebar_class() ); ?>" role="complementary">
878
+			<div id="secondary" class="facetwp-sidebar widget-area <?php echo esc_attr(lsx_sidebar_class()); ?>" role="complementary">
879 879
 
880
-				<?php do_action( 'lsx_search_sidebar_top' ); ?>
880
+				<?php do_action('lsx_search_sidebar_top'); ?>
881 881
 
882
-				<?php if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) { ?>
882
+				<?php if (!empty($this->options['display'][$this->search_prefix.'_facets']) && is_array($this->options['display'][$this->search_prefix.'_facets'])) { ?>
883 883
 					<div class="row facetwp-row lsx-search-filer-area">
884
-						<h3 class="facetwp-filter-title"><?php echo esc_html_e( 'Refine by', 'lsx-search' ); ?></h3>
884
+						<h3 class="facetwp-filter-title"><?php echo esc_html_e('Refine by', 'lsx-search'); ?></h3>
885 885
 						<div class="col-xs-12 facetwp-item facetwp-filters-button hidden-sm hidden-md hidden-lg">
886
-							<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>
886
+							<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>
887 887
 						</div>
888 888
 
889 889
 						<div class="ssm-overlay ssm-toggle-nav" rel="lsx-search-filters"></div>
@@ -891,16 +891,16 @@  discard block
 block discarded – undo
891 891
 						<div class="col-xs-12 facetwp-item-wrap facetwp-filters-wrap" id="lsx-search-filters">
892 892
 							<div class="row hidden-sm hidden-md hidden-lg ssm-row-margin-bottom">
893 893
 								<div class="col-xs-12 facetwp-item facetwp-filters-button">
894
-									<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>
894
+									<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>
895 895
 								</div>
896 896
 							</div>
897 897
 
898 898
 							<div class="row">
899 899
 								<?php
900 900
 								// Slider.
901
-								foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
902
-									if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'alpha', 'search', 'pager' ) ) ) {
903
-										$this->display_facet_default( $facet );
901
+								foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) {
902
+									if (isset($this->facet_data[$facet]) && !in_array($this->facet_data[$facet]['type'], array('alpha', 'search', 'pager'))) {
903
+										$this->display_facet_default($facet);
904 904
 									}
905 905
 								}
906 906
 								?>
@@ -908,17 +908,17 @@  discard block
 block discarded – undo
908 908
 
909 909
 							<div class="row hidden-sm hidden-md hidden-lg ssm-row-margin-top">
910 910
 								<div class="col-xs-12 facetwp-item facetwp-filters-button">
911
-									<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>
911
+									<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>
912 912
 								</div>
913 913
 							</div>
914 914
 						</div>
915 915
 					</div>
916 916
 				<?php } ?>
917 917
 
918
-				<?php do_action( 'lsx_search_sidebar_bottom' ); ?>
918
+				<?php do_action('lsx_search_sidebar_bottom'); ?>
919 919
 			</div>
920 920
 
921
-			<?php do_action( 'lsx_search_sidebar_after' ); ?>
921
+			<?php do_action('lsx_search_sidebar_after'); ?>
922 922
 		<?php
923 923
 	}
924 924
 
@@ -931,9 +931,9 @@  discard block
 block discarded – undo
931 931
 
932 932
 		$pager_facet_off = false;
933 933
 
934
-		if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) {
935
-			foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
936
-				if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) {
934
+		if (!empty($this->options['display'][$this->search_prefix.'_facets']) && is_array($this->options['display'][$this->search_prefix.'_facets'])) {
935
+			foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) {
936
+				if (isset($this->facet_data[$facet]) && !in_array($this->facet_data[$facet]['type'], array('pager'))) {
937 937
 					$pager_facet_off = true;
938 938
 				}
939 939
 			}
@@ -947,9 +947,9 @@  discard block
 block discarded – undo
947 947
 	 */
948 948
 	public function wc_archive_header() {
949 949
 		$default_size   = 'sm';
950
-		$size           = apply_filters( 'lsx_bootstrap_column_size', $default_size );
950
+		$size           = apply_filters('lsx_bootstrap_column_size', $default_size);
951 951
 		?>
952
-			<div class="archive-header-wrapper banner-woocommerce col-<?php echo esc_attr( $size ); ?>-12">
952
+			<div class="archive-header-wrapper banner-woocommerce col-<?php echo esc_attr($size); ?>-12">
953 953
 				<?php lsx_global_header_inner_bottom(); ?>
954 954
 				<header class="archive-header">
955 955
 					<h1 class="archive-title"><?php woocommerce_page_title(); ?></h1>
@@ -967,11 +967,11 @@  discard block
 block discarded – undo
967 967
 			<form class="search-form lsx-search-form" action="/" method="get">
968 968
 				<div class="input-group">
969 969
 					<div class="field">
970
-						<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() ?>">
970
+						<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() ?>">
971 971
 					</div>
972 972
 
973 973
 					<div class="field submit-button">
974
-						<button class="search-submit btn" type="submit"><?php esc_html_e( 'Search', 'lsx-search' ); ?></button>
974
+						<button class="search-submit btn" type="submit"><?php esc_html_e('Search', 'lsx-search'); ?></button>
975 975
 					</div>
976 976
 				</div>
977 977
 			</form>
@@ -982,26 +982,26 @@  discard block
 block discarded – undo
982 982
 	/**
983 983
 	 * Display facet default.
984 984
 	 */
985
-	public function display_facet_default( $facet ) {
985
+	public function display_facet_default($facet) {
986 986
 
987
-		$show_collapse = ! isset( $this->options['display']['enable_collapse'] ) || 'on' !== $this->options['display']['enable_collapse'];
987
+		$show_collapse = !isset($this->options['display']['enable_collapse']) || 'on' !== $this->options['display']['enable_collapse'];
988 988
 		$col_class = '';
989 989
 
990
-		if ( 'search' === $this->facet_data[ $facet ]['type'] ) : ?>
991
-			<?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?>
990
+		if ('search' === $this->facet_data[$facet]['type']) : ?>
991
+			<?php echo do_shortcode('[facetwp facet="'.$facet.'"]'); ?>
992 992
 		<?php else : ?>
993
-			<div class="col-xs-12 facetwp-item parent-facetwp-facet-<?php echo esc_html( $facet ); ?> <?php echo esc_attr( $col_class ); ?>">
994
-				<?php if ( ! $show_collapse ) { ?>
993
+			<div class="col-xs-12 facetwp-item parent-facetwp-facet-<?php echo esc_html($facet); ?> <?php echo esc_attr($col_class); ?>">
994
+				<?php if (!$show_collapse) { ?>
995 995
 					<div class="facetwp-collapsed">
996
-						<h3 class="lsx-search-title"><?php echo wp_kses_post( $this->facet_data[ $facet ]['label'] ); ?></h3>
997
-						<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>
996
+						<h3 class="lsx-search-title"><?php echo wp_kses_post($this->facet_data[$facet]['label']); ?></h3>
997
+						<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>
998 998
 					</div>
999
-					<div id="collapse-<?php echo esc_html( $facet ); ?>" class="collapse">
1000
-						<?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?>
999
+					<div id="collapse-<?php echo esc_html($facet); ?>" class="collapse">
1000
+						<?php echo do_shortcode('[facetwp facet="'.$facet.'"]'); ?>
1001 1001
 					</div>
1002 1002
 				<?php } else { ?>
1003
-					<h3 class="lsx-search-title"><?php echo wp_kses_post( $this->facet_data[ $facet ]['label'] ); ?></h3>
1004
-					<?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?>
1003
+					<h3 class="lsx-search-title"><?php echo wp_kses_post($this->facet_data[$facet]['label']); ?></h3>
1004
+					<?php echo do_shortcode('[facetwp facet="'.$facet.'"]'); ?>
1005 1005
 				<?php } ?>
1006 1006
 			</div>
1007 1007
 		<?php
@@ -1011,8 +1011,8 @@  discard block
 block discarded – undo
1011 1011
 	/**
1012 1012
 	 * Changes slot column class.
1013 1013
 	 */
1014
-	public function change_slot_column_class( $class ) {
1015
-		if ( is_post_type_archive( 'video' ) || is_tax( 'video-category' ) ) {
1014
+	public function change_slot_column_class($class) {
1015
+		if (is_post_type_archive('video') || is_tax('video-category')) {
1016 1016
 			$column_class = 'col-xs-12 col-sm-4';
1017 1017
 		}
1018 1018
 
@@ -1023,15 +1023,15 @@  discard block
 block discarded – undo
1023 1023
 	 * Add post type label to the title.
1024 1024
 	 */
1025 1025
 	public function add_label_to_title() {
1026
-		if ( is_search() ) {
1027
-			if ( ! empty( $this->options['display']['engine_search_enable_pt_label'] ) ) {
1026
+		if (is_search()) {
1027
+			if (!empty($this->options['display']['engine_search_enable_pt_label'])) {
1028 1028
 				$post_type = get_post_type();
1029
-				$post_type = str_replace( '_', ' ', $post_type );
1030
-				$post_type = str_replace( '-', ' ', $post_type );
1031
-				if ( 'tribe events' === $post_type ) {
1029
+				$post_type = str_replace('_', ' ', $post_type);
1030
+				$post_type = str_replace('-', ' ', $post_type);
1031
+				if ('tribe events' === $post_type) {
1032 1032
 					$post_type = 'Events';
1033 1033
 				}
1034
-				echo wp_kses_post( ' <span class="label label-default lsx-label-post-type">' . $post_type . '</span>' );
1034
+				echo wp_kses_post(' <span class="label label-default lsx-label-post-type">'.$post_type.'</span>');
1035 1035
 			}
1036 1036
 		}
1037 1037
 	}
@@ -1039,22 +1039,22 @@  discard block
 block discarded – undo
1039 1039
 	/**
1040 1040
 	 * Changes the sort options.
1041 1041
 	 */
1042
-	public function facetwp_sort_options( $options, $params ) {
1042
+	public function facetwp_sort_options($options, $params) {
1043 1043
 		$this->set_vars();
1044 1044
 
1045
-		if ( true === $this->search_enabled ) {
1046
-			if ( 'default' !== $params['template_name'] && 'wp' !== $params['template_name'] ) {
1045
+		if (true === $this->search_enabled) {
1046
+			if ('default' !== $params['template_name'] && 'wp' !== $params['template_name']) {
1047 1047
 				return $options;
1048 1048
 			}
1049 1049
 
1050
-			if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_date_sorting' ] ) ) {
1051
-				unset( $options['date_desc'] );
1052
-				unset( $options['date_asc'] );
1050
+			if (!empty($this->options['display'][$this->search_prefix.'_disable_date_sorting'])) {
1051
+				unset($options['date_desc']);
1052
+				unset($options['date_asc']);
1053 1053
 			}
1054 1054
 
1055
-			if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_az_sorting' ] ) ) {
1056
-				unset( $options['title_desc'] );
1057
-				unset( $options['title_asc'] );
1055
+			if (!empty($this->options['display'][$this->search_prefix.'_disable_az_sorting'])) {
1056
+				unset($options['title_desc']);
1057
+				unset($options['title_asc']);
1058 1058
 			}
1059 1059
 		}
1060 1060
 
@@ -1067,9 +1067,9 @@  discard block
 block discarded – undo
1067 1067
 	 *
1068 1068
 	 * @return mixed
1069 1069
 	 */
1070
-	public function kses_allowed_html( $allowedtags, $context ) {
1070
+	public function kses_allowed_html($allowedtags, $context) {
1071 1071
 		$allowedtags['a']['data-value'] = true;
1072
-		$allowedtags['a']['data-selection']  = true;
1072
+		$allowedtags['a']['data-selection'] = true;
1073 1073
 		$allowedtags['button']['data-toggle'] = true;
1074 1074
 		return $allowedtags;
1075 1075
 	}
Please login to merge, or discard this patch.
classes/class-admin.php 2 patches
Indentation   +484 added lines, -484 removed lines patch added patch discarded remove patch
@@ -12,476 +12,476 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class Admin {
14 14
 
15
-	/**
16
-	 * Holds class instance
17
-	 *
18
-	 * @since 1.0.0
19
-	 *
20
-	 * @var      object \lsx\search\classes\Admin()
21
-	 */
22
-	protected static $instance = null;
23
-	/**
24
-	 * Holds the options for the search.
25
-	 *
26
-	 * @var array()
27
-	 */
28
-	public $options = false;
29
-
30
-	/**
31
-	 * Holds the facetwp data for use in the fields.
32
-	 *
33
-	 * @var array()
34
-	 */
35
-	public $facet_data = false;
36
-
37
-	/**
38
-	 * Holds the Alpha betical facetwp data for use in the fields.
39
-	 *
40
-	 * @var array()
41
-	 */
42
-	public $az_facets = array();
43
-
44
-	/**
45
-	 * Holds the settings page theme functions
46
-	 *
47
-	 * @var object \lsx\search\classes\admin\Settings_Theme();
48
-	 */
49
-	public $settings_theme;
50
-
51
-	/**
52
-	 * Construct method.
53
-	 */
54
-	public function __construct() {
55
-		$this->load_classes();
56
-		add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) );
57
-		add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_engine_fields' ), 15, 1 );
58
-		add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_archive_fields' ), 15, 1 );
59
-		add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
60
-
61
-		if ( is_admin() ) {
62
-			add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 );
63
-			add_filter( 'lsx_customizer_colour_selectors_button', array( $this, 'customizer_button_colours' ), 10, 2 );
64
-		}
65
-	}
66
-
67
-	/**
68
-	 * Return an instance of this class.
69
-	 *
70
-	 * @since 1.0.0
71
-	 *
72
-	 * @return    object \lsx\member_directory\search\Admin()    A single instance of this class.
73
-	 */
74
-	public static function get_instance() {
75
-		// If the single instance hasn't been set, set it now.
76
-		if ( null === self::$instance ) {
77
-			self::$instance = new self();
78
-		}
79
-		return self::$instance;
80
-	}
81
-
82
-	/**
83
-	 * Loads the variable classes and the static classes.
84
-	 */
85
-	private function load_classes() {
86
-		require_once LSX_SEARCH_PATH . 'classes/admin/class-settings-theme.php';
87
-		$this->settings_theme = admin\Settings_Theme::get_instance();
88
-	}
89
-
90
-	/**
91
-	 * Configure Business Directory custom fields for the Settings page.
92
-	 *
93
-	 * @return void
94
-	 */
95
-	public function register_settings_page() {
96
-		$args = array(
97
-			'id'           => 'lsx_search_settings',
98
-			'title'        => '<h1>' . esc_html__( 'LSX Search Settings', 'lsx-search' ) . ' <span class="version">' . LSX_SEARCH_VER . '</span></h1>',
99
-			'menu_title'   => esc_html__( 'LSX Search', 'search' ), // Falls back to 'title' (above).
100
-			'object_types' => array( 'options-page' ),
101
-			'option_key'   => 'lsx-search-settings', // The option key and admin menu page slug.
102
-			'parent_slug'  => 'options-general.php',
103
-			'capability'   => 'manage_options', // Cap required to view options-page.
104
-		);
105
-		$cmb  = new_cmb2_box( $args );
106
-		do_action( 'lsx_search_settings_page', $cmb );
107
-	}
108
-
109
-	/**
110
-	 * Sets post types with active search options.
111
-	 */
112
-	public function register_post_type_tabs( $post_types_plural ) {
113
-		$post_types_plural = array(
114
-			'project' => 'projects',
115
-			'service' => 'services',
116
-			'team' => 'team',
117
-			'testimonial' => 'testimonials',
118
-			'video' => 'videos',
119
-			'product' => 'products', // WooCommerce
120
-			'post' => 'posts',
121
-		);
122
-		return $post_types_plural;
123
-	}
124
-
125
-	/**
126
-	 * Gets the Tour Operator Post Types.
127
-	 *
128
-	 * @return array
129
-	 */
130
-	public function get_to_post_types() {
131
-		$to_types = array(
132
-			'accommodation',
133
-			'tour',
134
-			'destination',
135
-			'review',
136
-			'activity',
137
-			'special',
138
-			'vehicle',
139
-		);
140
-		return $to_types;
141
-	}
142
-
143
-	/**
144
-	 * Sets the FacetWP variables.
145
-	 *
146
-	 * @return  void
147
-	 */
148
-	public function set_facetwp_vars() {
149
-		if ( function_exists( '\FWP' ) ) {
150
-			$facet_data = \FWP()->helper->get_facets();
151
-		}
152
-		$this->facet_data = array();
153
-		$this->az_facets  = array(
154
-			'' => __( 'Do not show', 'lsx-search' ),
155
-		);
156
-		if ( ! empty( $facet_data ) && is_array( $facet_data ) ) {
157
-			foreach ( $facet_data as $facet ) {
158
-				if ( 'alpha' === $facet['type'] ) {
159
-					$this->az_facets[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')';
160
-				} else {
161
-					$this->facet_data[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')';
162
-				}
163
-			}
164
-		}
165
-	}
166
-
167
-	/**
168
-	 * Enqueue JS and CSS.
169
-	 */
170
-	public function assets( $hook ) {
171
-		wp_enqueue_script( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/js/src/lsx-search-admin.js', array( 'jquery' ), LSX_SEARCH_VER, true );
172
-		wp_enqueue_style( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/css/lsx-search-admin.css', array(), LSX_SEARCH_VER );
173
-	}
174
-
175
-	/**
176
-	 * Enable Business Directory Search settings only if LSX Search plugin is enabled.
177
-	 *
178
-	 * @return  void
179
-	 */
180
-	public function configure_settings_search_engine_fields( $cmb ) {
181
-		$global_args = array(
182
-			'title' => __( 'Global', 'lsx-search' ),
183
-			'desc'  => esc_html__( 'Control the filters which show on your WordPress search results page.', 'lsx-search' ),
184
-		);
185
-		$this->search_fields( $cmb, 'engine', $global_args );
186
-	}
187
-
188
-	/**
189
-	 * Enable Business Directory Search settings only if LSX Search plugin is enabled.
190
-	 *
191
-	 * @param object $cmb The CMB2() class.
192
-	 * @param string $position either top of bottom.
193
-	 * @return void
194
-	 */
195
-	public function configure_settings_search_archive_fields( $cmb ) {
196
-		$archives       = array();
197
-		$post_type_args = array(
198
-			'public' => true,
199
-		);
200
-		$post_types     = get_post_types( $post_type_args );
201
-		if ( ! empty( $post_types ) ) {
202
-			foreach ( $post_types as $post_type_key => $post_type_value ) {
203
-				switch ( $post_type_key ) {
204
-					case 'post':
205
-						$page_url      = home_url();
206
-						$page_title    = __( 'Home', 'lsx-search' );
207
-						$show_on_front = get_option( 'show_on_front' );
208
-						if ( 'page' === $show_on_front ) {
209
-							$page_for_posts = get_option( 'page_for_posts' );
210
-							if ( '' !== $page_for_posts ) {
211
-								$page_title   = get_the_title( $page_for_posts );
212
-								$page_url     = get_permalink( $page_for_posts );
213
-							}
214
-						}
215
-						$description = sprintf(
216
-							/* translators: %s: The subscription info */
217
-							__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ),
218
-							$page_url,
219
-							$page_title
220
-						);
221
-						$archives[ $post_type_key ] = array(
222
-							'title' => __( 'Blog', 'lsx-search' ),
223
-							'desc'  => $description,
224
-						);
225
-						break;
226
-
227
-					case 'product':
228
-						$page_url = home_url();
229
-						$page_title    = __( 'Shop', 'lsx-search' );
230
-						if ( function_exists( 'wc_get_page_id' ) ) {
231
-							$shop_page  = wc_get_page_id( 'shop' );
232
-							$page_url   = get_permalink( $shop_page );
233
-							$page_title = get_the_title( $shop_page );
234
-						}
235
-						$description = sprintf(
236
-							/* translators: %s: The subscription info */
237
-							__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ),
238
-							$page_url,
239
-							$page_title
240
-						);
241
-						$archives[ $post_type_key ] = array(
242
-							'title' => __( 'Shop', 'lsx-search' ),
243
-							'desc'  => $description,
244
-						);
245
-						break;
246
-
247
-					default:
248
-						if ( ! in_array( $post_type_key, \lsx\search\includes\get_restricted_post_types() ) ) {
249
-							$temp_post_type = get_post_type_object( $post_type_key );
250
-							if ( ! is_wp_error( $temp_post_type ) ) {
251
-								$page_url    = get_post_type_archive_link( $temp_post_type->name );
252
-								$description = sprintf(
253
-									/* translators: %s: The subscription info */
254
-									__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ),
255
-									$page_url,
256
-									$temp_post_type->label
257
-								);
258
-
259
-								$archives[ $post_type_key ] = array(
260
-									'title' => $temp_post_type->label,
261
-									'desc'  => $description,
262
-								);
263
-							}
264
-						}
265
-						break;
266
-				}
267
-			}
268
-		}
269
-		if ( ! empty( $archives ) ) {
270
-			foreach ( $archives as $archive_key => $archive_args ) {
271
-				$this->search_fields( $cmb, $archive_key, $archive_args );
272
-			}
273
-		}
274
-	}
275
-
276
-	/**
277
-	 * Enable Business Directory Search settings only if LSX Search plugin is enabled.
278
-	 *
279
-	 * @param object $cmb The CMB2() class.
280
-	 * @param string $section either engine,archive or single.
281
-	 * @return void
282
-	 */
283
-	public function search_fields( $cmb, $section, $args ) {
284
-		$this->set_facetwp_vars();
285
-		$cmb->add_field(
286
-			array(
287
-				'id'          => 'settings_' . $section . '_search',
288
-				'type'        => 'title',
289
-				'name'        => $args['title'],
290
-				'default'     => $args['title'],
291
-				'description' => $args['desc'],
292
-			)
293
-		);
294
-		do_action( 'lsx_search_settings_section', $cmb, 'top' );
295
-		$cmb->add_field(
296
-			array(
297
-				'name'        => esc_html__( 'Enable Search Filters', 'lsx-search' ),
298
-				'id'          => $section . '_search_enable',
299
-				'description' => esc_html__( 'Display FacetWP filters on your search results page.', 'lsx-search' ),
300
-				'type'        => 'checkbox',
301
-			)
302
-		);
303
-
304
-		$cmb->add_field(
305
-			array(
306
-				'name'    => esc_html__( 'Page Layout', 'lsx-search' ),
307
-				'id'      => $section . '_search_layout',
308
-				'type'    => 'select',
309
-				'options' => array(
310
-					''    => esc_html__( 'Follow the theme layout', 'lsx-search' ),
311
-					'1c'  => esc_html__( '1 column', 'lsx-search' ),
312
-					'2cr' => esc_html__( '2 columns / Content on right', 'lsx-search' ),
313
-					'2cl' => esc_html__( '2 columns / Content on left', 'lsx-search' ),
314
-				),
315
-				'default' => '',
316
-			)
317
-		);
318
-
319
-		if ( 'product' === $section ) {
320
-			$cmb->add_field(
321
-				array(
322
-					'name'             => esc_html__( 'Results Layout', 'lsx-search' ),
323
-					'id'               => $section . '_search_grid_list',
324
-					'type'             => 'select',
325
-					'show_option_none' => false,
326
-					'description'      => __( 'Set a default layout for the search results.', 'lsx-search' ),
327
-					'options'          => array(
328
-						'grid' => esc_html__( 'Grid', 'lsx-search' ),
329
-						'list' => esc_html__( 'List', 'lsx-search' ),
330
-					),
331
-					'default' => 'grid',
332
-				)
333
-			);
334
-			$cmb->add_field(
335
-				array(
336
-					'name'        => esc_html__( 'Layout Switcher', 'lsx-search' ),
337
-					'id'          => $section . '_search_layout_switcher_enable',
338
-					'type'        => 'checkbox',
339
-					'description' => __( 'Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search' ),
340
-				)
341
-			);
342
-		}
343
-		if ( 'engine' === $section && is_plugin_active( 'tour-operator/tour-operator.php' ) ) {
344
-			$cmb->add_field(
345
-				array(
346
-					'name'    => esc_html__( 'List layout images', 'lsx-search' ),
347
-					'id'      => $section . '_search_list_layout_image_style',
348
-					'type'    => 'select',
349
-					'options' => array(
350
-						''           => esc_html__( 'Full Height', 'lsx-search' ),
351
-						'max-height' => esc_html__( 'Max Height', 'lsx-search' ),
352
-					),
353
-					'default' => '',
354
-				)
355
-			);
356
-		}
357
-		if ( 'engine' === $section ) {
358
-			$cmb->add_field(
359
-				array(
360
-					'name'        => esc_html__( 'Display Excerpt', 'lsx-search' ),
361
-					'id'          => $section . '_excerpt_enable',
362
-					'type'        => 'checkbox',
363
-					'description' => __( 'Display the excerpt of a listing.', 'lsx-search' ),
364
-				)
365
-			);
366
-			$cmb->add_field(
367
-				array(
368
-					'name'        => esc_html__( 'Enable Post Type Label', 'lsx-search' ),
369
-					'id'          => $section . '_search_enable_pt_label',
370
-					'type'        => 'checkbox',
371
-					'description' => __( 'This enables the post type label from entries on search results page.', 'lsx-search' ),
372
-				)
373
-			);
374
-			if ( is_plugin_active( 'tour-operator/tour-operator.php' ) ) {
375
-				$cmb->add_field(
376
-					array(
377
-						'name'        => esc_html__( 'Enable Continent Filter', 'lsx-search' ),
378
-						'id'          => $section . '_search_enable_continent_filter',
379
-						'type'        => 'checkbox',
380
-						'description' => __( 'This enables the continent filter in FacetWP destinations filter.', 'lsx-search' ),
381
-					)
382
-				);
383
-				$cmb->add_field(
384
-					array(
385
-						'name'        => esc_html__( 'Enable Continental Regions', 'lsx-search' ),
386
-						'id'          => $section . '_search_enable_continental_regions',
387
-						'type'        => 'checkbox',
388
-						'description' => __( 'This disable continents and enabled the sub regions.', 'lsx-search' ),
389
-					)
390
-				);
391
-			}
392
-		}
393
-
394
-		if ( is_plugin_active( 'tour-operator/tour-operator.php' ) && 'accommodation' === $section ) {
395
-			$cmb->add_field(
396
-				array(
397
-					'name'    => esc_html__( 'Results Layout - list vs map', 'lsx-search' ),
398
-					'id'      => $section . '_search_results_layout',
399
-					'type'    => 'select',
400
-					'options' => array(
401
-						'list_map'    => esc_html__( 'List and Map', 'lsx-search' ),
402
-						'list'        => esc_html__( 'List only', 'lsx-search' ),
403
-					),
404
-					'default' => '',
405
-				)
406
-			);
407
-		}
408
-
409
-		$cmb->add_field(
410
-			array(
411
-				'name'        => esc_html__( 'Enable Collapse', 'lsx-search' ),
412
-				'id'          => $section . '_search_collapse',
413
-				'type'        => 'checkbox',
414
-				'description' => __( 'Enable collapsible filters on search results.', 'lsx-search' ),
415
-			)
416
-		);
417
-
418
-		$cmb->add_field(
419
-			array(
420
-				'name' => esc_html__( 'Disable Sorting', 'lsx-search' ),
421
-				'id'   => $section . '_search_disable_sorting',
422
-				'type' => 'checkbox',
423
-				'description' => __( 'Toggle the sorting drop down menu on your search results.', 'lsx-search' ),
424
-			)
425
-		);
426
-
427
-		$cmb->add_field(
428
-			array(
429
-				'name' => esc_html__( 'Disable the Date Option', 'lsx-search' ),
430
-				'id'   => $section . '_search_disable_date',
431
-				'type' => 'checkbox',
432
-			)
433
-		);
434
-
435
-		$cmb->add_field(
436
-			array(
437
-				'name' => esc_html__( 'Display Clear Button', 'lsx-search' ),
438
-				'id'   => $section . '_search_display_clear_button',
439
-				'type' => 'checkbox',
440
-				'description' => __( 'Check this to turn on a button that will clear your search results.', 'lsx-search' ),
441
-			)
442
-		);
443
-
444
-		$cmb->add_field(
445
-			array(
446
-				'name' => esc_html__( 'Display Result Count', 'lsx-search' ),
447
-				'id'   => $section . '_search_display_result_count',
448
-				'type' => 'checkbox',
449
-			)
450
-		);
451
-		if ( is_plugin_active( 'facetwp-alpha/index.php' ) ) {
452
-			$cmb->add_field(
453
-				array(
454
-					'name'        => esc_html__( 'Alphabet Facet', 'lsx-search' ),
455
-					'description' => esc_html__( 'Select the alphabetical sorter facet.', 'lsx-search' ),
456
-					'id'          => $section . '_search_az_pagination',
457
-					'type'        => 'select',
458
-					'options'     => $this->az_facets,
459
-				)
460
-			);
461
-		}
462
-		$cmb->add_field(
463
-			array(
464
-				'name'        => esc_html__( 'Facets', 'lsx-search' ),
465
-				'description' => esc_html__( 'Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search' ),
466
-				'id'          => $section . '_search_facets',
467
-				'type'        => 'multicheck',
468
-				'options'     => $this->facet_data,
469
-			)
470
-		);
471
-		do_action( 'lsx_search_settings_section', $cmb, 'bottom' );
472
-		$cmb->add_field(
473
-			array(
474
-				'id'   => 'settings_' . $section . '_search_closing',
475
-				'type' => 'tab_closing',
476
-			)
477
-		);
478
-	}
479
-
480
-	/**
481
-	 * Handle body colours that might be change by LSX Customiser.
482
-	 */
483
-	public function customizer_body_colours_handler( $css, $colors ) {
484
-		$css .= '
15
+     /**
16
+      * Holds class instance
17
+      *
18
+      * @since 1.0.0
19
+      *
20
+      * @var      object \lsx\search\classes\Admin()
21
+      */
22
+     protected static $instance = null;
23
+     /**
24
+      * Holds the options for the search.
25
+      *
26
+      * @var array()
27
+      */
28
+     public $options = false;
29
+
30
+     /**
31
+      * Holds the facetwp data for use in the fields.
32
+      *
33
+      * @var array()
34
+      */
35
+     public $facet_data = false;
36
+
37
+     /**
38
+      * Holds the Alpha betical facetwp data for use in the fields.
39
+      *
40
+      * @var array()
41
+      */
42
+     public $az_facets = array();
43
+
44
+     /**
45
+      * Holds the settings page theme functions
46
+      *
47
+      * @var object \lsx\search\classes\admin\Settings_Theme();
48
+      */
49
+     public $settings_theme;
50
+
51
+     /**
52
+      * Construct method.
53
+      */
54
+     public function __construct() {
55
+          $this->load_classes();
56
+          add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) );
57
+          add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_engine_fields' ), 15, 1 );
58
+          add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_archive_fields' ), 15, 1 );
59
+          add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
60
+
61
+          if ( is_admin() ) {
62
+               add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 );
63
+               add_filter( 'lsx_customizer_colour_selectors_button', array( $this, 'customizer_button_colours' ), 10, 2 );
64
+          }
65
+     }
66
+
67
+     /**
68
+      * Return an instance of this class.
69
+      *
70
+      * @since 1.0.0
71
+      *
72
+      * @return    object \lsx\member_directory\search\Admin()    A single instance of this class.
73
+      */
74
+     public static function get_instance() {
75
+          // If the single instance hasn't been set, set it now.
76
+          if ( null === self::$instance ) {
77
+               self::$instance = new self();
78
+          }
79
+          return self::$instance;
80
+     }
81
+
82
+     /**
83
+      * Loads the variable classes and the static classes.
84
+      */
85
+     private function load_classes() {
86
+          require_once LSX_SEARCH_PATH . 'classes/admin/class-settings-theme.php';
87
+          $this->settings_theme = admin\Settings_Theme::get_instance();
88
+     }
89
+
90
+     /**
91
+      * Configure Business Directory custom fields for the Settings page.
92
+      *
93
+      * @return void
94
+      */
95
+     public function register_settings_page() {
96
+          $args = array(
97
+               'id'           => 'lsx_search_settings',
98
+               'title'        => '<h1>' . esc_html__( 'LSX Search Settings', 'lsx-search' ) . ' <span class="version">' . LSX_SEARCH_VER . '</span></h1>',
99
+               'menu_title'   => esc_html__( 'LSX Search', 'search' ), // Falls back to 'title' (above).
100
+               'object_types' => array( 'options-page' ),
101
+               'option_key'   => 'lsx-search-settings', // The option key and admin menu page slug.
102
+               'parent_slug'  => 'options-general.php',
103
+               'capability'   => 'manage_options', // Cap required to view options-page.
104
+          );
105
+          $cmb  = new_cmb2_box( $args );
106
+          do_action( 'lsx_search_settings_page', $cmb );
107
+     }
108
+
109
+     /**
110
+      * Sets post types with active search options.
111
+      */
112
+     public function register_post_type_tabs( $post_types_plural ) {
113
+          $post_types_plural = array(
114
+               'project' => 'projects',
115
+               'service' => 'services',
116
+               'team' => 'team',
117
+               'testimonial' => 'testimonials',
118
+               'video' => 'videos',
119
+               'product' => 'products', // WooCommerce
120
+               'post' => 'posts',
121
+          );
122
+          return $post_types_plural;
123
+     }
124
+
125
+     /**
126
+      * Gets the Tour Operator Post Types.
127
+      *
128
+      * @return array
129
+      */
130
+     public function get_to_post_types() {
131
+          $to_types = array(
132
+               'accommodation',
133
+               'tour',
134
+               'destination',
135
+               'review',
136
+               'activity',
137
+               'special',
138
+               'vehicle',
139
+          );
140
+          return $to_types;
141
+     }
142
+
143
+     /**
144
+      * Sets the FacetWP variables.
145
+      *
146
+      * @return  void
147
+      */
148
+     public function set_facetwp_vars() {
149
+          if ( function_exists( '\FWP' ) ) {
150
+               $facet_data = \FWP()->helper->get_facets();
151
+          }
152
+          $this->facet_data = array();
153
+          $this->az_facets  = array(
154
+               '' => __( 'Do not show', 'lsx-search' ),
155
+          );
156
+          if ( ! empty( $facet_data ) && is_array( $facet_data ) ) {
157
+               foreach ( $facet_data as $facet ) {
158
+                    if ( 'alpha' === $facet['type'] ) {
159
+                         $this->az_facets[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')';
160
+                    } else {
161
+                         $this->facet_data[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')';
162
+                    }
163
+               }
164
+          }
165
+     }
166
+
167
+     /**
168
+      * Enqueue JS and CSS.
169
+      */
170
+     public function assets( $hook ) {
171
+          wp_enqueue_script( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/js/src/lsx-search-admin.js', array( 'jquery' ), LSX_SEARCH_VER, true );
172
+          wp_enqueue_style( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/css/lsx-search-admin.css', array(), LSX_SEARCH_VER );
173
+     }
174
+
175
+     /**
176
+      * Enable Business Directory Search settings only if LSX Search plugin is enabled.
177
+      *
178
+      * @return  void
179
+      */
180
+     public function configure_settings_search_engine_fields( $cmb ) {
181
+          $global_args = array(
182
+               'title' => __( 'Global', 'lsx-search' ),
183
+               'desc'  => esc_html__( 'Control the filters which show on your WordPress search results page.', 'lsx-search' ),
184
+          );
185
+          $this->search_fields( $cmb, 'engine', $global_args );
186
+     }
187
+
188
+     /**
189
+      * Enable Business Directory Search settings only if LSX Search plugin is enabled.
190
+      *
191
+      * @param object $cmb The CMB2() class.
192
+      * @param string $position either top of bottom.
193
+      * @return void
194
+      */
195
+     public function configure_settings_search_archive_fields( $cmb ) {
196
+          $archives       = array();
197
+          $post_type_args = array(
198
+               'public' => true,
199
+          );
200
+          $post_types     = get_post_types( $post_type_args );
201
+          if ( ! empty( $post_types ) ) {
202
+               foreach ( $post_types as $post_type_key => $post_type_value ) {
203
+                    switch ( $post_type_key ) {
204
+                         case 'post':
205
+                              $page_url      = home_url();
206
+                              $page_title    = __( 'Home', 'lsx-search' );
207
+                              $show_on_front = get_option( 'show_on_front' );
208
+                              if ( 'page' === $show_on_front ) {
209
+                                   $page_for_posts = get_option( 'page_for_posts' );
210
+                                   if ( '' !== $page_for_posts ) {
211
+                                        $page_title   = get_the_title( $page_for_posts );
212
+                                        $page_url     = get_permalink( $page_for_posts );
213
+                                   }
214
+                              }
215
+                              $description = sprintf(
216
+                                   /* translators: %s: The subscription info */
217
+                                   __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ),
218
+                                   $page_url,
219
+                                   $page_title
220
+                              );
221
+                              $archives[ $post_type_key ] = array(
222
+                                   'title' => __( 'Blog', 'lsx-search' ),
223
+                                   'desc'  => $description,
224
+                              );
225
+                              break;
226
+
227
+                         case 'product':
228
+                              $page_url = home_url();
229
+                              $page_title    = __( 'Shop', 'lsx-search' );
230
+                              if ( function_exists( 'wc_get_page_id' ) ) {
231
+                                   $shop_page  = wc_get_page_id( 'shop' );
232
+                                   $page_url   = get_permalink( $shop_page );
233
+                                   $page_title = get_the_title( $shop_page );
234
+                              }
235
+                              $description = sprintf(
236
+                                   /* translators: %s: The subscription info */
237
+                                   __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ),
238
+                                   $page_url,
239
+                                   $page_title
240
+                              );
241
+                              $archives[ $post_type_key ] = array(
242
+                                   'title' => __( 'Shop', 'lsx-search' ),
243
+                                   'desc'  => $description,
244
+                              );
245
+                              break;
246
+
247
+                         default:
248
+                              if ( ! in_array( $post_type_key, \lsx\search\includes\get_restricted_post_types() ) ) {
249
+                                   $temp_post_type = get_post_type_object( $post_type_key );
250
+                                   if ( ! is_wp_error( $temp_post_type ) ) {
251
+                                        $page_url    = get_post_type_archive_link( $temp_post_type->name );
252
+                                        $description = sprintf(
253
+                                             /* translators: %s: The subscription info */
254
+                                             __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ),
255
+                                             $page_url,
256
+                                             $temp_post_type->label
257
+                                        );
258
+
259
+                                        $archives[ $post_type_key ] = array(
260
+                                             'title' => $temp_post_type->label,
261
+                                             'desc'  => $description,
262
+                                        );
263
+                                   }
264
+                              }
265
+                              break;
266
+                    }
267
+               }
268
+          }
269
+          if ( ! empty( $archives ) ) {
270
+               foreach ( $archives as $archive_key => $archive_args ) {
271
+                    $this->search_fields( $cmb, $archive_key, $archive_args );
272
+               }
273
+          }
274
+     }
275
+
276
+     /**
277
+      * Enable Business Directory Search settings only if LSX Search plugin is enabled.
278
+      *
279
+      * @param object $cmb The CMB2() class.
280
+      * @param string $section either engine,archive or single.
281
+      * @return void
282
+      */
283
+     public function search_fields( $cmb, $section, $args ) {
284
+          $this->set_facetwp_vars();
285
+          $cmb->add_field(
286
+               array(
287
+                    'id'          => 'settings_' . $section . '_search',
288
+                    'type'        => 'title',
289
+                    'name'        => $args['title'],
290
+                    'default'     => $args['title'],
291
+                    'description' => $args['desc'],
292
+               )
293
+          );
294
+          do_action( 'lsx_search_settings_section', $cmb, 'top' );
295
+          $cmb->add_field(
296
+               array(
297
+                    'name'        => esc_html__( 'Enable Search Filters', 'lsx-search' ),
298
+                    'id'          => $section . '_search_enable',
299
+                    'description' => esc_html__( 'Display FacetWP filters on your search results page.', 'lsx-search' ),
300
+                    'type'        => 'checkbox',
301
+               )
302
+          );
303
+
304
+          $cmb->add_field(
305
+               array(
306
+                    'name'    => esc_html__( 'Page Layout', 'lsx-search' ),
307
+                    'id'      => $section . '_search_layout',
308
+                    'type'    => 'select',
309
+                    'options' => array(
310
+                         ''    => esc_html__( 'Follow the theme layout', 'lsx-search' ),
311
+                         '1c'  => esc_html__( '1 column', 'lsx-search' ),
312
+                         '2cr' => esc_html__( '2 columns / Content on right', 'lsx-search' ),
313
+                         '2cl' => esc_html__( '2 columns / Content on left', 'lsx-search' ),
314
+                    ),
315
+                    'default' => '',
316
+               )
317
+          );
318
+
319
+          if ( 'product' === $section ) {
320
+               $cmb->add_field(
321
+                    array(
322
+                         'name'             => esc_html__( 'Results Layout', 'lsx-search' ),
323
+                         'id'               => $section . '_search_grid_list',
324
+                         'type'             => 'select',
325
+                         'show_option_none' => false,
326
+                         'description'      => __( 'Set a default layout for the search results.', 'lsx-search' ),
327
+                         'options'          => array(
328
+                              'grid' => esc_html__( 'Grid', 'lsx-search' ),
329
+                              'list' => esc_html__( 'List', 'lsx-search' ),
330
+                         ),
331
+                         'default' => 'grid',
332
+                    )
333
+               );
334
+               $cmb->add_field(
335
+                    array(
336
+                         'name'        => esc_html__( 'Layout Switcher', 'lsx-search' ),
337
+                         'id'          => $section . '_search_layout_switcher_enable',
338
+                         'type'        => 'checkbox',
339
+                         'description' => __( 'Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search' ),
340
+                    )
341
+               );
342
+          }
343
+          if ( 'engine' === $section && is_plugin_active( 'tour-operator/tour-operator.php' ) ) {
344
+               $cmb->add_field(
345
+                    array(
346
+                         'name'    => esc_html__( 'List layout images', 'lsx-search' ),
347
+                         'id'      => $section . '_search_list_layout_image_style',
348
+                         'type'    => 'select',
349
+                         'options' => array(
350
+                              ''           => esc_html__( 'Full Height', 'lsx-search' ),
351
+                              'max-height' => esc_html__( 'Max Height', 'lsx-search' ),
352
+                         ),
353
+                         'default' => '',
354
+                    )
355
+               );
356
+          }
357
+          if ( 'engine' === $section ) {
358
+               $cmb->add_field(
359
+                    array(
360
+                         'name'        => esc_html__( 'Display Excerpt', 'lsx-search' ),
361
+                         'id'          => $section . '_excerpt_enable',
362
+                         'type'        => 'checkbox',
363
+                         'description' => __( 'Display the excerpt of a listing.', 'lsx-search' ),
364
+                    )
365
+               );
366
+               $cmb->add_field(
367
+                    array(
368
+                         'name'        => esc_html__( 'Enable Post Type Label', 'lsx-search' ),
369
+                         'id'          => $section . '_search_enable_pt_label',
370
+                         'type'        => 'checkbox',
371
+                         'description' => __( 'This enables the post type label from entries on search results page.', 'lsx-search' ),
372
+                    )
373
+               );
374
+               if ( is_plugin_active( 'tour-operator/tour-operator.php' ) ) {
375
+                    $cmb->add_field(
376
+                         array(
377
+                              'name'        => esc_html__( 'Enable Continent Filter', 'lsx-search' ),
378
+                              'id'          => $section . '_search_enable_continent_filter',
379
+                              'type'        => 'checkbox',
380
+                              'description' => __( 'This enables the continent filter in FacetWP destinations filter.', 'lsx-search' ),
381
+                         )
382
+                    );
383
+                    $cmb->add_field(
384
+                         array(
385
+                              'name'        => esc_html__( 'Enable Continental Regions', 'lsx-search' ),
386
+                              'id'          => $section . '_search_enable_continental_regions',
387
+                              'type'        => 'checkbox',
388
+                              'description' => __( 'This disable continents and enabled the sub regions.', 'lsx-search' ),
389
+                         )
390
+                    );
391
+               }
392
+          }
393
+
394
+          if ( is_plugin_active( 'tour-operator/tour-operator.php' ) && 'accommodation' === $section ) {
395
+               $cmb->add_field(
396
+                    array(
397
+                         'name'    => esc_html__( 'Results Layout - list vs map', 'lsx-search' ),
398
+                         'id'      => $section . '_search_results_layout',
399
+                         'type'    => 'select',
400
+                         'options' => array(
401
+                              'list_map'    => esc_html__( 'List and Map', 'lsx-search' ),
402
+                              'list'        => esc_html__( 'List only', 'lsx-search' ),
403
+                         ),
404
+                         'default' => '',
405
+                    )
406
+               );
407
+          }
408
+
409
+          $cmb->add_field(
410
+               array(
411
+                    'name'        => esc_html__( 'Enable Collapse', 'lsx-search' ),
412
+                    'id'          => $section . '_search_collapse',
413
+                    'type'        => 'checkbox',
414
+                    'description' => __( 'Enable collapsible filters on search results.', 'lsx-search' ),
415
+               )
416
+          );
417
+
418
+          $cmb->add_field(
419
+               array(
420
+                    'name' => esc_html__( 'Disable Sorting', 'lsx-search' ),
421
+                    'id'   => $section . '_search_disable_sorting',
422
+                    'type' => 'checkbox',
423
+                    'description' => __( 'Toggle the sorting drop down menu on your search results.', 'lsx-search' ),
424
+               )
425
+          );
426
+
427
+          $cmb->add_field(
428
+               array(
429
+                    'name' => esc_html__( 'Disable the Date Option', 'lsx-search' ),
430
+                    'id'   => $section . '_search_disable_date',
431
+                    'type' => 'checkbox',
432
+               )
433
+          );
434
+
435
+          $cmb->add_field(
436
+               array(
437
+                    'name' => esc_html__( 'Display Clear Button', 'lsx-search' ),
438
+                    'id'   => $section . '_search_display_clear_button',
439
+                    'type' => 'checkbox',
440
+                    'description' => __( 'Check this to turn on a button that will clear your search results.', 'lsx-search' ),
441
+               )
442
+          );
443
+
444
+          $cmb->add_field(
445
+               array(
446
+                    'name' => esc_html__( 'Display Result Count', 'lsx-search' ),
447
+                    'id'   => $section . '_search_display_result_count',
448
+                    'type' => 'checkbox',
449
+               )
450
+          );
451
+          if ( is_plugin_active( 'facetwp-alpha/index.php' ) ) {
452
+               $cmb->add_field(
453
+                    array(
454
+                         'name'        => esc_html__( 'Alphabet Facet', 'lsx-search' ),
455
+                         'description' => esc_html__( 'Select the alphabetical sorter facet.', 'lsx-search' ),
456
+                         'id'          => $section . '_search_az_pagination',
457
+                         'type'        => 'select',
458
+                         'options'     => $this->az_facets,
459
+                    )
460
+               );
461
+          }
462
+          $cmb->add_field(
463
+               array(
464
+                    'name'        => esc_html__( 'Facets', 'lsx-search' ),
465
+                    'description' => esc_html__( 'Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search' ),
466
+                    'id'          => $section . '_search_facets',
467
+                    'type'        => 'multicheck',
468
+                    'options'     => $this->facet_data,
469
+               )
470
+          );
471
+          do_action( 'lsx_search_settings_section', $cmb, 'bottom' );
472
+          $cmb->add_field(
473
+               array(
474
+                    'id'   => 'settings_' . $section . '_search_closing',
475
+                    'type' => 'tab_closing',
476
+               )
477
+          );
478
+     }
479
+
480
+     /**
481
+      * Handle body colours that might be change by LSX Customiser.
482
+      */
483
+     public function customizer_body_colours_handler( $css, $colors ) {
484
+          $css .= '
485 485
 			@import "' . LSX_SEARCH_PATH . '/assets/css/scss/customizer-search-body-colours";
486 486
 
487 487
 			/**
@@ -497,18 +497,18 @@  discard block
 block discarded – undo
497 497
 			);
498 498
 		';
499 499
 
500
-		return $css;
501
-	}
502
-
503
-	/**
504
-	 * Adds the lsx search buttons to the customizer plugin.
505
-	 *
506
-	 * @param string $css
507
-	 * @param array $colours
508
-	 * @return string
509
-	 */
510
-	public function customizer_button_colours( $css, $colours ) {
511
-		$css .= '
500
+          return $css;
501
+     }
502
+
503
+     /**
504
+      * Adds the lsx search buttons to the customizer plugin.
505
+      *
506
+      * @param string $css
507
+      * @param array $colours
508
+      * @return string
509
+      */
510
+     public function customizer_button_colours( $css, $colours ) {
511
+          $css .= '
512 512
 			#secondary.facetwp-sidebar {
513 513
 				.facetwp-item.facetwp-form {
514 514
 					.search-form {
@@ -521,6 +521,6 @@  discard block
 block discarded – undo
521 521
 				}
522 522
 			}
523 523
 		';
524
-		return $css;
525
-	}
524
+          return $css;
525
+     }
526 526
 }
Please login to merge, or discard this patch.
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function __construct() {
55 55
 		$this->load_classes();
56
-		add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) );
57
-		add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_engine_fields' ), 15, 1 );
58
-		add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_archive_fields' ), 15, 1 );
59
-		add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
60
-
61
-		if ( is_admin() ) {
62
-			add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 );
63
-			add_filter( 'lsx_customizer_colour_selectors_button', array( $this, 'customizer_button_colours' ), 10, 2 );
56
+		add_action('cmb2_admin_init', array($this, 'register_settings_page'));
57
+		add_action('lsx_search_settings_page', array($this, 'configure_settings_search_engine_fields'), 15, 1);
58
+		add_action('lsx_search_settings_page', array($this, 'configure_settings_search_archive_fields'), 15, 1);
59
+		add_action('admin_enqueue_scripts', array($this, 'assets'));
60
+
61
+		if (is_admin()) {
62
+			add_filter('lsx_customizer_colour_selectors_body', array($this, 'customizer_body_colours_handler'), 15, 2);
63
+			add_filter('lsx_customizer_colour_selectors_button', array($this, 'customizer_button_colours'), 10, 2);
64 64
 		}
65 65
 	}
66 66
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public static function get_instance() {
75 75
 		// If the single instance hasn't been set, set it now.
76
-		if ( null === self::$instance ) {
76
+		if (null === self::$instance) {
77 77
 			self::$instance = new self();
78 78
 		}
79 79
 		return self::$instance;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * Loads the variable classes and the static classes.
84 84
 	 */
85 85
 	private function load_classes() {
86
-		require_once LSX_SEARCH_PATH . 'classes/admin/class-settings-theme.php';
86
+		require_once LSX_SEARCH_PATH.'classes/admin/class-settings-theme.php';
87 87
 		$this->settings_theme = admin\Settings_Theme::get_instance();
88 88
 	}
89 89
 
@@ -95,21 +95,21 @@  discard block
 block discarded – undo
95 95
 	public function register_settings_page() {
96 96
 		$args = array(
97 97
 			'id'           => 'lsx_search_settings',
98
-			'title'        => '<h1>' . esc_html__( 'LSX Search Settings', 'lsx-search' ) . ' <span class="version">' . LSX_SEARCH_VER . '</span></h1>',
99
-			'menu_title'   => esc_html__( 'LSX Search', 'search' ), // Falls back to 'title' (above).
100
-			'object_types' => array( 'options-page' ),
98
+			'title'        => '<h1>'.esc_html__('LSX Search Settings', 'lsx-search').' <span class="version">'.LSX_SEARCH_VER.'</span></h1>',
99
+			'menu_title'   => esc_html__('LSX Search', 'search'), // Falls back to 'title' (above).
100
+			'object_types' => array('options-page'),
101 101
 			'option_key'   => 'lsx-search-settings', // The option key and admin menu page slug.
102 102
 			'parent_slug'  => 'options-general.php',
103 103
 			'capability'   => 'manage_options', // Cap required to view options-page.
104 104
 		);
105
-		$cmb  = new_cmb2_box( $args );
106
-		do_action( 'lsx_search_settings_page', $cmb );
105
+		$cmb = new_cmb2_box($args);
106
+		do_action('lsx_search_settings_page', $cmb);
107 107
 	}
108 108
 
109 109
 	/**
110 110
 	 * Sets post types with active search options.
111 111
 	 */
112
-	public function register_post_type_tabs( $post_types_plural ) {
112
+	public function register_post_type_tabs($post_types_plural) {
113 113
 		$post_types_plural = array(
114 114
 			'project' => 'projects',
115 115
 			'service' => 'services',
@@ -146,19 +146,19 @@  discard block
 block discarded – undo
146 146
 	 * @return  void
147 147
 	 */
148 148
 	public function set_facetwp_vars() {
149
-		if ( function_exists( '\FWP' ) ) {
149
+		if (function_exists('\FWP')) {
150 150
 			$facet_data = \FWP()->helper->get_facets();
151 151
 		}
152 152
 		$this->facet_data = array();
153 153
 		$this->az_facets  = array(
154
-			'' => __( 'Do not show', 'lsx-search' ),
154
+			'' => __('Do not show', 'lsx-search'),
155 155
 		);
156
-		if ( ! empty( $facet_data ) && is_array( $facet_data ) ) {
157
-			foreach ( $facet_data as $facet ) {
158
-				if ( 'alpha' === $facet['type'] ) {
159
-					$this->az_facets[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')';
156
+		if (!empty($facet_data) && is_array($facet_data)) {
157
+			foreach ($facet_data as $facet) {
158
+				if ('alpha' === $facet['type']) {
159
+					$this->az_facets[$facet['name']] = $facet['label'].'('.$facet['name'].')';
160 160
 				} else {
161
-					$this->facet_data[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')';
161
+					$this->facet_data[$facet['name']] = $facet['label'].'('.$facet['name'].')';
162 162
 				}
163 163
 			}
164 164
 		}
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 	/**
168 168
 	 * Enqueue JS and CSS.
169 169
 	 */
170
-	public function assets( $hook ) {
171
-		wp_enqueue_script( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/js/src/lsx-search-admin.js', array( 'jquery' ), LSX_SEARCH_VER, true );
172
-		wp_enqueue_style( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/css/lsx-search-admin.css', array(), LSX_SEARCH_VER );
170
+	public function assets($hook) {
171
+		wp_enqueue_script('lsx-search-admin', LSX_SEARCH_URL.'assets/js/src/lsx-search-admin.js', array('jquery'), LSX_SEARCH_VER, true);
172
+		wp_enqueue_style('lsx-search-admin', LSX_SEARCH_URL.'assets/css/lsx-search-admin.css', array(), LSX_SEARCH_VER);
173 173
 	}
174 174
 
175 175
 	/**
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
 	 *
178 178
 	 * @return  void
179 179
 	 */
180
-	public function configure_settings_search_engine_fields( $cmb ) {
180
+	public function configure_settings_search_engine_fields($cmb) {
181 181
 		$global_args = array(
182
-			'title' => __( 'Global', 'lsx-search' ),
183
-			'desc'  => esc_html__( 'Control the filters which show on your WordPress search results page.', 'lsx-search' ),
182
+			'title' => __('Global', 'lsx-search'),
183
+			'desc'  => esc_html__('Control the filters which show on your WordPress search results page.', 'lsx-search'),
184 184
 		);
185
-		$this->search_fields( $cmb, 'engine', $global_args );
185
+		$this->search_fields($cmb, 'engine', $global_args);
186 186
 	}
187 187
 
188 188
 	/**
@@ -192,71 +192,71 @@  discard block
 block discarded – undo
192 192
 	 * @param string $position either top of bottom.
193 193
 	 * @return void
194 194
 	 */
195
-	public function configure_settings_search_archive_fields( $cmb ) {
195
+	public function configure_settings_search_archive_fields($cmb) {
196 196
 		$archives       = array();
197 197
 		$post_type_args = array(
198 198
 			'public' => true,
199 199
 		);
200
-		$post_types     = get_post_types( $post_type_args );
201
-		if ( ! empty( $post_types ) ) {
202
-			foreach ( $post_types as $post_type_key => $post_type_value ) {
203
-				switch ( $post_type_key ) {
200
+		$post_types     = get_post_types($post_type_args);
201
+		if (!empty($post_types)) {
202
+			foreach ($post_types as $post_type_key => $post_type_value) {
203
+				switch ($post_type_key) {
204 204
 					case 'post':
205 205
 						$page_url      = home_url();
206
-						$page_title    = __( 'Home', 'lsx-search' );
207
-						$show_on_front = get_option( 'show_on_front' );
208
-						if ( 'page' === $show_on_front ) {
209
-							$page_for_posts = get_option( 'page_for_posts' );
210
-							if ( '' !== $page_for_posts ) {
211
-								$page_title   = get_the_title( $page_for_posts );
212
-								$page_url     = get_permalink( $page_for_posts );
206
+						$page_title    = __('Home', 'lsx-search');
207
+						$show_on_front = get_option('show_on_front');
208
+						if ('page' === $show_on_front) {
209
+							$page_for_posts = get_option('page_for_posts');
210
+							if ('' !== $page_for_posts) {
211
+								$page_title   = get_the_title($page_for_posts);
212
+								$page_url     = get_permalink($page_for_posts);
213 213
 							}
214 214
 						}
215 215
 						$description = sprintf(
216 216
 							/* translators: %s: The subscription info */
217
-							__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ),
217
+							__('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search'),
218 218
 							$page_url,
219 219
 							$page_title
220 220
 						);
221
-						$archives[ $post_type_key ] = array(
222
-							'title' => __( 'Blog', 'lsx-search' ),
221
+						$archives[$post_type_key] = array(
222
+							'title' => __('Blog', 'lsx-search'),
223 223
 							'desc'  => $description,
224 224
 						);
225 225
 						break;
226 226
 
227 227
 					case 'product':
228 228
 						$page_url = home_url();
229
-						$page_title    = __( 'Shop', 'lsx-search' );
230
-						if ( function_exists( 'wc_get_page_id' ) ) {
231
-							$shop_page  = wc_get_page_id( 'shop' );
232
-							$page_url   = get_permalink( $shop_page );
233
-							$page_title = get_the_title( $shop_page );
229
+						$page_title = __('Shop', 'lsx-search');
230
+						if (function_exists('wc_get_page_id')) {
231
+							$shop_page  = wc_get_page_id('shop');
232
+							$page_url   = get_permalink($shop_page);
233
+							$page_title = get_the_title($shop_page);
234 234
 						}
235 235
 						$description = sprintf(
236 236
 							/* translators: %s: The subscription info */
237
-							__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ),
237
+							__('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search'),
238 238
 							$page_url,
239 239
 							$page_title
240 240
 						);
241
-						$archives[ $post_type_key ] = array(
242
-							'title' => __( 'Shop', 'lsx-search' ),
241
+						$archives[$post_type_key] = array(
242
+							'title' => __('Shop', 'lsx-search'),
243 243
 							'desc'  => $description,
244 244
 						);
245 245
 						break;
246 246
 
247 247
 					default:
248
-						if ( ! in_array( $post_type_key, \lsx\search\includes\get_restricted_post_types() ) ) {
249
-							$temp_post_type = get_post_type_object( $post_type_key );
250
-							if ( ! is_wp_error( $temp_post_type ) ) {
251
-								$page_url    = get_post_type_archive_link( $temp_post_type->name );
248
+						if (!in_array($post_type_key, \lsx\search\includes\get_restricted_post_types())) {
249
+							$temp_post_type = get_post_type_object($post_type_key);
250
+							if (!is_wp_error($temp_post_type)) {
251
+								$page_url    = get_post_type_archive_link($temp_post_type->name);
252 252
 								$description = sprintf(
253 253
 									/* translators: %s: The subscription info */
254
-									__( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ),
254
+									__('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search'),
255 255
 									$page_url,
256 256
 									$temp_post_type->label
257 257
 								);
258 258
 
259
-								$archives[ $post_type_key ] = array(
259
+								$archives[$post_type_key] = array(
260 260
 									'title' => $temp_post_type->label,
261 261
 									'desc'  => $description,
262 262
 								);
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 				}
267 267
 			}
268 268
 		}
269
-		if ( ! empty( $archives ) ) {
270
-			foreach ( $archives as $archive_key => $archive_args ) {
271
-				$this->search_fields( $cmb, $archive_key, $archive_args );
269
+		if (!empty($archives)) {
270
+			foreach ($archives as $archive_key => $archive_args) {
271
+				$this->search_fields($cmb, $archive_key, $archive_args);
272 272
 			}
273 273
 		}
274 274
 	}
@@ -280,126 +280,126 @@  discard block
 block discarded – undo
280 280
 	 * @param string $section either engine,archive or single.
281 281
 	 * @return void
282 282
 	 */
283
-	public function search_fields( $cmb, $section, $args ) {
283
+	public function search_fields($cmb, $section, $args) {
284 284
 		$this->set_facetwp_vars();
285 285
 		$cmb->add_field(
286 286
 			array(
287
-				'id'          => 'settings_' . $section . '_search',
287
+				'id'          => 'settings_'.$section.'_search',
288 288
 				'type'        => 'title',
289 289
 				'name'        => $args['title'],
290 290
 				'default'     => $args['title'],
291 291
 				'description' => $args['desc'],
292 292
 			)
293 293
 		);
294
-		do_action( 'lsx_search_settings_section', $cmb, 'top' );
294
+		do_action('lsx_search_settings_section', $cmb, 'top');
295 295
 		$cmb->add_field(
296 296
 			array(
297
-				'name'        => esc_html__( 'Enable Search Filters', 'lsx-search' ),
298
-				'id'          => $section . '_search_enable',
299
-				'description' => esc_html__( 'Display FacetWP filters on your search results page.', 'lsx-search' ),
297
+				'name'        => esc_html__('Enable Search Filters', 'lsx-search'),
298
+				'id'          => $section.'_search_enable',
299
+				'description' => esc_html__('Display FacetWP filters on your search results page.', 'lsx-search'),
300 300
 				'type'        => 'checkbox',
301 301
 			)
302 302
 		);
303 303
 
304 304
 		$cmb->add_field(
305 305
 			array(
306
-				'name'    => esc_html__( 'Page Layout', 'lsx-search' ),
307
-				'id'      => $section . '_search_layout',
306
+				'name'    => esc_html__('Page Layout', 'lsx-search'),
307
+				'id'      => $section.'_search_layout',
308 308
 				'type'    => 'select',
309 309
 				'options' => array(
310
-					''    => esc_html__( 'Follow the theme layout', 'lsx-search' ),
311
-					'1c'  => esc_html__( '1 column', 'lsx-search' ),
312
-					'2cr' => esc_html__( '2 columns / Content on right', 'lsx-search' ),
313
-					'2cl' => esc_html__( '2 columns / Content on left', 'lsx-search' ),
310
+					''    => esc_html__('Follow the theme layout', 'lsx-search'),
311
+					'1c'  => esc_html__('1 column', 'lsx-search'),
312
+					'2cr' => esc_html__('2 columns / Content on right', 'lsx-search'),
313
+					'2cl' => esc_html__('2 columns / Content on left', 'lsx-search'),
314 314
 				),
315 315
 				'default' => '',
316 316
 			)
317 317
 		);
318 318
 
319
-		if ( 'product' === $section ) {
319
+		if ('product' === $section) {
320 320
 			$cmb->add_field(
321 321
 				array(
322
-					'name'             => esc_html__( 'Results Layout', 'lsx-search' ),
323
-					'id'               => $section . '_search_grid_list',
322
+					'name'             => esc_html__('Results Layout', 'lsx-search'),
323
+					'id'               => $section.'_search_grid_list',
324 324
 					'type'             => 'select',
325 325
 					'show_option_none' => false,
326
-					'description'      => __( 'Set a default layout for the search results.', 'lsx-search' ),
326
+					'description'      => __('Set a default layout for the search results.', 'lsx-search'),
327 327
 					'options'          => array(
328
-						'grid' => esc_html__( 'Grid', 'lsx-search' ),
329
-						'list' => esc_html__( 'List', 'lsx-search' ),
328
+						'grid' => esc_html__('Grid', 'lsx-search'),
329
+						'list' => esc_html__('List', 'lsx-search'),
330 330
 					),
331 331
 					'default' => 'grid',
332 332
 				)
333 333
 			);
334 334
 			$cmb->add_field(
335 335
 				array(
336
-					'name'        => esc_html__( 'Layout Switcher', 'lsx-search' ),
337
-					'id'          => $section . '_search_layout_switcher_enable',
336
+					'name'        => esc_html__('Layout Switcher', 'lsx-search'),
337
+					'id'          => $section.'_search_layout_switcher_enable',
338 338
 					'type'        => 'checkbox',
339
-					'description' => __( 'Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search' ),
339
+					'description' => __('Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search'),
340 340
 				)
341 341
 			);
342 342
 		}
343
-		if ( 'engine' === $section && is_plugin_active( 'tour-operator/tour-operator.php' ) ) {
343
+		if ('engine' === $section && is_plugin_active('tour-operator/tour-operator.php')) {
344 344
 			$cmb->add_field(
345 345
 				array(
346
-					'name'    => esc_html__( 'List layout images', 'lsx-search' ),
347
-					'id'      => $section . '_search_list_layout_image_style',
346
+					'name'    => esc_html__('List layout images', 'lsx-search'),
347
+					'id'      => $section.'_search_list_layout_image_style',
348 348
 					'type'    => 'select',
349 349
 					'options' => array(
350
-						''           => esc_html__( 'Full Height', 'lsx-search' ),
351
-						'max-height' => esc_html__( 'Max Height', 'lsx-search' ),
350
+						''           => esc_html__('Full Height', 'lsx-search'),
351
+						'max-height' => esc_html__('Max Height', 'lsx-search'),
352 352
 					),
353 353
 					'default' => '',
354 354
 				)
355 355
 			);
356 356
 		}
357
-		if ( 'engine' === $section ) {
357
+		if ('engine' === $section) {
358 358
 			$cmb->add_field(
359 359
 				array(
360
-					'name'        => esc_html__( 'Display Excerpt', 'lsx-search' ),
361
-					'id'          => $section . '_excerpt_enable',
360
+					'name'        => esc_html__('Display Excerpt', 'lsx-search'),
361
+					'id'          => $section.'_excerpt_enable',
362 362
 					'type'        => 'checkbox',
363
-					'description' => __( 'Display the excerpt of a listing.', 'lsx-search' ),
363
+					'description' => __('Display the excerpt of a listing.', 'lsx-search'),
364 364
 				)
365 365
 			);
366 366
 			$cmb->add_field(
367 367
 				array(
368
-					'name'        => esc_html__( 'Enable Post Type Label', 'lsx-search' ),
369
-					'id'          => $section . '_search_enable_pt_label',
368
+					'name'        => esc_html__('Enable Post Type Label', 'lsx-search'),
369
+					'id'          => $section.'_search_enable_pt_label',
370 370
 					'type'        => 'checkbox',
371
-					'description' => __( 'This enables the post type label from entries on search results page.', 'lsx-search' ),
371
+					'description' => __('This enables the post type label from entries on search results page.', 'lsx-search'),
372 372
 				)
373 373
 			);
374
-			if ( is_plugin_active( 'tour-operator/tour-operator.php' ) ) {
374
+			if (is_plugin_active('tour-operator/tour-operator.php')) {
375 375
 				$cmb->add_field(
376 376
 					array(
377
-						'name'        => esc_html__( 'Enable Continent Filter', 'lsx-search' ),
378
-						'id'          => $section . '_search_enable_continent_filter',
377
+						'name'        => esc_html__('Enable Continent Filter', 'lsx-search'),
378
+						'id'          => $section.'_search_enable_continent_filter',
379 379
 						'type'        => 'checkbox',
380
-						'description' => __( 'This enables the continent filter in FacetWP destinations filter.', 'lsx-search' ),
380
+						'description' => __('This enables the continent filter in FacetWP destinations filter.', 'lsx-search'),
381 381
 					)
382 382
 				);
383 383
 				$cmb->add_field(
384 384
 					array(
385
-						'name'        => esc_html__( 'Enable Continental Regions', 'lsx-search' ),
386
-						'id'          => $section . '_search_enable_continental_regions',
385
+						'name'        => esc_html__('Enable Continental Regions', 'lsx-search'),
386
+						'id'          => $section.'_search_enable_continental_regions',
387 387
 						'type'        => 'checkbox',
388
-						'description' => __( 'This disable continents and enabled the sub regions.', 'lsx-search' ),
388
+						'description' => __('This disable continents and enabled the sub regions.', 'lsx-search'),
389 389
 					)
390 390
 				);
391 391
 			}
392 392
 		}
393 393
 
394
-		if ( is_plugin_active( 'tour-operator/tour-operator.php' ) && 'accommodation' === $section ) {
394
+		if (is_plugin_active('tour-operator/tour-operator.php') && 'accommodation' === $section) {
395 395
 			$cmb->add_field(
396 396
 				array(
397
-					'name'    => esc_html__( 'Results Layout - list vs map', 'lsx-search' ),
398
-					'id'      => $section . '_search_results_layout',
397
+					'name'    => esc_html__('Results Layout - list vs map', 'lsx-search'),
398
+					'id'      => $section.'_search_results_layout',
399 399
 					'type'    => 'select',
400 400
 					'options' => array(
401
-						'list_map'    => esc_html__( 'List and Map', 'lsx-search' ),
402
-						'list'        => esc_html__( 'List only', 'lsx-search' ),
401
+						'list_map'    => esc_html__('List and Map', 'lsx-search'),
402
+						'list'        => esc_html__('List only', 'lsx-search'),
403 403
 					),
404 404
 					'default' => '',
405 405
 				)
@@ -408,52 +408,52 @@  discard block
 block discarded – undo
408 408
 
409 409
 		$cmb->add_field(
410 410
 			array(
411
-				'name'        => esc_html__( 'Enable Collapse', 'lsx-search' ),
412
-				'id'          => $section . '_search_collapse',
411
+				'name'        => esc_html__('Enable Collapse', 'lsx-search'),
412
+				'id'          => $section.'_search_collapse',
413 413
 				'type'        => 'checkbox',
414
-				'description' => __( 'Enable collapsible filters on search results.', 'lsx-search' ),
414
+				'description' => __('Enable collapsible filters on search results.', 'lsx-search'),
415 415
 			)
416 416
 		);
417 417
 
418 418
 		$cmb->add_field(
419 419
 			array(
420
-				'name' => esc_html__( 'Disable Sorting', 'lsx-search' ),
421
-				'id'   => $section . '_search_disable_sorting',
420
+				'name' => esc_html__('Disable Sorting', 'lsx-search'),
421
+				'id'   => $section.'_search_disable_sorting',
422 422
 				'type' => 'checkbox',
423
-				'description' => __( 'Toggle the sorting drop down menu on your search results.', 'lsx-search' ),
423
+				'description' => __('Toggle the sorting drop down menu on your search results.', 'lsx-search'),
424 424
 			)
425 425
 		);
426 426
 
427 427
 		$cmb->add_field(
428 428
 			array(
429
-				'name' => esc_html__( 'Disable the Date Option', 'lsx-search' ),
430
-				'id'   => $section . '_search_disable_date',
429
+				'name' => esc_html__('Disable the Date Option', 'lsx-search'),
430
+				'id'   => $section.'_search_disable_date',
431 431
 				'type' => 'checkbox',
432 432
 			)
433 433
 		);
434 434
 
435 435
 		$cmb->add_field(
436 436
 			array(
437
-				'name' => esc_html__( 'Display Clear Button', 'lsx-search' ),
438
-				'id'   => $section . '_search_display_clear_button',
437
+				'name' => esc_html__('Display Clear Button', 'lsx-search'),
438
+				'id'   => $section.'_search_display_clear_button',
439 439
 				'type' => 'checkbox',
440
-				'description' => __( 'Check this to turn on a button that will clear your search results.', 'lsx-search' ),
440
+				'description' => __('Check this to turn on a button that will clear your search results.', 'lsx-search'),
441 441
 			)
442 442
 		);
443 443
 
444 444
 		$cmb->add_field(
445 445
 			array(
446
-				'name' => esc_html__( 'Display Result Count', 'lsx-search' ),
447
-				'id'   => $section . '_search_display_result_count',
446
+				'name' => esc_html__('Display Result Count', 'lsx-search'),
447
+				'id'   => $section.'_search_display_result_count',
448 448
 				'type' => 'checkbox',
449 449
 			)
450 450
 		);
451
-		if ( is_plugin_active( 'facetwp-alpha/index.php' ) ) {
451
+		if (is_plugin_active('facetwp-alpha/index.php')) {
452 452
 			$cmb->add_field(
453 453
 				array(
454
-					'name'        => esc_html__( 'Alphabet Facet', 'lsx-search' ),
455
-					'description' => esc_html__( 'Select the alphabetical sorter facet.', 'lsx-search' ),
456
-					'id'          => $section . '_search_az_pagination',
454
+					'name'        => esc_html__('Alphabet Facet', 'lsx-search'),
455
+					'description' => esc_html__('Select the alphabetical sorter facet.', 'lsx-search'),
456
+					'id'          => $section.'_search_az_pagination',
457 457
 					'type'        => 'select',
458 458
 					'options'     => $this->az_facets,
459 459
 				)
@@ -461,17 +461,17 @@  discard block
 block discarded – undo
461 461
 		}
462 462
 		$cmb->add_field(
463 463
 			array(
464
-				'name'        => esc_html__( 'Facets', 'lsx-search' ),
465
-				'description' => esc_html__( 'Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search' ),
466
-				'id'          => $section . '_search_facets',
464
+				'name'        => esc_html__('Facets', 'lsx-search'),
465
+				'description' => esc_html__('Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search'),
466
+				'id'          => $section.'_search_facets',
467 467
 				'type'        => 'multicheck',
468 468
 				'options'     => $this->facet_data,
469 469
 			)
470 470
 		);
471
-		do_action( 'lsx_search_settings_section', $cmb, 'bottom' );
471
+		do_action('lsx_search_settings_section', $cmb, 'bottom');
472 472
 		$cmb->add_field(
473 473
 			array(
474
-				'id'   => 'settings_' . $section . '_search_closing',
474
+				'id'   => 'settings_'.$section.'_search_closing',
475 475
 				'type' => 'tab_closing',
476 476
 			)
477 477
 		);
@@ -480,20 +480,20 @@  discard block
 block discarded – undo
480 480
 	/**
481 481
 	 * Handle body colours that might be change by LSX Customiser.
482 482
 	 */
483
-	public function customizer_body_colours_handler( $css, $colors ) {
483
+	public function customizer_body_colours_handler($css, $colors) {
484 484
 		$css .= '
485
-			@import "' . LSX_SEARCH_PATH . '/assets/css/scss/customizer-search-body-colours";
485
+			@import "' . LSX_SEARCH_PATH.'/assets/css/scss/customizer-search-body-colours";
486 486
 
487 487
 			/**
488 488
 			 * LSX Customizer - Body (LSX Search)
489 489
 			 */
490 490
 			@include customizer-search-body-colours (
491
-				$bg: 		' . $colors['background_color'] . ',
492
-				$breaker: 	' . $colors['body_line_color'] . ',
493
-				$color:    	' . $colors['body_text_color'] . ',
494
-				$link:    	' . $colors['body_link_color'] . ',
495
-				$hover:    	' . $colors['body_link_hover_color'] . ',
496
-				$small:    	' . $colors['body_text_small_color'] . '
491
+				$bg: 		' . $colors['background_color'].',
492
+				$breaker: 	' . $colors['body_line_color'].',
493
+				$color:    	' . $colors['body_text_color'].',
494
+				$link:    	' . $colors['body_link_color'].',
495
+				$hover:    	' . $colors['body_link_hover_color'].',
496
+				$small:    	' . $colors['body_text_small_color'].'
497 497
 			);
498 498
 		';
499 499
 
@@ -507,14 +507,14 @@  discard block
 block discarded – undo
507 507
 	 * @param array $colours
508 508
 	 * @return string
509 509
 	 */
510
-	public function customizer_button_colours( $css, $colours ) {
510
+	public function customizer_button_colours($css, $colours) {
511 511
 		$css .= '
512 512
 			#secondary.facetwp-sidebar {
513 513
 				.facetwp-item.facetwp-form {
514 514
 					.search-form {
515 515
 						.btn {
516 516
 							&.search-submit {
517
-								@include lsx-button-colour(' . $colours['button_text_color'] . ', ' . $colours['button_text_color_hover'] . ', ' . $colours['button_background_color'] . ', ' . $colours['button_background_hover_color'] . ', ' . $colours['button_shadow'] . ');
517
+								@include lsx-button-colour(' . $colours['button_text_color'].', '.$colours['button_text_color_hover'].', '.$colours['button_background_color'].', '.$colours['button_background_hover_color'].', '.$colours['button_shadow'].');
518 518
 							}
519 519
 						}
520 520
 					}
Please login to merge, or discard this patch.