Issues (4138)

templates/content-recipe.php (25 issues)

1
<?php
2
/**
3
 * Template used to display post content on single pages.
4
 *
5
 * @package lsx-health-plan
6
 */
0 ignored issues
show
There must be exactly one blank line after the file comment
Loading history...
7
?>
8
9
<?php
10
$prep_time     = get_post_meta( get_the_ID(), 'recipe_prep_time', true );
0 ignored issues
show
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

10
$prep_time     = get_post_meta( /** @scrutinizer ignore-type */ get_the_ID(), 'recipe_prep_time', true );
Loading history...
11
$cooking_time  = get_post_meta( get_the_ID(), 'recipe_cooking_time', true );
12
$serves        = get_post_meta( get_the_ID(), 'recipe_serves', true );
13
$portion       = get_post_meta( get_the_ID(), 'recipe_portion', true );
14
$energy        = get_post_meta( get_the_ID(), 'recipe_energy', true );
15
$protein       = get_post_meta( get_the_ID(), 'recipe_protein', true );
16
$carbohydrates = get_post_meta( get_the_ID(), 'recipe_carbohydrates', true );
17
$fibre         = get_post_meta( get_the_ID(), 'recipe_fibre', true );
18
$fat           = get_post_meta( get_the_ID(), 'recipe_fat', true );
19
20
21
// Getting translated endpoint.
22
$recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' );
23
24
$connected_members  = get_post_meta( get_the_ID(), ( $recipe . '_connected_team_member' ), true );
0 ignored issues
show
Are you sure $recipe 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

24
$connected_members  = get_post_meta( get_the_ID(), ( /** @scrutinizer ignore-type */ $recipe . '_connected_team_member' ), true );
Loading history...
25
$connected_articles = get_post_meta( get_the_ID(), ( $recipe . '_connected_articles' ), true );
26
?>
27
28
<?php lsx_entry_before(); ?>
29
30
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
31
32
	<?php lsx_entry_top(); ?>
33
34
	<div class="entry-meta">
35
		<?php lsx_post_meta_single_bottom(); ?>
36
	</div><!-- .entry-meta -->
37
38
	<div id="single-recipe" class="entry-content">
39
		<h2 class="title-lined"><?php the_title(); ?>
40
		<?php 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...
41
			<div class="post-sharing-wrapper">
42
43
				<?php
44
				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...
45
					lsx_content_sharing();
46
				} else {
47
					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...
48
						sharing_display( '', true );
49
					}
50
51
					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...
52
						$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...
53
						echo wp_kses_post( $custom_likes->post_likes( '' ) );
54
					}
55
				}
56
				?>
57
		<?php endif ?>
58
		</h2>
59
		<?php echo wp_kses_post( lsx_hp_member_connected( $connected_members, 'recipe' ) ); ?>
0 ignored issues
show
lsx_hp_member_connected(...cted_members, 'recipe') 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

59
		<?php echo wp_kses_post( /** @scrutinizer ignore-type */ lsx_hp_member_connected( $connected_members, 'recipe' ) ); ?>
Loading history...
60
		<div class="row">
61
			<div class="col-md-6 recipe-image lsx-hp-shadow">
62
				<?php
63
				$featured_image = get_the_post_thumbnail();
64
				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...
65
					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...
66
						'class' => 'aligncenter',
67
					) );
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...
68
				} else {
69
					?>
70
					<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>">
71
					<?php
72
				}
73
				?>
74
				<?php if ( ( ! empty( $prep_time ) ) || ( ! empty( $cooking_time ) ) || ( ! empty( $serves ) ) || ( ! empty( $portion ) ) || ( ! empty( $energy ) ) || ( ! empty( $protein ) ) || ( ! empty( $carbohydrates ) ) || ( ! empty( $fibre ) ) || ( ! empty( $fat ) ) ) { ?>
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
75
				<div class="recipe-data">
76
					<?php lsx_health_plan_recipe_data(); ?>
77
				</div>
78
				<?php } ?>
79
			</div>
80
			<div class="col-md-6 recipe-content">
81
				<?php the_content(); ?>
82
				<?php echo do_shortcode( '[lsx_health_plan_featured_tips_block]' ); ?>
83
				<div class="back-plan-btn">
84
				<?php
85
				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...
86
					?>
87
					<a class="btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'Back To My Plan', '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

87
					<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 Plan', 'lsx-health-plan' ); ?></a>
Loading history...
88
					<?php
89
				}
90
				?>
91
				</div>
92
			</div>
93
		</div>
94
95
	</div><!-- .entry-content -->
96
97
	<?php lsx_entry_bottom(); ?>
98
99
</article><!-- #post-## -->
100
101
<?php
102
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...
103
	lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) );
104
}
105
?>
106
107
<?php
108
lsx_entry_after();
109