Changeset 1259173
- Timestamp:
- 10/04/2015 08:54:49 AM (10 years ago)
- Location:
- wpcf/trunk
- Files:
-
- 5 edited
-
css/style.css (modified) (1 diff)
-
inc/ajaxWork.php (modified) (3 diffs)
-
js/function.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
wpcf.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpcf/trunk/css/style.css
r1150337 r1259173 1 input,textarea{ 2 width: 95%; 3 } 4 input[type='submit'],input[type='reset'] 5 { 6 width: 20%; 7 margin-top: 10px; 8 } 9 .error{ 10 color: #f00; 11 display: block; 12 } 1 #wpcf input,#wpcf textarea 2 { 3 width: 100%; 4 border-color: 999; 5 6 } 7 #wpcf input[type='submit'],#wpcf input[type='reset'] 8 { 9 width: 12%; 10 border: none; 11 border-radius: 3px; 12 padding: 5px; 13 margin-top: 10px; 14 } 15 .error 16 { 17 color: #f00; 18 display: block; 19 } 13 20 14 #statusMsg{ 15 display: none; 16 } 21 #statusMsg 22 { 23 display: none; 24 } -
wpcf/trunk/inc/ajaxWork.php
r1150337 r1259173 1 1 <?php 2 2 3 // WordPress Ajax Call 3 4 add_action('wp_ajax_nopriv_wpcf_ajax', 'wpcf_ajax_callback'); … … 9 10 $subject=sanitize_text_field($_POST['txtSubject']); 10 11 $message=sanitize_text_field($_POST['txtMsg']); 11 12 $answer=sanitize_text_field($_POST['txtAnswer']); 13 $answerInSession=sanitize_text_field($_POST['txtSessionAnswer']); 14 12 15 // Send mail to 13 16 $mail_to=$a['to']; … … 19 22 $site_name= get_bloginfo('name'); 20 23 21 if(!empty($ name) && !empty($email) && !empty($subject) && !empty($message))24 if(!empty($answer) && $answerInSession==md5($answer)) 22 25 { 23 $headers = "From: ".$site_name."<".$email.">\n"; 24 $headers .= "Return-Path: <".$email.">\n"; 25 $headers .= "Reply-To: <".$email.">\n"; 26 $body ="Sender : " .$name."\n"; 27 $body .="Message :" .$message."\n"; 28 //mail($mail_to,$subject,$message,$headers); 29 wp_mail($mail_to, $subject, $body, $headers); 30 echo "success"; 31 26 if(!empty($name) && !empty($email) && !empty($subject) && !empty($message)) 27 { 28 $headers = "From: ".$site_name."<".$email.">\n"; 29 $headers .= "Return-Path: <".$email.">\n"; 30 $headers .= "Reply-To: <".$email.">\n"; 31 $body ="Sender : " .$name."\n"; 32 $body .="Message :" .$message."\n"; 33 //mail($mail_to,$subject,$message,$headers); 34 wp_mail($mail_to, $subject, $body, $headers); 35 echo "success"; 36 37 } 38 39 else 40 { 41 echo "All field required"; 42 } 32 43 } 33 34 44 else 35 45 { 36 echo " All field required";46 echo "wrong_captcha"; 37 47 } 48 38 49 39 50 die(""); -
wpcf/trunk/js/function.js
r1150337 r1259173 1 jQuery(document).ready(function() { 2 //validattion 3 jQuery(function() { 4 jQuery("#wpcf").validate(); 5 }) 6 //end validation 7 8 jQuery('#wpcf').submit(function(e) { 9 var url = jQuery(this).attr('action'); 10 var data = jQuery(this).serialize(); 11 12 jQuery.ajax({ 13 type: "POST", 14 url: url, 15 data: data, 16 success: function(data) { 17 if (data == 'success') { 18 jQuery('#wpcf').slideUp('slow'); 19 jQuery('#statusMsg').html('Your message successfully send!'); 20 jQuery('#statusMsg').css({ 21 display: 'block', 22 color: 'green' 23 }); 24 } 25 26 }, 27 error: function(errorThrown) { 28 alert(errorThrown); 29 } 30 31 }); 32 return false; 33 34 }); 35 }); 1 jQuery(document).ready(function() 2 { 3 //validattion 4 jQuery(function() 5 { 6 jQuery("#wpcf").validate(); 7 }) 8 //end validation 9 jQuery('#wpcf').submit(function(e) 10 { 11 var url = jQuery(this).attr('action'); 12 var data = jQuery(this).serialize(); 13 jQuery.ajax( 14 { 15 type: "POST", 16 url: url, 17 data: data, 18 success: function(data) 19 { 20 console.log(data); 21 if (data == 'success') 22 { 23 jQuery('#wpcf').slideUp('slow'); 24 jQuery('#statusMsg').html('Your message successfully send!'); 25 jQuery('#statusMsg').css( 26 { 27 display: 'block', 28 border: '1px solid green', 29 padding: '10px', 30 marginButtom: '10px', 31 width: '100%', 32 fontWeight:'bold', 33 color: 'green' 34 }); 35 } 36 if (data =='wrong_captcha') 37 { 38 jQuery('#statusMsg').html('Wrong Captcha Answer'); 39 jQuery('#statusMsg').css( 40 { 41 display: 'block', 42 border: '1px solid red', 43 padding: '10px', 44 marginButtom: '10px', 45 width: '100%', 46 fontWeight:'bold', 47 color: 'red' 48 }); 49 } 50 }, 51 error: function(errorThrown) 52 { 53 alert(errorThrown); 54 } 55 }); 56 return false; 57 }); 58 }); -
wpcf/trunk/readme.txt
r1150341 r1259173 4 4 Tags: wordpress contact form 5 5 Requires at least: 3.0 6 Tested up to: 4. 27 Stable tag: trunk6 Tested up to: 4.3 7 Stable tag: 1.1 8 8 9 9 WPCF is a simple WordPress contact form. You can easily add this in your page,post anywhere with shortcode. … … 29 29 <span style="white-space: pre;"> </span> Just add this shortcode in your post or page<strong> [wpcf]</strong> 30 30 </div> 31 32 == Changelog == 33 34 = 1.1 = 35 36 * captcha included with contact form. 37 * some bug fix. 38 * some design changes. -
wpcf/trunk/wpcf.php
r1150337 r1259173 4 4 * Plugin URI: http://learn24bd.com/portfolio/wpcf 5 5 * Description: WPCF (Wordpress Contact Form) is simple contact form. You can add this in any where whare you need it. It support sortcode. 6 * Version: 1. 06 * Version: 1.1 7 7 * Author: Harun 8 8 * Author URI: http://learn24bd.com … … 10 10 */ 11 11 12 include 'inc/mc.php'; 12 13 /// Register Script 13 14 function wpcf_load_scripts() { … … 49 50 <label for="txtMsg">Message</label> 50 51 <textarea name="txtMsg" id="" cols="30" rows="4" required></textarea> 52 <?php putMcData(); ?> 53 <label for="txtAnswer">Put answer of <?php echo getMcQuestion(); ?></label> 54 <input type="text" name="txtAnswer" required style="width:50px;"><br> 55 56 <input type="hidden" name="txtSessionAnswer" value="<?php echo md5(getMcAnswer());?>"/> 51 57 52 58 <input type="submit" value="Send">
Note: See TracChangeset
for help on using the changeset viewer.