Passed
Push — fix/bugherd-fixes ( 7511a1...49a475 )
by Virginia
02:33
created

Frontend::ignore_sticky_search()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 2
c 1
b 1
f 0
dl 0
loc 3
rs 10
cc 3
nc 2
nop 1
1
<?php
2
/**
3
 * LSX Search Frontend Class.
4
 *
5
 * @package lsx-search
6
 */
7
8
namespace lsx\search\classes;
9
10
class Frontend {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for class Frontend
Loading history...
11
12
	/**
13
	 * Holds class instance
14
	 *
15
	 * @since 1.0.0
16
	 *
17
	 * @var      object \lsx\search\classes\Frontend()
18
	 */
19
	protected static $instance = null;
20
21
	public $options = false;
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
22
23
	public $tabs = false;
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
24
25
	public $facet_data = false;
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
26
27
	/**
28
	 * Determine weather or not search is enabled for this page.
29
	 *
30
	 * @var boolean
31
	 */
32
	public $search_enabled = false;
33
34
	public $search_core_suffix = false;
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
35
36
	public $search_prefix = false;
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
37
38
	/**
39
	 * Holds the post types enabled
40
	 *
41
	 * @var array
42
	 */
43
	public $post_types = array();
44
45
	/**
46
	 * Holds the taxonomies enabled for search
47
	 *
48
	 * @var array
49
	 */
50
	public $taxonomies = array();
51
52
	/**
53
	 * If the current search page has posts or not
54
	 *
55
	 * @var boolean
56
	 */
57
	public $has_posts = false;
58
59
	/**
60
	 * If we are using the CMB2 options or not.
61
	 *
62
	 * @var boolean
63
	 */
64
	public $new_options = false;
65
66
	/**
67
	 * Construct method.
68
	 */
69
	public function __construct() {
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
70
		$this->options = \lsx\search\includes\get_options();
71
		$this->load_classes();
72
73
		add_filter( 'wpseo_json_ld_search_url', array( $this, 'change_json_ld_search_url' ), 10, 1 );
74
		add_action( 'wp', array( $this, 'set_vars' ), 21 );
75
		add_action( 'wp', array( $this, 'set_facetwp_vars' ), 22 );
76
		add_action( 'wp', array( $this, 'core' ), 23 );
77
		add_action( 'lsx_body_top', array( $this, 'check_for_results' ) );
78
79
		add_filter( 'pre_get_posts', array( $this, 'ignore_sticky_search' ) );
80
81
		add_action( 'pre_get_posts', array( $this, 'filter_post_types' ) );
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 );
88
89
		// Redirects.
90
		add_action( 'template_redirect', array( $this, 'pretty_search_redirect' ) );
91
		add_filter( 'pre_get_posts', array( $this, 'pretty_search_parse_query' ) );
92
93
		add_action( 'lsx_search_sidebar_top', array( $this, 'search_sidebar_top' ) );
94
		add_filter( 'facetwp_facet_html', array( $this, 'search_facet_html' ), 10, 2 );
95
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
96
97
	/**
98
	 * Return an instance of this class.
99
	 *
100
	 * @since 1.0.0
101
	 *
102
	 * @return    object \lsx\member_directory\search\Frontend()    A single instance of this class.
103
	 */
104
	public static function get_instance() {
105
		// If the single instance hasn't been set, set it now.
106
		if ( null === self::$instance ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
107
			self::$instance = new self();
108
		}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
109
		return self::$instance;
110
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
111
112
	/**
113
	 * Loads the variable classes and the static classes.
114
	 */
115
	private function load_classes() {
116
		require_once LSX_SEARCH_PATH . 'classes/frontend/class-layout.php';
117
		$this->layout = frontend\Layout::get_instance();
0 ignored issues
show
Bug Best Practice introduced by
The property layout does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
118
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
119
120
	/**
121
	 * Check all settings.
122
	 */
123
	public function set_vars() {
124
		$post_type = '';
125
126
		$this->post_types      = apply_filters( 'lsx_search_post_types', array() );
127
		$this->taxonomies      = apply_filters( 'lsx_search_taxonomies', array() );
128
		$this->tabs            = apply_filters( 'lsx_search_post_types_plural', array() );
129
		$this->options         = apply_filters( 'lsx_search_options', $this->options );
130
		$this->post_types      = get_post_types();
131
		$this->post_type_slugs = array(
0 ignored issues
show
Bug Best Practice introduced by
The property post_type_slugs does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
132
			'post'        => 'posts',
133
			'project'     => 'projects',
134
			'service'     => 'services',
135
			'team'        => 'team',
136
			'testimonial' => 'testimonials',
137
			'video'       => 'videos',
138
			'product'     => 'products',
139
		);
140
		$this->set_search_prefix();
141
		$this->get_cmb2_options();
142
		$this->search_enabled = apply_filters( 'lsx_search_enabled', $this->is_search_enabled(), $this );
143
		$this->search_prefix  = apply_filters( 'lsx_search_prefix', $this->search_prefix, $this );
144
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
145
146
	private function get_cmb2_options() {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for function get_cmb2_options()
Loading history...
147
		$cmb2_options = get_option( 'lsx-search-settings' );
148
		if ( false !== $cmb2_options && ! empty( $cmb2_options ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
149
			$this->set_search_prefix( true );
150
			$this->options['display'] = $cmb2_options;
151
			foreach ( $this->options['display'] as $option_key => $option_value ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
152
				if ( is_array( $option_value ) && ! empty( $option_value ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
153
					$new_values = array();
154
					foreach ( $option_value as $empty_key => $key_value ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
155
						$new_values[ $key_value ] = 'on';
156
					}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
157
					$this->options['display'][ $option_key ] = $new_values;
158
				}
159
			}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
160
			$this->new_options = true;
161
			$this->disable_to_search_actions();
162
		}
163
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
164
165
	private function disable_to_search_actions() {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for function disable_to_search_actions()
Loading history...
166
		global $lsx_to_search_fwp, $lsx_to_search;
167
		if ( null !== $lsx_to_search ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
168
			// Redirects.
169
			remove_filter( 'template_include', array( $lsx_to_search, 'search_template_include' ), 99 );
170
			remove_action( 'template_redirect', array( $lsx_to_search, 'pretty_search_redirect' ) );
171
			remove_filter( 'pre_get_posts', array( $lsx_to_search, 'pretty_search_parse_query' ) );
172
173
			// Layout Filter.
174
			remove_filter( 'lsx_layout', array( $lsx_to_search, 'lsx_layout' ), 20, 1 );
0 ignored issues
show
Unused Code introduced by
The call to remove_filter() has too many arguments starting with 1. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

174
			/** @scrutinizer ignore-call */ 
175
   remove_filter( 'lsx_layout', array( $lsx_to_search, 'lsx_layout' ), 20, 1 );

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
175
			remove_filter( 'lsx_layout_selector', array( $lsx_to_search, 'lsx_layout_selector' ), 10, 4 );
176
			remove_filter( 'lsx_to_archive_layout', array( $lsx_to_search, 'lsx_to_search_archive_layout' ), 10, 2 );
177
178
			remove_action( 'lsx_search_sidebar_top', array( $lsx_to_search, 'search_sidebar_top' ) );
179
			remove_action( 'pre_get_posts', array( $lsx_to_search, 'price_sorting' ), 100 );
180
181
			//add_shortcode( 'lsx_search_form', array( 'LSX_TO_Search_Frontend', 'search_form' ) );
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
Coding Style introduced by
No space found before comment text; expected "// add_shortcode( 'lsx_search_form', array( 'LSX_TO_Search_Frontend', 'search_form' ) );" but found "//add_shortcode( 'lsx_search_form', array( 'LSX_TO_Search_Frontend', 'search_form' ) );"
Loading history...
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
182
			remove_filter( 'searchwp_short_circuit', array( $lsx_to_search, 'searchwp_short_circuit' ), 10, 2 );
183
			remove_filter( 'get_search_query', array( $lsx_to_search, 'get_search_query' ) );
184
			remove_filter( 'body_class', array( $lsx_to_search, 'to_add_search_url_class' ), 20 );
185
186
			remove_filter( 'facetwp_preload_url_vars', array( $lsx_to_search, 'preload_url_vars' ), 10, 1 );
187
			remove_filter( 'wpseo_json_ld_search_url', array( $lsx_to_search, 'change_json_ld_search_url' ), 10, 1 );
188
		}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
189
		if ( null !== $lsx_to_search_fwp ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
190
			remove_filter( 'facetwp_indexer_row_data', array( $lsx_to_search_fwp, 'facetwp_index_row_data' ), 10, 2 );
191
			remove_filter( 'facetwp_index_row', array( $lsx_to_search_fwp, 'facetwp_index_row' ), 10, 2 );
192
193
			remove_filter( 'facetwp_sort_options', array( $lsx_to_search_fwp, 'facet_sort_options' ), 10, 2 );
194
195
			remove_filter( 'facetwp_pager_html', array( $lsx_to_search_fwp, 'facetwp_pager_html' ), 10, 2 );
196
			remove_filter( 'facetwp_result_count', array( $lsx_to_search_fwp, 'facetwp_result_count' ), 10, 2 );
197
198
			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'destination_facet_html' ), 10, 2 );
199
			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'slide_facet_html' ), 10, 2 );
200
			remove_filter( 'facetwp_facet_html', array( $lsx_to_search_fwp, 'search_facet_html' ), 10, 2 );
201
			remove_filter( 'facetwp_load_css', array( $lsx_to_search_fwp, 'facetwp_load_css' ), 10, 1 );
202
203
			if ( class_exists( 'LSX_Currencies' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
204
				remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_lsx_currencies' ), 10, 2 );
205
			} else {
206
				remove_filter( 'facetwp_render_output', array( $lsx_to_search_fwp, 'slide_price_to_currencies' ), 10, 2 );
207
			}
208
		}
209
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
210
211
	/**
212
	 * Returns if the search is enabled.
213
	 *
214
	 * @return boolean
215
	 */
216
	public function is_search_enabled() {
217
		$search_enabled = false;
218
219
		if ( false === $this->new_options ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
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 ] ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
introduced by
Found: ==. Use strict comparisons (=== or !==).
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
221
				$search_enabled = true;
222
			}
223
		} else {
224
			$enable_prefix = $this->search_prefix;
225
			if ( ! empty( $this->options ) && isset( $this->options['display'] ) && isset( $this->options['display'][ $enable_prefix . '_enable' ] ) && 'on' === $this->options['display'][ $enable_prefix . '_enable' ] ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
226
				$search_enabled = true;
227
			}
228
		}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
229
		return $search_enabled;
230
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
231
232
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$new_prefixes" missing
Loading history...
233
	 * Sets the search prefix.
234
	 *
235
	 * @return void
236
	 */
237
	private function set_search_prefix( $new_prefixes = false ) {
238
		$page_for_posts = get_option( 'page_for_posts' );
239
		if ( false !== $new_prefixes ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
240
			$this->taxonomies = array();
241
			$this->post_types = array();
242
		}
243
244
		if ( is_search() ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
245
			if ( false === $new_prefixes ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
246
				$this->search_core_suffix = 'core';
247
				$this->search_prefix      = 'search';
248
			} else {
249
				$this->search_core_suffix = 'enable';
250
				$this->search_prefix      = 'engine_search';
251
			}
252
		} elseif ( is_post_type_archive( $this->post_types ) || is_tax() || is_page( $page_for_posts ) || is_home() || is_category() || is_tag() ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
253
			if ( false === $new_prefixes ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
254
				$this->search_core_suffix = 'search';
255
			} else {
256
				$this->search_core_suffix = 'enable';
257
			}
258
259
			if ( is_tax() ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
260
				$tax = get_query_var( 'taxonomy' );
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
261
				$tax = get_taxonomy( $tax );
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
262
				$post_type = $tax->object_type[0];
263
			} else if ( is_page( $page_for_posts ) || is_category() || is_tag() || is_home() ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
264
				$post_type = 'post';
265
			} else {
266
				$post_type = get_query_var( 'post_type' );
267
			}
268
269
			if ( false === $new_prefixes ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
270
				if ( isset( $this->tabs[ $post_type ] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
271
					$this->search_prefix = $this->tabs[ $post_type ] . '_archive';
272
				}
273
			} else {
274
				$this->search_prefix = $post_type . '_search';
275
			}
276
		}
277
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
278
279
	/**
280
	 * Sets the FacetWP variables.
281
	 */
282
	public function set_facetwp_vars() {
0 ignored issues
show
Coding Style introduced by
Expected 0 blank lines after opening function brace; 1 found
Loading history...
283
284
		if ( class_exists( 'FacetWP' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
285
			$facet_data = FWP()->helper->get_facets();
0 ignored issues
show
Bug introduced by
The function FWP was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

285
			$facet_data = /** @scrutinizer ignore-call */ FWP()->helper->get_facets();
Loading history...
286
		}
287
288
		$this->facet_data = array();
289
290
		$this->facet_data['search_form'] = array(
291
			'name' => 'search_form',
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 2 space(s) between "'name'" and double arrow, but found 1.
Loading history...
292
			'label' => esc_html__( 'Search Form', 'lsx-search' ),
293
		);
294
295
		if ( ! empty( $facet_data ) && is_array( $facet_data ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
296
			foreach ( $facet_data as $facet ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
297
				$this->facet_data[ $facet['name'] ] = $facet;
298
			}
299
		}
300
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
301
302
	/**
303
	 * Check all settings.
304
	 */
305
	public function core() {
0 ignored issues
show
Coding Style introduced by
Expected 0 blank lines after opening function brace; 1 found
Loading history...
306
307
		if ( true === $this->search_enabled ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
308
			add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 999 );
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 );
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 );
318
319
			if ( class_exists( 'LSX_Videos' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
320
				global $lsx_videos_frontend;
321
				remove_action( 'lsx_content_top', array( $lsx_videos_frontend, 'categories_tabs' ), 15 );
322
			}
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' ) );
329
330
			if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) && '1c' !== $this->options['display'][ $this->search_prefix . '_layout' ] ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
331
				add_filter( 'lsx_sidebar_enable', array( $this, 'lsx_sidebar_enable' ), 10, 1 );
332
			}
333
334
			add_action( 'lsx_content_wrap_before', array( $this, 'search_sidebar' ), 150 );
335
336
			if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_category() || is_product_tag() ) ) {
0 ignored issues
show
Bug introduced by
The function is_shop was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

336
			if ( class_exists( 'WooCommerce' ) && ( /** @scrutinizer ignore-call */ is_shop() || is_product_category() || is_product_tag() ) ) {
Loading history...
Bug introduced by
The function is_product_category was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

336
			if ( class_exists( 'WooCommerce' ) && ( is_shop() || /** @scrutinizer ignore-call */ is_product_category() || is_product_tag() ) ) {
Loading history...
Bug introduced by
The function is_product_tag was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

336
			if ( class_exists( 'WooCommerce' ) && ( is_shop() || is_product_category() || /** @scrutinizer ignore-call */ is_product_tag() ) ) {
Loading history...
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
341
				add_filter( 'loop_shop_columns', function() {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
342
					return 3;
343
				} );
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
344
345
				// Actions added by LSX theme
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
346
				remove_action( 'lsx_content_wrap_before', 'lsx_global_header' );
347
				add_action( 'lsx_content_wrap_before', array( $this, 'wc_archive_header' ), 140 );
348
349
				// Actions added be LSX theme / woocommerce.php file
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
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
356
				// Actions added be LSX theme / woocommerce.php file
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
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
			}
363
		}
364
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
365
366
	/**
367
	 * Adds a search class to the body to allow the styling of the sidebars etc.
368
	 *
369
	 * @param  array $classes The classes.
370
	 * @return array $classes The classes.
371
	 */
372
	public function body_class( $classes ) {
373
		$classes[] = 'lsx-search-enabled';
374
		return $classes;
375
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
376
377
	/**
378
	 * Moves the blog description to above the content columns.
379
	 *
380
	 * @param  string $action
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
381
	 * @return string $action
382
	 */
383
	public function top_of_blog_action( $action = '' ) {
384
		$action = 'lsx_content_wrap_before';
385
		return $action;
386
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
387
388
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$class" missing
Loading history...
389
	 * Adds a class to the blog description.
390
	 *
391
	 * @param  string $action
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Doc comment for parameter $action does not match actual variable name $class
Loading history...
392
	 * @return string $action
393
	 */
394
	public function blog_description_class( $class = '' ) {
395
		$class .= ' col-md-12 search-description';
396
		return $class;
397
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
398
399
	/**
400
	 * Check the $wp_query global to see if there are posts in the current query.
401
	 *
402
	 * @return void
403
	 */
404
	public function check_for_results() {
405
		if ( true === $this->search_enabled ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
406
			global $wp_query;
407
			if ( empty( $wp_query->posts ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
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 );
412
			} else {
413
				$this->has_posts = true;
414
			}
415
		}
416
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
417
418
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$query" missing
Loading history...
419
	 * Filter the post types.
420
	 */
421
	public function filter_post_types( $query ) {
422
		if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
423
			if ( ! empty( $this->options ) && ! empty( $this->options['display']['search_enable_core'] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
424
				if ( ! empty( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
425
					$post_types = array_keys( $this->options['general']['search_post_types'] );
426
					$query->set( 'post_type', $post_types );
427
				}
428
			}
429
		}
430
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
431
432
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$post_types" missing
Loading history...
433
	 * Sets post types with active search options.
434
	 */
435
	public function register_post_types( $post_types ) {
436
		$post_types = array( 'post', 'project', 'service', 'team', 'testimonial', 'video', 'product' );
437
		return $post_types;
438
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
439
440
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$taxonomies" missing
Loading history...
441
	 * Sets taxonomies with active search options.
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' );
445
		return $taxonomies;
446
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
447
448
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$post_types_plural" missing
Loading history...
449
	 * Sets post types with active search options.
450
	 */
451
	public function register_post_type_tabs( $post_types_plural ) {
452
		$post_types_plural = array(
453
			'post' => 'posts',
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 8 space(s) between "'post'" and double arrow, but found 1.
Loading history...
454
			'project' => 'projects',
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 5 space(s) between "'project'" and double arrow, but found 1.
Loading history...
455
			'service' => 'services',
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 5 space(s) between "'service'" and double arrow, but found 1.
Loading history...
456
			'team' => 'team',
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 8 space(s) between "'team'" and double arrow, but found 1.
Loading history...
457
			'testimonial' => 'testimonials',
458
			'video' => 'videos',
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 7 space(s) between "'video'" and double arrow, but found 1.
Loading history...
459
			'product' => 'products', // WooCommerce
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 5 space(s) between "'product'" and double arrow, but found 1.
Loading history...
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
460
		);
461
		return $post_types_plural;
462
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
463
464
	/**
465
	 * Enqueue styles and scripts.
466
	 */
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 );
472
473
		$params = apply_filters( 'lsx_search_js_params', array(
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
474
			'ajax_url' => admin_url( 'admin-ajax.php' ),
475
		));
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
476
477
		wp_localize_script( 'lsx-search', 'lsx_customizer_params', $params );
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' );
481
482
		if ( true === $this->new_options ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
483
			wp_deregister_style( 'lsx_to_search' );
484
			wp_deregister_script( 'lsx_to_search' );
485
		}
486
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
487
488
	/**
489
	 * Adds the to-search.min.js and the to-search.js
490
	 *
491
	 * @param boolean $should_skip
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
492
	 * @param string  $tag
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
493
	 * @param string  $handle
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
494
	 * @param string  $href
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
495
	 * @return boolean
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' ) ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
499
			$should_skip = true;
500
		}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
501
		return $should_skip;
502
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
503
504
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$template" missing
Loading history...
505
	 * Redirect wordpress to the search template located in the plugin
0 ignored issues
show
introduced by
Please spell "WordPress" correctly. Found 1 misspelling(s): wordpress
Loading history...
506
	 *
507
	 * @param	$template
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
508
	 * @return	$template
0 ignored issues
show
Documentation Bug introduced by
The doc comment $template at position 0 could not be parsed: Unknown type name '$template' at position 0 in $template.
Loading history...
introduced by
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
509
	 */
510
	public function search_template_include( $template ) {
511
		if ( is_main_query() && is_search() ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
512
			if ( file_exists( LSX_SEARCH_PATH . 'templates/search.php' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
513
				$template = LSX_SEARCH_PATH . 'templates/search.php';
514
			}
515
		}
516
517
		return $template;
518
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
519
520
	/**
521
	 * Ignore sticky posts on Blog search.
522
	 *
523
	 * @param [type] $query
0 ignored issues
show
Documentation Bug introduced by
The doc comment [type] at position 0 could not be parsed: Unknown type name '[' at position 0 in [type].
Loading history...
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
524
	 * @return void
525
	 */
526
	public function ignore_sticky_search( $query ) {
527
		if ( $query->is_main_query() && is_home() ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
528
			$query->set( 'ignore_sticky_posts', true );
529
		}
530
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
531
532
	/**
533
	 * Rewrite the search URL
534
	 */
535
	public function pretty_search_redirect() {
536
		global $wp_rewrite,$wp_query;
537
538
		if ( ! isset( $wp_rewrite ) || ! is_object( $wp_rewrite ) || ! $wp_rewrite->using_permalinks() ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
539
			return;
540
		}
541
542
		$search_base = $wp_rewrite->search_base;
543
544
		if ( is_search() && ! is_admin() && strpos( $_SERVER['REQUEST_URI'], "/{$search_base}/" ) === false ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
introduced by
Detected usage of a possibly undefined superglobal array index: $_SERVER['REQUEST_URI']. Use isset() or empty() to check the index exists before using it
Loading history...
introduced by
$_SERVER data not unslashed before sanitization. Use wp_unslash() or similar
Loading history...
introduced by
Detected usage of a non-sanitized input variable: $_SERVER['REQUEST_URI']
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
545
			$search_query = get_query_var( 's' );
546
			$engine = '';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
547
548
			// If the search was triggered by a supplemental engine.
549
			if ( isset( $_GET['engine'] ) && 'default' !== $_GET['engine'] ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
introduced by
Processing form data without nonce verification.
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
550
				$engine = $_GET['engine'];
0 ignored issues
show
introduced by
Processing form data without nonce verification.
Loading history...
introduced by
$_GET data not unslashed before sanitization. Use wp_unslash() or similar
Loading history...
introduced by
Detected usage of a non-sanitized input variable: $_GET['engine']
Loading history...
551
				set_query_var( 'engine', $engine );
552
				$engine = array_search( $engine, $this->post_type_slugs, true ) . '/';
0 ignored issues
show
Bug introduced by
Are you sure array_search($engine, $t...>post_type_slugs, true) of type false|integer|string can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

552
				$engine = /** @scrutinizer ignore-type */ array_search( $engine, $this->post_type_slugs, true ) . '/';
Loading history...
553
			}
554
555
			$get_array = $_GET;
0 ignored issues
show
introduced by
Processing form data without nonce verification.
Loading history...
556
557
			if ( is_array( $get_array ) && ! empty( $get_array ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
558
				$vars_to_maintain = array();
559
560
				foreach ( $get_array as $ga_key => $ga_value ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
561
					if ( false !== strpos( $ga_key, 'fwp_' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
562
						$vars_to_maintain[] = $ga_key . '=' . $ga_value;
563
					}
564
				}
565
			}
566
567
			$redirect_url = home_url( "/{$search_base}/" . $engine . urlencode( $search_query ) );
0 ignored issues
show
introduced by
urlencode() should only be used when dealing with legacy applications rawurlencode() should now be used instead. See http://php.net/manual/en/function.rawurlencode.php and http://www.faqs.org/rfcs/rfc3986.html
Loading history...
568
569
			if ( ! empty( $vars_to_maintain ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
570
				$redirect_url .= '?' . implode( '&', $vars_to_maintain );
571
			}
572
573
			wp_redirect( $redirect_url );
0 ignored issues
show
introduced by
wp_redirect() found. Using wp_safe_redirect(), along with the allowed_redirect_hosts filter if needed, can help avoid any chances of malicious redirects within code. It is also important to remember to call exit() after a redirect so that no other unwanted code is executed.
Loading history...
574
			exit();
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
575
		}
576
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
577
578
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$query" missing
Loading history...
579
	 * Parse the Query and trigger a search
580
	 */
581
	public function pretty_search_parse_query( $query ) {
582
		$this->post_type_slugs = array(
0 ignored issues
show
Bug Best Practice introduced by
The property post_type_slugs does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
583
			'post' => 'posts',
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 8 space(s) between "'post'" and double arrow, but found 1.
Loading history...
584
			'project' => 'projects',
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 5 space(s) between "'project'" and double arrow, but found 1.
Loading history...
585
			'service' => 'services',
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 5 space(s) between "'service'" and double arrow, but found 1.
Loading history...
586
			'team' => 'team',
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 8 space(s) between "'team'" and double arrow, but found 1.
Loading history...
587
			'testimonial' => 'testimonials',
588
			'video' => 'videos',
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 7 space(s) between "'video'" and double arrow, but found 1.
Loading history...
589
			'product' => 'products', // WooCommerce
0 ignored issues
show
introduced by
Array double arrow not aligned correctly; expected 5 space(s) between "'product'" and double arrow, but found 1.
Loading history...
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
590
		);
591
		if ( $query->is_search() && ! is_admin() && $query->is_main_query() ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
592
			$search_query = $query->get( 's' );
593
			$keyword_test = explode( '/', $search_query );
594
595
			$index = array_search( $keyword_test[0], $this->post_type_slugs, true );
596
			if ( false !== $index ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
597
				$engine = $this->post_type_slugs[ $index ];
598
599
				$query->set( 'post_type', $engine );
600
				$query->set( 'engine', $engine );
601
602
				if ( count( $keyword_test ) > 1 ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
603
					$query->set( 's', $keyword_test[1] );
604
				} elseif ( post_type_exists( $engine ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
605
					$query->set( 's', '' );
606
				}
607
			} else {
608
				if ( isset( $this->options['general']['search_post_types'] ) && is_array( $this->options['general']['search_post_types'] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
609
					$post_types = array_keys( $this->options['general']['search_post_types'] );
610
					$query->set( 'post_type', $post_types );
611
				}
612
			}
613
		}
614
615
		return $query;
616
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
617
618
	/**
619
	 * Change the search slug to /search/ for the JSON+LD output in Yoast SEO
620
	 *
621
	 * @return url
0 ignored issues
show
Bug introduced by
The type lsx\search\classes\url was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
622
	 */
623
	public function change_json_ld_search_url() {
624
		return trailingslashit( home_url() ) . 'search/{search_term_string}';
625
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
626
627
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$layout" missing
Loading history...
628
	 * A filter to set the layout to 2 column.
629
	 */
630
	public function lsx_layout( $layout ) {
631
		if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
632
			if ( false === $this->has_posts ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
633
				$layout = '1c';
634
			} else {
635
				$layout = $this->options['display'][ $this->search_prefix . '_layout' ];
636
			}
637
		}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
638
		return $layout;
639
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
640
641
	/**
642
	 * Outputs the Search Title Facet
643
	 */
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 ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
Coding Style introduced by
Blank line found at start of control structure
Loading history...
646
647
			if ( ! is_search() ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
Coding Style introduced by
Blank line found at start of control structure
Loading history...
648
649
				foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
Coding Style introduced by
Blank line found at start of control structure
Loading history...
650
651
					if ( isset( $this->facet_data[ $facet ] ) && 'search' === $this->facet_data[ $facet ]['type'] ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
					}
657
				}
658
			} else {
659
				echo wp_kses_post( '<div class="row">' );
660
					$this->display_facet_search();
661
				echo wp_kses_post( '</div>' );
662
			}
663
		}
664
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
665
666
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$output" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$params" missing
Loading history...
667
	 * Overrides the search facet HTML
668
	 * @param $output
0 ignored issues
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
Coding Style introduced by
Missing parameter name
Loading history...
669
	 * @param $params
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
670
	 *
671
	 * @return string
672
	 */
673
	public function search_facet_html( $output, $params ) {
674
		if ( 'search' == $params['facet']['type'] ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
introduced by
Found: ==. Use strict comparisons (=== or !==).
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
Coding Style introduced by
Blank line found at start of control structure
Loading history...
675
676
			$value = (array) $params['selected_values'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
677
			$value = empty( $value ) ? '' : stripslashes( $value[0] );
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
678
			$placeholder = isset( $params['facet']['placeholder'] ) ? $params['facet']['placeholder'] : __( 'Search...', 'lsx-search' );
679
			$placeholder = facetwp_i18n( $placeholder );
0 ignored issues
show
Bug introduced by
The function facetwp_i18n was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

679
			$placeholder = /** @scrutinizer ignore-call */ facetwp_i18n( $placeholder );
Loading history...
680
681
			ob_start();
682
			?>
683
			<div class="col-xs-12 facetwp-item facetwp-form">
684
				<div class="search-form lsx-search-form 2">
685
					<div class="input-group facetwp-search-wrap">
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 ); ?>">
688
						</div>
689
690
						<div class="field submit-button">
691
							<button class="search-submit btn facetwp-btn" type="submit"><?php esc_html_e( 'Search', 'lsx-search' ); ?></button>
692
						</div>
693
					</div>
694
				</div>
695
			</div>
696
			<?php
697
			$output = ob_get_clean();
698
		}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
699
		return $output;
700
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
701
702
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$return_class" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$class" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$layout" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$size" missing
Loading history...
703
	 * Change the primary and secondary column classes.
704
	 */
705
	public function lsx_layout_selector( $return_class, $class, $layout, $size ) {
706
		if ( ! empty( $this->options['display'][ $this->search_prefix . '_layout' ] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
Coding Style introduced by
Blank line found at start of control structure
Loading history...
707
708
			if ( '2cl' === $layout || '2cr' === $layout ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
709
				$main_class    = 'col-sm-8 col-md-9';
710
				$sidebar_class = 'col-sm-4 col-md-3';
711
712
				if ( '2cl' === $layout ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
713
					$main_class    .= ' col-sm-pull-4 col-md-pull-3';
714
					$sidebar_class .= ' col-sm-push-8 col-md-push-9';
715
				}
716
717
				if ( 'main' === $class ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
718
					return $main_class;
719
				}
720
721
				if ( 'sidebar' === $class ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
722
					return $sidebar_class;
723
				}
724
			}
725
		}
726
727
		return $return_class;
728
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
729
730
	/**
731
	 * Displays the Alphabet sorter above the facets.
732
	 *
733
	 * @return void
734
	 */
735
	public function display_alphabet_facet() {
736
		if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
737
			$az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ];
738
		} else {
739
			$az_pagination = false;
740
		}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
741
		$az_pagination = apply_filters( 'lsx_search_top_az_pagination', $az_pagination );
742
		if ( false !== $az_pagination && '' !== $az_pagination ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
743
			echo do_shortcode( '[facetwp facet="' . $az_pagination . '"]' );
744
		}
745
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
746
747
	/**
748
	 * Outputs top.
749
	 */
750
	public function facet_top_bar() {
751
		if ( true === apply_filters( 'lsx_search_hide_top_bar', false ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
752
			return;
753
		}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
754
		$show_pagination     = true;
755
		$pagination_visible  = false;
756
		$show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] );
757
		$show_sort_combo     = empty( $this->options['display'][ $this->search_prefix . '_disable_all_sorting' ] );
758
759
		$show_pagination     = apply_filters( 'lsx_search_top_show_pagination', $show_pagination );
760
		$pagination_visible  = apply_filters( 'lsx_search_top_pagination_visible', $pagination_visible );
761
		$show_per_page_combo = apply_filters( 'lsx_search_top_show_per_page_combo', $show_per_page_combo );
762
		$show_sort_combo     = apply_filters( 'lsx_search_top_show_sort_combo', $show_sort_combo );
763
		$facet_row_classes   = apply_filters( 'lsx_search_top_facetwp_row_classes', '' );
764
		?>
765
		<div id="facetwp-top">
766
			<?php if ( $show_sort_combo || ( $show_pagination && $show_per_page_combo ) ) { ?>
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
767
				<div class="row facetwp-top-row-1 hidden-xs <?php echo esc_attr( $facet_row_classes ); ?>">
768
					<div class="col-xs-12">
769
770
						<?php if ( ! empty( $this->options['display'][ $this->search_prefix . '_display_result_count' ] ) && false === apply_filters( 'lsx_search_hide_result_count', false ) ) { ?>
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
771
							<div class="row">
772
								<div class="col-md-12 facetwp-item facetwp-results">
773
									<h3 class="lsx-search-title lsx-search-title-results"><?php esc_html_e( 'Results', 'lsx-search' ); ?> <?php echo '(' . do_shortcode( '[facetwp counts="true"]' ) . ')&nbsp;'; ?>
774
									<?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' ] ) { ?>
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
775
										<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>
776
									<?php } ?>
777
									</h3>
778
								</div>
779
							</div>
780
						<?php } ?>
781
782
						<?php do_action( 'lsx_search_facetwp_top_row' ); ?>
783
784
						<?php $this->display_alphabet_facet(); ?>
785
786
						<?php if ( $show_sort_combo ) { ?>
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
787
							<?php echo do_shortcode( '[facetwp sort="true"]' ); ?>
788
						<?php } ?>
789
790
					</div>
791
				</div>
792
			<?php } ?>
793
		</div>
794
		<?php
795
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
796
797
	/**
798
	 * Outputs bottom.
799
	 */
800
	public function facet_bottom_bar() {
801
		if ( true === apply_filters( 'lsx_search_hide_bottom_bar', false ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
802
			return;
803
		}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
804
		$show_pagination    = true;
805
		$pagination_visible = false;
806
		if ( isset( $this->options['display'][ $this->search_prefix . '_az_pagination' ] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
807
			$az_pagination = $this->options['display'][ $this->search_prefix . '_az_pagination' ];
808
		} else {
809
			$az_pagination = false;
810
		}
811
812
		$show_per_page_combo = empty( $this->options['display'][ $this->search_prefix . '_disable_per_page' ] );
813
		$show_sort_combo     = empty( $this->options['display'][ $this->search_prefix . '_disable_all_sorting' ] );
814
815
		$show_pagination     = apply_filters( 'lsx_search_bottom_show_pagination', $show_pagination );
816
		$pagination_visible  = apply_filters( 'lsx_search_bottom_pagination_visible', $pagination_visible );
817
		$show_per_page_combo = apply_filters( 'lsx_search_bottom_show_per_page_combo', $show_per_page_combo );
818
		$show_sort_combo     = apply_filters( 'lsx_search_bottom_show_sort_combo', $show_sort_combo );
819
820
		if ( $show_pagination || ! empty( $az_pagination ) ) { ?>
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
Coding Style introduced by
Closing PHP tag must be on a line by itself
Loading history...
821
			<div id="facetwp-bottom">
822
				<div class="row facetwp-bottom-row-1">
823
					<div class="col-xs-12">
824
						<?php do_action( 'lsx_search_facetwp_bottom_row' ); ?>
825
826
						<?php //if ( $show_sort_combo ) { ?>
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
Coding Style introduced by
No space found before comment text; expected "// if ( $show_sort_combo ) {" but found "//if ( $show_sort_combo ) {"
Loading history...
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
827
							<?php //echo do_shortcode( '[facetwp sort="true"]' ); ?>
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
Coding Style introduced by
No space found before comment text; expected "// echo do_shortcode( '[facetwp sort="true"]' );" but found "//echo do_shortcode( '[facetwp sort="true"]' );"
Loading history...
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
828
						<?php //} ?>
0 ignored issues
show
Coding Style introduced by
No space found before comment text; expected "// }" but found "//}"
Loading history...
829
830
						<?php //if ( ( $show_pagination && $show_per_page_combo ) || $show_per_page_combo ) { ?>
0 ignored issues
show
Unused Code Comprehensibility introduced by
53% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
Coding Style introduced by
No space found before comment text; expected "// if ( ( $show_pagination && $show_per_page_combo ) || $show_per_page_combo ) {" but found "//if ( ( $show_pagination && $show_per_page_combo ) || $show_per_page_combo ) {"
Loading history...
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
831
							<?php //echo do_shortcode( '[facetwp per_page="true"]' ); ?>
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
Coding Style introduced by
No space found before comment text; expected "// echo do_shortcode( '[facetwp per_page="true"]' );" but found "//echo do_shortcode( '[facetwp per_page="true"]' );"
Loading history...
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
832
						<?php //} ?>
0 ignored issues
show
Coding Style introduced by
No space found before comment text; expected "// }" but found "//}"
Loading history...
833
834
						<?php
835
						if ( $show_pagination ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
836
							$output_pagination = do_shortcode( '[facetwp pager="true"]' );
837
							if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
838
								foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
839
									if ( isset( $this->facet_data[ $facet ] ) && in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
introduced by
Not using strict comparison for in_array; supply true for third argument.
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
840
										$output_pagination = do_shortcode( '[facetwp facet="pager_"]' );
841
									}
842
								}
843
							}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
844
							echo wp_kses_post( $output_pagination );
845
						?>
846
						<?php } ?>
847
					</div>
848
				</div>
849
			</div>
850
		<?php }
0 ignored issues
show
Coding Style introduced by
Opening PHP tag must be on a line by itself
Loading history...
851
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
852
853
	/**
854
	 * Adds in the closing facetwp div
855
	 *
856
	 * @return void
857
	 */
858
	public function facetwp_tempate_open() {
859
		?>
860
		<div class="facetwp-template">
861
		<?php
862
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
863
864
	/**
865
	 * Adds in the closing facetwp div
866
	 *
867
	 * @return void
868
	 */
869
	public function facetwp_tempate_close() {
870
		?>
871
		</div>
872
		<?php
873
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
874
875
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$sidebar_enabled" missing
Loading history...
876
	 * Disables default sidebar.
877
	 */
878
	public function lsx_sidebar_enable( $sidebar_enabled ) {
879
		$sidebar_enabled = false;
880
		return $sidebar_enabled;
881
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
882
883
	/**
884
	 * Outputs custom sidebar.
885
	 */
886
	public function search_sidebar() {
0 ignored issues
show
Coding Style introduced by
Expected 0 blank lines after opening function brace; 1 found
Loading history...
887
888
		$this->options = apply_filters( 'lsx_search_sidebar_options', $this->options );
889
		?>
890
			<?php do_action( 'lsx_search_sidebar_before' ); ?>
891
892
			<div id="secondary" class="facetwp-sidebar widget-area <?php echo esc_attr( lsx_sidebar_class() ); ?>" role="complementary">
893
894
				<?php do_action( 'lsx_search_sidebar_top' ); ?>
895
896
				<?php if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) { ?>
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
897
					<div class="row facetwp-row lsx-search-filer-area">
898
						<h3 class="facetwp-filter-title"><?php echo esc_html_e( 'Refine by', 'lsx-search' ); ?></h3>
899
						<div class="col-xs-12 facetwp-item facetwp-filters-button hidden-sm hidden-md hidden-lg">
900
							<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
						</div>
902
903
						<div class="ssm-overlay ssm-toggle-nav" rel="lsx-search-filters"></div>
904
905
						<div class="col-xs-12 facetwp-item-wrap facetwp-filters-wrap" id="lsx-search-filters">
906
							<div class="row hidden-sm hidden-md hidden-lg ssm-row-margin-bottom">
907
								<div class="col-xs-12 facetwp-item facetwp-filters-button">
908
									<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
								</div>
910
							</div>
911
912
							<div class="row">
913
								<?php
914
								// Slider.
915
								foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
916
									if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'alpha', 'search', 'pager' ) ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
introduced by
Not using strict comparison for in_array; supply true for third argument.
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
917
										$this->display_facet_default( $facet );
918
									}
919
								}
920
								?>
921
							</div>
922
923
							<div class="row hidden-sm hidden-md hidden-lg ssm-row-margin-top">
924
								<div class="col-xs-12 facetwp-item facetwp-filters-button">
925
									<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
								</div>
927
							</div>
928
						</div>
929
					</div>
930
				<?php } ?>
931
932
				<?php do_action( 'lsx_search_sidebar_bottom' ); ?>
933
			</div>
934
935
			<?php do_action( 'lsx_search_sidebar_after' ); ?>
936
		<?php
937
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
938
939
	/**
940
	 * Check if the pager facet is on
941
	 *
942
	 * @return void
0 ignored issues
show
Coding Style introduced by
Function return type is void, but function contains return statement
Loading history...
943
	 */
944
	public function pager_facet_enabled() {
0 ignored issues
show
Coding Style introduced by
Expected 0 blank lines after opening function brace; 1 found
Loading history...
945
946
		$pager_facet_off = false;
947
948
		if ( ! empty( $this->options['display'][ $this->search_prefix . '_facets' ] ) && is_array( $this->options['display'][ $this->search_prefix . '_facets' ] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
949
			foreach ( $this->options['display'][ $this->search_prefix . '_facets' ] as $facet => $facet_useless ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
950
				if ( isset( $this->facet_data[ $facet ] ) && ! in_array( $this->facet_data[ $facet ]['type'], array( 'pager' ) ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
introduced by
Not using strict comparison for in_array; supply true for third argument.
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
951
					$pager_facet_off = true;
952
				}
953
			}
954
		}
955
956
		return $pager_facet_off;
957
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
958
959
	/**
960
	 * Display WooCommerce archive title.
961
	 */
962
	public function wc_archive_header() {
963
		$default_size   = 'sm';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 1 space but found 3 spaces

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
964
		$size           = apply_filters( 'lsx_bootstrap_column_size', $default_size );
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 11 spaces

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
965
		?>
966
			<div class="archive-header-wrapper banner-woocommerce col-<?php echo esc_attr( $size ); ?>-12">
967
				<?php lsx_global_header_inner_bottom(); ?>
968
				<header class="archive-header">
969
					<h1 class="archive-title"><?php woocommerce_page_title(); ?></h1>
0 ignored issues
show
Bug introduced by
The function woocommerce_page_title was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

969
					<h1 class="archive-title"><?php /** @scrutinizer ignore-call */ woocommerce_page_title(); ?></h1>
Loading history...
970
				</header>
971
			</div>
972
		<?php
973
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
974
975
	/**
976
	 * Display facet search.
977
	 */
978
	public function display_facet_search() {
979
		?>
980
		<div class="col-xs-12 facetwp-item facetwp-form">
981
			<form class="search-form lsx-search-form" action="/" method="get">
982
				<div class="input-group">
983
					<div class="field">
984
						<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() ?>">
0 ignored issues
show
Coding Style introduced by
Inline PHP statement must end with a semicolon
Loading history...
985
					</div>
986
987
					<div class="field submit-button">
988
						<button class="search-submit btn" type="submit"><?php esc_html_e( 'Search', 'lsx-search' ); ?></button>
989
					</div>
990
				</div>
991
			</form>
992
		</div>
993
		<?php
994
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
995
996
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$facet" missing
Loading history...
997
	 * Display facet default.
998
	 */
999
	public function display_facet_default( $facet ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 blank lines after opening function brace; 1 found
Loading history...
1000
1001
		$show_collapse = ! isset( $this->options['display']['enable_collapse'] ) || 'on' !== $this->options['display']['enable_collapse'];
1002
		$col_class = '';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
1003
1004
		if ( 'search' === $this->facet_data[ $facet ]['type'] ) : ?>
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
Coding Style introduced by
Closing PHP tag must be on a line by itself
Loading history...
1005
			<?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?>
1006
		<?php else : ?>
1007
			<div class="col-xs-12 facetwp-item parent-facetwp-facet-<?php echo esc_html( $facet ); ?> <?php echo esc_attr( $col_class ); ?>">
1008
				<?php if ( ! $show_collapse ) { ?>
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
1009
					<div class="facetwp-collapsed">
1010
						<h3 class="lsx-search-title"><?php echo wp_kses_post( $this->facet_data[ $facet ]['label'] ); ?></h3>
1011
						<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>
1012
					</div>
1013
					<div id="collapse-<?php echo esc_html( $facet ); ?>" class="collapse">
1014
						<?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?>
1015
					</div>
1016
				<?php } else { ?>
1017
					<h3 class="lsx-search-title"><?php echo wp_kses_post( $this->facet_data[ $facet ]['label'] ); ?></h3>
1018
					<?php echo do_shortcode( '[facetwp facet="' . $facet . '"]' ); ?>
1019
				<?php } ?>
1020
			</div>
1021
		<?php
1022
		endif;
1023
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
1024
1025
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$class" missing
Loading history...
1026
	 * Changes slot column class.
1027
	 */
1028
	public function change_slot_column_class( $class ) {
1029
		if ( is_post_type_archive( 'video' ) || is_tax( 'video-category' ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
1030
			$column_class = 'col-xs-12 col-sm-4';
1031
		}
1032
1033
		return $column_class;
1034
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
1035
1036
	/**
1037
	 * Add post type label to the title.
1038
	 */
1039
	public function add_label_to_title() {
1040
		if ( is_search() ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
1041
			if ( ! empty( $this->options['display']['engine_search_enable_pt_label'] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
1042
				$post_type = get_post_type();
1043
				$post_type = str_replace( '_', ' ', $post_type );
1044
				$post_type = str_replace( '-', ' ', $post_type );
1045
				if ( 'tribe events' === $post_type ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
1046
					$post_type = 'Events';
1047
				}
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
1048
				echo wp_kses_post( ' <span class="label label-default lsx-label-post-type">' . $post_type . '</span>' );
1049
			}
1050
		}
1051
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
1052
1053
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$options" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$params" missing
Loading history...
1054
	 * Changes the sort options.
1055
	 */
1056
	public function facetwp_sort_options( $options, $params ) {
1057
		$this->set_vars();
1058
1059
		if ( true === $this->search_enabled ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
1060
			if ( 'default' !== $params['template_name'] && 'wp' !== $params['template_name'] ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
1061
				return $options;
1062
			}
1063
1064
			if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_date_sorting' ] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
1065
				unset( $options['date_desc'] );
1066
				unset( $options['date_asc'] );
1067
			}
1068
1069
			if ( ! empty( $this->options['display'][ $this->search_prefix . '_disable_az_sorting' ] ) ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces after opening bracket; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
1070
				unset( $options['title_desc'] );
1071
				unset( $options['title_asc'] );
1072
			}
1073
		}
1074
1075
		return $options;
1076
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
1077
1078
	/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$allowedtags" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$context" missing
Loading history...
1079
	 * @param $allowedtags
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
1080
	 * @param $context
0 ignored issues
show
Coding Style introduced by
Missing parameter name
Loading history...
1081
	 *
1082
	 * @return mixed
1083
	 */
1084
	public function kses_allowed_html( $allowedtags, $context ) {
1085
		$allowedtags['a']['data-value'] = true;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
1086
		$allowedtags['a']['data-selection']  = true;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 2 spaces

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
1087
		$allowedtags['button']['data-toggle'] = true;
1088
		return $allowedtags;
1089
	}
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
1090
}
1091