本文整理汇总了PHP中TravelHelper::get_current_currency方法的典型用法代码示例。如果您正苦于以下问题:PHP TravelHelper::get_current_currency方法的具体用法?PHP TravelHelper::get_current_currency怎么用?PHP TravelHelper::get_current_currency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TravelHelper
的用法示例。
在下文中一共展示了TravelHelper::get_current_currency方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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>
示例2: _change_wc_order_cyrrency
/**
*
*
* @since 1.1.1
* */
function _change_wc_order_cyrrency($paypal_arg)
{
$paypal_arg['currency_code'] = TravelHelper::get_current_currency('name');
return $paypal_arg;
}
示例3: _add_booking
function _add_booking()
{
if (!check_admin_referer('shb_action', 'shb_field')) {
die;
}
$data = $this->_check_validate();
if (is_array($data) && count($data)) {
extract($data);
$order = array('post_title' => __('Order', ST_TEXTDOMAIN) . ' - ' . date(get_option('date_format')) . ' @ ' . date(get_option('time_format')), 'post_type' => 'st_order', 'post_status' => 'publish');
$order_id = wp_insert_post($order);
if ($order_id) {
$check_out_field = STCart::get_checkout_fields();
if (!empty($check_out_field)) {
foreach ($check_out_field as $field_name => $field_desc) {
update_post_meta($order_id, $field_name, STInput::post($field_name));
}
}
$id_user = get_current_user_id();
update_post_meta($order_id, 'id_user', $id_user);
update_post_meta($order_id, 'payment_method', 'st_submit_form');
$item_price = STPrice::getRentalPriceOnlyCustomPrice($item_id, strtotime($check_in), strtotime($check_out));
$numberday = TravelHelper::dateDiff($check_in, $check_out);
$origin_price = $item_price;
//Extra price
$extras = STInput::request('extra_price', array());
$extra_price = STPrice::getExtraPrice($extras, $room_num_search, $numberday);
$sale_price = STPrice::getSalePrice($item_id, $item_price, strtotime($check_in), strtotime($check_out));
$price_with_tax = STPrice::getPriceWithTax($sale_price + $extra_price);
$deposit_money['data'] = array();
$deposit_money = STPrice::getDepositData($item_id, $deposit_money);
$deposit_price = STPrice::getDepositPrice($deposit_money['data']['deposit_money'], $price_with_tax, 0);
if (isset($deposit_money['data']['deposit_money'])) {
$total_price = $deposit_price;
} else {
$total_price = $price_with_tax;
}
$data_prices = array('origin_price' => $origin_price, 'sale_price' => $sale_price, 'coupon_price' => 0, 'price_with_tax' => $price_with_tax, 'total_price' => $total_price, 'deposit_price' => $deposit_price);
$item_data = array('item_number' => 1, 'item_id' => $item_id, 'item_price' => $item_price, 'check_in' => $check_in, 'check_out' => $check_out, 'adult_number' => $adult_number, 'child_number' => $child_number, 'total_price' => $total_price, 'data_prices' => $data_prices, 'deposit_money' => $deposit_money['data']['deposit_money'], 'booking_by' => 'admin', 'st_tax' => STPrice::getTax(), 'st_tax_percent' => STPrice::getTax(), 'status' => $_POST['status'], 'currency' => TravelHelper::get_current_currency('symbol'), 'currency_rate' => TravelHelper::get_current_currency('rate'), 'extras' => $extras, 'extra_price' => $extra_price, 'commission' => TravelHelper::get_commission());
foreach ($item_data as $val => $value) {
update_post_meta($order_id, $val, $value);
}
if (TravelHelper::checkTableDuplicate('st_rental')) {
global $wpdb;
$table = $wpdb->prefix . 'st_order_item_meta';
$g_post = get_post($item_id);
$partner_id = $g_post ? $g_post->post_author : '';
global $sitepress;
if ($sitepress) {
$post_type = get_post_type($st_booking_id);
if ($post_type == 'st_hotel') {
$post_type = 'hotel_room';
$id = $room_id;
} else {
$id = $st_booking_id;
}
$lang_code = $sitepress->get_default_language();
$origin_id = icl_object_id($id, $post_type, true, $lang_code);
} else {
$origin_id = $st_booking_id;
}
$data = array('order_item_id' => $order_id, 'type' => 'normal_booking', 'check_in' => $check_in, 'check_out' => $check_out, 'st_booking_post_type' => 'st_rental', 'st_booking_id' => $item_id, 'adult_number' => $adult_number, 'child_number' => $child_number, 'check_in_timestamp' => strtotime($check_in), 'check_out_timestamp' => strtotime($check_out), 'room_num_search' => $room_num_search, 'user_id' => $id_user, 'status' => $_POST['status'], 'wc_order_id' => $order_id, 'partner_id' => $partner_id, 'created' => get_the_date('Y-m-d', $order_id), 'total_order' => $total_price, 'commission' => TravelHelper::get_commission(), 'origin_id' => $origin_id);
$wpdb->insert($table, $data);
}
do_action('st_booking_success', $order_id);
//Check email
$user_name = STInput::post('st_email');
$user_id = username_exists($user_name);
if (!$user_id and email_exists($user_name) == false) {
$random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
$userdata = array('user_login' => $user_name, 'user_pass' => $random_password, 'user_email' => $user_name, 'first_name' => STInput::post('st_first_name'), 'last_name' => STInput::post('st_last_name'));
$user_id = wp_insert_user($userdata);
wp_new_user_notification($user_id);
}
STCart::send_mail_after_booking($order_id, true);
STCart::send_email_confirm($order_id);
wp_safe_redirect(self::$booking_page);
}
}
}
示例4: round
}
}
$data_min_max = TravelerObject::get_min_max_price('st_hotel');
$max = $data_min_max['price_max'];
$min = $data_min_max['price_min'];
if (TravelHelper::get_default_currency('rate') != 0 and TravelHelper::get_default_currency('rate')) {
$rate_change = TravelHelper::get_current_currency('rate') / TravelHelper::get_default_currency('rate');
$max = round($rate_change * $max);
$min = round($rate_change * $min);
}
/*$min = number_format($min , TravelHelper::get_current_currency('booking_currency_precision')) ;
$max = number_format($max , TravelHelper::get_current_currency('booking_currency_precision')) ;*/
$value_show = $min . ";" . $max;
// default if error
if ($rate_change) {
if (STInput::request('price_range')) {
$price_range = explode(';', STInput::request('price_range'));
$value_show = $price_range[0] . ";" . $price_range[1];
} else {
$value_show = $min . ";" . $max;
}
}
echo '<input name="price_range" type="text" value="' . $value_show . '" class="price-slider" data-symbol="' . TravelHelper::get_current_currency('symbol') . '" data-min="' . esc_attr($min) . '" data-max="' . esc_attr($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('filter');
?>
</button>
</form>
示例5: esc_attr
<?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).'">';
示例6: st_add_scripts
//.........这里部分代码省略.........
}
if (is_singular('st_hotel')) {
wp_enqueue_script('single-hotel-js', get_template_directory_uri() . '/js/init/single-hotel.js', array('jquery'), '1.1.0', true);
}
if (is_singular('st_tours')) {
wp_enqueue_script('st-qtip', get_template_directory_uri() . '/js/jquery.qtip.js', array('jquery'), null, true);
wp_enqueue_script('single-tour-js', get_template_directory_uri() . '/js/init/single-tour.js', array('jquery'), '1.1.0', true);
}
if (is_singular('st_holidays')) {
wp_enqueue_script('st-qtip', get_template_directory_uri() . '/js/jquery.qtip.js', array('jquery'), null, true);
wp_enqueue_script('single-holiday-js', get_template_directory_uri() . '/js/init/single-holiday.js', array('jquery'), '1.1.0', true);
}
if (is_singular('st_activity')) {
wp_enqueue_script('single-activity-js', get_template_directory_uri() . '/js/init/single-activity.js', array('jquery'), '1.1.0', true);
}
/**
*@since 1.1.3
**/
wp_enqueue_script('date.js', get_template_directory_uri() . '/js/date.js', array('jquery'), null, true);
wp_enqueue_script('mousewheel.js', get_template_directory_uri() . '/js/jquery.mousewheel-3.0.6.pack.js', array('jquery'), null, true);
wp_enqueue_script('fancybox.js', get_template_directory_uri() . '/js/jquery.fancybox.js', array('jquery'), null, true);
wp_enqueue_script('fancybox-buttons.js', get_template_directory_uri() . '/js/helpers/jquery.fancybox-buttons.js', array('jquery'), null, true);
wp_enqueue_script('fancybox-media.js', get_template_directory_uri() . '/js/helpers/jquery.fancybox-media.js', array('jquery'), null, true);
wp_enqueue_script('fancybox-thumbs.js', get_template_directory_uri() . '/js/helpers/jquery.fancybox-thumbs.js', array('jquery'), null, true);
wp_enqueue_script('custom.js', get_template_directory_uri() . '/js/custom.js', array('jquery'), null, true);
wp_enqueue_script('custom2.js', get_template_directory_uri() . '/js/custom2.js', array('jquery'), null, true);
wp_enqueue_script('user.js', get_template_directory_uri() . '/js/user.js', array('jquery'), null, true);
wp_enqueue_script('social-login.js', get_template_directory_uri() . '/js/init/social-login.js', array('jquery'), null, true);
wp_enqueue_script('sst-select.js', get_template_directory_uri() . '/js/init/st-select.js', array('jquery'), null, true);
wp_enqueue_script('jquery-sticky', get_template_directory_uri() . '/js/sticky.js', array('jquery'), null, true);
if (is_page_template('template-checkout.php')) {
wp_enqueue_script('checkout-js', get_template_directory_uri() . '/js/init/template-checkout.js', array('jquery'), null, true);
}
wp_localize_script('jquery', 'st_checkout_text', array('without_pp' => __('Submit Request', ST_TEXTDOMAIN), 'with_pp' => __('Booking Now', ST_TEXTDOMAIN), 'validate_form' => __('Please fill all required fields', ST_TEXTDOMAIN), 'error_accept_term' => __('Please accept our terms and conditions', ST_TEXTDOMAIN), 'adult_price' => __('Adult price', ST_TEXTDOMAIN), 'child_price' => __("Child price", ST_TEXTDOMAIN), 'infant_price' => __("Infant price", ST_TEXTDOMAIN), 'adult' => __("Adult", ST_TEXTDOMAIN), 'child' => __("Child", ST_TEXTDOMAIN), 'infant' => __("Infant", ST_TEXTDOMAIN), 'price' => __("Price", ST_TEXTDOMAIN), 'origin_price' => __("Origin Price", ST_TEXTDOMAIN)));
wp_localize_script('jquery', 'st_params', array('theme_url' => get_template_directory_uri(), 'site_url' => site_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'loading_url' => admin_url('/images/wpspin_light.gif'), 'st_search_nonce' => wp_create_nonce("st_search_security"), 'facebook_enable' => st()->get_option('social_fb_login', 'on'), 'facbook_app_id' => st()->get_option('social_fb_app_id'), 'booking_currency_precision' => TravelHelper::get_current_currency('booking_currency_precision'), 'thousand_separator' => TravelHelper::get_current_currency('thousand_separator'), 'decimal_separator' => TravelHelper::get_current_currency('decimal_separator'), 'currency_symbol' => TravelHelper::get_current_currency('symbol'), 'currency_position' => TravelHelper::get_current_currency('booking_currency_pos'), 'currency_rtl_support' => TravelHelper::get_current_currency('currency_rtl_support'), 'free_text' => __('Free', ST_TEXTDOMAIN), 'date_format' => TravelHelper::getDateFormatJs(), 'time_format' => st()->get_option('time_format', '12h'), 'text_loading' => __("Loading...", ST_TEXTDOMAIN), 'mk_my_location' => get_template_directory_uri() . '/img/my_location.png', 'locale' => $locale, 'header_bgr' => st()->get_option('header_background', ''), 'text_refresh' => __("Refresh", ST_TEXTDOMAIN)));
wp_localize_script('jquery', 'st_list_map_params', array('mk_my_location' => get_template_directory_uri() . '/img/my_location.png', 'text_my_location' => __("3000 m radius", ST_TEXTDOMAIN), 'text_no_result' => __("No Result", ST_TEXTDOMAIN)));
wp_localize_script('jquery', 'st_config_partner', array('text_er_image_format' => false));
if (st()->get_option('social_fb_login', 'on')) {
//wp_enqueue_script('st-facebook',get_template_directory_uri().'/js/init/facebook.js',null,true);
}
//Allow turn on nicescroll
if (st()->get_option('gen_enable_smscroll', 'off') == 'on') {
wp_enqueue_script('nicescroll.js', get_template_directory_uri() . '/js/nicescroll.js', array('jquery'), null, true);
}
wp_enqueue_style('bootstrap.css', get_template_directory_uri() . '/css/bootstrap.css');
wp_enqueue_style('animate.css', get_template_directory_uri() . '/css/animate.css');
wp_enqueue_style('fontawesome', get_template_directory_uri() . '/css/font-awesome.css');
if (st_is_https()) {
wp_enqueue_style('roboto-font', 'https://fonts.googleapis.com/css?family=Roboto:500,700,400,300,100');
} else {
wp_enqueue_style('roboto-font', 'http://fonts.googleapis.com/css?family=Roboto:500,700,400,300,100');
}
if (is_page_template('template-user.php')) {
wp_enqueue_style('jquery.jqplot.min.css', get_template_directory_uri() . '/js/jqplot/js/jquery.jqplot.min.css');
wp_enqueue_style('shCoreDefault.min.css', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/styles/shCoreDefault.min.css');
wp_enqueue_style('shThemejqPlot.min.css', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/styles/shThemejqPlot.min.css');
wp_enqueue_script('jquery.jqplot.min.js', get_template_directory_uri() . '/js/jqplot/js/jquery.jqplot.js', array('jquery'), null, true);
wp_enqueue_script('shCore.min.js', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/scripts/shCore.min.js', array('jquery'), null, true);
wp_enqueue_script('shBrushJScript.min.js', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/scripts/shBrushJScript.min.js', array('jquery'), null, true);
wp_enqueue_script('shBrushXml.min.js', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/scripts/shBrushXml.min.js', array('jquery'), null, true);
wp_enqueue_script('jqplot.barRenderer.min.js', get_template_directory_uri() . '/js/jqplot/plugins/jqplot.barRenderer.min.js', array('jquery'), null, true);
wp_enqueue_script('jqplot.categoryAxisRenderer.min.js', get_template_directory_uri() . '/js/jqplot/plugins/jqplot.categoryAxisRenderer.js', array('jquery'), null, true);
wp_enqueue_script('jqplot.pointLabels.min.js', get_template_directory_uri() . '/js/jqplot/plugins/jqplot.pointLabels.min.js', array('jquery'), null, true);
wp_enqueue_script('jqplot.cursor.min', get_template_directory_uri() . '/js/jqplot/js/jqplot.cursor.min.js', array('jquery'), null, true);
wp_enqueue_script('Chart.min.js', get_template_directory_uri() . '/inc/plugins/chart-master/Chart.js', array('jquery'), null, true);
}
wp_enqueue_script('jquery.scrollTo.min.js', get_template_directory_uri() . '/js/jquery.scrollTo.min.js', array('jquery'), null, true);
wp_enqueue_style('icomoon.css', get_template_directory_uri() . '/css/icomoon.css');
wp_enqueue_style('weather-icons.css', get_template_directory_uri() . '/css/weather-icons.min.css');
wp_enqueue_style('styles.css', get_template_directory_uri() . '/css/styles.css');
wp_enqueue_style('mystyles.css', get_template_directory_uri() . '/css/mystyles.css');
wp_enqueue_style('tooltip-classic.css', get_template_directory_uri() . '/css/tooltip-classic.css');
wp_enqueue_style('chosen-css', get_template_directory_uri() . '/js/chosen/chosen.min.css');
wp_enqueue_style('default-style', get_stylesheet_uri());
wp_enqueue_style('fancybox.css', get_template_directory_uri() . '/css/jquery.fancybox.css');
wp_enqueue_style('fancybox-buttons.css', get_template_directory_uri() . '/js/helpers/jquery.fancybox-buttons.css');
wp_enqueue_style('fancybox-thumbs.css', get_template_directory_uri() . '/js/helpers/jquery.fancybox-thumbs.css');
wp_enqueue_style('custom.css', get_template_directory_uri() . '/css/custom.css');
wp_enqueue_style('custom2css', get_template_directory_uri() . '/css/custom2.css');
wp_enqueue_style('user.css', get_template_directory_uri() . '/css/user.css');
wp_enqueue_style('custom-responsive', get_template_directory_uri() . '/css/custom-responsive.css');
wp_enqueue_style('st-select.css', get_template_directory_uri() . '/css/st-select.css');
// from 1.1.9 2nd menu
wp_enqueue_style('menu_style2.css', get_template_directory_uri() . '/css/menu_style2.css');
wp_enqueue_script('testimonial', get_template_directory_uri() . '/js/testimonial.js', array('jquery'), null, true);
wp_enqueue_script('hover_effect_fix', get_template_directory_uri() . '/js/hover_effect.js', array('jquery'), null, true);
wp_enqueue_style('hover_effect_demo', get_template_directory_uri() . '/css/hover_effect/demo.css');
wp_enqueue_style('hover_effect_normal', get_template_directory_uri() . '/css/hover_effect/normalize.css');
wp_enqueue_style('hover_effect_set1', get_template_directory_uri() . '/css/hover_effect/set1.css');
wp_enqueue_style('hover_effect_set2', get_template_directory_uri() . '/css/hover_effect/set2.css');
if (st()->get_option('right_to_left') == 'on') {
wp_enqueue_style('rtl.css', get_template_directory_uri() . '/rtl.css');
}
$list_icon = get_option('st_list_fonticon_', array());
if (is_array($list_icon) && count($list_icon)) {
foreach ($list_icon as $item => $val) {
wp_enqueue_style($item, $val['link_file_css']);
}
}
}
示例7: do_add_to_cart
function do_add_to_cart()
{
$pass_validate = true;
$item_id = STInput::request('item_id', '');
if ($item_id <= 0 || get_post_type($item_id) != 'st_holidays') {
STTemplate::set_message(__('This holiday is not available..', ST_TEXTDOMAIN), 'danger');
$pass_validate = false;
return false;
}
$number = 1;
$adult_number = intval(STInput::request('adult_number', 1));
$child_number = intval(STInput::request('child_number', 0));
$infant_number = intval(STInput::request('infant_number', 0));
$data['adult_number'] = $adult_number;
$data['child_number'] = $child_number;
$data['infant_number'] = $infant_number;
$max_number = intval(get_post_meta($item_id, 'max_people', true));
$type_holiday = get_post_meta($item_id, 'type_holiday', true);
$data['type_holiday'] = $type_holiday;
$today = date('Y-m-d');
$check_in = STInput::request('check_in', '');
$check_out = STInput::request('check_out', '');
if (!$check_in || !$check_out) {
STTemplate::set_message(__('Select a holiday in the calendar above.', ST_TEXTDOMAIN), 'danger');
$pass_validate = FALSE;
return false;
}
$compare = TravelHelper::dateCompare($today, $check_in);
if ($compare < 0) {
STTemplate::set_message(__('This holiday has expired', ST_TEXTDOMAIN), 'danger');
$pass_validate = false;
return false;
}
$booking_period = intval(get_post_meta($item_id, 'holidays_booking_period', true));
$period = TravelHelper::dateDiff($today, $check_in);
if ($period < $booking_period) {
STTemplate::set_message(sprintf(__('This holiday allow minimum booking is %d day(s)', ST_TEXTDOMAIN), $booking_period), 'danger');
$pass_validate = false;
return false;
}
if ($adult_number + $child_number + $infant_number > $max_number) {
STTemplate::set_message(sprintf(__('Max of people for this holiday is %d people', ST_TEXTDOMAIN), $max_number), 'danger');
$pass_validate = FALSE;
return false;
}
$holiday_available = HolidayHelper::checkAvailableHoliday($item_id, strtotime($check_in), strtotime($check_out));
if (!$holiday_available) {
STTemplate::set_message(__('The check in, check out day is not invalid or this holiday not available.', ST_TEXTDOMAIN), 'danger');
$pass_validate = FALSE;
return false;
}
$free_people = intval(get_post_meta($item_id, 'max_people', true));
$result = HolidayHelper::_get_free_peple($item_id, strtotime($check_in), strtotime($check_out));
if (is_array($result) && count($result)) {
$free_people = intval($result['free_people']);
}
if ($free_people < $adult_number + $child_number + $infant_number) {
STTemplate::set_message(sprintf(__('This holiday only vacant %d people', ST_TEXTDOMAIN), $free_people), 'danger');
$pass_validate = FALSE;
return false;
}
$data_price = STPrice::getPriceByPeopleHoliday($item_id, strtotime($check_in), strtotime($check_out), $adult_number, $child_number, $infant_number);
$total_price = $data_price['total_price'];
$sale_price = STPrice::getSaleHolidaySalePrice($item_id, $total_price, $type_holiday, strtotime($check_in));
$data['check_in'] = date('m/d/Y', strtotime($check_in));
$data['check_out'] = date('m/d/Y', strtotime($check_out));
$people_price = STPrice::getPeoplePrice($item_id, strtotime($check_in), strtotime($check_out));
$data = wp_parse_args($data, $people_price);
$data['ori_price'] = $sale_price;
$data['currency'] = TravelHelper::get_current_currency('symbol');
$data['currency_rate'] = TravelHelper::get_current_currency('rate');
$data['currency_pos'] = TravelHelper::get_current_currency('booking_currency_pos');
$data['commission'] = TravelHelper::get_commission();
$data['data_price'] = $data_price;
$data['discount_rate'] = STPrice::get_discount_rate($item_id, strtotime($check_in));
if ($pass_validate) {
$data['duration'] = $type_holiday == 'daily_holiday' ? floatval(get_post_meta($item_id, 'duration_day', true)) : '';
if ($pass_validate) {
STCart::add_cart($item_id, $number, $sale_price, $data);
}
}
return $pass_validate;
}
示例8: do_add_to_cart
//.........这里部分代码省略.........
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));
$discount_rate = STPrice::get_discount_rate($item_id, strtotime($check_in));
$data['adult_price'] = floatval(get_post_meta($item_id, 'adult_price', true));
$data['child_price'] = floatval(get_post_meta($item_id, 'child_price', true));
$data['infant_price'] = floatval(get_post_meta($item_id, 'infant_price', true));
$data['ori_price'] = $sale_price;
$data['currency'] = TravelHelper::get_current_currency('symbol');
$data['currency_rate'] = TravelHelper::get_current_currency('rate');
$data['currency_pos'] = TravelHelper::get_current_currency('booking_currency_pos');
$data['commission'] = TravelHelper::get_commission();
$data['data_price'] = $data_price;
$data['discount_rate'] = $discount_rate;
if ($pass_validate) {
$pass_validate = apply_filters('st_activity_add_cart_validate', $pass_validate);
}
if ($pass_validate) {
STCart::add_cart($item_id, $number, $sale_price, $data);
}
return $pass_validate;
}
示例9: st
// from 1.1.9
if (empty($container)) {
$container = "div";
}
if (empty($class)) {
$class = "nav-drop nav-symbol";
}
$is_show = st()->get_option('show_booking_primary_currency', 'on');
?>
<?php
if ($is_show == 'on') {
echo balanceTags('<' . $container . ' class="' . $class . '">');
?>
<a class="cursor" ><?php
$current_currency = TravelHelper::get_current_currency();
if (isset($current_currency['name'])) {
echo esc_html($current_currency['name']);
}
if (isset($current_currency['symbol'])) {
echo esc_html(' ' . $current_currency['symbol']);
}
?>
<i class="fa fa-angle-down"></i><i class="fa fa-angle-up"></i></a>
<ul class="list nav-drop-menu">
<?php
$currency = TravelHelper::get_currency();
if (!empty($currency)) {
foreach ($currency as $key => $value) {
if ($current_currency['name'] != $value['name']) {
echo '<li><a href="' . esc_url(add_query_arg('currency', $value['name'])) . '">' . $value['name'] . '<span class="right">' . $value['symbol'] . '</span></a>
示例10: check_completePurchase
function check_completePurchase($order_id = false)
{
//Check cart is not empty
if ($order_id and false !== get_post_status($order_id)) {
$total = get_post_meta($order_id, 'total_price', true);
$gateway = Omnipay::create('PayPal_Express');
$gateway->setUsername($this->apiUserName);
$gateway->setPassword($this->apiPass);
$gateway->setSignature($this->apiSignature);
$gateway->setTestMode(true);
$amount = TravelHelper::convert_money($total);
$order_token_code = get_post_meta($order_id, 'order_token_code', true);
if (!$order_token_code) {
$array = array('gateway_name' => 'st_paypal', 'order_code' => $order_id, 'status' => 'success');
$array_error = array('gateway_name' => 'st_paypal', 'order_code' => $order_id, 'status' => 'error');
} else {
$array = array('gateway_name' => 'st_paypal', 'order_token_code' => $order_token_code, 'status' => 'success');
$array_error = array('gateway_name' => 'st_paypal', 'order_token_code' => $order_token_code, 'status' => 'error');
}
$response = $gateway->completePurchase(array('amount' => (double) $amount, 'currency' => TravelHelper::get_current_currency('name'), 'description' => __('Traveler Booking', ST_TEXTDOMAIN), 'returnUrl' => add_query_arg($array, STCart::get_success_link()), 'cancelUrl' => add_query_arg($array_error, STCart::get_success_link())))->send();
if ($response->isSuccessful()) {
$data = $response->getData();
$data2 = $gateway->fetchCheckout(array('transactionReference' => $data['TOKEN']))->send();
$transaction_data = $data2->getData();
//Try to create user and create new orders with paypal transaction detail
return STGatewayPaypal::paypal_checkout($transaction_data, $order_id);
//return true;
} elseif ($response->isRedirect()) {
//$response->redirect(); // this will automatically forward the customer
return array('status' => false, 'redirect_url' => $response->getRedirectUrl(), 'func' => 'check_completePurchase');
// return ;
} else {
// not successful
return array('status' => false, 'message' => $response->getMessage());
}
} else {
// not successful
return array('status' => false, 'message' => __('Order Code is not exists', ST_TEXTDOMAIN));
}
}
示例11: esc_html
$info_price = STCars::get_info_price(get_the_ID(), $start, $end);
$cars_price = $info_price['price'];
$count_sale = $info_price['discount'];
$price_origin = $info_price['price_origin'];
$list_price = $info_price['list_price'];
$data_price_tmp = STPrice::getSaleCarPrice(get_the_ID(), $price_origin, $start, $end);
?>
<form id="form-booking-inpage" method="post" class="car_booking_form" >
<div class="booking-item-price-calc">
<div class="row row-wrap">
<?php
$current_rate = 1;
$current = TravelHelper::get_current_currency('name');
$default = TravelHelper::get_default_currency('name');
if ($current != $default) {
$current_rate = TravelHelper::get_current_currency('rate');
}
?>
<input type="hidden" name="price_rate" value="<?php
echo esc_html($current_rate);
?>
">
<div class="col-md-<?php
echo esc_attr($col);
?>
singe_cars" data-car-id="<?php
the_ID();
?>
">
<?php
$list = get_post_meta(get_the_ID(), 'cars_equipment_list', true);
示例12: _add_booking
function _add_booking()
{
if (!check_admin_referer('shb_action', 'shb_field')) {
die;
}
$data = $this->check_validate();
if (is_array($data) && count($data)) {
extract($data);
$order = array('post_title' => __('Order', ST_TEXTDOMAIN) . ' - ' . date(get_option('date_format')) . ' @ ' . date(get_option('time_format')), 'post_type' => 'st_order', 'post_status' => 'publish');
$order_id = wp_insert_post($order);
if ($order_id) {
$check_out_field = STCart::get_checkout_fields();
if (!empty($check_out_field)) {
foreach ($check_out_field as $field_name => $field_desc) {
update_post_meta($order_id, $field_name, STInput::post($field_name));
}
}
update_post_meta($order_id, 'payment_method', 'st_submit_form');
$id_user = get_current_user_id();
update_post_meta($order_id, 'id_user', $id_user);
$item_price = floatval(get_post_meta($item_id, 'cars_price', true));
$unit = st()->get_option('cars_price_unit', 'day');
/*if($unit == 'day'){
$numberday = ceil(($check_out_timestamp - $check_in_timestamp) / (60 * 60 * 24));
}elseif($unit == 'hour'){
$numberday = ceil(($check_out_timestamp - $check_in_timestamp) / (60 * 60));
}*/
$numberday = STCars::get_date_diff($check_in_timestamp, $check_out_timestamp, $unit);
$selected_equipments = $_POST['item_equipment'];
$price_equipment = STPrice::getPriceEuipmentCarAdmin($selected_equipments);
$data_equipment = STPrice::convertEquipmentToOject($selected_equipments);
$origin_price = $item_price * $numberday;
$sale_price = STPrice::getSaleCarPrice($item_id, $item_price, $check_in_timestamp, $check_out_timestamp);
$price_with_tax = STPrice::getPriceWithTax($sale_price + $price_equipment);
$coupon_price = 0;
$deposit_money['data'] = array();
$deposit_money = STPrice::getDepositData($item_id, $deposit_money);
$deposit_price = STPrice::getDepositPrice($deposit_money['data']['deposit_money'], $price_with_tax, 0);
if (isset($deposit_money['data']['deposit_money'])) {
$total_price = $deposit_price;
} else {
$total_price = $price_with_tax - $coupon_price;
}
$data_prices = array('origin_price' => $origin_price, 'sale_price' => $sale_price, 'coupon_price' => 0, 'price_with_tax' => $price_with_tax, 'total_price' => $total_price, 'deposit_price' => $deposit_price, 'unit' => $unit, 'price_equipment' => $price_equipment);
$item_data = array('item_id' => $item_id, 'item_number' => 1, 'total_price' => $total_price, 'item_price' => $item_price, 'check_in' => $check_in, 'check_in_timestamp' => $check_in_timestamp, 'check_out' => $check_out, 'check_out_timestamp' => $check_out_timestamp, 'st_booking_id' => $item_id, 'check_in_time' => $check_in_time, 'check_out_time' => $check_out_time, 'pick_up' => get_the_title($location_id_pick_up), 'location_id_pick_up' => $location_id_pick_up, 'drop_off' => get_the_title($location_id_drop_off), 'location_id_drop_off' => $location_id_drop_off, 'deposit_money' => $deposit_money, 'booking_by' => 'admin', 'st_tax' => STPrice::getTax(), 'st_tax_percent' => STPrice::getTax(), 'status' => $_POST['status'], 'currency' => TravelHelper::get_current_currency('symbol'), 'currency_rate' => TravelHelper::get_current_currency('rate'), 'data_equipment' => $data_equipment, 'data_prices' => $data_prices, 'commission' => TravelHelper::get_commission());
foreach ($item_data as $val => $value) {
update_post_meta($order_id, $val, $value);
}
if (TravelHelper::checkTableDuplicate('st_cars')) {
global $wpdb;
$table = $wpdb->prefix . 'st_order_item_meta';
$g_post = get_post($item_id);
$partner_id = $g_post ? $g_post->post_author : '';
global $sitepress;
if ($sitepress) {
$post_type = get_post_type($st_booking_id);
if ($post_type == 'st_hotel') {
$post_type = 'hotel_room';
$id = $room_id;
} else {
$id = $st_booking_id;
}
$lang_code = $sitepress->get_default_language();
$origin_id = icl_object_id($id, $post_type, true, $lang_code);
} else {
$origin_id = $st_booking_id;
}
$data = array('order_item_id' => $order_id, 'type' => 'normal_booking', 'st_booking_post_type' => 'st_cars', 'check_in' => date('m/d/Y', strtotime($check_in)), 'check_out' => date('m/d/Y', strtotime($check_out)), 'st_booking_id' => $item_id, 'check_in_timestamp' => $check_in_timestamp, 'check_out_timestamp' => $check_out_timestamp, 'user_id' => $id_user, 'status' => $_POST['status'], 'wc_order_id' => $order_id, 'partner_id' => $partner_id, 'created' => get_the_date('Y-m-d', $order_id), 'total_order' => $total_price, 'commission' => TravelHelper::get_commission(), 'origin_id' => $origin_id);
$wpdb->insert($table, $data);
}
//Check email
$user_name = STInput::post('st_email');
$user_id = username_exists($user_name);
if (!$user_id and email_exists($user_name) == false) {
$random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
$userdata = array('user_login' => $user_name, 'user_pass' => $random_password, 'user_email' => $user_name, 'first_name' => STInput::post('st_first_name'), 'last_name' => STInput::post('st_last_name'));
$user_id = wp_insert_user($userdata);
wp_new_user_notification($user_id);
}
STCart::send_mail_after_booking($order_id, true);
STCart::send_email_confirm($order_id);
do_action('st_booking_success', $order_id);
wp_safe_redirect(self::$booking_page);
}
}
}
示例13: st_add_scripts
function st_add_scripts()
{
if (is_singular()) {
wp_enqueue_script('comment');
wp_enqueue_script('comment-reply');
wp_enqueue_script('st-reviews-form', get_template_directory_uri() . '/js/init/review_form.js', array('jquery'), null, true);
}
wp_enqueue_script('bootstrap-traveler', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), null, true);
wp_enqueue_script('slimmenu', get_template_directory_uri() . '/js/slimmenu.js', array('jquery'), null, true);
wp_enqueue_script('bootstrap-datepicker.js', get_template_directory_uri() . '/js/bootstrap-datepicker.js', array('jquery'), null, true);
wp_enqueue_script('bootstrap-timepicker.js', get_template_directory_uri() . '/js/bootstrap-timepicker.js', array('jquery'), null, true);
wp_enqueue_script('ionrangeslider.js', get_template_directory_uri() . '/js/ionrangeslider.js', array('jquery'), null, true);
wp_enqueue_script('icheck.js', get_template_directory_uri() . '/js/icheck.js', array('jquery'), null, true);
wp_enqueue_script('fotorama.js', get_template_directory_uri() . '/js/fotorama.js', array('jquery'), null, true);
wp_register_script('handlebars-v2.0.0.js', get_template_directory_uri() . '/js/handlebars-v2.0.0.js', array(), null, true);
wp_enqueue_script('typeahead.js', get_template_directory_uri() . '/js/typeahead.js', array('jquery', 'handlebars-v2.0.0.js'), null, true);
wp_enqueue_script('magnific.js', get_template_directory_uri() . '/js/magnific.js', array('jquery'), null, true);
wp_enqueue_script('owl-carousel.js', get_template_directory_uri() . '/js/owl-carousel.js', array('jquery'), null, true);
if (is_page_template('template-commingsoon.php')) {
wp_enqueue_script('countdown.js', get_template_directory_uri() . '/js/countdown.js', array('jquery'), null, true);
}
wp_enqueue_script('modernizr', get_template_directory_uri() . '/js/modernizr.js', array('jquery'), null, true);
wp_register_script('gridrotator.js', get_template_directory_uri() . '/js/gridrotator.js', array('jquery'), null, true);
if (st_is_https()) {
wp_register_script('gmap-apiv3', 'https://maps.googleapis.com/maps/api/js?sensor=false', array(), null, true);
} else {
wp_register_script('gmap-apiv3', 'http://maps.googleapis.com/maps/api/js?sensor=false', array(), null, true);
}
wp_register_script('gmaplib', get_template_directory_uri() . '/js/gmap3.js', array('gmap-apiv3'), null, true);
wp_register_script('gmap-init', get_template_directory_uri() . '/js/init/gmap.init.js', array('gmaplib'), null, true);
wp_register_script('jquery.noty', get_template_directory_uri() . '/js/noty/packaged/jquery.noty.packaged.min.js', array('jquery'), null, true);
wp_register_script('st.noty', get_template_directory_uri() . '/js/init/class.notice.js', array('jquery', 'jquery.noty'), null, true);
if (is_singular()) {
wp_enqueue_script('gmap-init');
}
wp_enqueue_script('hotel-ajax', get_template_directory_uri() . '/js/init/hotel-ajax.js', array('jquery'), null, true);
wp_enqueue_script('booking_modal', get_template_directory_uri() . '/js/init/booking_modal.js', array('jquery'), null, true);
wp_enqueue_script('chosen.jquery', get_template_directory_uri() . '/js/chosen/chosen.jquery.min.js', array('jquery'), null, true);
wp_enqueue_script('st.noty');
/**
* @since 1.1.0
**/
if (get_post_type(get_the_ID()) == 'st_rental') {
wp_enqueue_script('rental-js', get_template_directory_uri() . '/js/init/rental-date-ajax.js', array('jquery'), '1.1.0', true);
}
/**
*@since 1.1.3
**/
if (get_post_type(get_the_ID()) == 'st_hotel' || is_singular('hotel_room')) {
wp_enqueue_script('hotel-js', get_template_directory_uri() . '/js/init/hotel-date-ajax.js', array('jquery'), '1.1.0', true);
}
wp_enqueue_script('custom.js', get_template_directory_uri() . '/js/custom.js', array('jquery'), null, true);
wp_enqueue_script('custom2.js', get_template_directory_uri() . '/js/custom2.js', array('jquery'), null, true);
wp_enqueue_script('user.js', get_template_directory_uri() . '/js/user.js', array('jquery'), null, true);
wp_enqueue_script('social-login.js', get_template_directory_uri() . '/js/init/social-login.js', array('jquery'), null, true);
if (st()->get_option('gen_enable_sticky_menu', 'off') == 'on') {
wp_enqueue_script('jquery-sticky', get_template_directory_uri() . '/js/sticky.js', array('jquery'), null, true);
}
if (is_page_template('template-checkout.php')) {
wp_enqueue_script('checkout-js', get_template_directory_uri() . '/js/init/template-checkout.js', array('jquery'), null, true);
}
wp_localize_script('jquery', 'st_checkout_text', array('without_pp' => __('Submit Request', ST_TEXTDOMAIN), 'with_pp' => __('Booking Now', ST_TEXTDOMAIN), 'validate_form' => __('Please fill all required fields', ST_TEXTDOMAIN), 'error_accept_term' => __('Please accept our terms and conditions', ST_TEXTDOMAIN)));
wp_localize_script('jquery', 'st_params', array('theme_url' => get_template_directory_uri(), 'site_url' => site_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'loading_url' => admin_url('/images/wpspin_light.gif'), 'st_search_nonce' => wp_create_nonce("st_search_security"), 'facebook_enable' => st()->get_option('social_fb_login', 'on'), 'facbook_app_id' => st()->get_option('social_fb_app_id'), 'booking_currency_precision' => st()->get_option('booking_currency_precision', 2), 'thousand_separator' => st()->get_option('thousand_separator', '.'), 'decimal_separator' => st()->get_option('decimal_separator', ','), 'currency_symbol' => TravelHelper::get_current_currency('symbol'), 'currency_position' => st()->get_option('booking_currency_pos'), 'free_text' => __('Free', ST_TEXTDOMAIN)));
if (st()->get_option('social_fb_login', 'on')) {
//wp_enqueue_script('st-facebook',get_template_directory_uri().'/js/init/facebook.js',null,true);
}
//Allow turn on nicescroll
if (st()->get_option('gen_enable_smscroll', 'off') == 'on') {
wp_enqueue_script('nicescroll.js', get_template_directory_uri() . '/js/nicescroll.js', array('jquery'), null, true);
}
wp_enqueue_style('bootstrap.css', get_template_directory_uri() . '/css/bootstrap.css');
wp_enqueue_style('animate.css', get_template_directory_uri() . '/css/animate.css');
wp_enqueue_style('font-awesome.css', get_template_directory_uri() . '/css/font-awesome.css');
if (st_is_https()) {
wp_enqueue_style('roboto-font', 'https://fonts.googleapis.com/css?family=Roboto:500,700,400,300,100');
} else {
wp_enqueue_style('roboto-font', 'http://fonts.googleapis.com/css?family=Roboto:500,700,400,300,100');
}
if (is_page_template('template-user.php')) {
wp_enqueue_style('jquery.jqplot.min.css', get_template_directory_uri() . '/js/jqplot/js/jquery.jqplot.min.css');
wp_enqueue_style('shCoreDefault.min.css', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/styles/shCoreDefault.min.css');
wp_enqueue_style('shThemejqPlot.min.css', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/styles/shThemejqPlot.min.css');
wp_enqueue_script('jquery.jqplot.min.js', get_template_directory_uri() . '/js/jqplot/js/jquery.jqplot.js', array('jquery'), null, true);
wp_enqueue_script('shCore.min.js', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/scripts/shCore.min.js', array('jquery'), null, true);
wp_enqueue_script('shBrushJScript.min.js', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/scripts/shBrushJScript.min.js', array('jquery'), null, true);
wp_enqueue_script('shBrushXml.min.js', get_template_directory_uri() . '/js/jqplot/syntaxhighlighter/scripts/shBrushXml.min.js', array('jquery'), null, true);
wp_enqueue_script('jqplot.barRenderer.min.js', get_template_directory_uri() . '/js/jqplot/plugins/jqplot.barRenderer.min.js', array('jquery'), null, true);
wp_enqueue_script('jqplot.categoryAxisRenderer.min.js', get_template_directory_uri() . '/js/jqplot/plugins/jqplot.categoryAxisRenderer.js', array('jquery'), null, true);
wp_enqueue_script('jqplot.pointLabels.min.js', get_template_directory_uri() . '/js/jqplot/plugins/jqplot.pointLabels.min.js', array('jquery'), null, true);
wp_enqueue_script('jqplot.cursor.min', get_template_directory_uri() . '/js/jqplot/js/jqplot.cursor.min.js', array('jquery'), null, true);
}
wp_enqueue_style('icomoon.css', get_template_directory_uri() . '/css/icomoon.css');
wp_enqueue_style('weather-icons.css', get_template_directory_uri() . '/css/weather-icons.min.css');
wp_enqueue_style('styles.css', get_template_directory_uri() . '/css/styles.css');
wp_enqueue_style('mystyles.css', get_template_directory_uri() . '/css/mystyles.css');
wp_enqueue_style('tooltip-classic.css', get_template_directory_uri() . '/css/tooltip-classic.css');
wp_enqueue_style('chosen-css', get_template_directory_uri() . '/js/chosen/chosen.min.css');
wp_enqueue_style('default-style', get_stylesheet_uri());
wp_enqueue_style('custom.css', get_template_directory_uri() . '/css/custom.css');
wp_enqueue_style('custom2css', get_template_directory_uri() . '/css/custom2.css');
//.........这里部分代码省略.........
示例14: booking_form_submit
static function booking_form_submit($item_id = '')
{
if (STInput::post('st_payment_gateway') and wp_verify_nonce(STInput::post('travel_order'), 'submit_form_order')) {
$first_item_id = self::get_booking_id();
// All gateway available
$gateways = STPaymentGateways::get_payment_gateways();
if (empty($gateways)) {
return array('status' => false, 'message' => __('Sorry! No payment gateway available', ST_TEXTDOMAIN));
}
$payment_gateway_used = false;
$payment_gateway_id = false;
if (!empty($gateways)) {
foreach ($gateways as $key => $value) {
if (STInput::post('st_payment_gateway_' . $key)) {
$payment_gateway_id = $key;
$payment_gateway_used = STPaymentGateways::get_gateway($payment_gateway_id, $first_item_id);
}
}
}
if (!$payment_gateway_id or !$payment_gateway_used) {
$payment_gateway_name = apply_filters('st_payment_gateway_' . $payment_gateway_id . '_name', $payment_gateway_id);
return array('status' => false, 'message' => sprintf(__('Sorry! Payment Gateway: <code>%s</code> is not available for this item!', ST_TEXTDOMAIN), $payment_gateway_name));
}
// Action before submit form
do_action('st_before_form_submit_run');
$form_validate = true;
if (!self::check_cart()) {
return array('status' => false, 'message' => __('Your cart is currently empty.', ST_TEXTDOMAIN), 'code' => '1');
}
if ($coupon_code = STInput::request('coupon_code')) {
$status = self::do_apply_coupon($coupon_code);
if (!$status['status']) {
return array('status' => false, 'message' => $status['message']);
}
}
if (st()->get_option('booking_enable_captcha', 'on') == 'on') {
$st_security_key = STInput::request('st_security_key');
$allow_captcha = STInput::request('allow_capcha', 'off');
if ($allow_captcha == 'off') {
if (!$st_security_key) {
return array('status' => false, 'message' => __('You dose not enter the captcha', ST_TEXTDOMAIN));
}
$valid = STCoolCaptcha::validate_captcha($st_security_key);
if (!$valid) {
return array('status' => false, 'message' => __('Captcha is not correct', ST_TEXTDOMAIN), 'error_code' => 'invalid_captcha');
}
}
}
$default = array('st_note' => '', 'term_condition' => '', 'create_account' => false, 'paypal_checkout' => false);
extract(wp_parse_args($_POST, $default));
//Term and condition
if (!$term_condition) {
return array('status' => false, 'message' => __('Please accept our terms and conditions', ST_TEXTDOMAIN));
}
$form_validate = self::validate_checkout_fields();
if ($form_validate) {
$form_validate = $payment_gateway_used->_pre_checkout_validate();
}
if (!$form_validate) {
$message = array('status' => false, 'message' => STTemplate::get_message_content(), 'form_validate' => 'false');
STTemplate::clear();
return $message;
}
$post = array('post_title' => __('Order', ST_TEXTDOMAIN) . ' - ' . date(get_option('date_format')) . ' @ ' . date(get_option('time_format')), 'post_type' => 'st_order', 'post_status' => 'publish');
$data_price = STPrice::getDataPrice();
//save the order
$insert_post = wp_insert_post($post);
if ($insert_post) {
$cart = self::get_items();
$fields = self::get_checkout_fields();
if (!empty($fields)) {
foreach ($fields as $key => $value) {
update_post_meta($insert_post, $key, STInput::post($key));
}
}
update_post_meta($insert_post, 'st_tax', STPrice::getTax());
update_post_meta($insert_post, 'st_tax_percent', STPrice::getTax());
update_post_meta($insert_post, 'st_is_tax_included_listing_page', STCart::is_tax_included_listing_page() ? 'on' : 'off');
update_post_meta($insert_post, 'currency', TravelHelper::get_current_currency('symbol'));
update_post_meta($insert_post, 'currency_rate', TravelHelper::get_current_currency('rate'));
update_post_meta($insert_post, 'coupon_code', STCart::get_coupon_code());
update_post_meta($insert_post, 'coupon_amount', STCart::get_coupon_amount());
update_post_meta($insert_post, 'status', 'pending');
update_post_meta($insert_post, 'st_cart_info', $cart);
update_post_meta($insert_post, 'total_price', STPrice::getTotal());
update_post_meta($insert_post, 'ip_address', STInput::ip_address());
update_post_meta($insert_post, 'order_token_code', wp_hash($insert_post));
update_post_meta($insert_post, 'data_prices', $data_price);
update_post_meta($insert_post, 'booking_by', STInput::post('booking_by', ''));
self::saveOrderItems($insert_post);
if (!is_user_logged_in()) {
$user_name = STInput::post('st_email');
$user_id = username_exists($user_name);
//Now Create Account if user agree
if ($create_account) {
if (!$user_id and email_exists($user_name) == false) {
$random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
$userdata = array('user_login' => $user_name, 'user_pass' => $random_password, 'user_email' => $user_name, 'first_name' => STInput::post('st_first_name'), 'last_name' => STInput::post('st_last_name'));
$user_id = wp_insert_user($userdata);
//Create User Success, send the nofitication
//.........这里部分代码省略.........