lightspeeddevelopment /
to-vehicles
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * Vehicle Widget Content Part |
||||
| 4 | * |
||||
| 5 | * @package lsx-tour-operators |
||||
| 6 | * @category vehicle |
||||
| 7 | * @subpackage widget |
||||
| 8 | */ |
||||
| 9 | global $disable_placeholder, $disable_text, $post; |
||||
| 10 | |||||
| 11 | $has_single = ! lsx_to_is_single_disabled(); |
||||
| 12 | $permalink = ''; |
||||
| 13 | |||||
| 14 | if ( $has_single ) { |
||||
| 15 | $permalink = get_the_permalink(); |
||||
| 16 | } elseif ( ! is_post_type_archive( 'vehicle' ) ) { |
||||
| 17 | $has_single = true; |
||||
| 18 | $permalink = get_post_type_archive_link( 'vehicle' ) . '#vehicle-' . $post->post_name; |
||||
|
0 ignored issues
–
show
Bug
introduced
by
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 ) ) { ?> |
||||
| 26 | <div class="lsx-to-widget-thumb"> |
||||
| 27 | <?php if ( $has_single ) { ?><a href="<?php echo esc_url( $permalink ); ?>"><?php } ?> |
||||
|
0 ignored issues
–
show
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
Loading history...
|
|||||
| 28 | <?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?> |
||||
| 29 | <?php if ( $has_single ) { ?></a><?php } ?> |
||||
| 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 ) { ?> |
||||
| 38 | <a href="<?php echo esc_url( $permalink ); ?>"><?php } ?> |
||||
| 39 | <?php the_title(); ?> |
||||
| 40 | <?php if ( false !== $has_single ) { ?> |
||||
| 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
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
Loading history...
|
|||||
| 51 | <?php } ?> |
||||
| 52 | <?php if ( false !== get_post_meta( get_the_ID(), 'seating', true ) ) { ?> |
||||
| 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 ) ) { ?> |
||||
| 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 ) ) { |
||||
| 67 | echo wp_kses_post( $excerpt ); |
||||
| 68 | } elseif ( $has_single ) { ?> |
||||
| 69 | <p><a href="<?php echo esc_url( $permalink ); ?>" class="moretag"><?php esc_html_e( 'View more', 'tour-operator' ); ?></a></p> |
||||
| 70 | <?php |
||||
| 71 | } |
||||
| 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 |