lightspeeddevelopment /
to-specials
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * Specials Widget Content Part |
||||
| 4 | * |
||||
| 5 | * @package tour-operators |
||||
| 6 | * @category special |
||||
| 7 | * @subpackage widget |
||||
| 8 | */ |
||||
| 9 | |||||
| 10 | global $disable_placeholder, $disable_text, $post; |
||||
| 11 | |||||
| 12 | $has_single = ! lsx_to_is_single_disabled(); |
||||
| 13 | $permalink = ''; |
||||
| 14 | $tour_operator = tour_operator(); |
||||
| 15 | |||||
| 16 | if ( $has_single ) { |
||||
| 17 | $permalink = get_the_permalink(); |
||||
| 18 | } elseif ( ! is_post_type_archive( 'special' ) ) { |
||||
| 19 | $has_single = true; |
||||
| 20 | $permalink = get_post_type_archive_link( 'special' ) . '#special-' . $post->post_name; |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 21 | } |
||||
| 22 | ?> |
||||
| 23 | <article <?php post_class(); ?>> |
||||
| 24 | <?php if ( empty( $disable_placeholder ) ) { ?> |
||||
| 25 | <div class="lsx-to-widget-thumb"> |
||||
| 26 | <?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...
|
|||||
| 27 | <?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?> |
||||
| 28 | <?php if ( $has_single ) { ?></a><?php } ?> |
||||
| 29 | </div> |
||||
| 30 | <?php } ?> |
||||
| 31 | |||||
| 32 | <div class="lsx-to-widget-content"> |
||||
| 33 | <h4 class="lsx-to-widget-title text-center"> |
||||
| 34 | <?php if ( $has_single ) { ?><a href="<?php echo esc_url( $permalink ); ?>"><?php } ?> |
||||
| 35 | <?php the_title(); ?> |
||||
| 36 | <?php if ( $has_single ) { ?></a><?php } ?> |
||||
| 37 | </h4> |
||||
| 38 | |||||
| 39 | <?php |
||||
| 40 | // if ( empty( $disable_text ) ) { |
||||
| 41 | // lsx_to_tagline( '<p class="lsx-to-widget-tagline text-center">', '</p>' ); |
||||
| 42 | // } |
||||
| 43 | ?> |
||||
| 44 | |||||
| 45 | <div class="lsx-to-widget-meta-data"> |
||||
| 46 | <?php |
||||
| 47 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
||||
| 48 | |||||
| 49 | lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
| 50 | lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
| 51 | lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
| 52 | the_terms( get_the_ID(), 'travel-style', '<span class="' . $meta_class . 'style"><span class="lsx-to-meta-data-key">' . __( 'Travel Style', 'to-specials' ) . ':</span> ', ', ', '</span>' ); |
||||
|
0 ignored issues
–
show
It seems like
get_the_ID() can also be of type false; however, parameter $post_id of the_terms() 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...
|
|||||
| 53 | the_terms( get_the_ID(), 'special-type', '<span class="' . $meta_class . 'special"><span class="lsx-to-meta-data-key">' . __( 'Type', 'to-specials' ) . ':</span> ', ', ', '</span>' ); |
||||
| 54 | lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
| 55 | lsx_to_specials_validity( '<span class="' . $meta_class . 'valid-from"><span class="lsx-to-meta-data-key">' . __( 'Booking Validity', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
| 56 | |||||
| 57 | if ( function_exists( 'lsx_to_connected_activities' ) ) { |
||||
| 58 | lsx_to_connected_activities( '<span class="' . $meta_class . 'activities"><span class="lsx-to-meta-data-key">' . __( 'Activites', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
| 59 | } |
||||
| 60 | ?> |
||||
| 61 | </div> |
||||
| 62 | |||||
| 63 | <?php |
||||
| 64 | ob_start(); |
||||
| 65 | lsx_to_widget_entry_content_top(); |
||||
| 66 | the_excerpt(); |
||||
| 67 | lsx_to_widget_entry_content_bottom(); |
||||
| 68 | $excerpt = ob_get_clean(); |
||||
| 69 | |||||
| 70 | if ( empty( $disable_text ) && ! empty( $excerpt ) ) { |
||||
| 71 | echo wp_kses_post( $excerpt ); |
||||
| 72 | } elseif ( $has_single && true !== $disable_view_more && '1' !== $disable_view_more ) { |
||||
| 73 | ?> |
||||
| 74 | <p class="moretag-wrapper"><a href="<?php echo esc_url( $permalink ); ?>" class="moretag"><?php esc_html_e( 'View more', 'tour-operator' ); ?></a></p> |
||||
| 75 | <?php |
||||
| 76 | } |
||||
| 77 | ?> |
||||
| 78 | </div> |
||||
| 79 | </article> |
||||
| 80 |