diff --git a/assets/img/rating-star-empty.png b/assets/img/rating-star-empty.png new file mode 100644 index 00000000..397dd7aa Binary files /dev/null and b/assets/img/rating-star-empty.png differ diff --git a/assets/img/rating-star-full.png b/assets/img/rating-star-full.png new file mode 100644 index 00000000..f455440c Binary files /dev/null and b/assets/img/rating-star-full.png differ diff --git a/assets/js/blocks/accommodation.js b/assets/js/blocks/accommodation.js index fa03d4ca..16f7844c 100644 --- a/assets/js/blocks/accommodation.js +++ b/assets/js/blocks/accommodation.js @@ -1044,7 +1044,7 @@ wp.domReady(() => { metadata: { name: 'Facilities', }, - className: 'lsx-facilities-wrapper', + className: 'lsx-facility-wrapper', style: { spacing: { padding: { @@ -1118,9 +1118,27 @@ wp.domReady(() => { } }, [ - ['core/post-terms', { - term: 'facility', - fontSize: 'x-small' + ['core/paragraph', { + metadata: { + bindings: { + content: { + source: 'lsx/post-connection', + args: { + key: 'facilities' + } + } + } + }, + className: 'has-septenary-color has-text-color has-link-color has-primary-color has-primary-700-color', + style: { + spacing: { + padding: { + top: '2px', + bottom: '2px' + } + } + }, + textColor: 'primary-700' }] ] ] diff --git a/assets/js/src/custom.js b/assets/js/src/custom.js index d9f720ac..e379ec29 100755 --- a/assets/js/src/custom.js +++ b/assets/js/src/custom.js @@ -332,17 +332,28 @@ if ( window.location.hash ) { * @subpackage scripts */ lsx_to.build_slider_lightbox = function() { - $( '.single-tour-operator .gallery' ).slickLightbox( { - caption: function( element, info ) { - return $( element ).find( 'img' ).attr( 'alt' ); - } - } ); - - $( '.single-tour-operator .rooms-content' ).slickLightbox( { - caption: function( element, info ) { - return $( element ).find( 'img' ).attr( 'alt' ); - } - } ); + if ( 0 < $( '.wp-block-gallery.has-nested-images' ).length ) { + $( '.wp-block-gallery.has-nested-images' ).slickLightbox( { + caption: function( element, info ) { + return $( element ).find( 'img' ).attr( 'alt' ); + } + } ); + } + + if ( 0 < $( '.lsx-units-wrapper .unit-image a' ).length ) { + let roomImages = $('.lsx-units-wrapper .unit-image a img').map(function() { + return $(this).attr('src'); + }).get(); + console.log(roomImages); + + $( '.lsx-units-wrapper' ).slickLightbox( { + //images : roomImages, + itemSelector: '.unit-image a', + caption: function( element, info ) { + return $( element ).find( 'img' ).attr( 'alt' ); + } + } ); + } }; /** diff --git a/bin/build.command b/bin/build.command deleted file mode 100755 index 9debf22a..00000000 --- a/bin/build.command +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -gulp compile-css; -gulp compile-js; -gulp wordpress-lang; - -exit; diff --git a/includes/actions.php b/includes/actions.php deleted file mode 100644 index 057b5568..00000000 --- a/includes/actions.php +++ /dev/null @@ -1,176 +0,0 @@ -get_template(); -$theme_name = $current_theme->get( 'Name' ); - -if ( 'lsx' !== $current_template && 'LSX' !== $theme_name ) { - /** - * Semantic hooks - * - * $lsx_supports[] = 'content'; - */ - - function lsx_content_wrap_before() { - do_action( 'lsx_content_wrap_before' ); - } - - function lsx_content_wrap_after() { - do_action( 'lsx_content_wrap_after' ); - } - - function lsx_content_before() { - do_action( 'lsx_content_before' ); - } - - function lsx_content_after() { - do_action( 'lsx_content_after' ); - } - - function lsx_content_top() { - do_action( 'lsx_content_top' ); - } - - function lsx_content_bottom() { - do_action( 'lsx_content_bottom' ); - } - - function lsx_content_post_tags() { - do_action( 'lsx_content_post_tags' ); - } - - function lsx_content_sharing() { - do_action( 'lsx_content_sharing' ); - } - - /** - * Semantic hooks - * - * $lsx_supports[] = 'entry'; - */ - - function lsx_entry_before() { - do_action( 'lsx_entry_before' ); - } - - function lsx_entry_after() { - do_action( 'lsx_entry_after' ); - } - - function lsx_entry_top() { - do_action( 'lsx_entry_top' ); - } - - function lsx_entry_bottom() { - do_action( 'lsx_entry_bottom' ); - } - - /** - * .main classes - */ - function lsx_main_class() { - return 'col-sm-12 '; - } - - function lsx_thumbnail( $size = 'thumbnail', $image_src = false ) { - echo wp_kses_post( lsx_get_thumbnail( $size, $image_src ) ); - } - - function lsx_get_thumbnail( $size, $image_src = false ) { - global $wp_version; - if ( false === $image_src ) { - $post_id = get_the_ID(); - $post_thumbnail_id = get_post_thumbnail_id( $post_id ); - } elseif ( false !== $image_src ) { - if ( is_numeric( $image_src ) ) { - $post_thumbnail_id = $image_src; - } else { - $post_thumbnail_id = lsx_get_attachment_id_from_src( $image_src ); - } - } - - $size = apply_filters( 'lsx_thumbnail_size', $size ); - $img = false; - - if ( 'lsx-thumbnail-single' === $size || 'lsx-thumbnail-wide' === $size || 'thumbnail' === $size ) { - $srcset = false; - $img = wp_get_attachment_image_src( $post_thumbnail_id, $size ); - $img = $img[0]; - } else { - $srcset = true; - $img = wp_get_attachment_image_srcset( $post_thumbnail_id, $size ); - - if ( false === $img ) { - $srcset = false; - $img = wp_get_attachment_image_src( $post_thumbnail_id, $size ); - $img = $img[0]; - } - } - - if ( $srcset ) { - $img = '' . the_title_attribute( 'echo=0' ) . ''; - } else { - $img = '' . the_title_attribute( 'echo=0' ) . ''; - } - - if ( version_compare( $wp_version, '5.5', '>=' ) ) { - if ( $srcset ) { - $img = '' . the_title_attribute( 'echo=0' ) . ''; - } else { - $img = '' . the_title_attribute( 'echo=0' ) . ''; - } - } - - if ( ! version_compare( $wp_version, '5.5', '>=' ) ) { - $img = apply_filters( 'lsx_lazyload_filter_images', $img ); - } - return $img; - } - - function lsx_get_attachment_id_from_src( $image_src ) { - $post_id = wp_cache_get( $image_src, 'lsx_get_attachment_id_from_src' ); - - if ( false === $post_id ) { - global $wpdb; - $post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src ) ); - wp_cache_set( $image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600 ); - } - - return $post_id; - } -} - -function lsx_to_content( $slug, $name = null ) { - do_action( 'lsx_to_content', $slug, $name ); -} - -function lsx_to_modal_meta() { - do_action( 'lsx_to_modal_meta' ); -} - -function lsx_to_entry_content_top() { - do_action( 'lsx_to_entry_content_top' ); -} - -function lsx_to_entry_content_bottom() { - do_action( 'lsx_to_entry_content_bottom' ); -} - -function lsx_to_widget_entry_content_top() { - do_action( 'lsx_to_widget_entry_content_top' ); -} - -function lsx_to_widget_entry_content_bottom() { - do_action( 'lsx_to_widget_entry_content_bottom' ); -} - -function lsx_to_fast_facts() { - do_action( 'lsx_to_fast_facts' ); -} diff --git a/includes/classes/admin/class-setup.php b/includes/classes/admin/class-setup.php index 03028004..b2edfd20 100644 --- a/includes/classes/admin/class-setup.php +++ b/includes/classes/admin/class-setup.php @@ -19,14 +19,6 @@ */ class Setup { - /** - * Holds instance of the class - * - * @since 1.1.0 - * @var \lsx\admin\Setup - */ - private static $instance; - /** * Holds the tour operators options * @@ -56,24 +48,39 @@ public function __construct() { 'accommodation', 'destination', ); + add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); add_action( 'init', array( $this, 'register_meta_with_rest' ) ); add_action( 'cmb2_admin_init', array( $this, 'register_cmb2_fields' ) ); + + // Allow extra tags and attributes to wp_kses_post(). + add_filter( + 'wp_kses_allowed_html', + array( + $this, + 'wp_kses_allowed_html', + ), + 10, + 2 + ); + // Allow extra protocols to wp_kses_post(). + add_filter( + 'kses_allowed_protocols', + array( + $this, + 'kses_allowed_protocols', + ) + ); + // Allow extra style attributes to wp_kses_post(). + add_filter( 'safe_style_css', array( $this, 'safe_style_css' ) ); } /** - * Return an instance of this class. + * Load the plugin text domain for translation. * - * @since 1.1.0 - * @return Tour_Operator A single instance + * @since 0.0.1 */ - public static function init() { - - // If the single instance hasn't been set, set it now. - if ( ! isset( self::$instance ) ) { - self::$instance = new self(); - } - - return self::$instance; + public function load_plugin_textdomain() { + load_plugin_textdomain( 'tour-operator', false, basename( LSX_TO_PATH ) . '/languages' ); } /** @@ -168,4 +175,175 @@ public function get_custom_fields( $type = '' ) { } return $fields; } + + /** + * Allow extra tags and attributes to wp_kses_post() + */ + public function wp_kses_allowed_html( $allowedtags, $context ) { + if ( ! isset( $allowedtags['i'] ) ) { + $allowedtags['i'] = array(); + } + $allowedtags['i']['aria-hidden'] = true; + + if ( ! isset( $allowedtags['span'] ) ) { + $allowedtags['span'] = array(); + } + + $allowedtags['span']['aria-hidden'] = true; + + if ( ! isset( $allowedtags['button'] ) ) { + $allowedtags['button'] = array(); + } + + $allowedtags['button']['aria-label'] = true; + $allowedtags['button']['data-dismiss'] = true; + + if ( ! isset( $allowedtags['li'] ) ) { + $allowedtags['li'] = array(); + } + + $allowedtags['li']['data-target'] = true; + $allowedtags['li']['data-slide-to'] = true; + + if ( ! isset( $allowedtags['a'] ) ) { + $allowedtags['a'] = array(); + } + + + $allowedtags['a']['target'] = true; + $allowedtags['a']['data-toggle'] = true; + $allowedtags['a']['data-target'] = true; + $allowedtags['a']['data-slide'] = true; + $allowedtags['a']['data-collapsed'] = true; + $allowedtags['a']['data-envira-caption'] = true; + $allowedtags['a']['data-envira-retina'] = true; + $allowedtags['a']['data-thumbnail'] = true; + $allowedtags['a']['data-mobile-thumbnail'] = true; + $allowedtags['a']['data-envirabox-type'] = true; + $allowedtags['a']['data-video-width'] = true; + $allowedtags['a']['data-video-height'] = true; + $allowedtags['a']['data-video-aspect-ratio'] = true; + + if ( ! isset( $allowedtags['h2'] ) ) { + $allowedtags['h2'] = array(); + } + + $allowedtags['h2']['data-target'] = true; + $allowedtags['h2']['data-toggle'] = true; + + if ( ! isset( $allowedtags['div'] ) ) { + $allowedtags['div'] = array(); + } + + $allowedtags['div']['aria-labelledby'] = true; + $allowedtags['div']['data-interval'] = true; + $allowedtags['div']['data-icon'] = true; + $allowedtags['div']['data-id'] = true; + $allowedtags['div']['data-class'] = true; + $allowedtags['div']['data-long'] = true; + $allowedtags['div']['data-lat'] = true; + $allowedtags['div']['data-zoom'] = true; + $allowedtags['div']['data-link'] = true; + $allowedtags['div']['data-thumbnail'] = true; + $allowedtags['div']['data-title'] = true; + $allowedtags['div']['data-type'] = true; + $allowedtags['div']['data-cluster-small'] = true; + $allowedtags['div']['data-cluster-medium'] = true; + $allowedtags['div']['data-cluster-large'] = true; + $allowedtags['div']['data-fusion-tables'] = true; + $allowedtags['div']['data-fusion-tables-colour-border'] = true; + $allowedtags['div']['data-fusion-tables-width-border'] = true; + $allowedtags['div']['data-fusion-tables-colour-background'] = true; + $allowedtags['div']['itemscope'] = true; + $allowedtags['div']['itemtype'] = true; + $allowedtags['div']['data-row-height'] = true; + $allowedtags['div']['data-justified-margins'] = true; + $allowedtags['div']['data-slick'] = true; + + //Envirta Gallery tags + // + $allowedtags['div']['data-envira-id'] = true; + $allowedtags['div']['data-gallery-config'] = true; + $allowedtags['div']['data-gallery-images'] = true; + $allowedtags['div']['data-gallery-theme'] = true; + $allowedtags['div']['data-envira-columns'] = true; + + if ( ! isset( $allowedtags['img'] ) ) { + $allowedtags['img'] = array(); + } + + $allowedtags['img']['data-envira-index'] = true; + $allowedtags['img']['data-envira-caption'] = true; + $allowedtags['img']['data-envira-gallery-id'] = true; + $allowedtags['img']['data-envira-item-id'] = true; + $allowedtags['img']['data-envira-src'] = true; + $allowedtags['img']['data-envira-srcset'] = true; + + if ( ! isset( $allowedtags['input'] ) ) { + $allowedtags['input'] = array(); + } + + $allowedtags['input']['type'] = true; + $allowedtags['input']['id'] = true; + $allowedtags['input']['name'] = true; + $allowedtags['input']['value'] = true; + $allowedtags['input']['size'] = true; + $allowedtags['input']['checked'] = true; + $allowedtags['input']['onclick'] = true; + $allowedtags['input']['class'] = true; + $allowedtags['input']['placeholder'] = true; + $allowedtags['input']['autocomplete'] = true; + + if ( ! isset( $allowedtags['select'] ) ) { + $allowedtags['select'] = array(); + } + + $allowedtags['select']['name'] = true; + $allowedtags['select']['id'] = true; + $allowedtags['select']['disabled'] = true; + $allowedtags['select']['onchange'] = true; + + if ( ! isset( $allowedtags['option'] ) ) { + $allowedtags['option'] = array(); + } + + $allowedtags['option']['value'] = true; + $allowedtags['option']['selected'] = true; + + if ( ! isset( $allowedtags['iframe'] ) ) { + $allowedtags['iframe'] = array(); + } + + $allowedtags['iframe']['src'] = true; + $allowedtags['iframe']['width'] = true; + $allowedtags['iframe']['height'] = true; + $allowedtags['iframe']['frameborder'] = true; + $allowedtags['iframe']['allowfullscreen'] = true; + $allowedtags['iframe']['style'] = true; + + if ( ! isset( $allowedtags['noscript'] ) ) { + $allowedtags['noscript'] = array(); + } + + return $allowedtags; + } + + /** + * Allow extra protocols to wp_kses_post() + */ + public function kses_allowed_protocols( $allowedprotocols ) { + $allowedprotocols[] = 'tel'; + + return $allowedprotocols; + } + + /** + * Allow extra style attributes to wp_kses_post() + */ + public function safe_style_css( $allowedstyles ) { + $allowedstyles[] = 'display'; + $allowedstyles[] = 'background-image'; + + return $allowedstyles; + } } \ No newline at end of file diff --git a/includes/classes/blocks/class-bindings.php b/includes/classes/blocks/class-bindings.php index 67f9ddde..1c529f53 100644 --- a/includes/classes/blocks/class-bindings.php +++ b/includes/classes/blocks/class-bindings.php @@ -149,6 +149,10 @@ public function post_connections_callback( $source_args, $block_instance ) { $value = $this->prep_links( [ $args ] ); break; + case 'facilities': + $value = lsx_to_accommodation_facilities( '', '', false ); + break; + default: // For custom fields. @@ -380,7 +384,7 @@ public function build_image( $build = '', $classname = 'itinerary-image' ) { } else { $img_src = $rooms->item_thumbnail(); } - + $tags->set_attribute( 'rel', sanitize_key( $classname ) ); $tags->set_attribute( 'src', $img_src ); $build = $tags->get_updated_html(); } @@ -598,11 +602,16 @@ public function render_gallery_block( $block_content, $parsed_block, $block_obj $link = true; } + $target = ''; + if ( isset( $parsed_block['attrs']['linkTarget'] ) ) { + $target = 'target="' . $parsed_block['attrs']['linkTarget'] . '"'; + } + $count = 1; foreach ( $gallery as $gid => $gurl ) { if ( $link ) { - $link_prefix = ''; + $link_prefix = ''; $link_suffix = ''; } diff --git a/includes/classes/blocks/class-registration.php b/includes/classes/blocks/class-registration.php index 9db094b1..3207168a 100644 --- a/includes/classes/blocks/class-registration.php +++ b/includes/classes/blocks/class-registration.php @@ -174,12 +174,15 @@ public function query_args_filter( $query, $block ) { // Get the current destinations attached $destinations = get_post_meta( get_the_ID(), 'destination_to_' . $from, true ); + + do_action( 'qm/debug', $destinations ); + if ( ! empty( $destinations ) ) { $items = []; foreach ( $destinations as $destination ) { $found_items = get_post_meta( $destination, $to . '_to_destination', true ); - + do_action( 'qm/debug', [ $to . '_to_destination', $found_items ] ); if ( ! empty( $found_items ) ) { if ( ! is_array( $found_items ) ) { $found_items = [ $found_items ]; @@ -187,6 +190,7 @@ public function query_args_filter( $query, $block ) { $items = array_merge( $items, $found_items ); } } + if ( ! empty( $items ) ) { $items = array_unique( $items ); $items = array_diff( $items, $excluded_items ); @@ -194,6 +198,8 @@ public function query_args_filter( $query, $block ) { } } + do_action( 'qm/debug', $query['post__in'] ); + if ( ! isset( $query['post__in'] ) ) { $this->disabled[ $key ] = true; } @@ -218,6 +224,9 @@ public function query_args_filter( $query, $block ) { $from = $directions[1]; $found_items = get_post_meta( get_the_ID(), $to . '_to_' . $from, true ); + + do_action( 'qm/debug', [ get_the_ID(), $to . '_to_' . $from, $found_items ] ); + if ( false !== $found_items && ! empty( $found_items ) ) { if ( ! is_array( $found_items ) ) { $found_items = [ $found_items ]; diff --git a/includes/classes/class-tour-operator.php b/includes/classes/class-tour-operator.php index 2828c8f3..ae846eed 100644 --- a/includes/classes/class-tour-operator.php +++ b/includes/classes/class-tour-operator.php @@ -219,7 +219,7 @@ public function setup() { $this->taxonomies = Taxonomies::init(); $this->admin = new Admin(); $this->settings = Settings::init(); - $this->setup = Setup::init(); + $this->setup = new Setup(); $this->bindings = new Bindings(); $this->registration = new Registration(); $this->patterns = new Patterns(); diff --git a/includes/classes/legacy/class-accommodation.php b/includes/classes/legacy/class-accommodation.php index b96d28ef..d0ccb24a 100644 --- a/includes/classes/legacy/class-accommodation.php +++ b/includes/classes/legacy/class-accommodation.php @@ -173,22 +173,20 @@ public function rating( $html = '', $meta_key = false, $value = false, $before = $html = ''; if ( 0 !== (int) $value ) { while ( $counter > 0 ) { + $ratings_array[] = '
'; + $ratings_array[] = ''; + $ratings_array[] = LSX_TO_URL . 'assets/img/rating-star-full.png'; } else { - $ratings_array[] = ''; + $ratings_array[] = LSX_TO_URL . 'assets/img/rating-star-empty.png'; } + $ratings_array[] = '" alt="" style="width:20px;vertical-align:sub;">'; + $ratings_array[] = '
'; $counter --; $value --; } - $rating_type = get_post_meta( get_the_ID(), 'rating_type', true ); - $rating_description = ''; - - if ( false !== $rating_type && '' !== $rating_type && esc_html__( 'Unspecified', 'tour-operator' ) !== $rating_type ) { - $rating_description = ' (' . $rating_type . ')'; - } - $html = $before . implode( '', $ratings_array ) . $rating_description . $after; + $html = $before . implode( '', $ratings_array ) . $after; } } return $html; diff --git a/includes/classes/legacy/class-admin.php b/includes/classes/legacy/class-admin.php index 836adc60..5472d68f 100644 --- a/includes/classes/legacy/class-admin.php +++ b/includes/classes/legacy/class-admin.php @@ -326,6 +326,4 @@ public function add_tagline_form_field( $term = false ) { options = get_option( '_lsx-to_settings', false ); $this->set_vars(); - add_filter( 'post_class', array( $this, 'replace_class' ), 10, 1 ); - add_filter( 'body_class', array( $this, 'replace_class' ), 10, 1 ); - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_stylescripts' ), 1 ); add_action( 'wp_head', array( $this, 'wp_head' ), 10 ); add_filter( 'body_class', array( $this, 'body_class' ), 15, 1 ); @@ -79,20 +76,6 @@ public function __construct() { add_filter( 'wpseo_breadcrumb_links', array( $this, 'wpseo_breadcrumb_links' ), 20 ); } - /** - * A filter to replace anything with '-TO_POST_TYPE' by - * '-lsx-to-TO_POST_TYPE' - */ - public function replace_class( $classes ) { - foreach ( $this->active_post_types as $key1 => $value1 ) { - foreach ( $classes as $key2 => $value2 ) { - $classes[ $key2 ] = str_replace( "-{$value1}", "-lsx-to-{$value1}", $value2 ); - } - } - - return $classes; - } - /** * Initate some boolean flags */ @@ -104,27 +87,6 @@ public function wp_head() { ) { $this->enable_modals = true; } - - if ( ( is_post_type_archive( $this->active_post_types ) ) || ( is_tax( array_keys( $this->taxonomies ) ) ) ) { - add_filter( 'use_default_gallery_style', '__return_false' ); - - add_action( 'lsx_content_wrap_before', 'lsx_to_archive_description', 100 ); - add_filter( 'lsx_to_archive_description', array( $this, 'get_post_type_archive_description' ), 1, 3 ); - - add_action( 'lsx_content_top', array( $this, 'archive_taxonomy_content_part' ), 100 ); - - // LSX default pagination - add_action( 'lsx_content_bottom', array( 'lsx\legacy\Frontend', 'lsx_default_pagination' ) ); - } - } - - /** - * Taxonomy Archive content part. - */ - public function archive_taxonomy_content_part() { - if ( is_tax( array_keys( $this->taxonomies ) ) && have_posts() ) { - lsx_to_content( 'content', get_queried_object()->taxonomy ); - } } /** @@ -330,13 +292,6 @@ public function get_the_archive_title( $title ) { return $title; } - /** - * Outputs LSX default pagination. - */ - public static function lsx_default_pagination() { - lsx_paging_nav(); - } - /** * Add continent item to the breadcrumb. */ diff --git a/includes/classes/legacy/class-tour-operator.php b/includes/classes/legacy/class-tour-operator.php index c5ddf6e9..c9c13988 100644 --- a/includes/classes/legacy/class-tour-operator.php +++ b/includes/classes/legacy/class-tour-operator.php @@ -164,18 +164,8 @@ class Tour_Operator { */ private function __construct() { add_action( 'init', array( $this, 'disable_deprecated' ), 0 ); - add_action( 'admin_init', array( $this, 'compatible_version_check' ) ); add_action( 'plugins_loaded', array( $this, 'trigger_schema' ), 10 ); - // Theme compatibility check. - add_action( 'admin_notices', array( $this, 'compatible_theme_check' ) ); - add_action( 'wp_ajax_lsx_to_theme_notice_dismiss', array( $this, 'theme_notice_dismiss' ) ); - - // Don't run anything else in the plugin, if we're on an incompatible PHP version. - if ( ! self::compatible_version() ) { - return; - } - // Start sort engine. new SCPO_Engine(); @@ -187,30 +177,8 @@ private function __construct() { add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); // Add our action to init to set up our vars first. - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); add_action( 'init', array( $this, 'require_post_type_classes' ), 1 ); - // Allow extra tags and attributes to wp_kses_post(). - add_filter( - 'wp_kses_allowed_html', - array( - $this, - 'wp_kses_allowed_html', - ), - 10, - 2 - ); - // Allow extra protocols to wp_kses_post(). - add_filter( - 'kses_allowed_protocols', - array( - $this, - 'kses_allowed_protocols', - ) - ); - // Allow extra style attributes to wp_kses_post(). - add_filter( 'safe_style_css', array( $this, 'safe_style_css' ) ); - // init admin object. $this->admin = new Admin(); // init frontend object. @@ -302,14 +270,7 @@ public function disable_deprecated() { } } - /** - * Load the plugin text domain for translation. - * - * @since 0.0.1 - */ - public function load_plugin_textdomain() { - load_plugin_textdomain( 'tour-operator', false, basename( LSX_TO_PATH ) . '/languages' ); - } + /** * Sets the variables for the class @@ -366,6 +327,8 @@ public function set_map_vars() { $this->map_post_types = array( 'accommodation', 'activity', 'destination' ); $this->markers = new \stdClass(); + do_action( 'qm/debug', $this->options['googlemaps_key'] ); + if ( ( false !== $this->options && isset( $this->options['googlemaps_key'] ) ) || defined( 'GOOGLEMAPS_API_KEY' ) ) { if ( ! defined( 'GOOGLEMAPS_API_KEY' ) ) { $this->google_api_key = $this->options['googlemaps_key']; @@ -554,219 +517,6 @@ public function get_tagline( $tagline = false, $before = '', $after = '' ) { return $tagline; } - /** - * A filter that outputs the description for the post_type archives. - */ - public function get_post_type_archive_description( $description = false, $before = '', $after = '' ) { - if ( is_post_type_archive( $this->active_post_types ) && isset( $this->options[ get_post_type() ] ) && isset( $this->options[ get_post_type() ]['description'] ) && '' !== $this->options[ get_post_type() ]['description'] ) { - $description = $this->options[ get_post_type() ]['description']; - //$description = $this->apply_filters_the_content( $description ); - $description = $before . $description . $after; - } - - return $description; - } - - /** - * Return any content with "read more" button and filtered by the_content - */ - public function apply_filters_the_content( $content = '', $more_link_text = 'Read More', $link = '' ) { - $output = ''; - - if ( preg_match( '//', $content, $matches ) ) { - $content = explode( $matches[0], $content, 2 ); - - if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) { - $more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) ); - } - } else { - $content = array( $content ); - } - - $output .= $content[0]; - - if ( count( $content ) > 1 ) { - if ( empty( $link ) ) { - $output .= "{$more_link_text}" . $content[1]; - } else { - $output .= "{$more_link_text}"; - } - } - - $output = apply_filters( 'the_content', $output ); - - return $output; - } - - /** - * Allow extra tags and attributes to wp_kses_post() - */ - public function wp_kses_allowed_html( $allowedtags, $context ) { - if ( ! isset( $allowedtags['i'] ) ) { - $allowedtags['i'] = array(); - } - $allowedtags['i']['aria-hidden'] = true; - - if ( ! isset( $allowedtags['span'] ) ) { - $allowedtags['span'] = array(); - } - - $allowedtags['span']['aria-hidden'] = true; - - if ( ! isset( $allowedtags['button'] ) ) { - $allowedtags['button'] = array(); - } - - $allowedtags['button']['aria-label'] = true; - $allowedtags['button']['data-dismiss'] = true; - - if ( ! isset( $allowedtags['li'] ) ) { - $allowedtags['li'] = array(); - } - - $allowedtags['li']['data-target'] = true; - $allowedtags['li']['data-slide-to'] = true; - - if ( ! isset( $allowedtags['a'] ) ) { - $allowedtags['a'] = array(); - } - - $allowedtags['a']['data-toggle'] = true; - $allowedtags['a']['data-target'] = true; - $allowedtags['a']['data-slide'] = true; - $allowedtags['a']['data-collapsed'] = true; - $allowedtags['a']['data-envira-caption'] = true; - $allowedtags['a']['data-envira-retina'] = true; - $allowedtags['a']['data-thumbnail'] = true; - $allowedtags['a']['data-mobile-thumbnail'] = true; - $allowedtags['a']['data-envirabox-type'] = true; - $allowedtags['a']['data-video-width'] = true; - $allowedtags['a']['data-video-height'] = true; - $allowedtags['a']['data-video-aspect-ratio'] = true; - - if ( ! isset( $allowedtags['h2'] ) ) { - $allowedtags['h2'] = array(); - } - - $allowedtags['h2']['data-target'] = true; - $allowedtags['h2']['data-toggle'] = true; - - if ( ! isset( $allowedtags['div'] ) ) { - $allowedtags['div'] = array(); - } - - $allowedtags['div']['aria-labelledby'] = true; - $allowedtags['div']['data-interval'] = true; - $allowedtags['div']['data-icon'] = true; - $allowedtags['div']['data-id'] = true; - $allowedtags['div']['data-class'] = true; - $allowedtags['div']['data-long'] = true; - $allowedtags['div']['data-lat'] = true; - $allowedtags['div']['data-zoom'] = true; - $allowedtags['div']['data-link'] = true; - $allowedtags['div']['data-thumbnail'] = true; - $allowedtags['div']['data-title'] = true; - $allowedtags['div']['data-type'] = true; - $allowedtags['div']['data-cluster-small'] = true; - $allowedtags['div']['data-cluster-medium'] = true; - $allowedtags['div']['data-cluster-large'] = true; - $allowedtags['div']['data-fusion-tables'] = true; - $allowedtags['div']['data-fusion-tables-colour-border'] = true; - $allowedtags['div']['data-fusion-tables-width-border'] = true; - $allowedtags['div']['data-fusion-tables-colour-background'] = true; - $allowedtags['div']['itemscope'] = true; - $allowedtags['div']['itemtype'] = true; - $allowedtags['div']['data-row-height'] = true; - $allowedtags['div']['data-justified-margins'] = true; - $allowedtags['div']['data-slick'] = true; - - //Envirta Gallery tags - // - $allowedtags['div']['data-envira-id'] = true; - $allowedtags['div']['data-gallery-config'] = true; - $allowedtags['div']['data-gallery-images'] = true; - $allowedtags['div']['data-gallery-theme'] = true; - $allowedtags['div']['data-envira-columns'] = true; - - if ( ! isset( $allowedtags['img'] ) ) { - $allowedtags['img'] = array(); - } - - $allowedtags['img']['data-envira-index'] = true; - $allowedtags['img']['data-envira-caption'] = true; - $allowedtags['img']['data-envira-gallery-id'] = true; - $allowedtags['img']['data-envira-item-id'] = true; - $allowedtags['img']['data-envira-src'] = true; - $allowedtags['img']['data-envira-srcset'] = true; - - if ( ! isset( $allowedtags['input'] ) ) { - $allowedtags['input'] = array(); - } - - $allowedtags['input']['type'] = true; - $allowedtags['input']['id'] = true; - $allowedtags['input']['name'] = true; - $allowedtags['input']['value'] = true; - $allowedtags['input']['size'] = true; - $allowedtags['input']['checked'] = true; - $allowedtags['input']['onclick'] = true; - $allowedtags['input']['class'] = true; - $allowedtags['input']['placeholder'] = true; - $allowedtags['input']['autocomplete'] = true; - - if ( ! isset( $allowedtags['select'] ) ) { - $allowedtags['select'] = array(); - } - - $allowedtags['select']['name'] = true; - $allowedtags['select']['id'] = true; - $allowedtags['select']['disabled'] = true; - $allowedtags['select']['onchange'] = true; - - if ( ! isset( $allowedtags['option'] ) ) { - $allowedtags['option'] = array(); - } - - $allowedtags['option']['value'] = true; - $allowedtags['option']['selected'] = true; - - if ( ! isset( $allowedtags['iframe'] ) ) { - $allowedtags['iframe'] = array(); - } - - $allowedtags['iframe']['src'] = true; - $allowedtags['iframe']['width'] = true; - $allowedtags['iframe']['height'] = true; - $allowedtags['iframe']['frameborder'] = true; - $allowedtags['iframe']['allowfullscreen'] = true; - $allowedtags['iframe']['style'] = true; - - if ( ! isset( $allowedtags['noscript'] ) ) { - $allowedtags['noscript'] = array(); - } - - return $allowedtags; - } - - /** - * Allow extra protocols to wp_kses_post() - */ - public function kses_allowed_protocols( $allowedprotocols ) { - $allowedprotocols[] = 'tel'; - - return $allowedprotocols; - } - - /** - * Allow extra style attributes to wp_kses_post() - */ - public function safe_style_css( $allowedstyles ) { - $allowedstyles[] = 'display'; - $allowedstyles[] = 'background-image'; - - return $allowedstyles; - } - /** * checks which plugin is active, and grabs those forms. */ @@ -897,126 +647,4 @@ public function activated_plugin() { } } } - - /** - * Check if the PHP version is compatible. - * - * @since 1.0.2 - */ - public static function compatible_version() { - if ( version_compare( PHP_VERSION, '7.0', '<' ) ) { - return false; - } - - return true; - } - - /** - * The backup sanity check, in case the plugin is activated in a weird way, - * or the versions change after activation. - * - * @since 1.0.2 - */ - public function compatible_version_check() { - if ( ! self::compatible_version() ) { - if ( is_plugin_active( plugin_basename( LSX_TO_CORE ) ) ) { - deactivate_plugins( plugin_basename( LSX_TO_CORE ) ); - add_action( 'admin_notices', array( $this, 'compatible_version_notice' ) ); - - if ( isset( $_GET['activate'] ) ) { - unset( $_GET['activate'] ); - } - } - } - } - - /** - * Display the notice related with the older version from PHP. - * - * @since 1.0.2 - */ - public function compatible_version_notice() { - $class = 'notice notice-error'; - $message = esc_html__( 'LSX Tour Operator Plugin requires PHP 7.0 or higher.', 'tour-operator' ); - printf( '

%2$s

', esc_html( $class ), esc_html( $message ) ); - } - - /** - * The primary sanity check, automatically disable the plugin on activation - * if it doesn't meet minimum requirements. - * - * @since 1.0.2 - */ - public static function compatible_version_check_on_activation() { - if ( ! self::compatible_version() ) { - deactivate_plugins( plugin_basename( LSX_TO_CORE ) ); - wp_die( esc_html__( 'LSX Tour Operator Plugin requires PHP 7.0 or higher.', 'tour-operator' ) ); - } - } - - /** - * Check if the theme is compatible. - * - * @since 1.1.0 - */ - public static function compatible_theme() { - $current_theme = wp_get_theme(); - $current_template = $current_theme->get_template(); - $theme_name = $current_theme->get( 'Name' ); - - if ( 'lsx' !== $current_template && 'LSX' !== $theme_name ) { - return false; - } - - return true; - } - - /** - * Adds an admin notice (requires LSX). - * - * @since 1.1.0 - */ - public function compatible_theme_check() { - if ( ! self::compatible_theme() ) { - if ( is_plugin_active( plugin_basename( LSX_TO_CORE ) ) ) { - if ( empty( get_option( 'lsx-to-theme-notice-dismissed' ) ) ) { - //add_action( 'admin_notices', array( $this, 'compatible_theme_notice' ), 199 ); - } - } - } - } - - /** - * Display an admin notice (requires LSX). - * - * @since 1.1.0 - */ - public function compatible_theme_notice() { - ?> -
-

- ', - '' - ); - ?> -

-

-
- options = false; } - $this->room_basis = array( - 'None' => esc_html__( 'None', 'tour-operator' ), - 'BedAndBreakfast' => esc_html__( 'B&B: Bed and Breakfast', 'tour-operator' ), - 'RoomOnly' => esc_html__( 'Room Only', 'tour-operator' ), - 'SelfCatering' => esc_html__( 'Self Catering', 'tour-operator' ), - 'Lunch' => esc_html__( 'Lunch', 'tour-operator' ), - 'Dinner' => esc_html__( 'Dinner', 'tour-operator' ), - 'LunchAndDinner' => esc_html__( 'Lunch and Dinner', 'tour-operator' ), - 'BedBreakfastAndLunch' => esc_html__( 'Bed, Breakfast and Lunch', 'tour-operator' ), - 'DinnerBedAndBreakfast' => esc_html__( 'Dinner, Bed and Breakfast', 'tour-operator' ), - 'HalfBoard' => esc_html__( 'Half Board - Dinner, Bed and Breakfast', 'tour-operator' ), - 'DinnerBedBreakfastAndActivities' => esc_html__( 'Half Board Plus - Dinner, Bed, Breakfast and Activities', 'tour-operator' ), - 'DinnerBedBreakfastAndLunch' => esc_html__( 'Full Board - Dinner, Bed, Breakfast and Lunch', 'tour-operator' ), - 'DinnerBedBreakfastLunchAndActivities' => esc_html__( 'Full Board Plus - Dinner, Bed, Breakfast, Lunch and Activities', 'tour-operator' ), - 'AllInclusiveBedAndAllMeals' => esc_html__( 'All Inclusive - Bed and All Meals', 'tour-operator' ), - 'FullyInclusive' => esc_html__( 'Fully Inclusive - Bed, All Meals, Fees and Activities', 'tour-operator' ), - 'ExclusiveClubPremierBenefits' => esc_html__( 'Premier - Executive Club / Premier Benefits', 'tour-operator' ), - ); - - $this->drinks_basis = array( - 'None' => esc_html__( 'None', 'tour-operator' ), - 'TeaCoffee' => esc_html__( 'Tea and Coffee Only', 'tour-operator' ), - 'DrinksSoft' => esc_html__( 'Tea, Coffee and Soft Drinks Only', 'tour-operator' ), - 'DrinksLocalBrands' => esc_html__( 'All Local Brands (Spirits, Wine and Beers)', 'tour-operator' ), - 'DrinksExclSpirits' => esc_html__( 'All Local Brands (excl Spirits)', 'tour-operator' ), - 'DrinksExclChampagne' => esc_html__( 'All Drinks (excl Champagne)', 'tour-operator' ), - 'DrinksExclPremium' => esc_html__( 'All Drinks (excl Premium Brands)', 'tour-operator' ), - 'AllDrinks' => esc_html__( 'All Drinks', 'tour-operator' ), - ); - // activate property post type. add_action( 'init', array( $this, 'set_vars' ) ); diff --git a/includes/classes/legacy/class-unit-query.php b/includes/classes/legacy/class-unit-query.php index 1d6d36af..2dad81f7 100644 --- a/includes/classes/legacy/class-unit-query.php +++ b/includes/classes/legacy/class-unit-query.php @@ -212,7 +212,7 @@ public function item_thumbnail() { $thumbnail_src = false; $thumbnail_src = apply_filters( 'lsx_to_accommodation_room_thumbnail', $thumbnail_src ); if ( $this->have_query && false !== $this->query_item && ! empty( $this->query_item ) ) { - if ( false !== $this->query_item['gallery'] ) { + if ( isset( $this->query_item['gallery'] ) && ! empty( $this->query_item['gallery'] ) ) { $images = array_keys( $this->query_item['gallery'] ); $thumbnail = wp_get_attachment_image_src( $images[0], 'medium' ); if ( is_array( $thumbnail ) ) { @@ -234,7 +234,7 @@ public function item_thumbnails() { if ( $this->have_query && false !== $this->query_item ) { $images_return = array(); - if ( isset( $this->query_item['gallery'] ) && false !== $this->query_item['gallery'] ) { + if ( isset( $this->query_item['gallery'] ) && ! empty( $this->query_item['gallery'] ) ) { $images = array_keys( $this->query_item['gallery'] ); foreach ( $images as $key => $value ) { diff --git a/includes/customizer.php b/includes/customizer.php deleted file mode 100644 index 3efad440..00000000 --- a/includes/customizer.php +++ /dev/null @@ -1,96 +0,0 @@ - esc_html__( 'LSX Tour Operator', 'tour-operator' ), - 'colors' => array( - 'button_background_color' => '#1098AD', - 'button_background_hover_color' => '#0E8395', - 'button_text_color' => '#FFFFFF', - 'button_text_color_hover' => '#FFFFFF', - 'button_shadow' => '#0C7383', - - 'button_cta_background_color' => '#F7AE00', - 'button_cta_background_hover_color' => '#EDA700', - 'button_cta_text_color' => '#FFFFFF', - 'button_cta_text_color_hover' => '#FFFFFF', - 'button_cta_shadow' => '#AB7800', - - 'top_menu_background_color' => '#F2F2F2', - 'top_menu_link_color' => '#1098AD', - 'top_menu_link_hover_color' => '#F7AE00', - 'top_menu_icon_color' => '#434343', - 'top_menu_icon_hover_color' => '#F7AE04', - 'top_menu_dropdown_color' => '#374750', - 'top_menu_dropdown_hover_color' => '#2B3840', - 'top_menu_dropdown_link_color' => '#FFFFFF', - 'top_menu_dropdown_link_hover_color' => '#1098AD', - - 'header_background_color' => '#FFFFFF', - 'header_link_color' => '#1098AD', - 'header_link_hover_color' => '#F7AE00', - 'header_description_color' => '#434343', - - 'main_menu_background_color' => '#FFFFFF', - 'main_menu_link_color' => '#515151', - 'main_menu_link_hover_color' => '#1098AD', - 'main_menu_dropdown_background_color' => '#374750', - 'main_menu_dropdown_background_hover_color' => '#2B3840', - 'main_menu_dropdown_link_color' => '#FFFFFF', - 'main_menu_dropdown_link_hover_color' => '#1098AD', - - 'banner_background_color' => '#2B3840', - 'banner_text_color' => '#FFFFFF', - 'banner_text_image_color' => '#FFFFFF', - 'banner_breadcrumb_background_color' => '#374750', - 'banner_breadcrumb_text_color' => '#919191', - 'banner_breadcrumb_text_selected_color' => '#FFFFFF', - - 'background_color' => '#F6F6F6', - 'body_line_color' => '#DADDDF', - 'body_text_heading_color' => '#4A4A4A', - 'body_text_small_color' => '#919191', - 'body_text_color' => '#4A4A4A', - 'body_link_color' => '#1098AD', - 'body_link_hover_color' => '#F7AE00', - 'body_section_full_background_color' => '#333333', - 'body_section_full_text_color' => '#FFFFFF', - 'body_section_full_link_color' => '#1098AD', - 'body_section_full_link_hover_color' => '#F7AE00', - 'body_section_full_cta_background_color' => '#1098AD', - 'body_section_full_cta_text_color' => '#FFFFFF', - 'body_section_full_cta_link_color' => '#374750', - 'body_section_full_cta_link_hover_color' => '#F7AE00', - - 'footer_cta_background_color' => '#232222', - 'footer_cta_text_color' => '#FFFFFF', - 'footer_cta_link_color' => '#1098AD', - 'footer_cta_link_hover_color' => '#F7AE00', - - 'footer_widgets_background_color' => '#333333', - 'footer_widgets_text_color' => '#FFFFFF', - 'footer_widgets_link_color' => '#1098AD', - 'footer_widgets_link_hover_color' => '#F7AE00', - - 'footer_background_color' => '#232222', - 'footer_text_color' => '#ffffff', - 'footer_link_color' => '#1098AD', - 'footer_link_hover_color' => '#F7AE00', - ), - ); - - return $array; -} -add_filter( 'lsx_customizer_colour_choices', 'lsx_to_customizer_colors_scheme' ); diff --git a/includes/functions.php b/includes/functions.php index 50f58918..fa04ddd9 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -219,9 +219,9 @@ function lsx_to_itinerary_thumbnail( $size = 'lsx-thumbnail-square', $meta_key = if ( $tour_itinerary && $tour_itinerary->has_itinerary && false !== $tour_itinerary->itinerary ) { $thumbnail_src = false; - if ( ! empty( $tour_itinerary->itinerary['featured_image'] ) ) { - $tour_itinerary->save_used_image( $tour_itinerary->itinerary['featured_image'] ); - $thumbnail = wp_get_attachment_image_src( $tour_itinerary->itinerary['featured_image'], $size ); + if ( ! empty( $tour_itinerary->itinerary['featured_image_id'] ) ) { + $tour_itinerary->save_used_image( $tour_itinerary->itinerary['featured_image_id'] ); + $thumbnail = wp_get_attachment_image_src( $tour_itinerary->itinerary['featured_image_id'], $size ); if ( is_array( $thumbnail ) ) { $thumbnail_src = $thumbnail[0]; @@ -493,17 +493,13 @@ function lsx_to_itinerary_count( $echo = true ) { */ function lsx_to_accommodation_has_rooms() { global $rooms; - $have_rooms = false; - if ( null === $rooms ) { $rooms = new \lsx\legacy\Unit_Query(); } - if ( is_object( $rooms ) ) { $have_rooms = $rooms->have_query(); } - return $have_rooms; } @@ -518,7 +514,6 @@ function lsx_to_accommodation_has_rooms() { */ function lsx_to_accommodation_room_loop() { global $rooms; - if ( is_object( $rooms ) ) { return $rooms->while_query(); } else { @@ -537,7 +532,6 @@ function lsx_to_accommodation_room_loop() { */ function lsx_to_accommodation_room_loop_item( $type = false ) { global $rooms; - if ( is_object( $rooms ) ) { return $rooms->current_queried_item( $type ); } else { @@ -558,7 +552,6 @@ function lsx_to_accommodation_room_loop_item( $type = false ) { */ function lsx_to_accommodation_room_title( $before = '', $after = '', $echo = true ) { global $rooms; - if ( is_object( $rooms ) ) { $rooms->item_title( $before, $after, $echo ); } @@ -577,7 +570,6 @@ function lsx_to_accommodation_room_title( $before = '', $after = '', $echo = tru */ function lsx_to_accommodation_room_description( $before = '', $after = '', $echo = true ) { global $rooms; - if ( is_object( $rooms ) ) { $rooms->item_description( $before, $after, $echo ); } @@ -592,7 +584,6 @@ function lsx_to_accommodation_room_description( $before = '', $after = '', $echo */ function lsx_to_accommodation_room_has_thumbnail() { global $rooms; - if ( $rooms && $rooms->have_query ) { return true; } @@ -607,7 +598,6 @@ function lsx_to_accommodation_room_has_thumbnail() { */ function lsx_to_accommodation_check_type( $type = false ) { global $rooms; - return $rooms->check_type( $type ); } @@ -620,58 +610,5 @@ function lsx_to_accommodation_check_type( $type = false ) { */ function lsx_to_accommodation_reset_units_loop() { global $rooms; - return $rooms->reset_loop(); } - -/** - * SCP Order Uninstall hook - */ -register_uninstall_hook( __FILE__, 'lsx_to_scporder_uninstall' ); - -function lsx_to_scporder_uninstall() { - global $wpdb; - - if ( function_exists( 'is_multisite' ) && is_multisite() ) { - $curr_blog = $wpdb->blogid; - $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); - - foreach ( $blogids as $blog_id ) { - switch_to_blog( $blog_id ); - lsx_to_scporder_uninstall_db(); - } - - switch_to_blog( $curr_blog ); - } else { - lsx_to_scporder_uninstall_db(); - } -} - -function lsx_to_scporder_uninstall_db() { - global $wpdb; - - $result = $wpdb->query( "DESCRIBE $wpdb->terms `lsx_to_term_order`" ); - - if ( $result ) { - $result = $wpdb->query( "ALTER TABLE $wpdb->terms DROP `lsx_to_term_order`" ); - } - - delete_option( 'lsx_to_scporder_install' ); -} - -/** - * Removes unnecesary menu items from the TO menu. - * - * @return void - */ -function lsx_to_remove_menu_pages() { - remove_submenu_page( 'tour-operator', 'post-new.php?post_type=destination' ); - remove_submenu_page( 'tour-operator', 'post-new.php?post_type=tour' ); - remove_submenu_page( 'tour-operator', 'post-new.php?post_type=accommodation' ); - remove_submenu_page( 'tour-operator', 'post-new.php?post_type=activity' ); - remove_submenu_page( 'tour-operator', 'post-new.php?post_type=review' ); - remove_submenu_page( 'tour-operator', 'post-new.php?post_type=special' ); - remove_submenu_page( 'tour-operator', 'edit-tags.php?taxonomy=special-type' ); - remove_submenu_page( 'tour-operator', 'post-new.php?post_type=team' ); -} -add_action( 'admin_init', 'lsx_to_remove_menu_pages' ); diff --git a/includes/layout.php b/includes/layout.php deleted file mode 100644 index 1642b3c9..00000000 --- a/includes/layout.php +++ /dev/null @@ -1,690 +0,0 @@ - - post_name; - } - - $thumbnail_id = get_post_thumbnail_id( get_the_ID() ); - $image_arr = wp_get_attachment_image_src( $thumbnail_id, 'lsx-thumbnail-single' ); - - if ( is_array( $image_arr ) ) { - $image_src = $image_arr[0]; - } - ?> - - - -
-
-

- - - - - -

- - ', '

' ); ?> - -
- - - -
- ', '
' ); - } else { - lsx_to_enquiry_contact( '
', '
' ); - } - - lsx_to_enquire_modal(); - ?> -
- -
- ', '' ); - lsx_to_connected_countries( ' ', '' ); - the_terms( get_the_ID(), 'travel-style', ' ', ', ', '' ); - the_terms( get_the_ID(), 'accommodation-type', ' ', ', ', '' ); - lsx_to_accommodation_room_total( ' ', '' ); - lsx_to_accommodation_spoken_languages( ' ', '' ); - lsx_to_accommodation_activity_friendly( ' ', '' ); - lsx_to_accommodation_special_interests( ' ', '' ); - the_terms( get_the_ID(), 'accommodation-brand', ' ', ', ', '' ); - - if ( function_exists( 'lsx_to_connected_activities' ) ) { - lsx_to_connected_activities( ' ', '' ); - } - $content = ob_get_clean(); - - if ( '' !== $content ) { - ?> - - ', ', ', '' ); - if ( function_exists( 'lsx_to_connected_activities' ) ) { - lsx_to_connected_activities( ' ', '' ); - } - $content = ob_get_clean(); - if ( '' !== $content ) { - ?> - - - - -
-
-

- - -
-
- - -
- - -
-
- -
-
-
-

' . esc_html__( 'Facilities', 'tour-operator' ) . '

', '
' ); - - lsx_to_included_block(); - - if ( function_exists( 'lsx_to_accommodation_specials' ) ) { - lsx_to_accommodation_specials(); - } - - if ( function_exists( 'lsx_to_accommodation_reviews' ) ) { - lsx_to_accommodation_reviews(); - } - - lsx_to_related_items( 'travel-style', '' ); - - lsx_to_accommodation_posts(); - } -} - -/** - * Adds the template tags to the top of the content-accommodation - * - * @package tour-operator - * @subpackage template-tag - * @category accommodation - */ -function lsx_to_accommodation_archive_entry_top() { - global $lsx_to_archive; - - if ( 'accommodation' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { - if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { - ?> - - -
- - options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> - - - - - - - archive_layout ) : ?> - - - -
- - -
-
- -
-
-
- options[ get_post_type() ]['disable_entry_metadata'] ) ) { - ?> - - - - - options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> - - - - - - - archive_layout ) : ?> - - - -
- - - - -
-
- -
-
-
- -
- - -
-
- -
-
-
-

' . esc_html__( 'When to Go', 'tour-operator' ) . '

', '
' ); - - if ( lsx_to_has_itinerary() ) { - $itinerary_count = 1; - ?> -
- - -
-
-
- - - -
> -
-
-
- ' ); ?> -
-
- -
-
-

- - -
- -
-
- - -
-
-
- -
-
-
- - -
-

' . lsx_to_get_post_type_section_title( 'tour', 'related', esc_html__( 'Related Tours', 'tour-operator' ) ) . '

' ); - - lsx_to_tour_posts(); - } -} - -/** - * Adds the template tags to the top of the content-tour.php - * - * @package tour-operator - * @subpackage template-tag - * @category tour - */ -function lsx_to_tour_archive_entry_top() { - global $lsx_to_archive; - - if ( 'tour' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { - if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { - ?> - - - - - options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> - - - - - - - archive_layout ) : ?> - - - esc_html__( 'Drinks Basis', 'tour-operator' ), 'desc' => esc_html__( 'Select the drinks basis for the itinerary (e.g., tea & coffee, all local drinks).', 'tour-operator' ), 'type' => 'select', - 'options' => $this->drinks_basis, + 'options' => array( + 'None' => esc_html__( 'None', 'tour-operator' ), + 'TeaCoffee' => esc_html__( 'Tea and Coffee Only', 'tour-operator' ), + 'DrinksSoft' => esc_html__( 'Tea, Coffee and Soft Drinks Only', 'tour-operator' ), + 'DrinksLocalBrands' => esc_html__( 'All Local Brands (Spirits, Wine and Beers)', 'tour-operator' ), + 'DrinksExclSpirits' => esc_html__( 'All Local Brands (excl Spirits)', 'tour-operator' ), + 'DrinksExclChampagne' => esc_html__( 'All Drinks (excl Champagne)', 'tour-operator' ), + 'DrinksExclPremium' => esc_html__( 'All Drinks (excl Premium Brands)', 'tour-operator' ), + 'AllDrinks' => esc_html__( 'All Drinks', 'tour-operator' ), + ), ); $itinerary_fields[] = array( 'id' => 'room_basis', 'name' => esc_html__( 'Room Basis', 'tour-operator' ), 'desc' => esc_html__( 'Choose the room basis for the itinerary (e.g., breakfast only, full board).', 'tour-operator' ), 'type' => 'select', - 'options' => $this->room_basis, + 'options' => array( + 'None' => esc_html__( 'None', 'tour-operator' ), + 'BedAndBreakfast' => esc_html__( 'B&B: Bed and Breakfast', 'tour-operator' ), + 'RoomOnly' => esc_html__( 'Room Only', 'tour-operator' ), + 'SelfCatering' => esc_html__( 'Self Catering', 'tour-operator' ), + 'Lunch' => esc_html__( 'Lunch', 'tour-operator' ), + 'Dinner' => esc_html__( 'Dinner', 'tour-operator' ), + 'LunchAndDinner' => esc_html__( 'Lunch and Dinner', 'tour-operator' ), + 'BedBreakfastAndLunch' => esc_html__( 'Bed, Breakfast and Lunch', 'tour-operator' ), + 'DinnerBedAndBreakfast' => esc_html__( 'Dinner, Bed and Breakfast', 'tour-operator' ), + 'HalfBoard' => esc_html__( 'Half Board - Dinner, Bed and Breakfast', 'tour-operator' ), + 'DinnerBedBreakfastAndActivities' => esc_html__( 'Half Board Plus - Dinner, Bed, Breakfast and Activities', 'tour-operator' ), + 'DinnerBedBreakfastAndLunch' => esc_html__( 'Full Board - Dinner, Bed, Breakfast and Lunch', 'tour-operator' ), + 'DinnerBedBreakfastLunchAndActivities' => esc_html__( 'Full Board Plus - Dinner, Bed, Breakfast, Lunch and Activities', 'tour-operator' ), + 'AllInclusiveBedAndAllMeals' => esc_html__( 'All Inclusive - Bed and All Meals', 'tour-operator' ), + 'FullyInclusive' => esc_html__( 'Fully Inclusive - Bed, All Meals, Fees and Activities', 'tour-operator' ), + 'ExclusiveClubPremierBenefits' => esc_html__( 'Premier - Executive Club / Premier Benefits', 'tour-operator' ), + ), ); $metabox['fields'][] = array( diff --git a/includes/template-tags/accommodation.php b/includes/template-tags/accommodation.php index 6db0dcf0..93f8a36d 100644 --- a/includes/template-tags/accommodation.php +++ b/includes/template-tags/accommodation.php @@ -114,10 +114,11 @@ function lsx_to_has_facilities() { * @category accommodation */ function lsx_to_accommodation_facilities( $before = '', $after = '', $echo = true ) { - $facilities = wp_get_object_terms( get_the_ID(), 'facility' ); - $main_facilities = array(); - $child_facilities = array(); - $return = ''; + $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 ) { @@ -130,19 +131,22 @@ function lsx_to_accommodation_facilities( $before = '', $after = '', $echo = tru //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 .= '
'; + $return .= '
'; } } + $return .= '
'; if ( ! empty( $return ) ) { $return = $before . $return . $after; diff --git a/post-types/accommodation.json b/post-types/accommodation.json deleted file mode 100644 index be1f35a5..00000000 --- a/post-types/accommodation.json +++ /dev/null @@ -1,157 +0,0 @@ -{ - "type": "postType", - "postType": "accommodation", - "slug": "accommodation", - "label": "Accommodation", - "pluralLabel": "Accommodation", - "icon": "admin-post", - "template": [ - { - "blockName": "core/paragraph", - "attrs": { - "placeholder": "Add placeholder value for Rating", - "metadata": { - "name": "Rating", - "slug": "rating", - "bindings": { - "content": { - "source": "core/post-meta", - "args": { "key": "rating__content" } - } - } - } - }, - "innerBlocks": [], - "innerHTML": "\n

Rating

\n", - "innerContent": ["\n

Rating

\n"] - }, - { - "blockName": null, - "attrs": [], - "innerBlocks": [], - "innerHTML": "\n\n", - "innerContent": ["\n\n"] - }, - { - "blockName": "core/paragraph", - "attrs": { - "placeholder": "Add placeholder value for Spoken Languages", - "metadata": { - "name": "Spoken Languages", - "slug": "spoken_languages", - "bindings": { - "content": { - "source": "core/post-meta", - "args": { "key": "spoken_languages__content" } - } - } - } - }, - "innerBlocks": [], - "innerHTML": "\n

Languages

\n", - "innerContent": ["\n

Languages

\n"] - }, - { - "blockName": null, - "attrs": [], - "innerBlocks": [], - "innerHTML": "\n\n", - "innerContent": ["\n\n"] - }, - { - "blockName": "core/paragraph", - "attrs": { - "placeholder": "Add placeholder value for Number Of Rooms", - "metadata": { - "name": "Number Of Rooms", - "slug": "number_of_rooms", - "bindings": { - "content": { - "source": "core/post-meta", - "args": { "key": "number_of_rooms__content" } - } - } - } - }, - "innerBlocks": [], - "innerHTML": "\n

Number of Units

\n", - "innerContent": ["\n

Number of Units

\n"] - }, - { - "blockName": null, - "attrs": [], - "innerBlocks": [], - "innerHTML": "\n\n", - "innerContent": ["\n\n"] - }, - { - "blockName": "core/paragraph", - "attrs": { - "placeholder": "Add placeholder value for Suggested Visitor Types", - "metadata": { - "name": "Suggested Visitor Types", - "slug": "suggested_visitor_types", - "bindings": { - "content": { - "source": "core/post-meta", - "args": { "key": "suggested_visitor_types__content" } - } - } - } - }, - "innerBlocks": [], - "innerHTML": "\n

Suggested Visitor Types

\n", - "innerContent": ["\n

Suggested Visitor Types

\n"] - } - ], - "fields": [ - { - "slug": "rating", - "type": "string", - "label": "rating", - "description": "" - }, - { - "slug": "spoken_languages", - "type": "string", - "label": "spoken_languages", - "description": "" - }, - { - "slug": "number_of_rooms", - "type": "string", - "label": "number_of_rooms", - "description": "" - }, - { - "slug": "suggested_visitor_types", - "type": "string", - "label": "suggested_visitor_types", - "description": "" - }, - { - "slug": "rating__content", - "type": "string", - "label": "rating__content", - "description": "" - }, - { - "slug": "spoken_languages__content", - "type": "string", - "label": "spoken_languages__content", - "description": "" - }, - { - "slug": "number_of_rooms__content", - "type": "string", - "label": "number_of_rooms__content", - "description": "" - }, - { - "slug": "suggested_visitor_types__content", - "type": "string", - "label": "suggested_visitor_types__content", - "description": "" - } - ] -} diff --git a/post-types/destinations.json b/post-types/destinations.json deleted file mode 100644 index 56da84bd..00000000 --- a/post-types/destinations.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"postType","postType":"destinations","slug":"destinations","label":"Destination","pluralLabel":"Destinations","icon":"admin-post","template":[{"blockName":"core\/paragraph","attrs":{"placeholder":"Start building your model"},"innerBlocks":[],"innerHTML":"\n

<\/p>\n","innerContent":["\n

<\/p>\n"]}],"fields":[]} \ No newline at end of file diff --git a/post-types/tours.json b/post-types/tours.json deleted file mode 100644 index 0d531507..00000000 --- a/post-types/tours.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "type": "postType", - "postType": "tours", - "slug": "tours", - "label": "Tours", - "pluralLabel": "Tours", - "icon": "admin-post", - "template": [ - { - "blockName": "core\/paragraph", - "attrs": { - "placeholder": "Price", - "metadata": { - "name": "Price", - "slug": "price", - "bindings": { - "content": { - "source": "lsx\/post-meta", - "args": { - "key": "price" - } - } - } - } - }, - "innerBlocks": [], - "innerHTML": "\n

Price<\/p>\n", - "innerContent": [ - "\n

Price<\/p>\n" - ] - }, - { - "blockName": null, - "attrs": [], - "innerBlocks": [], - "innerHTML": "\n\n", - "innerContent": [ - "\n\n" - ] - }, - { - "blockName": "core\/paragraph", - "attrs": { - "placeholder": "Duration", - "metadata": { - "name": "Duration", - "slug": "duration", - "bindings": { - "content": { - "source": "lsx\/post-meta", - "args": { - "key": "duration" - } - } - } - } - }, - "innerBlocks": [], - "innerHTML": "\n

Duration<\/p>\n", - "innerContent": [ - "\n

Duration<\/p>\n" - ] - } - ], - "fields": [ - { - "slug": "price", - "type": "string", - "label": "price", - "description": "" - }, - { - "slug": "duration", - "type": "string", - "label": "duration", - "description": "" - } - ] -} \ No newline at end of file diff --git a/tour-operator-bootstrap.php b/tour-operator-bootstrap.php index 19d1d811..2a399c4d 100644 --- a/tour-operator-bootstrap.php +++ b/tour-operator-bootstrap.php @@ -32,14 +32,6 @@ require_once( LSX_TO_PATH . 'includes/template-tags/maps.php' ); require_once( LSX_TO_PATH . 'includes/template-tags/videos.php' ); - // General Includes. - require_once( LSX_TO_PATH . 'includes/customizer.php' ); - require_once( LSX_TO_PATH . 'includes/layout.php' ); - - add_action( 'after_setup_theme', function() { - require_once( LSX_TO_PATH . 'includes/actions.php' ); - } ); - // include context helper & autoloader. require_once( LSX_TO_PATH . 'includes/tour-operator.php' ); // Include functions.