Issues (1223)

classes/class-lsx-team-frontend.php (148 issues)

1
<?php
2
/**
3
 * LSX Team Frontend Class
4
 *
5
 * @package   LSX Team
6
 * @author    LightSpeed
7
 * @license   GPL3
8
 * @link
9
 * @copyright 2018 LightSpeed
10
 */
11
12
namespace lsx_team\classes;
13
14
class LSX_Team_Frontend {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for class LSX_Team_Frontend
Loading history...
15
16
	/**
17
	 * Holds the previous role, so we know when to output a new title.
18
	 */
0 ignored issues
show
Coding Style Documentation introduced by
Missing @var tag in member variable comment
Loading history...
19
	var $previous_role = '';
0 ignored issues
show
The visibility should be declared for property $previous_role.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
20
21
22
	public function __construct() {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for function __construct()
Loading history...
Expected 0 blank lines after opening function brace; 1 found
Loading history...
23
24
		$this->options = team_get_options();
0 ignored issues
show
Bug Best Practice introduced by
The property options does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
25
26
		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5 );
27
		add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 );
28
		add_filter( 'template_include', array( $this, 'single_template_include' ), 99 );
29
		add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 );
30
31
		if ( ! empty( $this->options['display']['team_disable_single'] ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
32
			add_action( 'template_redirect', array( $this, 'disable_single' ) );
33
		}
34
35
		if ( ! empty( $this->options['display']['group_by_role'] ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
36
			add_action( 'pre_get_posts', array( $this, 'pre_get_posts_order_by_role' ) );
37
			add_action( 'lsx_entry_before', array( $this, 'entry_before' ) );
38
		}
39
40
		add_action( 'pre_get_posts', array( $this, 'disable_pagination_on_archive' ) );
41
42
		if ( is_admin() ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
43
			add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 );
44
		}
45
46
		add_filter( 'lsx_fonts_css', array( $this, 'customizer_fonts_handler' ), 15 );
47
		add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_archive_title' ), 15 );
48
		add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_single_title' ), 15 );
49
		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
50
51
		add_filter( 'excerpt_more_p', array( $this, 'change_excerpt_more' ) );
52
		add_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ) );
53
		add_filter( 'excerpt_strip_tags', array( $this, 'change_excerpt_strip_tags' ) );
54
55
		add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 );
56
	}
0 ignored issues
show
Expected 2 blank lines after function; 1 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
57
58
	/**
59
	 * Return an instance of this class.
60
	 *
61
	 * @since 1.0.0
62
	 *
63
	 * @return    object lsx_team\classes    A single instance of this class.
64
	 */
65
	public static function get_instance() {
66
		// If the single instance hasn't been set, set it now.
67
		if ( null === self::$instance ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
68
			self::$instance = new self();
0 ignored issues
show
Bug Best Practice introduced by
The property instance does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
69
		}
0 ignored issues
show
No blank line found after control structure
Loading history...
70
		return self::$instance;
71
	}
0 ignored issues
show
Expected 2 blank lines after function; 1 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
72
73
	public function enqueue_scripts( $plugins ) {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for function enqueue_scripts()
Loading history...
74
		$has_slick = wp_script_is( 'slick', 'queue' );
75
76
		if ( ! $has_slick ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
77
			wp_enqueue_style( 'slick', LSX_TEAM_URL . 'assets/css/vendor/slick.css', array(), LSX_TEAM_VER, null );
78
			wp_enqueue_script( 'slick', LSX_TEAM_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, LSX_TEAM_VER, true );
0 ignored issues
show
lsx_team\classes\LSX_TEAM_VER of type string is incompatible with the type boolean expected by parameter $in_footer of wp_enqueue_script(). ( Ignorable by Annotation )

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

78
			wp_enqueue_script( 'slick', LSX_TEAM_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, /** @scrutinizer ignore-type */ LSX_TEAM_VER, true );
Loading history...
The call to wp_enqueue_script() has too many arguments starting with true. ( Ignorable by Annotation )

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

78
			/** @scrutinizer ignore-call */ 
79
   wp_enqueue_script( 'slick', LSX_TEAM_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, LSX_TEAM_VER, true );

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...
Resource version not set in call to wp_enqueue_script(). This means new versions of the script will not always be loaded due to browser caching.
Loading history...
79
		}
80
81
		wp_enqueue_script( 'lsx-team', LSX_TEAM_URL . 'assets/js/lsx-team.min.js', array( 'jquery', 'slick' ), LSX_TEAM_VER, true );
82
83
		$params = apply_filters( 'lsx_team_js_params', array(
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
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...
84
			'ajax_url' => admin_url( 'admin-ajax.php' ),
85
		));
0 ignored issues
show
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...
86
87
		wp_localize_script( 'lsx-team', 'lsx_team_params', $params );
88
89
		wp_enqueue_style( 'lsx-team', LSX_TEAM_URL . 'assets/css/lsx-team.css', array(), LSX_TEAM_VER );
90
		wp_style_add_data( 'lsx-team', 'rtl', 'replace' );
91
	}
0 ignored issues
show
Expected 2 blank lines after function; 1 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
92
93
	/**
0 ignored issues
show
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...
94
	 * Allow data params for Slick slider addon.
95
	 */
96
	public function wp_kses_allowed_html( $allowedtags, $context ) {
97
		$allowedtags['div']['data-slick'] = true;
98
		return $allowedtags;
99
	}
0 ignored issues
show
Expected 2 blank lines after function; 1 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
100
101
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$template" missing
Loading history...
102
	 * Single template.
103
	 */
104
	public function single_template_include( $template ) {
105
		if ( is_main_query() && is_singular( 'team' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
106
			if ( empty( locate_template( array( 'single-team.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/single-team.php' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
107
				$template = LSX_TEAM_PATH . 'templates/single-team.php';
108
			}
109
		}
110
111
		return $template;
112
	}
0 ignored issues
show
Expected 2 blank lines after function; 1 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
113
114
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$template" missing
Loading history...
115
	 * Archive template.
116
	 */
117
	public function archive_template_include( $template ) {
118
		if ( is_main_query() && is_post_type_archive( 'team' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
119
			if ( empty( locate_template( array( 'archive-team.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/archive-team.php' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
120
				$template = LSX_TEAM_PATH . 'templates/archive-team.php';
121
			}
122
		}
123
124
		if ( is_tax( 'team_role' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
125
			if ( empty( locate_template( array( 'taxonomy-team_role.php' ) ) ) && file_exists( LSX_TEAM_PATH . 'templates/taxonomy-team_role.php' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
126
				$template = LSX_TEAM_PATH . 'templates/taxonomy-team_role.php';
127
			}
128
		}
129
130
		return $template;
131
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
132
133
	/**
134
	 * Removes access to single team member posts.
135
	 */
136
	public function disable_single() {
137
		$queried_post_type = get_query_var( 'post_type' );
138
139
		if ( is_single() && 'team' === $queried_post_type ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
140
			wp_redirect( home_url(), 301 );
0 ignored issues
show
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...
141
			exit;
0 ignored issues
show
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...
142
		}
143
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
144
145
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$query" missing
Loading history...
146
	 * Disable pagination.
147
	 */
148
	public function disable_pagination_on_archive( $query ) {
149
		if ( $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
150
			$query->set( 'posts_per_page', -1 );
151
			$query->set( 'no_found_rows', true );
152
		}
153
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
154
155
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$css_fonts" missing
Loading history...
156
	 * Handle fonts that might be change by LSX Customiser.
157
	 */
158
	public function customizer_fonts_handler( $css_fonts ) {
159
		global $wp_filesystem;
160
161
		$css_fonts_file = LSX_TEAM_PATH . '/assets/css/lsx-team-fonts.css';
162
163
		if ( file_exists( $css_fonts_file ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
164
			if ( empty( $wp_filesystem ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
165
				require_once( ABSPATH . 'wp-admin/includes/file.php' );
0 ignored issues
show
"require_once" is a statement not a function; no parentheses are required
Loading history...
166
				WP_Filesystem();
167
			}
168
169
			if ( $wp_filesystem ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
170
				$css_fonts .= $wp_filesystem->get_contents( $css_fonts_file );
171
			}
172
		}
173
174
		return $css_fonts;
175
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
176
177
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$css" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$colors" missing
Loading history...
178
	 * Handle body colours that might be change by LSX Customiser.
179
	 */
180
	public function customizer_body_colours_handler( $css, $colors ) {
181
		$css .= '
182
			@import "' . LSX_TEAM_PATH . '/assets/css/scss/customizer-team-body-colours";
183
184
			/**
185
			 * LSX Customizer - Body (LSX Team)
186
			 */
187
			@include customizer-team-body-colours (
188
				$bg:   		' . $colors['background_color'] . ',
189
				$breaker:   ' . $colors['body_line_color'] . ',
190
				$color:    	' . $colors['body_text_color'] . ',
191
				$link:    	' . $colors['body_link_color'] . ',
192
				$hover:    	' . $colors['body_link_hover_color'] . ',
193
				$small:    	' . $colors['body_text_small_color'] . '
194
			);
195
		';
196
197
		return $css;
198
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
199
200
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$title" missing
Loading history...
201
	 * Change the LSX Banners title for team archive.
202
	 */
203
	public function lsx_banner_archive_title( $title ) {
204
		if ( is_main_query() && is_post_type_archive( 'team' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
205
			$title = '<h1 class="page-title">' . esc_html__( 'Team', 'lsx-team' ) . '</h1>';
206
		}
207
208
		return $title;
209
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
210
211
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$title" missing
Loading history...
212
	 * Change the LSX Banners title for team single.
213
	 */
214
	public function lsx_banner_single_title( $title ) {
215
		if ( is_main_query() && is_singular( 'team' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
216
			$title = '<h1 class="page-title">' . esc_html__( 'Team', 'lsx-team' ) . '</h1>';
217
		}
218
219
		return $title;
220
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
221
222
	/**
223
	 * Remove the "Archives:" from the post type recipes.
224
	 *
225
	 * @param string $title the term title.
226
	 * @return string
227
	 */
228
	public function get_the_archive_title( $title ) {
229
		if ( is_post_type_archive( 'team' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
230
			$title = __( 'Team', 'lsx-health-plan' );
231
		}
0 ignored issues
show
No blank line found after control structure
Loading history...
232
		return $title;
233
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
234
235
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$excerpt_more" missing
Loading history...
236
	 * Remove the "continue reading" when the single is disabled.
237
	 */
238
	public function change_excerpt_more( $excerpt_more ) {
239
		global $post;
240
241
		if ( 'team' === $post->post_type ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
242
			if ( ! empty( team_get_option( 'team_disable_single' ) ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
243
				$excerpt_more = '';
244
			}
245
		}
246
247
		return $excerpt_more;
248
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
249
250
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$excerpt_word_count" missing
Loading history...
251
	 * Change the word count when crop the content to excerpt (single team relations).
252
	 */
253
	public function change_excerpt_length( $excerpt_word_count ) {
254
		global $post;
255
256
		if ( is_singular( 'team' ) && ( 'project' === $post->post_type || 'testimonial' === $post->post_type ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
257
			$excerpt_word_count = 20;
258
		}
259
260
		return $excerpt_word_count;
261
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
262
263
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$allowed_tags" missing
Loading history...
264
	 * Change the allowed tags crop the content to excerpt (single team relations).
265
	 */
266
	public function change_excerpt_strip_tags( $allowed_tags ) {
267
		global $post;
268
269
		if ( is_singular( 'team' ) && ( 'project' === $post->post_type || 'testimonial' === $post->post_type ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
270
			$allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>';
271
		}
272
273
		return $allowed_tags;
274
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
275
276
	/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$query" missing
Loading history...
277
	 * @param $query \WP_Query()
0 ignored issues
show
Missing parameter name
Loading history...
278
	 *
279
	 * @return mixed
280
	 */
281
	public function pre_get_posts_order_by_role( $query ) {
282
		if ( ! is_admin() && $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
283
			$post_ids = $this->order_by_role_query();
284
			if ( ! empty( $post_ids ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
285
				$query->set( 'post__in', $post_ids );
286
				$query->set( 'orderby', 'post__in' );
287
			}
288
		}
0 ignored issues
show
No blank line found after control structure
Loading history...
289
		return $query;
290
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
291
292
	/**
293
	 * Grabs the team members ordered by the Roles Slug and the title alphabetical
294
	 */
295
	public function order_by_role_query() {
296
		global $wpdb;
297
		$post_ids = array();
298
299
		$results = $wpdb->get_results( $wpdb->prepare("
0 ignored issues
show
Usage of a direct database call is discouraged.
Loading history...
Direct database call without caching detected. Consider using wp_cache_get() / wp_cache_set() or wp_cache_delete().
Loading history...
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
300
			SELECT posts.ID, posts.post_title, terms.slug
301
			FROM {$wpdb->posts} AS posts
302
			INNER JOIN {$wpdb->term_relationships} as rels
303
			INNER JOIN {$wpdb->term_taxonomy} as tax
304
			INNER JOIN {$wpdb->terms} as terms
305
			WHERE posts.post_type = '%s'
0 ignored issues
show
Simple placeholders should not be quoted in the query string in $wpdb->prepare(). Found: '%s'.
Loading history...
306
			AND posts.post_status = '%s'
0 ignored issues
show
Simple placeholders should not be quoted in the query string in $wpdb->prepare(). Found: '%s'.
Loading history...
307
			AND posts.ID = rels.object_id
308
			AND rels.term_taxonomy_id = tax.term_taxonomy_id
309
			AND tax.taxonomy = '%s'
0 ignored issues
show
Simple placeholders should not be quoted in the query string in $wpdb->prepare(). Found: '%s'.
Loading history...
310
			AND tax.term_id = terms.term_id
311
			ORDER BY terms.lsx_team_term_order, posts.post_name
312
         ", 'team', 'publish', 'team_role' ) );
0 ignored issues
show
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...
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...
313
314
		if ( ! empty( $results ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
315
			$post_ids = wp_list_pluck( $results, 'ID' );
316
		}
0 ignored issues
show
No blank line found after control structure
Loading history...
317
		return $post_ids;
318
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
319
320
321
	/**
322
	 * Outputs the Role Title if its found
323
	 */
324
	public function entry_before() {
325
		if ( is_post_type_archive( 'team' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
326
			$all_roles    = wc_get_object_terms( get_the_ID(), 'team_role' );
0 ignored issues
show
The function wc_get_object_terms 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

326
			$all_roles    = /** @scrutinizer ignore-call */ wc_get_object_terms( get_the_ID(), 'team_role' );
Loading history...
327
			$this_role    = '';
328
			$this_role_id = '';
329
			if ( ! empty( $all_roles ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
330
				$this_role    = $all_roles[0];
331
				$this_role_id = $this_role->term_id;
332
			}
333
334
			if ( '' === $this->previous_role || $this->previous_role !== $this_role_id ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
335
				echo '<h2 class="role-title text-center col-xs-12 col-sm-12 col-md-12">' . wp_kses_post( $this_role->name ) . '</h2>';
336
				$this->previous_role = $this_role_id;
337
			}
338
		}
339
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 0 found
Loading history...
340
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$pieces" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$context" missing
Loading history...
341
	 * Adds Pieces
342
	 */
343
	public function add_graph_pieces( $pieces, $context ) {
344
		// Scheme Class.
345
		if ( class_exists( 'LSX_Schema_Graph_Piece' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
346
			require_once LSX_TEAM_PATH . '/classes/class-lsx-team-schema.php';
347
			$pieces[] = new \LSX_Team_Schema( $context );
348
		}
0 ignored issues
show
No blank line found after control structure
Loading history...
349
		return $pieces;
350
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 0 found
Loading history...
351
}
352
353
$lsx_team_frontend = new LSX_Team_Frontend();
354