Plugin Directory

Changeset 555595


Ignore:
Timestamp:
06/10/2012 01:15:55 PM (14 years ago)
Author:
_Math_
Message:
 
Location:
mp-booking/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mp-booking/trunk/js/mp-booking.js

    r422126 r555595  
    5959var tableDetail;
    6060
    61 //modal dialog contain the booking form
    62 $( "#dialog-form" ).dialog({
    63   autoOpen: false,
    64   height: 400,
    65   width: 700,
    66   modal: true,
    67   buttons: {
    68     "Continue": function() {   
    69       $(".error_form").empty();
    70       //end
    71       if(step==4){
    72          $( this ).dialog( "close" );
    73          return;
    74       }
    75       //form -> step 3 : send information to server, wait ajax answer
    76       if(step==3){
     61function sendDetail(step1,step2){
    7762        //disable button for wait answer
    7863        $('#continue-button').attr('disabled', true);
     
    9479            $('#back-button').hide();
    9580            //next div
    96             $('#step'+step).slideUp();
    97             step++;
    98             $('#step'+step).slideDown();
     81            $('#step'+step1).slideUp();
     82            step=step2;
     83            $('#step'+step2).slideDown();
    9984          }
    10085          else{
    101             updateTips("Please complete captcha");
    102             $('#captcha').val('');
     86            if(mp_no_captcha){
     87              updateTips("Server error appends try later");
     88            }
     89            else{
     90              updateTips("Please complete captcha");
     91              $('#captcha').val('');
     92            }
    10393          }
    10494          //change the captcha picure
     
    10999         } 
    110100        });
     101}
     102
     103//modal dialog contain the booking form
     104$( "#dialog-form" ).dialog({
     105  autoOpen: false,
     106  height: 500,
     107  width: 700,
     108  modal: true,
     109  buttons: {
     110    "Continue": function() {   
     111      $(".error_form").empty();
     112      //end
     113      if(step==4){
     114         $( this ).dialog( "close" );
     115         return;
     116      }
     117      //form -> step 3 : send information to server, wait ajax answer
     118      if(step==3){
     119        sendDetail(3,4);
    111120      }
    112121      //when client had verified his information
    113122      if(step==2){
    114         //next div
    115         $('#step'+step).slideUp();
    116         step++;
    117         $('#step'+step).slideDown();
     123        if(mp_no_captcha){
     124          sendDetail(2,4);
     125        }
     126        else{
     127          //next div
     128          $('#step'+step).slideUp();
     129          step++;
     130          $('#step'+step).slideDown();
     131        }
    118132      }
    119133      //verify field and fell next div
     
    126140                return next;
    127141            }
    128             if(field.name==='captcha') return true;
     142            if(field.name==='captcha'||field.name==='mp_from'||field.name==='mp_send_to') return true;
     143           
    129144            var label=$("label[for="+field.name+"]").html();
    130145            tableDetail+="<tr><td>"+label+" : </td><td>"+field.value+"</td></tr>";
     
    173188      $('#step4').hide();
    174189      $('#continue-button').html('<span class="ui-button-text">Continue</span>');
     190      $('#back-button').html('<span class="ui-button-text">Back</span>');
    175191      $('#back-button').show();
    176192      $('#guest').empty();//empty a previous nb guest select box
     
    180196      var object=$(this).attr("object");
    181197      $('#mp_booking_object').val(object);
     198      var mp_mail_to=$(this).attr("sendTo");
     199      $('#mp_send_to').val(mp_mail_to);
     200      var mp_from=$(this).attr("from");
     201      $('#mp_from').val(mp_from);
     202      mp_no_captcha=false;
     203      mp_no_captcha=$(this).attr("captcha")=="no";
     204     
    182205      $("dialog-form").attr("title",object);
    183206      var nbguest=$(this).attr("nummax");//feel the nb guest select box until the max num
  • mp-booking/trunk/mp-booking-form.php

    r422126 r555595  
    44Plugin Name: mp-booking
    55Plugin URI: http://www.mathieu-piot.net/MP_Booking
    6 Description: mp-booking is a wordpress pluggin which provide a simple button that open a simple form to complete hostel room reservations.It permit to have multiple rooms descriptions on one page and for each simply add a booking button that open a form with jqueryui functionalities such as calendar modal form
    7 The booking process end by a captcha verification and send a mail confirmation to the user (the client) and to the admin’s mail (you).
     6Description: mp-booking is a wordpress pluggin which provide a simple button that open a simple form to complete hostel room reservations.It permit to have multiple rooms descriptions on one page and for each simply add a booking button that open a form with jqueryui functionalities such as calendar modal form?The booking process end by a captcha verification and send a mail confirmation to the user (the client) and to the admin?s mail (you).
    87Version: 1.0.1
    98Author: Mathieu Piot
     
    2423Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2524*/
     25
     26$mpb_force_sender=false;
     27
    2628//captcha lib
    2729//require_once('php/kcaptcha/kcaptcha.php');
     
    3335add_shortcode('mp_booking', 'mp_booking_ShortCode');
    3436//right place ?? [need review] include form once
    35 add_action('wp_footer', 'add_form');
     37add_action('wp_footer', 'mp_booking_add_form');
    3638//add ajax script for callback
    3739add_action('wp_ajax_mp_booking', 'mp_booking_callback');//logged and private
     
    4749function  mp_booking_AddScripts()
    4850{
    49   wp_enqueue_script('jquery');
    50   wp_enqueue_script('jquery-ui-core');
    51   wp_enqueue_script('jquery-ui-dialog');
    52   //enqueue jq ui date picker for form
    53   wp_enqueue_script('jquery-ui-datepicker', plugins_url('/js/jquery-ui-datepicker.js', __FILE__), array('jquery','jquery-ui-core') );
    54   //enqueue jsfunction for mp-booking form (plugin)
    55   wp_enqueue_script('mp-booking', plugins_url('/js/mp-booking.js', __FILE__), array('jquery','jquery-ui-core','jquery-ui-datepicker') );
     51    wp_enqueue_script('jquery');
     52    wp_enqueue_script('jquery-ui-core');
     53    wp_enqueue_script('jquery-ui-dialog');
     54    //enqueue jq ui date picker for form
     55    wp_enqueue_script('jquery-ui-datepicker', plugins_url('/js/jquery-ui-datepicker.js', __FILE__), array('jquery','jquery-ui-core') );
     56    //enqueue jsfunction for mp-booking form (plugin)
     57    wp_enqueue_script('mp-booking', plugins_url('/js/mp-booking.js', __FILE__), array('jquery','jquery-ui-core','jquery-ui-datepicker') );
    5658}
    5759
     
    6264 */
    6365function mp_booking_AddStyle(){
    64   wp_enqueue_style('jquery-ui-dialog');
    65   //add jquery ui style (you can change theme here)
    66   wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/ui-lightness/jquery-ui.css');
    67   wp_enqueue_style('mp-booking', plugins_url('/css/mp-booking.css', __FILE__));
     66    wp_enqueue_style('jquery-ui-dialog');
     67    //add jquery ui style (you can change theme here)
     68    wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/ui-lightness/jquery-ui.css');
     69    wp_enqueue_style('mp-booking', plugins_url('/css/mp-booking.css', __FILE__));
    6870}
    6971
     
    7375 */
    7476function mp_booking_ajaxurl() {
    75   $ajaxUrl='<script type="text/javascript">';
    76   $ajaxUrl.=' var ajaxurl = "'.admin_url('admin-ajax.php').'"';
    77   $ajaxUrl.='</script>';
    78   echo $ajaxUrl;
     77    $ajaxUrl='<script type="text/javascript">';
     78    $ajaxUrl.=' var ajaxurl = "'.admin_url('admin-ajax.php').'"';
     79    $ajaxUrl.='</script>';
     80    echo $ajaxUrl;
    7981}
    8082
     
    8385 */
    8486function mp_booking_callback() {
    85 
    86   $answer=array();
    87   //verify  captcha
    88   if(count($_POST)>0){
    89     if(isset($_SESSION['captcha_keystring']) && strtolower($_SESSION['captcha_keystring']) === strtolower($_POST['captcha'])){
    90       $answer["captcha"]="ok";
    91       mail_content($_POST["bookcontent"],$_POST["mp_booking_object"],$_POST["first_name"]." ".$_POST["name"],$_POST["email"]);     
    92     }else{
    93       $answer["captcha"]="ko";
    94       $answer["debug"]=$_POST["captcha"]." != ".$_SESSION['captcha_keystring'];
    95     }
    96   }
    97   //new captcha
    98   session_regenerate_id();//for generate an other captcha
    99   unset($_SESSION['captcha_keystring']);
    100   $answer["captcha_img_src"]=plugins_url()."/mp-booking/php/kcaptcha/?".session_name()."=".session_id();
     87    $answer=array();
     88    //no captcha
     89    if(isset($_SESSION["mp_booking_no_kaptcha"]) && $_SESSION["mp_booking_no_kaptcha"]){
     90                mp_booking_mail_content($_POST["bookcontent"],$_POST["mp_booking_object"],$_POST["first_name"]." ".$_POST["name"],$_POST["email"],$_POST['mp_from'],$_POST['mp_send_to']);
     91                $answer["captcha"]="ok";
     92                echo json_encode($answer);
     93                die();
     94    }
     95   
     96    //verify  captcha
     97    if(count($_POST)>0){
     98        if((isset($_SESSION['captcha_keystring']) && strtolower($_SESSION['captcha_keystring']) === strtolower($_POST['captcha']))){
     99            $answer["captcha"]="ok";
     100            mp_booking_mail_content($_POST["bookcontent"],$_POST["mp_booking_object"],$_POST["first_name"]." ".$_POST["name"],$_POST["email"],$_POST['mp_from'],$_POST['mp_send_to']);     
     101        }else{
     102            $answer["captcha"]="ko";
     103            $answer["debug"]=$_POST["captcha"]." != ".$_SESSION['captcha_keystring'];
     104        }
     105    }
     106    //new captcha
     107    session_regenerate_id();//for generate an other captcha
     108    unset($_SESSION['captcha_keystring']);
     109    $answer["captcha_img_src"]=plugins_url()."/mp-booking/php/kcaptcha/?".session_name()."=".session_id();
    101110    echo json_encode($answer);
    102111    die(); // this is required to return a proper result
     
    105114
    106115
    107 function display_form(){
    108   return "
    109   <div id='mpi_booking_container'/>
    110   <form id='booking-form' action=''>
    111   <div class='error_form'></div>
    112   <div id='step1'>
     116function mp_booking_display_form(){
     117    $mpform="
     118    <div id='mpi_booking_container'/>
     119    <form id='booking-form' action=''>
     120    <div class='error_form'></div>
     121    <div id='step1'>
    113122    <fieldset>
    114     <label for='mp_booking_object' style='display:none' >Room type</label>
    115     <input name='mp_booking_object' id='mp_booking_object' type='hidden' name='object' value=''>
    116     <label for='first_name'>First Name</label>
     123        <input name='mp_from' id='mp_from' type='hidden' value=''>
     124        <input name='mp_send_to' id='mp_send_to' type='hidden' value=''>
     125        <label for='mp_booking_object' style='display:none' >Room type</label>
     126        <input name='mp_booking_object' id='mp_booking_object' type='hidden' value=''>
     127        <label for='first_name'>First Name</label>
    117128        <input type='text' name='first_name' id='first_name' class='text ui-widget-content ui-corner-all' />
    118     <label for='name'>Name</label>
     129        <label for='name'>Name</label>
    119130        <input type='text' name='name' id='name' class='text ui-widget-content ui-corner-all' />
    120131        <label for='email'>Email</label>
     
    122133        <label for='country'>Country</label>
    123134        <select name='country' id='country' class='text ui-widget-content ui-corner-all'><option value=''></option></select>
    124     <label for='date_checkin'>Date checkin</label>
    125     <input type='text' name='date_checkin' id='mpb_date_checkin' class='date ui-widget-content ui-corner-all'>
    126     <label for='date_chekout'>Date checkout</label>
    127     <input type='text' name='date_chekout' id='mpb_date_chekout' class='date ui-widget-content ui-corner-all'>
    128     <label for='guest'>Number of guest</label>
     135        <label for='date_checkin'>Date checkin</label>
     136        <input type='text' name='date_checkin' id='mpb_date_checkin' class='date ui-widget-content ui-corner-all'>
     137        <label for='date_chekout'>Date checkout</label>
     138        <input type='text' name='date_chekout' id='mpb_date_chekout' class='date ui-widget-content ui-corner-all'>
     139        <label for='guest'>Number of guest</label>
    129140        <select name='guest' id='guest' class='number ui-widget-content ui-corner-all'></select>
    130141        <label for='reservation_arrival_time'>Arrival time</label>
    131142        <select name='reservation_arrival_time' id='reservation_arrival_time' class='text ui-widget-content ui-corner-all' value='10:00 AM'>
    132       <option value=''></option>
    133       <option value='06:00 AM'>06:00 AM</option>
    134       <option value='07:00 AM'>07:00 AM</option>
    135       <option value='08:00 AM'>08:00 AM</option>
    136       <option value='09:00 AM'>09:00 AM</option>
    137       <option value='10:00 AM'>10:00 AM</option>
    138       <option value='11:00 AM'>11:00 AM</option>
    139       <option value='12:00 PM'>12:00 PM</option>
    140       <option value='01:00 PM'>01:00 PM</option>
    141       <option value='02:00 PM'>02:00 PM</option>
    142       <option value='03:00 PM'>03:00 PM</option>
    143       <option value='04:00 PM'>04:00 PM</option>
    144       <option value='05:00 PM'>05:00 PM</option>
    145       <option value='06:00 PM'>06:00 PM</option>
    146       <option value='07:00 PM'>07:00 PM</option>
    147       <option value='08:00 PM'>08:00 PM</option>
    148       <option value='09:00 PM'>09:00 PM</option>
    149       <option value='10:00 PM'>10:00 PM</option>
    150       <option value='11:00 PM'>11:00 PM</option>
    151       <option value='00:00 AM'>00:00 AM</option>
    152       <option value='01:00 AM'>01:00 AM</option>
    153       <option value='02:00 AM'>02:00 AM</option>
    154     </select>
     143            <option value=''></option>
     144            <option value='06:00 AM'>06:00 AM</option>
     145            <option value='07:00 AM'>07:00 AM</option>
     146            <option value='08:00 AM'>08:00 AM</option>
     147            <option value='09:00 AM'>09:00 AM</option>
     148            <option value='10:00 AM'>10:00 AM</option>
     149            <option value='11:00 AM'>11:00 AM</option>
     150            <option value='12:00 PM'>12:00 PM</option>
     151            <option value='01:00 PM'>01:00 PM</option>
     152            <option value='02:00 PM'>02:00 PM</option>
     153            <option value='03:00 PM'>03:00 PM</option>
     154            <option value='04:00 PM'>04:00 PM</option>
     155            <option value='05:00 PM'>05:00 PM</option>
     156            <option value='06:00 PM'>06:00 PM</option>
     157            <option value='07:00 PM'>07:00 PM</option>
     158            <option value='08:00 PM'>08:00 PM</option>
     159            <option value='09:00 PM'>09:00 PM</option>
     160            <option value='10:00 PM'>10:00 PM</option>
     161            <option value='11:00 PM'>11:00 PM</option>
     162            <option value='00:00 AM'>00:00 AM</option>
     163            <option value='01:00 AM'>01:00 AM</option>
     164            <option value='02:00 AM'>02:00 AM</option>
     165        </select>
    155166        <label for='guest_comments'>Comments</label>
    156167        <textarea  name='guest_comments' cols='50' id='reservation_guest_comments' rows='2'></textarea>
     
    158169    </div>
    159170    <div id='step2'>
    160       <h2 class='mp_h2'>Please verify your information</h2>
    161       <div id='mpb_information'></div></p>
     171            <h2 class='mp_h2'>Please verify your information</h2>
     172            <div id='mpb_information'></div></p>
    162173    </div>
    163     <div id='step3'>
    164       <h2 class='mp_h2'>You must complete the captcha to finish your booking :</h2>
    165       <p><img id=mp_booking_captcha src='".plugins_url()."/mp-booking/php/kcaptcha/?".session_name()."=".session_id()."'/></p>
    166       <label for='captcha'>Captcha</label>
    167       <p><input type='text' name='captcha' id='captcha'></p>
    168     </div>
     174    ";
     175    if(!isset($_SESSION["mp_booking_no_kaptcha"]) || !$_SESSION["mp_booking_no_kaptcha"]){
     176    $mpform.="<div id='step3'>
     177            <h2 class='mp_h2'>You must complete the captcha to finish your booking :</h2>
     178            <p><img id=mp_booking_captcha src='".plugins_url()."/mp-booking2/php/kcaptcha/?".session_name()."=".session_id()."'/></p>
     179            <label for='captcha'>Captcha</label>
     180            <p><input type='text' name='captcha' id='captcha'></p>
     181    </div>";
     182    }
     183    $mpform.="
    169184    <div id='step4'>
    170       <h2 class='mp_h2'>Your booking is complete</h2>
    171       <p>A detail copy has been sent to your email and also to our staff.</p>
     185            <h2 class='mp_h2'>Your booking is complete</h2>
     186            <p>A detail copy has been sent to your email and also to our staff.</p>
    172187    </div>
    173188    </form>
    174189    </div>";
     190    return $mpform;
    175191}
    176192
     
    179195 * Add book form
    180196 */
    181 function add_form() {
    182   $content = "<div id='dialog-form' title='Book now'>".display_form()."</div>";
    183   echo $content;
     197function mp_booking_add_form() {
     198    $content = "<div id='dialog-form' title='Book now'>".mp_booking_display_form()."</div>";
     199    echo $content;
    184200}
    185201
     
    188204 */
    189205function mp_booking_ShortCode($atts){
    190   //Extract shortcode attribute
    191   extract(shortcode_atts(array(
    192           'object' => '',
    193           'nummax' => '5'
    194    ), $atts));
    195   $bookButton= "<button id='mpb_book_button_".$object."' object='".$object."' nummax='".$nummax."' >Book now</button>";
     206    //Extract shortcode attribute
     207    extract(shortcode_atts(array(
     208                'object' => '',
     209                'nummax' => '5',
     210                'label'=>'Book now',
     211                'from'=>'',
     212                'send_to'=>'',
     213                'captcha'=>''
     214     ), $atts));
     215   
     216    $key=get_option('admin_email');
     217    $butt= "<button id='mpb_book_button_".$object."' object='".$object."' nummax='".$nummax."'";
     218    //if email are set to option add key for crypt email in the button parameter to prevent spam, (key is just admin email string)
     219    if($from!=''){
     220        $from_encrypted=base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $from, MCRYPT_MODE_CBC, md5(md5($key))));
     221        $butt.=" from='".$from_encrypted."'";
     222    }
     223    if($send_to!=''){
     224        $sendto_encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $send_to, MCRYPT_MODE_CBC, md5(md5($key))));
     225        $butt.=" sendTo='".$sendto_encrypted."'";
     226    }
     227    if(strtolower($captcha) === "no"){
     228    $_SESSION["mp_booking_no_kaptcha"]=true;
     229    $butt.=" captcha='no'";
     230  }
    196231 
    197   return $bookButton;
    198 }
    199 
    200 
    201 function mail_content($bookcontent, $ressource, $name, $mailuser){
    202 
    203     /*$headers  = 'MIME-Version: 1.0' . "\r\n";
    204     $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    205     // Additional headers
    206     $headers .= 'From: '.get_option('blogname').' <'.get_option('admin_email').'>  ';*/
    207 
    208     $mailadmin=get_option('admin_email');
    209     $object = "Pending request booking for ".$ressource;
    210        
    211     $user_message="Dear $name,<br>Thank you for you enquiry.<br>Your booking had been sent to our staff. We are checking your room availability.<br> You will receive a confirmation mail as soon as possible.<br><br>Here your detail : <br>".$bookcontent;
    212     $user_message.="<br>Please reply to : ".$mailadmin;
    213    
    214    
    215     $admin_message="A client would like to book a ".$ressource."<br>You can see his request detail here : <br>".$bookcontent;
    216        
    217     //send email
    218     add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
    219     $mail = wp_mail($mailuser, $object, $user_message);
    220    
    221     //add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
    222     $mail = wp_mail($mailadmin, $object, $admin_message);
     232    $butt.=">$label</button>";
     233    return $butt;
     234}
     235
     236
     237
     238
     239function mp_booking_mail_content($bookcontent, $ressource, $name, $mailuser,$from="",$mail_to=""){
     240    $key=get_option('admin_email');
     241   
     242    //get the current site (cause a site could have multiple domaine)
     243    $domain=str_replace('www.', '', $_SERVER['SERVER_NAME']);
     244   
     245    //default
     246    $fromName="noreply";
     247    $fromMail="noreply@".$domain;
     248   
     249    $from=($from!="")?rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($from), MCRYPT_MODE_CBC, md5(md5($key))), "\0"):"";
     250    $mail_to=($mail_to!="")?rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($mail_to), MCRYPT_MODE_CBC, md5(md5($key))), "\0"):"";
     251   
     252    //if user specify from
     253    //from string is specify as : name <[email protected]>
     254    //if user sepecify just name (recommanded) mail send will be like : name <[email protected]>
     255    //a mail provider could consider your mail as spam if the sender (your domain) is diferent than @mail
     256    $matches=array();
     257    $matches=preg_split("#<(.*)>#",$from,-1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
     258   
     259    if(count($matches)>0){//if $from is emty matches count = 0
     260        $fromName=$matches[0];//catch "name"
     261        $fromMail=$matches[0]."@".$domain;
     262    }
     263    if(count($matches)>1){
     264        $fromMail=$matches[1];//catch "[email protected]"
     265    }
     266   
     267    //for the reply to line
     268    $replyTo=get_option('admin_email');
     269    if($mail_to!=""){
     270        $mail_to=explode(",", $mail_to);
     271        $replyTo=$mail_to[0];
     272    }
     273    else{
     274    $mail_to=get_option('admin_email');
     275    }
     276   
     277    //add filter wp_mail to specify mail content as html
     278    add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
     279    //add filter wp_mail to specify sender name
     280    add_filter('wp_mail_from_name',create_function('$name', 'return "'.$fromName.'"; '));
     281    //add filter wp_mail to specify sender email
     282    add_filter('wp_mail_from',create_function('$email', 'return "'.$fromMail.'"; '));
     283    $object = "Pending request booking for ".$ressource;
     284    $user_message="Dear $name,<br>Thank you for you enquiry.<br>Your booking had been sent to our staff. We are checking your room availability.<br> You will receive a confirmation mail as soon as possible.<br><br>Here your detail : <br>".$bookcontent;
     285    $user_message.="<br>Please reply to : ".$replyTo;
     286    $admin_message="A client would like to book a ".$ressource."<br>You can see his request detail here : <br>".$bookcontent;
     287    $mail = wp_mail($mailuser, $object, $user_message);
     288    $mail = wp_mail($mail_to, $object, $admin_message);
    223289}
    224290?>
  • mp-booking/trunk/readme.txt

    r423391 r555595  
    44Requires at least: 3.0
    55Tested up to: 3.2
    6 Stable tag: 1.0.0
     6Stable tag: 1.2.0
    77Plugin URI: http://wordpress.org/extend/plugins/mp-booking/
    88Author URI: http://www.mathieu-piot.net/wordpress/mp-booking/
     
    1414== Description ==
    1515
     16MP Booking is a WordPress plugin which provides a button that opens a simple form for hostel / hotel reservations.
     17The plugin allows multiple room descriptions on one page.
     18The button opens a form with jQuery / JQueryui functionalities such as a modal form calendar;
     19specific fields to be filled out, drop-down menus for client country, guest number, arrival time and a comment field. The booking
     20process ends with a captcha verification and sends an e-mail confirmation to the user and to the staff entitled to manage the reservation.
     21The plugin is configurable by changing attributes in the shortcode such as: booking object / room type,
     22maximum number of rooms available, button label, form identification and
     23destination e-mail address for each instance of the form.
    1624
    17 mp-booking is a wordpress pluggin which provide a simple button that open a simple form to complete hostel room reservations.
    18 It permit to have multiple rooms descriptions on one page and for each simply add a booking button that open a form with jqueryui functionalities such as calendar modal form
    19 
    20 The booking process end by a captcha verification and send a mail confirmation to the user (the client) and to the admin’s mail (you).
    21 The form is configurable by changing attribute in the shortcode.
    22 Demo : http://www.mathieu-piot.net/wordpress/mp-booking/
    23 
    24   * This plugin is inspired by "simple-booking-form" pluggin writen by romeluv.
    25   * It use jquery jqueryui (like calendar)
    26   * Cpatcha lib : "kcaptcha"
     25This plugin is inspired by "simple-booking-form" plugin written by romeluv.
     26It uses jQuery / jJueryui (for calendar)
     27Cpatcha lib: "kcaptcha"
    2728
    2829== Installation ==
    2930
    30 Install and activate the plugin.
     31Place the booking button by entering the following shortcode:
    3132
    32 Then add the [mp_booking object="your room type" nummax="number max guest"] shorttag in pages and posts.
     33[mp_booking object="Single Room" nummax="2" label="Book now"
     34from="noreply"
     35send_to="[email protected]" captcha="yes"]
    3336
    34 Configure with argument
    35 @object : this is the name of your room type
    36 @nummax : number person max you can receive in
     37[mp_booking object="Single Room" nummax="2" label="Book now"
     38from='noreply <[email protected]>'
     39send_to="[email protected], [email protected]" captcha="yes"]
     40
     41on your page or posts.
     42
     43
     44Configure with argument :
     45
     46@object – identifies the form instance. Examples: Single Room, Twin Room etc.
     47This will be identified in the Subject field of the incoming reservation e-mail as
     48follows: Pending reservation for <object>
     49@nummax – identifies the maximum number of rooms for each plugin usage
     50instance
     51@label – identifies the label of the button. Examples: Book now!, Booking, Reservation
     52etc. Can be used to translate the button label. Examples: Réservation, Prenotazione,
     53Buchung etc.
     54@from – identifies the sending instance of the plugin.
     55If not defined, the default sender will be [email protected]
     56If defined as a name and not an address, the sender will be name@yourdomain.
     57com
     58Can be defined as an address, for example [email protected] but in this particular
     59case, the e-mail can be treated like spam by e-mail service providers.
     60@send_to – identifies destination addresses for booking notification.
     61Multiple comma-separated addresses can be configured. Example:
     62[email protected], [email protected], [email protected]
     63First defined address is used at the bottom of client message: “Please reply to:
     64[email protected]”
     65@captcha put no if you don't want captcha
     66
     67== Frequently Asked Questions ==
     68= I don't see any plugin entry on my dashboard after install. Is it a problem?
     69This plugin don't add any configuration panel in the dashboard.
     70
     71You just have to add the short code :
     72
     73[mp_booking object="replace_here_your_room_description"
     74nummax="Replace_here_max_guest_your_room_can_contain_5_for_exemple"
     75label="Replace_here_the_text_to_display_on_the_button"
     76from="Replace_here_your_hostel_name"
     77send_to="Replace_here_by_your_email"
     78captcha="replace_here_by_yes_or_no"]
     79
     80Exemple :
     81Edit your page where you want to add a button.
     82Under your room description add the code :
     83[mp_booking object="replace_here_your_room_description" nummax="Replace_here_max_guest_your_room_can_contain_5_for_exemple"]
     84
     85You ca add more option if you want to change the from email adress disable captcha.
     86The shortcode will be replaced by the button.
     87
     88= How I can change the email adress?
     89If you want to change email adress I highly recomand you to use for example :
     90[mp_booking object="theRoom" nummax="2" label="Book now"
     91from="nameofmyhostel"
     92send_to="[email protected]" captcha="yes"]
     93
     94Yo can change email adress in :
     95"From" :
     96The "from" in the mail sended.
     97If not defined, the default sender will be [email protected]
     98If defined as a name and not an email address, the sender will be name@yourdomain.
     99com
     100Can be defined as an address, for example [email protected] but in this particular
     101case, the e-mail can be treated like SPAM by e-mail service providers.
     102
     103send_to :
     104The mail will be sended to this adress to notify the owner of a new client's booking.
     105You can use email adress such as gmail or hotmail or whatever you want, or multiple adress separated by a coma
     106This email will be displayed at the bottom of client message: “Please reply to:
     107[email protected]”
     108 
     109= I would like to disable the captcha.
     110
     111Add captcha="no" in the shortcode
     112
     113= I want to change some text (to translate it, or other) in the form, title, field, button how could I do?
     114
     115Go in your plugin direcory.
     116
     117Edit mp-booking-form.php with a notepad
     118Find a label for exemple :
     119<label for='country'>Country</label>
     120Change the text into <label...></label> for exemple:
     121<label for='country'>Pays</label>
     122Do not change "for=..."
     123Save the file.
     124Reload your page in your browser by ctrl+f5 (ctrl to empty page cache)
     125
     126If you want to change "continue", "back" button
     127Edit the javascript file "mp-booking.js" in the "js" folder
     128Find :
     129$('#continue-button').html('<span class="ui-button-text">Continue</span>');
     130Replace for example by
     131$('#continue-button').html('<span class="ui-button-text">Suivant</span>');
     132Save the file.
     133Reload your page in your browser by ctrl+f5 (ctrl to empty page cache)
     134
     135= I want to change the color of the form, how I can do it simply?
     136You can change by a theme existing in jquery ui by changing the line :
     137wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/ui-lightness/jquery-ui.css');
     138For exemple by :
     139wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/base/jquery-ui.css');
     140Or relace /base/ by :
     141black-tie or blitzer or cupertino or dark-hive or dot-luv or vader or ui-lightness or ui-darkness or trontastic or swanky-purse or sunny or start or south-street or smoothness or redmond or pepper-grinder etc...
     142To preview it see gallery tab in :
     143http://jqueryui.com/themeroller/
     144
     145= I want to change the form's window size.
     146Edit the javascript file "mp-booking.js" in the "js" folder
     147Find :
     148$( "#dialog-form" ).dialog({
     149  autoOpen: false,
     150  height: 500,
     151  width: 700,
     152  ......
     153 
     154Change width and height size.
     155
     156
     157= I want transform a field optional.
     158Edit the javascript file "mp-booking.js" in the "js" folder
     159find the line :
     160var fieldNeeded=new Array("first_name","name","email","country","date_checkin","date_chekout");
     161Delete one of field for exemple checkout : 
     162var fieldNeeded=new Array("first_name","name","email","country","date_checkin");
     163
     164= There is a display problem, the form directly appear in my page, ho I can fix it?
     165Verify if the problem is not due to other plugins installed or the wordpress version.
     166You can try to desactive all others plugins and see if it works, then find wich is in conflict.
     167
     168= I want to add adding payment function like a paypall submition for complete booking, what can I do?
     169This is currently not implemented. Maybe in a future release.
     170
     171== Other ==
     172Any comments, suggestions and feedback are warmly welcomed at:
     173http://www.mathieu-piot.net/mp-booking/
     174You like it and want to suport
     175You can help me to improve it if you are a developer.
     176Or send me a mail if you want to do a gift or a paypal coffee
    37177
    38178== Screenshots ==
     
    44184== Changelog ==
    45185
    46 = 1.0.0 =
     186= 1.0 =
    47187* First plugin release.
     188= 1.2 =
     189* Add option for configure email
     190* Add an option for disable kaptcha
Note: See TracChangeset for help on using the changeset viewer.