added url patch as a separate plugin
This commit is contained in:
@@ -233,6 +233,7 @@ $_POST
|
||||
"form_type_confirm":""
|
||||
}
|
||||
*/
|
||||
|
||||
add_action('parse_request', 'my_custom_url_handler');
|
||||
function my_custom_url_handler($query)
|
||||
{
|
||||
@@ -254,18 +255,18 @@ function my_custom_url_handler($query)
|
||||
* Undefined variable: min_length in /var/www/html/wp-content/plugins/divi-form-builder/includes/modules/FormField/FormField.php on line 5933
|
||||
* Undefined variable: use_icon in /var/www/html/wp-content/plugins/divi-form-builder/includes/modules/FormField/FormField.php on line 5984
|
||||
*/
|
||||
function add_my_jquery_patch()
|
||||
{
|
||||
$fipfcard_tools = new PLGNTLS_class();
|
||||
return $fipfcard_tools->add_to_front
|
||||
(
|
||||
array
|
||||
(
|
||||
'de_fb_validate' => 'js/jquery_validator_url_patch.js',
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'add_my_jquery_patch');
|
||||
// function add_my_jquery_patch()
|
||||
// {
|
||||
// $fipfcard_tools = new PLGNTLS_class();
|
||||
// return $fipfcard_tools->add_to_front
|
||||
// (
|
||||
// array
|
||||
// (
|
||||
// 'de_fb_validate' => 'js/jquery_validator_url_patch.js',
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
// add_action('wp_enqueue_scripts', 'add_my_jquery_patch');
|
||||
|
||||
// Hook into the 'acf/save_post' action
|
||||
add_action('acf/save_post', 'handle_acf_form_submission', 5); // 20 is the priority, you can adjust it as needed
|
||||
|
||||
28
plugins/formbuilder_url_patch/formbuilder_url_patch.php
Normal file
28
plugins/formbuilder_url_patch/formbuilder_url_patch.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: formbuilder url patch
|
||||
Plugin URI:
|
||||
Description:
|
||||
Author: hugogogo
|
||||
Version: 1.1.0
|
||||
Author URI:
|
||||
*/
|
||||
|
||||
/**
|
||||
* in `wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php`
|
||||
* also :
|
||||
* - Undefined variable: min_length in /var/www/html/wp-content/plugins/divi-form-builder/includes/modules/FormField/FormField.php on line 5933
|
||||
* - Undefined variable: use_icon in /var/www/html/wp-content/plugins/divi-form-builder/includes/modules/FormField/FormField.php on line 5984
|
||||
*/
|
||||
function add_my_jquery_patch()
|
||||
{
|
||||
$handle = 'jquery_validator_url_patch';
|
||||
$url = plugin_dir_url(__FILE__) . 'jquery_validator_url_patch.js';
|
||||
$dependencies = array('de_fb_validate');
|
||||
$version = '';
|
||||
$defer = true;
|
||||
wp_enqueue_script( $handle, $url, $dependencies, $version, $defer);
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'add_my_jquery_patch');
|
||||
|
||||
?>
|
||||
8
plugins/formbuilder_url_patch/jquery_validator_url_patch.js
vendored
Normal file
8
plugins/formbuilder_url_patch/jquery_validator_url_patch.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// https://stackoverflow.com/questions/12741517/how-to-make-url-validation-without-http-or-add-it-after-validation-passed/44848476#44848476
|
||||
|
||||
let old_url = jQuery.validator.methods.url;
|
||||
jQuery.validator.addMethod( 'url', function(value, element) {
|
||||
let url = old_url.bind(this);
|
||||
return url(value, element) || url('http://' + value, element);
|
||||
}, 'Please enter a valid URL'
|
||||
);
|
||||
Reference in New Issue
Block a user