Plugin Directory

Changeset 2915316


Ignore:
Timestamp:
05/21/2023 04:57:35 AM (3 years ago)
Author:
haruncpi
Message:

v1.1.3

Location:
wpcf
Files:
26 added
2 deleted
4 edited

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
    225{
    326    width: 100%;
     
    1033   
    1134}
    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;
    2438}
    2539
    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;
    2948}
     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             });
     1jQuery(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        }
    5844    });
     45});
  • wpcf/trunk/readme.txt

    r1356292 r2915316  
    11=== WPCF ===
    22Contributors: haruncpi
    3 Donate link:http://learn24bd.com
     3Donate link: https://learn24bd.com
    44Tags: wordpress contact form
    5 Requires at least: 3.0
    6 Tested up to: 4.4
     5Requires at least: 5.3
     6Tested up to: 6.2
    77Stable tag: trunk
    88
     
    1111== Description ==
    1212
    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  
     13WPCF  is a simple WordPress contact form. You can easily add this in your page,post anywhere with shortcode.
    2014
    2115== Installation ==
    2216
    2317Extract 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
     211. screenshot-1.png
     22
    2423== Frequently Asked Questions ==
    2524
    26 *   **How to add contact form?**
     25**How to add contact form?**
    2726
    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]**
    3128
    3229== Changelog ==
     30
     31= 1.1.3 =
     32
     33* Bug fixes
    3334
    3435= 1.1.1 =
  • wpcf/trunk/wpcf.php

    r1356292 r2915316  
    22/**
    33 * Plugin Name: WPCF
    4  * Plugin URI: http://learn24bd.com/portfolio/wpcf
     4 * Plugin URI: https://learn24bd.com
    55 * 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.1
    76 * Author: Harun
    8  * Author URI: http://learn24bd.com
     7 * Author URI: https://learn24bd.com
     8 * Version: 1.1.3
    99 * License:GPL2
     10 * Requires at least: 5.3
     11 * Tested up to: 6.2
     12 * Text Domain: wpcf
    1013 */
    1114
    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__ ));
     15use Haruncpi\WpCf\Plugin;
    2016
    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' );
     17require_once 'vendor/autoload.php';
    2818
    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>
     19define( 'WPCF_VERSION', '1.1.3' );
     20define( 'WPCF_FILE', __FILE__ );
     21define( 'WPCF_DIR', plugin_dir_path( __FILE__ ) );
    3822
    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();
    6525
    6626
Note: See TracChangeset for help on using the changeset viewer.