/** * @return assoc */ public function getFontSet() { if (!$this->font_set) { return adventure_tours_di('app')->getFontSet(); } return $this->font_set; }
public function get_options_list() { $result = array('none' => esc_html__('None', 'adventure-tours')); $icons_list = adventure_tours_di('icons_manager')->get_list(); foreach ($icons_list as $icon) { $result[$icon['value']] = $icon['label']; } return $result; }
/** * Generates inputs for badges lit management. * * @return array */ function _adventure_tours_generate_badge_controls() { $result = array(); $count = adventure_tours_di('tour_badge_service')->get_count(); for ($bid = 1; $bid <= $count; $bid++) { $result[] = array('name' => "tour_badge_{$bid}_is_active", 'label' => sprintf(esc_html__('Is Active Badge #%d', 'adventure-tours'), $bid), 'type' => 'toggle', 'default' => '0'); $result[] = array('name' => "tour_badge_{$bid}_title", 'label' => sprintf(esc_html__('Title #%d', 'adventure-tours'), $bid), 'type' => 'textbox', 'default' => '', 'dependency' => array('field' => "tour_badge_{$bid}_is_active", 'function' => 'vp_dep_boolean')); $result[] = array('name' => "tour_badge_{$bid}_color", 'label' => sprintf(esc_html__('Color #%d', 'adventure-tours'), $bid), 'type' => 'color', 'default' => '', 'dependency' => array('field' => "tour_badge_{$bid}_is_active", 'function' => 'vp_dep_boolean')); } return $result; }
/** * Renders badge for specefied tour. * * @param array $args assoc that contains rendering settings. * @return void */ function adventure_tours_renders_tour_badge($args = array()) { $defaults = array('tour_id' => null, 'text_before' => '', 'text_after' => '', 'wrap_css_class' => '', 'wrap_container_tag' => 'div', 'css_class' => '', 'container_tag' => 'div'); $args = wp_parse_args($args, $defaults); extract($args); if (null === $tour_id) { $tour_id = get_the_ID(); } $badge = adventure_tours_di('tour_badge_service')->get_tour_badge($tour_id); if ($badge) { echo strtr('<{wrap_tag} class="{wrap_class}"><{tag} class="{class}" style="background-color:{bg_color}">{text_before}{text}{text_after}</{tag}></{wrap_tag}>', array('{wrap_tag}' => $wrap_container_tag ? $wrap_container_tag : 'div', '{wrap_class}' => esc_attr($wrap_css_class), '{tag}' => $container_tag ? $container_tag : 'div', '{class}' => esc_attr($css_class), '{bg_color}' => $badge['color'], '{text}' => esc_html($badge['title']), '{text_before}' => $text_before, '{text_after}' => $text_after)); } }
/** * Returns assoc that contains dates and number of available tickets for a date. * * @param integer $tour_id * @param boolean $allow_cache * @return assoc the date is used as a key, tickets number as a value */ function adventure_touts_get_tour_booking_dates($tour_id, $allow_cache = true) { static $cache = array(); if ($tour_id > 0) { if (empty($cache) || !$allow_cache || !isset($cache[$tour_id])) { $booking_range = adventure_tours_get_tour_booking_range($tour_id); $cache[$tour_id] = adventure_tours_di('tour_booking_service')->get_expanded($tour_id, $booking_range['start'], $booking_range['end']); } return $cache[$tour_id]; } return array(); }
} ?> <div class="<?php echo esc_attr($item_wrapper_class); ?> "> <div class="atgrid__item"> <div class="atgrid__item__top"> <?php printf('<a href="%s" class="atgrid__item__top__image">%s</a>', esc_url($item_url), $image_html ? $image_html : $placeholder_image); ?> <?php if ('highlighted' == $view_settings['price_style']) { ?> <?php $badge = adventure_tours_di('tour_badge_service')->get_tour_badge($item_id); printf('<a href="%s" class="price-round"%s><span class="price-round__content">%s</span></a>', esc_url($item_url), isset($badge['color']) ? ' style="background-color:' . esc_attr($badge['color']) . '"' : '', $price_html); ?> <?php } else { ?> <?php adventure_tours_renders_tour_badge(array('tour_id' => $item_id, 'wrap_css_class' => 'atgrid__item__angle-wrap', 'css_class' => 'atgrid__item__angle')); ?> <?php if ($price_html) { printf('<div class="atgrid__item__price"><a href="%s" class="atgrid__item__price__button">%s</a></div>', esc_url($item_url), $price_html); } ?> <?php }
<?php /** * Tour single content template part. * * @author Themedelight * @package Themedelight/AdventureTours * @version 1.0.0 */ global $product; $is_banner = adventure_tours_di('register')->getVar('is_banner'); $tour_permalink = get_the_permalink(); $tour_thumbnail_url = wp_get_attachment_url(get_post_thumbnail_id()); ?> <div class="row<?php if ($is_banner) { echo ' tour-single-rise'; } ?> "> <main class="col-md-9" role="main" itemscope itemtype="http://schema.org/Product"> <?php get_template_part('templates/tour/tabs'); ?> <meta itemprop="name" content="<?php the_title(); ?> "> <meta itemprop="description" content="<?php echo esc_attr(adventure_tours_get_short_description(null, 300));
$columns = 2; } else { if ($columns > 4) { $columns = 4; } } $wrapper_class = 'product-category-wrap col-xs-6 col-md-' . 12 / $columns; $catIndex = adventure_tours_di('register')->getVar('tour_category_el_index', 0); if ($catIndex > 0 && 0 == $catIndex % $columns) { echo '<div class="product-category__row-separator clearfix hidden-sm hidden-xs"></div>'; } if ($catIndex > 0 && 0 == $catIndex % 2) { echo '<div class="product-category__row-separator clearfix visible-sm visible-xs"></div>'; } $catIndex++; adventure_tours_di('register')->setVar('tour_category_el_index', $catIndex); ?> <div class="<?php echo esc_attr($wrapper_class); ?> "> <div class="product-category"> <a href="<?php echo esc_url($category_link); ?> " class="product-category__image"><?php echo adventure_tours_render_category_thumbnail($category); ?> </a> <div class="product-category__content"> <?php
<?php /** * Tour single template. * * @author Themedelight * @package Themedelight/AdventureTours * @version 1.0.0 */ adventure_tours_di('app')->addBodyClass('tour-single'); get_header(); ?> <?php while (have_posts()) { the_post(); get_template_part('templates/tour/content-single'); } ?> <?php get_footer();
protected function do_import_theme_options($cfg) { $theme_options_file = $cfg['file']; $theme_option_component = adventure_tours_di('register')->getVar('_vp_theme_option'); if (!$theme_option_component) { throw new Exception('[di500] Data import error. Please contact support.'); } $theme_option_values = json_decode(file_get_contents($theme_options_file), true); if (!$theme_option_values) { throw new Exception('[di501] Theme options parsing error. Please contact support.'); } $theme_option_component->init_options_set(); $theme_option_component->init_options(); $set = $theme_option_component->get_options_set(); $tour_page_id = adventure_tours_get_option('tours_page'); $tour_page_instance = $tour_page_id ? get_page($tour_page_id) : null; if (!$tour_page_instance) { $tour_page_instance = get_page_by_path('tours', OBJECT, 'page'); if ($tour_page_instance) { $tour_page_id = $tour_page_instance->ID; } } $theme_option_values['tours_page'] = $tour_page_id; // populate new values $theme_option_component->get_options_set()->populate_values($theme_option_values, false); $theme_options_saving_result = $theme_option_component->save_and_reinit(); if (true != $theme_options_saving_result['status']) { throw new Exception('[to503] ' . $theme_options_saving_result['message']); } else { $saved_theme_values = $theme_option_component->get_options_set()->get_values(); } return 'Settings have been imported.'; }
/** * Ajax action that can be used by the tour booking form for calculate items prices. * * @return void */ public function ajax_calculate_booking_items_price() { $own_dir = dirname(__FILE__); require_once $own_dir . '/WC_Dummy_Session_Handler.php'; require_once $own_dir . '/WC_Dummy_Cart.php'; WC()->session = new WC_Dummy_Session_Handler(); $booking_form = adventure_tours_di('booking_form'); $booking_form->setConfig(array('disable_additional_fields' => true)); $cur_session_id = session_id(); if (!$cur_session_id) { session_start(); $cur_session_id = session_id(); } $new_session_id = null; if ($cur_session_id) { session_regenerate_id(false); $new_session_id = session_id(); } // using dummy cart instance $cart = new WC_Dummy_Cart(); // $cart->empty_cart(); $product_id = isset($_REQUEST['product_id']) ? $_REQUEST['product_id'] : 0; $product = wc_get_product($product_id); list($left_add, $added, $validation_errors) = $booking_form->process_add_to_cart_request($product, $cart); $response['success'] = false; $html_parts = array(); if ($left_add < 1 && count($added) > 0) { // to force full cycle of price calculations $cart->get_cart_from_session(); $cart->calculate_totals(); $items = array(); $line_totals = array(); $are_taxes_excluded = $cart->tax_display_cart == 'excl'; $render_tax_notice = true; foreach ($cart->get_cart() as $_sc_item) { $line_total_full = $are_taxes_excluded ? $_sc_item['line_total'] : $_sc_item['line_total'] + $_sc_item['line_tax']; $new_item = array('quantity' => $_sc_item['quantity'], 'price' => $line_total_full / $_sc_item['quantity'], 'total' => $line_total_full); $items[] = $new_item; $line_totals[] = $new_item['total']; $total_line_html = $render_tax_notice ? $cart->get_product_subtotal($_sc_item['data'], $new_item['quantity']) : wc_price($new_item['total']); $html_parts[] = sprintf('%s x %s = %s', $new_item['quantity'], wc_price($new_item['price']), $total_line_html); } if (count($line_totals) > 1) { if ($total_line_html) { //$html_parts[] = wc_price( array_sum( $line_totals ) ); // for WCML when multi-currency is enabled $real_cart = WC()->cart; WC()->cart = $cart; $html_parts[] = $cart->get_cart_subtotal(); WC()->cart = $real_cart; } else { $html_parts[] = wc_price(array_sum($line_totals)); } } $response = array('success' => true, 'data' => array('items' => $items)); } else { $plain_errors = array(); if ($validation_errors) { foreach ($validation_errors as $_field => $_errors) { $plain_errors = array_merge($plain_errors, $_errors); } } $html_parts = $plain_errors; } $response['as_html'] = join('<br>', $html_parts); if ($new_session_id) { session_destroy(); } if ($cur_session_id) { session_id($cur_session_id); session_start(); } exit(json_encode($response)); }
<?php /** * Breadcrumbs template. * * @author Themedelight * @package Themedelight/AdventureTours * @version 1.0.0 */ if (!adventure_tours_get_option('breadcrumbs_is_show')) { return; } $breadcrumbs_html = adventure_tours_di('breadcrumbs')->get_html(); if ($breadcrumbs_html) { printf('<div class="breadcrumbs">%s</div>', $breadcrumbs_html); }
* * @var string $widget_args * @var boolean $settings * @var string $items * * @author Themedelight * @package Themedelight/AdventureTours * @version 1.2.4 */ if (!$items) { return; } if (isset($widget_args)) { extract($widget_args); } $badge_service = adventure_tours_di('tour_badge_service'); // Display mode processing to decide what elements should be displayed for each tour item. $display_flags = !empty($settings['display_mode']) ? explode('_', $settings['display_mode']) : array(); $is_show_rating = $display_flags ? in_array('rating', $display_flags) : false; $is_show_badge = $display_flags ? in_array('badge', $display_flags) : false; $is_show_price = $display_flags ? in_array('price', $display_flags) : false; $is_show_alt_price = $display_flags ? in_array('alt-price', $display_flags) : false; if ($is_show_alt_price && $is_show_badge) { $is_show_badge = false; } $title = !empty($settings['title']) ? $settings['title'] : ''; ?> <div class="block-after-indent<?php if (!$title) { print ' widget-atgrid-without-title'; }
public function widget($args, $instance) { adventure_tours_render_template_part('templates/widgets/tours', '', array('widget_args' => $args, 'settings' => $instance, 'items' => adventure_tours_di('shortcodes_helper')->get_tours_collection($instance))); }
<?php /** * Wrapper for product loop used in WooCoomerce shortcodes for products rendering. * * @see AtWoocommerceShortcodesHelper * * @author Themedelight * @package Themedelight/AdventureTours * @version 1.2.1 */ global $woocommerce_loop; $template_file = adventure_tours_di('wc_shortcodes_helper')->get_wrapped_template(); if (!$template_file) { return; } $columns = isset($woocommerce_loop['columns']) ? $woocommerce_loop['columns'] : 3; $loop = isset($woocommerce_loop['loop']) ? $woocommerce_loop['loop'] : 0; if ($columns < 1 || $columns > 4) { $columns = 3; } $item_class = ''; if (!$item_class) { $item_class = 'atgrid__item-wrap atgrid__item-wrap--product col-xs-6 col-md-' . round(12 / $columns); } // $loop increases in content-product.php if ($loop > 0 && $loop % $columns == 0) { echo '<div class="atgrid__row-separator atgrid__row-separator--product clearfix hidden-sm hidden-xs"></div>'; } if ($loop > 0 && $loop % 2 == 0) { echo '<div class="atgrid__row-separator atgrid__row-separator--product clearfix visible-sm visible-xs"></div>';
/** * Saves booking periods for specefied post. * * @param int $post_id * @param array $rows * @return assoc */ protected function save_booking_rows($post_id, $rows) { return adventure_tours_di('tour_booking_service')->set_rows($post_id, $rows); }
* @var string $banner_subtitle * @var string $banner_image * @var string $is_banner_image_parallax * @var string $banner_image_repeat * @var string $banner_mask * * @author Themedelight * @package Themedelight/AdventureTours * @version 1.0.7 */ $breadcrumbs_html = adventure_tours_render_template_part('templates/header/breadcrumbs', '', array(), true); $is_use_parallax = isset($is_banner_image_parallax) && $is_banner_image_parallax; $is_image = $banner_image && !$is_use_parallax; $is_banner_paralax = $is_use_parallax && $banner_image; $mask_html = !empty($banner_mask) ? sprintf('<div class="header-section-mask %s"></div>', esc_attr('header-section-mask--' . $banner_mask)) : ''; adventure_tours_di('register')->setVar('is_banner', true); $wrapper_additional_class = $is_banner_paralax ? ' parallax-section parallax-section--header' : ''; if ($banner_mask) { $wrapper_additional_class .= esc_attr(' header-section--with-mask-' . $banner_mask); } ?> <div class="header-section header-section--with-banner<?php print $wrapper_additional_class; ?> "> <?php if ($is_banner_paralax) { wp_enqueue_script('parallax'); TdJsClientScript::addScript('initParallax', 'Theme.initParallax();'); printf('%s<div class="parallax-image" style="background-image:url(%s);%s"></div>', $mask_html, esc_url($banner_image), $banner_image_repeat ? ' background-repeat:' . esc_attr($banner_image_repeat) . ';' : '');
<?php /** * Template page for 404 page. * * @author Themedelight * @package Themedelight/AdventureTours * @version 1.0.0 */ adventure_tours_di('app')->addBodyClass('page-404'); get_header(); ?> <?php get_template_part('content', 'none'); ?> <?php get_footer();
/** * Returns options for the tour badge selector. * * @return array */ function adventure_tours_vp_badges_list() { $list = adventure_tours_di('tour_badge_service')->get_list(); $result = array(array('value' => '', 'label' => esc_html__('None', 'adventure-tours'))); foreach ($list as $bid => $title) { $result[] = array('value' => $bid, 'label' => $title); } return $result; }
public function getFontIcons() { $service = $this->icons_manager_service_id ? adventure_tours_di($this->icons_manager_service_id) : null; $result = $service ? $service->get_list() : null; return $result ? $result : array(); }
<?php /** * Page header section template. * * @author Themedelight * @package Themedelight/AdventureTours * @version 1.0.0 */ if (is_404()) { return; } $section_meta_service = adventure_tours_di('header_section'); $section_meta = $section_meta_service ? $section_meta_service->get_section_meta() : array(); // $mode == 'hide' means "default" mode. $mode = isset($section_meta['section_mode']) ? $section_meta['section_mode'] : 'hide'; if ('banner' == $mode && empty($section_meta['banner_image'])) { $mode = 'hide'; } if ('hide' == $mode) { // To hide default title for home page. if (is_front_page()) { return; } } switch ($mode) { case 'banner': adventure_tours_render_template_part('templates/header/banner', '', $section_meta); break; case 'slider': adventure_tours_render_template_part('templates/header/slider', '', $section_meta);
protected function get_product_date_specific_price($product, $date) { if (!$product) { return ''; } $check_product = $product->is_type('variation') && $product->parent ? $product->parent : $product; $result = $product->price; if ($date && $check_product->is_type('tour')) { return adventure_tours_di('tour_booking_service')->calculate_date_price($check_product->id, $date, $result); } return $result; }
public function get_special_price_service() { return adventure_tours_di('tour_special_price_service'); }
public function getFontSet() { static $includeCache = null; $fs = adventure_tours_di('register')->getVar('font_set', null); if (!$fs) { if (null == $includeCache) { $includeCache = (require PARENT_DIR . '/includes/data/font-set.php'); } return $includeCache; } return $fs; }
<?php /** * Shortcode [google_map] view. * For more detailed list see list of shortcode attributes. * * @var string $address * @var string $coordinates * @var string $zoom * @var string $height * @var string $width_mode * @var string $css_class * @var string $view * * @author Themedelight * @package Themedelight/AdventureTours * @version 1.0.0 */ $instance_id = adventure_tours_di('shortcodes_helper')->generate_id(); $element_id = 'googleMapCanvas' . $instance_id; $config_json = wp_json_encode(array('coordinates' => explode(',', $coordinates), 'zoom' => (int) $zoom, 'address' => $address, 'height' => $height, 'element_id' => $element_id, 'full_width' => 'full-width' == $width_mode, 'is_reset_map_fix_for_bootstrap_tabs_accrodion' => true)); TdJsClientScript::addScriptScriptFile('googleMapScript', 'https://maps.google.com/maps/api/js?sensor=true'); TdJsClientScript::addScript('initGoogleMap' . $instance_id, 'Theme.initGoogleMap(' . $config_json . ');', TdJsClientScript::POS_FOOTER); printf('<div id="%s" class="google-map%s"></div>', esc_attr($element_id), $css_class ? esc_attr(' ' . $css_class) : '');
/** * Returns display mode value for tour archive page. * If $tour_category_id has been specefied - category specific value, otherwise value will be taken from the theme options. * * @param int $tour_category_id * @return string possible values are: 'products', 'subcategories', 'both'. */ public static function get_tour_archive_page_display_mode($tour_category_id = null) { $result = 'default'; if ($tour_category_id > 0) { $cat_display_storage = adventure_tours_di('tour_category_display_type_storage'); if ($cat_display_storage && $cat_display_storage->is_active()) { $result = $cat_display_storage->getData($tour_category_id); } } if ('default' == $result) { $result = adventure_tours_get_option('tours_archive_display_mode'); } return !$result || 'default' == $result ? 'both' : $result; }
* @var string $view * @var string $items * * @author Themedelight * @package Themedelight/AdventureTours * @version 1.2.4 */ if (!$items) { return; } if (!isset($slides_number) || $slides_number < 1) { $slides_number = 4; } elseif ($slides_number > 6) { $slides_number = 6; } $slider_id = 'swiper' . adventure_tours_di('shortcodes_helper')->generate_id(); wp_enqueue_style('swiper'); wp_enqueue_script('swiper'); TdJsClientScript::addScript('toursTypeSliderInit' . $slider_id, 'Theme.makeSwiper(' . wp_json_encode(array('containerSelector' => '#' . $slider_id, 'slidesNumber' => $slides_number, 'navPrevSelector' => '.tours-type__slider__prev', 'navNextSelector' => '.tours-type__slider__next')) . ');'); ?> <div id="<?php echo esc_attr($slider_id); ?> " class="tours-type<?php if ($css_class) { echo esc_attr(' ' . $css_class); } ?> "> <?php if ($title || $sub_title) {
?> <?php $need_show_categories = $is_first_page && in_array($display_mode, array('both', 'subcategories')); $need_show_tours = in_array($display_mode, array('products', 'both')); $tours_display_style = $need_show_tours ? apply_filters('adventure_tours_get_tours_page_display_style', adventure_tours_get_option('tours_archive_display_style')) : ''; ?> <?php if ($need_show_categories) { if ('grid' == $tours_display_style) { $categories_col_size = adventure_tours_get_option('tours_archive_columns_number', '2'); } else { $categories_col_size = $sidebar_content ? 2 : 3; } adventure_tours_di('register')->setVar('tour_cat_columns', apply_filters('adventure_tours_tour_categories_columns', $categories_col_size, $sidebar_content ? true : false)); adventure_tours_render_tour_categories(array('before' => '<div class="row product-rategories">', 'after' => '</div>')); } ?> <?php if ($need_show_tours) { if ('grid' == $tours_display_style) { get_template_part('templates/tour/loop-grid'); } else { get_template_part('templates/tour/loop-list'); } adventure_tours_render_pagination('<div class="margin-top">', '</div>'); } ?> <?php
<?php /** * Shortcodes menu definition. * * @author Themedelight * @package Themedelight/AdventureTours * @version 1.3.0 */ $shortcodes_register = adventure_tours_di('shortcodes_register'); if (!adventure_tours_di('shortcodes_tiny_mce_integrator') || !$shortcodes_register) { return; } $toursMenu = esc_html__('Tours', 'adventure-tours') . '.'; $typographyMenu = esc_html__('Typography', 'adventure-tours') . '.'; $tablesMenu = esc_html__('Tables', 'adventure-tours') . '.'; $otherMenu = esc_html__('Other', 'adventure-tours') . '.'; $contactMenu = esc_html__('Contact', 'adventure-tours') . '.'; $externalApiMenu = esc_html__('External Services', 'adventure-tours') . '.'; $category_order_mode = array('ASC', 'DESC'); $category_orderby_mode = array('name', 'id', 'slug', 'count', 'term_group', 'category__in'); $article_order_mode = array('DESC', 'ASC'); $article_orderby_mode = array('date', 'title', 'name', 'modified', 'rand', 'comment_count', 'post__in'); $article_product_orderby_mode = $article_orderby_mode; $article_product_orderby_mode[] = 'price'; $article_product_orderby_mode[] = 'sales'; $article_product_orderby_mode[] = 'most_popular'; $shortcodes_register->add('_edit_', esc_html__('Edit', 'adventure-tours'))->add('row', esc_html__('Columns', 'adventure-tours'), array('columns' => '2', 'css_class' => ''))->add('title', $typographyMenu . esc_html__('Title', 'adventure-tours'), array('text' => '', 'subtitle' => '', 'size' => array('type' => 'select', 'values' => array('big', 'small')), 'position' => array('type' => 'select', 'values' => array('left', 'center')), 'decoration' => array('type' => 'boolean', 'default' => 'on'), 'underline' => array('type' => 'boolean', 'default' => 'on'), 'style' => array('type' => 'select', 'values' => array('dark', 'light')), 'css_class' => ''))->add('icon_tick', $typographyMenu . esc_html__('Icon Tick', 'adventure-tours'), array('state' => array('type' => 'boolean', 'default' => 'on'), 'css_class' => ''))->add('at_btn', $typographyMenu . esc_html__('Button', 'adventure-tours'), array('text' => '', 'url' => '', 'type' => array('type' => 'select', 'values' => array('link', 'button', 'submit')), 'css_class' => '', 'style' => array('type' => 'select', 'values' => array('', 'primary', 'secondary1', 'secondary2')), 'size' => array('type' => 'select', 'values' => array('', 'medium', 'small')), 'corners' => array('type' => 'select', 'values' => array('', 'rounded')), 'light' => array('type' => 'boolean', 'default' => 'off'), 'transparent' => array('type' => 'boolean', 'default' => 'off'), 'icon_class' => '', 'icon_align' => array('type' => 'select', 'values' => array('left', 'right'))))->add('table', $tablesMenu . esc_html__('Table', 'adventure-tours'), array('rows' => '', 'cols' => '', 'css_class' => ''))->add('tour_table', $tablesMenu . esc_html__('Tour Table', 'adventure-tours'), array('rows' => '', 'cols' => '', 'css_class' => ''))->add('tour_search_form', $toursMenu . esc_html__('Tour Search Form', 'adventure-tours'), array('title' => '', 'note' => '', 'css_class' => '', 'hide_text_field' => array('type' => 'boolean', 'default' => 'off')))->add('tour_search_form_horizontal', $toursMenu . esc_html__('Tour Search Form Horizontal', 'adventure-tours'), array('title' => '', 'note' => '', 'style' => array('type' => 'select', 'values' => array('default', 'style1', 'style2', 'style3', 'style4')), 'css_class' => '', 'hide_text_field' => array('type' => 'boolean', 'default' => 'off')))->add('tour_category_images', $toursMenu . esc_html__('Tour Category Images', 'adventure-tours'), array('title' => '', 'title_underline' => array('type' => 'boolean', 'default' => 'on'), 'sub_title' => '', 'parent_id' => '', 'ignore_empty' => array('type' => 'boolean', 'default' => 'on'), 'category_ids' => array('help' => esc_html__('Specify exact ids of items that should be displayed separated by comma.', 'adventure-tours'), 'default' => ''), 'number' => '', 'slides_number' => '4', 'css_class' => '', 'order' => array('type' => 'select', 'values' => $category_order_mode), 'orderby' => array('type' => 'select', 'values' => $category_orderby_mode)))->add('tour_category_icons', $toursMenu . esc_html__('Tour Category Icons', 'adventure-tours'), array('title' => '', 'title_underline' => array('type' => 'boolean', 'default' => 'on'), 'sub_title' => '', 'parent_id' => '', 'bg_url' => array('type' => 'image_url', 'help' => esc_html__('Select image that should be used as background.', 'adventure-tours'), 'default' => ''), 'ignore_empty' => array('type' => 'boolean', 'default' => 'on'), 'category_ids' => array('help' => esc_html__('Specify exact ids of items that should be displayed separated by comma.', 'adventure-tours'), 'default' => ''), 'number' => '', 'slides_number' => '5', 'css_class' => '', 'order' => array('type' => 'select', 'values' => $category_order_mode), 'orderby' => array('type' => 'select', 'values' => $category_orderby_mode)))->add('tour_carousel', $toursMenu . esc_html__('Tours Carousel', 'adventure-tours'), array('title' => '', 'title_underline' => array('type' => 'boolean', 'default' => 'on'), 'sub_title' => '', 'description_words_limit' => '20', 'tour_category' => array('help' => esc_html__('Filter items from specific tour category (enter category slug).', 'adventure-tours'), 'default' => ''), 'tour_category_ids' => array('help' => esc_html__('Specify tour categories ID\'s (separated by comma) of items that you want to display.', 'adventure-tours'), 'default' => ''), 'tour_ids' => array('help' => esc_html__('Specify exact ids of items that should be displayed separated by comma.', 'adventure-tours'), 'default' => ''), 'slides_number' => '3', 'number' => '', 'css_class' => '', 'bg_url' => array('type' => 'image_url', 'help' => esc_html__('Select image that should be used as background.', 'adventure-tours'), 'default' => ''), 'arrow_style' => array('type' => 'select', 'values' => array('light', 'dark')), 'order' => array('type' => 'select', 'values' => $article_order_mode), 'orderby' => array('type' => 'select', 'values' => $article_product_orderby_mode)))->add('tours_grid', $toursMenu . esc_html__('Tours Grid', 'adventure-tours'), array('title' => '', 'title_underline' => array('type' => 'boolean', 'default' => 'on'), 'sub_title' => '', 'description_words_limit' => '20', 'tour_category' => array('help' => esc_html__('Filter items from specific tour category (enter category slug).', 'adventure-tours'), 'default' => ''), 'tour_category_ids' => array('help' => esc_html__('Specify tour categories ID\'s (separated by comma) of items that you want to display.', 'adventure-tours'), 'default' => ''), 'tour_ids' => array('help' => esc_html__('Specify exact ids of items that should be displayed separated by comma.', 'adventure-tours'), 'default' => ''), 'number' => '4', 'columns' => '', 'css_class' => '', 'price_style' => array('type' => 'select', 'values' => array('default', 'highlighted')), 'show_categories' => array('type' => 'boolean', 'default' => 'on'), 'btn_more_text' => esc_html__('View more', 'adventure-tours'), 'btn_more_link' => '', 'order' => array('type' => 'select', 'values' => $article_order_mode), 'orderby' => array('type' => 'select', 'values' => $article_product_orderby_mode)))->add('tours_list', $toursMenu . esc_html__('Tours List', 'adventure-tours'), array('title' => '', 'title_underline' => array('type' => 'boolean', 'default' => 'on'), 'sub_title' => '', 'description_words_limit' => '20', 'tour_category' => array('help' => esc_html__('Filter items from specific tour category (enter category slug).', 'adventure-tours'), 'default' => ''), 'tour_category_ids' => array('help' => esc_html__('Specify tour categories ID\'s (separated by comma) of items that you want to display.', 'adventure-tours'), 'default' => ''), 'tour_ids' => array('help' => esc_html__('Specify exact ids of items that should be displayed separated by comma.', 'adventure-tours'), 'default' => ''), 'number' => '4', 'css_class' => '', 'show_categories' => array('type' => 'boolean', 'default' => 'on'), 'btn_more_text' => esc_html__('View more', 'adventure-tours'), 'btn_more_link' => '', 'order' => array('type' => 'select', 'values' => $article_order_mode), 'orderby' => array('type' => 'select', 'values' => $article_product_orderby_mode)))->add('tour_reviews', $toursMenu . esc_html__('Tour Reviews', 'adventure-tours'), array('title' => '', 'title_underline' => array('type' => 'boolean', 'default' => 'on'), 'number' => '2', 'css_class' => '', 'order' => array('type' => 'select', 'values' => array('DESC', 'ASC')), 'orderby' => array('type' => 'select', 'values' => array('comment_date_gmt', 'comment_author', 'comment_post_ID'))))->add('contact_info', $contactMenu . esc_html__('Contact Info', 'adventure-tours'), array('address' => '', 'phone' => '', 'email' => '', 'skype' => '', 'css_class' => ''))->add('social_icons', $contactMenu . esc_html__('Social Icons', 'adventure-tours'), array('title' => esc_html__('We are social', 'adventure-tours'), 'facebook_url' => '', 'twitter_url' => '', 'googleplus_url' => '', 'pinterest_url' => '', 'linkedin_url' => '', 'instagram_url' => '', 'dribbble_url' => '', 'tumblr_url' => '', 'vk_url' => '', 'css_class' => ''))->add('mailchimp_form', $externalApiMenu . esc_html__('MailChimp Form', 'adventure-tours'), array('form_id' => array('required' => true), 'button_text' => esc_html__('Submit', 'adventure-tours'), 'title' => '', 'content' => '', 'css_class' => '', 'width_mode' => array('type' => 'select', 'values' => array('box-width', 'full-width')), 'bg_url' => array('type' => 'image_url', 'help' => esc_html__('Select image that should be used as background.', 'adventure-tours'), 'default' => ''), 'bg_repeat' => array('type' => 'select', 'values' => array('repeat', 'no-repeat', 'repeat-x', 'repeat-y'))))->add('google_map', $externalApiMenu . esc_html__('Google Map', 'adventure-tours'), array('address' => array('help' => esc_html__('The address will show up when clicking on the map marker.', 'adventure-tours')), 'coordinates' => array('help' => esc_html__('Coordinates separated by comma.', 'adventure-tours'), 'default' => '40.764324,-73.973057', 'required' => true), 'zoom' => array('help' => esc_html__('Number in range from 1 up to 21.', 'adventure-tours'), 'default' => '10', 'required' => true), 'height' => array('default' => '400'), 'width_mode' => array('type' => 'select', 'values' => array('box-width', 'full-width')), 'css_class' => ''))->add('latest_posts', $otherMenu . esc_html__('Latest Posts', 'adventure-tours'), array('title' => esc_html__('Latest Posts', 'adventure-tours'), 'title_underline' => array('type' => 'boolean', 'default' => 'on'), 'category' => array('help' => esc_html__('Filter items from specific category (enter category slug).', 'adventure-tours'), 'default' => ''), 'post_ids' => array('help' => esc_html__('Specify exact ids of items that should be displayed separated by comma.', 'adventure-tours'), 'default' => ''), 'number' => '1', 'read_more_text' => esc_html__('Read more', 'adventure-tours'), 'words_limit' => '25', 'ignore_sticky_posts' => array('type' => 'boolean', 'default' => 'on'), 'translate' => array('type' => 'boolean', 'default' => 'on'), 'order' => array('type' => 'select', 'values' => $article_order_mode), 'orderby' => array('type' => 'select', 'values' => $article_orderby_mode), 'css_class' => ''))->add('timeline', $otherMenu . esc_html__('Timeline', 'adventure-tours'), array('content' => '[timeline_item item_number="1" title="Day 1"]Lorem ipsum 1[/timeline_item][timeline_item item_number="2" title="Day 2"]Lorem ipsum 2[/timeline_item]', 'css_class' => ''))->add('icons_set', $otherMenu . esc_html__('Icons Set', 'adventure-tours'), array('row_size' => array('type' => 'select', 'values' => array('2', '3', '4'), 'default' => 3), 'content' => join(PHP_EOL, array('[icon_item icon="td-earth" title="Item1"]text[/icon_item]', '[icon_item icon="td-heart" title="Item2"]text[/icon_item]', '[icon_item icon="td-lifebuoy" title="Item3"]text[/icon_item]')), 'css_class' => ''))->add('product_carousel', $otherMenu . esc_html__('Products Carousel', 'adventure-tours'), array('title' => '', 'title_underline' => array('type' => 'boolean', 'default' => 'on'), 'sub_title' => '', 'description_words_limit' => '20', 'product_category' => array('help' => esc_html__('Filter items from specific tour category (enter category slug).', 'adventure-tours'), 'default' => ''), 'product_category_ids' => array('help' => esc_html__('Specify product categories ID\'s (separated by comma) of items that you want to display.', 'adventure-tours'), 'default' => ''), 'product_ids' => array('help' => esc_html__('Specify exact ids of items that should be displayed separated by comma.', 'adventure-tours'), 'default' => ''), 'slides_number' => '3', 'number' => '', 'css_class' => '', 'bg_url' => array('type' => 'image_url', 'help' => esc_html__('Select image that should be used as background.', 'adventure-tours'), 'default' => ''), 'arrow_style' => array('type' => 'select', 'values' => array('light', 'dark')), 'order' => array('type' => 'select', 'values' => $article_order_mode), 'orderby' => array('type' => 'select', 'values' => $article_product_orderby_mode)))->add('accordion', $otherMenu . esc_html__('Accordion', 'adventure-tours'), array('content' => join(PHP_EOL, array('[accordion_item title="Title 1" is_active="on"]Lorem ipsum 1[/accordion_item]', '[accordion_item title="Title 2"]Lorem ipsum 2[/accordion_item]', '[accordion_item title="Title 3"]Lorem ipsum 3[/accordion_item]')), 'style' => array('type' => 'select', 'values' => array('with-shadow', 'with-border')), 'css_class' => ''))->add('tabs', $otherMenu . esc_html__('Tabs', 'adventure-tours'), array('content' => join(PHP_EOL, array('[tab_item title="Title 1" is_active="on"]Lorem ipsum 1[/tab_item]', '[tab_item title="Title 2"]Lorem ipsum 2[/tab_item]', '[tab_item title="Title 3"]Lorem ipsum 3[/tab_item]')), 'style' => array('type' => 'select', 'values' => array('with-shadow', 'with-border')), 'css_class' => ''));
/** * Output the main chart. */ public function get_main_chart() { global $wpdb; $query_data = array('_product_id' => array('type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => '', 'name' => 'product_id'), '_qty' => array('type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'quantity'), 'order_id' => array('type' => 'order_item', 'order_item_type' => 'line_item', 'function' => 'GROUP_CONCAT', 'name' => 'order_ids'), 'post_status' => array('type' => 'post_data', 'order_item_type' => 'line_item', 'function' => '', 'name' => 'order_status'), 'tour_date' => array('type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => '', 'name' => 'date')); $where_meta = array(); $product_ids = array(); if (isset($_GET['item_ids']) && !empty($_GET['item_ids'])) { $product_ids = array_map('absint', (array) $_GET['item_ids']); } if ($product_ids) { $where_meta[] = array('type' => 'order_item_meta', 'meta_key' => '_product_id', 'operator' => 'in', 'meta_value' => $product_ids); } $wpdb->query('SET SQL_BIG_SELECTS=1'); $raw_rows = $this->get_order_report_data(array('data' => $query_data, 'where_meta' => $where_meta, 'order_by' => 'date, product_id DESC', 'group_by' => 'product_id, date, order_status', 'query_type' => 'get_results', 'filter_range' => true, 'order_types' => array_merge(wc_get_order_types('sales-reports'), array('shop_order_refund')), 'order_status' => array('completed', 'processing', 'on-hold'), 'parent_order_status' => array('completed', 'processing', 'on-hold'))); $records = array(); $stuses_list = wc_get_order_statuses(); $booking_form = adventure_tours_di('booking_form'); foreach ($raw_rows as $row) { $product = wc_get_product($row->product_id); $row->item_title = $product->get_title(); $row->item_permalink = get_permalink($row->product_id); $row->order_status_label = isset($stuses_list[$row->order_status]) ? $stuses_list[$row->order_status] : $row->order_status; $row->booking_date_formatted = $booking_form ? $booking_form->convert_date_for_human($row->date) : $row->date; $records[] = $row; } ?> <table class="widefat"> <thead> <tr> <th><?php _e('Tour', 'adventure-tours'); ?> </th> <th><?php _e('Date', 'adventure-tours'); ?> </th> <th><?php _e('Tickets', 'adventure-tours'); ?> </th> <th><?php _e('Status', 'adventure-tours'); ?> </th> <th><?php _e('Orders', 'adventure-tours'); ?> </th> <th><?php _e('URL', 'adventure-tours'); ?> </th> </tr> </thead> <?php if ($records) { ?> <tbody> <?php foreach ($records as $row) { ?> <?php ?> <tr> <th scope="row"><?php printf('<a href="%s">%s</a>', esc_url($row->item_permalink), esc_html($row->item_title)); ?> </th> <td><?php echo esc_html($row->booking_date_formatted); ?> </td> <td class="total_row"><?php echo esc_html($row->quantity); ?> </td> <td><?php echo esc_html($row->order_status_label); ?> </td> <td><?php echo '#' . join(', #', explode(',', $row->order_ids)); ?> </td> <td><?php echo esc_url($row->item_permalink); ?> </td> </tr> <?php } ?> </tbody> <?php } else { ?> <tbody> <tr> <td><?php _e('No records found in this period', 'adventure-tours'); ?> </td> </tr> </tbody> <?php } ?> </table> <?php }