本文整理汇总了PHP中TravelHelper类的典型用法代码示例。如果您正苦于以下问题:PHP TravelHelper类的具体用法?PHP TravelHelper怎么用?PHP TravelHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TravelHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_add_to_cart
function do_add_to_cart($array = array())
{
$default = array('item_id' => '', 'number_room' => 1, 'price' => '', 'check_in' => '', 'check_out' => '', 'adult' => 1, 'children' => 0);
extract(wp_parse_args($array, $default));
$data = array('check_in' => $check_in, 'check_out' => $check_out, 'currency' => TravelHelper::get_default_currency('symbol'), 'adult' => $adult, 'children' => $children);
STCart::add_cart($item_id, $number_room, $price, $data);
}
示例2: product_cat_column
public function product_cat_column($columns, $column, $id)
{
if ($column == 'icon') {
$icon = get_tax_meta($id, 'st_icon');
$columns .= '<i style="font-size:24px" class="' . TravelHelper::handle_icon($icon) . '"></i>';
}
return $columns;
}
示例3: 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;
}
示例4: add_scripts
function add_scripts()
{
if (TravelHelper::is_https()) {
wp_register_script('gmap-api', 'https://maps.google.com/maps/api/js?sensor=false&language=en&libraries=places', null, false, true);
} else {
wp_register_script('gmap-api', 'http://maps.google.com/maps/api/js?sensor=false&language=en&libraries=places', null, false, true);
}
wp_register_script('gmapv3', $this->_url . 'js/gmap3.min.js', array('jquery', 'gmap-api'), false, true);
wp_register_script('bt-gmapv3-init', $this->_url . 'js/init.js', array('gmapv3'), false, true);
wp_register_style('bt-gmapv3', $this->_url . 'css/bt-gmap.css');
}
示例5: _format_money
/**
*
*
* @since 1.1.3
* */
static function _format_money()
{
$data = STInput::post('money_data', array());
if (!empty($data)) {
foreach ($data as $key => $value) {
$data[$key] = TravelHelper::format_money($value);
}
}
echo json_encode(array('status' => 1, 'money_data' => $data));
die;
}
示例6: init_metabox
/**
*
*
* @since 1.1.1
* */
function init_metabox()
{
//Room
$this->metabox[] = array('id' => 'room_metabox', 'title' => __('Room Setting', ST_TEXTDOMAIN), 'desc' => '', 'pages' => array('hotel_room'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => __('General', ST_TEXTDOMAIN), 'id' => 'room_reneral_tab', 'type' => 'tab'), array('label' => __('Hotel', ST_TEXTDOMAIN), 'id' => 'room_parent', 'type' => 'post_select_ajax', 'desc' => __('Choose the hotel that the room belong', ST_TEXTDOMAIN), 'post_type' => 'st_hotel', 'placeholder' => __('Search for a Hotel', ST_TEXTDOMAIN)), array('label' => __('Number of Room', ST_TEXTDOMAIN), 'id' => 'number_room', 'type' => 'text', 'desc' => __('Number of rooms available for book', ST_TEXTDOMAIN), 'std' => 1), array('label' => __('Gallery', ST_TEXTDOMAIN), 'id' => 'gallery', 'type' => 'gallery'), array('label' => __('Hotel Room Layout', ST_TEXTDOMAIN), 'id' => 'st_custom_layout', 'post_type' => 'st_layouts', 'desc' => __('Hotel Room Layout', ST_TEXTDOMAIN), 'type' => 'select', 'choices' => st_get_layout('hotel_room')), array('label' => __('Room Price', ST_TEXTDOMAIN), 'id' => 'room_price_tab', 'type' => 'tab'), array('label' => sprintf(__('Price (%s)', ST_TEXTDOMAIN), TravelHelper::get_default_currency('symbol')), 'id' => 'price', 'type' => 'text', 'desc' => __('Per night', ST_TEXTDOMAIN)), array('label' => __('Discount Rate', ST_TEXTDOMAIN), 'id' => 'discount_rate', 'type' => 'text', 'desc' => __('Discount by %', ST_TEXTDOMAIN)), array('label' => __('Sale Schedule', ST_TEXTDOMAIN), 'id' => 'is_sale_schedule', 'type' => 'on-off', 'std' => 'off'), array('label' => __('Sale Price Date From', ST_TEXTDOMAIN), 'desc' => __('Sale Price Date From', ST_TEXTDOMAIN), 'id' => 'sale_price_from', 'type' => 'date-picker', 'condition' => 'is_sale_schedule:is(on)'), array('label' => __('Sale Price Date To', ST_TEXTDOMAIN), 'desc' => __('Sale Price Date To', ST_TEXTDOMAIN), 'id' => 'sale_price_to', 'type' => 'date-picker', 'condition' => 'is_sale_schedule:is(on)'), array('label' => __('Additional paid options', ST_TEXTDOMAIN), 'desc' => __('Additional paid options', ST_TEXTDOMAIN), 'id' => 'paid_options', 'type' => 'list-item', 'settings' => array(array('id' => 'price', 'type' => 'text', 'std' => 0, 'label' => __('Price', ST_TEXTDOMAIN)))), array('id' => 'deposit_payment_status', 'label' => __("Deposit payment options", ST_TEXTDOMAIN), 'desc' => __('You can select <code>Disallow Deposit</code>, <code>Deposit by percent</code>, <code>Deposit by amount</code>'), 'type' => 'select', 'choices' => array(array('value' => '', 'label' => __('Disallow Deposit', ST_TEXTDOMAIN)), array('value' => 'percent', 'label' => __('Deposit by percent', ST_TEXTDOMAIN)), array('value' => 'amount', 'label' => __('Deposit by amount', ST_TEXTDOMAIN)))), array('label' => __('Deposit payment amount', ST_TEXTDOMAIN), 'desc' => __('Leave empty for disallow deposit payment', ST_TEXTDOMAIN), 'id' => 'deposit_payment_amount', 'type' => 'text', 'condition' => 'deposit_payment_status:not()'), array('label' => __('Room Facility', ST_TEXTDOMAIN), 'id' => 'room_detail_tab', 'type' => 'tab'), array('label' => __('Adults Number', ST_TEXTDOMAIN), 'id' => 'adult_number', 'type' => 'text', 'desc' => __('Number of Adults in room', ST_TEXTDOMAIN), 'std' => 1), array('label' => __('Children Number', ST_TEXTDOMAIN), 'id' => 'children_number', 'type' => 'text', 'desc' => __('Number of Children in room', ST_TEXTDOMAIN), 'std' => 0), array('label' => __('Beds Number', ST_TEXTDOMAIN), 'id' => 'bed_number', 'type' => 'text', 'desc' => __('Number of Beds in room', ST_TEXTDOMAIN), 'std' => 0), array('label' => __('Room footage (square feet)', ST_TEXTDOMAIN), 'desc' => __('Room footage (square feet)', ST_TEXTDOMAIN), 'id' => 'room_footage', 'type' => 'text'), array('label' => __('Room external booking', ST_TEXTDOMAIN), 'id' => 'st_room_external_booking', 'type' => 'on-off', 'std' => "off"), array('label' => __('Room external booking', ST_TEXTDOMAIN), 'id' => 'st_room_external_booking_link', 'type' => 'text', 'std' => "", 'condition' => 'st_room_external_booking:is(on)', 'desc' => "<em>" . __('Notice: Must be http://...', ST_TEXTDOMAIN) . "</em>")));
$data_paypment = STPaymentGateways::$_payment_gateways;
if (!empty($data_paypment) and is_array($data_paypment)) {
$this->metabox[0]['fields'][] = array('label' => __('Payment', ST_TEXTDOMAIN), 'id' => 'payment_detail_tab', 'type' => 'tab');
foreach ($data_paypment as $k => $v) {
$this->metabox[0]['fields'][] = array('label' => $v->get_name(), 'id' => 'is_meta_payment_gateway_' . $k, 'type' => 'on-off', 'desc' => $v->get_name(), 'std' => 'on');
}
}
parent::register_metabox($this->metabox);
}
示例7: _get_car_cant_order_by_id
static function _get_car_cant_order_by_id($car_id, $check_in, $check_out, $order_item_id = '')
{
if (!TravelHelper::checkTableDuplicate('st_cars')) {
return true;
}
global $wpdb;
$string = "";
if (!empty($order_item_id)) {
$string = " AND order_item_id NOT IN ('{$order_item_id}') ";
}
$sql = "SELECT\r\n\t\t\tst_booking_id as car_id,\r\n\t\t\tmt.meta_value as number_car,\r\n\t\t\tmt.meta_value - COUNT(st_booking_id) as car_free\r\n\t\t\tFROM {$wpdb->prefix}st_order_item_meta\r\n\t\t\tINNER JOIN {$wpdb->prefix}postmeta as mt ON mt.post_id = st_booking_id AND mt.meta_key = 'number_car'\r\n\t\t\tWHERE\r\n\t\t\tst_booking_post_type = 'st_cars'\r\n\t\t\tAND status NOT IN ('trash', 'canceled')\r\n\t\t\tAND st_booking_id = '{$car_id}'\r\n\t\t\tAND (\r\n\t\t\t\t({$check_in} < check_in_timestamp AND {$check_out} > check_out_timestamp)\r\n\t\t\t\tOR(\r\n\t\t\t\t{$check_in} BETWEEN check_in_timestamp AND check_out_timestamp\r\n\t\t\t)\r\n\t\t\t\tOR(\r\n\t\t\t\t{$check_out} BETWEEN check_in_timestamp AND check_out_timestamp\r\n\t\t\t)\r\n\t\t\t)\r\n\t\t\t{$string}\r\n\t\t\tGROUP BY st_booking_id\r\n\t\t\tHAVING (mt.meta_value - COUNT(st_booking_id) <= 0)";
$result = $wpdb->get_results($sql, ARRAY_A);
if (is_array($result) && count($result)) {
return false;
}
return true;
}
示例8: _save_post
public function _save_post($id)
{
if (!TravelHelper::checkTableDuplicate('st_hotel')) {
return;
}
if (isset($_GET['post_type']) && $_GET['post_type'] == 'st_hotel' && isset($_GET['section']) && $_GET['section'] == 'edit_order_item' && isset($_GET['order_item_id'])) {
$item_id = $_GET['order_item_id'];
$status = $_POST['status'];
if ($status == 'canceled') {
$status = 'trash';
}
global $wpdb;
$table = $wpdb->prefix . 'st_order_item_meta';
$data = array('status' => $status);
$where = array('order_item_id' => $item_id);
$rs = $wpdb->update($table, $data, $where);
}
}
示例9: _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;
}
示例10: _e
_e('review', ST_TEXTDOMAIN);
}
?>
</p>
<?php
}
?>
<?php
if (!empty($offer)) {
?>
<p class="mb0">
<?php
if ($offer > 1) {
printf(__('%d offers from %s', ST_TEXTDOMAIN), $offer, TravelHelper::format_money($min_price));
} else {
printf(__('%d offer from %s', ST_TEXTDOMAIN), $offer, TravelHelper::format_money($min_price));
}
?>
</p>
<?php
}
?>
</div>
</div>
</a>
</div>
</div>
<?php
}
?>
</div>
示例11: __
?>
</td>
</tr>
<?php
}
?>
<tr>
<td style="border-bottom: 1px dashed #ccc;padding:10px;">
<strong><?php
echo __('Pay Amount :', ST_TEXTDOMAIN);
?>
</strong>
</td>
<td style="border-bottom: 1px dashed #ccc;padding:10px;">
<?php
echo TravelHelper::format_money($total_price);
?>
</td>
</tr>
</table>
</td>
</tr>
</tfoot>
</table>
<?php
echo st()->load_template('email/booking_customer_infomation', null, array('order_id' => $order_id));
?>
</td>
示例12: 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));
?>
示例13: add_col_content
function add_col_content($column_name, $post_ID)
{
if ($column_name == 'activity_date') {
$check_in = get_post_meta($post_ID, 'check_in', true);
$check_out = get_post_meta($post_ID, 'check_out', true);
$date = mysql2date('d/m/Y', $check_in) . ' <i class="fa fa-long-arrow-right"></i> ' . mysql2date('d/m/Y', $check_out);
if (!empty($check_in) and !empty($check_out)) {
echo balanceTags($date);
} else {
_e('none', ST_TEXTDOMAIN);
}
}
if ($column_name == 'duration') {
$parent = get_post_meta($post_ID, 'duration', true);
if ($parent) {
echo esc_html($parent);
}
}
if ($column_name == 'price') {
$price = get_post_meta($post_ID, 'price', true);
$type_price = get_post_meta($post_ID, 'type_price', true);
if ($type_price != 'people_price') {
echo '<strong>' . TravelHelper::format_money($price) . '</strong>';
} else {
$adult_price = get_post_meta($post_ID, 'adult_price', true);
$child_price = get_post_meta($post_ID, 'child_price', true);
echo '<span>' . __('Adult Price', ST_TEXTDOMAIN) . ' : ' . TravelHelper::format_money($adult_price) . '</span><br>';
echo '<span>' . __('Child Price', ST_TEXTDOMAIN) . ' : ' . TravelHelper::format_money($child_price) . '</span><br>';
}
}
if ($column_name == 'activity_time') {
$time = get_post_meta($post_ID, 'activity-time', true);
if ($time) {
echo esc_html($time);
}
}
}
示例14: esc_html
<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);
?>
>
<option value=""><?php
_e('-- Select --', ST_TEXTDOMAIN);
?>
</option>
<?php
foreach ($list_location as $key => $value) {
$name = TravelHelper::showNameLocation($value->ID);
$name = explode('||', $name);
$name = $name[0];
?>
<option <?php
selected($value->ID, $location_id);
?>
value="<?php
echo $value->ID;
?>
"><?php
echo $name;
?>
</option>
<?php
}
示例15: foreach
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>