1 | <?php |
||||
2 | /** |
||||
3 | * LSX_TO_Specials_Frontend |
||||
4 | * |
||||
5 | * @package LSX_TO_Specials_Frontend |
||||
6 | * @author LightSpeed |
||||
7 | * @license GPL-3.0+ |
||||
8 | * @link |
||||
9 | * @copyright 2018 LightSpeedDevelopment |
||||
10 | */ |
||||
11 | |||||
12 | /** |
||||
13 | * Main plugin class. |
||||
14 | * |
||||
15 | * @package LSX_Specials_Frontend |
||||
16 | * @author LightSpeed |
||||
17 | */ |
||||
18 | |||||
19 | class LSX_TO_Specials_Frontend extends LSX_TO_Specials { |
||||
20 | |||||
21 | /** |
||||
22 | * Holds the $page_links array while its being built on the single special page. |
||||
23 | * |
||||
24 | * @var array |
||||
25 | */ |
||||
26 | public $page_links = false; |
||||
27 | |||||
28 | /** |
||||
29 | * Constructor |
||||
30 | */ |
||||
31 | public function __construct() { |
||||
32 | $this->set_vars(); |
||||
33 | |||||
34 | add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); |
||||
35 | add_action( 'lsx_to_settings_current_tab', array( $this, 'set_settings_current_tab' ) ); |
||||
36 | add_action( 'init', array( $this, 'init' ) ); |
||||
37 | |||||
38 | if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { |
||||
39 | require_once( LSX_TO_SPECIALS_PATH . 'classes/class-template-redirects.php' ); |
||||
40 | } |
||||
41 | |||||
42 | $this->redirects = new LSX_TO_Template_Redirects( LSX_TO_SPECIALS_PATH, array_keys( $this->post_types ), array_keys( $this->taxonomies ) ); |
||||
43 | |||||
44 | add_action( 'lsx_special_content', array( $this->redirects, 'content_part' ), 10 , 2 ); |
||||
45 | |||||
46 | add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); |
||||
47 | |||||
48 | add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); |
||||
49 | add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); |
||||
50 | add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); |
||||
51 | add_action( 'lsx_to_fast_facts', array( $this, 'single_fast_facts' ) ); |
||||
52 | } |
||||
53 | |||||
54 | /** |
||||
55 | * Runs on init after all files have been parsed. |
||||
56 | */ |
||||
57 | public function init() { |
||||
58 | if ( ! class_exists( 'LSX_Currencies' ) ) { |
||||
59 | add_filter( 'lsx_to_custom_field_query', array( $this, 'price_filter' ), 5, 10 ); |
||||
60 | } |
||||
61 | |||||
62 | add_filter( 'lsx_to_custom_field_query', array( $this, 'terms_conditions_filter' ), 5, 10 ); |
||||
63 | } |
||||
64 | |||||
65 | /** |
||||
66 | * A filter to set the content area to a small column on single |
||||
67 | */ |
||||
68 | public function entry_class( $classes ) { |
||||
69 | global $lsx_to_archive; |
||||
70 | |||||
71 | if ( 1 !== $lsx_to_archive ) { |
||||
72 | $lsx_to_archive = false; |
||||
73 | } |
||||
74 | |||||
75 | if ( is_main_query() && is_singular( 'special' ) && false === $lsx_to_archive ) { |
||||
76 | $classes[] = 'col-xs-12 col-sm-12 col-md-6'; |
||||
77 | } |
||||
78 | |||||
79 | return $classes; |
||||
80 | } |
||||
81 | |||||
82 | /** |
||||
83 | * Sets the current tab selected. |
||||
84 | */ |
||||
85 | public function set_settings_current_tab( $settings_tab ) { |
||||
86 | if ( is_tax( array_keys( $this->taxonomies ) ) ) { |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
87 | $taxonomy = get_query_var( 'taxonomy' ); |
||||
88 | |||||
89 | if ( 'special-type' === $taxonomy ) { |
||||
90 | $settings_tab = 'special'; |
||||
91 | } |
||||
92 | } |
||||
93 | |||||
94 | return $settings_tab; |
||||
95 | } |
||||
96 | |||||
97 | /** |
||||
98 | * Adds in additional info for the price custom field |
||||
99 | */ |
||||
100 | public function price_filter( $html = '', $meta_key = false, $value = false, $before = '', $after = '' ) { |
||||
101 | if ( get_post_type() === 'special' && 'price' === $meta_key ) { |
||||
102 | $price_type = get_post_meta( get_the_ID(), 'price_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
![]() |
|||||
103 | $value = preg_replace( '/[^0-9,.]/', '', $value ); |
||||
104 | $value = ltrim( $value, '.' ); |
||||
105 | $value = str_replace( ', ', '', $value ); |
||||
106 | $value = number_format( (int) $value, 2 ); |
||||
107 | $tour_operator = tour_operator(); |
||||
108 | $currency = ''; |
||||
109 | |||||
110 | if ( is_object( $tour_operator ) && isset( $tour_operator->options['general'] ) && is_array( $tour_operator->options['general'] ) ) { |
||||
111 | if ( isset( $tour_operator->options['general']['currency'] ) && ! empty( $tour_operator->options['general']['currency'] ) ) { |
||||
112 | $currency = $tour_operator->options['general']['currency']; |
||||
113 | $currency = '<span class="currency-icon ' . mb_strtolower( $currency ) . '">' . $currency . '</span>'; |
||||
114 | } |
||||
115 | } |
||||
116 | |||||
117 | switch ( $price_type ) { |
||||
118 | case 'per_person': |
||||
119 | case 'per_person_per_night': |
||||
120 | case 'per_person_sharing': |
||||
121 | case 'per_person_sharing_per_night': |
||||
122 | $value = $currency . $value . ' ' . ucwords( str_replace( '_', ' ', $price_type ) ) . ''; |
||||
123 | $value = str_replace( 'Per Person', 'P/P', $value ); |
||||
124 | break; |
||||
125 | |||||
126 | case 'total_percentage': |
||||
127 | $value .= '% ' . __( 'Off', 'to-specials' ) . ''; |
||||
128 | $before = str_replace( 'from price', '', $before ); |
||||
129 | break; |
||||
130 | |||||
131 | case 'none': |
||||
132 | default: |
||||
133 | $value = $currency . $value; |
||||
134 | break; |
||||
135 | } |
||||
136 | |||||
137 | $html = $before . $value . $after; |
||||
138 | } |
||||
139 | |||||
140 | return $html; |
||||
141 | } |
||||
142 | |||||
143 | /** |
||||
144 | * Filters text area type filters |
||||
145 | */ |
||||
146 | public function terms_conditions_filter( $html = '', $meta_key = false, $value = false, $before = '', $after = '' ) { |
||||
147 | if ( get_post_type() === 'special' && 'terms_conditions' === $meta_key ) { |
||||
148 | $html = $before . '<div class="entry-content">' . apply_filters( 'the_content', wpautop( $value ) ) . '</div>' . $after; |
||||
149 | |||||
150 | } |
||||
151 | |||||
152 | return $html; |
||||
153 | } |
||||
154 | |||||
155 | /** |
||||
156 | * Adds our navigation links to the special single post |
||||
157 | * |
||||
158 | * @param $page_links array |
||||
159 | * @return $page_links array |
||||
0 ignored issues
–
show
|
|||||
160 | */ |
||||
161 | public function page_links( $page_links ) { |
||||
162 | if ( is_singular( 'special' ) ) { |
||||
163 | $this->page_links = $page_links; |
||||
164 | |||||
165 | $this->get_map_link(); |
||||
166 | $this->get_gallery_link(); |
||||
167 | $this->get_videos_link(); |
||||
168 | $this->get_terms_and_conditions_link(); |
||||
169 | |||||
170 | $this->get_related_posts_link(); |
||||
171 | |||||
172 | $page_links = $this->page_links; |
||||
173 | } |
||||
174 | |||||
175 | return $page_links; |
||||
176 | } |
||||
177 | |||||
178 | /** |
||||
179 | * Tests for the Google Map and returns a link for the section |
||||
180 | */ |
||||
181 | public function get_map_link() { |
||||
182 | if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) { |
||||
183 | $this->page_links['special-map'] = esc_html__( 'Map', 'to-specials' ); |
||||
184 | } |
||||
185 | } |
||||
186 | |||||
187 | /** |
||||
188 | * Tests for the Gallery and returns a link for the section |
||||
189 | */ |
||||
190 | public function get_gallery_link() { |
||||
191 | $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); |
||||
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
![]() |
|||||
192 | $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); |
||||
193 | |||||
194 | if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { |
||||
195 | if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { |
||||
196 | // Envira Gallery |
||||
197 | $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-specials' ); |
||||
198 | return; |
||||
199 | } else { |
||||
200 | if ( function_exists( 'envira_dynamic' ) ) { |
||||
201 | // Envira Gallery - Dynamic |
||||
202 | $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-specials' ); |
||||
203 | return; |
||||
204 | } else { |
||||
205 | // WordPress Gallery |
||||
206 | $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-specials' ); |
||||
207 | return; |
||||
208 | } |
||||
209 | } |
||||
210 | } |
||||
211 | } |
||||
212 | |||||
213 | /** |
||||
214 | * Tests for the Videos and returns a link for the section |
||||
215 | */ |
||||
216 | public function get_videos_link() { |
||||
217 | $videos_id = false; |
||||
218 | |||||
219 | if ( class_exists( 'Envira_Videos' ) ) { |
||||
220 | $videos_id = get_post_meta( get_the_ID(), 'envira_video', 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
![]() |
|||||
221 | } |
||||
222 | |||||
223 | if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { |
||||
224 | $videos_id = get_post_meta( get_the_ID(), 'videos', true ); |
||||
225 | } |
||||
226 | |||||
227 | if ( ! empty( $videos_id ) ) { |
||||
228 | $this->page_links['videos'] = esc_html__( 'Videos', 'to-specials' ); |
||||
229 | } |
||||
230 | } |
||||
231 | |||||
232 | /** |
||||
233 | * Tests for the Related Posts and returns a link for the section |
||||
234 | */ |
||||
235 | public function get_related_posts_link() { |
||||
236 | $connected_posts = get_post_meta( get_the_ID(), 'post_to_special', false ); |
||||
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
![]() |
|||||
237 | |||||
238 | if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { |
||||
239 | $connected_posts = new \WP_Query( array( |
||||
240 | 'post_type' => 'post', |
||||
241 | 'post__in' => $connected_posts, |
||||
242 | 'post_status' => 'publish', |
||||
243 | 'nopagin' => true, |
||||
244 | 'posts_per_page' => '-1', |
||||
245 | 'fields' => 'ids', |
||||
246 | ) ); |
||||
247 | |||||
248 | $connected_posts = $connected_posts->posts; |
||||
249 | |||||
250 | if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { |
||||
251 | $this->page_links['posts'] = esc_html__( 'Posts', 'to-specials' ); |
||||
252 | } |
||||
253 | } |
||||
254 | } |
||||
255 | |||||
256 | /** |
||||
257 | * Tests for the Term and Conditions and returns a link for the section |
||||
258 | */ |
||||
259 | public function get_terms_and_conditions_link() { |
||||
260 | $terms_conditions = get_post_meta( get_the_ID(), 'terms_conditions', 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
![]() |
|||||
261 | |||||
262 | if ( ! empty( $terms_conditions ) ) { |
||||
263 | $this->page_links['terms-and-conditions'] = esc_html__( 'Terms and Conditions', 'to-specials' ); |
||||
264 | } |
||||
265 | } |
||||
266 | |||||
267 | /** |
||||
268 | * Adds the template tags to the top of the archive special |
||||
269 | */ |
||||
270 | public function archive_entry_top() { |
||||
271 | global $lsx_to_archive; |
||||
272 | |||||
273 | if ( 'special' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { |
||||
274 | if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> |
||||
275 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-grid-mode"> |
||||
276 | <?php |
||||
277 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
||||
278 | |||||
279 | lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
280 | lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
281 | lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
282 | 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
![]() |
|||||
283 | the_terms( get_the_ID(), 'special-type', '<span class="' . $meta_class . 'type"><span class="lsx-to-meta-data-key">' . __( 'Type', 'to-specials' ) . ':</span> ', ', ', '</span>' ); |
||||
284 | lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
285 | lsx_to_specials_validity( '<span class="' . $meta_class . 'valid-from"><span class="lsx-to-meta-data-key">' . __( 'Booking Validity', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
286 | lsx_to_travel_dates( '<span class="' . $meta_class . 'travel-dates"><span class="lsx-to-meta-data-key">' . __( 'Travel Dates', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
287 | |||||
288 | if ( function_exists( 'lsx_to_connected_activities' ) ) { |
||||
289 | lsx_to_connected_activities( '<span class="' . $meta_class . 'activities"><span class="lsx-to-meta-data-key">' . __( 'Activites', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
290 | } |
||||
291 | ?> |
||||
292 | </div> |
||||
293 | <?php } |
||||
294 | } |
||||
295 | } |
||||
296 | |||||
297 | /** |
||||
298 | * Adds the template tags to the bottom of the archive special |
||||
299 | */ |
||||
300 | public function archive_entry_bottom() { |
||||
301 | global $lsx_to_archive; |
||||
302 | |||||
303 | if ( 'special' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { ?> |
||||
304 | </div> |
||||
305 | |||||
306 | <?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> |
||||
307 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-list-mode"> |
||||
308 | <?php |
||||
309 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
||||
310 | |||||
311 | lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
312 | lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
313 | lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
314 | 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
![]() |
|||||
315 | the_terms( get_the_ID(), 'special-type', '<span class="' . $meta_class . 'type"><span class="lsx-to-meta-data-key">' . __( 'Type', 'to-specials' ) . ':</span> ', ', ', '</span>' ); |
||||
316 | lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
317 | lsx_to_specials_validity( '<span class="' . $meta_class . 'valid-from"><span class="lsx-to-meta-data-key">' . __( 'Booking Validity', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
318 | lsx_to_travel_dates( '<span class="' . $meta_class . 'travel-dates"><span class="lsx-to-meta-data-key">' . __( 'Travel Dates', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
319 | |||||
320 | if ( function_exists( 'lsx_to_connected_activities' ) ) { |
||||
321 | lsx_to_connected_activities( '<span class="' . $meta_class . 'activities"><span class="lsx-to-meta-data-key">' . __( 'Activites', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
322 | } |
||||
323 | ?> |
||||
324 | </div> |
||||
325 | <?php } ?> |
||||
326 | </div> |
||||
327 | |||||
328 | <?php $has_single = ! lsx_to_is_single_disabled(); ?> |
||||
329 | |||||
330 | <?php if ( $has_single && 'grid' === tour_operator()->archive_layout ) : ?> |
||||
331 | <a href="<?php the_permalink(); ?>" class="moretag"><?php esc_html_e( 'View more', 'to-specials' ); ?></a> |
||||
332 | <?php endif; ?> |
||||
333 | <?php } |
||||
334 | } |
||||
335 | |||||
336 | /** |
||||
337 | * Adds the template tags fast facts |
||||
338 | */ |
||||
339 | public function single_fast_facts() { |
||||
340 | if ( is_singular( 'special' ) ) { ?> |
||||
341 | <section id="fast-facts"> |
||||
342 | <div class="lsx-to-section-inner"> |
||||
343 | <h3 class="lsx-to-section-title"><?php esc_html_e( 'Special Summary', 'to-specials' ); ?></h3> |
||||
344 | |||||
345 | <div class="lsx-to-single-meta-data"> |
||||
346 | <?php |
||||
347 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
||||
348 | |||||
349 | // lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
42% 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. ![]() |
|||||
350 | lsx_to_specials_validity( '<span class="' . $meta_class . 'valid-from"><span class="lsx-to-meta-data-key">' . esc_html__( 'Booking Validity', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
351 | lsx_to_travel_dates( '<span class="' . $meta_class . 'travel-dates"><span class="lsx-to-meta-data-key">' . esc_html__( 'Travel Dates', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
352 | the_terms( get_the_ID(), 'travel-style', '<span class="' . $meta_class . 'style"><span class="lsx-to-meta-data-key">' . esc_html__( '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
![]() |
|||||
353 | the_terms( get_the_ID(), 'special-type', '<span class="' . $meta_class . 'type"><span class="lsx-to-meta-data-key">' . esc_html__( 'Type', 'to-specials' ) . ':</span> ', ', ', '</span>' ); |
||||
354 | lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . esc_html__( 'Tours', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
355 | lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . esc_html__( 'Accommodation', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
356 | lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . esc_html__( 'Destinations', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
357 | |||||
358 | if ( function_exists( 'lsx_to_connected_activities' ) ) { |
||||
359 | lsx_to_connected_activities( '<span class="' . $meta_class . 'activities"><span class="lsx-to-meta-data-key">' . esc_html__( 'Activites', 'to-specials' ) . ':</span> ', '</span>' ); |
||||
360 | } |
||||
361 | ?> |
||||
362 | </div> |
||||
363 | </div> |
||||
364 | </section> |
||||
365 | <?php } |
||||
366 | } |
||||
367 | |||||
368 | /** |
||||
369 | * Adds the template tags to the bottom of the single special |
||||
370 | */ |
||||
371 | public function single_content_bottom() { |
||||
372 | if ( is_singular( 'special' ) ) { |
||||
373 | if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) : ?> |
||||
374 | <section id="special-map" class="lsx-to-section lsx-to-collapse-section"> |
||||
375 | <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title hidden-lg" data-toggle="collapse" data-target="#collapse-special-map"><?php esc_html_e( 'Map', 'to-specials' ); ?></h2> |
||||
376 | |||||
377 | <div id="collapse-special-map" class="collapse in"> |
||||
378 | <div class="collapse-inner"> |
||||
379 | <?php lsx_to_map(); ?> |
||||
380 | </div> |
||||
381 | </div> |
||||
382 | </section> |
||||
383 | <?php |
||||
384 | endif; |
||||
385 | |||||
386 | lsx_to_gallery( '<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__( 'Gallery', 'to-specials' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
||||
387 | |||||
388 | if ( function_exists( 'lsx_to_videos' ) ) { |
||||
389 | lsx_to_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-specials' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
||||
390 | } elseif ( class_exists( 'Envira_Videos' ) ) { |
||||
391 | lsx_to_envira_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-specials' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
||||
392 | } |
||||
393 | |||||
394 | $terms_conditions = get_post_meta( get_the_ID(), 'terms_conditions', 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
![]() |
|||||
395 | |||||
396 | if ( false !== $terms_conditions && '' !== $terms_conditions ) { ?> |
||||
397 | <section id="terms-and-conditions" class="lsx-to-section lsx-to-collapse-section"> |
||||
398 | <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-terms-and-conditions"><?php esc_html_e( 'Terms and Conditions', 'to-specials' ); ?></h2> |
||||
399 | |||||
400 | <div id="collapse-terms-and-conditions" class="collapse in"> |
||||
401 | <div class="collapse-inner"> |
||||
402 | <div class="row"> |
||||
403 | <div class="col-xs-12"> |
||||
404 | <?php lsx_to_specials_terms_conditions(); ?> |
||||
405 | </div> |
||||
406 | </div> |
||||
407 | </div> |
||||
408 | </div> |
||||
409 | </section> |
||||
410 | <?php } |
||||
411 | |||||
412 | lsx_to_special_posts(); |
||||
413 | } |
||||
414 | } |
||||
415 | |||||
416 | } |
||||
417 | |||||
418 | new LSX_TO_Specials_Frontend(); |
||||
419 |