Plugin Directory

Changeset 2205609


Ignore:
Timestamp:
12/04/2019 12:18:31 AM (6 years ago)
Author:
verifybee
Message:

Added suopport for wp fluent form

Location:
form-verification-verifybee/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • form-verification-verifybee/trunk/README.txt

    r2203237 r2205609  
    2020*   Contact Form 7
    2121*   Gravity Form
     22*   WP Fluent Forms
     23
     24
    2225
    2326One plugin that integrates with both form types. Just install, activate and add your API key by [creating a Free Account](https://verifybee.com).
     
    6366== Changelog ==
    6467
     68= 1.2 =
     69* Added support for WP fluent forms
     70
     71= 1.1 =
     72* Fixes
     73
    6574= 1.0 =
    6675* New version released
  • form-verification-verifybee/trunk/cn-verifying-email.php

    r2203197 r2205609  
    1717 * Plugin URI:        https://verifybee.com
    1818 * Description:       This plugin validates emails before form submission
    19  * Version:           1.1.1
     19 * Version:           1.2
    2020 * Author:            VerifyBee
    2121 * Author URI:        https://verifybee.com
  • form-verification-verifybee/trunk/includes/class-cn-verifying-email.php

    r2203197 r2205609  
    182182        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
    183183        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
     184
    184185        $this->loader->add_filter( 'wpcf7_validate_email*', $plugin_public, 'custom_email_confirmation_validation_filter', 20, 2 );
    185186        $this->loader->add_filter( 'gform_field_validation', $plugin_public, 'cn_validation', 10, 4 );
    186         // add_filter( 'gform_field_validation', function ( $result, $value, $form, $field ) {
    187         //          if ( $field->get_input_type() === 'email' && $result['is_valid'] ) {
    188         //              $request_url = add_query_arg(
    189         //                  array(
    190         //                      'email'  => $value,
    191         //                      'apikey' => 'your_api_key_here',
    192         //                  ),
    193         //                  'http://api.quickemailverification.com/v1/verify'
    194         //              );
    195                  
    196         //              $response       = wp_remote_get( $request_url );
    197         //              $response_json  = wp_remote_retrieve_body( $response );
    198         //              $response_array = json_decode( $response_json, 1 );
    199                  
    200         //              if ( rgar( $response_array, 'result' ) !== 'valid' ) {
    201         //                  $result['is_valid'] = false;
    202         //                  $result['message']  = 'Email is invalid';
    203         //              }
    204         //          }
    205                  
    206         //          return $result;
    207         //      }, 10, 4 );
    208 
    209 
     187
     188        $this->loader->add_action( 'wp_ajax_Cn_Verifying_public_quiz_ajax', $plugin_public, 'cn_verifying_ajax_handaler' );
     189        $this->loader->add_action( 'wp_ajax_nopriv_Cn_Verifying_public_quiz_ajax', $plugin_public, 'cn_verifying_ajax_handaler' );
    210190       
    211191
     192        // $this->loader->add_action('cn_fluent_validation', 'fluent_validation', 10, 3 );
     193
     194        //$this->loader->add_action('fluentform_before_insert_submission', 'fluent_validation', 10, 2 );
    212195    }
    213196
  • form-verification-verifybee/trunk/public/class-cn-verifying-email-public.php

    r2203197 r2205609  
    9898
    9999        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/cn-verifying-email-public.js', array( 'jquery' ), $this->version, false );
     100        wp_localize_script( $this->plugin_name,'cn_verifying_plugin_vars', array('ajaxurl' => admin_url('admin-ajax.php'),'plugin_url' =>Cn_Verifying_Email_URI,'site_url'=>get_site_url()));
    100101
    101102    }
     
    180181        if ($field->get_input_type() === 'email' && $result['is_valid'] ) {
    181182            $cn_verification=get_option('cn_verification');
    182            
    183183            $cn_token=wp_kses(get_option('cn_token'), []);
    184184            $your_email = sanitize_email($value);
    185185            $error_message = $this->validate_email($cn_token, $cn_name, $your_email);
    186                
    187            
    188186            if ($error_message) {
    189187                $result['is_valid'] = false;
     
    194192    }
    195193
     194   
     195   
     196
     197    public function cn_verifying_ajax_handaler(){
     198        global $wpdb;
     199        $param= isset($_REQUEST['param'])?trim($_REQUEST['param']):"";
     200        if ($param=='fluent_validation') {
     201            $value= $_POST['cnemail'];
     202            $cn_verification=get_option('cn_verification');
     203            $cn_token=wp_kses(get_option('cn_token'), []);
     204            $your_email = sanitize_email($value);
     205            $error_message = $this->validate_email($cn_token, $cn_name, $your_email);
     206             if ($error_message) {
     207                $result['is_valid'] = false;
     208                $result['message']  = $error_message;
     209            }else{
     210                $result['is_valid'] = 'done';
     211            }
     212            echo json_encode($result);
     213        }
     214
     215        wp_die();
     216
     217    }
     218
    196219
    197220
  • form-verification-verifybee/trunk/public/js/cn-verifying-email-public.js

    r2203197 r2205609  
    11(function( $ ) {
    22    'use strict';
     3    $( document ).ready(function() {
     4        $('.ff-btn-submit').click(function(event) {
     5            event.preventDefault();             
     6            $('.cnvalidation').remove();
     7            var form_id=$('.frm-fluent-form').attr('data-form_id');
     8            var cnform_id=$('.frm-fluent-form').attr('id');
     9            var cndata=$('.frm-fluent-form :input').serialize();
     10            var cnemail =$("input[type='email']").val();
     11            if (cnemail) {
     12                jQuery.post(cn_verifying_plugin_vars.ajaxurl,{
     13                    'action': 'Cn_Verifying_public_quiz_ajax',
     14                    'param': 'fluent_validation',
     15                    'cnemail':cnemail
     16                }, function(response){
     17                    var newResponse = JSON.parse(response)
     18                    if (newResponse.message) {
     19                        var cnemail =$("input[type='email']").val();
     20                        $("input[type='email']").parent().after("<div class='cnvalidation' style='color:red;margin-bottom: 10px;'>"+newResponse.message+"</div>");
     21                    }
     22                    if (newResponse.is_valid=='done') {
     23                        $('.ff-btn-submit').parent().append('<div class="ff-loading"></div>');
     24                        jQuery.post(cn_verifying_plugin_vars.ajaxurl,{
     25                            'action': 'fluentform_submit',
     26                            'data':cndata,
     27                            'form_id':form_id
     28                        }, function(response){
     29                            if (response.data.result.action=='reset_form') {
     30                                $('.frm-fluent-form :input,textarea').val('');
     31                            }else{
     32                                $('.frm-fluent-form').hide();
     33                            }
     34                            $('.ff-loading').remove();
     35                            $(".frm-fluent-form").parent().after("<div id='fluentform_1_success' class='ff-message-success'>"+response.data.result.message+"</div>");
     36                           
     37                        });
     38                    }
     39                   
     40                });
     41            }else{
     42                $("input[type='email']").parent().after("<div class='cnvalidation' style='color:red;margin-bottom: 10px;'>This field is required</div>");
     43            }
     44           
    345
    4     /**
    5      * All of the code for your public-facing JavaScript source
    6      * should reside in this file.
    7      *
    8      * Note: It has been assumed you will write jQuery code here, so the
    9      * $ function reference has been prepared for usage within the scope
    10      * of this function.
    11      *
    12      * This enables you to define handlers, for when the DOM is ready:
    13      *
    14      * $(function() {
    15      *
    16      * });
    17      *
    18      * When the window is loaded:
    19      *
    20      * $( window ).load(function() {
    21      *
    22      * });
    23      *
    24      * ...and/or other possibilities.
    25      *
    26      * Ideally, it is not considered best practise to attach more than a
    27      * single DOM-ready or window-load handler for a particular page.
    28      * Although scripts in the WordPress core, Plugins and Themes may be
    29      * practising this, we should strive to set a better example in our own work.
    30      */
     46
     47
     48        });
     49       
     50    })
    3151
    3252})( jQuery );
Note: See TracChangeset for help on using the changeset viewer.