Issues (4138)

templates/tab-content-recipes.php (19 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 lsx_entry_before(); ?>
10
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
11
12
	<?php lsx_entry_top(); ?>
13
14
	<div class="entry-meta">
15
		<?php lsx_post_meta_single_bottom(); ?>
16
	</div><!-- .entry-meta -->
17
18
	<div class="entry-content">
19
		<?php
20
			//the_content();
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% 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...
No space found before comment text; expected "// the_content();" but found "//the_content();"
Loading history...
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
21
22
			wp_link_pages( array(
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
23
				'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
24
				'after'       => '</div></div>',
25
				'link_before' => '<span>',
26
				'link_after'  => '</span>',
27
			) );
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...
28
		?>
29
		<div class="single-plan-inner recipes-content">
30
			<div class="single-plan-section-title recipes-plan title-lined">
31
				<?php lsx_get_svg_icon( 'recipes.svg' ); ?>
32
				<h2><?php esc_html_e( 'Recipes', 'lsx-health-plan' ); ?> <span class="blue-title"><?php the_title(); ?></span></h2>
33
			</div>
34
			<div class="recipes">
35
			<div class="row eating-row">
36
			<?php
37
			$connected_recipes = get_post_meta( get_the_ID(), 'connected_recipes', 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

37
			$connected_recipes = get_post_meta( /** @scrutinizer ignore-type */ get_the_ID(), 'connected_recipes', true );
Loading history...
38
			if ( empty( $connected_recipes ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
39
				$options = \lsx_health_plan\functions\get_option( 'all' );
40
				if ( isset( $options['connected_recipes'] ) && '' !== $options['connected_recipes'] && ! empty( $options['connected_recipes'] ) ) {
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
					$connected_recipes = $options['connected_recipes'];
42
					if ( ! array( $connected_recipes ) ) {
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
						$connected_recipes = array( $connected_recipes );
44
					}
45
				}
46
			}
0 ignored issues
show
No blank line found after control structure
Loading history...
47
			$args    = array(
48
				'orderby'   => 'date',
49
				'order'     => 'DESC',
50
				'post_type' => 'recipe',
51
				'post__in'  => $connected_recipes,
52
			);
53
			$recipes = new WP_Query( $args );
54
55
			if ( $recipes->have_posts() ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
56
				while ( $recipes->have_posts() ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
57
					$recipes->the_post();
58
					$post_id = get_the_id();
59
60
					?>
61
					<div class="col-md-4 recipe-column">
62
						<div class="content-box box-shadow">
63
							<h3 class="recipe-title title-lined"><?php the_title(); ?></h3>
64
							<?php lsx_health_plan_recipe_data(); ?>
65
							<a href="<?php echo esc_url( get_permalink() ); ?>" class="btn btn-full"><?php esc_html_e( 'View Recipe', 'lsx-health-plan' ); ?></a>
0 ignored issues
show
It seems like get_permalink() can also be of type false; however, parameter $url of esc_url() 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

65
							<a href="<?php echo esc_url( /** @scrutinizer ignore-type */ get_permalink() ); ?>" class="btn btn-full"><?php esc_html_e( 'View Recipe', 'lsx-health-plan' ); ?></a>
Loading history...
66
						</div>
67
					</div>
68
				<?php
69
				}
70
			}
71
			?>
72
			<?php wp_reset_postdata(); ?>
73
			</div>
74
			</div>
75
		</div>
76
	</div><!-- .entry-content -->
77
78
	<?php lsx_entry_bottom(); ?>
79
80
</article><!-- #post-## -->
81
82
<?php
83