-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery-validation-for-contact-form-7.php
67 lines (55 loc) · 2.67 KB
/
jquery-validation-for-contact-form-7.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/*
Plugin Name: Jquery Validation For Contact Form 7
Plugin URI: http://dnesscarkey.com/jquery-validation/
Description: This plugin integrates jquery validation in contact form 7
Author: Dinesh Karki
Version: 3.1
Author URI: http://www.dineshkarki.com.np
*/
/* Copyright 2012 Dinesh Karki (email : [email protected])
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
$defaultOptionValues['jvcf7_show_label_error'] = "errorMsgshow";
$defaultOptionValues['jvcf7_invalid_field_design'] = "theme_1";
$optionValues = array();
foreach ($defaultOptionValues as $key=>$value){
$optionValues[$key] = get_option($key);
if (empty($optionValues[$key])){
update_option($key, $value);
$optionValues[$key] = $value;
}
}
function jvcf7_validation_js(){
global $optionValues;
echo '<script>
jvcf7_loading_url= "'.plugins_url('contact-form-7/images/ajax-loader.gif').'";
jvcf7_invalid_field_design = "'.$optionValues["jvcf7_invalid_field_design"].'";
jvcf7_show_label_error = "'.$optionValues["jvcf7_show_label_error"].'";
</script>';
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-form');
wp_enqueue_script('jvcf7_jquery_validate', plugins_url('jquery-validation-for-contact-form-7/js/jquery.validate.min.js'), array('jquery'), '', true);
wp_enqueue_script('jvcf7_jquery_validate_iban', plugins_url('jquery-validation-for-contact-form-7/js/iban.js'), array('jquery', 'jvcf7_jquery_validate'), '', true);
wp_dequeue_script( 'contact-form-7' );
wp_enqueue_script('jvcf7_validation_custom', plugins_url('jquery-validation-for-contact-form-7/js/jquery.jvcf7_validation.js'), '', '', true);
wp_register_style('jvcf7_style', plugins_url('jquery-validation-for-contact-form-7/css/jvcf7_validate.css'));
wp_enqueue_style('jvcf7_style');
}
function jvcf7_adminCsslibs(){
wp_register_style('jvcf7_style', plugins_url('jquery-validation-for-contact-form-7/css/jvcf7_validate.css'));
wp_enqueue_style('jvcf7_style');
}
add_action('wp_enqueue_scripts', 'jvcf7_validation_js');
add_action("admin_print_styles", 'jvcf7_adminCsslibs');
include('plugin_interface.php');
?>