function st_post_select_func() { if (!current_user_can('upload_files')) { return; } $result = array('total_count' => 0, 'items' => array()); $q = STInput::get('q'); $post_type = STInput::get('post_type'); if ($q) { if (!$post_type) { $post_type = 'st_hotel'; } $arg = array('post_type' => $post_type, 'posts_per_page' => 20, 's' => $q, 'post_status' => 'publish'); $author = STInput::get('author'); if ($author) { $arg = array('post_type' => $post_type, 'posts_per_page' => 20, 's' => $q, 'author' => $author, 'post_status' => 'publish'); } $query = new WP_Query($arg); while ($query->have_posts()) { $query->the_post(); $result['items'][] = array('id' => get_the_ID(), 'name' => get_the_title(), 'description' => "ID: " . get_the_ID()); } global $wp_query; $result['total_count'] = $wp_query->found_posts; wp_reset_query(); } echo json_encode($result); die; }
/** * * * * * @since 1.0.9 * */ function _top_ajax_search() { if (STInput::request('action') != 'st_top_ajax_search') { return; } //Small security check_ajax_referer('st_search_security', 'security'); $s = STInput::get('s'); $arg = array('post_type' => array('post', 'st_hotel', 'st_rental', 'location', 'st_tours', 'st_holidays', 'st_cars', 'st_activity'), 'posts_per_page' => 10, 's' => $s, 'suppress_filters' => false); $query = new WP_Query(); $query->is_admin = false; $query->query($arg); $r = array(); while ($query->have_posts()) { $query->the_post(); $post_type = get_post_type(get_the_ID()); $obj = get_post_type_object($post_type); $item = array('title' => get_the_title(), 'id' => get_the_ID(), 'type' => $obj->labels->singular_name, 'url' => get_permalink(), 'obj' => $obj); if ($post_type == 'location') { $item['url'] = home_url(esc_url_raw('?s=&post_type=st_hotel&location_id=' . get_the_ID())); } $r['data'][] = $item; } wp_reset_query(); echo json_encode($r); die; }
function _shop_product_style() { $style = st()->get_option('shop_default_list_view', 'grid'); if (STInput::get('view_style')) { $style = STInput::get('view_style'); } return $style; }
static function _get_image() { if (STInput::get('st_get_captcha')) { $key = STInput::get('key'); $captcha = new SimpleCaptcha(); if ($key) { $captcha->session_var = $key; } $captcha->CreateImage(); die; } }
protected function content($arg, $content = null) { $data = shortcode_atts(array('st_title_form' => '', 'st_post_type' => "st_hotel", 'st_button_search' => __("Search", ST_TEXTDOMAIN)), $arg, 'st_search_form'); extract($data); $content = st_remove_wpautop($content); $text = ' <h2>' . $st_title_form . '</h2> <form role="search" method="get" class="search" action="' . home_url('/') . '"> <input type="hidden" name="s" value=""> <input type="hidden" name="post_type" value="' . $st_post_type . '"> <input type="hidden" name="layout" value="' . STInput::get('layout') . '"> <div class="row">' . $content . '</div> <button class="btn btn-primary btn-lg" type="submit">' . $st_button_search . '</button> </form>'; return $text; }
static function _javascript_reload_parentwindow() { if (STInput::get('social_login_success') == 1) { ?> <script> window.opener.location.reload(); window.close(); </script> <?php die; } }
/** * @since 1.1.8 */ static function _init() { self::$table_columns = apply_filters('st_order_meta_table_columns', self::$table_columns); add_action('after_setup_theme', array(__CLASS__, '_check_is_working')); add_action('st_traveler_do_upgrade_table', array(__CLASS__, '_upgrade_table')); add_action('st_save_order_item_meta', array(__CLASS__, '_save_data'), 10, 3); // Re update the Order Meta add_action('save_post', array(__CLASS__, '_reupdate_normal_booking'), 50); // Update Status add_action('st_booking_change_status', array(__CLASS__, '_st_booking_change_status'), 10, 3); add_action('woocommerce_order_status_changed', array(__CLASS__, '_woocommerce_order_status_changed'), 10, 3); if (STInput::get('_upgrade_table') and current_user_can('manage_options')) { self::_upgrade_table(); die; } }
function search_location() { //Small security check_ajax_referer('st_search_security', 'security'); $s = STInput::get('s'); $arg = array('post_type' => 'location', 'posts_per_page' => 10, 's' => $s); if ($s) { } global $wp_query; query_posts($arg); $r = array(); while (have_posts()) { the_post(); $r['data'][] = array('title' => get_the_title(), 'id' => get_the_ID(), 'type' => __('Location', ST_TEXTDOMAIN)); } wp_reset_query(); echo json_encode($r); die; }
/** * Validate if order is available to show booking infomation * * @since 1.0.8 * * */ function success_page_validate() { $order_code = STInput::get('order_code'); $order_token_code = STInput::get('order_token_code'); if ($order_token_code) { $order_code = STOrder::get_order_id_by_token($order_token_code); } $status = get_post_meta($order_code, 'status', true); $result = true; if ($status == 'incomplete') { // try to check payment complete $paypal = new STPaypal(); $r = $paypal->check_completePurchase($order_code); if ($r) { if (isset($r['status'])) { if ($r['status']) { $result = true; update_post_meta($order_code, 'status', 'complete'); $status = 'complete'; //do_action('st_email_after_booking',$order_code); //do_action('st_booking_submit_form_success',$order_code); STCart::send_mail_after_booking($order_code, true); STCart::send_email_confirm($order_code); do_action('st_booking_change_status', 'complete', $order_code, 'normal_booking'); } elseif (isset($r['message']) and $r['message']) { $result = false; STTemplate::set_message($r['message'], 'danger'); } if (isset($r['redirect_url']) and $r['redirect_url']) { echo "<script>window.location.href='" . $r['redirect_url'] . "'</script>"; die; } } } } if ($status == 'incomplete') { $result = false; STTemplate::set_message(__("Sorry! Your payment is incomplete.", ST_TEXTDOMAIN)); } return $result; }
function st_post_select_ajax() { //if(!current_user_can('upload_files')) return; $result = array('total_count' => 0, 'items' => array()); $q = STInput::get('q'); $post_type = STInput::get('post_type'); if ($q) { if (!$post_type) { $post_type = 'st_hotel'; } query_posts(array('post_type' => $post_type, 'posts_per_page' => 20, 's' => $q)); while (have_posts()) { the_post(); $result['items'][] = array('id' => get_the_ID(), 'name' => get_the_title(), 'description' => "ID: " . get_the_ID()); } global $wp_query; $result['total_count'] = $wp_query->found_posts; wp_reset_query(); } echo json_encode($result); die; }
function st_post_select_ajax() { $result = array('total_count' => 0, 'items' => array()); $q = STInput::get('q'); $post_type = STInput::get('post_type'); $user_id = STInput::get('user_id', ''); if ($q) { if (!$post_type) { $post_type = 'st_hotel'; } query_posts(array('post_type' => $post_type, 'posts_per_page' => 20, 's' => $q, 'author' => $user_id, 'post_status' => array('publish', 'private'))); while (have_posts()) { the_post(); $result['items'][] = array('id' => get_the_ID(), 'name' => get_the_title(), 'description' => "ID: " . get_the_ID()); } global $wp_query; $result['total_count'] = $wp_query->found_posts; wp_reset_query(); } echo json_encode($result); die; }
<div class="filter-items"> <div class="alignleft actions"> <input type="text" class="st_datepicker" format="mm/dd/yyyy" name="st_date_start" placeholder="<?php _e('Filter by Date from', ST_TEXTDOMAIN); ?> " value="<?php echo STInput::get('st_date_start'); ?> "/> <input type="text" class="st_datepicker" name="st_date_end" placeholder="<?php _e('Filter by Date to', ST_TEXTDOMAIN); ?> " value="<?php echo STInput::get('st_date_end'); ?> "/> <input type="submit" name="filter_action" id="post-query-submit" class="button" value="<?php _e('Filter', ST_TEXTDOMAIN); ?> "> </div> </div> </div> </form> <form id="posts-filter" action="<?php echo admin_url('edit.php?post_type=st_rental&page=st_rental_booking'); ?> " method="post">
} if ($is_required == 'on') { $is_required = 'required'; } ?> <div data-date-format="<?php echo TravelHelper::getDateFormatJs(); ?> " class="form-group input-daterange form-group-<?php echo esc_attr($field_size); ?> form-group-icon-left"> <label for="field-hotel-checkout"><?php echo esc_html($title); ?> </label> <i class="fa fa-calendar input-icon input-icon-highlight"></i> <input id="field-hotel-checkout" <?php echo esc_attr($is_required); ?> placeholder="<?php echo TravelHelper::getDateFormatJs(); ?> " class="form-control <?php echo esc_attr($is_required); ?> checkout_hotel" value="<?php echo STInput::get('end'); ?> " name="end" type="text" /> </div>
$i_s = '<li><i class="fa fa-star"></i></li>'; for ($k = 1; $k <= $i; $k++) { echo balanceTags($i_s); } ?> </ul> </label> </div> <?php } break; case "taxonomy": $terms = get_terms($value->taxonomy); $key = $value->taxonomy; foreach ($terms as $key2 => $value2) { $current = STInput::get('taxonomy'); if (isset($current[$key])) { $current = $current[$value->taxonomy]; } else { $current = ''; } $checked = TravelHelper::checked_array(explode(',', $current), $value2->term_id); if ($checked) { $link = TravelHelper::build_url_array('taxonomy', $value->taxonomy, $value2->term_id, false); } else { $link = TravelHelper::build_url_array('taxonomy', $value->taxonomy, $value2->term_id); } ?> <div class="checkbox"> <label> <input <?php
* @package WordPress * @subpackage Traveler * @since 1.0 * * Hotel field room num * * Created by ShineTheme * */ $default = array('title' => ''); if (isset($data)) { extract(wp_parse_args($data, $default)); } else { extract($default); } $old = STInput::get('room_num_search'); if (!isset($field_size)) { $field_size = 'lg'; } ?> <div class="form-group form-group-<?php echo esc_attr($field_size); ?> form-group-select-plus"> <label><?php echo esc_html($title); ?> </label> <div class="btn-group btn-group-select-num <?php if ($old >= 4) { echo 'hidden';
* @package WordPress * @subpackage Traveler * @since 1.0 * * Hotel field children * * Created by ShineTheme * */ $default = array('title' => ''); if (isset($data)) { extract(wp_parse_args($data, $default)); } else { extract($default); } $old = STInput::get('child_number'); if (!isset($field_size)) { $field_size = 'lg'; } ?> <div class="form-group form-group-<?php echo esc_attr($field_size); ?> form-group-select-plus"> <label for="field-rental-children"><?php echo esc_html($title); ?> </label> <div class="btn-group btn-group-select-num <?php if ($old >= 3) {
echo "hidden"; } ?> "> <?php for ($i = 1; $i < 9; $i++) { echo '<option ' . selected($room_num_search, $i, false) . ' value="' . $i . '">' . $i . '</option>'; } ?> </select> </div> </div> <div class="col-md-2"> <?php $adult_num = STInput::get('adult_num', 1); ?> <div class="form-group form-group-select-plus"> <label><?php st_the_language('adults'); ?> </label> <?php if ($dropdown_style == 'number' and $adult_num < 4) { ?> <div class="btn-group btn-group-select-num" data-toggle="buttons"> <label class="btn btn-primary <?php echo (!$adult_num or $adult_num == 1) ? 'active' : false; ?> ">
function _change_posts_per_page($query) { if ($limit = STInput::get('posts_per_page')) { $query->set('posts_per_page', $limit); } }
} if (!isset($field_size)) { $field_size = 'lg'; } if ($is_required == 'on') { $is_required = 'required'; } ?> <div class="form-group form-group-<?php echo esc_attr($field_size); ?> form-group-icon-left"> <label for="field-st-name"><?php echo balanceTags($title); ?> </label> <i class="fa fa-sort-amount-asc input-icon"></i> <input id="field-st-name" name="item_name" <?php echo esc_attr($is_required); ?> value="<?php echo STInput::get('item_name'); ?> " class="form-control <?php echo esc_attr($is_required); ?> " placeholder="<?php echo $placeholder ? $placeholder : false; ?> " type="text" /> </div>
} else { extract($default); } if (!isset($field_size)) { $field_size = 'lg'; } $old_location = STInput::get('location_id'); $list_location = TravelHelper::getListFullNameLocation(); if ($is_required == 'on') { $is_required = 'required'; } $location_id = STInput::get('location_id', ''); $location_name = STInput::request('location_name', ''); if (!$location_id) { $location_id = STInput::get('location_id_pick_up'); $location_name = STInput::get('pick-up'); } if (!empty($list_location) and is_array($list_location)) { ?> <div class="form-group form-group-<?php echo esc_attr($field_size); ?> form-group-icon-left"> <label for="field-hotel-location"><?php echo esc_html($title); ?> </label> <i class="fa fa-map-marker input-icon"></i> <select id="field-hotel-location" name="location_id" class="form-control" <?php echo esc_attr($is_required); ?>
if ($is_required == 'on') { $is_required = 'required'; } ?> <div data-date-format="<?php echo TravelHelper::getDateFormatJs(); ?> " class="form-group input-daterange form-group-<?php echo esc_attr($field_size); ?> form-group-icon-left"> <label for="field-tour-checkin"><?php echo balanceTags($title); ?> </label> <i class="fa fa-calendar input-icon input-icon-highlight"></i> <input id="field-tour-checkin" class="form-control <?php echo esc_attr($is_required); ?> " <?php echo esc_attr($is_required); ?> name="start" type="text" placeholder="<?php echo TravelHelper::getDateFormatJs(); ?> " value="<?php echo STInput::get('start'); ?> " /> </div>
<?php if ($range_km == 'on') { ?> <div class="col-md-<?php echo esc_attr($range_km_col); ?> "> <label><?php _e("Range Kilometers", ST_TEXTDOMAIN); ?> </label> <div class="form-group price_map"> <?php $data_min_max['min'] = 0; $data_min_max['max'] = $max_range_km; echo '<input type="text" name="range" value="' . STInput::get('range') . '" class="range-slider" data-symbol="' . TravelHelper::get_current_currency('symbol') . '" data-min="' . $data_min_max['min'] . '" data-max="' . $data_min_max['max'] . '" data-step="1">'; ?> </div> </div> <?php } ?> </div> <!--<label><?php /*_e("Price range",ST_TEXTDOMAIN) */ ?> </label>--> <!--<div class="form-group price_map" > <?php /* $data_min_max = TravelerObject::get_min_max_price('st_rental'); echo '<input type="text" name="price_range" value="'.STInput::get('price_range').'" class="price-slider" data-symbol="'.TravelHelper::get_current_currency('symbol').'" data-min="'.$data_min_max['price_min'].'" data-max="'.$data_min_max['price_max'].'" data-step="'.st()->get_option('search_price_range_step',0).'">';
if (!empty($get)) { foreach ($get as $key => $value) { if (is_array($value)) { if (!empty($value)) { if (!empty($value) and is_array($value)) { foreach ($value as $key2 => $value2) { if (!empty($value2) and is_array($value2)) { foreach ($value2 as $key3 => $value3) { echo "<input type='hidden' name='{$key}[{$key2}][{$key3}]' value='{$value3}' >"; } } } } } } else { if ($key != "price_range") { echo "<input type='hidden' name='{$key}' value='{$value}' >"; } } } } $data_min_max = TravelerObject::get_min_max_price('st_cars'); echo '<input type="text" name="price_range" value="' . STInput::get('price_range') . '" class="price-slider" data-symbol="' . TravelHelper::get_current_currency('symbol') . '" data-min="' . $data_min_max['price_min'] . '" data-max="' . $data_min_max['price_max'] . '" data-step="' . st()->get_option('search_price_range_step', 0) . '">'; ?> <button style="margin-top: 4px;" type="submit" class="btn btn-primary"><?php st_the_language('car_filter'); ?> </button> </form>
extract(wp_parse_args($data, $default)); } else { extract($default); } if ($is_required == 'on') { $is_required = 'required'; } ?> <div class="form-group form-group-lg form-group-icon-left"> <label for="field-holiday-duration-dropdown"><?php echo esc_html($title); ?> </label> <i class="fa fa-calendar input-icon input-icon-highlight"></i> <select id="field-holiday-duratio-dropdown" name="duration" class="form-control"> <option value=""><?php _e('-- Select --', ST_TEXTDOMAIN); ?> </option> <?php for ($i = 1; $i <= 50; $i++) { if ($i == STInput::get('duration')) { echo '<option selected="selected" value="' . $i . '">' . $i . '</option>'; } else { echo '<option value="' . $i . '">' . $i . '</option>'; } } ?> </select> </div>
if ($is_required == 'on') { $is_required = 'required'; } if (!isset($field_size)) { $field_size = 'md'; } ?> <div class="form-group form-group-<?php echo esc_attr($field_size); ?> form-group-icon-left"> <label for="field-st-dropoff-address"><?php echo esc_html($title); ?> </label> <i class="fa fa-map-marker input-icon input-icon-highlight"></i> <input id="field-st-dropoff-address" name="drop-off" data-country="" <?php echo esc_attr($is_required); ?> value="<?php echo STInput::get('drop-off'); ?> " class="typeahead_drop_off_address form-control <?php echo esc_attr($is_required); ?> " placeholder="<?php echo $placeholder ? $placeholder : st_get_language('car_city_airport_or_us_zip_code'); ?> " type="text" /> </div>
/** * @since 1.0.9 **/ function activity_add_to_cart() { if (STInput::get('action') == 'activity_add_to_cart') { $item_id = STInput::get('item_id'); $number = STInput::get('number'); $discount = STInput::get('discount'); if (!empty($discount)) { $price = STInput::get('price'); $price = $price - $price * ($discount / 100); $data = array('discount' => $discount, 'price_old' => STInput::get('price'), 'price_sale' => $price); } else { $price = STInput::get('price'); } $data['check_in'] = STInput::get('check_in'); $data['check_out'] = STInput::get('check_out'); $data['type_price'] = STInput::request('type_price'); if ($data['type_price'] == 'people_price') { $prices = self::get_price_person($item_id); $data['adult_price'] = $prices['adult']; $data['child_price'] = $prices['child']; $data['discount'] = $prices['discount']; $data['adult_number'] = STInput::request('adult_number', 1); $data['child_number'] = STInput::request('children_number', 0); } /* Check booking period */ $today = strtotime(date('m/d/Y')); $check_out = strtotime(STInput::get('check_out')); //$period = STDate::date_diff($today,$check_in); $expired = $today - $check_out; if ($expired >= 0) { STTemplate::set_message(__('This activity has expired', ST_TEXTDOMAIN), 'danger'); return; } else { STCart::add_cart($item_id, $number, $price, $data); $link = STCart::get_cart_link(); wp_safe_redirect($link); die; } } }
<form method="get" action="<?php the_permalink(); ?> "> <div class="row"> <?php if (!get_option('permalink_structure')) { echo '<input type="hidden" name="page_id" value="' . STInput::request('page_id') . '">'; } ?> <input type="hidden" name="layout" value="<?php echo STInput::get('layout'); ?> "> <input type="hidden" name="style" value="<?php echo STInput::get('style'); ?> "> <?php if (!empty($fields)) { foreach ($fields as $key => $value) { $name = $value['title']; $size = $value['layout_col_box']; ?> <div class="col-md-<?php echo esc_attr($size); ?> "> <?php echo st()->load_template('cars/elements/search/field-' . $value['field_atrribute'], false, array('data' => $value)); ?>
* @since 1.0 * * Rental result * * Created by ShineTheme * */ $default = array('style' => 'list'); global $wp_query; if (isset($arg)) { extract(wp_parse_args($arg, $default)); } else { extract($default); } if (STInput::get('style')) { $style = STInput::get('style'); } $object = new STRental(); $allOrderby = $object->getOrderby(); ?> <div class="nav-drop booking-sort"> </div> <div class="sort_top"> <div class="row"> <div class="col-md-10 col-sm-9"> <ul class="nav nav-pills"> <?php $active = STInput::request('orderby'); if (!empty($allOrderby) and is_array($allOrderby)) { $i = 0;
function get_result_string() { global $wp_query; $result_string = ''; if ($wp_query->found_posts) { $result_string .= sprintf(_n('%s vacation rental', '%s vacation rentals', $wp_query->found_posts, ST_TEXTDOMAIN), $wp_query->found_posts); } else { $result_string .= __('No rental found', ST_TEXTDOMAIN); } $location_id = STInput::get('location_id'); if ($location_id and $location = get_post($location_id)) { $result_string .= ' in ' . get_the_title($location_id); } $start = STInput::get('start'); $end = STInput::get('end'); $start = strtotime($start); $end = strtotime($end); if ($start and $end) { $result_string .= __(' on ', ST_TEXTDOMAIN) . date('M d', $start) . ' - ' . date('M d', $end); } if ($adult_num = STInput::get('adult_num')) { if ($adult_num > 1) { $result_string .= sprintf(__(' for %s adults', ST_TEXTDOMAIN), $adult_num); } else { $result_string .= sprintf(__(' for %s adult', ST_TEXTDOMAIN), $adult_num); } } return $result_string; }
form-group-icon-left"> <i class="fa fa-map-marker input-icon"></i> <label><?php echo esc_html($title); ?> </label> <input <?php echo esc_attr($is_required); ?> name="<?php echo esc_attr($location_name); ?> " value="<?php if ($old_location and $title = get_the_title($old_location)) { echo esc_html($title); } else { echo esc_html($value_search); } ?> " class="typeahead_location form-control <?php echo esc_attr($is_required); ?> " placeholder="<?php echo $placeholder ? $placeholder : st_get_language('city_name_or_zip_code'); ?> " type="text" /> <input type="hidden" name="location_id" value="<?php echo STInput::get('location_id'); ?> " class="location_id"> </div>