Changeset 555595
- Timestamp:
- 06/10/2012 01:15:55 PM (14 years ago)
- Location:
- mp-booking/trunk
- Files:
-
- 3 edited
-
js/mp-booking.js (modified) (6 diffs)
-
mp-booking-form.php (modified) (12 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mp-booking/trunk/js/mp-booking.js
r422126 r555595 59 59 var tableDetail; 60 60 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){ 61 function sendDetail(step1,step2){ 77 62 //disable button for wait answer 78 63 $('#continue-button').attr('disabled', true); … … 94 79 $('#back-button').hide(); 95 80 //next div 96 $('#step'+step ).slideUp();97 step ++;98 $('#step'+step ).slideDown();81 $('#step'+step1).slideUp(); 82 step=step2; 83 $('#step'+step2).slideDown(); 99 84 } 100 85 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 } 103 93 } 104 94 //change the captcha picure … … 109 99 } 110 100 }); 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); 111 120 } 112 121 //when client had verified his information 113 122 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 } 118 132 } 119 133 //verify field and fell next div … … 126 140 return next; 127 141 } 128 if(field.name==='captcha') return true; 142 if(field.name==='captcha'||field.name==='mp_from'||field.name==='mp_send_to') return true; 143 129 144 var label=$("label[for="+field.name+"]").html(); 130 145 tableDetail+="<tr><td>"+label+" : </td><td>"+field.value+"</td></tr>"; … … 173 188 $('#step4').hide(); 174 189 $('#continue-button').html('<span class="ui-button-text">Continue</span>'); 190 $('#back-button').html('<span class="ui-button-text">Back</span>'); 175 191 $('#back-button').show(); 176 192 $('#guest').empty();//empty a previous nb guest select box … … 180 196 var object=$(this).attr("object"); 181 197 $('#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 182 205 $("dialog-form").attr("title",object); 183 206 var nbguest=$(this).attr("nummax");//feel the nb guest select box until the max num -
mp-booking/trunk/mp-booking-form.php
r422126 r555595 4 4 Plugin Name: mp-booking 5 5 Plugin 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 admins mail (you). 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?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). 8 7 Version: 1.0.1 9 8 Author: Mathieu Piot … … 24 23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 25 24 */ 25 26 $mpb_force_sender=false; 27 26 28 //captcha lib 27 29 //require_once('php/kcaptcha/kcaptcha.php'); … … 33 35 add_shortcode('mp_booking', 'mp_booking_ShortCode'); 34 36 //right place ?? [need review] include form once 35 add_action('wp_footer', ' add_form');37 add_action('wp_footer', 'mp_booking_add_form'); 36 38 //add ajax script for callback 37 39 add_action('wp_ajax_mp_booking', 'mp_booking_callback');//logged and private … … 47 49 function mp_booking_AddScripts() 48 50 { 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 form53 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') ); 56 58 } 57 59 … … 62 64 */ 63 65 function 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__)); 68 70 } 69 71 … … 73 75 */ 74 76 function 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; 79 81 } 80 82 … … 83 85 */ 84 86 function 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(); 101 110 echo json_encode($answer); 102 111 die(); // this is required to return a proper result … … 105 114 106 115 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'>116 function 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'> 113 122 <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> 117 128 <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> 119 130 <input type='text' name='name' id='name' class='text ui-widget-content ui-corner-all' /> 120 131 <label for='email'>Email</label> … … 122 133 <label for='country'>Country</label> 123 134 <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> 129 140 <select name='guest' id='guest' class='number ui-widget-content ui-corner-all'></select> 130 141 <label for='reservation_arrival_time'>Arrival time</label> 131 142 <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> 155 166 <label for='guest_comments'>Comments</label> 156 167 <textarea name='guest_comments' cols='50' id='reservation_guest_comments' rows='2'></textarea> … … 158 169 </div> 159 170 <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> 162 173 </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.=" 169 184 <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> 172 187 </div> 173 188 </form> 174 189 </div>"; 190 return $mpform; 175 191 } 176 192 … … 179 195 * Add book form 180 196 */ 181 function add_form() {182 $content = "<div id='dialog-form' title='Book now'>".display_form()."</div>";183 echo $content;197 function mp_booking_add_form() { 198 $content = "<div id='dialog-form' title='Book now'>".mp_booking_display_form()."</div>"; 199 echo $content; 184 200 } 185 201 … … 188 204 */ 189 205 function 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 } 196 231 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 239 function 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); 223 289 } 224 290 ?> -
mp-booking/trunk/readme.txt
r423391 r555595 4 4 Requires at least: 3.0 5 5 Tested up to: 3.2 6 Stable tag: 1. 0.06 Stable tag: 1.2.0 7 7 Plugin URI: http://wordpress.org/extend/plugins/mp-booking/ 8 8 Author URI: http://www.mathieu-piot.net/wordpress/mp-booking/ … … 14 14 == Description == 15 15 16 MP Booking is a WordPress plugin which provides a button that opens a simple form for hostel / hotel reservations. 17 The plugin allows multiple room descriptions on one page. 18 The button opens a form with jQuery / JQueryui functionalities such as a modal form calendar; 19 specific fields to be filled out, drop-down menus for client country, guest number, arrival time and a comment field. The booking 20 process ends with a captcha verification and sends an e-mail confirmation to the user and to the staff entitled to manage the reservation. 21 The plugin is configurable by changing attributes in the shortcode such as: booking object / room type, 22 maximum number of rooms available, button label, form identification and 23 destination e-mail address for each instance of the form. 16 24 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 admins 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" 25 This plugin is inspired by "simple-booking-form" plugin written by romeluv. 26 It uses jQuery / jJueryui (for calendar) 27 Cpatcha lib: "kcaptcha" 27 28 28 29 == Installation == 29 30 30 Install and activate the plugin. 31 Place the booking button by entering the following shortcode: 31 32 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" 34 from="noreply" 35 send_to="[email protected]" captcha="yes"] 33 36 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" 38 from='noreply <[email protected]>' 39 send_to="[email protected], [email protected]" captcha="yes"] 40 41 on your page or posts. 42 43 44 Configure with argument : 45 46 @object identifies the form instance. Examples: Single Room, Twin Room etc. 47 This will be identified in the Subject field of the incoming reservation e-mail as 48 follows: Pending reservation for <object> 49 @nummax identifies the maximum number of rooms for each plugin usage 50 instance 51 @label identifies the label of the button. Examples: Book now!, Booking, Reservation 52 etc. Can be used to translate the button label. Examples: Réservation, Prenotazione, 53 Buchung etc. 54 @from identifies the sending instance of the plugin. 55 If not defined, the default sender will be [email protected] 56 If defined as a name and not an address, the sender will be name@yourdomain. 57 com 58 Can be defined as an address, for example [email protected] but in this particular 59 case, the e-mail can be treated like spam by e-mail service providers. 60 @send_to identifies destination addresses for booking notification. 61 Multiple comma-separated addresses can be configured. Example: 62 [email protected], [email protected], [email protected] 63 First 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? 69 This plugin don't add any configuration panel in the dashboard. 70 71 You just have to add the short code : 72 73 [mp_booking object="replace_here_your_room_description" 74 nummax="Replace_here_max_guest_your_room_can_contain_5_for_exemple" 75 label="Replace_here_the_text_to_display_on_the_button" 76 from="Replace_here_your_hostel_name" 77 send_to="Replace_here_by_your_email" 78 captcha="replace_here_by_yes_or_no"] 79 80 Exemple : 81 Edit your page where you want to add a button. 82 Under 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 85 You ca add more option if you want to change the from email adress disable captcha. 86 The shortcode will be replaced by the button. 87 88 = How I can change the email adress? 89 If you want to change email adress I highly recomand you to use for example : 90 [mp_booking object="theRoom" nummax="2" label="Book now" 91 from="nameofmyhostel" 92 send_to="[email protected]" captcha="yes"] 93 94 Yo can change email adress in : 95 "From" : 96 The "from" in the mail sended. 97 If not defined, the default sender will be [email protected] 98 If defined as a name and not an email address, the sender will be name@yourdomain. 99 com 100 Can be defined as an address, for example [email protected] but in this particular 101 case, the e-mail can be treated like SPAM by e-mail service providers. 102 103 send_to : 104 The mail will be sended to this adress to notify the owner of a new client's booking. 105 You can use email adress such as gmail or hotmail or whatever you want, or multiple adress separated by a coma 106 This 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 111 Add 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 115 Go in your plugin direcory. 116 117 Edit mp-booking-form.php with a notepad 118 Find a label for exemple : 119 <label for='country'>Country</label> 120 Change the text into <label...></label> for exemple: 121 <label for='country'>Pays</label> 122 Do not change "for=..." 123 Save the file. 124 Reload your page in your browser by ctrl+f5 (ctrl to empty page cache) 125 126 If you want to change "continue", "back" button 127 Edit the javascript file "mp-booking.js" in the "js" folder 128 Find : 129 $('#continue-button').html('<span class="ui-button-text">Continue</span>'); 130 Replace for example by 131 $('#continue-button').html('<span class="ui-button-text">Suivant</span>'); 132 Save the file. 133 Reload 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? 136 You can change by a theme existing in jquery ui by changing the line : 137 wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/ui-lightness/jquery-ui.css'); 138 For exemple by : 139 wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/base/jquery-ui.css'); 140 Or relace /base/ by : 141 black-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... 142 To preview it see gallery tab in : 143 http://jqueryui.com/themeroller/ 144 145 = I want to change the form's window size. 146 Edit the javascript file "mp-booking.js" in the "js" folder 147 Find : 148 $( "#dialog-form" ).dialog({ 149 autoOpen: false, 150 height: 500, 151 width: 700, 152 ...... 153 154 Change width and height size. 155 156 157 = I want transform a field optional. 158 Edit the javascript file "mp-booking.js" in the "js" folder 159 find the line : 160 var fieldNeeded=new Array("first_name","name","email","country","date_checkin","date_chekout"); 161 Delete one of field for exemple checkout : 162 var 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? 165 Verify if the problem is not due to other plugins installed or the wordpress version. 166 You 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? 169 This is currently not implemented. Maybe in a future release. 170 171 == Other == 172 Any comments, suggestions and feedback are warmly welcomed at: 173 http://www.mathieu-piot.net/mp-booking/ 174 You like it and want to suport 175 You can help me to improve it if you are a developer. 176 Or send me a mail if you want to do a gift or a paypal coffee 37 177 38 178 == Screenshots == … … 44 184 == Changelog == 45 185 46 = 1.0 .0=186 = 1.0 = 47 187 * 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.