PluginProbe
Yatra – Travel Booking & Tour Operator Software / 2.0.10
Yatra – Travel Booking & Tour Operator Software v2.0.10
3.0.15 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 All 83 releases
yatra / includes / template-tags.php

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

1,025 lines 38.5 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 = explode(',', $yatra_tour_meta_tour_tabs_ordering);
738
739 $configs = yatra_tour_tab_configurations();
740
741 $config_array_keys = array_keys($configs);
742
743 $array_diff = array_diff($config_array_keys, $yatra_tour_meta_tour_tabs_ordering_array);
744
745 $final_ordered_config_keys = $yatra_tour_meta_tour_tabs_ordering_array;
746
747 if (count($array_diff) > 0) {
748
749 $final_ordered_config_keys = array_merge($yatra_tour_meta_tour_tabs_ordering_array, $array_diff);
750 }
751
752 $frontend_tabs_config = array();
753
754 $active_tab_config = '';
755
756 foreach ($final_ordered_config_keys as $config) {
757
758 if (isset($configs[$config])) {
759
760 $setting = $configs[$config];
761
762 $label = get_post_meta($post_id, $config . '_label', true);
763
764 $label = empty($label) ? $setting['label'] : $label;
765
766 $frontend_tabs_config [$config] = $label;
767
768 }
769 }
770
771 return apply_filters('frontend_tabs_configurations', $frontend_tabs_config);
772 }
773 }
774
775
776 if (!function_exists('yatra_frontend_tabs')) {
777
778 function yatra_frontend_tabs()
779 {
780 global $post;
781
782 $frontend_tabs_config = yatra_frontend_tabs_config();
783 $yatra_tour_tab_configurations = yatra_tour_tab_configurations();
784
785 ?>
786 <div class="yatra-tabs" id="yatra-tour-tabs">
787
788 <ul class="yatra-tab-wrap">
789 <?php foreach ($frontend_tabs_config as $tab_key => $tab) { ?>
790 <li class="item"><a
791 href="#<?php echo esc_attr($tab_key); ?>"><?php if (isset($yatra_tour_tab_configurations[$tab_key]) && isset($yatra_tour_tab_configurations[$tab_key]['icon'])) {
792 echo !empty($yatra_tour_tab_configurations[$tab_key]['icon']) ? '<span class="' . esc_attr($yatra_tour_tab_configurations[$tab_key]['icon']) . '"></span>' : '';
793 }
794 echo esc_html($tab); ?></a></li>
795 <?php } ?>
796 </ul>
797 <?php
798 $loop_index = 0;
799 foreach ($frontend_tabs_config as $tab_content_key => $tab_content) { ?>
800 <section id="<?php echo esc_attr($tab_content_key); ?>"
801 class="yatra-tab-content" <?php if ($loop_index > 0) { ?> aria-hidden="true" <?php } ?>>
802 <div class="tab-inner">
803 <?php
804 do_action('yatra_frontend_tab_content_' . $tab_content_key, $tab_content, $post)
805 ?>
806 </div>
807 </section>
808 <?php
809 $loop_index++;
810 } ?>
811
812 </div>
813 <?php
814 }
815 }
816 if (!function_exists('yatra_frontend_options')) {
817 function yatra_frontend_options($attribute_only = false)
818 {
819 $post_id = get_the_ID();
820 $yatra_tour_meta_price_per = get_post_meta($post_id, 'yatra_tour_meta_price_per', true);
821 $yatra_tour_meta_group_size = get_post_meta($post_id, 'yatra_tour_meta_group_size', true);
822 $yatra_tour_meta_regular_price = get_post_meta($post_id, 'yatra_tour_meta_regular_price', true);
823 $yatra_tour_meta_sales_price = get_post_meta($post_id, 'yatra_tour_meta_sales_price', true);
824 $yatra_tour_meta_tour_duration_days = get_post_meta($post_id, 'yatra_tour_meta_tour_duration_days', true);
825 $yatra_tour_meta_tour_duration_nights = get_post_meta($post_id, 'yatra_tour_meta_tour_duration_nights', true);
826 $yatra_tour_meta_tour_country = get_post_meta($post_id, 'yatra_tour_meta_tour_country', true);
827
828
829 $currency = get_option('yatra_currency');
830
831 $currency_symbol = yatra_get_currency_symbols($currency);
832
833 if (!empty($yatra_tour_meta_tour_country)) {
834
835 $country_string = '';
836
837
838 foreach ($yatra_tour_meta_tour_country as $country_item) {
839
840 $country = yatra_get_countries($country_item);
841
842
843 $country_string .= $country . ', ';
844 }
845 $country_string = trim($country_string, ', ');
846
847 $meta_frontend[] =
848 array(
849 'icon' => 'fa fa-map',
850 'text' => $country_string,
851 'title' => __('Country', 'yatra')
852
853 );
854
855 }
856 $price_string = $currency_symbol . absint($yatra_tour_meta_regular_price);
857 if ($yatra_tour_meta_sales_price > 0) {
858
859 $price_string = '<del>' . $price_string . '</del> &nbsp;' . $currency_symbol . $yatra_tour_meta_sales_price;
860 }
861 if(!$attribute_only) {
862 ?>
863 <h3><?php echo __('Tour Options', 'yatra') ?></h3>
864 <table>
865 <tr>
866 <th><?php echo __('Price per', 'yatra') ?></th>
867 <td><?php echo esc_html(ucwords($yatra_tour_meta_price_per)) ?></td>
868 </tr>
869 <tr>
870 <th><?php echo __('Group Size', 'yatra') ?></th>
871 <td><?php echo absint($yatra_tour_meta_group_size) ?></td>
872 </tr>
873 <tr>
874 <th><?php echo __('Price', 'yatra') ?></th>
875 <td><?php echo $price_string; ?></td>
876 </tr>
877 <tr>
878 <th><?php echo __('Tour Duration', 'yatra') ?></th>
879 <td><?php echo absint($yatra_tour_meta_tour_duration_days); ?>
880 Days <?php echo absint($yatra_tour_meta_tour_duration_nights) ?> Nights
881 </td>
882 </tr>
883 <tr>
884 <th><?php echo __('Country', 'yatra') ?></th>
885 <td><?php echo esc_html($country_string); ?></td>
886 </tr>
887 </table>
888
889 <?php
890 }
891
892 $tour_meta_custom_attributes = get_post_meta($post_id, 'tour_meta_custom_attributes', true);
893 if (count($tour_meta_custom_attributes) > 0) {
894 echo '<h3>' . __('Attributes', 'yatra') . '</h3>';
895 $yatra_tour_attribute_type_options = yatra_tour_attribute_type_options();
896 ?>
897 <table>
898 <?php foreach ($tour_meta_custom_attributes as $term_id => $content) {
899 $term = get_term($term_id);
900 $field_key = get_term_meta($term_id, 'attribute_field_type', true);
901 $field = isset($yatra_tour_attribute_type_options[$field_key]) ? $yatra_tour_attribute_type_options[$field_key] : array();
902 $field_option = isset($field['options']) ? $field['options'] : array();
903 if (isset($term->name)) {
904 ?>
905 <tr>
906 <th><?php echo esc_html($term->name) ?></th>
907 <td><?php
908
909 foreach ($content as $content_key => $content_value) {
910
911 $type = isset($field_option[$content_key]['type']) ? $field_option[$content_key]['type'] : '';
912
913 $value = '';
914
915 if (count($field_option) > 0) {
916
917 switch ($type) {
918 case "text":
919 $value = esc_html($content_value);
920 break;
921 case "textarea":
922 $value = esc_html($content_value);
923 break;
924
925 case "number":
926 $value = absint($content_value);
927 break;
928 case "shortcode":
929 $value = do_shortcode($content_value);
930 break;
931
932
933 }
934
935 echo '<p>' . ($value) . '</p>';
936 }
937 }
938 ?></td>
939 </tr>
940
941 <?php
942 }
943 } ?>
944 </table>
945
946 <?php
947 }
948
949 }
950 }
951 if (!function_exists('yatra_tour_additional_info')) {
952 function yatra_tour_additional_info()
953 {
954 $post_id = get_the_ID();
955 $yatra_tour_meta_price_per = get_post_meta($post_id, 'yatra_tour_meta_price_per', true);
956 $yatra_tour_meta_group_size = get_post_meta($post_id, 'yatra_tour_meta_group_size', true);
957 $yatra_tour_meta_regular_price = get_post_meta($post_id, 'yatra_tour_meta_regular_price', true);
958 $yatra_tour_meta_sales_price = get_post_meta($post_id, 'yatra_tour_meta_sales_price', true);
959 $yatra_tour_meta_tour_duration_days = get_post_meta($post_id, 'yatra_tour_meta_tour_duration_days', true);
960 $yatra_tour_meta_tour_duration_nights = get_post_meta($post_id, 'yatra_tour_meta_tour_duration_nights', true);
961 $yatra_tour_meta_tour_country = get_post_meta($post_id, 'yatra_tour_meta_tour_country', true);
962 $yatra_tour_meta_tour_fixed_departure = get_post_meta($post_id, 'yatra_tour_meta_tour_fixed_departure', true);
963 $yatra_tour_meta_tour_start_date = get_post_meta($post_id, 'yatra_tour_meta_tour_start_date', true);
964 $yatra_tour_meta_tour_end_date = get_post_meta($post_id, 'yatra_tour_meta_tour_end_date', true);
965
966 $yatra_tour_meta_tour_fixed_departure = $yatra_tour_meta_tour_fixed_departure == 1 ? true : false;
967
968
969 $currency = get_option('yatra_currency');
970
971 $currency_symbol = yatra_get_currency_symbols($currency);
972
973 if (!empty($yatra_tour_meta_tour_country)) {
974
975 $country_string = '';
976
977
978 foreach ($yatra_tour_meta_tour_country as $country_item) {
979
980 $country = yatra_get_countries($country_item);
981
982
983 $country_string .= $country . ', ';
984 }
985 $country_string = trim($country_string, ', ');
986
987 $meta_frontend[] =
988 array(
989 'icon' => 'fa fa-map',
990 'text' => $country_string,
991 'title' => __('Country', 'yatra')
992
993 );
994
995 }
996 $price_string = $currency_symbol . absint($yatra_tour_meta_regular_price);
997 if ($yatra_tour_meta_sales_price > 0) {
998
999 $price_string = '<del>' . $price_string . '</del> &nbsp;' . $currency_symbol . $yatra_tour_meta_sales_price;
1000 }
1001
1002 $tour_duration_string = '';
1003
1004 if ('' != $yatra_tour_meta_tour_duration_days) {
1005
1006 $tour_duration_string = absint($yatra_tour_meta_tour_duration_days) . ' Days ';
1007 }
1008 if ('' != $yatra_tour_meta_tour_duration_nights) {
1009
1010 $tour_duration_string .= absint($yatra_tour_meta_tour_duration_nights) . ' Nights ';
1011 }
1012 if ($yatra_tour_meta_tour_fixed_departure) {
1013 $tour_duration_string = $yatra_tour_meta_tour_start_date . ' to ' . $yatra_tour_meta_tour_end_date;
1014 }
1015 $additional_info = array(
1016 'price_per' => ucwords($yatra_tour_meta_price_per),
1017 'group_size' => $yatra_tour_meta_group_size,
1018 'price' => $price_string,
1019 'tour_duration' => $tour_duration_string,
1020 'country' => $country_string
1021 );
1022 return $additional_info;
1023
1024 }
1025 }