Exemplo n.º 1
0
/**
 * Theme options helper function.
 * Returns list of available attributes (attributes that have few values saved for a tours) for tour entities.
 *
 * @return array
 */
function adventure_tours_vp_get_tour_attributes_list()
{
    static $cache;
    $ignore_empty_lists = false;
    if (null != $cache) {
        return $cache;
    }
    $result = array();
    if (adventure_tours_check('tour_category_taxonomy_exists')) {
        $result[] = array('value' => '__tour_categories_filter', 'label' => esc_html__('Tour Categories', 'adventure-tours'));
    }
    $list = AtTourHelper::get_available_attributes(true, true);
    if ($list) {
        foreach ($list as $attributeName => $attributeValues) {
            if ($ignore_empty_lists && count($attributeValues) < 2) {
                // Checking if list contains more than 1 value, as 1-st one is field label.
                continue;
            }
            $result[] = array('value' => $attributeName, 'label' => array_shift($attributeValues));
        }
    }
    $cache = $result;
    return $result;
}
Exemplo n.º 2
0
<?php

/**
 * The template for displaying product content in the single-product.php template
 *
 * Override this template by copying it to yourtheme/woocommerce/content-single-product.php
 *
 * @author   WooThemes
 * @package  WooCommerce/Templates
 * @version  1.6.4
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
if (!AtTourHelper::beforeWCTemplateRender(__FILE__)) {
    return;
}
?>

<?php 
/**
 * woocommerce_before_single_product hook
 *
 * @hooked wc_print_notices - 10
 */
do_action('woocommerce_before_single_product');
if (post_password_required()) {
    echo get_the_password_form();
    return;
}
Exemplo n.º 3
0
if (!function_exists('adventure_tours_autoloader')) {
    /**
     * Vendor components loading function.
     *
     * @param  string $class class name that should be loaded.
     * @return void
     */
    function adventure_tours_autoloader($class)
    {
        static $map, $includesPath;
        if (!$map) {
            $map = array('lessc' => _THEME_VENDOR_PATH_ . 'lessphp/lessc.inc.php', 'wp_bootstrap_navwalker' => _THEME_VENDOR_PATH_ . 'twittem/wp_bootstrap_navwalker.php', 'JuiceContainer' => _THEME_VENDOR_PATH_ . 'juice/JuiceContainer.php', 'tmhOAuth' => _THEME_VENDOR_PATH_ . 'tmhOAuth/tmhOAuth.php');
            $includesPath = dirname(__FILE__);
        }
        if (isset($map[$class])) {
            $fileName = $map[$class];
            if ($fileName) {
                require $fileName;
            }
        } elseif (0 === strpos($class, 'At')) {
            $themeClassFile = "{$includesPath}/classes/{$class}.php";
            if (file_exists($themeClassFile)) {
                require $themeClassFile;
            }
        }
    }
    spl_autoload_register('adventure_tours_autoloader');
}
require _THEME_VENDOR_PATH_ . 'themedelight/bootstrap.php';
AtTourHelper::init();
Exemplo n.º 4
0
if ($title || $sub_title) {
    echo do_shortcode('[title text="' . addslashes($title) . '" subtitle="' . addslashes($sub_title) . '" size="big" position="center" decoration="on" underline="' . addslashes($title_underline) . '" style="light"]');
}
?>
		<div class="tours-type-icons__slider">
			<div class="tours-type-icons__slider__controls">
				<a class="tours-type-icons__slider__prev" href="#"><i class="fa fa-chevron-left"></i></a>
				<a class="tours-type-icons__slider__next" href="#"><i class="fa fa-chevron-right"></i></a>
			</div>
			<div class="swiper-container swiper-slider">
				<div class="swiper-wrapper">
				<?php 
foreach ($items as $item) {
    ?>
					<?php 
    $icon_class = AtTourHelper::get_tour_category_icon_class($item->term_id);
    $detail_url = get_term_link($item->slug, 'tour_category');
    ?>
					<div class="swiper-slide tours-type-icons__item">
						<a href="<?php 
    echo esc_url($detail_url);
    ?>
" class="tours-type-icons__item__container">
							<span class="tours-type-icons__item__content">
								<i class="<?php 
    echo esc_attr($icon_class);
    ?>
"></i><?php 
    echo esc_html($item->name);
    ?>
							</span>
Exemplo n.º 5
0
	<?php 
if (!$hide_text_field) {
    ?>
		<div class="form-block__item form-block__field-width-icon">
			<input type="text" placeholder="<?php 
    echo esc_attr_x('Search Tour', 'placeholder', 'adventure-tours');
    ?>
" value="<?php 
    echo get_search_query();
    ?>
" name="s">
			<i class="td-search-1"></i>
		</div>
	<?php 
}
?>

	<?php 
$form_items_html = AtTourHelper::get_search_form_fields_html(true);
foreach ($form_items_html as $form_element_config) {
    $has_icon = !empty($form_element_config['icon']) && 'none' != $form_element_config['icon'];
    printf('<div class="form-block__item%s">%s%s</div>', $has_icon ? ' form-block__field-width-icon' : '', $form_element_config['html'], $has_icon ? sprintf('<i class="%s"></i>', esc_attr($form_element_config['icon'])) : '');
}
?>
		<button type="submit" class="atbtn atbtn--full-width atbtn--primary"><?php 
esc_attr_e('Find Tours', 'adventure-tours');
?>
</button>
	</form>
</div>
Exemplo n.º 6
0
 /**
  * Returns field configs for tour search form.
  *
  * @param  boolean $only_allowed_in_settings if set to true only fields allwed in Tours > Search Form > Additional Fields option.
  * @param  boolean $clear_empty_values
  * @return array
  */
 public static function get_search_form_fields_html($only_allowed_in_settings = true, $clear_empty_values = false)
 {
     $result = array();
     $form_taxonomies = self::get_search_form_fields($only_allowed_in_settings);
     if (!$form_taxonomies) {
         return $result;
     }
     $tour_tax_request = isset($_REQUEST['tourtax']) ? $_REQUEST['tourtax'] : array();
     foreach ($form_taxonomies as $name => $list) {
         if ('__tour_categories_filter' === $name) {
             if (!adventure_tours_check('tour_category_taxonomy_exists')) {
                 continue;
             }
             $current_term_id = !empty($_REQUEST['tour_category']) ? $_REQUEST['tour_category'] : '';
             /*
             				// For WP < 4.3
             				$current_term_id = 0;
             				$tour_cat_slug = ! empty( $_REQUEST['tour_category'] ) ? $_REQUEST['tour_category'] : '';
             				if ( $tour_cat_slug ) {
             					$cur_cat_term = get_term_by( 'slug', $tour_cat_slug, 'tour_category' );
             					if ( $cur_cat_term ) {
             						$current_term_id = $cur_cat_term->term_id;
             					}
             				}*/
             $use_parent_cat_name_as_title = true;
             $parent_term_id = adventure_tours_get_option('tours_search_form_start_category');
             $show_all_title = esc_html__('Category', 'adventure-tours');
             if ($use_parent_cat_name_as_title && $parent_term_id) {
                 $parent_term_obj = get_term($parent_term_id, 'tour_category');
                 if ($parent_term_obj) {
                     $show_all_title = $parent_term_obj->name;
                 }
             }
             $drop_down_html = wp_dropdown_categories(array('show_option_all' => $clear_empty_values ? ' ' : $show_all_title, 'hide_if_empty' => true, 'taxonomy' => 'tour_category', 'hierarchical' => true, 'echo' => false, 'name' => 'tour_category', 'value_field' => 'slug', 'hide_if_empty' => true, 'class' => 'selectpicker', 'show_count' => true, 'selected' => $current_term_id, 'child_of' => $parent_term_id));
             if ($drop_down_html) {
                 // to replace value='0' with value='' - as options with empty string value are hidhlighted with placeholder color only
                 $drop_down_html = preg_replace('`(\\s+value=(?:\\"|\'))0(\\"|\')`', '$1$2', $drop_down_html);
                 $icon_class = $parent_term_id ? AtTourHelper::get_tour_category_icon_class($parent_term_id) : '';
                 $result[] = array('icon' => $icon_class ? $icon_class : 'td-network', 'html' => $drop_down_html, 'label' => $show_all_title);
             }
         } else {
             $selected_value = isset($tour_tax_request[$name]) ? $tour_tax_request[$name] : '';
             $attribute_title = wc_attribute_label($name);
             $list_options = array();
             foreach ($list as $value => $title) {
                 /*if ( $is_show_label ) {
                 			if ( $attribute_title == $title ) {
                 				continue;
                 			}
                 		}*/
                 if ($clear_empty_values && !$value) {
                     $title = ' ';
                 }
                 $list_options[] = sprintf('<option value="%s"%s>%s</option>', esc_attr($value), $selected_value == $value ? ' selected="selected"' : '', esc_html($title));
             }
             $result[] = array('icon' => AtTourHelper::get_product_attribute_icon_class($name), 'html' => '<select name="tourtax[' . esc_attr($name) . ']" class="selectpicker">' . join('', $list_options) . '</select>', 'label' => $attribute_title);
         }
     }
     return $result;
 }
Exemplo n.º 7
0
 * Tour archive template.
 *
 * @author    Themedelight
 * @package   Themedelight/AdventureTours
 * @version   1.1.2
 */
get_header();
$sidebar_content = '';
if (adventure_tours_get_option('tours_archive_show_sidebar', 1)) {
    ob_start();
    do_action('woocommerce_sidebar');
    $sidebar_content = ob_get_clean();
}
$is_first_page = get_query_var('paged') < 2;
$cat_term = is_tax() ? get_queried_object() : null;
$display_mode = AtTourHelper::get_tour_archive_page_display_mode($cat_term ? $cat_term->term_id : 0);
?>

<?php 
ob_start();
?>
	<?php 
if ($is_first_page) {
    if ($cat_term) {
        echo wc_format_content($cat_term->description);
    } elseif (is_archive()) {
        $tours_page_id = adventure_tours_get_option('tours_page');
        $tours_page = $tours_page_id ? get_post($tours_page_id) : null;
        if ($tours_page && $tours_page->post_content) {
            echo wc_format_content($tours_page->post_content);
        }
Exemplo n.º 8
0
 public function get_fields_config($product)
 {
     $state_key = $this->make_product_state_key('base_fields_config', $product);
     $result = $this->get_state($state_key, false);
     if (false === $result) {
         $booking_dates = $this->get_booking_dates($product, true);
         $product_id = $product->id;
         /*if ( $product_id && adventure_tours_check('is_wpml_in_use') ) {
         			$product_id = apply_filters( 'translate_object_id', $product_id, 'product', true, apply_filters( 'wpml_default_language', '' ) );
         		}*/
         $result = array('add-to-cart' => array('type' => 'hidden', 'default' => $product_id));
         $is_mutli_quantity_form = $this->is_mutli_quantity_form($product);
         if ($product->is_variable_tour()) {
             $variation_rules = array();
             if (!$is_mutli_quantity_form) {
                 $variation_rules[] = 'required';
             }
             $variation_rules[] = 'variation_id';
             $result['variation_id'] = array('type' => 'hidden', 'rules' => $variation_rules);
             $variation_attributes = $product->get_variation_attributes();
             foreach ($variation_attributes as $attribute_name => $options) {
                 $attrib_field_name = 'attribute_' . sanitize_title($attribute_name);
                 $result[$attrib_field_name] = array('type' => 'variation_select', 'name' => $attrib_field_name, 'attribute' => $attribute_name, 'product' => $product, 'options' => $options, 'class' => 'selectpicker', 'label' => wc_attribute_label($attribute_name), 'default' => $product->get_variation_default_attribute($attribute_name), 'icon_class' => AtTourHelper::get_product_attribute_icon_class($attribute_name));
             }
         }
         if ($booking_dates || !$this->hide_date_field_for_no_booking_dates) {
             $date_default_value = '';
             if ($booking_dates) {
                 $date_default_value = date($this->get_date_format(), strtotime(key($booking_dates)));
             }
             $date_label = esc_html__('Date', 'adventure-tours');
             $result['date'] = array('label' => $date_label, 'placeholder' => $date_label, 'rules' => array('required', 'date', 'booking_date'), 'default' => $date_default_value, 'icon_class' => 'td-calendar');
             // improvements required after testing is completed
             if ($booking_dates) {
                 $date_options = array();
                 ksort($booking_dates);
                 foreach ($booking_dates as $_date => $_open_tickets) {
                     $date_options[$_date] = sprintf($this->date_field_text_format, $this->convert_date_for_human($_date), $_open_tickets);
                 }
                 $date_exact_field = array('type' => 'select', 'options' => $date_options);
                 // $result['date_exact'] = $date_exact_field;
                 $result['date'] = array_merge($result['date'], $date_exact_field);
             }
         }
         // quantity field should follow after booking date field, validation requirement
         $quantity_label = esc_html__('Quantity', 'adventure-tours');
         $invalid_tickets_number = esc_html__('Please enter the amount of tickets.', 'adventure-tours');
         if ($is_mutli_quantity_form) {
             $expand_attribute_name = $this->get_expand_quantity_attribute_name($product);
             $expand_field_key = $expand_attribute_name ? 'attribute_' . $expand_attribute_name : null;
             $default_expand_attribute_value = $product->get_variation_default_attribute($expand_attribute_name);
             $quantity_redirect_to = null;
             $quantity_fields_set = $this->get_quantity_field_expand_values($product);
             foreach ($quantity_fields_set as $field_suffix => $field_label) {
                 $new_field_key = 'quantity_' . $field_suffix;
                 $result['variation_id_' . $field_suffix] = array('type' => 'hidden');
                 // implement icon selection filter selection depends on attribute value
                 $result[$new_field_key] = array('type' => 'number', 'label' => $field_label, 'placeholder' => $field_label, 'default' => '', 'icon_class' => 'td-users', 'attributes' => array('data-quantityattribute' => $expand_field_key, 'min' => '0'), 'rules' => array(array('type' => 'combined_ticket_number', 'message' => $invalid_tickets_number), 'combined_booking_tickets'));
                 if ($field_suffix == $default_expand_attribute_value || !$quantity_redirect_to) {
                     $quantity_redirect_to = $new_field_key;
                 }
             }
             if ($quantity_redirect_to) {
                 // complete icons selection
                 $result[$quantity_redirect_to]['icon_class'] = 'td-user-plus';
                 $result[$quantity_redirect_to]['default'] = 1;
                 $this->errors_movement['quantity'] = $quantity_redirect_to;
                 unset($result[$expand_field_key]);
             }
         } else {
             $result['quantity'] = array('type' => 'number', 'label' => $quantity_label, 'placeholder' => $quantity_label, 'rules' => array('required', array('type' => 'number', 'min' => '1', 'message' => $invalid_tickets_number, 'min_message' => $invalid_tickets_number), 'booking_tickets'), 'attributes' => array('min' => '1'), 'default' => '1', 'icon_class' => 'td-user-plus');
         }
         $this->set_state($state_key, $result);
     }
     return $result;
 }
 /**
  * Creates special rewrite url for tours archive section.
  *
  * @param  assoc $rules
  * @return void
  */
 public function filter_rewrite_rules_array($rules)
 {
     $tour_base_url = AtTourHelper::get_tour_base_rewrite_rule(false, true);
     if ($tour_base_url) {
         $new_rules = array();
         $new_rules[$tour_base_url . 'page/([0-9]{1,})/?'] = 'index.php?toursearch=1&paged=$matches[1]';
         $new_rules[$tour_base_url . '?$'] = 'index.php?toursearch=1';
         // &post_type=product&product_type=tour
         return array_merge($new_rules, $rules);
     }
     return $rules;
 }
 /**
  * Filter for init hook.
  *
  * @return void
  */
 public function filter_init()
 {
     if (get_option('permalink_structure')) {
         if (AtTourHelper::get_tour_base_rewrite_rule()) {
             $this->tour_rewrite_base = AtTourHelper::get_tour_base_rewrite_rule(true);
             add_filter('post_type_link', array($this, 'filter_post_type_link'), 10, 4);
         }
     }
     if (!$this->placeholder_image_url) {
         $this->placeholder_image_url = adventure_tours_placeholder_img_src();
         if ($this->placeholder_image_url) {
             add_filter('woocommerce_placeholder_img_src', array($this, 'filter_woocommerce_placeholder_img_src'));
             /*add_filter('woocommerce_placeholder_img', function($img_html, $size, $dimensions) { return $img_html; });*/
         }
     }
 }
Exemplo n.º 11
0
    /**
     * Tour details page, tab description icons/attributes rendeing function.
     *
     * @return void
     */
    function adventure_tours_render_tab_description_top_section()
    {
        global $product;
        $all_attributes = AtTourHelper::get_tour_details_attributes($product, null);
        $header_attributes = $all_attributes ? AtTourHelper::get_tour_details_attributes($product, true) : array();
        if ($header_attributes) {
            $count = count($header_attributes);
            $count_to_batch_size = $count < 5 ? $count : ($count % 3 == 0 ? 3 : ($count % 5 == 0 ? 5 : 4));
            /*
            			$count_to_batch_size = $count < 4 ? $count : (
            				$count % 4 == 0 ? 4 : 3
            			);*/
            $attributes_batches = array_chunk($header_attributes, $count_to_batch_size);
            foreach ($attributes_batches as $attrib_batch) {
                echo '<div class="tours-tabs__info">';
                foreach ($attrib_batch as $attribute) {
                    echo strtr('<div class="tours-tabs__info__item">
						<div class="tours-tabs__info__item__content">
							<div class="tours-tabs__info__item__icon"><i class="{icon_class}"></i></div>
							<div class="tours-tabs__info__item__title">{value}</div>
							<div class="tours-tabs__info__item__description">{label}</div>
						</div>
					</div>', array('{icon_class}' => esc_attr($attribute['icon_class']), '{value}' => $attribute['text'], '{label}' => $attribute['label']));
                }
                echo '</div>';
            }
        }
        $additional_attributes = $all_attributes && $header_attributes ? array_diff_key($all_attributes, $header_attributes) : $all_attributes;
        if ($additional_attributes) {
            $GLOBALS['_tour_additional_attributes'] = $additional_attributes;
        }
    }
 * @var string  $title
 * @var string  $note
 * @var strign  $style
 * @var string  $css_class
 * @var boolean $hide_text_field
 * @var string  $view
 *
 * @author    Themedelight
 * @package   Themedelight/AdventureTours
 * @version   1.2.4
 */
$attributesRequest = isset($_REQUEST['tourtax']) ? $_REQUEST['tourtax'] : array();
$configs_map = array('default' => array(), 'style1' => array('css' => 'form-block--light-style form-block--with-border'), 'style2' => array('css' => 'form-block--with-border'), 'style3' => array('css' => 'form-block--full-width form-block--big-indent form-block--with-label', 'show_label' => true), 'style4' => array('css' => 'form-block--full-width'));
$style_config = $style && isset($configs_map[$style]) ? $configs_map[$style] : $configs_map['default'];
$is_show_label = !empty($style_config['show_label']);
$form_items_html = AtTourHelper::get_search_form_fields_html(true, $is_show_label);
$block_css_classes = 'form-block form-block--horizontal';
if (!empty($style_config['css'])) {
    $block_css_classes .= ' ' . $style_config['css'];
}
if ($title) {
    $block_css_classes .= ' form-block--with-title';
}
if ($css_class) {
    $block_css_classes .= ' ' . $css_class;
}
$search_field_cells = 4;
$field_cells = 2;
$left_cells = 12;
?>
<div class="<?php