当前位置: 首页>>代码示例>>PHP>>正文


PHP TravelHelper::convertDateFormat方法代码示例

本文整理汇总了PHP中TravelHelper::convertDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP TravelHelper::convertDateFormat方法的具体用法?PHP TravelHelper::convertDateFormat怎么用?PHP TravelHelper::convertDateFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TravelHelper的用法示例。


在下文中一共展示了TravelHelper::convertDateFormat方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wp_nonce_field

wp_nonce_field('submit_form_order', 'travel_order');
?>

    <?php 
$info_price = STCars::get_info_price();
$cars_price = $info_price['price'];
$count_sale = $info_price['discount'];
if (!empty($count_sale)) {
    $price = $info_price['price'];
    $price_sale = $info_price['price_old'];
}
$pick_up_date = TravelHelper::convertDateFormat(STInput::request('pick-up-date'));
if (!$pick_up_date) {
    $pick_up_date = date('m/d/Y', strtotime("now"));
}
$drop_off_date = TravelHelper::convertDateFormat(STInput::request('drop-off-date'));
if (!$drop_off_date) {
    $drop_off_date = date('m/d/Y', strtotime("+1 day"));
}
$pick_up_time = STInput::request('pick-up-time', '12:00 PM');
$drop_off_time = STInput::request('drop-off-time', '12:00 PM');
$pick_up = STInput::request('pick-up');
$drop_off = STInput::request('drop-off');
$start = $pick_up_date . ' ' . $pick_up_time;
$start = strtotime($start);
$end = $drop_off_date . ' ' . $drop_off_time;
$end = strtotime($end);
$time = STCars::get_date_diff($start, $end);
$data_price_tmp = $cars_price * $time;
$data = array('price_cars' => $cars_price, "pick_up" => $pick_up, "drop_off" => $drop_off, 'date_time' => array("pick_up_date" => $pick_up_date, "pick_up_time" => $pick_up_time, "drop_off_date" => $drop_off_date, "drop_off_time" => $drop_off_time, "total_time" => $time));
?>
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:31,代码来源:modal_booking.php

示例2: date

?>
                        </span>
                    </p>
                    <?php 
$pick_up_date = $drop_off_date = '';
$pick_up_date_html = $drop_off_date_html = '';
if (!empty($_REQUEST['pick-up-date'])) {
    $pick_up_date_html = $_REQUEST['pick-up-date'];
    $pick_up_date = TravelHelper::convertDateFormat($_REQUEST['pick-up-date']);
} else {
    $pick_up_date_html = date(TravelHelper::getDateFormat(), strtotime("now"));
    $pick_up_date = date(TravelHelper::getDateFormat(), strtotime("now"));
}
if (!empty($_REQUEST['drop-off-date'])) {
    $drop_off_date_html = $_REQUEST['drop-off-date'];
    $drop_off_date = TravelHelper::convertDateFormat($_REQUEST['drop-off-date']);
} else {
    $drop_off_date_html = date(TravelHelper::getDateFormat(), strtotime("+1 day"));
    $drop_off_date = date(TravelHelper::getDateFormat(), strtotime("+1 day"));
}
if (!empty($pick_up_date_html)) {
    ?>
                      <small><?php 
    echo esc_attr($time);
    ?>
 <?php 
    if ($time > 1) {
        echo STCars::get_price_unit('plural');
    } else {
        echo STCars::get_price_unit();
    }
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:31,代码来源:price.php

示例3: get_avg_price_hotel

 static function get_avg_price_hotel($hotel_id)
 {
     global $wpdb;
     $rooms = self::_getAllRoomHotelID($hotel_id);
     $avg_price = 0;
     $check_in = STInput::request('start', '');
     $check_out = STInput::request('end', '');
     if (empty($check_in)) {
         $check_in = date('m/d/Y');
     } else {
         $check_in = TravelHelper::convertDateFormat($check_in);
     }
     if (empty($check_out)) {
         $check_out = date('m/d/Y', strtotime("+1 day"));
     } else {
         $check_out = TravelHelper::convertDateFormat($check_out);
     }
     $room_num_search = STInput::request('room_num_search', 1);
     if (intval($room_num_search) <= 0) {
         $room_num_search = 1;
     }
     $room_full_ordered = HotelHelper::_get_room_cant_book_by_id($hotel_id, date('Y-m-d', strtotime($check_in)), date('Y-m-d', strtotime($check_out)), $room_num_search);
     if (is_array($rooms) && count($rooms)) {
         $i = 0;
         foreach ($rooms as $room) {
             if (!in_array($room, $room_full_ordered)) {
                 $price = STPrice::getRoomPriceOnlyCustomPrice($room, strtotime($check_in), strtotime($check_out), $room_num_search);
                 if ($price > 0) {
                     $avg_price += $price;
                 }
             }
             $i++;
         }
         $avg_price /= $i;
     }
     return $avg_price;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:37,代码来源:hotel.helper.php

示例4: get_the_ID

<?php

$room_id = get_the_ID();
$item_id = get_post_meta(get_the_ID(), 'room_parent', true);
$start = STInput::request('start') ? STInput::request('start') : date(TravelHelper::getDateFormat(), strtotime("now"));
$end = STInput::request('end') ? STInput::request('end') : date(TravelHelper::getDateFormat(), strtotime("+1 day"));
$check_in = TravelHelper::convertDateFormat($start);
$check_out = TravelHelper::convertDateFormat($end);
$room_num_search = STInput::request('room_num_search');
if (!$room_num_search) {
    $room_num_search = 1;
}
$data_price = STRoom::get_room_price(get_the_ID(), $check_in, $check_out);
$html_price = $data_price['price'] * STInput::request('room_num_search');
?>
<div class="booking-item-dates-change">
    <?php 
echo STTemplate::message();
?>
	<form class="single-room-form" method="get">
		<?php 
wp_nonce_field('room_search', 'room_search');
?>
		<div class="input-daterange" data-date-format="<?php 
echo TravelHelper::getDateFormatJs();
?>
">
            <div class="form-group form-group-icon-left"><i class="fa fa-calendar input-icon input-icon-hightlight"></i>
                <label><?php 
st_the_language('check_in');
?>
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:31,代码来源:st_hotel_room_form.php

示例5: get_result_string

 function get_result_string()
 {
     global $wp_query, $st_search_query;
     if ($st_search_query) {
         $query = $st_search_query;
     } else {
         $query = $wp_query;
     }
     $result_string = '';
     if ($query->found_posts) {
         if ($query->found_posts > 1) {
             $result_string .= esc_html($query->found_posts) . __(' holidays ', ST_TEXTDOMAIN);
         } else {
             $result_string .= esc_html($query->found_posts) . __(' holiday ', ST_TEXTDOMAIN);
         }
     } else {
         $result_string = __('No holiday found', ST_TEXTDOMAIN);
     }
     $location_id = STInput::get('location_id');
     if (!$location_id) {
         $location_id = STInput::get('location_id_pick_up');
     }
     if ($location_id and $location = get_post($location_id)) {
         $result_string .= sprintf(__(' in %s', ST_TEXTDOMAIN), get_the_title($location_id));
     } elseif (STInput::request('location_name')) {
         $result_string .= sprintf(__(' in %s', ST_TEXTDOMAIN), STInput::request('location_name'));
     } elseif (STInput::request('address')) {
         $result_string .= sprintf(__(' in %s', ST_TEXTDOMAIN), STInput::request('address'));
     }
     $start = TravelHelper::convertDateFormat(STInput::get('start'));
     $end = TravelHelper::convertDateFormat(STInput::get('end'));
     $start = strtotime($start);
     $end = strtotime($end);
     if ($start and $end) {
         $result_string .= __(' on ', ST_TEXTDOMAIN) . date_i18n('M d', $start) . ' - ' . date_i18n('M d', $end);
     }
     if ($adult_number = STInput::get('adult_number')) {
         if ($adult_number > 1) {
             $result_string .= sprintf(__(' for %s adults', ST_TEXTDOMAIN), $adult_number);
         } else {
             $result_string .= sprintf(__(' for %s adult', ST_TEXTDOMAIN), $adult_number);
         }
     }
     return esc_html($result_string);
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:45,代码来源:class.holiday.php

示例6: do_add_to_cart

 function do_add_to_cart()
 {
     $pass_validate = true;
     $item_id = intval(STInput::request('item_id', ''));
     if ($item_id <= 0 || get_post_type($item_id) != 'st_activity') {
         STTemplate::set_message(__('This activity is not available..', ST_TEXTDOMAIN), 'danger');
         $pass_validate = false;
         return false;
     }
     $number = 1;
     $type_activity = STInput::request('type_activity', 'specific_date');
     $adult_number = intval(STInput::request('adult_number', 1));
     $child_number = intval(STInput::request('child_number', 0));
     $infant_number = intval(STInput::request('infant_number', 0));
     $max_number = intval(get_post_meta($item_id, 'max_people', true));
     $today = date('Y-m-d');
     if ($adult_number + $child_number + $infant_number > $max_number) {
         STTemplate::set_message(sprintf(__('Max of people for this activity is %d people', ST_TEXTDOMAIN), $max_number), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     if ($type_activity == 'specific_date') {
         $check_in = TravelHelper::convertDateFormat(STInput::request('check_in', ''));
         $check_out = TravelHelper::convertDateFormat(STInput::request('check_out', ''));
         if (empty($check_in)) {
             STTemplate::set_message(__('The check in field is not empty.', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         if (empty($check_out)) {
             STTemplate::set_message(__('The check out field is not empty.', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         $compare = TravelHelper::dateCompare($today, $check_in);
         if ($compare < 0) {
             STTemplate::set_message(__('This activity has expired', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         $people = $adult_number + $child_number + $child_number;
         $result = ActivityHelper::_get_free_peple_special($item_id, $check_in, $check_out);
         $free_people = intval(get_post_meta($item_id, 'max_people', true));
         if (is_array($result) && count($result)) {
             $free_people = intval($result['free_people']);
         }
         if ($free_people < $people) {
             STTemplate::set_message(sprintf(__('This activity only vacant %d people', ST_TEXTDOMAIN), $free_people), 'danger');
             $pass_validate = false;
             return false;
         }
         $data['check_in'] = date('m/d/Y', strtotime($check_in));
         $data['check_out'] = date('m/d/Y', strtotime($check_out));
     } elseif ($type_activity == 'daily_activity') {
         $check_in = STInput::request('check_in', '');
         if (empty($check_in)) {
             STTemplate::set_message(__('The check in field is not empty.', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         $check_in = TravelHelper::convertDateFormat($check_in);
         $check_in = date('Y-m-d', strtotime($check_in));
         $duration = intval(get_post_meta($item_id, 'duration', true));
         $check_out = $duration >= 2 ? strtotime('+ ' . $duration . ' days', strtotime($check_in)) : strtotime('+ ' . $duration . ' day', strtotime($check_in));
         $check_out = date('Y-m-d', $check_out);
         $booking_period = intval(get_post_meta($item_id, 'activity_booking_period', true));
         $period = TravelHelper::dateDiff($today, $check_in);
         $compare = TravelHelper::dateCompare($today, $check_in);
         if ($compare < 0) {
             STTemplate::set_message(__('You can not set check-in date in the past', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         if ($booking_period && $booking_period > $period) {
             STTemplate::set_message(sprintf(__('This activity allow minimum booking is %d day(s)', ST_TEXTDOMAIN), $booking_period), 'danger');
             $pass_validate = false;
             return false;
         }
         $people = $adult_number + $child_number + $child_number;
         $result = ActivityHelper::_get_free_peple_daily($item_id, $check_in);
         $free_people = intval(get_post_meta($item_id, 'max_people', true));
         if (is_array($result) && count($result)) {
             $free_people = intval($result['free_people']);
         }
         if ($free_people < $people) {
             STTemplate::set_message(sprintf(__('This activity only vacant %d people', ST_TEXTDOMAIN), $free_people), 'danger');
             $pass_validate = false;
             return false;
         }
         $data['duration'] = $duration;
     }
     $data['adult_number'] = $adult_number;
     $data['child_number'] = $child_number;
     $data['infant_number'] = $infant_number;
     $data['check_in'] = date('m/d/Y', strtotime($check_in));
     $data['check_out'] = date('m/d/Y', strtotime($check_out));
     $data['type_activity'] = $type_activity;
     $data_price = STPrice::getPriceByPeople($item_id, strtotime($check_in), strtotime($check_out), $adult_number, $child_number, $infant_number);
     $total_price = $data_price['total_price'];
     $sale_price = STPrice::getSaleTourSalePrice($item_id, $total_price, $type_activity, strtotime($check_in));
//.........这里部分代码省略.........
开发者ID:DaddyFool,项目名称:travelTest,代码行数:101,代码来源:class.activity.php

示例7: add_to_cart

 /**
  * @since 1.1.0
  **/
 function add_to_cart()
 {
     if (STInput::request('action') == 'rental_add_cart') {
         if (!STInput::request('start') or !STInput::request('end')) {
             STTemplate::set_message(st_get_language('check_in_and_check_out_are_required'), 'danger');
             return;
         }
         $today = strtotime(date('m/d/Y'));
         $check_in = TravelHelper::convertDateFormat(STInput::request('start'));
         $rental_id = STInput::request('item_id');
         $booking_period = get_post_meta($rental_id, 'rentals_booking_period', true);
         $period = STDate::date_diff($today, $check_in);
         if ($booking_period && $period < $booking_period) {
             STTemplate::set_message(sprintf(__('Booking is only accepted %d day(s) before today.', ST_TEXTDOMAIN), $booking_period), 'danger');
             return;
         }
         $adult = intval(STInput::request('adult'));
         $children = intval(STInput::request('children'));
         if (get_post_meta($rental_id, 'rental_max_adult', true)) {
             $max_adult = intval(get_post_meta($rental_id, 'rental_max_adult', true));
             if ($adult > $max_adult) {
                 STTemplate::set_message(sprintf(__('A maximum number of adult(s): %d', ST_TEXTDOMAIN), $max_adult), 'danger');
                 return;
             }
         }
         if (get_post_meta($rental_id, 'rental_max_children', true)) {
             $max_children = intval(get_post_meta($rental_id, 'rental_max_children', true));
             if ($children > $max_children) {
                 STTemplate::set_message(sprintf(__('A maximum number of children: %d', ST_TEXTDOMAIN), $max_children), 'danger');
                 return;
             }
         }
         $validate = $this->do_add_to_cart(array('item_id' => STInput::request('item_id'), 'number_room' => STInput::request('number_room'), 'price' => STInput::request('price'), 'start' => TravelHelper::convertDateFormat(STInput::request('start')), 'end' => TravelHelper::convertDateFormat(STInput::request('end')), 'adult' => STInput::request('adult'), 'children' => STInput::request('children')));
         if ($validate) {
             $link = STCart::get_cart_link();
             wp_safe_redirect($link);
             die;
         }
     }
 }
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:43,代码来源:class.rental.php

示例8: date

<?php

$check_in = TravelHelper::convertDateFormat(STInput::request('start'));
if (!$check_in) {
    $check_in = date('m/d/Y', strtotime("now"));
}
$check_out = TravelHelper::convertDateFormat(STInput::request('end'));
if (!$check_out) {
    $check_out = date('m/d/Y', strtotime("+1 day"));
}
$room_num_search = STInput::request('room_num_search');
if (!$room_num_search) {
    $room_num_search = 1;
}
$data_price = STRoom::get_room_price(get_the_ID(), $check_in, $check_out);
$html_price = $data_price['price'] * $room_num_search;
$default = array('align' => 'right');
if (isset($attr)) {
    extract(wp_parse_args($attr, $default));
} else {
    extract($default);
}
?>
<div class="booking-item-details no-border-top">
	<p class="booking-item-header-price text-<?php 
echo esc_html($align);
?>
">
	    <small><?php 
_e("price", ST_TEXTDOMAIN);
?>
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:31,代码来源:st_hotel_room_price.php

示例9: _alter_search_query_ajax

 public function _alter_search_query_ajax($where)
 {
     global $wpdb;
     $hotel_id = get_the_ID();
     $check_in = date('Y-m-d', strtotime(TravelHelper::convertDateFormat(STInput::request('start'))));
     $check_out = date('Y-m-d', strtotime(TravelHelper::convertDateFormat(STInput::request('end'))));
     $adult_num = STInput::request('adult_number', 0);
     $child_num = STInput::request('child_number', 0);
     $number_room = STInput::request('room_num_search', 0);
     $list = HotelHelper::_hotelValidateByID($hotel_id, strtotime($check_in), strtotime($check_out), $adult_num, $child_num, $number_room);
     if (!is_array($list) || count($list) <= 0) {
         $list = "''";
     } else {
         $list = implode(',', $list);
     }
     $where .= " AND {$wpdb->prefix}posts.ID NOT IN ({$list})";
     return $where;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:18,代码来源:class.hotel.php

示例10: do_add_to_cart

 function do_add_to_cart()
 {
     $pass_validate = true;
     $item_id = STInput::request('item_id');
     $number = STInput::request('number');
     $discount = STInput::request('discount');
     $price = STInput::request('price');
     if (!empty($discount)) {
         $price_sale = $price - $price * ($discount / 100);
         $data = array('discount' => $discount, 'price_sale' => $price_sale);
     }
     $data['check_in'] = STInput::request('check_in');
     $data['check_out'] = STInput::request('check_out');
     $data['type_tour'] = STInput::request('type_tour');
     $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);
     }
     $data['duration'] = STInput::request('duration');
     $type_tour = STInput::request('type_tour');
     $today = strtotime(date('m/d/Y', time()));
     if ($type_tour == 'daily_tour') {
         $check_in = strtotime(TravelHelper::convertDateFormat(STInput::request('check_in')));
     } else {
         $check_in = strtotime(get_post_meta($item_id, 'check_in', true));
     }
     $booking_period = intval(get_post_meta($item_id, 'tours_booking_period', true));
     $period = STDate::date_diff($today, $check_in);
     $expired = $check_in - $today;
     if ($type_tour == 'daily_tour') {
         if ($booking_period && $period < $booking_period) {
             STTemplate::set_message(sprintf(__('Booking is only accepted %d day(s) before today.', ST_TEXTDOMAIN), $booking_period), 'danger');
             return;
         }
     } else {
         if ($expired < 0) {
             STTemplate::set_message(__('This tour has expired', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return;
         }
     }
     if ($pass_validate) {
         $pass_validate = apply_filters('st_tour_add_cart_validate', $pass_validate, $data);
     }
     if ($pass_validate) {
         STCart::add_cart($item_id, $number, $price, $data);
     }
     return $pass_validate;
 }
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:54,代码来源:class.tour.php

示例11: do_add_to_cart

 /**
  * @since 1.0.9
  * @update 1.1.3
  **/
 function do_add_to_cart()
 {
     $pass_validate = true;
     $data_price_cars = json_decode(str_ireplace("\\", '', STInput::request('data_price_cars')));
     $data_price_items = json_decode(str_ireplace("\\", '', STInput::request('data_price_items')));
     $selected_equipments = json_decode(str_ireplace("\\", '', STInput::request('selected_equipments')));
     $discount = STInput::request('discount');
     $price_unit = STInput::request('price');
     $price_old = STInput::request('price_old');
     $item_id = STInput::request('item_id');
     $number = 1;
     $price_total = STInput::request('data_price_total');
     $check_in = $data_price_cars->date_time->pick_up_date . ' ' . $data_price_cars->date_time->pick_up_time;
     $check_in = date('Y-m-d H:i:s', strtotime($check_in));
     $check_out = $data_price_cars->date_time->drop_off_date . ' ' . $data_price_cars->date_time->drop_off_time;
     $check_out = date('Y-m-d H:i:s', strtotime($check_out));
     $data = array('data_price_cars' => $data_price_cars, 'data_price_items' => $data_price_items, 'discount' => $discount, 'price_old' => $price_old, 'check_in' => STInput::request('check_in'), 'check_in_timestamp' => STInput::request('check_in_timestamp'), 'check_out' => STInput::request('check_out'), 'check_out_timestamp' => STInput::request('check_out_timestamp'), 'price_total' => $price_total, 'price_unit' => self::get_price_unit(), 'selected_equipments' => $selected_equipments);
     // Validate required field
     $change_location_date_box = $this->get_search_fields_box();
     $field_types = $this->get_search_fields_name();
     if (!empty($change_location_date_box)) {
         $message = '';
         foreach ($change_location_date_box as $key => $value) {
             if (isset($field_types[$value['field_atrribute']]) and $value['is_required'] == 'on') {
                 $field_name = isset($field_types[$value['field_atrribute']]['field_name']) ? $field_types[$value['field_atrribute']]['field_name'] : false;
                 if ($field_name) {
                     if (is_array($field_name)) {
                         foreach ($field_name as $v) {
                             if (!STInput::request($v)) {
                                 $message .= sprintf(__('%s is required', ST_TEXTDOMAIN), $value['title']) . '<br>';
                                 $pass_validate = false;
                             }
                         }
                     } elseif (is_string($field_name)) {
                         if (!STInput::request($field_name)) {
                             $message .= sprintf(__('%s is required', ST_TEXTDOMAIN), $value['title']) . '<br>';
                             $pass_validate = false;
                         }
                     }
                 }
             }
         }
         if ($message) {
             $message = substr($message, 0, -4);
             STTemplate::set_message($message, 'danger');
         }
     }
     $is_required_country = st()->get_option('is_required_country', 'off');
     if ($is_required_country == 'on') {
         if (STInput::request('county_pick_up') != STInput::request('county_drop_off') or !STInput::request('county_drop_off') or !STInput::request('county_pick_up')) {
             STTemplate::set_message(__('Pick-up and Drop-off are not in the same country. Please re-check it.', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
         }
     }
     $today = strtotime(date('m/d/Y', time()));
     $check_in_unix = strtotime(TravelHelper::convertDateFormat($data_price_cars->date_time->pick_up_date));
     $booking_period = intval(get_post_meta($item_id, 'cars_booking_period', true));
     $period = STDate::date_diff($today, $check_in_unix);
     $var = $check_in_unix - $today;
     if ($var < 0) {
         STTemplate::set_message(__('You can not set check-in date in the past'), 'danger');
         $pass_validate = false;
     } else {
         if ($booking_period && $period < $booking_period) {
             STTemplate::set_message(sprintf(__('Booking is only accepted %d day(s) before today.', ST_TEXTDOMAIN), $booking_period), 'danger');
             $pass_validate = false;
         }
     }
     if (!$this->_is_slot_available($item_id, $check_in, $check_out)) {
         STTemplate::set_message(__('Sorry! This Car is not available.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = false;
     }
     //if($pickup)
     // Allow to be filtered
     $pass_validate = apply_filters('st_car_add_cart_validate', $pass_validate, $item_id, $number, $price_unit, $data);
     if ($pass_validate) {
         STCart::add_cart($item_id, $number, $price_unit, $data);
     }
     return $pass_validate;
 }
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:84,代码来源:class.cars.php

示例12: DateTime

<?php

/**
 * Created by PhpStorm.
 * User: MSI
 * Date: 03/06/2015
 * Time: 4:17 CH
 */
?>

<p class="booking-item-description">
    <?php 
if ($st_booking_data['type_tour'] == 'daily_tour') {
    if ($st_booking_data['duration'] and $st_booking_data['duration'] != 'none') {
        $checkout = new DateTime(TravelHelper::convertDateFormat($st_booking_data['check_in']));
        $checkout->modify('+ ' . $st_booking_data['duration'] . ' day');
        ?>
            <?php 
        echo __('Date:', ST_TEXTDOMAIN);
        ?>
 <?php 
        echo date_i18n(get_option('date_format'), strtotime($st_booking_data['check_in']));
        ?>
            <i class="fa fa-long-arrow-right"></i> <?php 
        echo date_i18n(get_option('date_format'), $checkout->getTimestamp());
        ?>
        <?php 
    } else {
        ?>
            <?php 
        echo __('Date:', ST_TEXTDOMAIN);
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:31,代码来源:wc_cart_item_information.php

示例13: _alter_search_query

 function _alter_search_query($where)
 {
     global $wp_query;
     if (is_search()) {
         $post_type = $wp_query->query_vars['post_type'];
         if ($post_type == 'st_cars') {
             //Alter From NOW
             global $wpdb;
             $check_in = STInput::get('pick-up-date');
             $check_out = STInput::get('drop-off-date');
             //Alter WHERE for check in and check out
             if ($check_in and $check_out) {
                 $check_in = @date('Y-m-d H:i:s', strtotime(TravelHelper::convertDateFormat($check_in)));
                 $check_out = @date('Y-m-d H:i:s', strtotime(TravelHelper::convertDateFormat($check_out)));
                 $check_in = esc_sql($check_in);
                 $check_out = esc_sql($check_out);
                 $where .= " AND {$wpdb->posts}.ID NOT IN\r\n                            (\r\n                                SELECT booked_id FROM (\r\n                                    SELECT count(st_meta6.meta_value) as total_booked, st_meta5.meta_value as total,st_meta6.meta_value as booked_id ,st_meta2.meta_value as check_in,st_meta3.meta_value as check_out\r\n                                         FROM {$wpdb->posts}\r\n                                                JOIN {$wpdb->postmeta}  as st_meta2 on st_meta2.post_id={$wpdb->posts}.ID and st_meta2.meta_key='check_in'\r\n                                                JOIN {$wpdb->postmeta}  as st_meta3 on st_meta3.post_id={$wpdb->posts}.ID and st_meta3.meta_key='check_out'\r\n                                                JOIN {$wpdb->postmeta}  as st_meta6 on st_meta6.post_id={$wpdb->posts}.ID and st_meta6.meta_key='item_id'\r\n                                                JOIN {$wpdb->postmeta}  as st_meta5 on st_meta5.post_id=st_meta6.meta_value and st_meta5.meta_key='number_car'\r\n                                                WHERE {$wpdb->posts}.post_type='st_order'\r\n                                        GROUP BY st_meta6.meta_value HAVING total<=total_booked AND (\r\n\r\n                                                    ( CAST(st_meta2.meta_value AS DATE)<'{$check_in}' AND  CAST(st_meta3.meta_value AS DATE)>'{$check_in}' )\r\n                                                    OR ( CAST(st_meta2.meta_value AS DATE)>='{$check_in}' AND  CAST(st_meta2.meta_value AS DATE)<='{$check_out}' )\r\n\r\n                                        )\r\n                                ) as item_booked\r\n                            )\r\n\r\n                    ";
             }
         }
     }
     return $where;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:22,代码来源:class.cars.php

示例14: ajax_search_room

 function ajax_search_room()
 {
     if (st_is_ajax() and STInput::post('room_search')) {
         if (!wp_verify_nonce(STInput::post('room_search'), 'room_search')) {
             $result = array('status' => 0, 'data' => "");
             echo json_encode($result);
             die;
         }
         $result = array('status' => 1, 'data' => "");
         $hotel_id = get_the_ID();
         $post = STInput::request();
         $post['room_parent'] = $hotel_id;
         //Check Date
         $today = date('m/d/Y');
         $check_in = strtotime(TravelHelper::convertDateFormat($post['start']));
         $check_out = strtotime(TravelHelper::convertDateFormat($post['end']));
         $date_diff = STDate::date_diff($check_in, $check_out);
         $booking_period = $this->is_booking_period($hotel_id, $today, $post['start']);
         if ($booking_period) {
             $result = array('status' => 0, 'data' => st()->load_template('hotel/elements/loop-room-none'), 'message' => sprintf(__('Booking is only accepted %d day(s) before today.', ST_TEXTDOMAIN), $booking_period));
             echo json_encode($result);
             die;
         }
         if ($date_diff < 1) {
             $result = array('status' => 0, 'data' => "", 'message' => __('Make sure your check-out date is at least 1 day after check-in.', ST_TEXTDOMAIN), 'more-data' => $date_diff);
             echo json_encode($result);
             die;
         }
         query_posts($this->search_room($post));
         $post['check_in'] = date('d-m-Y', strtotime($post['start']));
         $post['check_out'] = date('d-m-Y', strtotime($post['end']));
         global $wp_query;
         if (have_posts()) {
             while (have_posts()) {
                 the_post();
                 $result['data'] .= st()->load_template('hotel/elements/loop-room-item');
             }
         } else {
             $result['data'] .= st()->load_template('hotel/elements/loop-room-none');
         }
         wp_reset_query();
         echo json_encode($result);
         die;
     }
 }
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:45,代码来源:class.hotel.php


注:本文中的TravelHelper::convertDateFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。