本文整理汇总了PHP中TravelHelper::getDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP TravelHelper::getDateFormat方法的具体用法?PHP TravelHelper::getDateFormat怎么用?PHP TravelHelper::getDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TravelHelper
的用法示例。
在下文中一共展示了TravelHelper::getDateFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getListDate
static function getListDate($start, $end)
{
$start = new DateTime($start);
$end = new DateTime($end . ' +1 day');
$list = array();
foreach (new DatePeriod($start, new DateInterval('P1D'), $end) as $day) {
$list[] = $day->format(TravelHelper::getDateFormat());
}
return $list;
}
示例2: _get_disable_date
static function _get_disable_date()
{
$disable = array();
$activity_id = STInput::request('activity_id', '');
$activity_id = apply_filters('st_get_post_id_origin', $activity_id);
if (empty($activity_id)) {
echo json_encode($disable);
die;
}
$year = STInput::request('year', date('Y'));
global $wpdb;
$sql = "SELECT\r\n\t\t\t\torigin_id as activity_id,\r\n\t\t\t\tcheck_in_timestamp as check_in,\r\n\t\t\t\tcheck_out_timestamp as check_out,\r\n\t\t\t\tadult_number,\r\n\t\t\t\tchild_number,\r\n\t\t\t\tinfant_number\r\n\t\t\t\tFROM\r\n\t\t\t\t\t{$wpdb->prefix}st_order_item_meta\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tst_booking_post_type = 'st_activity'\r\n\t\t\t\tAND origin_id = '{$activity_id}'\r\n\t\t\t\tAND status NOT IN ('trash', 'canceled')\r\n\t\t\t\tAND YEAR (\r\n\t\t\t\t\tFROM_UNIXTIME(check_in_timestamp)\r\n\t\t\t\t) = {$year}\r\n\t\t\t\tAND YEAR (\r\n\t\t\t\t\tFROM_UNIXTIME(check_out_timestamp)\r\n\t\t\t\t) = {$year}";
$result = $wpdb->get_results($sql, ARRAY_A);
if (is_array($result) && count($result)) {
$list_date = array();
foreach ($result as $key => $val) {
$list_date[] = array('check_in' => $val['check_in'], 'check_out' => $val['check_out'], 'adult_number' => $val['adult_number'], 'child_number' => $val['child_number'], 'infant_number' => $val['infant_number']);
}
}
if (isset($list_date) && count($list_date)) {
$min_max = self::_get_minmax($activity_id, $year);
if (is_array($min_max) && count($min_max)) {
$max_people = intval(get_post_meta($activity_id, 'max_people', true));
for ($i = intval($min_max['check_in']); $i <= intval($min_max['check_out']); $i = strtotime('+1 day', $i)) {
$people = 0;
foreach ($result as $key => $date) {
if ($i == intval($date['check_in'])) {
$people += intval($date['adult_number']) + intval($date['child_number']) + intval($date['infant_number']);
}
}
if ($people >= $max_people) {
$disable[] = date(TravelHelper::getDateFormat(), $i);
}
}
}
}
if (count($disable)) {
echo json_encode($disable);
die;
}
echo json_encode($disable);
die;
}
示例3: get_post_meta
echo TravelHelper::getDateFormatJs();
?>
" type="text"
value="<?php
echo $start;
?>
" name="check_in">
</div>
</div>
</div>
<?php
} else {
$check_in = get_post_meta(get_the_ID(), 'check_in', true);
$check_in = $check_in ? date(TravelHelper::getDateFormat(), strtotime($check_in)) : '';
$check_out = get_post_meta(get_the_ID(), 'check_out', true);
$check_out = $check_out ? date(TravelHelper::getDateFormat(), strtotime($check_out)) : '';
?>
<input name="check_in" type="hidden" class="activity_check_in"
value="<?php
echo $check_in;
?>
">
<input name="check_out" type="hidden" class="activity_check_out"
value="<?php
echo $check_out;
?>
">
<?php
}
?>
示例4: _e
if (isset($item_data['_st_check_in_timestamp'])) {
?>
<li>
<span class="meta-label"><?php
_e('Date:', ST_TEXTDOMAIN);
?>
</span>
<span class="meta-data"><?php
echo date_i18n(TravelHelper::getDateFormat() . ' ' . get_option('time_format'), st_wc_parse_order_item_meta($item_data['_st_check_in_timestamp']));
?>
<?php
if (isset($item_data['_st_check_out_timestamp'])) {
?>
<i class="fa fa-long-arrow-right"></i>
<?php
echo date_i18n(TravelHelper::getDateFormat() . ' ' . get_option('time_format'), st_wc_parse_order_item_meta($item_data['_st_check_out_timestamp']));
?>
<?php
}
?>
</span>
</li>
<?php
}
?>
<?php
if (isset($item_data['_st_data_equipment'])) {
$selected_equipment = st_wc_parse_order_item_meta($item_data['_st_data_equipment']);
if ($selected_equipment and $selected_equipment = unserialize($selected_equipment)) {
if (is_array($selected_equipment) and !empty($selected_equipment)) {
?>
示例5: 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');
?>
示例6: st_the_language
<div class="package-info">
<i class="fa fa-calendar"></i>
<span class=""><?php
st_the_language('user_availability');
?>
: </span>
<?php
$check_in = get_post_meta(get_the_ID(), 'check_in', true);
if (!empty($check_in)) {
$check_in = strtotime($check_in);
echo date_i18n(TravelHelper::getDateFormat(), $check_in);
}
$check_out = get_post_meta(get_the_ID(), 'check_out', true);
if (!empty($check_out)) {
$check_out = strtotime($check_out);
echo ' <i class="fa fa-arrow-right"></i> ' . date_i18n(TravelHelper::getDateFormat(), $check_out);
}
?>
</div>
<?php
}
?>
<?php
$activity_time = get_post_meta(get_the_ID(), 'activity-time', true);
if (!empty($activity_time)) {
?>
<div class="info">
<span class="head"><i class="fa fa-clock-o"></i> <?php
st_the_language('user_activity_time');
?>
: </span>
示例7: get_post_meta
<div class="package-info">
<i class="fa fa-calendar"> </i>
<span class=""><?php
STLanguage::st_the_language('holiday_date');
?>
: </span>
<?php
$type_holiday = get_post_meta(get_the_ID(), 'type_holiday', true);
if ($type_holiday == 'daily_holiday') {
$day = STHoliday::get_duration_unit();
echo esc_html($day);
} else {
$check_in = get_post_meta(get_the_ID(), 'check_in', true);
$check_out = get_post_meta(get_the_ID(), 'check_out', true);
if (!empty($check_in) and !empty($check_out)) {
$date = date_i18n(TravelHelper::getDateFormat(), strtotime($check_in)) . ' <i class="fa fa-long-arrow-right"></i> ' . date_i18n(TravelHelper::getDateFormat(), strtotime($check_out));
echo balanceTags($date);
} else {
st_the_language('holiday_none');
}
}
?>
</div>
</div>
</div>
<div class="row mt10">
<div class="col-md-6 col-sm-6 col-xs-6">
<p class="mb0 text-darken">
<i class="fa fa-money"> </i>
<?php
_e('Price', ST_TEXTDOMAIN);
示例8: __
}
echo __("Duration", ST_TEXTDOMAIN) . ": " . $duration;
}
?>
</td>
<td class="post-title page-title column-title">
<?php
$price = get_post_meta($post_id, 'total_price', true);
$currency = get_post_meta($post_id, 'currency', true);
$rate = floatval(get_post_meta($post_id, 'currency_rate', true));
echo TravelHelper::format_money_from_db($price, $currency, $rate);
?>
</td>
<td class="post-title page-title column-title">
<?php
echo date(TravelHelper::getDateFormat(), strtotime($value->post_date));
?>
</td>
<td class="post-title page-title column-title">
<?php
echo get_post_meta($order_id, 'status', true);
?>
</td>
<td class="post-title page-title column-title">
<?php
echo STPaymentGateways::get_gatewayname(get_post_meta($order_id, 'payment_method', true));
?>
</td>
</tr>
<?php
}
示例9: _get_availability_hotel_room
public function _get_availability_hotel_room()
{
$list_date = array();
$room_id = STInput::request('post_id', '');
$check_in = STInput::request('start', '');
$check_out = STInput::request('end', '');
$hotel_id = intval(get_post_meta($room_id, 'room_parent', true));
$allow_full_day = get_post_meta($hotel_id, 'allow_full_day', true);
if (!$allow_full_day || $allow_full_day == '') {
$allow_full_day = 'on';
}
$year = date('Y', $check_in);
if (empty($year)) {
$year = date('Y');
}
$year2 = date('Y', $check_out);
if (empty($year2)) {
$year2 = date('Y');
}
$month = date('m', $check_in);
if (empty($month)) {
$month = date('m');
}
$month2 = date('m', $check_out);
if (empty($month2)) {
$month2 = date('m');
}
$result = HotelHelper::_get_full_ordered($room_id, $month, $month2, $year, $year2);
$number_room = get_post_meta($room_id, 'number_room', true);
$min_max = HotelHelper::_get_min_max_date_ordered($room_id, $year, $year2);
if (is_array($min_max) && count($min_max) && is_array($result) && count($result)) {
$disable = array();
for ($i = intval($min_max['min_date']); $i <= intval($min_max['max_date']); $i = strtotime('+1 day', $i)) {
$num_room = 0;
foreach ($result as $key => $date) {
if ($allow_full_day == 'on') {
if ($i >= intval($date['check_in_timestamp']) && $i <= intval($date['check_out_timestamp'])) {
$num_room += $date['number_room'];
}
} else {
if ($i > intval($date['check_in_timestamp']) && $i < intval($date['check_out_timestamp'])) {
$num_room += $date['number_room'];
}
}
}
$disable[$i] = $num_room;
}
if (count($disable)) {
foreach ($disable as $key => $num_room) {
if (intval($num_room) >= $number_room) {
$list_date[] = date(TravelHelper::getDateFormat(), $key);
}
}
}
}
$list_date_2 = AvailabilityHelper::_getDisableCustomDate($room_id, $month, $month2, $year, $year2);
$date1 = strtotime($year . '-' . $month . '-01');
$date2 = strtotime($year2 . '-' . $month2 . '-01');
$date2 = strtotime(date('Y-m-t', $date2));
$today = strtotime(date('Y-m-d'));
$return = array();
$booking_period = intval(get_post_meta($hotel_id, 'hotel_booking_period', true));
for ($i = $date1; $i <= $date2; $i = strtotime('+1 day', $i)) {
$period = TravelHelper::dateDiff(date('Y-m-d', $today), date('Y-m-d', $i));
$d = date(TravelHelper::getDateFormat(), $i);
if (in_array($d, $list_date)) {
$return[] = array('start' => date('Y-m-d', $i), 'date' => date('Y-m-d', $i), 'day' => date('d', $i), 'status' => 'booked');
} else {
if ($i < $today) {
$return[] = array('start' => date('Y-m-d', $i), 'date' => date('Y-m-d', $i), 'day' => date('d', $i), 'status' => 'past');
} else {
if (in_array($d, $list_date_2)) {
$return[] = array('start' => date('Y-m-d', $i), 'date' => date('Y-m-d', $i), 'day' => date('d', $i), 'status' => 'disabled');
} else {
if ($period < $booking_period) {
$return[] = array('start' => date('Y-m-d', $i), 'date' => date('Y-m-d', $i), 'day' => date('d', $i), 'status' => 'disabled');
} else {
$return[] = array('start' => date('Y-m-d', $i), 'date' => date('Y-m-d', $i), 'day' => date('d', $i), 'status' => 'avalable', 'price' => TravelHelper::format_money(STPrice::getRoomPriceOnlyCustomPrice($room_id, $i, strtotime('+1 day', $i), 1)));
}
}
}
}
}
echo json_encode($return);
die;
}
示例10: get_post_meta
echo get_post_meta($order_id, 'room_num_search', true);
?>
</p>
<p><strong><?php
echo __('Check In :', ST_TEXTDOMAIN);
?>
</strong> <?php
echo date(TravelHelper::getDateFormat(), strtotime(get_post_meta($order_id, 'check_in', true)));
?>
</p>
<p><strong><?php
echo __('Check Out :', ST_TEXTDOMAIN);
?>
</strong> <?php
echo date(TravelHelper::getDateFormat(), strtotime(get_post_meta($order_id, 'check_out', true)));
?>
</p>
<?php
if (isset($extras['value']) && is_array($extras['value']) && count($extras['value'])) {
?>
<p>
<strong><?php
echo __('Extra', ST_TEXTDOMAIN);
?>
</strong>
</p>
<p>
<?php
foreach ($extras['value'] as $name => $value) {
$price_item = floatval($extras['price'][$name]);
示例11: _getDisableCustomDateRental
static function _getDisableCustomDateRental($rental_id, $month, $month2, $year, $year2)
{
$date1 = $year . '-' . $month . '-01';
$date2 = strtotime($year2 . '-' . $month2 . '-01');
$date2 = date('Y-m-t', $date2);
global $wpdb;
$sql = "\r\n\t\t\tSELECT\r\n\t\t\t\t`check_in`,\r\n\t\t\t\t`check_out`,\r\n\t\t\t\t`number`,\r\n\t\t\t\t`status`\r\n\t\t\tFROM\r\n\t\t\t\t{$wpdb->prefix}st_availability\r\n\t\t\tWHERE\r\n\t\t\t\tpost_id = {$rental_id}\r\n\r\n\t\t\tAND (\r\n\t\t\t\t(\r\n\t\t\t\t\t'{$date1}' < DATE_FORMAT(FROM_UNIXTIME(check_in), '%Y-%m-%d')\r\n\t\t\t\t\tAND '{$date2}' > DATE_FORMAT(FROM_UNIXTIME(check_out), '%Y-%m-%d')\r\n\t\t\t\t)\r\n\t\t\t\tOR (\r\n\t\t\t\t\t'{$date1}' BETWEEN DATE_FORMAT(FROM_UNIXTIME(check_in), '%Y-%m-%d')\r\n\t\t\t\t\tAND DATE_FORMAT(FROM_UNIXTIME(check_out), '%Y-%m-%d')\r\n\t\t\t\t)\r\n\t\t\t\tOR (\r\n\t\t\t\t\t'{$date2}' BETWEEN DATE_FORMAT(FROM_UNIXTIME(check_in), '%Y-%m-%d')\r\n\t\t\t\t\tAND DATE_FORMAT(FROM_UNIXTIME(check_out), '%Y-%m-%d')\r\n\t\t\t\t)\r\n\t\t\t)";
$results = $wpdb->get_results($sql);
$list_date = array();
$start = strtotime($date1);
$end = strtotime($date2);
if (is_array($results) && count($results)) {
for ($i = $start; $i <= $end; $i = strtotime('+1 day', $i)) {
$in_date = false;
foreach ($results as $key => $val) {
$status = $val->status;
if ($i == $val->check_in && $i == $val->check_out) {
if ($status == 'unavailable') {
$date = $i;
} else {
unset($date);
}
if (!$in_date) {
$in_date = true;
}
}
}
if ($in_date && isset($date)) {
$list_date[] = date(TravelHelper::getDateFormat(), $date);
unset($date);
}
}
}
return $list_date;
}
示例12: __
</h5>
<p><strong><?php
echo __('Booking Number :', ST_TEXTDOMAIN);
?>
</strong> <?php
echo esc_html($order_code);
?>
</p>
<p>
<strong><?php
echo __('Booking Date :', ST_TEXTDOMAIN);
?>
</strong> <?php
echo get_the_time(TravelHelper::getDateFormat(), $order_code);
?>
</p>
<p><strong><?php
echo __('Payment Method :', ST_TEXTDOMAIN);
?>
</strong> <?php
echo STPaymentGateways::get_gatewayname(get_post_meta($order_code, 'payment_method', true));
?>
</p>
<table cellpadding="0" cellspacing="0" width="100%" class="tb_list_cart">
<thead>
<tr>
<td>
*
示例13: _e
?>
<p>
<strong><?php
_e("Pick-up Time: ", ST_TEXTDOMAIN);
?>
</strong> <?php
echo @date_i18n(TravelHelper::getDateFormat(), strtotime(get_post_meta($order_item_id, 'check_in', TRUE))) . ' - ' . get_post_meta($order_item_id, 'check_in_time', TRUE);
?>
</p>
<p>
<strong><?php
_e("Drop-off Time: ", ST_TEXTDOMAIN);
?>
</strong> <?php
echo @date_i18n(TravelHelper::getDateFormat(), strtotime(get_post_meta($order_item_id, 'check_out', TRUE))) . ' - ' . get_post_meta($order_item_id, 'check_out_time', TRUE);
?>
</p>
<?php
if ($drive_name = get_post_meta($order_code, 'driver_name', TRUE)) {
?>
<p>
<strong><?php
_e("Driver’s Name: ", ST_TEXTDOMAIN);
?>
</strong> <?php
echo $drive_name;
?>
</p>
<?php
}
示例14: _send_owner_booking_email
static function _send_owner_booking_email($order)
{
global $order_id;
$order_id = $order;
$item_post_type = get_post_meta($order_id, 'st_booking_post_type', true);
$to = false;
$subject = sprintf(__('New Booking at %s', ST_TEXTDOMAIN), get_bloginfo('title'));
$check = false;
$item_id = get_post_meta($order_id, 'item_id', true);
$check_in = get_post_meta($order_id, 'check_in', true);
$check_out = get_post_meta($order_id, 'check_out', true);
$date_check_in = @date(TravelHelper::getDateFormat(), strtotime($check_in));
$date_check_out = @date(TravelHelper::getDateFormat(), strtotime($check_out));
if ($item_id) {
$message = st()->load_template('email/header');
$email_for_partner = st()->get_option('email_for_partner', '');
$message .= do_shortcode($email_for_partner);
$message .= st()->load_template('email/footer');
$title = '';
if ($title = get_the_title($item_id)) {
$subject = sprintf(__('New Booking at %s: %s - %s', ST_TEXTDOMAIN), $title, $date_check_in, $date_check_out);
}
if (!empty($item_post_type) and $item_post_type == 'st_tours') {
$type_tour = get_post_meta($order_id, 'type_tour', true);
if ($type_tour == 'daily_tour') {
$duration = get_post_meta($order_id, 'duration', true);
$subject = sprintf(__('Your booking at %s: %s - %s', ST_TEXTDOMAIN), $title, $date_check_in, $duration);
}
}
if (!empty($item_post_type) and $item_post_type == 'st_holidays') {
$type_holiday = get_post_meta($order_id, 'type_holiday', true);
if ($type_holiday == 'daily_holiday') {
$duration = get_post_meta($order_id, 'duration', true);
$subject = sprintf(__('Your booking at %s: %s - %s', ST_TEXTDOMAIN), $title, $date_check_in, $duration);
}
}
$to = STCart::get_owner_email($item_id);
if ($to) {
$check = self::_send_mail($to, $subject, $message);
}
}
return $check;
}
示例15: _validate_cart_rental
static function _validate_cart_rental($data)
{
if (is_array($data) && count($data)) {
$result = ValidateWooCheckout::_get_order_rental($data['rental_id'], $data['check_in'], $data['check_out']);
$total_rental = intval(get_post_meta($data['rental_id'], 'rental_number', true));
if ($total_rental <= 0) {
$total_rental = 0;
}
for ($i = $data['check_in']; $i <= $data['check_out']; $i = strtotime('+1 day', $i)) {
$number_room = 0;
$number_room_cart = 1;
if (is_array($result) && count($result)) {
foreach ($result as $item) {
if ($i >= intval($item['check_in_timestamp']) && $i <= intval($item['check_out_timestamp'])) {
$number_room += 1;
}
}
if ($number_room_cart + $number_room > $total_rental) {
$free_room = $total_rental - $number_room;
$_SESSION['flash_validate_checkout'] = '<p class="bg-danger" style="padding: 10px 5px">' . sprintf(__('This <b>%s</b> rental has only %s rental(s) available on <b>%s</b>.', ST_TEXTDOMAIN), get_the_title($data['rental_id']), $free_room, date(TravelHelper::getDateFormat(), $i)) . '</p>';
return false;
}
} else {
if ($number_room_cart > $total_rental) {
$_SESSION['flash_validate_checkout'] = '<p class="bg-danger" style="padding: 10px 5px">' . sprintf(__('This <b>%s</b> rental has only %s rental(s) available on <b>%s</b>.', ST_TEXTDOMAIN), get_the_title($data['rental_id']), $total_rental, date(TravelHelper::getDateFormat(), $i)) . '</p>';
return false;
}
}
}
}
return true;
}