-
+
@@ -54,7 +54,7 @@
-
+
@@ -64,7 +64,7 @@
diff --git a/includes/patterns/tour-card.php b/includes/patterns/tour-card.php
new file mode 100644
index 00000000..bbb5b186
--- /dev/null
+++ b/includes/patterns/tour-card.php
@@ -0,0 +1,60 @@
+ __( 'Tour Card', 'tour-operator' ),
+ 'description' => __( 'A grid display for tours.', 'tour-operator' ),
+ 'categories' => array( $this->category ),
+ 'content' => '
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From:
+
+
+
+
+
price
+
+
+
+
+
+
+
+
+
+
+
Duration:
+
+
+
+
+
+
+
+
+
+
+
+
+
+'
+);
\ No newline at end of file
diff --git a/includes/patterns/travel-information.php b/includes/patterns/travel-information.php
new file mode 100644
index 00000000..cf99bdab
--- /dev/null
+++ b/includes/patterns/travel-information.php
@@ -0,0 +1,246 @@
+ __( 'Travel Information', 'tour-operator' ),
+ 'description' => __( 'Display the travel information like banking and cusine.', 'tour-operator' ),
+ 'categories' => array( $this->category ),
+ 'content' => '
+
+'
+);
diff --git a/includes/template-tags/accommodation.php b/includes/template-tags/accommodation.php
deleted file mode 100644
index 93f8a36d..00000000
--- a/includes/template-tags/accommodation.php
+++ /dev/null
@@ -1,334 +0,0 @@
- 'post',
- 'to' => 'accommodation',
- 'column' => '3',
- 'before' => '
' . esc_html__( 'Featured Posts', 'tour-operator' ) . ' ',
- );
-
- lsx_to_connected_panel_query( $args );
-}
-
-/**
- * Outputs the current accommodations room total
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category accommodation
- */
-function lsx_to_accommodation_room_total( $before = '', $after = '', $echo = true ) {
- lsx_to_custom_field_query( 'number_of_rooms', $before, $after, $echo );
-}
-
-/**
- * Gets the current accommodations rating
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @param $post_id | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category accommodation
- */
-function lsx_to_accommodation_rating( $before = '', $after = '', $echo = true, $post_id = false ) {
- lsx_to_custom_field_query( 'rating', $before, $after, $echo, $post_id );
-}
-
-/**
- * Outputs the accommodations facilities
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category accommodation
- */
-function lsx_to_has_facilities() {
- // Get any existing copy of our transient data
- $facilities = get_transient( get_the_ID() . '_facilities' );
-
- if ( false === $facilities ) {
- // It wasn't there, so regenerate the data and save the transient
- $facilities = wp_get_object_terms( get_the_ID(), 'facility' );
- $main_facilities = false;
- $child_facilities = false;
- $return = false;
-
- if ( ! empty( $facilities ) && ! is_wp_error( $facilities ) ) {
- foreach ( $facilities as $facility ) {
- if ( 0 === $facility->parent ) {
- $main_facilities[] = $facility;
- } else {
- $child_facilities[ $facility->parent ][] = $facility;
- }
- }
-
- set_transient( get_the_ID() . '_facilities', $location, 30 );
- }
- } else {
- return false;
- }
-}
-
-/**
- * Outputs the accommodations facilities
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category accommodation
- */
-function lsx_to_accommodation_facilities( $before = '', $after = '', $echo = true ) {
- $args = [];
- $facilities = wp_get_object_terms( get_the_ID(), 'facility' );
- $main_facilities = [];
- $child_facilities = [];
- $return = '';
-
- if ( ! empty( $facilities ) && ! is_wp_error( $facilities ) ) {
- foreach ( $facilities as $facility ) {
- if ( 0 === $facility->parent ) {
- $main_facilities[] = $facility;
- } else {
- $child_facilities[ $facility->parent ][] = $facility;
- }
- }
-
- //Output in the order we want
- if ( count( $main_facilities ) > 0 && count( $child_facilities ) > 0 ) {
- $return .= '
';
- foreach ( $main_facilities as $heading ) {
- if ( isset( $child_facilities[ $heading->term_id ] ) ) {
- $return .= '
';
- }
- }
- $return .= '
';
-
- if ( ! empty( $return ) ) {
- $return = $before . $return . $after;
-
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
- }
- } else {
- return false;
- }
- } else {
- return false;
- }
-}
-
-/**
- * Outputs the Spoken Languages HTML
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category accommodation
- */
-function lsx_to_accommodation_spoken_languages( $before = '', $after = '', $echo = true ) {
- $spoken_languages = get_post_meta( get_the_ID(), 'spoken_languages', true );
-
- if ( is_string( $spoken_languages ) && ! empty( $spoken_languages ) ) {
- $spoken_languages = array( $spoken_languages );
- }
-
- $return = '';
-
- if ( ! empty( $spoken_languages ) && ! is_wp_error( $spoken_languages ) ) {
- foreach ( $spoken_languages as $i => $spoken_language ) {
- $return .= ucwords( str_replace( '_', ' / ', str_replace( '-', ' ', str_replace( '-and-', ' & ', $spoken_language ) ) ) );
-
- if ( ( $i + 1 ) < count( $spoken_languages ) ) {
- $return .= ', ';
- }
- }
- $return = $before . $return . $after;
-
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
- } else {
- return false;
- }
-}
-
-/**
- * Outputs the Special Interests HTML
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category accommodation
- */
-function lsx_to_accommodation_special_interests( $before = '', $after = '', $echo = true, $post_id = false ) {
- if ( false === $post_id ) {
- $post_id = get_the_ID();
- }
-
- $special_interests = get_post_meta( $post_id, 'special_interests', true );
-
- if ( is_string( $special_interests ) && ! empty( $special_interests ) ) {
- $special_interests = array( $special_interests );
- }
-
- $return = '';
-
- if ( ! empty( $special_interests ) && ! is_wp_error( $special_interests ) ) {
- foreach ( $special_interests as $i => $special_interest ) {
- $return .= ucwords( str_replace( '_', ' / ', str_replace( '-', ' ', str_replace( '-and-', ' & ', $special_interest ) ) ) );
-
- if ( ( $i + 1 ) < count( $special_interests ) ) {
- $return .= ', ';
- }
- }
- $return = $before . $return . $after;
-
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
- } else {
- return false;
- }
-}
-
-/**
- * Outputs the Friendly HTML
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category accommodation
- * @category activity
- */
-function lsx_to_accommodation_activity_friendly( $before = '', $after = '', $echo = true ) {
- $friendly = get_post_meta( get_the_ID(), 'suggested_visitor_types', true );
-
- if ( is_string( $friendly ) && ! empty( $friendly ) ) {
- $friendly = array( $friendly );
- }
-
- $return = '';
-
- if ( ! empty( $friendly ) && ! is_wp_error( $friendly ) ) {
- foreach ( $friendly as $i => $friendly_item ) {
- $return .= ucwords( str_replace( '_', ' / ', str_replace( '-', ' ', str_replace( '-and-', ' & ', $friendly_item ) ) ) );
-
- if ( ( $i + 1 ) < count( $friendly ) ) {
- $return .= ', ';
- }
- }
- $return = $before . $return . $after;
-
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
- } else {
- return false;
- }
-}
-
-/**
- * Outputs the accommodation meta
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category accommodation
- */
-function lsx_to_accommodation_meta() {
- if ( 'accommodation' === get_post_type() ) {
- $meta_class = 'lsx-to-meta-data lsx-to-meta-data-';
-
- lsx_to_price( '
' . esc_html__( 'From price', 'tour-operator' ) . ': ', '' );
- lsx_to_accommodation_room_total( '
' . esc_html__( 'Rooms', 'tour-operator' ) . ': ', '' );
- lsx_to_accommodation_rating( '
' . esc_html__( 'Rating', 'tour-operator' ) . ': ', '' );
- the_terms( get_the_ID(), 'travel-style', '
' . esc_html__( 'Style', 'tour-operator' ) . ': ', ', ', '' );
- the_terms( get_the_ID(), 'accommodation-brand', '
' . esc_html__( 'Brand', 'tour-operator' ) . ': ', ', ', '' );
- the_terms( get_the_ID(), 'accommodation-type', '
' . esc_html__( 'Type', 'tour-operator' ) . ': ', ', ', '' );
- lsx_to_accommodation_spoken_languages( '
' . esc_html__( 'Spoken Languages', 'tour-operator' ) . ': ', '' );
- lsx_to_accommodation_activity_friendly( '
' . esc_html__( 'Friendly', 'tour-operator' ) . ': ', '' );
- lsx_to_accommodation_special_interests( '
' . esc_html__( 'Special Interests', 'tour-operator' ) . ': ', '' );
- lsx_to_connected_countries( '
' . esc_html__( 'Location', 'tour-operator' ) . ': ', '' );
- }
-}
-
-/**
- * Gets the current specials connected accommodation
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category connections
- */
-function lsx_to_connected_accommodation( $before = '', $after = '', $echo = true ) {
- lsx_to_connected_items_query( 'accommodation', get_post_type(), $before, $after, $echo );
-}
diff --git a/includes/template-tags/addons.php b/includes/template-tags/addons.php
deleted file mode 100644
index ced10d49..00000000
--- a/includes/template-tags/addons.php
+++ /dev/null
@@ -1,25 +0,0 @@
- 'post',
- 'to' => 'destination',
- 'column' => '3',
- 'before' => '
' . esc_html__( 'Featured Posts', 'tour-operator' ) . ' ',
- );
-
- lsx_to_connected_panel_query( $args );
-}
-
-/**
- * Outputs the connected accommodation only on a "region"
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category destination
- */
-function lsx_to_region_accommodation() {
- global $lsx_to_archive;
-
- if ( post_type_exists( 'accommodation' ) && is_singular( 'destination' ) && ! lsx_to_item_has_children( get_the_ID(), 'destination' ) ) {
- $args = array(
- 'from' => 'accommodation',
- 'to' => 'destination',
- 'column' => '3',
- 'before' => '
' . lsx_to_get_post_type_section_title( 'accommodation', '', esc_html__( 'Featured Accommodation', 'tour-operator' ) ) . ' ',
- );
-
- lsx_to_connected_panel_query( $args );
- }
-}
-
-/**
- * Outputs the destinations attached tours
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category destination
- */
-function lsx_to_destination_tours() {
- global $lsx_to_archive, $wp_query;
-
- if ( post_type_exists( 'tour' ) && is_singular( 'destination' ) ) {
- $args = array(
- 'from' => 'tour',
- 'to' => 'destination',
- 'column' => '3',
- 'before' => '
' . lsx_to_get_post_type_section_title( 'tour', '', esc_html__( 'Featured Tours', 'tour-operator' ) ) . ' ',
- );
-
- lsx_to_connected_panel_query( $args );
- }
-}
-
-/**
- * Outputs the destinations attached activites
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category destination
- */
-function lsx_to_destination_activities() {
- global $lsx_to_archive;
-
- if ( post_type_exists( 'activity' ) && is_singular( 'destination' ) && ! lsx_to_item_has_children( get_the_ID(), 'destination' ) ) {
- $args = array(
- 'from' => 'activity',
- 'to' => 'destination',
- // 'content_part' => 'widget-activity',
- 'column' => '3',
- 'before' => '
' . lsx_to_get_post_type_section_title( 'activity', '', esc_html__( 'Featured Activities', 'tour-operator' ) ) . ' ',
- );
-
- lsx_to_connected_panel_query( $args );
- }
-}
-
-/**
- * Outputs the destination travel info
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category destination
- */
-function lsx_to_destination_travel_info() {
- $electricity = get_post_meta( get_the_ID(), 'electricity', true );
- $banking = get_post_meta( get_the_ID(), 'banking', true );
- $cuisine = get_post_meta( get_the_ID(), 'cuisine', true );
- $climate = get_post_meta( get_the_ID(), 'climate', true );
- $transport = get_post_meta( get_the_ID(), 'transport', true );
- $dress = get_post_meta( get_the_ID(), 'dress', true );
- $health = get_post_meta( get_the_ID(), 'health', true );
- $safety = get_post_meta( get_the_ID(), 'safety', true );
- $visa = get_post_meta( get_the_ID(), 'visa', true );
- $general = get_post_meta( get_the_ID(), 'additional_info', true );
-
- if ( ! empty( $electricity ) || ! empty( $banking ) || ! empty( $cuisine ) || ! empty( $climate ) || ! empty( $transport ) || ! empty( $dress ) || ! empty( $health ) || ! empty( $safety ) || ! empty( $visa ) || ! empty( $general ) ) :
- $limit_words = 20;
- $limit_chars = 150;
- $more_button = "\n\n" . '
Read More ' . "\n\n";
-
- $items = array(
- esc_html__( 'Electricity', 'tour-operator' ) => $electricity,
- esc_html__( 'Banking', 'tour-operator' ) => $banking,
- esc_html__( 'Cuisine', 'tour-operator' ) => $cuisine,
- esc_html__( 'Climate', 'tour-operator' ) => $climate,
- esc_html__( 'Transport', 'tour-operator' ) => $transport,
- esc_html__( 'Dress', 'tour-operator' ) => $dress,
- esc_html__( 'Health', 'tour-operator' ) => $health,
- esc_html__( 'Safety', 'tour-operator' ) => $safety,
- esc_html__( 'Visa', 'tour-operator' ) => $visa,
- esc_html__( 'General', 'tour-operator' ) => $general,
- );
- ?>
-
- $theid,
- 'post_type' => 'destination',
- ) );
- $meta_class = 'lsx-to-meta-data lsx-to-meta-data-';
- if ( $child->have_posts() ) {
- $list_destinations = array();
- $final_list_destinations = '';
- echo '
' . esc_html__( 'Regions', 'tour-operator' ) . ': ';
- while ( $child->have_posts() ) {
- $child->the_post();
- $childtitle = get_the_title();
- $childlink = get_the_permalink();
- $list_destinations[] = ' ' . esc_attr( $childtitle ) . ' ';
- }
- $final_list_destinations = implode( ', ', $list_destinations );
- echo wp_kses_post( $final_list_destinations );
- } else {
- echo '' . esc_html__( 'Country', 'tour-operator' ) . ': ';
- $parent_title = get_the_title( wp_get_post_parent_id( $theid ) );
- $parent_link = get_the_permalink( wp_get_post_parent_id( $theid ) );
- echo ' ' . esc_attr( $parent_title ) . ' ';
- }
- echo ' ';
- wp_reset_postdata();
-}
-
-/**
- * Gets the current best months to visit
- *
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category connections
- */
-
-function months_to_visit() {
- $meta_class = 'lsx-to-meta-data lsx-to-meta-data-';
- $months = get_post_meta( get_the_ID(), 'best_time_to_visit', true );
- $month_list = array();
-
- foreach ( (array) $months as $single_month ) {
- $single_month = str_split( $single_month, 3 );
- $month_list[] = '' . $single_month[0] .
- ' ';
- }
-
- if ( ! empty( $months ) ) {
- echo '' . esc_html__( 'Best Time', 'tour-operator' ) . ': ';
- echo ( implode( ', ', $month_list ) );
- echo ' ';
- }
-
-}
diff --git a/includes/template-tags/general.php b/includes/template-tags/general.php
index aeb27d07..2fc7605e 100644
--- a/includes/template-tags/general.php
+++ b/includes/template-tags/general.php
@@ -8,587 +8,188 @@
* @license GPL3
*/
-/* ================== LAYOUT ================== */
-
/**
- * Returns the CSS class for the archive panels
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category class
- */
-function lsx_to_archive_class( $classes = array() ) {
- $layout = tour_operator()->archive_layout;
-
- if ( ! is_array( $classes ) ) {
- $classes = explode( ' ', $classes );
- }
-
- $new_classes = $classes;
-
- if ( 'grid' === $layout ) {
- $new_classes[] = 'col-xs-12 col-sm-6 col-md-4';
- } else {
- $new_classes[] = 'col-xs-12';
- }
+ * Used Functions
+ */
- $new_classes = apply_filters( 'lsx_to_archive_class', $new_classes, $classes, $layout );
-
- return implode( ' ', $new_classes );
-}
+// =============== Itinerary ===================
/**
- * Outputs the CSS class for the widget panels
+ * Outputs The current Itinerary connected destinations, can only be used in
+ * the itinerary loop.
*
- * @package tour-operator
- * @subpackage template-tags
- * @category class
+ * @package tour-operator
+ * @subpackage template-tags
+ * @category itinerary
*/
-function lsx_to_widget_class( $type = '', $return = false ) {
- global $columns;
-
- $cols = 'col-xs-12 col-sm-';
- $cols .= '5' == $columns ? '15' : 12 / $columns;
-
- $class = 'lsx-to-widget-item-wrap lsx-' . $type . ' ' . $cols;
-
- if ( false === $return ) {
- echo 'class="' . esc_attr( $class ) . '"';
- } else {
- return 'class="' . $class . '"';
- }
-}
-
-/**
- * Outputs the 'content' class.
- *
- * @param $classes string or array
- */
-function lsx_to_entry_class( $classes = false ) {
- global $post;
-
- if ( false !== $classes ) {
- if ( ! is_array( $classes ) ) {
- $classes = explode( ' ', $classes );
- }
-
- $classes = apply_filters( 'lsx_to_entry_class', $classes, $post->ID );
- }
-
- echo wp_kses_post( 'class="' . implode( ' ', $classes ) . '"' );
-}
-
-/**
- * Outputs the 'content' class.
- *
- * @param $classes string or array
- */
-function lsx_to_column_class( $classes = false ) {
- global $post;
-
- if ( false !== $classes ) {
- if ( ! is_array( $classes ) ) {
- $classes = explode( ' ', $classes );
+function lsx_to_itinerary_room_basis( $before = '', $after = '', $echo = true ) {
+ global $tour_itinerary;
+ if ( $tour_itinerary && $tour_itinerary->has_itinerary && ! empty( $tour_itinerary->itinerary ) ) {
+ if ( ! empty( $tour_itinerary->itinerary['room_basis'] ) && 'None' !== $tour_itinerary->itinerary['room_basis'] ) {
+ $label = lsx_to_room_basis_label( $tour_itinerary->itinerary['room_basis'] );
+ if ( $echo ) {
+ echo wp_kses_post( $before . $label . $after );
+ } else {
+ return $before . $label . $after;
+ }
}
- $classes = apply_filters( 'lsx_to_column_class', $classes, $post->ID );
}
-
- echo wp_kses_post( 'class="' . implode( ' ', $classes ) . '"' );
+ return '';
}
/**
- * Returns the collapsible class if it is active.
+ * Return the Room basis Label.
*
- * @param bool $post_type
- * @param bool $return
+ * @param string $index
* @return string
*/
-function lsx_to_collapsible_class( $post_type = false, $return = true ) {
- if ( false === $post_type ) {
- $post_type = get_post_type();
+function lsx_to_room_basis_label( $index = '' ) {
+ $label = $index;
+ if ( isset( tour_operator()->legacy->tour->room_basis[ $index ] ) ) {
+ $label = tour_operator()->legacy->tour->room_basis[ $index ];
}
- if ( ! lsx_to_is_collapsible( $post_type ) ) {
-
- $output = 'lsx-to-collapse-section';
- if ( false === $return ) {
- echo esc_attr( $output );
- } else {
- return $output;
- }
- }
-}
-
-/**
- * Returns the collapsible class if it is active.
- *
- * @param bool $target
- * @param bool $post_type
- * @param bool $return
- * @return string
- */
-function lsx_to_collapsible_attributes( $target = false, $post_type = false, $return = true ) {
- if ( false === $post_type ) {
- $post_type = get_post_type();
- }
- if ( ! lsx_to_is_collapsible( $post_type ) ) {
- $output = 'data-toggle="collapse" data-target="#' . $target . '"';
- if ( false === $return ) {
- echo esc_attr( $output );
- } else {
- return $output;
- }
- }
-}
-
-function lsx_to_collapsible_attributes_not_post( $target = false, $return = true ) {
- //$output = 'data-toggle="collapse" data-target="#' . $target . '"';
- $output = 'data-toggle=';
- $output .= 'collapse';
- $output .= ' ';
- $output .= 'data-target=';
- $output .= '#' . $target;
- echo esc_attr( $output );
-}
-
-/* ================== HEADER ================== */
-
-/**
- * Global header.
- *
- * @package tour-operator
- * @subpackage template-tag
- * @category header
- */
-function lsx_to_global_header() {
- $default_size = 'sm';
- $size = apply_filters( 'lsx_bootstrap_column_size', $default_size );
- ?>
-
-', '
' ) );
+ return $label;
}
-
-/* ================== SINGLE ================== */
-
/**
- * Outputs the Single pages navigation
+ * Return the Drinks basis Label.
*
- * @param $echo
+ * @param string $index
* @return string
- *
- * @package tour-operator
- * @subpackage template-tag
- * @category navigation
*/
-function lsx_to_page_navigation( $echo = true ) {
- $page_links = array();
-
- if ( is_single() ) {
- $page_links['summary'] = esc_html__( 'Summary', 'tour-operator' );
- }
-
- // Allow 3rd party plugins and themes to disable the page links.
- if ( apply_filters( 'lsx_to_page_navigation_disable', false, get_post_type() ) ) {
- return false;
- }
-
- $page_links = apply_filters( 'lsx_to_page_navigation', $page_links );
-
- if ( ! empty( $page_links ) && count( $page_links ) > 1 ) {
- $return = '
';
- $return .= '
';
-
- if ( ! empty( $page_links ) ) {
- foreach ( $page_links as $link_slug => $link_value ) {
- $return .= '' . $link_value . ' ';
- }
- }
-
- $return .= ' ';
- $return .= '
';
-
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
+function lsx_to_drinks_basis_label( $index = '' ) {
+ $label = $index;
+ if ( isset( tour_operator()->legacy->tour->drinks_basis[ $index ] ) ) {
+ $label = tour_operator()->legacy->tour->drinks_basis[ $index ];
}
+ return $label;
}
/**
- * outputs the sharing
+ * Outputs The current Itinerary connected destinations, can only be used in
+ * the itinerary loop.
*
- * @package tour-operator
- * @subpackage setup
- * @category helper
+ * @package tour-operator
+ * @subpackage template-tags
+ * @category itinerary
*/
-function lsx_to_sharing() {
- echo '
';
-
- if ( class_exists( 'LSX_Sharing' ) ) {
- global $lsx_sharing;
- echo wp_kses_post( $lsx_sharing->sharing_buttons() );
- } else {
- if ( function_exists( 'sharing_display' ) ) {
- sharing_display( '', true );
- }
-
- if ( class_exists( 'Jetpack_Likes' ) ) {
- $custom_likes = new Jetpack_Likes();
- echo wp_kses_post( $custom_likes->post_likes( '' ) );
+function lsx_to_itinerary_drinks_basis( $before = '', $after = '', $echo = true ) {
+ global $tour_itinerary;
+ if ( $tour_itinerary && $tour_itinerary->has_itinerary && ! empty( $tour_itinerary->itinerary ) ) {
+ if ( ! empty( $tour_itinerary->itinerary['drinks_basis'] ) && 'None' !== $tour_itinerary->itinerary['drinks_basis'] ) {
+ $label = lsx_to_drinks_basis_label( $tour_itinerary->itinerary['drinks_basis'] );
+ if ( $echo ) {
+ echo wp_kses_post( $before . $label . $after );
+ } else {
+ return $before . $label . $after;
+ }
}
}
-
- echo ' ';
+ return '';
}
-/* ================== TAXONOMIES ================== */
-
-/**
- * Outputs the widget with some styling
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category helper
- */
-function lsx_to_safari_brands( $before = '', $after = '', $echo = true ) {
- $args = array(
- 'name' => 'Home',
- 'id' => 'sidebar-home',
- 'description' => '',
- 'class' => '',
- 'before_widget' => '
',
- 'before_title' => '
',
- 'widget_id' => 'lsx_to_taxonomy_widget-6',
- 'widget_name' => 'LSX Taxonomies',
- );
- $instance = array(
- 'title' => '',
- 'title_link' => '',
- 'columns' => '4',
- 'orderby' => 'menu_order',
- 'order' => 'ASC',
- 'limit' => '100',
- 'include' => '',
- 'size' => '100',
- 'buttons' => '',
- 'button_text' => '',
- 'responsive' => '1',
- 'carousel' => '1',
- 'taxonomy' => 'accommodation-brand',
- 'class' => '',
- 'interval' => '7000',
- 'indicators' => '1',
- );
- $safari_brands = new \lsx\legacy\Taxonomy_Widget();
- ob_start();
- $safari_brands->widget( $args, $instance );
- $return = ob_get_clean();
- $return = $before . $return . $after;
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
-}
-/**
- * Outputs the travel styles widget with some styling
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category helper
- */
-function lsx_to_travel_styles( $before = '', $after = '', $echo = true ) {
- $args = array(
- 'name' => 'Home',
- 'id' => 'sidebar-home',
- 'description' => '',
- 'class' => '',
- 'before_widget' => '
',
- 'before_title' => '
',
- 'widget_id' => 'lsx_to_taxonomy_widget-6',
- 'widget_name' => 'LSX Taxonomies',
- );
- $instance = array(
- 'title' => '',
- 'title_link' => '',
- 'columns' => '3',
- 'orderby' => 'rand',
- 'order' => 'DESC',
- 'limit' => '100',
- 'include' => '',
- 'size' => '100',
- 'buttons' => '',
- 'button_text' => '',
- 'responsive' => '1',
- 'carousel' => '1',
- 'taxonomy' => 'travel-style',
- 'class' => '',
- 'interval' => '7000',
- 'indicators' => '1',
- );
- $travel_styles = new \lsx\legacy\Taxonomy_Widget();
- ob_start();
- $travel_styles->widget( $args, $instance );
- $return = ob_get_clean();
- $return = $before . $return . $after;
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
-}
+// =============== Tours ===================
-/* ================== ENQUIRE ================== */
/**
- * Test if Enquire Contact exists
+ * Retrieves the accommodation ids from the itinerary, mostly for use in the map.
+ * the itinerary loop.
*
- * @return boolean
- * @package tour-operator
- */
-function lsx_to_has_enquiry_contact() {
- $tour_operator = tour_operator();
-
- $has_enquiry_contact = false;
-
- if ( function_exists( 'lsx_to_has_team_member' ) ) {
- $has_enquiry_contact = lsx_to_has_team_member();
- }
-
- if ( false === $has_enquiry_contact && isset( $tour_operator->options['general'] ) ) {
- if ( isset( $tour_operator->options['general']['enquiry_contact_name'] ) && '' !== $tour_operator->options['general']['enquiry_contact_name'] ) {
- $has_enquiry_contact = true;
- }
-
- // First set the general form
- if ( isset( $tour_operator->options['general']['enquiry'] ) && '' !== $tour_operator->options['general']['enquiry'] ) {
- $has_enquiry_contact = true;
- }
- }
-
- return $has_enquiry_contact;
-}
-/**
- * Display Enquire Contact
+ * @package tour-operator
+ * @subpackage template-tags
+ * @category itinerary
*
- * @return void
- * @package tour-operator
+ * @param string $meta_key
+ * @param string $supress_filters
+ * @return array
*/
-function lsx_to_enquiry_contact( $before = '', $after = '' ) {
- $tour_operator = tour_operator();
-
- $fields = array(
- 'enquiry_contact_name' => '',
- 'enquiry_contact_email' => '',
- 'enquiry_contact_phone' => '',
- 'enquiry_contact_image_id' => '',
- 'enquiry_contact_image' => '',
- );
+function lsx_to_get_tour_itinerary_ids( $meta_key = 'accommodation_to_tour', $supress_filters = false ) {
+ $tour_itinerary = new \lsx\legacy\Itinerary_Query();
+ $itinerary_ids = array();
- foreach ( $fields as $key => $field ) {
- if ( isset( $tour_operator->options['general'] ) && isset( $tour_operator->options['general'][ $key ] ) ) {
- $fields[ $key ] = $tour_operator->options['general'][ $key ];
- }
+ if ( false === $supress_filters ) {
+ $meta_key = apply_filters( 'lsx_to_get_itinerary_ids_meta_key', $meta_key );
}
+
+ if ( $tour_itinerary->has_itinerary() ) {
+ $itinerary_count = 1;
+ while ( $tour_itinerary->while_itinerary() ) {
+ $tour_itinerary->current_itinerary_item();
- if ( ! empty( $fields['enquiry_contact_image_id'] ) ) {
- $temp_src_array = wp_get_attachment_image_src( $fields['enquiry_contact_image_id'], 'medium' );
-
- if ( is_array( $temp_src_array ) && count( $temp_src_array ) > 0 ) {
- $fields['enquiry_contact_image'] = $temp_src_array[0];
+ if ( ! empty( $tour_itinerary->itinerary[ $meta_key ] ) && '' !== $tour_itinerary->itinerary[ $meta_key] ) {
+ if ( ! is_array( $tour_itinerary->itinerary[ $meta_key ] ) ) {
+ $d_ids = array( $tour_itinerary->itinerary[ $meta_key ] );
+ } else {
+ $d_ids = $tour_itinerary->itinerary[ $meta_key ];
+ }
+ $itinerary_ids = array_merge( $itinerary_ids, array_values( $d_ids ) );
+ }
}
}
-
- echo wp_kses_post( $before );
- ?>
-
>
-
-
- ' ); ?>
-
-
-
-
- Your travel expert:
-
-
-
-
-
- options['general'] ) && isset( $tour_operator->options['general']['enquiry'] ) && '' !== $tour_operator->options['general']['enquiry'] ) {
- $form_id = $tour_operator->options['general']['enquiry'];
- }
-
- if ( is_singular( $tour_operator->active_post_types ) ) {
- if ( isset( $tour_operator->options[ get_post_type() ] ) && isset( $tour_operator->options[ get_post_type() ]['enquiry'] ) && '' !== $tour_operator->options[ get_post_type() ]['enquiry'] ) {
- $form_id = $tour_operator->options[ get_post_type() ]['enquiry'];
+ * @category accommodation
+ */
+function lsx_to_accommodation_facilities( $before = '', $after = '', $echo = true ) {
+ $args = [];
+ $facilities = wp_get_object_terms( get_the_ID(), 'facility' );
+ $main_facilities = [];
+ $child_facilities = [];
+ $return = '';
+
+ if ( ! empty( $facilities ) && ! is_wp_error( $facilities ) ) {
+ foreach ( $facilities as $facility ) {
+ if ( 0 === $facility->parent ) {
+ $main_facilities[] = $facility;
+ } else {
+ $child_facilities[ $facility->parent ][] = $facility;
}
}
- if ( is_archive( $tour_operator->active_post_types ) ) {
- if ( isset( $tour_operator->options[ get_post_type() ] ) && isset( $tour_operator->options[ get_post_type() ]['enquiry'] ) && '' !== $tour_operator->options[ get_post_type() ]['enquiry'] ) {
- $form_id = $tour_operator->options[ get_post_type() ]['enquiry'];
- }
- }
- }
- $link = '#';
+ //Output in the order we want
+ if ( count( $main_facilities ) > 0 && count( $child_facilities ) > 0 ) {
+ $return .= '
';
+ foreach ( $main_facilities as $heading ) {
+ if ( isset( $child_facilities[ $heading->term_id ] ) ) {
+ $return .= '
+
' . esc_html( $heading->name ) . ' ';
+ $return .= '
';
- if ( isset( $tour_operator->options['general'] ) && isset( $tour_operator->options['general']['disable_enquire_modal'] ) && 'on' === $tour_operator->options['general']['disable_enquire_modal'] ) {
- if ( isset( $tour_operator->options['general']['enquire_link'] ) && '' !== $tour_operator->options['general']['enquire_link'] ) {
- $link = $tour_operator->options['general']['enquire_link'];
- }
- }
+ foreach ( $child_facilities[ $heading->term_id ] as $child_facility ) {
+ $return .= '' . esc_html( $child_facility->name ) . ' ';
+ }
- if ( is_singular( $tour_operator->active_post_types ) ) {
- if ( isset( $tour_operator->options[ get_post_type() ] ) && isset( $tour_operator->options[ get_post_type() ]['disable_enquire_modal'] ) && 'on' === $tour_operator->options[ get_post_type() ]['disable_enquire_modal'] ) {
- $disable_modal = true;
- if ( isset( $tour_operator->options[ get_post_type() ]['enquire_link'] ) && '' !== $tour_operator->options[ get_post_type() ]['enquire_link'] ) {
- $link = $tour_operator->options[ get_post_type() ]['enquire_link'];
+ $return .= ' ';
+ $return .= '
';
+ }
}
- }
- }
+ $return .= '
';
- if ( false !== $form_id ) {
- ?>
-
- 'post_type',
- 'label' => __( 'Destinations', 'lsx' ),
- 'heirarchy' => true,
- );
-
- return $sitemap_loops;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
}
- add_filter( 'lsx_sitemap_loops_list', 'to_sitemap_loops', 1 );
}
diff --git a/includes/template-tags/helpers.php b/includes/template-tags/helpers.php
index af69f52c..1389c36d 100644
--- a/includes/template-tags/helpers.php
+++ b/includes/template-tags/helpers.php
@@ -95,6 +95,7 @@ function lsx_to_item_has_children( $post_id = false, $post_type = false ) {
$post_type = 'page';
}
+ // phpcs:disable WordPress.DB -- Start ignoring
$children = $wpdb->get_results(
$wpdb->prepare(
"SELECT ID
@@ -103,9 +104,11 @@ function lsx_to_item_has_children( $post_id = false, $post_type = false ) {
AND post_parent = %d
ORDER BY post_title ASC
LIMIT 100",
- $post_type,$post_id
+ $post_type,
+ $post_id
)
);
+ // phpcs:enable -- Stop ignoring
if ( count( $children ) > 0 ) {
return $children;
@@ -185,6 +188,7 @@ function lsx_to_get_term_thumbnail( $term_id = false, $size = 'lsx-thumbnail-sin
$term_thumbnail_id = get_term_meta( $term_id, 'thumbnail', true );
$img = wp_get_attachment_image_src( $term_thumbnail_id,$size );
$image_url = $img[0];
+ // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
$img = '
';
$img = apply_filters( 'lsx_lazyload_slider_images', $img, $term_thumbnail_id, $size, false, $image_url );
return $img;
@@ -308,297 +312,6 @@ function lsx_to_custom_field_query( $meta_key = false, $before = '', $after = ''
}
}
-/**
- * Gets the list of connections requested
- *
- * @param $from | string
- * @param $to | string
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @param $parent | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category helper
- */
-function lsx_to_connected_items_query( $from = false, $to = false, $before = '', $after = '', $echo = false, $parents = false, $extra = false ) {
- if ( post_type_exists( $from ) && post_type_exists( $to ) ) {
- $connected_ids = get_post_meta( get_the_ID(), $from . '_to_' . $to, false );
-
- if ( $parents ) {
- $connected_ids = apply_filters( 'lsx_to_parents_only', $connected_ids, $from . '_to_' . $to );
- }
-
- if ( false !== $connected_ids && '' !== $connected_ids && ! empty( $connected_ids ) ) {
- if ( ! is_array( $connected_ids ) ) {
- $connected_ids = array( $connected_ids );
- }
-
- $return = $before . lsx_to_connected_list( $connected_ids, $from, true, ', ' ) . $after;
-
- if ( false !== $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
- } else {
- return false;
- }
- }
-}
-
-/**
- * Gets the list of connections items, and displays them using the the specified content part.
- *
- * @param $args | array
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category helper
- */
-function lsx_to_connected_panel_query( $args = false ) {
- global $lsx_to_archive, $columns;
-
- if ( false !== $args && is_array( $args ) ) {
- $defaults = array(
- 'from' => false,
- 'to' => false,
- 'content_part' => false,
- 'id' => false,
- 'column' => false,
- 'before' => '',
- 'after' => '',
- 'featured' => false,
- 'orderby' => false,
- 'items' => array(),
- );
-
- $args = wp_parse_args( $args, $defaults );
-
- if ( false === $args['content_part'] ) {
- $args['content_part'] = $args['from'];
- }
-
- if ( empty( $args['items'] ) ) {
- $items_array = get_post_meta( get_the_ID(), $args['from'] . '_to_' . $args['to'], false );
- } else {
- $items_array = $args['items'];
- }
-
- if ( false !== $items_array && is_array( $items_array ) && ! empty( $items_array ) ) {
- $items_query_args = array(
- 'post_type' => $args['from'],
- 'post_status' => 'publish',
- 'post__in' => $items_array,
- );
-
- if ( false !== $args['orderby'] ) {
- $items_query_args['orderby'] = $args['orderby'];
- }
-
- if ( true === $args['featured'] || 'true' === $args['featured'] ) {
- $items_query_args['meta_query'] = array(
- 'relation' => 'OR',
- array(
- 'key' => 'featured',
- 'value' => true,
- 'compare' => '=',
- ),
- );
-
- if ( 'accommodation' === $args['from'] ) {
- $items_query_args['meta_query'][] = array(
- 'key' => 'featured',
- 'compare' => 'NOT EXISTS',
- );
- $items_query_args['orderby'] = array(
- 'meta_value' => 'DESC',
- 'title' => 'RAND',
- );
- }
- }
-
- $items = new WP_Query( $items_query_args );
-
- if ( $items->have_posts() ) :
- $lsx_to_archive = 1;
-
- $carousel_id = rand( 20, 20000 );
- $columns = intval( esc_attr( $args['column'] ) );
- $interval = '6000';
- $post_type = $args['content_part'];
-
- echo wp_kses_post( $args['before'] );
-
- if ( 1 < $items->post_count ) {
- echo '
';
- }
-
- echo wp_kses_post( $args['after'] );
-
- endif;
- }
- }
-}
-
-/**
- * Returns items tagged in the same terms for the taxonomy you select.
- *
- * @param $taxonomy | string
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category helper
- */
-function lsx_to_related_items( $taxonomy = false, $before = '', $after = '', $echo = true, $post_type = false ) {
- if ( false !== $taxonomy ) {
- $return = false;
- $filters = array();
-
- if ( false === $post_type ) {
- $post_type = get_post_type();
- }
-
- $filters['post_type'] = $post_type;
-
- if ( is_array( $taxonomy ) ) {
- $filters['post__in'] = $taxonomy;
- } else {
- //Get the settings from the customizer options
- $filters['posts_per_page'] = 15;
- //Exclude the current post
- $filters['post__not_in'] = array( get_the_ID() );
- //if its set to related then we need to check by the type.
- $filters['orderby'] = 'rand';
- $terms = wp_get_object_terms( get_the_ID(), $taxonomy );
-
- //only allow relation by 1 property type term
- if ( is_array( $terms ) && ! empty( $terms ) ) {
- $filters['tax_query'] = array(
- array(
- 'taxonomy' => $taxonomy,
- 'field' => 'slug',
- 'terms' => array(),
- ),
- );
-
- foreach ( $terms as $term ) {
- $filters['tax_query'][0]['terms'][] = $term->slug;
- }
- }
- }
-
- $related_query = new WP_Query( $filters );
-
- if ( $related_query->have_posts() ) :
- global $wp_query, $columns;
-
- $wp_query->is_single = 0;
- $wp_query->is_singular = 0;
- $wp_query->is_post_type_archive = 1;
-
- if ( null === $columns || empty( $columns ) || '' === $columns ) {
- $columns = 3;
- }
-
- ob_start();
-
- //Setting some carousel variables
- $carousel_id = rand( 20, 20000 );
- $interval = '6000';
- $post_type = get_post_type();
-
- $slider_atts = array(
- 'slidesToShow' => esc_attr( $columns ),
- 'slidesToScroll' => esc_attr( $columns ),
- );
- $slider_atts = apply_filters( 'lsx_to_related_slider_attributes', $slider_atts );
-
- echo '
';
- echo '
';
- echo '
';
-
- //echo '
';
- echo "
";
-
- while ( $related_query->have_posts() ) :
- $related_query->the_post();
-
- global $disable_placeholder, $disable_text;
-
- $disable_placeholder = apply_filters( 'lsx_to_widget_disable_placeholder', false, $post_type, false, $taxonomy );
- $disable_text = apply_filters( 'lsx_to_widget_disable_text', false, $post_type, false, $taxonomy );
-
- echo '
';
- lsx_to_content( 'content-widget', $post_type );
- echo '
';
- endwhile;
-
- echo '
';
- echo '
';
- echo '
';
- echo '
';
-
- $return = ob_get_clean();
-
- $wp_query->is_single = 1;
- $wp_query->is_singular = 1;
- $wp_query->is_post_type_archive = 0;
-
- wp_reset_postdata();
-
- $return = $before . $return . $after;
- endif;
-
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
- }
-}
-
/**
* Outputs a list of the ids you give it
*
@@ -763,7 +476,7 @@ function to_continent_region_label( $country_code = '' ) {
* @return string
*/
function lsx_to_get_price_type_label( $label_index = '' ) {
- $label = '';
+ $label = '';
switch ( $label_index ) {
case '':
$label = '';
diff --git a/includes/template-tags/maps.php b/includes/template-tags/maps.php
index 4f698bc0..0218fb58 100644
--- a/includes/template-tags/maps.php
+++ b/includes/template-tags/maps.php
@@ -152,6 +152,7 @@ function lsx_to_map( $before = '', $after = '', $echo = true ) {
);
if ( isset( get_queried_object()->term_id ) ) {
+ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
$country_args['tax_query'] = array(
array(
'taxonomy' => 'continent',
diff --git a/includes/template-tags/tour.php b/includes/template-tags/tour.php
deleted file mode 100644
index b5082698..00000000
--- a/includes/template-tags/tour.php
+++ /dev/null
@@ -1,414 +0,0 @@
- 'post',
- 'to' => 'tour',
- 'column' => '3',
- 'before' => '
' . esc_html__( 'Featured Posts', 'tour-operator' ) . ' ',
- );
-
- lsx_to_connected_panel_query( $args );
-}
-
-/**
- * Gets the current tours price
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category tour
- */
-function lsx_to_price( $before = '', $after = '', $echo = true ) {
- lsx_to_custom_field_query( 'price', $before, $after, $echo );
-}
-
-/**
- * Gets the current tours duration
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category tour
- */
-function lsx_to_duration( $before = '', $after = '', $echo = true ) {
- lsx_to_custom_field_query( 'duration', $before, $after, $echo );
-}
-
-/**
- * Gets the current tours included pricing field
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category tour
- */
-function lsx_to_included( $before = '', $after = '', $echo = true ) {
- return lsx_to_custom_field_query( 'included', $before, $after, $echo );
-}
-
-/**
- * Gets the current tours not included pricing field
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category tour
- */
-function lsx_to_not_included( $before = '', $after = '', $echo = true ) {
- return lsx_to_custom_field_query( 'not_included', $before, $after, $echo );
-}
-
-/**
- * Gets the current tours departure points
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category tour
- */
-function lsx_to_departure_point( $before = '', $after = '', $echo = true ) {
- $departs_from = get_post_meta( get_the_ID(), 'departs_from', false );
-
- $options = get_option( '_lsx-to_settings', false );
- if ( ! empty( $departs_from ) && is_array( $departs_from ) && count( $departs_from ) > 0 ) {
- $connected_list = lsx_to_connected_list( $departs_from, 'destination', true, ', ' );
- if ( false !== $options && isset( $options[ 'destination' ] ) && isset( $options[ 'destination' ]['disable_single_region'] ) ) {
- $connected_list = strip_tags( $connected_list );
- }
- $return = $before . $connected_list . $after;
-
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
- }
-}
-
-/**
- * Gets the current tours end points
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category tour
- */
-function lsx_to_end_point( $before = '', $after = '', $echo = true ) {
- $end_point = get_post_meta( get_the_ID(), 'ends_in', false );
- $options = get_option( '_lsx-to_settings', false );
-
- if ( ! empty( $end_point ) && is_array( $end_point ) && count( $end_point ) > 0 ) {
- $connected_list = lsx_to_connected_list( $end_point, 'destination', true, ', ' );
- if ( false !== $options && isset( $options[ 'destination' ] ) && isset( $options[ 'destination' ]['disable_single_region'] ) ) {
- $connected_list = strip_tags( $connected_list );
- }
- $return = $before . $connected_list . $after;
-
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
- }
-}
-
-/**
- * Outputs the tours included / not included block
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category tour
- */
-function lsx_to_included_block() {
- $tour_included = lsx_to_included( '', '', false );
- $tour_not_included = lsx_to_not_included( '', '', false );
-
- if ( null !== $tour_included || null !== $tour_not_included ) {
- $class = 'col-xs-12 col-sm-6';
-
- if ( ( null === $tour_included && null !== $tour_not_included ) || ( null !== $tour_included && null === $tour_not_included ) ) {
- $class = 'col-xs-12';
- }
- ?>
-
- ' . apply_filters( 'the_content', wpautop( $highlights ) ) . '
' . $after;
-
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
- }
-}
-
-/**
- * Outputs the Best Time to Visit HTML
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category tour
- */
-function lsx_to_best_time_to_visit( $before = '', $after = '', $echo = true ) {
- $best_time_to_visit = get_post_meta( get_the_ID(), 'best_time_to_visit', true );
-
- if ( false !== $best_time_to_visit && '' !== $best_time_to_visit && is_array( $best_time_to_visit ) && ! empty( $best_time_to_visit ) ) {
- $this_year = array(
- 'january' => esc_html__( 'January', 'tour-operator' ),
- 'february' => esc_html__( 'February', 'tour-operator' ),
- 'march' => esc_html__( 'March', 'tour-operator' ),
- 'april' => esc_html__( 'April', 'tour-operator' ),
- 'may' => esc_html__( 'May', 'tour-operator' ),
- 'june' => esc_html__( 'June', 'tour-operator' ),
- 'july' => esc_html__( 'July', 'tour-operator' ),
- 'august' => esc_html__( 'August', 'tour-operator' ),
- 'september' => esc_html__( 'September', 'tour-operator' ),
- 'october' => esc_html__( 'October', 'tour-operator' ),
- 'november' => esc_html__( 'November', 'tour-operator' ),
- 'december' => esc_html__( 'December', 'tour-operator ' ),
- );
-
- foreach ( $this_year as $month => $label ) {
- $checked = '';
- $checked_class = '';
-
- if ( in_array( $month, $best_time_to_visit ) ) {
- $checked = '
';
- $checked_class = 'lsx-to-month-check';
- }
-
- $shortname = str_split( $label, 3 );
- $best_times[] = '
' . $shortname[0] . ' ' . $checked . '
';
- };
-
- $return = $before . implode( $best_times ) . $after;
-
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
- }
-}
-
-/**
- * Gets the current specials connected tours
- *
- * @param $before | string
- * @param $after | string
- * @param $echo | boolean
- * @return string
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category connections
- */
-function lsx_to_connected_tours( $before = '', $after = '', $echo = true ) {
- lsx_to_connected_items_query( 'tour', get_post_type(), $before, $after, $echo );
-}
-
-/**
- * Return the Room basis Label.
- *
- * @param string $index
- * @return string
- */
-function lsx_to_room_basis_label( $index = '' ) {
- $label = $index;
- if ( isset( tour_operator()->legacy->tour->room_basis[ $index ] ) ) {
- $label = tour_operator()->legacy->tour->room_basis[ $index ];
- }
- return $label;
-}
-
-/**
- * Outputs The current Itinerary connected destinations, can only be used in
- * the itinerary loop.
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category itinerary
- */
-function lsx_to_itinerary_room_basis( $before = '', $after = '', $echo = true ) {
- global $tour_itinerary;
- if ( $tour_itinerary && $tour_itinerary->has_itinerary && ! empty( $tour_itinerary->itinerary ) ) {
- if ( ! empty( $tour_itinerary->itinerary['room_basis'] ) && 'None' !== $tour_itinerary->itinerary['room_basis'] ) {
- $label = lsx_to_room_basis_label( $tour_itinerary->itinerary['room_basis'] );
- if ( $echo ) {
- echo wp_kses_post( $before . $label . $after );
- } else {
- return $before . $label . $after;
- }
- }
- }
- return '';
-}
-
-/**
- * Return the Drinks basis Label.
- *
- * @param string $index
- * @return string
- */
-function lsx_to_drinks_basis_label( $index = '' ) {
- $label = $index;
- if ( isset( tour_operator()->legacy->tour->drinks_basis[ $index ] ) ) {
- $label = tour_operator()->legacy->tour->drinks_basis[ $index ];
- }
- return $label;
-}
-
-/**
- * Outputs The current Itinerary connected destinations, can only be used in
- * the itinerary loop.
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category itinerary
- */
-function lsx_to_itinerary_drinks_basis( $before = '', $after = '', $echo = true ) {
- global $tour_itinerary;
- if ( $tour_itinerary && $tour_itinerary->has_itinerary && ! empty( $tour_itinerary->itinerary ) ) {
- if ( ! empty( $tour_itinerary->itinerary['drinks_basis'] ) && 'None' !== $tour_itinerary->itinerary['drinks_basis'] ) {
- $label = lsx_to_drinks_basis_label( $tour_itinerary->itinerary['drinks_basis'] );
- if ( $echo ) {
- echo wp_kses_post( $before . $label . $after );
- } else {
- return $before . $label . $after;
- }
- }
- }
- return '';
-}
-
-/**
- * Retrieves the accommodation ids from the itinerary, mostly for use in the map.
- * the itinerary loop.
- *
- * @package tour-operator
- * @subpackage template-tags
- * @category itinerary
- *
- * @param string $meta_key
- * @param string $supress_filters
- * @return array
- */
-function lsx_to_get_tour_itinerary_ids( $meta_key = 'accommodation_to_tour', $supress_filters = false ) {
- $tour_itinerary = new \lsx\legacy\Itinerary_Query();
- $itinerary_ids = array();
-
- if ( false === $supress_filters ) {
- $meta_key = apply_filters( 'lsx_to_get_itinerary_ids_meta_key', $meta_key );
- }
-
- if ( $tour_itinerary->has_itinerary() ) {
- $itinerary_count = 1;
- while ( $tour_itinerary->while_itinerary() ) {
- $tour_itinerary->current_itinerary_item();
-
- if ( ! empty( $tour_itinerary->itinerary[ $meta_key ] ) && '' !== $tour_itinerary->itinerary[ $meta_key] ) {
- if ( ! is_array( $tour_itinerary->itinerary[ $meta_key ] ) ) {
- $d_ids = array( $tour_itinerary->itinerary[ $meta_key ] );
- } else {
- $d_ids = $tour_itinerary->itinerary[ $meta_key ];
- }
- $itinerary_ids = array_merge( $itinerary_ids, array_values( $d_ids ) );
- }
- }
- }
- return $itinerary_ids;
-}
diff --git a/includes/template-tags/videos.php b/includes/template-tags/videos.php
deleted file mode 100644
index 1856639d..00000000
--- a/includes/template-tags/videos.php
+++ /dev/null
@@ -1,115 +0,0 @@
-';
- $content .= '
';
- $content .= '
';
- $content .= '
';
-
- foreach ( $videos as $video ) {
- $content .= '
';
- $content .= '
';
-
- if ( isset( $video['url'] ) && '' !== $video['url'] ) {
- $content .= '';
-
- $embed_key = 'to_videos_embed_' . sanitize_title( $video['url'] );
- $embed = get_transient( $embed_key );
-
- if ( false === $embed ) {
- $embed = wp_oembed_get( $video['url'], array(
- 'class' => 'embed-responsive-item',
- ) );
-
- if ( ! empty( $embed ) ) {
- set_transient( $embed_key, $embed, ( 24 * 60 * 60 ) );
- }
- }
-
- $content .= $embed;
- $content .= '
';
-
- $has_content = ( isset( $video['title'] ) && '' !== $video['title'] ) || ( isset( $video['description'] ) && '' !== $video['description'] );
-
- if ( $has_content ) {
- $content .= '';
-
- if ( isset( $video['title'] ) && '' !== $video['title'] ) {
- $content .= '
' . $video['title'] . ' ';
- }
-
- if ( isset( $video['description'] ) && '' !== $video['description'] ) {
- $content .= apply_filters( 'the_content', $video['description'] );
- }
-
- $content .= '';
- }
- }
-
- $content .= ' ';
- $content .= '
';
- }
-
- $content .= '
';
- $content .= '
';
- $content .= '
';
- $content .= '
';
-
- $return = $content;
- }
-
- $protocol = is_ssl() ? 'https' : 'http';
- $return = preg_replace( '/href="\/\//i', 'href="' . $protocol . '://', $return );
-
- $return = $before . $return . $after;
-
- if ( $echo ) {
- echo wp_kses_post( $return );
- } else {
- return $return;
- }
- }
- }
-}
diff --git a/includes/tour-operator.php b/includes/tour-operator.php
index e742ad41..c021c715 100644
--- a/includes/tour-operator.php
+++ b/includes/tour-operator.php
@@ -19,11 +19,14 @@
*/
function tour_operator_autoload_class( $class ) {
$parts = explode( '\\', $class );
+
if ( 'lsx' === $parts[0] ) {
$path = LSX_TO_PATH . 'includes/classes/';
array_shift( $parts );
$name = array_shift( $parts );
+
+
if ( 'Settings' === $name ) {
$name = 'admin\\' . $name;
}
diff --git a/readme.txt b/readme.txt
index 4bb2d5d7..22262a1d 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,14 +1,15 @@
=== LSX Tour Operator ===
-Contributors: feedmymedia, lightspeedwp, eleshar, krugazul
+Contributors: lightspeedwp, wetudev
Donate link: https://lsdev.biz/lsx/donate/
-Tags: lsx, tour operator, tours, travel, travel-agency
-Requires at least: 6.1
+Tags: lsx, tour operator, travel, tourism, itinerary
+Requires at least: 6.7
Tested up to: 6.7
-Requires PHP: 7.2
-Stable tag: 2.0-beta-2
+Requires PHP: 8.0
+Stable tag: 2.0.0
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
+
The LSX Tour Operator is plugin specially designed & developed for the tourism and travel industry. Build to showcase your tours and accommodation.
== Description ==
diff --git a/templates/archive-accommodation.html b/templates/archive-accommodation.html
index 0154ac30..300f5a03 100644
--- a/templates/archive-accommodation.html
+++ b/templates/archive-accommodation.html
@@ -1,9 +1,9 @@
-