PluginProbe
Yatra – Travel Booking & Tour Operator Software / 2.0.11
Yatra – Travel Booking & Tour Operator Software v2.0.11
3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 2.0.11 All 82 releases
yatra / includes / template-tags.php

template-tags.php in Yatra – Travel Booking & Tour Operator Software 2.0.11, at includes/template-tags.php

1,039 lines 29.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined('ABSPATH') || exit;
4 if (!function_exists('yatra_get_taxonomy_term_lists')) {
5 function yatra_get_taxonomy_term_lists($post_id, $taxonomy = '')
6 {
7 /* translators: used between list items, there is a space after the comma. */
8 $terms = get_the_term_list($post_id, $taxonomy, '', __(', ', 'yatra'));
9
10 if ($terms) {
11 printf(
12 /* translators: 1: Taxonomy name 2: SVG icon. 3: posted in label, only visible to screen readers.*/
13 '<span class="cat-links %1$s-links"><span class="screen-reader-text">%2$s</span>%3$s</span>',
14 ($taxonomy),
15 ucwords($taxonomy),
16 $terms
17 ); // WPCS: XSS OK.
18 }
19
20 // /* translators: used between list items, there is a space after the comma. */
21 // $tags_list = get_the_tag_list('', __(', ', 'yatra'));
22 // if ($tags_list) {
23 // printf(
24 // /* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of tags. */
25 // '<span class="tags-links">%1$s<span class="screen-reader-text">%2$s </span>%3$s</span>',
26 // yatra_get_icon_svg('tag', 16),
27 // __('Tags:', 'yatra'),
28 // $tags_list
29 // ); // WPCS: XSS OK.
30 // }
31 }
32 }
33
34 if (!function_exists('yatra_entry_header')) {
35
36 function yatra_entry_header()
37 {
38 ?>
39 <header class="entry-header">
40 <?php
41 if (is_sticky() && is_home() && !is_paged()) {
42 printf('<span class="sticky-post">%s</span>', _x('Featured', 'post', 'yatra'));
43 }
44 if (is_singular()) :
45 the_title('<h1 class="entry-title">', '</h1>');
46 else :
47 the_title(sprintf('<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>');
48 endif;
49 ?>
50 <div class="entry-meta">
51 <?php
52 yatra_get_taxonomy_term_lists(get_the_ID(), 'destination');
53 ?></div>
54 </header><!-- .entry-header -->
55 <?php
56 }
57 }
58
59 if (!function_exists('yatra_post_thumbnail')) {
60
61 function yatra_post_thumbnail($size = "post-thumbnail")
62 {
63 ?>
64 <figure class="post-thumbnail">
65 <a class="post-thumbnail-inner" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
66 <?php the_post_thumbnail($size); ?>
67 </a>
68 </figure>
69 <?php
70 }
71 }
72
73 if (!function_exists('yatra_entry_post_content')) {
74
75 function yatra_entry_post_content()
76 {
77 ?>
78 <div class="entry-content">
79 <?php
80 the_excerpt();
81 ?>
82 </div><!-- .entry-content -->
83 <?php
84 }
85 }
86
87 if (!function_exists('yatra_entry_footer')) {
88
89 function yatra_entry_footer()
90 {
91 ?>
92 <div class="entry-footer">
93 <?php
94 yatra_posted_by();
95 yatra_posted_on();
96 yatra_get_taxonomy_term_lists(get_the_ID(), 'destination'); ?>
97 </div>
98 <?php
99 }
100 }
101
102 if (!function_exists('yatra_get_current_currency_symbol')) {
103 function yatra_get_current_currency_symbol()
104 {
105 $currency = get_option('yatra_currency');
106
107 $currency_symbol = yatra_get_currency_symbols($currency);
108
109 return $currency_symbol;
110 }
111 }
112
113 if (!function_exists('yatra_entry_meta_for_frontend_archive')) {
114
115 function yatra_entry_meta_for_frontend_archive($post_id)
116 {
117
118 $currency_symbol = yatra_get_current_currency_symbol();
119
120 $regular_yatra_tour_meta_regular_price = get_post_meta($post_id, 'yatra_tour_meta_regular_price', true);
121
122 $yatra_tour_meta_sales_price = get_post_meta($post_id, 'yatra_tour_meta_sales_price', true);
123
124 $yatra_tour_meta_tour_country = get_post_meta($post_id, 'yatra_tour_meta_tour_country', true);
125
126 $yatra_tour_meta_regular_price_string = $currency_symbol . $regular_yatra_tour_meta_regular_price;
127
128 if ((int)$yatra_tour_meta_sales_price > 0) {
129
130 $yatra_tour_meta_regular_price_string = '<del>' . $yatra_tour_meta_regular_price_string . '</del> &nbsp;' . $currency_symbol . $yatra_tour_meta_sales_price;;
131
132 }
133
134 $yatra_tour_meta_tour_fixed_departure = get_post_meta($post_id, 'yatra_tour_meta_tour_fixed_departure', true);
135
136 if ((boolean)$yatra_tour_meta_tour_fixed_departure && !is_null($yatra_tour_meta_tour_fixed_departure)) {
137 $tour_duration = '{{yatra_tour_meta_tour_start_date}} to {{yatra_tour_meta_tour_end_date}}';
138 } else {
139 $tour_duration = '{{yatra_tour_meta_tour_duration_days}} days and {{yatra_tour_meta_tour_duration_nights}} nights';
140 }
141
142 $meta_frontend = array(
143 array(
144 'icon' => 'fa fa-user',
145 'text' => '{{yatra_tour_meta_price_per}}',
146 'title' => __('Price Per', 'yatra')
147
148 ), array(
149 'icon' => 'fa fa-user-circle',
150 'text' => '{{yatra_tour_meta_group_size}}',
151 'title' => __('Group Size', 'yatra')
152
153 ),
154 array(
155 'icon' => 'fa fa-clock-o',
156 'text' => $tour_duration,
157 'title' => __('Duration', 'yatra')
158
159 ),
160
161 );
162 if (!empty($yatra_tour_meta_tour_country)) {
163
164 $country_string = '';
165
166
167 foreach ($yatra_tour_meta_tour_country as $country_item) {
168
169 $country = yatra_get_countries($country_item);
170
171
172 $country_string .= $country . ', ';
173 }
174 $country_string = trim($country_string, ', ');
175
176 $meta_frontend[] =
177 array(
178 'icon' => 'fa fa-map',
179 'text' => $country_string,
180 'title' => __('Country', 'yatra')
181
182 );
183
184 }
185
186 return apply_filters(
187 'yatra_entry_meta_frontend',
188 $meta_frontend
189 );
190
191 }
192 }
193
194 if (!function_exists('yatra_entry_meta_options')) {
195
196 function yatra_entry_meta_options($post_id = 0)
197 {
198 $post_id = $post_id > 0 ? $post_id : get_the_id();
199
200 $meta_frontend = yatra_entry_meta_for_frontend_archive($post_id);
201
202 $list = '';
203
204 foreach ($meta_frontend as $value) {
205
206 $icon = isset($value['icon']) ? $value['icon'] : '';
207
208 $text = isset($value['text']) ? $value['text'] : '';
209
210 $title = isset($value['title']) ? $value['title'] : '';
211
212 preg_match_all("~\{\{\s*(.*?)\s*\}\}~", $text, $matches);
213
214 $matches = isset($matches[1]) ? $matches[1] : array();
215
216 foreach ($matches as $match) {
217
218 $text_id = sanitize_text_field($match);
219
220 $text_option = get_post_meta($post_id, $text_id, true);
221
222 $text = str_replace('{{' . $match . '}}', $text_option, $text);
223 }
224
225 $list .= '<li><i class="' . esc_attr($icon) . '"></i>&nbsp;<strong>' . esc_html($title) . ': </strong>' . ($text) . '</li>';
226 }
227 echo '<ul class="yatra-tour-meta-options">';
228
229 echo $list;
230
231 echo '</ul>';
232
233 }
234 }
235 if (!function_exists('yatra_tour_tab_configurations')) {
236
237 function yatra_tour_tab_configurations()
238 {
239
240 $tab_config = array(
241 'overview' => array(
242 'label' => __('Overview', 'yatra'),
243 'icon' => 'fa fa-atom',
244 'options' =>
245 array(
246 'overview_label' => array(
247 'name' => 'overview_label',
248 'title' => __('Label Text', 'yatra'),
249 'type' => 'text',
250 'default' => __('Overview', 'yatra'),
251 ),
252 'overview_description' => array(
253 'name' => 'overview_description',
254 'title' => __('Overview Description', 'yatra'),
255 'type' => 'textarea',
256 'editor' => true
257 )
258 ),
259
260 ),
261 'itinerary' => array(
262 'label' => __('Itinerary', 'yatra'),
263 'icon' => 'fa fa-gopuram',
264 'options' =>
265 array(
266 'itinerary_label' => array(
267 'name' => 'itinerary_label',
268 'title' => __('Label', 'yatra'),
269 'type' => 'text',
270 'default' => __('Itinerary', 'yatra'),
271
272 ),
273 'itinerary_repeator' => array(
274 'name' => 'itinerary_repeator',
275 'type' => 'repeator',
276 'options' => array(
277 array(
278 'itinerary_heading' => array(
279 'name' => 'itinerary_heading',
280 'title' => __('Heading', 'yatra'),
281 'type' => 'text',
282 'default' => __('Day {index} ', 'yatra'),
283 'class' => 'mb-repeator-heading-input',
284 ),
285 'itinerary_title' => array(
286 'name' => 'itinerary_title',
287 'title' => __('Title', 'yatra'),
288 'type' => 'text',
289 ),
290 'itinerary_details' => array(
291 'name' => 'itinerary_details',
292 'title' => __('Details', 'yatra'),
293 'type' => 'textarea',
294 'editor' => true
295 )
296 )
297 )
298 )
299
300 )
301 ),
302 'cost_info' => array(
303 'label' => __('Cost Info', 'yatra'),
304 'icon' => 'fa fa-dollar-sign',
305 'options' =>
306 array(
307 'cost_info_label' => array(
308 'name' => 'cost_info_label',
309 'title' => __('Label', 'yatra'),
310 'type' => 'text',
311 'default' => __('Cost Info', 'yatra'),
312 ),
313 'cost_info_price_includes_title' => array(
314 'name' => 'cost_info_price_includes_title',
315 'title' => __('Price includes title', 'yatra'),
316 'type' => 'text',
317 'default' => __('Price includes', 'yatra'),
318 ),
319 'cost_info_price_includes_description' => array(
320 'name' => 'cost_info_price_includes_description',
321 'title' => __('Price include description', 'yatra'),
322 'type' => 'textarea',
323 'description' => __('Type enter to show in new list.', 'yatra'),
324 'editor' => true
325 ),
326 'cost_info_price_excludes_title' => array(
327 'name' => 'cost_info_price_excludes_title',
328 'title' => __('Price excludes title', 'yatra'),
329 'type' => 'text',
330 'default' => __('Price excludes', 'yatra'),
331 ),
332 'cost_info_price_excludes_description' => array(
333 'name' => 'cost_info_price_excludes_description',
334 'title' => __('Price excludes description', 'yatra'),
335 'type' => 'textarea',
336 'description' => __('Type enter to show in new list.', 'yatra'),
337 'editor' => true
338 )
339 ),
340 ),
341 'faq' => array(
342 'label' => __('FAQ', 'yatra'),
343 'icon' => 'fa fa-comment-dots',
344 'options' =>
345 array(
346 'faq_label' => array(
347 'name' => 'faq_label',
348 'title' => __('Label', 'yatra'),
349 'type' => 'text',
350 'default' => __('FAQ', 'yatra'),
351
352 ),
353 'faq_repeator' => array(
354 'name' => 'faq_repeator',
355 'type' => 'repeator',
356 'options' => array(
357 array(
358 'faq_heading' => array(
359 'name' => 'faq_heading',
360 'title' => __('FAQ Heading', 'yatra'),
361 'type' => 'text',
362 'default' => __('FAQ {index} ', 'yatra'),
363 'class' => 'mb-repeator-heading-input'
364 ),
365 'faq_description' => array(
366 'name' => 'faq_description',
367 'title' => __('Description', 'yatra'),
368 'type' => 'textarea',
369 'editor' => true
370 )
371 )
372 )
373 )
374
375 )
376
377 ),
378 'map' => array(
379 'label' => __('Map', 'yatra'),
380 'icon' => 'fa fa-directions',
381 'options' =>
382 array(
383 'map_label' => array(
384 'name' => 'map_label',
385 'title' => __('Label', 'yatra'),
386 'type' => 'text',
387 'default' => __('Map', 'yatra'),
388
389 ),
390 'yatra_tour_meta_map_content' => array(
391 'name' => 'yatra_tour_meta_map_content',
392 'title' => __('Map Content', 'yatra'),
393 'type' => 'textarea',
394 'editor' => true,
395 'allow-html' => true
396 )
397 ),
398 ),
399 'gallery' => array(
400 'label' => __('Gallery', 'yatra'),
401 'icon' => 'fa fa-images',
402 'options' =>
403 array(
404 'gallery_label' => array(
405 'name' => 'gallery_label',
406 'title' => __('Label', 'yatra'),
407 'type' => 'text',
408 'default' => __('Gallery', 'yatra'),
409
410 ),
411 'yatra_tour_meta_gallery' => array(
412 'name' => 'yatra_tour_meta_gallery',
413 'title' => __('Gallery', 'yatra'),
414 'type' => 'gallery',
415 )
416 ),
417 ),
418 );
419 return apply_filters('yatra_tour_tab_configurations', $tab_config);
420 }
421 }
422
423
424 if (!function_exists('yatra_tour_attribute_type_options')) {
425
426 function yatra_tour_attribute_type_options()
427 {
428
429 $tour_attributes = array(
430
431 'text_field' => array(
432 'label' => __('Text Field', 'yatra'),
433 'options' =>
434 array(
435 'content' => array(
436 'name' => 'content',
437 'title' => __('Content', 'yatra'),
438 'placeholder' => __('Default value for text field.', 'yatra'),
439 'description' => __('Default value for text field.', 'yatra'),
440 'type' => 'text',
441
442
443 )
444 ),
445 ),
446 'number_field' => array(
447 'label' => __('Number Field', 'yatra'),
448 'options' =>
449 array(
450
451 'content' => array(
452 'name' => 'content',
453 'title' => __('Default value for number field.', 'yatra'),
454 'placeholder' => __('Default value for number field.', 'yatra'),
455 'description' => __('Default value for number field.', 'yatra'),
456 'type' => 'number',
457 )
458 ),
459 ),
460 'textarea_field' => array(
461 'label' => __('Textarea Field', 'yatra'),
462 'options' =>
463 array(
464
465 'content' => array(
466 'name' => 'content',
467 'title' => __('Default value for textarea field.', 'yatra'),
468 'placeholder' => __('Default value for textarea field.', 'yatra'),
469 'description' => __('Default value for textarea field.', 'yatra'),
470 'type' => 'textarea',
471
472 )
473 ),
474 ),
475 'shortcode_field' => array(
476 'label' => __('Shortcode Field', 'yatra'),
477 'options' =>
478 array(
479 'shortcode' => array(
480 'name' => 'shortcode',
481 'title' => __('Shortcode', 'yatra'),
482 'placeholder' => __('Default value for text field.', 'yatra'),
483 'description' => __('Default value for text field.', 'yatra'),
484 'type' => 'shortcode',
485 'wrap_class' => 'yatra-left',
486
487
488 )
489 ),
490 ),
491 /* 'dropdown_field' => array(
492 'label' => __('Dropdown Field', 'yatra'),
493 'options' =>
494 array(
495 'content' => array(
496 'name' => 'content',
497 'title' => __('Default value for select(drop-down) field. Enter drop-down values separated by commas.', 'yatra'),
498 'placeholder' => __('Default value for select(drop-down) field. Enter drop-down values separated by commas.', 'yatra'),
499 'description' => __('Default value for select(drop-down) field. Enter drop-down values separated by commas.', 'yatra'),
500 'type' => 'textarea',
501
502
503
504 )
505 ),
506 )*/
507 );
508 return apply_filters('yatra_tour_attribute_type_options', $tour_attributes);
509 }
510 }
511
512
513 if (!function_exists('yatra_tour_attributes_list')) {
514 function yatra_tour_attributes_list()
515 {
516 $terms = get_terms(array(
517 'taxonomy' => 'attributes',
518 'hide_empty' => false
519
520 ));
521
522 $fields = array();
523
524 $number_of_tour_attributes = apply_filters('number_of_tour_attributes', 5);
525
526 foreach ($terms as $term_key => $term_value) {
527 if (isset($term_value->term_id)) {
528 $fields[$term_value->term_id] = $term_value->name;
529 if (count($fields) === $number_of_tour_attributes && $number_of_tour_attributes !== -1) {
530 break;
531 }
532 }
533 }
534
535 return $fields;
536
537 }
538 }
539 if (!function_exists('yatra_tour_attributes')) {
540 function yatra_tour_attributes()
541 {
542 $tour_attributes = array(
543 array(
544 'name' => 'tour_attributes',
545 'title' => sprintf(__('Tour Attributes', 'yatra')),
546 'type' => 'select',
547 'options' => yatra_tour_attributes_list(),
548 ),
549 array(
550 'name' => 'add_tour_attribute',
551 'type' => 'button',
552 'default' => sprintf(__('Add New', 'yatra')),
553
554 )
555 );
556 return apply_filters('yatra_tour_attributes', $tour_attributes);
557 }
558 }
559
560
561 if (!function_exists('yatra_tour_general_configurations')) {
562
563 function yatra_tour_general_configurations()
564 {
565
566 $countries = yatra_get_countries();
567
568 $tour_options = array(
569 'yatra_tour_meta_tour_fixed_departure' => array(
570 'name' => 'yatra_tour_meta_tour_fixed_departure',
571 'title' => esc_html__('Fixed Departure', 'yatra'),
572 'type' => 'switch',
573 //'wrap_class' => 'yatra-right',
574 //'row_end' => true,
575
576 ),
577 'yatra_tour_meta_tour_start_date' => array(
578 'name' => 'yatra_tour_meta_tour_start_date',
579 'title' => esc_html__('Start Date', 'yatra'),
580 'description' => esc_html__('Start Date', 'yatra'),
581 'type' => 'date',
582 // 'wrap_class' => 'yatra-left',
583 'extra_attributes' => array(
584 'placeholder' => __('Tour Start Date', 'yatra'),
585 ),
586 'visibility_condition' => array(
587 'yatra_tour_meta_tour_fixed_departure' => true
588 )
589 //'row_start' => true,
590
591 ),
592 'yatra_tour_meta_tour_end_date' => array(
593 'name' => 'yatra_tour_meta_tour_end_date',
594 'title' => esc_html__('End Date', 'yatra'),
595 'description' => esc_html__('End Date', 'yatra'),
596 'type' => 'date',
597 // 'wrap_class' => 'yatra-left',
598 'extra_attributes' => array(
599 'placeholder' => __('Tour End Date', 'yatra'),
600 ),
601 'visibility_condition' => array(
602 'yatra_tour_meta_tour_fixed_departure' => true
603 )
604 //'row_start' => true,
605
606 ), 'yatra_tour_meta_tour_duration_days' => array(
607 'name' => 'yatra_tour_meta_tour_duration_days',
608 'title' => esc_html__('Tour Duration Days', 'yatra'),
609 'description' => esc_html__('Total duration days for this tour', 'yatra'),
610 'type' => 'number',
611 // 'wrap_class' => 'yatra-left',
612 'extra_attributes' => array(
613 'placeholder' => __('Number of days', 'yatra'),
614 ),
615 'visibility_condition' => array(
616 'yatra_tour_meta_tour_fixed_departure' => false
617 )
618
619
620 //'row_start' => true,
621
622 ),
623 'yatra_tour_meta_tour_duration_nights' => array(
624 'name' => 'yatra_tour_meta_tour_duration_nights',
625 'title' => esc_html__('Tour Duration Nights', 'yatra'),
626 'type' => 'number',
627 //'wrap_class' => 'yatra-right',
628 'extra_attributes' => array(
629 'placeholder' => __('Number of nights', 'yatra'),
630 ),
631 'visibility_condition' => array(
632 'yatra_tour_meta_tour_fixed_departure' => false
633 )
634 ///'row_end' => true,
635
636 ),
637 'yatra_tour_meta_tour_country' => array(
638 'name' => 'yatra_tour_meta_tour_country',
639 'title' => esc_html__('Country', 'yatra'),
640 'type' => 'select',
641 //'wrap_class' => 'yatra-left',
642 'extra_attributes' => array(
643 'placeholder' => __('Country', 'yatra'),
644 ),
645 'options' => $countries,
646 'default' => 'NP',
647 'is_multiple' => true,
648 'select2' => true,
649 //'row_start' => true,
650
651 ),
652 'yatra_tour_meta_tour_featured' => array(
653 'name' => 'yatra_tour_meta_tour_featured',
654 'title' => esc_html__('Feature this tour', 'yatra'),
655 'type' => 'switch',
656 //'wrap_class' => 'yatra-right',
657 //'row_end' => true,
658
659 ),
660 'yatra_tour_meta_tour_tabs_ordering' => array(
661 'name' => 'yatra_tour_meta_tour_tabs_ordering',
662 'type' => 'hidden',
663
664 ),
665 );
666 return apply_filters('yatra_tour_general_configurations', $tour_options);
667 }
668 }
669
670 if (!function_exists('yatra_tour_pricing_configurations')) {
671
672 function yatra_tour_pricing_configurations()
673 {
674 $currency = get_option('yatra_currency');
675
676 $currency_symbols = yatra_get_currency_symbols($currency);
677
678 $tour_options = array(
679 'yatra_tour_meta_price_per' => array(
680 'name' => 'yatra_tour_meta_price_per',
681 'title' => __('Price Per', 'yatra'),
682 'type' => 'select',
683 //'wrap_class' => 'yatra-left',
684 //'row_start' => true,
685 'options' => array(
686 'person' => __('Person', 'yatra'),
687 'group' => __('Group', 'yatra')
688 ),
689 ), 'yatra_tour_meta_group_size' => array(
690 'name' => 'yatra_tour_meta_group_size',
691 'title' => __('Group Size', 'yatra'),
692 'type' => 'number',
693 //'wrap_class' => 'yatra-right',
694 'extra_attributes' => array(
695 'placeholder' => __('Group Size', 'yatra'),
696 ),
697 'conditional_and_display' =>
698
699 array(array('yatra_tour_meta_price_per', '=', 'group')),
700 // 'row_end' => true,
701 ),
702 'yatra_tour_meta_regular_price' => array(
703 'name' => 'yatra_tour_meta_regular_price',
704 'title' => sprintf(__('Tour Price- Regular (%s)', 'yatra'), $currency_symbols),
705 'type' => 'number',
706 //'wrap_class' => 'yatra-left',
707 'extra_attributes' => array(
708 'placeholder' => sprintf(__('Tour Price - Regular (%s)', 'yatra'), $currency_symbols),
709 ),
710 //'row_start' => true,
711 ),
712 'yatra_tour_meta_sales_price' => array(
713 'name' => 'yatra_tour_meta_sales_price',
714 'title' => sprintf(__('Tour Price- Sales Price (%s)', 'yatra'), $currency_symbols),
715 'type' => 'number',
716 //'wrap_class' => 'yatra-right',
717 'extra_attributes' => array(
718 'placeholder' => sprintf(__('Tour Price - Sales Price (%s). Leave it empty if you do not want to show sales price.', 'yatra'), $currency_symbols),
719 ),
720 //'row_end' => true,
721 ),
722 );
723 return apply_filters('yatra_tour_general_configurations', $tour_options);
724 }
725 }
726
727
728 if (!function_exists('yatra_frontend_tabs_config')) {
729
730 function yatra_frontend_tabs_config()
731 {
732
733 $post_id = get_the_ID();
734
735 $yatra_tour_meta_tour_tabs_ordering = get_post_meta($post_id, 'yatra_tour_meta_tour_tabs_ordering', true);
736
737 $yatra_tour_meta_tour_tabs_ordering_array = array();
738
739 if (!is_null($yatra_tour_meta_tour_tabs_ordering) && '' != $yatra_tour_meta_tour_tabs_ordering) {
740
741 $yatra_tour_meta_tour_tabs_ordering_array = explode(',', $yatra_tour_meta_tour_tabs_ordering);
742
743 }
744
745 $configs = yatra_tour_tab_configurations();
746
747 $config_array_keys = array_keys($configs);
748
749 $array_diff = array_diff($config_array_keys, $yatra_tour_meta_tour_tabs_ordering_array);
750
751 $final_ordered_config_keys = $yatra_tour_meta_tour_tabs_ordering_array;
752
753 if (count($array_diff) > 0) {
754
755 $final_ordered_config_keys = array_merge($yatra_tour_meta_tour_tabs_ordering_array, $array_diff);
756 }
757
758 $frontend_tabs_config = array();
759
760 $active_tab_config = '';
761
762 foreach ($final_ordered_config_keys as $config) {
763
764 if (isset($configs[$config])) {
765
766 if (count($yatra_tour_meta_tour_tabs_ordering_array) == 0 || in_array($config, $yatra_tour_meta_tour_tabs_ordering_array)) {
767
768 $setting = $configs[$config];
769
770 $label = get_post_meta($post_id, $config . '_label', true);
771
772 $label = empty($label) ? $setting['label'] : $label;
773
774 $frontend_tabs_config [$config] = $label;
775 }
776
777 }
778 }
779
780
781 return apply_filters('frontend_tabs_configurations', $frontend_tabs_config);
782 }
783 }
784
785
786 if (!function_exists('yatra_frontend_tabs')) {
787
788 function yatra_frontend_tabs()
789 {
790 global $post;
791
792 $frontend_tabs_config = yatra_frontend_tabs_config();
793
794
795 $yatra_tour_tab_configurations = yatra_tour_tab_configurations();
796
797 ?>
798 <div class="yatra-tabs" id="yatra-tour-tabs">
799
800 <ul class="yatra-tab-wrap">
801 <?php foreach ($frontend_tabs_config as $tab_key => $tab) { ?>
802 <li class="item"><a
803 href="#<?php echo esc_attr($tab_key); ?>"><?php if (isset($yatra_tour_tab_configurations[$tab_key]) && isset($yatra_tour_tab_configurations[$tab_key]['icon'])) {
804 echo !empty($yatra_tour_tab_configurations[$tab_key]['icon']) ? '<span class="' . esc_attr($yatra_tour_tab_configurations[$tab_key]['icon']) . '"></span>' : '';
805 }
806 echo esc_html($tab); ?></a></li>
807 <?php } ?>
808 </ul>
809 <?php
810 $loop_index = 0;
811 foreach ($frontend_tabs_config as $tab_content_key => $tab_content) { ?>
812 <section id="<?php echo esc_attr($tab_content_key); ?>"
813 class="yatra-tab-content" <?php if ($loop_index > 0) { ?> aria-hidden="true" <?php } ?>>
814 <div class="tab-inner">
815 <?php
816
817 do_action('yatra_frontend_tab_content_' . $tab_content_key, $tab_content, $post)
818 ?>
819 </div>
820 </section>
821 <?php
822 $loop_index++;
823 } ?>
824
825 </div>
826 <?php
827 }
828 }
829 if (!function_exists('yatra_frontend_options')) {
830 function yatra_frontend_options($attribute_only = false)
831 {
832 $post_id = get_the_ID();
833 $yatra_tour_meta_price_per = get_post_meta($post_id, 'yatra_tour_meta_price_per', true);
834 $yatra_tour_meta_group_size = get_post_meta($post_id, 'yatra_tour_meta_group_size', true);
835 $yatra_tour_meta_regular_price = get_post_meta($post_id, 'yatra_tour_meta_regular_price', true);
836 $yatra_tour_meta_sales_price = get_post_meta($post_id, 'yatra_tour_meta_sales_price', true);
837 $yatra_tour_meta_tour_duration_days = get_post_meta($post_id, 'yatra_tour_meta_tour_duration_days', true);
838 $yatra_tour_meta_tour_duration_nights = get_post_meta($post_id, 'yatra_tour_meta_tour_duration_nights', true);
839 $yatra_tour_meta_tour_country = get_post_meta($post_id, 'yatra_tour_meta_tour_country', true);
840
841
842 $currency = get_option('yatra_currency');
843
844 $currency_symbol = yatra_get_currency_symbols($currency);
845
846 if (!empty($yatra_tour_meta_tour_country)) {
847
848 $country_string = '';
849
850
851 foreach ($yatra_tour_meta_tour_country as $country_item) {
852
853 $country = yatra_get_countries($country_item);
854
855
856 $country_string .= $country . ', ';
857 }
858 $country_string = trim($country_string, ', ');
859
860 $meta_frontend[] =
861 array(
862 'icon' => 'fa fa-map',
863 'text' => $country_string,
864 'title' => __('Country', 'yatra')
865
866 );
867
868 }
869 $price_string = $currency_symbol . absint($yatra_tour_meta_regular_price);
870 if ($yatra_tour_meta_sales_price > 0) {
871
872 $price_string = '<del>' . $price_string . '</del> &nbsp;' . $currency_symbol . $yatra_tour_meta_sales_price;
873 }
874 if (!$attribute_only) {
875 ?>
876 <h3><?php echo __('Tour Options', 'yatra') ?></h3>
877 <table>
878 <tr>
879 <th><?php echo __('Price per', 'yatra') ?></th>
880 <td><?php echo esc_html(ucwords($yatra_tour_meta_price_per)) ?></td>
881 </tr>
882 <tr>
883 <th><?php echo __('Group Size', 'yatra') ?></th>
884 <td><?php echo absint($yatra_tour_meta_group_size) ?></td>
885 </tr>
886 <tr>
887 <th><?php echo __('Price', 'yatra') ?></th>
888 <td><?php echo $price_string; ?></td>
889 </tr>
890 <tr>
891 <th><?php echo __('Tour Duration', 'yatra') ?></th>
892 <td><?php echo absint($yatra_tour_meta_tour_duration_days); ?>
893 Days <?php echo absint($yatra_tour_meta_tour_duration_nights) ?> Nights
894 </td>
895 </tr>
896 <tr>
897 <th><?php echo __('Country', 'yatra') ?></th>
898 <td><?php echo esc_html($country_string); ?></td>
899 </tr>
900 </table>
901
902 <?php
903 }
904
905 $tour_meta_custom_attributes = get_post_meta($post_id, 'tour_meta_custom_attributes', true);
906 if (count($tour_meta_custom_attributes) > 0) {
907 echo '<h3>' . __('Attributes', 'yatra') . '</h3>';
908 $yatra_tour_attribute_type_options = yatra_tour_attribute_type_options();
909 ?>
910 <table>
911 <?php foreach ($tour_meta_custom_attributes as $term_id => $content) {
912 $term = get_term($term_id);
913 $field_key = get_term_meta($term_id, 'attribute_field_type', true);
914 $field = isset($yatra_tour_attribute_type_options[$field_key]) ? $yatra_tour_attribute_type_options[$field_key] : array();
915 $field_option = isset($field['options']) ? $field['options'] : array();
916 if (isset($term->name)) {
917 ?>
918 <tr>
919 <th><?php echo esc_html($term->name) ?></th>
920 <td><?php
921
922 foreach ($content as $content_key => $content_value) {
923
924 $type = isset($field_option[$content_key]['type']) ? $field_option[$content_key]['type'] : '';
925
926 $value = '';
927
928 if (count($field_option) > 0) {
929
930 switch ($type) {
931 case "text":
932 $value = esc_html($content_value);
933 break;
934 case "textarea":
935 $value = esc_html($content_value);
936 break;
937
938 case "number":
939 $value = absint($content_value);
940 break;
941 case "shortcode":
942 $value = do_shortcode($content_value);
943 break;
944
945
946 }
947
948 echo '<p>' . ($value) . '</p>';
949 }
950 }
951 ?></td>
952 </tr>
953
954 <?php
955 }
956 } ?>
957 </table>
958
959 <?php
960 }
961
962 }
963 }
964 if (!function_exists('yatra_tour_additional_info')) {
965 function yatra_tour_additional_info()
966 {
967 $post_id = get_the_ID();
968 $yatra_tour_meta_price_per = get_post_meta($post_id, 'yatra_tour_meta_price_per', true);
969 $yatra_tour_meta_group_size = get_post_meta($post_id, 'yatra_tour_meta_group_size', true);
970 $yatra_tour_meta_regular_price = get_post_meta($post_id, 'yatra_tour_meta_regular_price', true);
971 $yatra_tour_meta_sales_price = get_post_meta($post_id, 'yatra_tour_meta_sales_price', true);
972 $yatra_tour_meta_tour_duration_days = get_post_meta($post_id, 'yatra_tour_meta_tour_duration_days', true);
973 $yatra_tour_meta_tour_duration_nights = get_post_meta($post_id, 'yatra_tour_meta_tour_duration_nights', true);
974 $yatra_tour_meta_tour_country = get_post_meta($post_id, 'yatra_tour_meta_tour_country', true);
975 $yatra_tour_meta_tour_fixed_departure = get_post_meta($post_id, 'yatra_tour_meta_tour_fixed_departure', true);
976 $yatra_tour_meta_tour_start_date = get_post_meta($post_id, 'yatra_tour_meta_tour_start_date', true);
977 $yatra_tour_meta_tour_end_date = get_post_meta($post_id, 'yatra_tour_meta_tour_end_date', true);
978
979 $yatra_tour_meta_tour_fixed_departure = $yatra_tour_meta_tour_fixed_departure == 1 ? true : false;
980
981
982 $currency = get_option('yatra_currency');
983
984 $currency_symbol = yatra_get_currency_symbols($currency);
985
986 if (!empty($yatra_tour_meta_tour_country)) {
987
988 $country_string = '';
989
990
991 foreach ($yatra_tour_meta_tour_country as $country_item) {
992
993 $country = yatra_get_countries($country_item);
994
995
996 $country_string .= $country . ', ';
997 }
998 $country_string = trim($country_string, ', ');
999
1000 $meta_frontend[] =
1001 array(
1002 'icon' => 'fa fa-map',
1003 'text' => $country_string,
1004 'title' => __('Country', 'yatra')
1005
1006 );
1007
1008 }
1009 $price_string = $currency_symbol . absint($yatra_tour_meta_regular_price);
1010 if ($yatra_tour_meta_sales_price > 0) {
1011
1012 $price_string = '<del>' . $price_string . '</del> &nbsp;' . $currency_symbol . $yatra_tour_meta_sales_price;
1013 }
1014
1015 $tour_duration_string = '';
1016
1017 if ('' != $yatra_tour_meta_tour_duration_days) {
1018
1019 $tour_duration_string = absint($yatra_tour_meta_tour_duration_days) . ' Days ';
1020 }
1021 if ('' != $yatra_tour_meta_tour_duration_nights) {
1022
1023 $tour_duration_string .= absint($yatra_tour_meta_tour_duration_nights) . ' Nights ';
1024 }
1025 if ($yatra_tour_meta_tour_fixed_departure) {
1026 $tour_duration_string = $yatra_tour_meta_tour_start_date . ' to ' . $yatra_tour_meta_tour_end_date;
1027 }
1028 $additional_info = array(
1029 'price_per' => ucwords($yatra_tour_meta_price_per),
1030 'group_size' => $yatra_tour_meta_group_size,
1031 'price' => $price_string,
1032 'tour_duration' => $tour_duration_string,
1033 'country' => $country_string
1034 );
1035 return $additional_info;
1036
1037 }
1038 }
1039