CO2 Reduktion / Icon Wir reduzieren CO2
Rechtsfraagen IconAbmahnung? Nicht mit uns!
Newsletter IconAnmeldung zum Newsletter
Nach oben scrollen

RANS-WEG-TEST-DUPLICATSFINDER HOTELPLUGIN

gdlr-booking-item.php.9304.orig
‘;
$ret .= ‘

‘ . __(‘1. Choose Date’, ‘gdlr-hotel’) . ‘

‘;
$ret .= ‘

‘ . __(‘2. Choose Room’, ‘gdlr-hotel’) . ‘

‘;
$ret .= ‘

‘ . __(‘3. Make a Reservation’, ‘gdlr-hotel’) . ‘

‘;
$ret .= ‘

‘ . __(‘4. Confirmation’, ‘gdlr-hotel’) . ‘

‘;
$ret .= ‘

‘;
return $ret;
}
}

if( !function_exists(‘gdlr_booking_date_range’) ){
function gdlr_booking_date_range( $state = 1 ){
global $theme_option, $hotel_option;
?>

>

‘;
$ret[‘content’] .= ‘

‘ . __(‘Date field invalid’, ‘gdlr-hotel’) . ‘

‘;
$ret[‘content’] .= ‘

‘ . __(‘Please select \’check in\’ and \’check out\’ date from reservation bar again.’, ‘gdlr-hotel’) . ‘

‘;
$ret[‘content’] .= ‘

‘;
}else if( $data[‘gdlr-room-number’] > $room_number ){
$ret[‘content’] = gdlr_get_booking_room_query($data, $room_number);
}else{
$data[‘gdlr-hotel-branches’] = empty($data[‘gdlr-hotel-branches’])? ”: $data[‘gdlr-hotel-branches’];
$ret[‘content’] = ‘

‘;
$ret[‘content’] .= ‘

‘ . __(‘Room Selection is Complete’, ‘gdlr-hotel’) . ‘

‘;
$ret[‘content’] .= ‘

‘ . __(‘You can edit your booking by using the panel on the left’, ‘gdlr-hotel’) . ‘

‘;
$ret[‘content’] .= gdlr_get_booking_services($data[‘gdlr-hotel-branches’], $data[‘service’]);
$ret[‘content’] .= ‘

‘;
$ret[‘content’] .= ‘‘ . __(‘Go to next step’, ‘gdlr-hotel’) . ‘‘;
$ret[‘content’] .= ‘

‘;
}

$ret[‘state’] = 2;
}else if( $_POST[‘state’] == 3 ){
if( !empty($data[‘service’]) ){
$ret[‘service’] = ”;
foreach( $data[‘service’] as $key => $service_id ){
$ret[‘service’] .= ‘‘;
$ret[‘service’] .= ‘‘;
}
}

if( empty($_POST[‘contact’]) ){
$ret[‘summary_form’] = gdlr_get_summary_form($data);
$ret[‘content’] = gdlr_get_booking_contact_form();
$ret[‘state’] = 3;
}else{
$validate = gdlr_validate_contact_form($contact);

if( !empty($validate) ){
$ret[‘state’] = 3;
$ret[‘error_message’] = $validate;
}else{
$ret[‘summary_form’] = gdlr_get_summary_form($data, false, $contact[‘coupon’]);

if( $_POST[‘contact_type’] == ‘contact’ ){
$contact[‘payment-method’] = ’email’;
$booking = gdlr_insert_booking_db(array(‘data’=>$data, ‘contact’=>$contact, ‘payment_status’=>’booking’));

global $hotel_option;

$mail_content = gdlr_hotel_mail_content( $contact, $data, array(), array(
‘total_price’=>$booking[‘total-price’], ‘pay_amount’=>0, ‘booking_code’=>$booking[‘code’]
// 93.0.4
, ‘taxe’=>$booking[‘taxe’], ‘reinigung’=>$booking[‘reinigung’]
)
);
gdlr_hotel_mail($contact[’email’], __(‘Thank you for booking the room with us.’, ‘gdlr-hotel’), $mail_content);
gdlr_hotel_mail($hotel_option[‘recipient-mail’], __(‘New room booking received’, ‘gdlr-hotel’), $mail_content, $contact[’email’]);

$ret[‘content’] = gdlr_booking_complete_message();
$ret[‘state’] = 4;
}else{
global $hotel_option;
$booking = gdlr_insert_booking_db(array(‘data’=>$data, ‘contact’=>$contact, ‘payment_status’=>’pending’));

if( intval($booking[‘total-price’]) == 0 ){
$mail_content = gdlr_hotel_mail_content( $contact, $data, array(), array(
‘total_price’=>$booking[‘total-price’], ‘pay_amount’=>0, ‘booking_code’=>$booking[‘code’]
// 93.0.4
, ‘taxe’=>$booking[‘taxe’], ‘reinigung’=>$booking[‘reinigung’]
)
);
gdlr_hotel_mail($contact[’email’], __(‘Thank you for booking the room with us.’, ‘gdlr-hotel’), $mail_content);
gdlr_hotel_mail($hotel_option[‘recipient-mail’], __(‘New room booking received’, ‘gdlr-hotel’), $mail_content, $contact[’email’]);

$ret[‘content’] = gdlr_booking_complete_message();
$ret[‘state’] = 4;
}else if( $contact[‘payment-method’] == ‘paypal’ ){
$ret[‘payment’] = ‘paypal’;
$ret[‘payment_url’] = $hotel_option[‘paypal-action-url’];
$ret[‘addition_part’] = gdlr_additional_paypal_part(array(
‘title’ => __(‘Room Booking’, ‘gdlr-hotel’),
‘invoice’ => $booking[‘invoice’],
‘price’ => $booking[‘pay-amount’],
‘branches’ => empty($data[‘gdlr-hotel-branches’])? ”: $data[‘gdlr-hotel-branches’]
));
$ret[‘state’] = 3;
}else if( $contact[‘payment-method’] == ‘stripe’ ){
$ret[‘content’] = gdlr_get_stripe_form(array(
‘invoice’ => $booking[‘invoice’]
));
$ret[‘state’] = 3;
}else if( $contact[‘payment-method’] == ‘paymill’ ){
$ret[‘content’] = gdlr_get_paymill_form(array(
‘invoice’ => $booking[‘invoice’]
));
$ret[‘state’] = 3;
}else if( $contact[‘payment-method’] == ‘authorize’ ){
$ret[‘content’] = gdlr_get_authorize_form(array(
‘invoice’ => $booking[‘invoice’],
‘price’ => $booking[‘pay-amount’]
));
$ret[‘state’] = 3;
}
}
}
}
}

if( !empty($data) ){
$ret[‘data’] = $data;
}

die(json_encode($ret));
}
}

// check if every room is selected.
if( !function_exists(‘gdlr_get_edited_room’) ){
function gdlr_get_edited_room($max_room = 0, $rooms = array()){
for( $i=0; $i<$max_room; $i++ ){ if( empty($rooms[$i]) ) return $i; } return $max_room; } } // booking room style if( !function_exists('gdlr_get_booking_room_query') ){ function gdlr_get_booking_room_query($data, $room_number){ global $wpdb, $hotel_option, $sitepress; $minimum_night = empty($hotel_option['minimum-night'])? 1: intval($hotel_option['minimum-night']); if( $data['gdlr-night'] < $minimum_night ){ $ret = '

‘;
$ret .= ‘‘;
$ret .= sprintf(__(‘A minimum stay of %d consecutive nights is required’, ‘gdlr-hotel’), $minimum_night);
$ret .= ‘

‘;
return $ret;
}else if( $data[‘gdlr-check-in’] == $data[‘gdlr-check-out’] ){
$ret = ‘

‘;
$ret .= ‘‘;
$ret .= __(‘Invalid check out date, please enter correct value to proceed’, ‘gdlr-hotel’);
$ret .= ‘

‘;
return $ret;
}

$num_people = intval($data[‘gdlr-adult-number’][$room_number]) + intval($data[‘gdlr-children-number’][$room_number])
// 93.0.4
+ intval($data[‘gdlr-children-number2’][$room_number]) + intval($data[‘gdlr-children-number3’][$room_number])
;
$hotel_option[‘preserve-booking-room’] = empty($hotel_option[‘preserve-booking-room’])? ‘paid’: $hotel_option[‘preserve-booking-room’];

// collect the previously selected room
$rooms = array();
$room_temp = array();
if( !empty($data[‘gdlr-room-id’]) ){
foreach( $data[‘gdlr-room-id’] as $selected_room_id ){

// polylang is enable
if( function_exists(‘pll_get_post_translations’) ){
$pll_translations = pll_get_post_translations($selected_room_id);
if( empty($pll_translations) ){
$room_temp[$selected_room_id] = empty($room_temp[$selected_room_id])? 1: $room_temp[$selected_room_id] + 1;
}else{
foreach( $pll_translations as $translation ){
$room_temp[$translation] = empty($room_temp[$translation])? 1: $room_temp[$translation] + 1;
}
}

// wpml is enable
}else if( !empty($sitepress) ){
$trid = $sitepress->get_element_trid($selected_room_id, ‘post_room’);
$translations = $sitepress->get_element_translations($trid,’post_room’);
if( empty($translations) ){
$room_temp[$selected_room_id] = empty($room_temp[$selected_room_id])? 1: $room_temp[$selected_room_id] + 1;
}else{
foreach( $translations as $translation ){
$room_temp[$translation->element_id] = empty($room_temp[$translation->element_id])? 1: $room_temp[$translation->element_id] + 1;
}
}

// no wpml
}else{
$room_temp[$selected_room_id] = empty($room_temp[$selected_room_id])? 1: $room_temp[$selected_room_id] + 1;
}
}
}

// select all room id where max people > selected people
$sql = “SELECT DISTINCT wpostmeta.post_id FROM {$wpdb->postmeta} wpostmeta “;
if( !empty($data[‘gdlr-hotel-branches’]) ){
$sql .= “LEFT JOIN {$wpdb->term_relationships} ON (wpostmeta.post_id = {$wpdb->term_relationships}.object_id) “;
$sql .= “LEFT JOIN {$wpdb->term_taxonomy} ON ({$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id) “;
}
$sql .= “WHERE wpostmeta.meta_key = ‘gdlr_max_people’ AND wpostmeta.meta_value >= {$num_people} “;
if( !empty($data[‘gdlr-hotel-branches’]) ){
$sql .= “AND {$wpdb->term_taxonomy}.taxonomy = ‘room_category’ “;
$sql .= “AND {$wpdb->term_taxonomy}.term_id = {$data[‘gdlr-hotel-branches’]} “;
}
$sql .= “ORDER BY post_id DESC”;
$room_query = $wpdb->get_results($sql, OBJECT);

// get data with false value filled
$all_date = gdlr_split_date($data[‘gdlr-check-in’], $data[‘gdlr-check-out’]);

// check if the date is blocked
$blocked_date = ”;
$hotel_option[‘block-date’] = empty($hotel_option[‘block-date’])? ”: $hotel_option[‘block-date’];
foreach($all_date as $key => $val){
if( gdlr_is_ss($key, array(‘date’=>$hotel_option[‘block-date’])) ){
$blocked_date .= empty($blocked_date)? ”:’, ‘;
$blocked_date .= gdlr_hotel_date_format($key);
}
}

if( !empty($blocked_date) ){
$ret = ‘

‘;
$ret .= ‘‘;
$ret .= __(‘Sorry, our hotel is closed on these following dates :’, ‘gdlr-hotel’);
$ret .= ‘
‘ . $blocked_date . ‘‘;
$ret .= ‘

‘;
return $ret;
}

// check if each room is available
foreach($room_query as $room){

// if single block room
$block_room = get_post_meta($room->post_id, ‘gdlr_block_date’, true);
if( !empty($block_room) ){
foreach($all_date as $key => $val){
if( gdlr_is_ss($key, array(‘date’=>$block_room)) ){
continue 2;
}
}
}

$avail_num = intval(get_post_meta($room->post_id, ‘gdlr_room_amount’, true));

// check ical
if( $avail_num == 1 ){
$ical_booked = gdlr_hotel_ical_booked($room->post_id, $data[‘gdlr-check-in’], $data[‘gdlr-check-out’]);
if( $ical_booked ){
continue;
}
}

if( !empty($room_temp[$room->post_id]) ){ $avail_num = $avail_num – $room_temp[$room->post_id]; }

$sql = “SELECT COUNT(*) “;
$sql .= “FROM {$wpdb->prefix}gdlr_hotel_booking, {$wpdb->prefix}gdlr_hotel_payment WHERE “;

// polylang is enable
if( function_exists(‘pll_get_post_translations’) ){
$count = 0;
$pll_translations = pll_get_post_translations($room->post_id);
if( !empty($pll_translations) ){
$sql .= “(“;
foreach( $pll_translations as $translation ){ $count++;
$sql .= ($count > 1)? ‘OR ‘: ”;
$sql .= “{$wpdb->prefix}gdlr_hotel_booking.room_id = {$translation} “;
}
$sql .= “) AND “;
}else{
$sql .= “{$wpdb->prefix}gdlr_hotel_booking.room_id = {$room->post_id} AND “;
}

// for wpml where room_id = $room
}else if( !empty($sitepress) ){
$count = 0;
$trid = $sitepress->get_element_trid($room->post_id, ‘post_room’);
$translations = $sitepress->get_element_translations($trid,’post_room’);

if( !empty($translations) ){
$sql .= “(“;
foreach( $translations as $translation ){ $count++;
$sql .= ($count > 1)? ‘OR ‘: ”;
$sql .= “{$wpdb->prefix}gdlr_hotel_booking.room_id = {$translation->element_id} “;
}
$sql .= “) AND “;
}else{
$sql .= “{$wpdb->prefix}gdlr_hotel_booking.room_id = {$room->post_id} AND “;
}
}else{
$sql .= “{$wpdb->prefix}gdlr_hotel_booking.room_id = {$room->post_id} AND “;
}

// where payment_status = selected_status
$sql .= “{$wpdb->prefix}gdlr_hotel_payment.id = {$wpdb->prefix}gdlr_hotel_booking.payment_id AND “;
if( $hotel_option[‘preserve-booking-room’] == ‘paid’ ){
$sql .= “{$wpdb->prefix}gdlr_hotel_payment.payment_status = ‘paid’ AND “;
}else{
$sql .= “{$wpdb->prefix}gdlr_hotel_payment.payment_status != ‘pending’ AND “;
}

// where date within
$room_free = true;
foreach($all_date as $key => $val){
$temp_sql = $sql . “(start_date <= '{$key}' AND end_date > ‘{$key}’)”;
if($avail_num <= $wpdb->get_var($temp_sql)){
$room_free = false;
}else{
$all_date[$key] = true;
}
}
if( $room_free ){
$rooms[] = $room->post_id;

// polylang is enable
if( function_exists(‘pll_get_post_translations’) ){
$pll_translations = pll_get_post_translations($room->post_id);
foreach( $pll_translations as $translation ){
$rooms[] = $translation;
}

// for wpml
}else if( !empty($sitepress) ){
$trid = $sitepress->get_element_trid($room->post_id, ‘post_room’);
$translations = $sitepress->get_element_translations($trid,’post_room’);
foreach( $translations as $translation ){
$rooms[] = $translation->element_id;
}
}
}
}

// query available room to print out
if( !empty($rooms) ){

// move single room to first
if( !empty($_POST[‘single-room’]) ){
foreach($rooms as $key => $value){
if($value == $_POST[‘single-room’]){
unset($rooms[$key]);
array_unshift($rooms, $_POST[‘single-room’]);
}
}
}

$paged = empty($_POST[‘paged’])? 1: $_POST[‘paged’];
$args = array(
‘post_type’=>’room’,
‘post__in’ => $rooms,
‘posts_per_page’=>$hotel_option[‘booking-num-fetch’],
‘paged’ => $paged,
‘post_status’ => array(‘publish’),
‘orderby’ => ‘post__in’,
‘order’ => ‘asc’
);
if( !empty($data[‘gdlr-hotel-branches’]) ){
$args[‘tax_query’] = array(array(
‘taxonomy’ => ‘room_category’,
‘field’ => ‘id’,
‘terms’ => intval($data[‘gdlr-hotel-branches’])
));
}
$query = new WP_Query($args);

if( empty($query->posts) ){
$ret = ‘

‘;
$ret .= ‘‘;
$ret .= __(‘Sorry, there\’re no room available within selected dates.’, ‘gdlr-hotel’);
$ret .= ‘

‘;

return $ret;
}else{
return gdlr_get_booking_room($query, array(
‘check-in’=> $data[‘gdlr-check-in’],
‘check-out’=> $data[‘gdlr-check-out’],
‘adult’=> $data[‘gdlr-adult-number’][$room_number],
‘children’=> $data[‘gdlr-children-number’][$room_number],
// 93.0.4
‘children2’=> $data[‘gdlr-children-number2’][$room_number],
‘children3’=> $data[‘gdlr-children-number3’][$room_number],
‘gdlr-night’=> $data[‘gdlr-night’]
)) . gdlr_get_ajax_pagination($query->max_num_pages, $paged);
}

// room not available
}else{
$no_room_text = ”;
foreach($all_date as $key => $val){
$no_room_text .= empty($no_room_text)? ”: ‘, ‘;
$no_room_text .= (!$val)? $key: ”;
}

$ret = ‘

‘;
$ret .= ‘‘;
if( !empty($no_room_text) ){
$ret .= __(‘Sorry, there\’re no room available in these following dates :’, ‘gdlr-hotel’);
$ret .= ‘
‘ . $no_room_text . ‘‘;
}else{
$ret .= __(‘Sorry, there\’re no room available within selected dates.’, ‘gdlr-hotel’);
}
$ret .= ‘

‘;

return $ret;
}
}
}
if( !function_exists(‘gdlr_get_booking_room’) ){
function gdlr_get_booking_room($query, $data){
global $hotel_option;
global $gdlr_excerpt_length, $gdlr_excerpt_read_more;
$gdlr_excerpt_read_more = false;
$gdlr_excerpt_length = $hotel_option[‘booking-num-excerpt’];
add_filter(‘excerpt_length’, ‘gdlr_set_excerpt_length’);

$room_style = empty($hotel_option[‘booking-item-style’])? ‘medium’: $hotel_option[‘booking-item-style’];
$extra_class = ($room_style == ‘medium-new’)? ‘gdlr-medium-room-new’: ”;

$ret = ‘

‘;
while($query->have_posts()){ $query->the_post();
$room_id = get_the_ID();
$post_option = json_decode(gdlr_decode_preventslashes(get_post_meta($room_id, ‘post-option’, true)), true);
$post_option[‘data’] = $data;

$ret .= ‘

‘;
$ret .= ‘

‘;
$ret .= ‘

‘ . gdlr_get_room_thumbnail($post_option, $hotel_option[‘booking-thumbnail-size’]) . ‘

‘;
$ret .= ‘

‘;
$ret .= ‘

‘ . get_the_title() . ‘

‘;
if( $room_style == ‘medium-new’ ){
$ret .= gdlr_hotel_room_info($post_option, array(‘bed’, ‘max-people’, ‘view’, ‘wifi’), true, ‘new-style’);
}else{
if( !empty($hotel_option[‘enable-hotel-branch’]) && $hotel_option[‘enable-hotel-branch’] == ‘enable’ ){
$terms = get_the_terms($room_id, ‘room_category’);
$ret .= ‘

‘;
foreach( $terms as $term ){
$ret .= ‘,‘ . $term->name;
}
$ret .= ‘

‘;
}
$ret .= gdlr_hotel_room_info($post_option, array(‘bed’, ‘max-people’, ‘view’));
}
$ret .= ‘

‘ . get_the_excerpt() . ‘

‘;
$ret .= ‘‘ . __(‘Select this room’, ‘gdlr-hotel’) . ‘‘;
$ret .= gdlr_hotel_room_info($post_option, array(‘price-break-down’), false);
$ret .= ‘

‘;
$ret .= ‘

‘;
$ret .= ‘

‘;
$ret .= ‘

‘; // gdlr-ux
$ret .= ‘

‘; // gdlr-item
}
$ret .= ‘

‘;
$ret .= ‘

‘;
wp_reset_postdata();

$gdlr_excerpt_read_more = true;
remove_filter(‘excerpt_length’, ‘gdlr_set_excerpt_length’);

return $ret;
}
}

if( !function_exists(‘gdlr_get_booking_services’) ){
function gdlr_get_booking_services($branches, $selected_service){
global $hotel_option, $wpdb;

// get every available services
$services = array();
$args = array(
‘post_type’=>’service’,
‘posts_per_page’=>99
);

if( !empty($branches) ){
$args[‘meta_query’] = array(
array(
‘key’ => ‘gdlr-branches’,
‘value’ => $branches,
‘compare’ => ‘LIKE’
)
);
}

$query = new WP_Query($args);
foreach( $query->posts as $post ){
$services[] = $post->ID;
}

if( empty($services) ) return;

ob_start();
?>

‘;
if( !empty($option[‘service-type’]) && $option[‘service-type’] == ‘regular-service’ &&
!empty($option[‘always-enable’]) && $option[‘always-enable’] == ‘enable’ ){

echo ‘‘;
}else{
echo ‘‘;
}
echo ‘‘ . get_the_title($service) . ‘‘;

if( $option[‘service-type’] == ‘parking-service’ && $option[‘car’] == ‘car’ ){
echo ‘‘;
echo ‘‘;
if( !empty($option[‘car-unit’]) ){
echo strtolower($option[‘car-unit’]);
}else{
echo __(‘Cars’, ‘gdlr-hotel’);
}
echo ‘
‘;
}else{
echo ‘‘;
}

echo ‘‘;
echo gdlr_hotel_money_format($option[‘price’]);
echo ‘/‘;
if( $option[‘service-type’] == ‘regular-service’ ){
echo $words[$option[‘per’]];
}else if( $option[‘service-type’] == ‘parking-service’ ){
if( !empty($option[‘car-unit’]) ){
echo $option[‘car-unit’];
}else{
echo $words[$option[‘car’]];
}
}
echo ‘/‘;
echo $words[$option[‘unit’]];
echo ‘
‘;
echo ‘

‘;
}
?>








‘;
echo ‘‘;
echo sprintf(__(‘I agree to terms & conditions‘, ‘gdlr-hotel’), $condition_page);
echo ‘

‘;
}
?>



Buchung korrigieren

‘ . __(‘Or’, ‘gdlr-hotel’);
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;

if( empty($hotel_option[‘instant-payment-method’]) ){
$hotel_option[‘instant-payment-method’] = array(‘paypal’, ‘stripe’, ‘paymill’, ‘authorize’);
}

if( sizeof($hotel_option[‘instant-payment-method’]) > 1 ){
echo ‘

‘;
foreach( $hotel_option[‘instant-payment-method’] as $key => $payment_method ){
echo ‘‘;
}
echo ‘

‘;
}else{
echo ‘‘;
}
echo ‘‘ . __(‘Pay Now’, ‘gdlr-hotel’) . ‘‘;
}
?>

‘;
$ret .= ‘

‘;
$ret .= __(‘Payment Failed’, ‘gdlr-hotel’);
$ret .= ‘

‘;

$ret .= ‘

‘;
$ret .= ‘‘ . $_GET[‘response_code’] . ‘ ‘;
$ret .= $_GET[‘response_reason_text’];
$ret .= ‘

‘;
$ret .= ‘

‘;
}else{
$ret = ‘

‘;
$ret .= ‘

‘;
$ret .= __(‘Reservation Completed!’, ‘gdlr-hotel’);
$ret .= ‘

‘;

$ret .= ‘

‘;
$ret .= __(‘Your reservation details have just been sent to your email. If you have any question, please don\’t hesitate to contact us. Thank you!’, ‘gdlr-hotel’);
$ret .= ‘

‘;

if( !empty($hotel_option[‘booking-complete-contact’]) ){
$ret .= ‘

‘ . gdlr_escape_string($hotel_option[‘booking-complete-contact’]) . ‘

‘;
}
}
$ret .= ‘

‘;
return $ret;
}
}

?>