Issues (4138)

templates/content-exercise.php (29 issues)

1
<?php
2
/**
3
 * Template used to display post content on single pages.
4
 *
5
 * @package lsx-health-plan
6
 */
7
8
$exercise_type = lsx_health_plan_exercise_type();
9
$equipment     = lsx_health_plan_exercise_equipment();
10
$muscle_group  = lsx_health_plan_muscle_group_equipment();
11
12
// Getting translated endpoint.
13
$exercise = \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' );
14
15
$connected_members  = get_post_meta( get_the_ID(), ( $exercise . '_connected_team_member' ), true );
0 ignored issues
show
Are you sure $exercise of type array|mixed 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

15
$connected_members  = get_post_meta( get_the_ID(), ( /** @scrutinizer ignore-type */ $exercise . '_connected_team_member' ), true );
Loading history...
It seems like get_the_ID() can also be of type false; however, parameter $post_id of get_post_meta() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

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

15
$connected_members  = get_post_meta( /** @scrutinizer ignore-type */ get_the_ID(), ( $exercise . '_connected_team_member' ), true );
Loading history...
16
$connected_articles = get_post_meta( get_the_ID(), ( $exercise . '_connected_articles' ), true );
17
18
$sharing = 'sharing-disabled';
19
if ( class_exists( 'LSX_Sharing' ) || ( function_exists( 'sharing_display' ) || class_exists( 'Jetpack_Likes' ) ) ) :
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
20
	$sharing = 'sharing-enabled';
21
endif;
22
23
?>
24
25
<?php lsx_entry_before(); ?>
26
27
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
28
29
	<?php lsx_entry_top(); ?>
30
31
	<div class="entry-meta">
32
		<?php lsx_post_meta_single_bottom(); ?>
33
	</div><!-- .entry-meta -->
34
35
	<div id="single-exercise" class="entry-content">
36
37
		<div class="exercise-title-section title-lined <?php echo esc_html( $sharing ); ?>">
38
			<?php if ( class_exists( 'LSX_Sharing' ) || ( function_exists( 'sharing_display' ) || class_exists( 'Jetpack_Likes' ) ) ) : ?>
0 ignored issues
show
Blank line found at start of control structure
Loading history...
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
39
40
					<?php
41
					if ( class_exists( 'LSX_Sharing' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
42
						lsx_content_sharing();
43
					} else {
44
						if ( function_exists( 'sharing_display' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
45
							sharing_display( '', true );
46
						}
47
48
						if ( class_exists( 'Jetpack_Likes' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
49
							$custom_likes = new Jetpack_Likes();
0 ignored issues
show
The type Jetpack_Likes 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...
50
							echo wp_kses_post( $custom_likes->post_likes( '' ) );
51
						}
52
					}
53
					?>
54
			<?php endif ?>
55
56
			<?php lsx_health_plan_exercise_title( '<h2>', '</h2>', false ); ?>
57
		</div>
58
		<?php echo wp_kses_post( lsx_hp_member_connected( $connected_members, 'exercise' ) ); ?>
0 ignored issues
show
lsx_hp_member_connected(...ed_members, 'exercise') of type void is incompatible with the type string expected by parameter $data of wp_kses_post(). ( Ignorable by Annotation )

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

58
		<?php echo wp_kses_post( /** @scrutinizer ignore-type */ lsx_hp_member_connected( $connected_members, 'exercise' ) ); ?>
Loading history...
59
		<div class="row">
60
			<div class="col-md-6 exercise-image lsx-hp-shadow">
61
62
			<?php
63
			$lsx_hp = lsx_health_plan();
64
65
			if ( $lsx_hp->frontend->gallery->has_gallery( get_the_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...
66
				lsx_health_plan_gallery();
67
			} else {
68
				$featured_image = get_the_post_thumbnail();
69
				if ( ! empty( $featured_image ) && '' !== $featured_image ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
70
					the_post_thumbnail( 'large', 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...
71
						'class' => 'aligncenter',
72
					) );
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...
73
				} else {
74
					?>
75
					<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>">
76
					<?php
77
				}
78
			}
79
			?>
80
81
				<?php if ( ( ! empty( $exercise_type ) ) || ( ! empty( $equipment ) ) || ( ! empty( $muscle_group ) ) ) { ?>
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
82
					<div class="exercise-data">
83
						<?php lsx_health_plan_exercise_data(); ?>
84
					</div>
85
				<?php } ?>
86
			</div>
87
			<div class="col-md-6 exercise-content">
88
				<?php the_content(); ?>
89
				<?php echo do_shortcode( '[lsx_health_plan_featured_tips_block]' ); ?>
90
				<div  class="back-plan-btn">
91
				<?php
92
				if ( function_exists( 'wc_get_page_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...
93
					?>
94
					<a class="btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'Back to my plans', 'lsx-health-plan' ); ?></a>
0 ignored issues
show
It seems like get_permalink(wc_get_page_id('myaccount')) can also be of type false; however, parameter $data of wp_kses_post() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

94
					<a class="btn" href="<?php echo wp_kses_post( /** @scrutinizer ignore-type */ get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'Back to my plans', 'lsx-health-plan' ); ?></a>
Loading history...
95
					<?php
96
				}
97
				?>
98
				</div>
99
			</div>
100
		</div>
101
	</div><!-- .entry-content -->
102
103
	<?php lsx_entry_bottom(); ?>
104
105
</article><!-- #post-## -->
106
107
<?php
108
if ( ! empty( $connected_articles ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
109
	lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) );
110
}
111
?>
112
113
<?php
114
lsx_entry_after();
115