patch for jquery url validator working
This commit is contained in:
@@ -251,8 +251,8 @@ function my_custom_url_handler($query)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* in `wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php`
|
* in `wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php`
|
||||||
* line 1328 : wp_register_script( 'de_fb_validate', DE_FB_URL . '/js/jquery.validation/jquer
|
* Undefined variable: min_length in /var/www/html/wp-content/plugins/divi-form-builder/includes/modules/FormField/FormField.php on line 5933
|
||||||
* line 1354 : wp_enqueue_script( 'de_fb_validate' );
|
* 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()
|
function add_my_jquery_patch()
|
||||||
{
|
{
|
||||||
@@ -261,7 +261,7 @@ function add_my_jquery_patch()
|
|||||||
(
|
(
|
||||||
array
|
array
|
||||||
(
|
(
|
||||||
'de_fb_validate' => 'js/jquery_validator_patch.js',
|
'de_fb_validate' => 'js/jquery_validator_url_patch.js',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
console.log("-------------EXAMPLEEEEE----------------- :)");
|
|
||||||
console.log("PLGNTLS_data:");
|
console.log("PLGNTLS_data:");
|
||||||
console.log(PLGNTLS_data);
|
console.log(PLGNTLS_data);
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
console.log("-------------jquery----------------- :)");
|
|
||||||
// https://stackoverflow.com/questions/24938890/wordpress-jquery-noconflict
|
|
||||||
// https://wordpress.stackexchange.com/questions/104510/how-to-add-jquery-script-to-an-individual-page
|
|
||||||
// https://developer.wordpress.org/reference/functions/wp_enqueue_script/#jQuery_noConflict_Wrappers
|
|
||||||
//(function($) {
|
|
||||||
jQuery( document ).ready( function( $ ) {
|
|
||||||
|
|
||||||
$.validator.addMethod
|
|
||||||
(
|
|
||||||
'validUrl',
|
|
||||||
function(value, element)
|
|
||||||
{
|
|
||||||
var url = $.validator.methods.url.bind(this);
|
|
||||||
return url(value, element) || url('http://' + value, element);
|
|
||||||
},
|
|
||||||
'Please enter a valid URL'
|
|
||||||
);
|
|
||||||
|
|
||||||
} );
|
|
||||||
//})(jQuery);
|
|
||||||
8
plugins/fipfcard_plugin/js/jquery_validator_url_patch.js
vendored
Normal file
8
plugins/fipfcard_plugin/js/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'
|
||||||
|
);
|
||||||
@@ -195,11 +195,8 @@ class PLGNTLS_class
|
|||||||
global $wp_scripts;
|
global $wp_scripts;
|
||||||
$already_enqueued = array_search($file->handle, $wp_scripts->queue);
|
$already_enqueued = array_search($file->handle, $wp_scripts->queue);
|
||||||
if ($already_enqueued !== false)
|
if ($already_enqueued !== false)
|
||||||
{
|
|
||||||
error_log("double !");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if ($file->ext === "css")
|
else if ($file->ext === "css")
|
||||||
{
|
{
|
||||||
global $wp_styles;
|
global $wp_styles;
|
||||||
@@ -241,8 +238,6 @@ class PLGNTLS_class
|
|||||||
|
|
||||||
$file->basename = pathinfo($file_name, PATHINFO_BASENAME);
|
$file->basename = pathinfo($file_name, PATHINFO_BASENAME);
|
||||||
$file->handle = "PLGNTLS_" . str_replace(".", "_", $file->basename);
|
$file->handle = "PLGNTLS_" . str_replace(".", "_", $file->basename);
|
||||||
error_log("in init file->handle");
|
|
||||||
error_log(json_encode($file->handle));
|
|
||||||
|
|
||||||
$file->url = $this->get_url().$file_name;
|
$file->url = $this->get_url().$file_name;
|
||||||
$file->path = $this->get_path().$file_name;
|
$file->path = $this->get_path().$file_name;
|
||||||
|
|||||||
Reference in New Issue
Block a user