Changeset 2915316
- Timestamp:
- 05/21/2023 04:57:35 AM (3 years ago)
- Location:
- wpcf
- Files:
-
- 26 added
- 2 deleted
- 4 edited
-
assets/screenshot-1.png (added)
-
trunk/composer.json (added)
-
trunk/css/style.css (modified) (2 diffs)
-
trunk/inc (deleted)
-
trunk/js/function.js (modified) (1 diff)
-
trunk/js/validate.min.js (deleted)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src (added)
-
trunk/src/Ajax.php (added)
-
trunk/src/Assets.php (added)
-
trunk/src/Mc.php (added)
-
trunk/src/Plugin.php (added)
-
trunk/src/Shortcode.php (added)
-
trunk/src/Utils.php (added)
-
trunk/vendor (added)
-
trunk/vendor/autoload.php (added)
-
trunk/vendor/composer (added)
-
trunk/vendor/composer/ClassLoader.php (added)
-
trunk/vendor/composer/InstalledVersions.php (added)
-
trunk/vendor/composer/LICENSE (added)
-
trunk/vendor/composer/autoload_classmap.php (added)
-
trunk/vendor/composer/autoload_namespaces.php (added)
-
trunk/vendor/composer/autoload_psr4.php (added)
-
trunk/vendor/composer/autoload_real.php (added)
-
trunk/vendor/composer/autoload_static.php (added)
-
trunk/vendor/composer/installed.json (added)
-
trunk/vendor/composer/installed.php (added)
-
trunk/vendor/pest-plugins.json (added)
-
trunk/views (added)
-
trunk/views/shortcodes (added)
-
trunk/views/shortcodes/contact-form.php (added)
-
trunk/wpcf.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wpcf/trunk/css/style.css
r1356292 r2915316 1 #wpcf input,#wpcf textarea 1 .wpcf-form-wrapper{ 2 width: 100%; 3 } 4 5 .wpcf-input{ 6 display: flex; 7 margin-bottom: 10px; 8 } 9 10 .wpcf-input label{ 11 min-width: 140px; 12 } 13 14 .wpcf-input input{ 15 padding: 3px 5px; 16 width: 100%; 17 border:1px solid #ddd; 18 border-radius: 4px; 19 -moz-border-radius: 4px; 20 -webkit-border-radius: 4px; 21 } 22 23 24 #wpcf textarea 2 25 { 3 26 width: 100%; … … 10 33 11 34 } 12 #wpcf input[type='submit'],#wpcf input[type='reset'] 13 { 14 width: 12%; 15 border: none; 16 border-radius: 3px; 17 padding: 5px; 18 margin-top: 10px; 19 } 20 .error 21 { 22 color: #f00; 23 display: block; 35 36 .wpcf-status-msg{ 37 display: none; 24 38 } 25 39 26 #statusMsg 27 { 28 display: none; 40 .wpcf-status-success{ 41 display: block; 42 border: 1px solid green; 43 padding: 10px; 44 margin-bottom: 10px; 45 width: 100%; 46 font-weight: bold; 47 color: green; 29 48 } 49 50 .wpcf-status-error{ 51 display: block; 52 border: 1px solid red; 53 padding: 10px; 54 margin-bottom: 10px; 55 width: 100%; 56 font-weight: bold; 57 color: red; 58 } 59 60 .wpcf-submit{ 61 margin-top: 25px; 62 display: flex; 63 justify-content: flex-end; 64 gap: 10px; 65 } 66 67 .wpcf-submit button{ 68 padding: 8px 12px; 69 border-radius: 4px; 70 border: 0; 71 } 72 73 .wpcf-submit button[type="submit"] { 74 background-color: royalblue; 75 color: white; 76 cursor: pointer; 77 } 78 79 .wpcf-submit-loading{ 80 pointer-events: none; 81 opacity: 0.5; 82 } -
wpcf/trunk/js/function.js
r1259173 r2915316 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 }); 1 jQuery(document).ready(function ($) { 2 3 $('#wpcf').submit(function (e) { 4 e.preventDefault(); 5 6 let form = $(this) 7 let url = $(this).attr('action'); 8 let data = $(this).serialize(); 9 let status = $('.wpcf-status-msg') 10 11 let btnSubmit = $('.wpcf-submit button[type="submit"]') 12 let oldTxt = btnSubmit.text() 13 14 btnSubmit.addClass('wpcf-submit-loading') 15 btnSubmit.text('Sending...') 16 17 $.ajax({ 18 type: 'POST', 19 url: url, 20 data: data, 21 success: onSuccess, 22 complete: onComplete 23 }) 24 25 function onSuccess(res) { 26 status 27 .removeClass('wpcf-status-success') 28 .removeClass('wpcf-status-error') 29 30 if (res.success) { 31 form.slideUp('slow'); 32 status.html(res.data); 33 status.addClass('wpcf-status-success'); 34 } else { 35 status.addClass('wpcf-status-error'); 36 status.html(res.data); 37 } 38 } 39 40 function onComplete() { 41 btnSubmit.removeClass('wpcf-submit-loading') 42 btnSubmit.text(oldTxt) 43 } 58 44 }); 45 }); -
wpcf/trunk/readme.txt
r1356292 r2915316 1 1 === WPCF === 2 2 Contributors: haruncpi 3 Donate link: http://learn24bd.com3 Donate link: https://learn24bd.com 4 4 Tags: wordpress contact form 5 Requires at least: 3.06 Tested up to: 4.45 Requires at least: 5.3 6 Tested up to: 6.2 7 7 Stable tag: trunk 8 8 … … 11 11 == Description == 12 12 13 WPCF is a simple WordPress contact form. You can easily add this in your page,post anywhere with shortcode. 14 15 16 17 * To add contact form just add this in your post,page **[wpcf]** 18 19 13 WPCF is a simple WordPress contact form. You can easily add this in your page,post anywhere with shortcode. 20 14 21 15 == Installation == 22 16 23 17 Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the Plugin from Plugins page. 18 19 == Screenshots == 20 21 1. screenshot-1.png 22 24 23 == Frequently Asked Questions == 25 24 26 * **How to add contact form?**25 **How to add contact form?** 27 26 28 <div> 29 <span style="white-space: pre;"> </span> Just add this shortcode in your post or page<strong> [wpcf]</strong> 30 </div> 27 * Just add this shortcode in your post or page **[wpcf]** 31 28 32 29 == Changelog == 30 31 = 1.1.3 = 32 33 * Bug fixes 33 34 34 35 = 1.1.1 = -
wpcf/trunk/wpcf.php
r1356292 r2915316 2 2 /** 3 3 * Plugin Name: WPCF 4 * Plugin URI: http ://learn24bd.com/portfolio/wpcf4 * Plugin URI: https://learn24bd.com 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.1.17 6 * Author: Harun 8 * Author URI: http://learn24bd.com 7 * Author URI: https://learn24bd.com 8 * Version: 1.1.3 9 9 * License:GPL2 10 * Requires at least: 5.3 11 * Tested up to: 6.2 12 * Text Domain: wpcf 10 13 */ 11 14 12 include 'inc/mc.php'; 13 /// Register Script 14 function wpcf_load_scripts() { 15 wp_enqueue_script('jquery'); 16 wp_register_style('wpcf_style',plugins_url('css/style.css', __FILE__ )); 17 18 wp_register_script( 'wpcf_functions',plugins_url('js/function.js', __FILE__ )); 19 wp_register_script( 'wpcf_valitations',plugins_url('js/validate.min.js', __FILE__ )); 15 use Haruncpi\WpCf\Plugin; 20 16 21 wp_enqueue_style('wpcf_style'); 22 23 wp_enqueue_script( 'wpcf_functions' ); 24 wp_enqueue_script( 'wpcf_valitations'); 25 } 26 // Hook into the 'wp_enqueue_scripts' action 27 add_action( 'wp_enqueue_scripts', 'wpcf_load_scripts' ); 17 require_once 'vendor/autoload.php'; 28 18 29 add_shortcode('wpcf','wpcf_make_sortcode'); 30 function wpcf_make_sortcode( $atts ) { 31 $a = shortcode_atts( array( 32 'to'=>'', 33 ), $atts ); 34 ?> 35 <div id="statusMsg"> 36 37 </div> 19 define( 'WPCF_VERSION', '1.1.3' ); 20 define( 'WPCF_FILE', __FILE__ ); 21 define( 'WPCF_DIR', plugin_dir_path( __FILE__ ) ); 38 22 39 <form id="wpcf" action="<?php echo admin_url('admin-ajax.php'); ?>" method="POST"> 40 <input type="hidden" name="action" value="wpcf_ajax"> 41 <label for="txtName">Your Name</label> 42 <input type="text" name="txtName" required> 43 <br> 44 <label for="txtEmail">Your E-mail</label> 45 <input type="email" name="txtEmail" required> 46 <br> 47 <label for="txtSubject">Subject</label> 48 <input type="text" name="txtSubject" required> 49 <br> 50 <label for="txtMsg">Message</label> 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());?>"/> 57 58 <input type="submit" value="Send"> 59 <input type="reset" value="Reset"> 60 </form> 61 <?php 62 } 63 64 include 'inc/ajaxWork.php'; 23 $plugin = new Plugin(); 24 $plugin->init(); 65 25 66 26
Note: See TracChangeset
for help on using the changeset viewer.