Issues (617)

templates/content-widget-vehicle.php (33 issues)

1
<?php
2
/**
3
 * Vehicle Widget Content Part
4
 *
5
 * @package    lsx-tour-operators
6
 * @category   vehicle
7
 * @subpackage widget
8
 */
0 ignored issues
show
There must be exactly one blank line after the file comment
Loading history...
9
global $disable_placeholder, $disable_text, $post;
10
11
$has_single = ! lsx_to_is_single_disabled();
12
$permalink = '';
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 2 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...
13
14
if ( $has_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...
15
	$permalink = get_the_permalink();
16
} elseif ( ! is_post_type_archive( 'vehicle' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
17
	$has_single = true;
18
	$permalink = get_post_type_archive_link( 'vehicle' ) . '#vehicle-' . $post->post_name;
0 ignored issues
show
Are you sure get_post_type_archive_link('vehicle') 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

18
	$permalink = /** @scrutinizer ignore-type */ get_post_type_archive_link( 'vehicle' ) . '#vehicle-' . $post->post_name;
Loading history...
Equals sign not aligned with surrounding assignments; expected 2 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...
19
}
20
?>
21
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
22
23
	<?php lsx_widget_entry_top(); ?>
24
25
	<?php if ( empty( $disable_placeholder ) ) { ?>
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
		<div class="lsx-to-widget-thumb">
27
			<?php if ( $has_single ) { ?><a href="<?php echo esc_url( $permalink ); ?>"><?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...
It seems like $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

27
			<?php if ( $has_single ) { ?><a href="<?php echo esc_url( /** @scrutinizer ignore-type */ $permalink ); ?>"><?php } ?>
Loading history...
28
				<?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?>
29
			<?php if ( $has_single ) { ?></a><?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...
30
		</div>
31
	<?php } ?>
32
33
	<div class="lsx-to-widget-content">
34
		<?php lsx_widget_entry_content_top(); ?>
35
36
		<h4 class="lsx-to-widget-title text-center">
37
			<?php if ( false !== $has_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...
38
				<a href="<?php echo esc_url( $permalink ); ?>"><?php } ?>
39
				<?php the_title(); ?>
40
			<?php if ( false !== $has_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...
41
				</a>
42
			<?php } ?>
43
		</h4>
44
45
		<div class="lsx-to-widget-meta-data">
46
			<?php
47
				$meta_class = 'lsx-to-meta-data lsx-to-meta-data-';
48
			?>
49
			<?php if ( false !== get_post_meta( get_the_ID(), 'vehicle_type', 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

49
			<?php if ( false !== get_post_meta( /** @scrutinizer ignore-type */ get_the_ID(), 'vehicle_type', true ) ) { ?>
Loading history...
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
50
				<div <?php echo 'class="' . esc_html( $meta_class ) . 'type"'; ?>><span class="lsx-to-meta-data-key"><?php esc_html_e( 'Type', 'to-vehicles' ); ?>:</span> <?php echo esc_attr( get_post_meta( get_the_ID(), 'vehicle_type', true ) ); ?></div>
0 ignored issues
show
It seems like get_post_meta(get_the_ID(), 'vehicle_type', true) can also be of type false; however, parameter $text of esc_attr() 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

50
				<div <?php echo 'class="' . esc_html( $meta_class ) . 'type"'; ?>><span class="lsx-to-meta-data-key"><?php esc_html_e( 'Type', 'to-vehicles' ); ?>:</span> <?php echo esc_attr( /** @scrutinizer ignore-type */ get_post_meta( get_the_ID(), 'vehicle_type', true ) ); ?></div>
Loading history...
51
			<?php } ?>
52
			<?php if ( false !== get_post_meta( get_the_ID(), 'seating', true ) ) { ?>
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
				<div <?php echo 'class="' . esc_html( $meta_class ) . 'seating"'; ?>><span class="lsx-to-meta-data-key"><?php esc_html_e( 'Seats', 'to-vehicles' ); ?>:</span> <?php echo esc_attr( get_post_meta( get_the_ID(), 'seating', true ) ); ?></div>
54
			<?php } ?>
55
			<?php if ( false !== get_post_meta( get_the_ID(), 'price', true ) ) { ?>
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
				<div <?php echo 'class="' . esc_html( $meta_class ) . 'price"'; ?>><span class="lsx-to-meta-data-key"><?php esc_html_e( 'Price Guide', 'to-vehicles' ); ?>:</span> <?php echo esc_attr( get_post_meta( get_the_ID(), 'price', true ) ); ?></div>
57
			<?php } ?>
58
		</div>
59
		<?php
60
			ob_start();
61
			lsx_to_widget_entry_content_top();
62
			the_excerpt();
63
			lsx_to_widget_entry_content_bottom();
64
			$excerpt = ob_get_clean();
65
66
			if ( empty( $disable_text ) && ! empty( $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...
67
				echo wp_kses_post( $excerpt );
68
			} elseif ( $has_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...
Closing PHP tag must be on a line by itself
Loading history...
69
				<p><a href="<?php echo esc_url( $permalink ); ?>" class="moretag"><?php esc_html_e( 'View more', 'tour-operator' ); ?></a></p>
70
			<?php
71
		}
0 ignored issues
show
Closing brace indented incorrectly; expected 12 spaces, found 8
Loading history...
72
		?>
73
		<?php lsx_widget_entry_content_bottom(); ?>
74
	</div>	
75
	<?php lsx_widget_entry_bottom(); ?>
76
77
</article>
78
<?php lsx_widget_entry_after(); ?>
79