Example #1
0
 function bookingwp_email_strings()
 {
     $name = 'bookingwp-quoted-subject';
     $string = booking_get_option('bookingwp_quoted_email_subject');
     $group = 'bookingwp';
     $multiline = true;
     pll_register_string($name, $string, $group, $multiline);
     $name = 'bookingwp-quoted';
     $string = booking_get_option('bookingwp_quoted_email');
     $group = 'bookingwp';
     $multiline = true;
     pll_register_string($name, $string, $group, $multiline);
     $name = 'bookingwp-refused-subject';
     $string = booking_get_option('bookingwp_refused_email_subject');
     $group = 'bookingwp';
     $multiline = true;
     pll_register_string($name, $string, $group, $multiline);
     $name = 'bookingwp-refused';
     $string = booking_get_option('bookingwp_refused_email');
     $group = 'bookingwp';
     $multiline = true;
     pll_register_string($name, $string, $group, $multiline);
     $name = 'bookingwp-confirmed-email-subject';
     $string = booking_get_option('bookingwp_confirmed_email_subject');
     $group = 'bookingwp';
     $multiline = true;
     pll_register_string($name, $string, $group, $multiline);
     $name = 'bookingwp-confirmed';
     $string = booking_get_option('bookingwp_confirmed_email');
     $group = 'bookingwp';
     $multiline = true;
     pll_register_string($name, $string, $group, $multiline);
     $name = 'bookingwp-confirm-button';
     $string = booking_get_option('bookingwp_confirm_button');
     $group = 'bookingwp';
     $multiline = true;
     pll_register_string($name, $string, $group, $multiline);
     $name = 'bookingwp-cancellation-policy';
     $string = booking_get_option('bookingwp_cancellation_policy');
     $group = 'bookingwp';
     $multiline = true;
     pll_register_string($name, $string, $group, $multiline);
 }
Example #2
0
</h5>
        <small><?php 
_e('Pay the entire amount of your booking using Paypal with your credit card. The room wil be instantly booked and a voucher will be sent to you.', 'bookingwp');
?>
</small>
        <img class="img-responsive" src="<?php 
bloginfo('template_url');
?>
/assets/images/accepted_c22e0.png" />
    </div>
    <div class="panel-body">
      <!-- PAYPAL FORM STARTS HERE -->
      <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="cmd" value="_xclick">
        <input type="hidden" name="business" value="<?php 
echo booking_get_option('bookingwp_paypal_email');
?>
">
        <input type="hidden" name="item_name" value="booking <?php 
echo get_the_title($room_id);
?>
 <?php 
echo date('d/m/Y', $checkin);
?>
 - <?php 
echo date('d/m/Y', $checkout);
?>
">
        <input type="hidden" name="item_number" value="<?php 
echo $token;
?>
Example #3
0
 $price = get_post_meta($bid, 'price', true);
 $room = get_post_meta($bid, 'room', true);
 $adults = get_post_meta($bid, 'adults', true);
 $children = get_post_meta($bid, 'children', true);
 $message = get_post_meta($bid, 'message', true);
 $token = get_post_meta($bid, 'token', true);
 $lang = get_post_meta($bid, 'lang', true);
 $address = get_post_meta($bid, 'email', true);
 $from = mytheme_get_option('place_name') . ' <' . $address . '>';
 $email_bcc = get_bloginfo('admin_email');
 $e_subject = sprintf(pll_translate_string(booking_get_option('bookingwp_confirmed_email_subject'), $lang), $name);
 // Configuration option.
 $request_language = $lang;
 $intro_text = sprintf(pll_translate_string(booking_get_option('bookingwp_confirmed_email'), $request_language), $name);
 $reservation_details = booking_details($bid);
 $cancellation_policy = sprintf(pll_translate_string(booking_get_option('bookingwp_cancellation_policy'), $request_language), $name);
 $email_content = $intro_text;
 $email_content .= $reservation_details;
 $email_content .= "<hr/>" . PHP_EOL . PHP_EOL;
 $email_content .= "<h5>Cancellation Policy</h5><small>" . $cancellation_policy . "</small>";
 $msg = wordwrap($e_body, 70);
 $e_body = build_email($email_content);
 $headers[] = "From: {$from}" . PHP_EOL;
 $headers[] = "Bcc: {$email_bcc}" . PHP_EOL;
 //customer voucher
 wp_mail($address, $e_subject, $e_body, $headers);
 //admin card
 $owner_subject = __('Conferma Prenotazione #', 'wpbooking') . $bid;
 $owner_address = mytheme_get_option('email');
 $from = mytheme_get_option('place_name') . ' <' . $address . '>';
 $email_content_owner = "<b>Card:</b> {$encrypted}<br />";
Example #4
0
function send_confirmation($bid)
{
    $name = get_post_meta($bid, 'name', true);
    $email = get_post_meta($bid, 'email', true);
    $phone = get_post_meta($bid, 'phone', true);
    $checkin = get_post_meta($bid, 'checkin', true);
    $checkout = get_post_meta($bid, 'checkout', true);
    $price = get_post_meta($bid, 'price', true);
    $room = get_post_meta($bid, 'room', true);
    $adults = get_post_meta($bid, 'adults', true);
    $children = get_post_meta($bid, 'children', true);
    $message = get_post_meta($bid, 'message', true);
    $token = get_post_meta($bid, 'token', true);
    $lang = get_post_meta($bid, 'lang', true);
    $address = get_post_meta($bid, 'email', true);
    $from = mytheme_get_option('place_name') . ' <' . $address . '>';
    $email_bcc = get_bloginfo('admin_email');
    $e_subject = sprintf(pll_translate_string(booking_get_option('bookingwp_confirmed_email_subject'), $lang), $name);
    // Configuration option.
    $request_language = $lang;
    $intro_text = sprintf(pll_translate_string(booking_get_option('bookingwp_confirmed_email'), $request_language), $name);
    $reservation_details = booking_details($bid);
    $cancellation_policy = sprintf(pll_translate_string(booking_get_option('bookingwp_cancellation_policy'), $request_language), $name);
    $email_content = $intro_text;
    $email_content .= $reservation_details;
    $email_content .= "<hr/>" . PHP_EOL . PHP_EOL;
    $email_content .= "<h5>Cancellation Policy</h5><small>" . $cancellation_policy . "</small>";
    $msg = wordwrap($e_body, 70);
    $e_body = build_email($email_content);
    $headers[] = "From: {$from}" . PHP_EOL;
    $headers[] = "Bcc: {$email_bcc}" . PHP_EOL;
    //customer voucher
    wp_mail($address, $e_subject, $e_body, $headers);
}
Example #5
0
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package bookingwp
 */
$result = Ipn();
if ($result) {
    wp_reset_query();
    $booking = new WP_Query(array('post_type' => 'bookings', 'meta_key' => 'token', 'meta_value' => $result['item_number'], 'posts_per_page' => 1));
    while ($booking->have_posts()) {
        $booking->the_post();
        set_booked(get_the_id());
        send_confirmation(get_the_id());
        $message = 'reservation id = ' . get_the_id() . ' code ' . $result['item_number'] . "\r\n";
        $message .= 'payment status = ' . $result['payment_status'] . "\r\n";
        $message .= 'details = ' . $result['item_name'] . "\r\n";
        $subject = 'Conferma pagamento Paypal #' . $result['item_number'];
        //$headers = 'From: IPN Notification <*****@*****.**>' . "\r\n";
        $headers[] = 'From: IPN Notification <' . booking_get_option('bookingwp_paypal_email') . '>';
        $headers[] = 'Bcc: IPN <' . booking_get_option('bookingwp_paypal_email') . '>';
        //$headers[] = 'Cc: iluvwp@wordpress.org'; // note you can just use a simple email address
        wp_mail('*****@*****.**', $subject, $message, $headers);
    }
} else {
    wp_redirect(get_bloginfo('siteurl'), '301');
    exit;
}
Example #6
0
function home_booking()
{
    if (!$_POST) {
        if (!defined("PHP_EOL")) {
            define("PHP_EOL", "\r\n");
        }
    }
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $checkin = $_POST['checkin'];
    $checkout = $_POST['checkout'];
    $room_id = $_POST['room_id'];
    $room = $_POST['room'];
    $adults = $_POST['adults'];
    $children = $_POST['children'];
    $room_number = $_POST['room_number'];
    $message = $_POST['message'];
    $lang = $_POST['current_lang'];
    //if availability
    if (!is_available($room_id, $checkin, $checkout)) {
        echo '<div class="alert alert-danger alert-dismissable">
	  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>La camera richiesta risulta occupata nelle date richieste!</div>';
        exit;
    }
    if (trim($email) == '') {
        echo '<div class="alert alert-danger alert-dismissable">
	  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Attention! Please enter a valid email address.</div>';
        exit;
    } else {
        if (trim($room) == '') {
            echo '<div class="alert alert-danger alert-dismissable">
	  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Attention! Please enter what kind of room.</div>';
            exit;
        } else {
            if (trim($checkin) == '') {
                echo '<div class="alert alert-danger alert-dismissable">
	  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Attention! Please enter your check-in date.</div>';
                exit;
            } else {
                if (trim($checkout) == '') {
                    echo '<div class="alert alert-danger alert-dismissable">
	  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Attention! Please enter your check-out date.</div>';
                    exit;
                } else {
                    if (!isEmail($email)) {
                        echo '<div class="alert alert-danger alert-dismissable">
	  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Attention! You have enter an invalid e-mail address, try again.</div>';
                        exit;
                    }
                }
            }
        }
    }
    if (get_magic_quotes_gpc()) {
        $comments = stripslashes($comments);
    }
    //titolo stanza composto da nome hotel + stanza x evitare duplicati...
    $main_name = 'booking ';
    $camera = get_the_title($room);
    // ADD THE FORM INPUT TO $new_post ARRAY
    $new_booking = array('post_title' => $main_name . ' - ' . $camera, 'post_type' => 'bookings', 'post_status' => 'waiting');
    //SAVE THE POST
    $bid = wp_insert_post($new_booking);
    $price = check_price($checkin, $checkout, $room, $room_number);
    $token = uniqid();
    $request_page = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
    $manager_url = get_bloginfo('siteurl') . '/reservations-system/?token=' . $token;
    update_post_meta($bid, 'name', $name);
    update_post_meta($bid, 'email', $email);
    update_post_meta($bid, 'phone', $phone);
    update_post_meta($bid, 'room', $room);
    update_post_meta($bid, 'room_id', $room_id);
    update_post_meta($bid, 'token', $token);
    update_post_meta($bid, 'manager_url', $manager_url);
    update_post_meta($bid, 'checkin', convert_date_to_timestamp($checkin));
    update_post_meta($bid, 'checkout', convert_date_to_timestamp($checkout));
    update_post_meta($bid, 'adults', $adults);
    update_post_meta($bid, 'children', $children);
    update_post_meta($bid, 'room_number', $room_number);
    update_post_meta($bid, 'message', $message);
    update_post_meta($bid, 'lang', $lang);
    if ($price) {
        update_post_meta($bid, 'price', $price);
    }
    $room_type = get_the_title($room);
    //$address = "*****@*****.**";
    $address = mytheme_get_option('email');
    $from = mytheme_get_option('place_name') . ' <' . $address . '>';
    $email_bcc = get_bloginfo('admin_email');
    // Configuration option.
    $e_subject = 'Booking n # ' . $bid . ' da ' . $email;
    $e_body = "Richiesta di prenotazione da <b>: {$name} {$email} tel. {$phone}</b>\n\n\t\tRichiesta prenotazione per le seguenti date<br />\n\t\tCheckin: <b>: {$checkin} </b><br />\n\t\tCheck-out <b>: {$checkout} </b><br />\n\t\tmessaggio <b>: {$message} </b><br />\n\n\t\tLa richiesta &egrave; di n, <b>{$room_number}</b>  <b>{$room_type}</b> per <b>{$adults} Adulti</b> e <b>{$children} bambini</b>.<br />\n\t\tIl prezzo proposto dal sistema in base alle tue impostazioni &egrave; di &euro; <b>{$price}</b> .<br />\n\t\tRicevuta da: {$request_page}.<br />\n\t\tin lingua: {$lang}.<br />\n\t\t<hr />\n\t\t<a href='{$manager_url}'>Gestisci</a>" . PHP_EOL . PHP_EOL;
    $e_reply = "<br />You can contact the customer via email, {$email} or hit 'reply' in your email browser to make the reservation complete.";
    $msg = wordwrap($e_body . $e_reply, 70);
    $headers[] = "From: {$from}" . PHP_EOL;
    $headers[] = "Bcc: {$email_bcc}" . PHP_EOL;
    //if(mail($address, $e_subject, $msg, $headers)) {
    if (wp_mail($address, $e_subject, $e_body, $headers)) {
        //email to customer
        // Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578
        remove_filter('wp_mail_content_type', 'set_html_content_type');
        $price = check_price($checkin, $checkout, $room);
        // Email has sent successfully, echo a success page.
        //try to understand what kind of booking: instant on-request
        $booking_type = booking_get_option('booking_type');
        if ($booking_type == 'instant') {
            $confirmation_url = get_bloginfo('siteurl') . '/confirm-reservation?token=' . $token;
            //stop mostra prezzo per ora..
            echo '<div id="success_page" class="alert alert-warning"><h4><i class="fa fa-bolt"></i> ' . __('Secure instant booking', 'bookingwp') . '</h4></div>';
            echo '<h5>' . __('Price for your reservation is &euro;', 'bookingwp') . ' <b>' . $price . '</b></h5><br />';
            echo __('You can confirm now your reservation by clicking this link and leave your credit card as warranty or paying the entire fee of your booking with Paypal and instantly book the room!', 'bookingwp') . '<br /><hr />';
            echo '<a href="' . $confirmation_url . '" class="btn btn-success btn-block">Confirm reservation</a></p>';
        } else {
            echo '<div id="success_page" class="alert alert-success"><p>' . __('Your reservation has been submitted to us and well contact you as quickly as possible to complete your booking. Thank you', 'bookingwp') . '</p></div>';
        }
        exit;
    } else {
        echo 'ERROR!';
    }
}