Issues (4138)

templates/content-archive-exercise.php (31 issues)

1
<?php
2
/**
3
 * Template used to display post content on widgets and archive 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
global $shortcode_args;
8
9
?>
10
11
<?php lsx_entry_before(); ?>
12
13
<?php
14
$content_setting = 'excerpt';
15
$column_class    = '4';
16
$link_html       = '';
17
$link_close      = '';
18
19
// Check for shortcode overrides.
20
if ( null !== $shortcode_args ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
21
	if ( isset( $shortcode_args['columns'] ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
22
		$column_class = $shortcode_args['columns'];
23
		$column_class = \lsx_health_plan\functions\column_class( $column_class );
24
	}
0 ignored issues
show
No blank line found after control structure
Loading history...
25
	if ( isset( $shortcode_args['link'] ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
26
		$link_setting = $shortcode_args['link'];
27
		// Setup our link and content.
28
		switch ( $link_setting ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
29
			case 'single':
30
				$link_html  = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">';
0 ignored issues
show
Are you sure get_permalink($group['connected_exercises']) of type false|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

30
				$link_html  = '<a href="' . /** @scrutinizer ignore-type */ get_permalink( $group['connected_exercises'] ) . '">';
Loading history...
31
				$link_close = '</a>';
32
				break;
33
34
			case 'modal':
35
				$link_html  = '<a class="btn border-btn" data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">';
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 13 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...
36
				$link_close = '</a>';
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 12 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...
37
				$modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' );
38
				$modal_args = array(
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 12 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...
39
					'modal_content' => $modal_content_setting,
40
				);
41
				// We call the button to register the modal, but we do not output it.
42
				lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args );
43
				break;
44
45
			case 'none':
46
			default:
47
				$link_html  = '';
48
				$link_close = '';
49
				break;
50
		}
51
	}
0 ignored issues
show
No blank line found after control structure
Loading history...
52
	if ( isset( $shortcode_args['description'] ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
53
		$content_setting = $shortcode_args['description'];
54
	}
55
}
56
57
?>
58
59
<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_class ); ?> has-content-<?php echo esc_attr( $content_setting ); ?>">
60
	<article class="lsx-slot box-shadow">
61
		<?php lsx_entry_top(); ?>
62
63
		<div class="exercise-feature-img">
64
			<a href="<?php echo esc_url( get_permalink() ); ?>">
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

64
			<a href="<?php echo esc_url( /** @scrutinizer ignore-type */ get_permalink() ); ?>">
Loading history...
65
			<?php
66
			$featured_image = get_the_post_thumbnail();
67
			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...
68
				the_post_thumbnail( 'lsx-thumbnail-square', 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...
69
					'class' => 'aligncenter',
70
				) );
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...
71
			} else {
72
				?>
73
				<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>">
74
				<?php
75
			}
76
			?>
77
			</a>
78
		</div>
79
		<div class="content-box exercise-content-box white-bg">
80
			<div class="title-lined">
81
				<?php lsx_health_plan_exercise_title( '<h3 class="exercise-title">', '</h3>' ); ?>
82
				<?php lsx_health_plan_exercise_data(); ?>
83
			</div>
84
			<?php
85
			if ( '' !== $content_setting && 'excerpt' === $content_setting ) {
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
				if ( ! has_excerpt() ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
87
					$content = wp_trim_words( get_the_content(), 20 );
88
					$content = '<p>' . $content . '</p>';
89
				} else {
90
					$content = apply_filters( 'the_excerpt', get_the_excerpt() );
91
				}
0 ignored issues
show
No blank line found after control structure
Loading history...
92
				echo wp_kses_post( $content );
93
			}
0 ignored issues
show
No blank line found after control structure
Loading history...
94
			if ( '' !== $content_setting && 'full' === $content_setting ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
95
				the_content();
96
			}
97
			?>
98
			<a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See exercise', 'lsx-health-plan' ); ?></a>
99
		</div>
100
		<?php lsx_entry_bottom(); ?>
101
	</article>
102
</div>
103
104
<?php
105
lsx_entry_after();
106