@@ -53,14 +53,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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,125 +280,125 @@ discard block |
||
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 | - '2cr' => esc_html__( 'Sidebar on right', 'lsx-search' ), |
|
312 | - '2cl' => esc_html__( 'Sidebar on left', 'lsx-search' ), |
|
310 | + '' => esc_html__('Follow the theme layout', 'lsx-search'), |
|
311 | + '2cr' => esc_html__('Sidebar on right', 'lsx-search'), |
|
312 | + '2cl' => esc_html__('Sidebar on left', 'lsx-search'), |
|
313 | 313 | ), |
314 | 314 | 'default' => '', |
315 | 315 | ) |
316 | 316 | ); |
317 | 317 | |
318 | - if ( 'product' === $section ) { |
|
318 | + if ('product' === $section) { |
|
319 | 319 | $cmb->add_field( |
320 | 320 | array( |
321 | - 'name' => esc_html__( 'Results Layout', 'lsx-search' ), |
|
322 | - 'id' => $section . '_search_grid_list', |
|
321 | + 'name' => esc_html__('Results Layout', 'lsx-search'), |
|
322 | + 'id' => $section.'_search_grid_list', |
|
323 | 323 | 'type' => 'select', |
324 | 324 | 'show_option_none' => false, |
325 | - 'description' => __( 'Set a default layout for the search results.', 'lsx-search' ), |
|
325 | + 'description' => __('Set a default layout for the search results.', 'lsx-search'), |
|
326 | 326 | 'options' => array( |
327 | - 'grid' => esc_html__( 'Grid', 'lsx-search' ), |
|
328 | - 'list' => esc_html__( 'List', 'lsx-search' ), |
|
327 | + 'grid' => esc_html__('Grid', 'lsx-search'), |
|
328 | + 'list' => esc_html__('List', 'lsx-search'), |
|
329 | 329 | ), |
330 | 330 | 'default' => 'grid', |
331 | 331 | ) |
332 | 332 | ); |
333 | 333 | $cmb->add_field( |
334 | 334 | array( |
335 | - 'name' => esc_html__( 'Layout Switcher', 'lsx-search' ), |
|
336 | - 'id' => $section . '_search_layout_switcher_enable', |
|
335 | + 'name' => esc_html__('Layout Switcher', 'lsx-search'), |
|
336 | + 'id' => $section.'_search_layout_switcher_enable', |
|
337 | 337 | 'type' => 'checkbox', |
338 | - 'description' => __( 'Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search' ), |
|
338 | + 'description' => __('Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search'), |
|
339 | 339 | ) |
340 | 340 | ); |
341 | 341 | } |
342 | - if ( 'engine' === $section && function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
342 | + if ('engine' === $section && function_exists('is_plugin_active') && is_plugin_active('tour-operator/tour-operator.php')) { |
|
343 | 343 | $cmb->add_field( |
344 | 344 | array( |
345 | - 'name' => esc_html__( 'List layout images', 'lsx-search' ), |
|
346 | - 'id' => $section . '_search_list_layout_image_style', |
|
345 | + 'name' => esc_html__('List layout images', 'lsx-search'), |
|
346 | + 'id' => $section.'_search_list_layout_image_style', |
|
347 | 347 | 'type' => 'select', |
348 | 348 | 'options' => array( |
349 | - '' => esc_html__( 'Full Height', 'lsx-search' ), |
|
350 | - 'max-height' => esc_html__( 'Max Height', 'lsx-search' ), |
|
349 | + '' => esc_html__('Full Height', 'lsx-search'), |
|
350 | + 'max-height' => esc_html__('Max Height', 'lsx-search'), |
|
351 | 351 | ), |
352 | 352 | 'default' => '', |
353 | 353 | ) |
354 | 354 | ); |
355 | 355 | } |
356 | - if ( 'engine' === $section ) { |
|
356 | + if ('engine' === $section) { |
|
357 | 357 | $cmb->add_field( |
358 | 358 | array( |
359 | - 'name' => esc_html__( 'Display Excerpt', 'lsx-search' ), |
|
360 | - 'id' => $section . '_excerpt_enable', |
|
359 | + 'name' => esc_html__('Display Excerpt', 'lsx-search'), |
|
360 | + 'id' => $section.'_excerpt_enable', |
|
361 | 361 | 'type' => 'checkbox', |
362 | - 'description' => __( 'Display the excerpt of a listing.', 'lsx-search' ), |
|
362 | + 'description' => __('Display the excerpt of a listing.', 'lsx-search'), |
|
363 | 363 | ) |
364 | 364 | ); |
365 | 365 | $cmb->add_field( |
366 | 366 | array( |
367 | - 'name' => esc_html__( 'Enable Post Type Label', 'lsx-search' ), |
|
368 | - 'id' => $section . '_search_enable_pt_label', |
|
367 | + 'name' => esc_html__('Enable Post Type Label', 'lsx-search'), |
|
368 | + 'id' => $section.'_search_enable_pt_label', |
|
369 | 369 | 'type' => 'checkbox', |
370 | - 'description' => __( 'This enables the post type label from entries on search results page.', 'lsx-search' ), |
|
370 | + 'description' => __('This enables the post type label from entries on search results page.', 'lsx-search'), |
|
371 | 371 | ) |
372 | 372 | ); |
373 | - if ( function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
373 | + if (function_exists('is_plugin_active') && is_plugin_active('tour-operator/tour-operator.php')) { |
|
374 | 374 | $cmb->add_field( |
375 | 375 | array( |
376 | - 'name' => esc_html__( 'Enable Continent Filter', 'lsx-search' ), |
|
377 | - 'id' => $section . '_search_enable_continent_filter', |
|
376 | + 'name' => esc_html__('Enable Continent Filter', 'lsx-search'), |
|
377 | + 'id' => $section.'_search_enable_continent_filter', |
|
378 | 378 | 'type' => 'checkbox', |
379 | - 'description' => __( 'This enables the continent filter in FacetWP destinations filter.', 'lsx-search' ), |
|
379 | + 'description' => __('This enables the continent filter in FacetWP destinations filter.', 'lsx-search'), |
|
380 | 380 | ) |
381 | 381 | ); |
382 | 382 | $cmb->add_field( |
383 | 383 | array( |
384 | - 'name' => esc_html__( 'Enable Continental Regions', 'lsx-search' ), |
|
385 | - 'id' => $section . '_search_enable_continental_regions', |
|
384 | + 'name' => esc_html__('Enable Continental Regions', 'lsx-search'), |
|
385 | + 'id' => $section.'_search_enable_continental_regions', |
|
386 | 386 | 'type' => 'checkbox', |
387 | - 'description' => __( 'This disable continents and enabled the sub regions.', 'lsx-search' ), |
|
387 | + 'description' => __('This disable continents and enabled the sub regions.', 'lsx-search'), |
|
388 | 388 | ) |
389 | 389 | ); |
390 | 390 | } |
391 | 391 | } |
392 | 392 | |
393 | - if ( function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) && 'accommodation' === $section ) { |
|
393 | + if (function_exists('is_plugin_active') && is_plugin_active('tour-operator/tour-operator.php') && 'accommodation' === $section) { |
|
394 | 394 | $cmb->add_field( |
395 | 395 | array( |
396 | - 'name' => esc_html__( 'Results Layout - list vs map', 'lsx-search' ), |
|
397 | - 'id' => $section . '_search_results_layout', |
|
396 | + 'name' => esc_html__('Results Layout - list vs map', 'lsx-search'), |
|
397 | + 'id' => $section.'_search_results_layout', |
|
398 | 398 | 'type' => 'select', |
399 | 399 | 'options' => array( |
400 | - 'list_map' => esc_html__( 'List and Map', 'lsx-search' ), |
|
401 | - 'list' => esc_html__( 'List only', 'lsx-search' ), |
|
400 | + 'list_map' => esc_html__('List and Map', 'lsx-search'), |
|
401 | + 'list' => esc_html__('List only', 'lsx-search'), |
|
402 | 402 | ), |
403 | 403 | 'default' => '', |
404 | 404 | ) |
@@ -407,52 +407,52 @@ discard block |
||
407 | 407 | |
408 | 408 | $cmb->add_field( |
409 | 409 | array( |
410 | - 'name' => esc_html__( 'Enable Collapse', 'lsx-search' ), |
|
411 | - 'id' => $section . '_search_collapse', |
|
410 | + 'name' => esc_html__('Enable Collapse', 'lsx-search'), |
|
411 | + 'id' => $section.'_search_collapse', |
|
412 | 412 | 'type' => 'checkbox', |
413 | - 'description' => __( 'Enable collapsible filters on search results.', 'lsx-search' ), |
|
413 | + 'description' => __('Enable collapsible filters on search results.', 'lsx-search'), |
|
414 | 414 | ) |
415 | 415 | ); |
416 | 416 | |
417 | 417 | $cmb->add_field( |
418 | 418 | array( |
419 | - 'name' => esc_html__( 'Disable Sorting', 'lsx-search' ), |
|
420 | - 'id' => $section . '_search_disable_sorting', |
|
419 | + 'name' => esc_html__('Disable Sorting', 'lsx-search'), |
|
420 | + 'id' => $section.'_search_disable_sorting', |
|
421 | 421 | 'type' => 'checkbox', |
422 | - 'description' => __( 'Toggle the sorting drop down menu on your search results.', 'lsx-search' ), |
|
422 | + 'description' => __('Toggle the sorting drop down menu on your search results.', 'lsx-search'), |
|
423 | 423 | ) |
424 | 424 | ); |
425 | 425 | |
426 | 426 | $cmb->add_field( |
427 | 427 | array( |
428 | - 'name' => esc_html__( 'Disable the Date Sorting Option', 'lsx-search' ), |
|
429 | - 'id' => $section . '_search_disable_date', |
|
428 | + 'name' => esc_html__('Disable the Date Sorting Option', 'lsx-search'), |
|
429 | + 'id' => $section.'_search_disable_date', |
|
430 | 430 | 'type' => 'checkbox', |
431 | 431 | ) |
432 | 432 | ); |
433 | 433 | |
434 | 434 | $cmb->add_field( |
435 | 435 | array( |
436 | - 'name' => esc_html__( 'Display Clear Button', 'lsx-search' ), |
|
437 | - 'id' => $section . '_search_display_clear_button', |
|
436 | + 'name' => esc_html__('Display Clear Button', 'lsx-search'), |
|
437 | + 'id' => $section.'_search_display_clear_button', |
|
438 | 438 | 'type' => 'checkbox', |
439 | - 'description' => __( 'Check this to turn on a button that will clear your search results.', 'lsx-search' ), |
|
439 | + 'description' => __('Check this to turn on a button that will clear your search results.', 'lsx-search'), |
|
440 | 440 | ) |
441 | 441 | ); |
442 | 442 | |
443 | 443 | $cmb->add_field( |
444 | 444 | array( |
445 | - 'name' => esc_html__( 'Display Result Count', 'lsx-search' ), |
|
446 | - 'id' => $section . '_search_display_result_count', |
|
445 | + 'name' => esc_html__('Display Result Count', 'lsx-search'), |
|
446 | + 'id' => $section.'_search_display_result_count', |
|
447 | 447 | 'type' => 'checkbox', |
448 | 448 | ) |
449 | 449 | ); |
450 | - if ( function_exists('is_plugin_active') && is_plugin_active( 'facetwp-alpha/index.php' ) ) { |
|
450 | + if (function_exists('is_plugin_active') && is_plugin_active('facetwp-alpha/index.php')) { |
|
451 | 451 | $cmb->add_field( |
452 | 452 | array( |
453 | - 'name' => esc_html__( 'Alphabet Facet', 'lsx-search' ), |
|
454 | - 'description' => esc_html__( 'Select the alphabetical sorter facet.', 'lsx-search' ), |
|
455 | - 'id' => $section . '_search_az_pagination', |
|
453 | + 'name' => esc_html__('Alphabet Facet', 'lsx-search'), |
|
454 | + 'description' => esc_html__('Select the alphabetical sorter facet.', 'lsx-search'), |
|
455 | + 'id' => $section.'_search_az_pagination', |
|
456 | 456 | 'type' => 'select', |
457 | 457 | 'options' => $this->az_facets, |
458 | 458 | ) |
@@ -460,17 +460,17 @@ discard block |
||
460 | 460 | } |
461 | 461 | $cmb->add_field( |
462 | 462 | array( |
463 | - 'name' => esc_html__( 'Facets', 'lsx-search' ), |
|
464 | - 'description' => esc_html__( 'Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search' ), |
|
465 | - 'id' => $section . '_search_facets', |
|
463 | + 'name' => esc_html__('Facets', 'lsx-search'), |
|
464 | + 'description' => esc_html__('Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search'), |
|
465 | + 'id' => $section.'_search_facets', |
|
466 | 466 | 'type' => 'multicheck', |
467 | 467 | 'options' => $this->facet_data, |
468 | 468 | ) |
469 | 469 | ); |
470 | - do_action( 'lsx_search_settings_section', $cmb, 'bottom' ); |
|
470 | + do_action('lsx_search_settings_section', $cmb, 'bottom'); |
|
471 | 471 | $cmb->add_field( |
472 | 472 | array( |
473 | - 'id' => 'settings_' . $section . '_search_closing', |
|
473 | + 'id' => 'settings_'.$section.'_search_closing', |
|
474 | 474 | 'type' => 'tab_closing', |
475 | 475 | ) |
476 | 476 | ); |
@@ -479,20 +479,20 @@ discard block |
||
479 | 479 | /** |
480 | 480 | * Handle body colours that might be change by LSX Customiser. |
481 | 481 | */ |
482 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
482 | + public function customizer_body_colours_handler($css, $colors) { |
|
483 | 483 | $css .= ' |
484 | - @import "' . LSX_SEARCH_PATH . '/assets/css/scss/customizer-search-body-colours"; |
|
484 | + @import "' . LSX_SEARCH_PATH.'/assets/css/scss/customizer-search-body-colours"; |
|
485 | 485 | |
486 | 486 | /** |
487 | 487 | * LSX Customizer - Body (LSX Search) |
488 | 488 | */ |
489 | 489 | @include customizer-search-body-colours ( |
490 | - $bg: ' . $colors['background_color'] . ', |
|
491 | - $breaker: ' . $colors['body_line_color'] . ', |
|
492 | - $color: ' . $colors['body_text_color'] . ', |
|
493 | - $link: ' . $colors['body_link_color'] . ', |
|
494 | - $hover: ' . $colors['body_link_hover_color'] . ', |
|
495 | - $small: ' . $colors['body_text_small_color'] . ' |
|
490 | + $bg: ' . $colors['background_color'].', |
|
491 | + $breaker: ' . $colors['body_line_color'].', |
|
492 | + $color: ' . $colors['body_text_color'].', |
|
493 | + $link: ' . $colors['body_link_color'].', |
|
494 | + $hover: ' . $colors['body_link_hover_color'].', |
|
495 | + $small: ' . $colors['body_text_small_color'].' |
|
496 | 496 | ); |
497 | 497 | '; |
498 | 498 | |
@@ -506,14 +506,14 @@ discard block |
||
506 | 506 | * @param array $colours |
507 | 507 | * @return string |
508 | 508 | */ |
509 | - public function customizer_button_colours( $css, $colours ) { |
|
509 | + public function customizer_button_colours($css, $colours) { |
|
510 | 510 | $css .= ' |
511 | 511 | #secondary.facetwp-sidebar { |
512 | 512 | .facetwp-item.facetwp-form { |
513 | 513 | .search-form { |
514 | 514 | .btn { |
515 | 515 | &.search-submit { |
516 | - @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'] . '); |
|
516 | + @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 | 517 | } |
518 | 518 | } |
519 | 519 | } |
@@ -70,28 +70,28 @@ discard block |
||
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_filter( 'pre_get_posts', array( $this, 'ignore_sticky_search' ) ); |
|
79 | + add_filter('pre_get_posts', array($this, 'ignore_sticky_search')); |
|
80 | 80 | |
81 | - add_action( 'pre_get_posts', array( $this, 'filter_post_types' ) ); |
|
81 | + add_action('pre_get_posts', array($this, 'filter_post_types')); |
|
82 | 82 | |
83 | - add_filter( 'lsx_search_post_types', array( $this, 'register_post_types' ) ); |
|
84 | - add_filter( 'lsx_search_taxonomies', array( $this, 'register_taxonomies' ) ); |
|
85 | - add_filter( 'lsx_search_post_types_plural', array( $this, 'register_post_type_tabs' ) ); |
|
86 | - add_filter( 'facetwp_sort_options', array( $this, 'facetwp_sort_options' ), 10, 2 ); |
|
87 | - add_filter( 'wp_kses_allowed_html', array( $this, 'kses_allowed_html' ), 20, 2 ); |
|
83 | + add_filter('lsx_search_post_types', array($this, 'register_post_types')); |
|
84 | + add_filter('lsx_search_taxonomies', array($this, 'register_taxonomies')); |
|
85 | + add_filter('lsx_search_post_types_plural', array($this, 'register_post_type_tabs')); |
|
86 | + add_filter('facetwp_sort_options', array($this, 'facetwp_sort_options'), 10, 2); |
|
87 | + add_filter('wp_kses_allowed_html', array($this, 'kses_allowed_html'), 20, 2); |
|
88 | 88 | |
89 | 89 | // Redirects. |
90 | - add_action( 'template_redirect', array( $this, 'pretty_search_redirect' ) ); |
|
91 | - add_filter( 'pre_get_posts', array( $this, 'pretty_search_parse_query' ) ); |
|
90 | + add_action('template_redirect', array($this, 'pretty_search_redirect')); |
|
91 | + add_filter('pre_get_posts', array($this, 'pretty_search_parse_query')); |
|
92 | 92 | |
93 | - add_action( 'lsx_search_sidebar_top', array( $this, 'search_sidebar_top' ) ); |
|
94 | - add_filter( 'facetwp_facet_html', array( $this, 'search_facet_html' ), 10, 2 ); |
|
93 | + add_action('lsx_search_sidebar_top', array($this, 'search_sidebar_top')); |
|
94 | + add_filter('facetwp_facet_html', array($this, 'search_facet_html'), 10, 2); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public static function get_instance() { |
105 | 105 | // If the single instance hasn't been set, set it now. |
106 | - if ( null === self::$instance ) { |
|
106 | + if (null === self::$instance) { |
|
107 | 107 | self::$instance = new self(); |
108 | 108 | } |
109 | 109 | return self::$instance; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * Loads the variable classes and the static classes. |
114 | 114 | */ |
115 | 115 | private function load_classes() { |
116 | - require_once LSX_SEARCH_PATH . 'classes/frontend/class-layout.php'; |
|
116 | + require_once LSX_SEARCH_PATH.'classes/frontend/class-layout.php'; |
|
117 | 117 | $this->layout = frontend\Layout::get_instance(); |
118 | 118 | } |
119 | 119 | |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | public function set_vars() { |
124 | 124 | $post_type = ''; |
125 | 125 | |
126 | - $this->post_types = apply_filters( 'lsx_search_post_types', array() ); |
|
127 | - $this->taxonomies = apply_filters( 'lsx_search_taxonomies', array() ); |
|
128 | - $this->tabs = apply_filters( 'lsx_search_post_types_plural', array() ); |
|
129 | - $this->options = apply_filters( 'lsx_search_options', $this->options ); |
|
126 | + $this->post_types = apply_filters('lsx_search_post_types', array()); |
|
127 | + $this->taxonomies = apply_filters('lsx_search_taxonomies', array()); |
|
128 | + $this->tabs = apply_filters('lsx_search_post_types_plural', array()); |
|
129 | + $this->options = apply_filters('lsx_search_options', $this->options); |
|
130 | 130 | $this->post_types = get_post_types(); |
131 | 131 | $this->post_type_slugs = array( |
132 | 132 | 'post' => 'posts', |
@@ -139,22 +139,22 @@ discard block |
||
139 | 139 | ); |
140 | 140 | $this->set_search_prefix(); |
141 | 141 | $this->get_cmb2_options(); |
142 | - $this->search_enabled = apply_filters( 'lsx_search_enabled', $this->is_search_enabled(), $this ); |
|
143 | - $this->search_prefix = apply_filters( 'lsx_search_prefix', $this->search_prefix, $this ); |
|
142 | + $this->search_enabled = apply_filters('lsx_search_enabled', $this->is_search_enabled(), $this); |
|
143 | + $this->search_prefix = apply_filters('lsx_search_prefix', $this->search_prefix, $this); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | private function get_cmb2_options() { |
147 | - $cmb2_options = get_option( 'lsx-search-settings' ); |
|
148 | - if ( false !== $cmb2_options && ! empty( $cmb2_options ) ) { |
|
149 | - $this->set_search_prefix( true ); |
|
147 | + $cmb2_options = get_option('lsx-search-settings'); |
|
148 | + if (false !== $cmb2_options && !empty($cmb2_options)) { |
|
149 | + $this->set_search_prefix(true); |
|
150 | 150 | $this->options['display'] = $cmb2_options; |
151 | - foreach ( $this->options['display'] as $option_key => $option_value ) { |
|
152 | - if ( is_array( $option_value ) && ! empty( $option_value ) ) { |
|
151 | + foreach ($this->options['display'] as $option_key => $option_value) { |
|
152 | + if (is_array($option_value) && !empty($option_value)) { |
|
153 | 153 | $new_values = array(); |
154 | - foreach ( $option_value as $empty_key => $key_value ) { |
|
155 | - $new_values[ $key_value ] = 'on'; |
|
154 | + foreach ($option_value as $empty_key => $key_value) { |
|
155 | + $new_values[$key_value] = 'on'; |
|
156 | 156 | } |
157 | - $this->options['display'][ $option_key ] = $new_values; |
|
157 | + $this->options['display'][$option_key] = $new_values; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | $this->new_options = true; |
@@ -164,46 +164,46 @@ discard block |
||
164 | 164 | |
165 | 165 | private function disable_to_search_actions() { |
166 | 166 | global $lsx_to_search_fwp, $lsx_to_search; |
167 | - if ( null !== $lsx_to_search ) { |
|
167 | + if (null !== $lsx_to_search) { |
|
168 | 168 | // Redirects. |
169 | - remove_filter( 'template_include', array( $lsx_to_search, 'search_template_include' ), 99 ); |
|
170 | - remove_action( 'template_redirect', array( $lsx_to_search, 'pretty_search_redirect' ) ); |
|
171 | - remove_filter( 'pre_get_posts', array( $lsx_to_search, 'pretty_search_parse_query' ) ); |
|
169 | + remove_filter('template_include', array($lsx_to_search, 'search_template_include'), 99); |
|
170 | + remove_action('template_redirect', array($lsx_to_search, 'pretty_search_redirect')); |
|
171 | + remove_filter('pre_get_posts', array($lsx_to_search, 'pretty_search_parse_query')); |
|
172 | 172 | |
173 | 173 | // Layout Filter. |
174 | - remove_filter( 'lsx_layout', array( $lsx_to_search, 'lsx_layout' ), 20, 1 ); |
|
175 | - remove_filter( 'lsx_layout_selector', array( $lsx_to_search, 'lsx_layout_selector' ), 10, 4 ); |
|
176 | - remove_filter( 'lsx_to_archive_layout', array( $lsx_to_search, 'lsx_to_search_archive_layout' ), 10, 2 ); |
|
174 | + remove_filter('lsx_layout', array($lsx_to_search, 'lsx_layout'), 20, 1); |
|
175 | + remove_filter('lsx_layout_selector', array($lsx_to_search, 'lsx_layout_selector'), 10, 4); |
|
176 | + remove_filter('lsx_to_archive_layout', array($lsx_to_search, 'lsx_to_search_archive_layout'), 10, 2); |
|
177 | 177 | |
178 | - remove_action( 'lsx_search_sidebar_top', array( $lsx_to_search, 'search_sidebar_top' ) ); |
|
179 | - remove_action( 'pre_get_posts', array( $lsx_to_search, 'price_sorting' ), 100 ); |
|
178 | + remove_action('lsx_search_sidebar_top', array($lsx_to_search, 'search_sidebar_top')); |
|
179 | + remove_action('pre_get_posts', array($lsx_to_search, 'price_sorting'), 100); |
|
180 | 180 | |
181 | 181 | //add_shortcode( 'lsx_search_form', array( 'LSX_TO_Search_Frontend', 'search_form' ) ); |
182 | - remove_filter( 'searchwp_short_circuit', array( $lsx_to_search, 'searchwp_short_circuit' ), 10, 2 ); |
|
183 | - remove_filter( 'get_search_query', array( $lsx_to_search, 'get_search_query' ) ); |
|
184 | - remove_filter( 'body_class', array( $lsx_to_search, 'to_add_search_url_class' ), 20 ); |
|
182 | + remove_filter('searchwp_short_circuit', array($lsx_to_search, 'searchwp_short_circuit'), 10, 2); |
|
183 | + remove_filter('get_search_query', array($lsx_to_search, 'get_search_query')); |
|
184 | + remove_filter('body_class', array($lsx_to_search, 'to_add_search_url_class'), 20); |
|
185 | 185 | |
186 | - remove_filter( 'facetwp_preload_url_vars', array( $lsx_to_search, 'preload_url_vars' ), 10, 1 ); |
|
187 | - remove_filter( 'wpseo_json_ld_search_url', array( $lsx_to_search, 'change_json_ld_search_url' ), 10, 1 ); |
|
186 | + remove_filter('facetwp_preload_url_vars', array($lsx_to_search, 'preload_url_vars'), 10, 1); |
|
187 | + remove_filter('wpseo_json_ld_search_url', array($lsx_to_search, 'change_json_ld_search_url'), 10, 1); |
|
188 | 188 | } |
189 | - if ( null !== $lsx_to_search_fwp ) { |
|
190 | - remove_filter( 'facetwp_indexer_row_data', array( $lsx_to_search_fwp, 'facetwp_index_row_data' ), 10, 2 ); |
|
191 | - remove_filter( 'facetwp_index_row', array( $lsx_to_search_fwp, 'facetwp_index_row' ), 10, 2 ); |
|
189 | + if (null !== $lsx_to_search_fwp) { |
|
190 | + remove_filter('facetwp_indexer_row_data', array($lsx_to_search_fwp, 'facetwp_index_row_data'), 10, 2); |
|
191 | + remove_filter('facetwp_index_row', array($lsx_to_search_fwp, 'facetwp_index_row'), 10, 2); |
|
192 | 192 | |
193 | - remove_filter( 'facetwp_sort_options', array( $lsx_to_search_fwp, 'facet_sort_options' ), 10, 2 ); |
|
193 | + remove_filter('facetwp_sort_options', array($lsx_to_search_fwp, 'facet_sort_options'), 10, 2); |
|
194 | 194 | |
195 | - remove_filter( 'facetwp_pager_html', array( $lsx_to_search_fwp, 'facetwp_pager_html' ), 10, 2 ); |
|
196 | - remove_filter( 'facetwp_result_count', array( $lsx_to_search_fwp, 'facetwp_result_count' ), 10, 2 ); |
|
195 | + remove_filter('facetwp_pager_html', array($lsx_to_search_fwp, 'facetwp_pager_html'), 10, 2); |
|
196 | + remove_filter('facetwp_result_count', array($lsx_to_search_fwp, 'facetwp_result_count'), 10, 2); |
|
197 | 197 | |
198 | - remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'destination_facet_html' ), 10, 2 ); |
|
199 | - remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'slide_facet_html' ), 10, 2 ); |
|
200 | - remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'search_facet_html' ), 10, 2 ); |
|
201 | - remove_filter( 'facetwp_load_css', array( $lsx_to_search_fwp, 'facetwp_load_css' ), 10, 1 ); |
|
198 | + remove_filter('facetwp_facet_html', array($lsx_to_search_fwp, 'destination_facet_html'), 10, 2); |
|
199 | + remove_filter('facetwp_facet_html', array($lsx_to_search_fwp, 'slide_facet_html'), 10, 2); |
|
200 | + remove_filter('facetwp_facet_html', array($lsx_to_search_fwp, 'search_facet_html'), 10, 2); |
|
201 | + remove_filter('facetwp_load_css', array($lsx_to_search_fwp, 'facetwp_load_css'), 10, 1); |
|
202 | 202 | |
203 | - if ( class_exists( 'LSX_Currencies' ) ) { |
|
204 | - remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_lsx_currencies' ), 10, 2 ); |
|
203 | + if (class_exists('LSX_Currencies')) { |
|
204 | + remove_filter('facetwp_render_output', array($lsx_to_search_fwp, 'slide_price_lsx_currencies'), 10, 2); |
|
205 | 205 | } else { |
206 | - remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_to_currencies' ), 10, 2 ); |
|
206 | + remove_filter('facetwp_render_output', array($lsx_to_search_fwp, 'slide_price_to_currencies'), 10, 2); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | } |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | public function is_search_enabled() { |
217 | 217 | $search_enabled = false; |
218 | 218 | |
219 | - if ( false === $this->new_options ) { |
|
220 | - if ( isset( $this->options['display'][ $this->search_prefix . '_enable_' . $this->search_core_suffix ] ) && ( ! empty( $this->options ) ) && 'on' == $this->options['display'][ $this->search_prefix . '_enable_' . $this->search_core_suffix ] ) { |
|
219 | + if (false === $this->new_options) { |
|
220 | + if (isset($this->options['display'][$this->search_prefix.'_enable_'.$this->search_core_suffix]) && (!empty($this->options)) && 'on' == $this->options['display'][$this->search_prefix.'_enable_'.$this->search_core_suffix]) { |
|
221 | 221 | $search_enabled = true; |
222 | 222 | } |
223 | 223 | } else { |
224 | 224 | $enable_prefix = $this->search_prefix; |
225 | - if ( ! empty( $this->options ) && isset( $this->options['display'] ) && isset( $this->options['display'][ $enable_prefix . '_enable' ] ) && 'on' === $this->options['display'][ $enable_prefix . '_enable' ] ) { |
|
225 | + if (!empty($this->options) && isset($this->options['display']) && isset($this->options['display'][$enable_prefix.'_enable']) && 'on' === $this->options['display'][$enable_prefix.'_enable']) { |
|
226 | 226 | $search_enabled = true; |
227 | 227 | } |
228 | 228 | } |
@@ -234,44 +234,44 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @return void |
236 | 236 | */ |
237 | - private function set_search_prefix( $new_prefixes = false ) { |
|
238 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
239 | - if ( false !== $new_prefixes ) { |
|
237 | + private function set_search_prefix($new_prefixes = false) { |
|
238 | + $page_for_posts = get_option('page_for_posts'); |
|
239 | + if (false !== $new_prefixes) { |
|
240 | 240 | $this->taxonomies = array(); |
241 | 241 | $this->post_types = array(); |
242 | 242 | } |
243 | 243 | |
244 | - if ( is_search() ) { |
|
245 | - if ( false === $new_prefixes ) { |
|
244 | + if (is_search()) { |
|
245 | + if (false === $new_prefixes) { |
|
246 | 246 | $this->search_core_suffix = 'core'; |
247 | 247 | $this->search_prefix = 'search'; |
248 | 248 | } else { |
249 | 249 | $this->search_core_suffix = 'enable'; |
250 | 250 | $this->search_prefix = 'engine_search'; |
251 | 251 | } |
252 | - } elseif ( is_post_type_archive( $this->post_types ) || is_tax() || is_page( $page_for_posts ) || is_home() || is_category() || is_tag() ) { |
|
253 | - if ( false === $new_prefixes ) { |
|
252 | + } elseif (is_post_type_archive($this->post_types) || is_tax() || is_page($page_for_posts) || is_home() || is_category() || is_tag()) { |
|
253 | + if (false === $new_prefixes) { |
|
254 | 254 | $this->search_core_suffix = 'search'; |
255 | 255 | } else { |
256 | 256 | $this->search_core_suffix = 'enable'; |
257 | 257 | } |
258 | 258 | |
259 | - if ( is_tax() ) { |
|
260 | - $tax = get_query_var( 'taxonomy' ); |
|
261 | - $tax = get_taxonomy( $tax ); |
|
259 | + if (is_tax()) { |
|
260 | + $tax = get_query_var('taxonomy'); |
|
261 | + $tax = get_taxonomy($tax); |
|
262 | 262 | $post_type = $tax->object_type[0]; |
263 | - } else if ( is_page( $page_for_posts ) || is_category() || is_tag() || is_home() ) { |
|
263 | + } else if (is_page($page_for_posts) || is_category() || is_tag() || is_home()) { |
|
264 | 264 | $post_type = 'post'; |
265 | 265 | } else { |
266 | - $post_type = get_query_var( 'post_type' ); |
|
266 | + $post_type = get_query_var('post_type'); |
|
267 | 267 | } |
268 | 268 | |
269 | - if ( false === $new_prefixes ) { |
|
270 | - if ( isset( $this->tabs[ $post_type ] ) ) { |
|
271 | - $this->search_prefix = $this->tabs[ $post_type ] . '_archive'; |
|
269 | + if (false === $new_prefixes) { |
|
270 | + if (isset($this->tabs[$post_type])) { |
|
271 | + $this->search_prefix = $this->tabs[$post_type].'_archive'; |
|
272 | 272 | } |
273 | 273 | } else { |
274 | - $this->search_prefix = $post_type . '_search'; |
|
274 | + $this->search_prefix = $post_type.'_search'; |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public function set_facetwp_vars() { |
283 | 283 | |
284 | - if ( class_exists( 'FacetWP' ) ) { |
|
284 | + if (class_exists('FacetWP')) { |
|
285 | 285 | $facet_data = FWP()->helper->get_facets(); |
286 | 286 | } |
287 | 287 | |
@@ -289,12 +289,12 @@ discard block |
||
289 | 289 | |
290 | 290 | $this->facet_data['search_form'] = array( |
291 | 291 | 'name' => 'search_form', |
292 | - 'label' => esc_html__( 'Search Form', 'lsx-search' ), |
|
292 | + 'label' => esc_html__('Search Form', 'lsx-search'), |
|
293 | 293 | ); |
294 | 294 | |
295 | - if ( ! empty( $facet_data ) && is_array( $facet_data ) ) { |
|
296 | - foreach ( $facet_data as $facet ) { |
|
297 | - $this->facet_data[ $facet['name'] ] = $facet; |
|
295 | + if (!empty($facet_data) && is_array($facet_data)) { |
|
296 | + foreach ($facet_data as $facet) { |
|
297 | + $this->facet_data[$facet['name']] = $facet; |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 | } |
@@ -304,61 +304,61 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function core() { |
306 | 306 | |
307 | - if ( true === $this->search_enabled ) { |
|
308 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 999 ); |
|
307 | + if (true === $this->search_enabled) { |
|
308 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 999); |
|
309 | 309 | |
310 | - add_filter( 'lsx_layout', array( $this, 'lsx_layout' ), 20, 1 ); |
|
311 | - add_filter( 'lsx_layout_selector', array( $this, 'lsx_layout_selector' ), 10, 4 ); |
|
312 | - add_filter( 'lsx_slot_class', array( $this, 'change_slot_column_class' ) ); |
|
313 | - add_action( 'lsx_entry_top', array( $this, 'add_label_to_title' ) ); |
|
314 | - add_filter( 'body_class', array( $this, 'body_class' ), 10 ); |
|
310 | + add_filter('lsx_layout', array($this, 'lsx_layout'), 20, 1); |
|
311 | + add_filter('lsx_layout_selector', array($this, 'lsx_layout_selector'), 10, 4); |
|
312 | + add_filter('lsx_slot_class', array($this, 'change_slot_column_class')); |
|
313 | + add_action('lsx_entry_top', array($this, 'add_label_to_title')); |
|
314 | + add_filter('body_class', array($this, 'body_class'), 10); |
|
315 | 315 | |
316 | - add_filter( 'lsx_blog_customizer_top_of_blog_action', array( $this, 'top_of_blog_action' ), 10, 1 ); |
|
317 | - add_filter( 'lsx_blog_customizer_blog_description_class', array( $this, 'blog_description_class' ), 10, 1 ); |
|
316 | + add_filter('lsx_blog_customizer_top_of_blog_action', array($this, 'top_of_blog_action'), 10, 1); |
|
317 | + add_filter('lsx_blog_customizer_blog_description_class', array($this, 'blog_description_class'), 10, 1); |
|
318 | 318 | |
319 | - if ( class_exists( 'LSX_Videos' ) ) { |
|
319 | + if (class_exists('LSX_Videos')) { |
|
320 | 320 | global $lsx_videos_frontend; |
321 | - remove_action( 'lsx_content_top', array( $lsx_videos_frontend, 'categories_tabs' ), 15 ); |
|
321 | + remove_action('lsx_content_top', array($lsx_videos_frontend, 'categories_tabs'), 15); |
|
322 | 322 | } |
323 | 323 | |
324 | - add_filter( 'lsx_paging_nav_disable', '__return_true' ); |
|
325 | - add_action( 'lsx_content_top', array( $this, 'facet_top_bar' ) ); |
|
326 | - add_action( 'lsx_content_top', array( $this, 'facetwp_tempate_open' ) ); |
|
327 | - add_action( 'lsx_content_bottom', array( $this, 'facetwp_tempate_close' ) ); |
|
328 | - add_action( 'lsx_content_bottom', array( $this, 'facet_bottom_bar' ) ); |
|
324 | + add_filter('lsx_paging_nav_disable', '__return_true'); |
|
325 | + add_action('lsx_content_top', array($this, 'facet_top_bar')); |
|
326 | + add_action('lsx_content_top', array($this, 'facetwp_tempate_open')); |
|
327 | + add_action('lsx_content_bottom', array($this, 'facetwp_tempate_close')); |
|
328 | + add_action('lsx_content_bottom', array($this, 'facet_bottom_bar')); |
|
329 | 329 | |
330 | - if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) && '1c' !== $this->options['display'][ $this->search_prefix . '_layout' ] ) { |
|
331 | - add_filter( 'lsx_sidebar_enable', array( $this, 'lsx_sidebar_enable' ), 10, 1 ); |
|
330 | + if (!empty($this->options['display'][$this->search_prefix.'_layout']) && '1c' !== $this->options['display'][$this->search_prefix.'_layout']) { |
|
331 | + add_filter('lsx_sidebar_enable', array($this, 'lsx_sidebar_enable'), 10, 1); |
|
332 | 332 | } |
333 | 333 | |
334 | - add_action( 'lsx_content_wrap_before', array( $this, 'search_sidebar' ), 150 ); |
|
334 | + add_action('lsx_content_wrap_before', array($this, 'search_sidebar'), 150); |
|
335 | 335 | |
336 | - if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_category() || is_product_tag() ) ) { |
|
337 | - remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description' ); |
|
338 | - remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description' ); |
|
339 | - add_filter( 'woocommerce_show_page_title', '__return_false' ); |
|
336 | + if (class_exists('WooCommerce') && (is_shop() || is_product_category() || is_product_tag())) { |
|
337 | + remove_action('woocommerce_archive_description', 'woocommerce_taxonomy_archive_description'); |
|
338 | + remove_action('woocommerce_archive_description', 'woocommerce_product_archive_description'); |
|
339 | + add_filter('woocommerce_show_page_title', '__return_false'); |
|
340 | 340 | |
341 | - add_filter( 'loop_shop_columns', function() { |
|
341 | + add_filter('loop_shop_columns', function() { |
|
342 | 342 | return 3; |
343 | 343 | } ); |
344 | 344 | |
345 | 345 | // Actions added by LSX theme |
346 | - remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
347 | - add_action( 'lsx_content_wrap_before', array( $this, 'wc_archive_header' ), 140 ); |
|
346 | + remove_action('lsx_content_wrap_before', 'lsx_global_header'); |
|
347 | + add_action('lsx_content_wrap_before', array($this, 'wc_archive_header'), 140); |
|
348 | 348 | |
349 | 349 | // Actions added be LSX theme / woocommerce.php file |
350 | - remove_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
351 | - remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
352 | - remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 ); |
|
353 | - remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 ); |
|
354 | - remove_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
350 | + remove_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
351 | + remove_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
352 | + remove_action('woocommerce_after_shop_loop', 'woocommerce_result_count', 20); |
|
353 | + remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 30); |
|
354 | + remove_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
355 | 355 | |
356 | 356 | // Actions added be LSX theme / woocommerce.php file |
357 | - remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
358 | - remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
359 | - remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
360 | - remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 ); |
|
361 | - remove_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
357 | + remove_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
358 | + remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
359 | + remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
360 | + remove_action('woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30); |
|
361 | + remove_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * @param array $classes The classes. |
370 | 370 | * @return array $classes The classes. |
371 | 371 | */ |
372 | - public function body_class( $classes ) { |
|
372 | + public function body_class($classes) { |
|
373 | 373 | $classes[] = 'lsx-search-enabled'; |
374 | 374 | return $classes; |
375 | 375 | } |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * @param string $action |
381 | 381 | * @return string $action |
382 | 382 | */ |
383 | - public function top_of_blog_action( $action = '' ) { |
|
383 | + public function top_of_blog_action($action = '') { |
|
384 | 384 | $action = 'lsx_content_wrap_before'; |
385 | 385 | return $action; |
386 | 386 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | * @param string $action |
392 | 392 | * @return string $action |
393 | 393 | */ |
394 | - public function blog_description_class( $class = '' ) { |
|
394 | + public function blog_description_class($class = '') { |
|
395 | 395 | $class .= ' col-md-12 search-description'; |
396 | 396 | return $class; |
397 | 397 | } |
@@ -402,13 +402,13 @@ discard block |
||
402 | 402 | * @return void |
403 | 403 | */ |
404 | 404 | public function check_for_results() { |
405 | - if ( true === $this->search_enabled ) { |
|
405 | + if (true === $this->search_enabled) { |
|
406 | 406 | global $wp_query; |
407 | - if ( empty( $wp_query->posts ) ) { |
|
407 | + if (empty($wp_query->posts)) { |
|
408 | 408 | $this->has_posts = false; |
409 | - remove_action( 'lsx_content_top', array( $this, 'facet_top_bar' ) ); |
|
410 | - remove_action( 'lsx_content_bottom', array( $this, 'facet_bottom_bar' ) ); |
|
411 | - remove_action( 'lsx_content_wrap_before', array( $this, 'search_sidebar' ), 150 ); |
|
409 | + remove_action('lsx_content_top', array($this, 'facet_top_bar')); |
|
410 | + remove_action('lsx_content_bottom', array($this, 'facet_bottom_bar')); |
|
411 | + remove_action('lsx_content_wrap_before', array($this, 'search_sidebar'), 150); |
|
412 | 412 | } else { |
413 | 413 | $this->has_posts = true; |
414 | 414 | } |
@@ -418,12 +418,12 @@ discard block |
||
418 | 418 | /** |
419 | 419 | * Filter the post types. |
420 | 420 | */ |
421 | - public function filter_post_types( $query ) { |
|
422 | - if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) { |
|
423 | - if ( ! empty( $this->options ) && ! empty( $this->options['display']['search_enable_core'] ) ) { |
|
424 | - if ( ! empty( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) { |
|
425 | - $post_types = array_keys( $this->options['general']['search_post_types'] ); |
|
426 | - $query->set( 'post_type', $post_types ); |
|
421 | + public function filter_post_types($query) { |
|
422 | + if (!is_admin() && $query->is_main_query() && $query->is_search()) { |
|
423 | + if (!empty($this->options) && !empty($this->options['display']['search_enable_core'])) { |
|
424 | + if (!empty($this->options['general']['search_post_types']) && is_array($this->options['general']['search_post_types'])) { |
|
425 | + $post_types = array_keys($this->options['general']['search_post_types']); |
|
426 | + $query->set('post_type', $post_types); |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | } |
@@ -432,23 +432,23 @@ discard block |
||
432 | 432 | /** |
433 | 433 | * Sets post types with active search options. |
434 | 434 | */ |
435 | - public function register_post_types( $post_types ) { |
|
436 | - $post_types = array( 'post', 'project', 'service', 'team', 'testimonial', 'video', 'product' ); |
|
435 | + public function register_post_types($post_types) { |
|
436 | + $post_types = array('post', 'project', 'service', 'team', 'testimonial', 'video', 'product'); |
|
437 | 437 | return $post_types; |
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
441 | 441 | * Sets taxonomies with active search options. |
442 | 442 | */ |
443 | - public function register_taxonomies( $taxonomies ) { |
|
444 | - $taxonomies = array( 'category', 'post_tag', 'project-group', 'service-group', 'team_role', 'video-category', 'product_cat', 'product_tag' ); |
|
443 | + public function register_taxonomies($taxonomies) { |
|
444 | + $taxonomies = array('category', 'post_tag', 'project-group', 'service-group', 'team_role', 'video-category', 'product_cat', 'product_tag'); |
|
445 | 445 | return $taxonomies; |
446 | 446 | } |
447 | 447 | |
448 | 448 | /** |
449 | 449 | * Sets post types with active search options. |
450 | 450 | */ |
451 | - public function register_post_type_tabs( $post_types_plural ) { |
|
451 | + public function register_post_type_tabs($post_types_plural) { |
|
452 | 452 | $post_types_plural = array( |
453 | 453 | 'post' => 'posts', |
454 | 454 | 'project' => 'projects', |
@@ -465,23 +465,23 @@ discard block |
||
465 | 465 | * Enqueue styles and scripts. |
466 | 466 | */ |
467 | 467 | public function assets() { |
468 | - add_filter( 'lsx_defer_parsing_of_js', array( $this, 'skip_js_defer' ), 10, 4 ); |
|
469 | - wp_enqueue_script( 'touchSwipe', LSX_SEARCH_URL . 'assets/js/vendor/jquery.touchSwipe.min.js', array( 'jquery' ), LSX_SEARCH_VER, true ); |
|
470 | - wp_enqueue_script( 'slideandswipe', LSX_SEARCH_URL . 'assets/js/vendor/jquery.slideandswipe.min.js', array( 'jquery', 'touchSwipe' ), LSX_SEARCH_VER, true ); |
|
471 | - 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 ); |
|
468 | + add_filter('lsx_defer_parsing_of_js', array($this, 'skip_js_defer'), 10, 4); |
|
469 | + wp_enqueue_script('touchSwipe', LSX_SEARCH_URL.'assets/js/vendor/jquery.touchSwipe.min.js', array('jquery'), LSX_SEARCH_VER, true); |
|
470 | + wp_enqueue_script('slideandswipe', LSX_SEARCH_URL.'assets/js/vendor/jquery.slideandswipe.min.js', array('jquery', 'touchSwipe'), LSX_SEARCH_VER, true); |
|
471 | + wp_enqueue_script('lsx-search', LSX_SEARCH_URL.'assets/js/src/lsx-search.js', array('jquery', 'touchSwipe', 'slideandswipe', 'jquery-ui-datepicker'), LSX_SEARCH_VER, true); |
|
472 | 472 | |
473 | - $params = apply_filters( 'lsx_search_js_params', array( |
|
474 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
473 | + $params = apply_filters('lsx_search_js_params', array( |
|
474 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
475 | 475 | )); |
476 | 476 | |
477 | - wp_localize_script( 'lsx-search', 'lsx_customizer_params', $params ); |
|
477 | + wp_localize_script('lsx-search', 'lsx_customizer_params', $params); |
|
478 | 478 | |
479 | - wp_enqueue_style( 'lsx-search', LSX_SEARCH_URL . 'assets/css/lsx-search.css', array(), LSX_SEARCH_VER ); |
|
480 | - wp_style_add_data( 'lsx-search', 'rtl', 'replace' ); |
|
479 | + wp_enqueue_style('lsx-search', LSX_SEARCH_URL.'assets/css/lsx-search.css', array(), LSX_SEARCH_VER); |
|
480 | + wp_style_add_data('lsx-search', 'rtl', 'replace'); |
|
481 | 481 | |
482 | - if ( true === $this->new_options ) { |
|
483 | - wp_deregister_style( 'lsx_to_search' ); |
|
484 | - wp_deregister_script( 'lsx_to_search' ); |
|
482 | + if (true === $this->new_options) { |
|
483 | + wp_deregister_style('lsx_to_search'); |
|
484 | + wp_deregister_script('lsx_to_search'); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | |
@@ -494,8 +494,8 @@ discard block |
||
494 | 494 | * @param string $href |
495 | 495 | * @return boolean |
496 | 496 | */ |
497 | - public function skip_js_defer( $should_skip, $tag, $handle, $href ) { |
|
498 | - if ( ! is_admin() && ( false !== stripos( $href, 'lsx-search.min.js' ) || false !== stripos( $href, 'lsx-search.js' ) ) ) { |
|
497 | + public function skip_js_defer($should_skip, $tag, $handle, $href) { |
|
498 | + if (!is_admin() && (false !== stripos($href, 'lsx-search.min.js') || false !== stripos($href, 'lsx-search.js'))) { |
|
499 | 499 | $should_skip = true; |
500 | 500 | } |
501 | 501 | return $should_skip; |
@@ -507,10 +507,10 @@ discard block |
||
507 | 507 | * @param $template |
508 | 508 | * @return $template |
509 | 509 | */ |
510 | - public function search_template_include( $template ) { |
|
511 | - if ( is_main_query() && is_search() ) { |
|
512 | - if ( file_exists( LSX_SEARCH_PATH . 'templates/search.php' ) ) { |
|
513 | - $template = LSX_SEARCH_PATH . 'templates/search.php'; |
|
510 | + public function search_template_include($template) { |
|
511 | + if (is_main_query() && is_search()) { |
|
512 | + if (file_exists(LSX_SEARCH_PATH.'templates/search.php')) { |
|
513 | + $template = LSX_SEARCH_PATH.'templates/search.php'; |
|
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
@@ -523,9 +523,9 @@ discard block |
||
523 | 523 | * @param [type] $query |
524 | 524 | * @return void |
525 | 525 | */ |
526 | - public function ignore_sticky_search( $query ) { |
|
527 | - if ( $query->is_main_query() && is_home() ) { |
|
528 | - $query->set( 'ignore_sticky_posts', true ); |
|
526 | + public function ignore_sticky_search($query) { |
|
527 | + if ($query->is_main_query() && is_home()) { |
|
528 | + $query->set('ignore_sticky_posts', true); |
|
529 | 529 | } |
530 | 530 | } |
531 | 531 | |
@@ -533,44 +533,44 @@ discard block |
||
533 | 533 | * Rewrite the search URL |
534 | 534 | */ |
535 | 535 | public function pretty_search_redirect() { |
536 | - global $wp_rewrite,$wp_query; |
|
536 | + global $wp_rewrite, $wp_query; |
|
537 | 537 | |
538 | - if ( ! isset( $wp_rewrite ) || ! is_object( $wp_rewrite ) || ! $wp_rewrite->using_permalinks() ) { |
|
538 | + if (!isset($wp_rewrite) || !is_object($wp_rewrite) || !$wp_rewrite->using_permalinks()) { |
|
539 | 539 | return; |
540 | 540 | } |
541 | 541 | |
542 | 542 | $search_base = $wp_rewrite->search_base; |
543 | 543 | |
544 | - if ( is_search() && ! is_admin() && strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) === false ) { |
|
545 | - $search_query = get_query_var( 's' ); |
|
544 | + if (is_search() && !is_admin() && strpos($_SERVER['REQUEST_URI'], "/{$search_base}/") === false) { |
|
545 | + $search_query = get_query_var('s'); |
|
546 | 546 | $engine = ''; |
547 | 547 | |
548 | 548 | // If the search was triggered by a supplemental engine. |
549 | - if ( isset( $_GET['engine'] ) && 'default' !== $_GET['engine'] ) { |
|
549 | + if (isset($_GET['engine']) && 'default' !== $_GET['engine']) { |
|
550 | 550 | $engine = $_GET['engine']; |
551 | - set_query_var( 'engine', $engine ); |
|
552 | - $engine = array_search( $engine, $this->post_type_slugs, true ) . '/'; |
|
551 | + set_query_var('engine', $engine); |
|
552 | + $engine = array_search($engine, $this->post_type_slugs, true).'/'; |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | $get_array = $_GET; |
556 | 556 | |
557 | - if ( is_array( $get_array ) && ! empty( $get_array ) ) { |
|
557 | + if (is_array($get_array) && !empty($get_array)) { |
|
558 | 558 | $vars_to_maintain = array(); |
559 | 559 | |
560 | - foreach ( $get_array as $ga_key => $ga_value ) { |
|
561 | - if ( false !== strpos( $ga_key, 'fwp_' ) ) { |
|
562 | - $vars_to_maintain[] = $ga_key . '=' . $ga_value; |
|
560 | + foreach ($get_array as $ga_key => $ga_value) { |
|
561 | + if (false !== strpos($ga_key, 'fwp_')) { |
|
562 | + $vars_to_maintain[] = $ga_key.'='.$ga_value; |
|
563 | 563 | } |
564 | 564 | } |
565 | 565 | } |
566 | 566 | |
567 | - $redirect_url = home_url( "/{$search_base}/" . $engine . urlencode( $search_query ) ); |
|
567 | + $redirect_url = home_url("/{$search_base}/".$engine.urlencode($search_query)); |
|
568 | 568 | |
569 | - if ( ! empty( $vars_to_maintain ) ) { |
|
570 | - $redirect_url .= '?' . implode( '&', $vars_to_maintain ); |
|
569 | + if (!empty($vars_to_maintain)) { |
|
570 | + $redirect_url .= '?'.implode('&', $vars_to_maintain); |
|
571 | 571 | } |
572 | 572 | |
573 | - wp_redirect( $redirect_url ); |
|
573 | + wp_redirect($redirect_url); |
|
574 | 574 | exit(); |
575 | 575 | } |
576 | 576 | } |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | /** |
579 | 579 | * Parse the Query and trigger a search |
580 | 580 | */ |
581 | - public function pretty_search_parse_query( $query ) { |
|
581 | + public function pretty_search_parse_query($query) { |
|
582 | 582 | $this->post_type_slugs = array( |
583 | 583 | 'post' => 'posts', |
584 | 584 | 'project' => 'projects', |
@@ -588,26 +588,26 @@ discard block |
||
588 | 588 | 'video' => 'videos', |
589 | 589 | 'product' => 'products', // WooCommerce |
590 | 590 | ); |
591 | - if ( $query->is_search() && ! is_admin() && $query->is_main_query() ) { |
|
592 | - $search_query = $query->get( 's' ); |
|
593 | - $keyword_test = explode( '/', $search_query ); |
|
591 | + if ($query->is_search() && !is_admin() && $query->is_main_query()) { |
|
592 | + $search_query = $query->get('s'); |
|
593 | + $keyword_test = explode('/', $search_query); |
|
594 | 594 | |
595 | - $index = array_search( $keyword_test[0], $this->post_type_slugs, true ); |
|
596 | - if ( false !== $index ) { |
|
597 | - $engine = $this->post_type_slugs[ $index ]; |
|
595 | + $index = array_search($keyword_test[0], $this->post_type_slugs, true); |
|
596 | + if (false !== $index) { |
|
597 | + $engine = $this->post_type_slugs[$index]; |
|
598 | 598 | |
599 | - $query->set( 'post_type', $engine ); |
|
600 | - $query->set( 'engine', $engine ); |
|
599 | + $query->set('post_type', $engine); |
|
600 | + $query->set('engine', $engine); |
|
601 | 601 | |
602 | - if ( count( $keyword_test ) > 1 ) { |
|
603 | - $query->set( 's', $keyword_test[1] ); |
|
604 | - } elseif ( post_type_exists( $engine ) ) { |
|
605 | - $query->set( 's', '' ); |
|
602 | + if (count($keyword_test) > 1) { |
|
603 | + $query->set('s', $keyword_test[1]); |
|
604 | + } elseif (post_type_exists($engine)) { |
|
605 | + $query->set('s', ''); |
|
606 | 606 | } |
607 | 607 | } else { |
608 | - if ( isset( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) { |
|
609 | - $post_types = array_keys( $this->options['general']['search_post_types'] ); |
|
610 | - $query->set( 'post_type', $post_types ); |
|
608 | + if (isset($this->options['general']['search_post_types']) && is_array($this->options['general']['search_post_types'])) { |
|
609 | + $post_types = array_keys($this->options['general']['search_post_types']); |
|
610 | + $query->set('post_type', $post_types); |
|
611 | 611 | } |
612 | 612 | } |
613 | 613 | } |
@@ -621,18 +621,18 @@ discard block |
||
621 | 621 | * @return url |
622 | 622 | */ |
623 | 623 | public function change_json_ld_search_url() { |
624 | - return trailingslashit( home_url() ) . 'search/{search_term_string}'; |
|
624 | + return trailingslashit(home_url()).'search/{search_term_string}'; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | /** |
628 | 628 | * A filter to set the layout to 2 column. |
629 | 629 | */ |
630 | - public function lsx_layout( $layout ) { |
|
631 | - if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) { |
|
632 | - if ( false === $this->has_posts ) { |
|
630 | + public function lsx_layout($layout) { |
|
631 | + if (!empty($this->options['display'][$this->search_prefix.'_layout'])) { |
|
632 | + if (false === $this->has_posts) { |
|
633 | 633 | $layout = '1c'; |
634 | 634 | } else { |
635 | - $layout = $this->options['display'][ $this->search_prefix . '_layout' ]; |
|
635 | + $layout = $this->options['display'][$this->search_prefix.'_layout']; |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | return $layout; |
@@ -642,23 +642,23 @@ discard block |
||
642 | 642 | * Outputs the Search Title Facet |
643 | 643 | */ |
644 | 644 | public function search_sidebar_top() { |
645 | - 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 ) ) { |
|
645 | + 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)) { |
|
646 | 646 | |
647 | - if ( ! is_search() ) { |
|
647 | + if (!is_search()) { |
|
648 | 648 | |
649 | - foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) { |
|
649 | + foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) { |
|
650 | 650 | |
651 | - if ( isset( $this->facet_data[ $facet ] ) && 'search' === $this->facet_data[ $facet ]['type'] ) { |
|
652 | - echo wp_kses_post( '<div class="row">' ); |
|
653 | - $this->display_facet_default( $facet ); |
|
654 | - echo wp_kses_post( '</div>' ); |
|
655 | - unset( $this->options['display'][ $this->search_prefix . '_facets' ][ $facet ] ); |
|
651 | + if (isset($this->facet_data[$facet]) && 'search' === $this->facet_data[$facet]['type']) { |
|
652 | + echo wp_kses_post('<div class="row">'); |
|
653 | + $this->display_facet_default($facet); |
|
654 | + echo wp_kses_post('</div>'); |
|
655 | + unset($this->options['display'][$this->search_prefix.'_facets'][$facet]); |
|
656 | 656 | } |
657 | 657 | } |
658 | 658 | } else { |
659 | - echo wp_kses_post( '<div class="row">' ); |
|
659 | + echo wp_kses_post('<div class="row">'); |
|
660 | 660 | $this->display_facet_search(); |
661 | - echo wp_kses_post( '</div>' ); |
|
661 | + echo wp_kses_post('</div>'); |
|
662 | 662 | } |
663 | 663 | } |
664 | 664 | } |
@@ -670,13 +670,13 @@ discard block |
||
670 | 670 | * |
671 | 671 | * @return string |
672 | 672 | */ |
673 | - public function search_facet_html( $output, $params ) { |
|
674 | - if ( 'search' == $params['facet']['type'] ) { |
|
673 | + public function search_facet_html($output, $params) { |
|
674 | + if ('search' == $params['facet']['type']) { |
|
675 | 675 | |
676 | 676 | $value = (array) $params['selected_values']; |
677 | - $value = empty( $value ) ? '' : stripslashes( $value[0] ); |
|
678 | - $placeholder = isset( $params['facet']['placeholder'] ) ? $params['facet']['placeholder'] : __( 'Search...', 'lsx-search' ); |
|
679 | - $placeholder = facetwp_i18n( $placeholder ); |
|
677 | + $value = empty($value) ? '' : stripslashes($value[0]); |
|
678 | + $placeholder = isset($params['facet']['placeholder']) ? $params['facet']['placeholder'] : __('Search...', 'lsx-search'); |
|
679 | + $placeholder = facetwp_i18n($placeholder); |
|
680 | 680 | |
681 | 681 | ob_start(); |
682 | 682 | ?> |
@@ -684,11 +684,11 @@ discard block |
||
684 | 684 | <div class="search-form lsx-search-form 2"> |
685 | 685 | <div class="input-group facetwp-search-wrap"> |
686 | 686 | <div class="field"> |
687 | - <input class="facetwp-search search-field form-control" type="text" placeholder="<?php echo esc_attr( $placeholder ); ?>" autocomplete="off" value="<?php echo esc_attr( $value ); ?>"> |
|
687 | + <input class="facetwp-search search-field form-control" type="text" placeholder="<?php echo esc_attr($placeholder); ?>" autocomplete="off" value="<?php echo esc_attr($value); ?>"> |
|
688 | 688 | </div> |
689 | 689 | |
690 | 690 | <div class="field submit-button"> |
691 | - <button class="search-submit btn facetwp-btn" type="submit"><?php esc_html_e( 'Search', 'lsx-search' ); ?></button> |
|
691 | + <button class="search-submit btn facetwp-btn" type="submit"><?php esc_html_e('Search', 'lsx-search'); ?></button> |
|
692 | 692 | </div> |
693 | 693 | </div> |
694 | 694 | </div> |
@@ -702,23 +702,23 @@ discard block |
||
702 | 702 | /** |
703 | 703 | * Change the primary and secondary column classes. |
704 | 704 | */ |
705 | - public function lsx_layout_selector( $return_class, $class, $layout, $size ) { |
|
706 | - if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) { |
|
705 | + public function lsx_layout_selector($return_class, $class, $layout, $size) { |
|
706 | + if (!empty($this->options['display'][$this->search_prefix.'_layout'])) { |
|
707 | 707 | |
708 | - if ( '2cl' === $layout || '2cr' === $layout ) { |
|
708 | + if ('2cl' === $layout || '2cr' === $layout) { |
|
709 | 709 | $main_class = 'col-sm-8 col-md-9'; |
710 | 710 | $sidebar_class = 'col-sm-4 col-md-3'; |
711 | 711 | |
712 | - if ( '2cl' === $layout ) { |
|
712 | + if ('2cl' === $layout) { |
|
713 | 713 | $main_class .= ' col-sm-pull-4 col-md-pull-3'; |
714 | 714 | $sidebar_class .= ' col-sm-push-8 col-md-push-9'; |
715 | 715 | } |
716 | 716 | |
717 | - if ( 'main' === $class ) { |
|
717 | + if ('main' === $class) { |
|
718 | 718 | return $main_class; |
719 | 719 | } |
720 | 720 | |
721 | - if ( 'sidebar' === $class ) { |
|
721 | + if ('sidebar' === $class) { |
|
722 | 722 | return $sidebar_class; |
723 | 723 | } |
724 | 724 | } |
@@ -733,14 +733,14 @@ discard block |
||
733 | 733 | * @return void |
734 | 734 | */ |
735 | 735 | public function display_alphabet_facet() { |
736 | - if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) { |
|
737 | - $az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ]; |
|
736 | + if (isset($this->options['display'][$this->search_prefix.'_az_pagination'])) { |
|
737 | + $az_pagination = $this->options['display'][$this->search_prefix.'_az_pagination']; |
|
738 | 738 | } else { |
739 | 739 | $az_pagination = false; |
740 | 740 | } |
741 | - $az_pagination = apply_filters( 'lsx_search_top_az_pagination', $az_pagination ); |
|
742 | - if ( false !== $az_pagination && '' !== $az_pagination ) { |
|
743 | - echo do_shortcode( '[facetwp facet="' . $az_pagination . '"]' ); |
|
741 | + $az_pagination = apply_filters('lsx_search_top_az_pagination', $az_pagination); |
|
742 | + if (false !== $az_pagination && '' !== $az_pagination) { |
|
743 | + echo do_shortcode('[facetwp facet="'.$az_pagination.'"]'); |
|
744 | 744 | } |
745 | 745 | } |
746 | 746 | |
@@ -748,44 +748,44 @@ discard block |
||
748 | 748 | * Outputs top. |
749 | 749 | */ |
750 | 750 | public function facet_top_bar() { |
751 | - if ( true === apply_filters( 'lsx_search_hide_top_bar', false ) ) { |
|
751 | + if (true === apply_filters('lsx_search_hide_top_bar', false)) { |
|
752 | 752 | return; |
753 | 753 | } |
754 | 754 | |
755 | 755 | $show_pagination = true; |
756 | 756 | $pagination_visible = false; |
757 | - $show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] ); |
|
758 | - $show_sort_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_sorting' ] ); |
|
759 | - |
|
760 | - $show_pagination = apply_filters( 'lsx_search_top_show_pagination', $show_pagination ); |
|
761 | - $pagination_visible = apply_filters( 'lsx_search_top_pagination_visible', $pagination_visible ); |
|
762 | - $show_per_page_combo = apply_filters( 'lsx_search_top_show_per_page_combo', $show_per_page_combo ); |
|
763 | - $show_sort_combo = apply_filters( 'lsx_search_top_show_sort_combo', $show_sort_combo ); |
|
764 | - $facet_row_classes = apply_filters( 'lsx_search_top_facetwp_row_classes', '' ); |
|
757 | + $show_per_page_combo = empty($this->options['display'][$this->search_prefix.'_disable_per_page']); |
|
758 | + $show_sort_combo = empty($this->options['display'][$this->search_prefix.'_disable_sorting']); |
|
759 | + |
|
760 | + $show_pagination = apply_filters('lsx_search_top_show_pagination', $show_pagination); |
|
761 | + $pagination_visible = apply_filters('lsx_search_top_pagination_visible', $pagination_visible); |
|
762 | + $show_per_page_combo = apply_filters('lsx_search_top_show_per_page_combo', $show_per_page_combo); |
|
763 | + $show_sort_combo = apply_filters('lsx_search_top_show_sort_combo', $show_sort_combo); |
|
764 | + $facet_row_classes = apply_filters('lsx_search_top_facetwp_row_classes', ''); |
|
765 | 765 | ?> |
766 | 766 | <div id="facetwp-top"> |
767 | - <?php if ( $show_sort_combo || ( $show_pagination && $show_per_page_combo ) ) { ?> |
|
768 | - <div class="row facetwp-top-row-1 hidden-xs <?php echo esc_attr( $facet_row_classes ); ?>"> |
|
767 | + <?php if ($show_sort_combo || ($show_pagination && $show_per_page_combo)) { ?> |
|
768 | + <div class="row facetwp-top-row-1 hidden-xs <?php echo esc_attr($facet_row_classes); ?>"> |
|
769 | 769 | <div class="col-xs-12"> |
770 | 770 | |
771 | - <?php if ( ! empty( $this->options['display'][ $this->search_prefix . '_display_result_count' ] ) && false === apply_filters( 'lsx_search_hide_result_count', false ) ) { ?> |
|
771 | + <?php if (!empty($this->options['display'][$this->search_prefix.'_display_result_count']) && false === apply_filters('lsx_search_hide_result_count', false)) { ?> |
|
772 | 772 | <div class="row"> |
773 | 773 | <div class="col-md-12 facetwp-item facetwp-results"> |
774 | - <h3 class="lsx-search-title lsx-search-title-results"><?php esc_html_e( 'Results', 'lsx-search' ); ?> <?php echo '(' . do_shortcode( '[facetwp counts="true"]' ) . ') '; ?> |
|
775 | - <?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' ] ) { ?> |
|
776 | - <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> |
|
774 | + <h3 class="lsx-search-title lsx-search-title-results"><?php esc_html_e('Results', 'lsx-search'); ?> <?php echo '('.do_shortcode('[facetwp counts="true"]').') '; ?> |
|
775 | + <?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']) { ?> |
|
776 | + <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> |
|
777 | 777 | <?php } ?> |
778 | 778 | </h3> |
779 | 779 | </div> |
780 | 780 | </div> |
781 | 781 | <?php } ?> |
782 | 782 | |
783 | - <?php do_action( 'lsx_search_facetwp_top_row' ); ?> |
|
783 | + <?php do_action('lsx_search_facetwp_top_row'); ?> |
|
784 | 784 | |
785 | 785 | <?php $this->display_alphabet_facet(); ?> |
786 | 786 | |
787 | - <?php if ( $show_sort_combo ) { ?> |
|
788 | - <?php echo do_shortcode( '[facetwp sort="true"]' ); ?> |
|
787 | + <?php if ($show_sort_combo) { ?> |
|
788 | + <?php echo do_shortcode('[facetwp sort="true"]'); ?> |
|
789 | 789 | <?php } ?> |
790 | 790 | |
791 | 791 | </div> |
@@ -799,30 +799,30 @@ discard block |
||
799 | 799 | * Outputs bottom. |
800 | 800 | */ |
801 | 801 | public function facet_bottom_bar() { |
802 | - if ( true === apply_filters( 'lsx_search_hide_bottom_bar', false ) ) { |
|
802 | + if (true === apply_filters('lsx_search_hide_bottom_bar', false)) { |
|
803 | 803 | return; |
804 | 804 | } |
805 | 805 | $show_pagination = true; |
806 | 806 | $pagination_visible = false; |
807 | - if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) { |
|
808 | - $az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ]; |
|
807 | + if (isset($this->options['display'][$this->search_prefix.'_az_pagination'])) { |
|
808 | + $az_pagination = $this->options['display'][$this->search_prefix.'_az_pagination']; |
|
809 | 809 | } else { |
810 | 810 | $az_pagination = false; |
811 | 811 | } |
812 | 812 | |
813 | - $show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] ); |
|
814 | - $show_sort_combo = empty( $this->options['display'][ $this->search_prefix . '_search_disable_sorting' ] ); |
|
813 | + $show_per_page_combo = empty($this->options['display'][$this->search_prefix.'_disable_per_page']); |
|
814 | + $show_sort_combo = empty($this->options['display'][$this->search_prefix.'_search_disable_sorting']); |
|
815 | 815 | |
816 | - $show_pagination = apply_filters( 'lsx_search_bottom_show_pagination', $show_pagination ); |
|
817 | - $pagination_visible = apply_filters( 'lsx_search_bottom_pagination_visible', $pagination_visible ); |
|
818 | - $show_per_page_combo = apply_filters( 'lsx_search_bottom_show_per_page_combo', $show_per_page_combo ); |
|
819 | - $show_sort_combo = apply_filters( 'lsx_search_bottom_show_sort_combo', $show_sort_combo ); |
|
816 | + $show_pagination = apply_filters('lsx_search_bottom_show_pagination', $show_pagination); |
|
817 | + $pagination_visible = apply_filters('lsx_search_bottom_pagination_visible', $pagination_visible); |
|
818 | + $show_per_page_combo = apply_filters('lsx_search_bottom_show_per_page_combo', $show_per_page_combo); |
|
819 | + $show_sort_combo = apply_filters('lsx_search_bottom_show_sort_combo', $show_sort_combo); |
|
820 | 820 | |
821 | - if ( $show_pagination || ! empty( $az_pagination ) ) { ?> |
|
821 | + if ($show_pagination || !empty($az_pagination)) { ?> |
|
822 | 822 | <div id="facetwp-bottom"> |
823 | 823 | <div class="row facetwp-bottom-row-1"> |
824 | 824 | <div class="col-xs-12"> |
825 | - <?php do_action( 'lsx_search_facetwp_bottom_row' ); ?> |
|
825 | + <?php do_action('lsx_search_facetwp_bottom_row'); ?> |
|
826 | 826 | |
827 | 827 | <?php //if ( $show_sort_combo ) { ?> |
828 | 828 | <?php //echo do_shortcode( '[facetwp sort="true"]' ); ?> |
@@ -833,16 +833,16 @@ discard block |
||
833 | 833 | <?php //} ?> |
834 | 834 | |
835 | 835 | <?php |
836 | - if ( $show_pagination ) { |
|
837 | - $output_pagination = do_shortcode( '[facetwp pager="true"]' ); |
|
838 | - if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) { |
|
839 | - foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) { |
|
840 | - if ( isset( $this->facet_data[ $facet ] ) && in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) { |
|
841 | - $output_pagination = do_shortcode( '[facetwp facet="pager_"]' ); |
|
836 | + if ($show_pagination) { |
|
837 | + $output_pagination = do_shortcode('[facetwp pager="true"]'); |
|
838 | + if (!empty($this->options['display'][$this->search_prefix.'_facets']) && is_array($this->options['display'][$this->search_prefix.'_facets'])) { |
|
839 | + foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) { |
|
840 | + if (isset($this->facet_data[$facet]) && in_array($this->facet_data[$facet]['type'], array('pager'))) { |
|
841 | + $output_pagination = do_shortcode('[facetwp facet="pager_"]'); |
|
842 | 842 | } |
843 | 843 | } |
844 | 844 | } |
845 | - echo wp_kses_post( $output_pagination ); |
|
845 | + echo wp_kses_post($output_pagination); |
|
846 | 846 | ?> |
847 | 847 | <?php } ?> |
848 | 848 | </div> |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | /** |
877 | 877 | * Disables default sidebar. |
878 | 878 | */ |
879 | - public function lsx_sidebar_enable( $sidebar_enabled ) { |
|
879 | + public function lsx_sidebar_enable($sidebar_enabled) { |
|
880 | 880 | $sidebar_enabled = false; |
881 | 881 | return $sidebar_enabled; |
882 | 882 | } |
@@ -886,19 +886,19 @@ discard block |
||
886 | 886 | */ |
887 | 887 | public function search_sidebar() { |
888 | 888 | |
889 | - $this->options = apply_filters( 'lsx_search_sidebar_options', $this->options ); |
|
889 | + $this->options = apply_filters('lsx_search_sidebar_options', $this->options); |
|
890 | 890 | ?> |
891 | - <?php do_action( 'lsx_search_sidebar_before' ); ?> |
|
891 | + <?php do_action('lsx_search_sidebar_before'); ?> |
|
892 | 892 | |
893 | - <div id="secondary" class="facetwp-sidebar widget-area <?php echo esc_attr( lsx_sidebar_class() ); ?>" role="complementary"> |
|
893 | + <div id="secondary" class="facetwp-sidebar widget-area <?php echo esc_attr(lsx_sidebar_class()); ?>" role="complementary"> |
|
894 | 894 | |
895 | - <?php do_action( 'lsx_search_sidebar_top' ); ?> |
|
895 | + <?php do_action('lsx_search_sidebar_top'); ?> |
|
896 | 896 | |
897 | - <?php if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) { ?> |
|
897 | + <?php if (!empty($this->options['display'][$this->search_prefix.'_facets']) && is_array($this->options['display'][$this->search_prefix.'_facets'])) { ?> |
|
898 | 898 | <div class="row facetwp-row lsx-search-filer-area"> |
899 | - <h3 class="facetwp-filter-title"><?php echo esc_html_e( 'Refine by', 'lsx-search' ); ?></h3> |
|
899 | + <h3 class="facetwp-filter-title"><?php echo esc_html_e('Refine by', 'lsx-search'); ?></h3> |
|
900 | 900 | <div class="col-xs-12 facetwp-item facetwp-filters-button hidden-sm hidden-md hidden-lg"> |
901 | - <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> |
|
901 | + <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> |
|
902 | 902 | </div> |
903 | 903 | |
904 | 904 | <div class="ssm-overlay ssm-toggle-nav" rel="lsx-search-filters"></div> |
@@ -906,16 +906,16 @@ discard block |
||
906 | 906 | <div class="col-xs-12 facetwp-item-wrap facetwp-filters-wrap" id="lsx-search-filters"> |
907 | 907 | <div class="row hidden-sm hidden-md hidden-lg ssm-row-margin-bottom"> |
908 | 908 | <div class="col-xs-12 facetwp-item facetwp-filters-button"> |
909 | - <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> |
|
909 | + <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> |
|
910 | 910 | </div> |
911 | 911 | </div> |
912 | 912 | |
913 | 913 | <div class="row"> |
914 | 914 | <?php |
915 | 915 | // Slider. |
916 | - foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) { |
|
917 | - if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'alpha', 'search', 'pager' ) ) ) { |
|
918 | - $this->display_facet_default( $facet ); |
|
916 | + foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) { |
|
917 | + if (isset($this->facet_data[$facet]) && !in_array($this->facet_data[$facet]['type'], array('alpha', 'search', 'pager'))) { |
|
918 | + $this->display_facet_default($facet); |
|
919 | 919 | } |
920 | 920 | } |
921 | 921 | ?> |
@@ -923,17 +923,17 @@ discard block |
||
923 | 923 | |
924 | 924 | <div class="row hidden-sm hidden-md hidden-lg ssm-row-margin-top"> |
925 | 925 | <div class="col-xs-12 facetwp-item facetwp-filters-button"> |
926 | - <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> |
|
926 | + <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> |
|
927 | 927 | </div> |
928 | 928 | </div> |
929 | 929 | </div> |
930 | 930 | </div> |
931 | 931 | <?php } ?> |
932 | 932 | |
933 | - <?php do_action( 'lsx_search_sidebar_bottom' ); ?> |
|
933 | + <?php do_action('lsx_search_sidebar_bottom'); ?> |
|
934 | 934 | </div> |
935 | 935 | |
936 | - <?php do_action( 'lsx_search_sidebar_after' ); ?> |
|
936 | + <?php do_action('lsx_search_sidebar_after'); ?> |
|
937 | 937 | <?php |
938 | 938 | } |
939 | 939 | |
@@ -946,9 +946,9 @@ discard block |
||
946 | 946 | |
947 | 947 | $pager_facet_off = false; |
948 | 948 | |
949 | - if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) { |
|
950 | - foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) { |
|
951 | - if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) { |
|
949 | + if (!empty($this->options['display'][$this->search_prefix.'_facets']) && is_array($this->options['display'][$this->search_prefix.'_facets'])) { |
|
950 | + foreach ($this->options['display'][$this->search_prefix.'_facets'] as $facet => $facet_useless) { |
|
951 | + if (isset($this->facet_data[$facet]) && !in_array($this->facet_data[$facet]['type'], array('pager'))) { |
|
952 | 952 | $pager_facet_off = true; |
953 | 953 | } |
954 | 954 | } |
@@ -962,9 +962,9 @@ discard block |
||
962 | 962 | */ |
963 | 963 | public function wc_archive_header() { |
964 | 964 | $default_size = 'sm'; |
965 | - $size = apply_filters( 'lsx_bootstrap_column_size', $default_size ); |
|
965 | + $size = apply_filters('lsx_bootstrap_column_size', $default_size); |
|
966 | 966 | ?> |
967 | - <div class="archive-header-wrapper banner-woocommerce col-<?php echo esc_attr( $size ); ?>-12"> |
|
967 | + <div class="archive-header-wrapper banner-woocommerce col-<?php echo esc_attr($size); ?>-12"> |
|
968 | 968 | <?php lsx_global_header_inner_bottom(); ?> |
969 | 969 | <header class="archive-header"> |
970 | 970 | <h1 class="archive-title"><?php woocommerce_page_title(); ?></h1> |
@@ -982,11 +982,11 @@ discard block |
||
982 | 982 | <form class="search-form lsx-search-form" action="/" method="get"> |
983 | 983 | <div class="input-group"> |
984 | 984 | <div class="field"> |
985 | - <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() ?>"> |
|
985 | + <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() ?>"> |
|
986 | 986 | </div> |
987 | 987 | |
988 | 988 | <div class="field submit-button"> |
989 | - <button class="search-submit btn" type="submit"><?php esc_html_e( 'Search', 'lsx-search' ); ?></button> |
|
989 | + <button class="search-submit btn" type="submit"><?php esc_html_e('Search', 'lsx-search'); ?></button> |
|
990 | 990 | </div> |
991 | 991 | </div> |
992 | 992 | </form> |
@@ -997,26 +997,26 @@ discard block |
||
997 | 997 | /** |
998 | 998 | * Display facet default. |
999 | 999 | */ |
1000 | - public function display_facet_default( $facet ) { |
|
1000 | + public function display_facet_default($facet) { |
|
1001 | 1001 | |
1002 | - $show_collapse = ! isset( $this->options['display'][$this->search_prefix . '_collapse'] ) || 'on' !== $this->options['display'][$this->search_prefix . '_collapse']; |
|
1002 | + $show_collapse = !isset($this->options['display'][$this->search_prefix.'_collapse']) || 'on' !== $this->options['display'][$this->search_prefix.'_collapse']; |
|
1003 | 1003 | $col_class = ''; |
1004 | 1004 | |
1005 | - if ( 'search' === $this->facet_data[ $facet ]['type'] ) : ?> |
|
1006 | - <?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?> |
|
1005 | + if ('search' === $this->facet_data[$facet]['type']) : ?> |
|
1006 | + <?php echo do_shortcode('[facetwp facet="'.$facet.'"]'); ?> |
|
1007 | 1007 | <?php else : ?> |
1008 | - <div class="col-xs-12 facetwp-item parent-facetwp-facet-<?php echo esc_html( $facet ); ?> <?php echo esc_attr( $col_class ); ?>"> |
|
1009 | - <?php if ( ! $show_collapse ) { ?> |
|
1008 | + <div class="col-xs-12 facetwp-item parent-facetwp-facet-<?php echo esc_html($facet); ?> <?php echo esc_attr($col_class); ?>"> |
|
1009 | + <?php if (!$show_collapse) { ?> |
|
1010 | 1010 | <div class="facetwp-collapsed"> |
1011 | - <h3 class="lsx-search-title"><?php echo wp_kses_post( $this->facet_data[ $facet ]['label'] ); ?></h3> |
|
1012 | - <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> |
|
1011 | + <h3 class="lsx-search-title"><?php echo wp_kses_post($this->facet_data[$facet]['label']); ?></h3> |
|
1012 | + <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> |
|
1013 | 1013 | </div> |
1014 | - <div id="collapse-<?php echo esc_html( $facet ); ?>" class="collapse"> |
|
1015 | - <?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?> |
|
1014 | + <div id="collapse-<?php echo esc_html($facet); ?>" class="collapse"> |
|
1015 | + <?php echo do_shortcode('[facetwp facet="'.$facet.'"]'); ?> |
|
1016 | 1016 | </div> |
1017 | 1017 | <?php } else { ?> |
1018 | - <h3 class="lsx-search-title"><?php echo wp_kses_post( $this->facet_data[ $facet ]['label'] ); ?></h3> |
|
1019 | - <?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?> |
|
1018 | + <h3 class="lsx-search-title"><?php echo wp_kses_post($this->facet_data[$facet]['label']); ?></h3> |
|
1019 | + <?php echo do_shortcode('[facetwp facet="'.$facet.'"]'); ?> |
|
1020 | 1020 | <?php } ?> |
1021 | 1021 | </div> |
1022 | 1022 | <?php |
@@ -1026,8 +1026,8 @@ discard block |
||
1026 | 1026 | /** |
1027 | 1027 | * Changes slot column class. |
1028 | 1028 | */ |
1029 | - public function change_slot_column_class( $class ) { |
|
1030 | - if ( is_post_type_archive( 'video' ) || is_tax( 'video-category' ) ) { |
|
1029 | + public function change_slot_column_class($class) { |
|
1030 | + if (is_post_type_archive('video') || is_tax('video-category')) { |
|
1031 | 1031 | $column_class = 'col-xs-12 col-sm-4'; |
1032 | 1032 | } |
1033 | 1033 | |
@@ -1038,15 +1038,15 @@ discard block |
||
1038 | 1038 | * Add post type label to the title. |
1039 | 1039 | */ |
1040 | 1040 | public function add_label_to_title() { |
1041 | - if ( is_search() ) { |
|
1042 | - if ( ! empty( $this->options['display']['engine_search_enable_pt_label'] ) ) { |
|
1041 | + if (is_search()) { |
|
1042 | + if (!empty($this->options['display']['engine_search_enable_pt_label'])) { |
|
1043 | 1043 | $post_type = get_post_type(); |
1044 | - $post_type = str_replace( '_', ' ', $post_type ); |
|
1045 | - $post_type = str_replace( '-', ' ', $post_type ); |
|
1046 | - if ( 'tribe events' === $post_type ) { |
|
1044 | + $post_type = str_replace('_', ' ', $post_type); |
|
1045 | + $post_type = str_replace('-', ' ', $post_type); |
|
1046 | + if ('tribe events' === $post_type) { |
|
1047 | 1047 | $post_type = 'Events'; |
1048 | 1048 | } |
1049 | - echo wp_kses_post( ' <span class="label label-default lsx-label-post-type">' . $post_type . '</span>' ); |
|
1049 | + echo wp_kses_post(' <span class="label label-default lsx-label-post-type">'.$post_type.'</span>'); |
|
1050 | 1050 | } |
1051 | 1051 | } |
1052 | 1052 | } |
@@ -1054,22 +1054,22 @@ discard block |
||
1054 | 1054 | /** |
1055 | 1055 | * Changes the sort options. |
1056 | 1056 | */ |
1057 | - public function facetwp_sort_options( $options, $params ) { |
|
1057 | + public function facetwp_sort_options($options, $params) { |
|
1058 | 1058 | $this->set_vars(); |
1059 | 1059 | |
1060 | - if ( true === $this->search_enabled ) { |
|
1061 | - if ( 'default' !== $params['template_name'] && 'wp' !== $params['template_name'] ) { |
|
1060 | + if (true === $this->search_enabled) { |
|
1061 | + if ('default' !== $params['template_name'] && 'wp' !== $params['template_name']) { |
|
1062 | 1062 | return $options; |
1063 | 1063 | } |
1064 | 1064 | |
1065 | - if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_date' ] ) ) { |
|
1066 | - unset( $options['date_desc'] ); |
|
1067 | - unset( $options['date_asc'] ); |
|
1065 | + if (!empty($this->options['display'][$this->search_prefix.'_disable_date'])) { |
|
1066 | + unset($options['date_desc']); |
|
1067 | + unset($options['date_asc']); |
|
1068 | 1068 | } |
1069 | 1069 | |
1070 | - if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_az_sorting' ] ) ) { |
|
1071 | - unset( $options['title_desc'] ); |
|
1072 | - unset( $options['title_asc'] ); |
|
1070 | + if (!empty($this->options['display'][$this->search_prefix.'_disable_az_sorting'])) { |
|
1071 | + unset($options['title_desc']); |
|
1072 | + unset($options['title_asc']); |
|
1073 | 1073 | } |
1074 | 1074 | } |
1075 | 1075 | |
@@ -1082,9 +1082,9 @@ discard block |
||
1082 | 1082 | * |
1083 | 1083 | * @return mixed |
1084 | 1084 | */ |
1085 | - public function kses_allowed_html( $allowedtags, $context ) { |
|
1085 | + public function kses_allowed_html($allowedtags, $context) { |
|
1086 | 1086 | $allowedtags['a']['data-value'] = true; |
1087 | - $allowedtags['a']['data-selection'] = true; |
|
1087 | + $allowedtags['a']['data-selection'] = true; |
|
1088 | 1088 | $allowedtags['button']['data-toggle'] = true; |
1089 | 1089 | return $allowedtags; |
1090 | 1090 | } |