Plugin Directory

Changeset 3363442


Ignore:
Timestamp:
09/17/2025 05:58:08 PM (7 months ago)
Author:
codeapple
Message:

Fixed: Minor Google reCAPTCHA bugs

Location:
wordform
Files:
98 added
5 edited

Legend:

Unmodified
Added
Removed
  • wordform/trunk/assets/js/sc-wordform-frontend-misc-script.js

    r3282718 r3363442  
    66
    77jQuery(document).ready(function($) {   
    8     console.log('SC-WORDFORM-FRONTEND-OBJECT');
    9     console.log(sc_wordform_frontend_misc_script_obj);             
     8    // console.log('SC-WORDFORM-FRONTEND-OBJECT');
     9    // console.log(sc_wordform_frontend_misc_script_obj);               
    1010       
    1111        // Front-end Users Form Submission - Single Page Multiple Form Support
     
    3333            let wordform_total_files_uploading  = 0;       
    3434           
    35             console.log('wordform_selected_tmp_files');
    36             console.log(wordform_selected_tmp_files);       
     35            // console.log('wordform_selected_tmp_files');
     36            // console.log(wordform_selected_tmp_files);       
    3737
    3838            // Append Selected files into FormData to upload to server - index is the each input type file element Id attribute
     
    4040            // Find the name attribute to assign upload file data   
    4141            let inputTypeFileElementName = scWordformWrapper.find('#'+index).prop('name');
    42             console.log(inputTypeFileElementName );
     42            // console.log(inputTypeFileElementName );
    4343            wordform_formdata.delete( inputTypeFileElementName ); // Delete / Clear same name of FormData varriable before adding to avoid duplicate files uploading           
    4444            $.each( files, function(index, file) {
     
    4949            });
    5050
    51             console.log('Total File Uploading: '+ wordform_total_files_uploading );
     51            // console.log('Total File Uploading: '+ wordform_total_files_uploading );
    5252
    5353            wordform_formdata.append('action', 'sc_wordform_created_form_submission');
     
    5656            wordform_formdata.append('WordFormID', scWordFormID );
    5757
    58             console.log('wordform_formdata');
    59             console.log(wordform_formdata);
     58            // console.log('wordform_formdata');
     59            // console.log(wordform_formdata);
    6060
    6161            // Remove form submission report messages if exist
     
    6565            scWordformWrapper.find('.sc-wordform-error-msg').text('');
    6666
    67             // Whenn greCaptcha Key Available && greCaptcha integrated with form!
    68             if ( sc_wordform_frontend_misc_script_obj.gcaptcha_site_key.length > 0 && sc_wordform_frontend_misc_script_obj.gcaptcha_version === 'v3' ) {
    69                         console.log('gCaptcha Site Key: '+ sc_wordform_frontend_misc_script_obj.gcaptcha_site_key );
     67            // When greCaptcha Key Available && greCaptcha integrated with form!
     68            if ( sc_wordform_frontend_misc_script_obj.gcaptcha_site_key.length > 0
     69                        && sc_wordform_frontend_misc_script_obj.gcaptcha_version === 'v3'
     70                            &&  parseInt( sc_wordform_frontend_misc_script_obj?.gcaptcha_form_element_exist ) === 1 ) {
     71
     72                        // console.log('gCaptcha Site Key: '+ sc_wordform_frontend_misc_script_obj.gcaptcha_site_key );
    7073
    7174                        // greCaptcha Render
     
    8487                        grecaptcha.execute( sc_wordform_frontend_misc_script_obj.gcaptcha_site_key, {action: gCaptchaActionValue } ).then(function(token) {
    8588                         // grecaptcha.enterprise.execute( sc_wordform_frontend_misc_script_obj.gcaptcha_site_key, {action: gCaptchaActionValue } ).then(function(token) { 
    86                             console.log('grecaptcha.execute Token: '+ token );
     89                            // console.log('grecaptcha.execute Token: '+ token );
    8790                            // wordform_formdata.append('token', token );
    8891                            wordform_formdata.append( gCapcthaTokenInputElementName, token );               
    8992                            wordform_formdata.append( gCapcthaActionInputElementName, gCaptchaActionValue );
    9093
    91                               console.log('reCAPTCHA( V3 ) FORM SUBMISSION');
     94                            //   console.log('reCAPTCHA( V3 ) FORM SUBMISSION');
    9295                              $.ajax({
    9396                                xhr: function() {
     
    118121                                success: function(data) {
    119122                                    wordformProgressBarEle.width('0%');
    120                                     console.log(data);
     123                                    // console.log(data);
    121124                                    jsonData    = JSON.parse( data );           
    122                                     console.log(jsonData );
     125                                    // console.log(jsonData );
    123126                                    // Fail
    124127                                    if ( jsonData.status == 'fail' ) {
     
    177180                if ( typeof grecaptcha !== 'undefined' ) {
    178181                    try {
    179                         console.log('grecaptcha.getResponse(): ');
     182                        // console.log('grecaptcha.getResponse(): ');
    180183                        token = grecaptcha.getResponse();       
    181184                        wordform_formdata.append( gCapcthaTokenInputElementName, token );                               
    182                         console.log( token );
     185                        // console.log( token );
    183186                    }
    184187                    catch(error) {
     
    218221                success: function(data) {
    219222                    wordformProgressBarEle.width('0%');
    220                     console.log(data);
     223                    // console.log(data);
    221224                    jsonData    = JSON.parse( data );           
    222                     console.log(jsonData );
     225                    // console.log(jsonData );
    223226                    // Fail
    224227                    if ( jsonData.status == 'fail' ) {
     
    296299            UploadErrorMsgWrapper.html('');
    297300
    298             console.log('WordForm ID: '+ scWordformWrapperID );
    299             console.log(acceptFileExtensions);
     301            // console.log('WordForm ID: '+ scWordformWrapperID );
     302            // console.log(acceptFileExtensions);
    300303
    301304            // console.log('Upload Config data');
     
    307310            // Total Selected Files Number                     
    308311            if ( ( wordform_selected_total_file_numbers + e.target.files.length )  > sc_wordform_frontend_misc_script_obj.wordform_upload_config_data?.max_num_files_allowed ) {               
    309                 console.log('Total Selected Files:'+ ( wordform_selected_total_file_numbers + e.target.files.length ) );
     312                // console.log('Total Selected Files:'+ ( wordform_selected_total_file_numbers + e.target.files.length ) );
    310313                UploadErrorMsgWrapper.html( sc_wordform_frontend_misc_script_obj.info_file_icon + validationMessages.upload_maxinput_msg );                     
    311314            }
     
    322325                // console.log( acceptFileExtensions.split(',') );
    323326                for ( const file of e.target.files ) {     
    324                     console.log(file);                                     
     327                    // console.log(file);                                       
    325328                    if ( is_file_selected_once( file.name ) >= 0 ) {
    326329                        UploadErrorMsgWrapper.append( sc_wordform_frontend_misc_script_obj.info_file_icon +  file.name +' - '+ validationMessages.upload_filealready_added_msg );           
     
    352355                console.log('Total Selected Files:'+ wordform_selected_total_file_numbers );
    353356           }
    354            console.log(wordform_selected_tmp_files );
     357        //    console.log(wordform_selected_tmp_files );
    355358      });
    356359
     
    360363        // let inputTypeElementkey = $(this).closest('.wordform-selected-file-names-list').prop('id').split('-')[1];       
    361364        // let UploadErrorMsgWrapper = $('#wordformUploadTempError-' + inputTypeElementkey );       
    362         console.log( 'Remove File Name:'+ removeFileName );             
     365        // console.log( 'Remove File Name:'+ removeFileName );             
    363366        $.each( wordform_selected_tmp_files, function(index, files) {           
    364367            let removeItemIndex = files.findIndex( function(file) { return file?.name?.trim() == removeFileName.trim(); });         
     
    366369            if ( removeItemIndex !== -1 ) { files.splice( removeItemIndex, 1 ); }
    367370        });
    368         console.log( wordform_selected_tmp_files );
     371        // console.log( wordform_selected_tmp_files );
    369372         $(this).closest('li').remove();
    370373         // Update Total File Numbers on Remove
    371374         wordform_selected_total_file_numbers--;
    372         console.log('Total Selected Files:'+ wordform_selected_total_file_numbers );
     375        // console.log('Total Selected Files:'+ wordform_selected_total_file_numbers );
    373376      });
    374377   
     
    380383        $.each( selectedFiles, function( index, file ) {
    381384            total_size_in_bytes += file.size ||=0;
    382             console.log('Converted file.size into MB: '+ wordform_bytes_to_mb( file.size ) );
    383             console.log('Each File Size Allowed: '+ parseFloat( sc_wordform_frontend_misc_script_obj.wordform_upload_config_data?.each_file_max_size_allowed ) );
     385            // console.log('Converted file.size into MB: '+ wordform_bytes_to_mb( file.size ) );
     386            // console.log('Each File Size Allowed: '+ parseFloat( sc_wordform_frontend_misc_script_obj.wordform_upload_config_data?.each_file_max_size_allowed ) );
    384387            if ( wordform_bytes_to_mb( file.size ) > parseFloat( sc_wordform_frontend_misc_script_obj.wordform_upload_config_data?.each_file_max_size_allowed ) ) {
    385                 console.log( file.name + ' File Size '+ wordform_bytes_to_mb( file.size ) + ' Exceeded.' );
     388                // console.log( file.name + ' File Size '+ wordform_bytes_to_mb( file.size ) + ' Exceeded.' );
    386389                fileSizeInfo.singleFileSizeExceed = true;
    387390                return; // Break the loop
     
    398401            fileSizeInfo.multipleFileSizeExceed = true;
    399402        }
    400         console.log('All selected files total size:'+ wordform_bytes_to_mb( total_size_in_bytes ) );
     403        // console.log('All selected files total size:'+ wordform_bytes_to_mb( total_size_in_bytes ) );
    401404        return fileSizeInfo;
    402405      }
     
    438441        let offset = $(this).offset();
    439442        let selectedValue = $(this).val();
    440         console.log( selectedValue );
     443        // console.log( selectedValue );
    441444
    442445        wordformRangeValueDisplayEle.text( selectedValue );     
  • wordform/trunk/includes/class-sftcy-buildform.php

    r3282718 r3363442  
    746746            return $formdata;
    747747        }
     748
     749        /**
     750         * Find element Google reCAPTCHA exist in form elements
     751         * based on Google reCAPTCHA element exist in form elements load reCAPTCHA JS library
     752         * If not exist not required to load with form page
     753         * @return boolean true | false
     754         */
     755        public static function is_google_recaptcha_element_exist_in_built_form() {
     756            $searchValue = 'gcaptcha';
     757            $form_data = self::$form_elements;
     758            foreach ($form_data as $subArray) {
     759                    if (is_array($subArray)) {
     760                        if (in_array($searchValue, $subArray, true)) {
     761                            return true; // Found in sub-array
     762                        }
     763                    }
     764                }
     765                return false; // Not found in any sub-array         
     766        }
     767
    748768    } // End class
    749769}
  • wordform/trunk/includes/class-sftcy-wordform-ajaxhandler.php

    r3282718 r3363442  
    261261                               
    262262                // $enterprise_recaptcha_script_url = 'https://www.google.com/recaptcha/enterprise.js?sitekey=' . esc_attr( $gcaptcha_data['gcaptcha-site-key'] ) . '&badge=bottomleft';
    263                 if ( isset( $recaptcha_script_url ) && ! empty( $recaptcha_script_url ) ) {
     263                // Google reCAPTCHA script loaded only when reCAPTCHA element integrated with Form
     264                $google_recaptcha_element_exist_in_built_form = ( SFTCY_BuildForm::is_google_recaptcha_element_exist_in_built_form() === true )? 1 : 0;
     265                if ( isset( $recaptcha_script_url ) && ! empty( $recaptcha_script_url ) && $google_recaptcha_element_exist_in_built_form === 1  ) {                 
    264266                    wp_enqueue_script( 'sc-wordform-frontend-google-recaptcha-script', $recaptcha_script_url, array( 'jquery' ), SFTCY_WORDFORM_VERSION, true );                   
    265267                }
    266 
    267268
    268269                // Localize script
     
    283284                        'gcaptcha_site_key'       => $gcaptcha_data['gcaptcha-site-key'],
    284285                        'gcaptcha_type'           => $gcaptcha_data['gcaptcha-type'],                       
    285                         'gcaptcha_version'        => $gcaptcha_data['gcaptcha-version'],                       
     286                        'gcaptcha_version'        => $gcaptcha_data['gcaptcha-version'],
     287                        'gcaptcha_form_element_exist' =>  $google_recaptcha_element_exist_in_built_form,  // gcaptcha added or not into form - 1 | 0                       
    286288                    )
    287289                );
  • wordform/trunk/readme.txt

    r3359106 r3363442  
    33Donate link: https://www.buymeacoffee.com/softcoy
    44Plugin URI: https://www.softcoy.com/wordform/
    5 Tags: Drag & Drop Form Builder, No-Code WordPress Forms, Captcha Forms, Block Editor Form Integration, Easy Form Builder Plugin
     5Tags: form builder, drag and drop, contact form, captcha, block editor
    66Requires at least: 6.2
    77Tested up to: 6.8
    8 Stable tag: 2.0.1
     8Stable tag: 2.0.2
    99Requires PHP: 7.4
    1010License: GPLv3
     
    2020[How to check users form submission data](https://youtu.be/8MxaKekcBl0)
    2121[How to edit your created forms](https://youtu.be/0AdmQh1WuOs)
     22[In Wordform, you can easily integrate Google reCAPTCHA to keep your forms secure](https://www.youtube.com/watch?v=95sVtBaOPgs)
     23[With Wordform, customizing validation messages is simple, flexible, and user-friendly](https://www.youtube.com/watch?v=Z_olDQypzHs)
     24[WordForm makes it effortless to manage all your form submissions—right from your WordPress dashboard](https://www.youtube.com/watch?v=khyIixubn7g)
     25[You're just a few quick steps away from making the form publish and ready to collect user responses](https://www.youtube.com/watch?v=qCINIvrNZMc)
     26[WordForm is a powerful drag-and-drop form builder plugin, allowing you to create custom forms easily](https://www.youtube.com/watch?v=Mbbv-_MfZc0)
     27
    2228
    2329
     
    105111== Changelog ==
    106112
     113= 2.0.2 =
     114* Fixed: Minor Google reCAPTCHA bugs
     115
    107116= 2.0.1 =
    108117* Fixed: Minor bugs
     
    142151
    143152== Upgrade Notice ==
    144 = 2.0.1 =
     153= 2.0.2 =
    145154Upgrade to the latest version.
  • wordform/trunk/wordform.php

    r3359106 r3363442  
    44 * Plugin URI:  http://softcoy.com/wordform/
    55 * Description: WordForm – The intuitive drag-and-drop form builder for WordPress. Effortlessly create and embed custom forms into any page or post using full block editor support—no coding required.
    6  * Version:     2.0.1
     6 * Version:     2.0.2
    77 * Author:      SOFTCOY
    88 * Author URI:  https://softcoy.com/
     
    2222
    2323if ( ! defined( 'SFTCY_WORDFORM_VERSION' ) ) {
    24     define( 'SFTCY_WORDFORM_VERSION', '2.0.1' );
     24    define( 'SFTCY_WORDFORM_VERSION', '2.0.2' );
    2525}
    2626if ( ! defined( 'SFTCY_WORDFORM_MINIMUM_PHP_VERSION' ) ) {
Note: See TracChangeset for help on using the changeset viewer.