Issues (1030)

templates/content-widget-activity.php (32 issues)

1
<?php
2
/**
3
 * Activity Widget Content Part
4
 *
5
 * @package 	lsx-tour-operators
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
6
 * @category	activity
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
7
 * @subpackage	widget
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
8
 */
9
10
global $disable_placeholder, $disable_text, $post;
11
12
$has_single = ! lsx_to_is_single_disabled();
13
$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...
14
15
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...
16
	$permalink = get_the_permalink();
17
} elseif ( ! is_post_type_archive( 'activity' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
18
	$has_single = true;
19
	$permalink = get_post_type_archive_link( 'activity' ) . '#activity-' . $post->post_name;
0 ignored issues
show
Are you sure get_post_type_archive_link('activity') 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

19
	$permalink = /** @scrutinizer ignore-type */ get_post_type_archive_link( 'activity' ) . '#activity-' . $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...
20
}
21
?>
22
<article <?php post_class(); ?>>
23
	 <?php if ( empty( $disable_placeholder ) ) { ?>
0 ignored issues
show
Found precision alignment of 1 spaces.
Loading history...
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
24
		<div class="lsx-to-widget-thumb">
25
			<?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

25
			<?php if ( $has_single ) { ?><a href="<?php echo esc_url( /** @scrutinizer ignore-type */ $permalink ); ?>"><?php } ?>
Loading history...
26
				<?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?>
27
			<?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...
28
		</div>
29
	<?php } ?>
0 ignored issues
show
Closing brace indented incorrectly; expected 5 spaces, found 4
Loading history...
30
31
	<div class="lsx-to-widget-content">
32
		<h4 class="lsx-to-widget-title text-center">
33
			<?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...
34
				<?php the_title(); ?>
35
			<?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...
36
		</h4>
37
38
		<?php
39
			// if ( empty( $disable_text ) ) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
52% 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...
40
			// 	lsx_to_tagline( '<p class="lsx-to-widget-tagline text-center">', '</p>' );
0 ignored issues
show
Expected 1 space before comment text but found 2; use block comment if you need indentation
Loading history...
41
			// }
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
42
		?>
43
44
		<div class="lsx-to-widget-meta-data">
45
			<?php
46
				$meta_class = 'lsx-to-meta-data lsx-to-meta-data-';
47
48
				lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' );
49
				lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ', '</span>' );
50
				lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' );
51
				lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' );
52
			?>
53
		</div>
54
55
		<?php
56
			ob_start();
57
			lsx_to_widget_entry_content_top();
58
			the_excerpt();
59
			lsx_to_widget_entry_content_bottom();
60
			$excerpt = ob_get_clean();
61
62
			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...
63
				echo wp_kses_post( $excerpt );
64
			} 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...
65
				<p><a href="<?php echo esc_url( $permalink ); ?>" class="moretag"><?php esc_html_e( 'View more', 'lsx-activities' ); ?></a></p>
66
			<?php }
0 ignored issues
show
Opening PHP tag must be on a line by itself
Loading history...
67
		?>
68
	</div>
69
70
</article>
71