Version Description
- Moved PO files to the external branch. They were space-consuming and enlarging the plugin package.
- Added an option for size attribute of <input type="file">.
- Added 'acceptance_as_validation' additional setting. This setting allows you to use acceptance checkbox as object of validation.
- Added watermark support to text, email and textarea tags.
- Use the latest jQuery Form plugin instead of the old one which WordPress bundles.
Releases
=
Download this release
Release Info
Developer | takayukister |
Plugin | ![]() |
Version | 2.4 |
Comparing to | |
See all releases |
Code changes from version 2.3.1 to 2.4
- admin/scripts.js +95 -91
- includes/classes.php +57 -5
- includes/controller.php +17 -9
- includes/functions.php +34 -8
- includes/shortcodes.php +19 -2
- jquery.form.js +781 -0
- languages/readme.txt +9 -0
- languages/wpcf7-af.po +0 -809
- languages/wpcf7-ar.po +0 -349
- languages/wpcf7-bg_BG.po +0 -289
- languages/wpcf7-bn_BD.po +0 -437
- languages/wpcf7-bs.po +0 -427
- languages/wpcf7-ca.po +0 -516
- languages/wpcf7-cs_CZ.po +0 -504
- languages/wpcf7-da_DK.mo +0 -0
- languages/wpcf7-da_DK.po +0 -842
- languages/wpcf7-de_DE.po +0 -844
- languages/wpcf7-el.po +0 -468
- languages/wpcf7-es_ES.po +0 -437
- languages/wpcf7-et.po +0 -819
- languages/wpcf7-fa_IR.po +0 -511
- languages/wpcf7-fi.po +0 -838
- languages/wpcf7-fr_FR.po +0 -977
- languages/wpcf7-gl_ES.po +0 -836
- languages/wpcf7-he_IL.po +0 -509
- languages/wpcf7-hi_IN.po +0 -804
- languages/wpcf7-hr.po +0 -427
- languages/wpcf7-hu_HU.po +0 -823
- languages/wpcf7-id_ID.po +0 -308
- languages/wpcf7-it_IT.po +0 -856
- languages/wpcf7-ja.mo +0 -0
- languages/wpcf7-ja.po +0 -843
- languages/wpcf7-ka_GE.po +0 -213
- languages/wpcf7-ko_KR.po +0 -446
- languages/wpcf7-lt_LT.po +0 -488
- languages/wpcf7-lv.po +0 -432
- languages/wpcf7-ml_IN.po +0 -813
- languages/wpcf7-nb_NO.po +0 -266
- languages/wpcf7-nl_NL.po +0 -469
- languages/wpcf7-pl_PL.po +0 -500
- languages/wpcf7-pt_BR.po +0 -837
- languages/wpcf7-pt_PT.po +0 -305
- languages/wpcf7-ro_RO.po +0 -407
- languages/wpcf7-ru_RU.po +0 -213
- languages/wpcf7-sk.po +0 -816
- languages/wpcf7-sl_SI.po +0 -213
- languages/wpcf7-sq.po +0 -305
- languages/wpcf7-sr_RS.po +0 -858
- languages/wpcf7-sv_SE.po +0 -443
- languages/wpcf7-th.po +0 -819
- languages/wpcf7-tr_TR.po +0 -502
- languages/wpcf7-uk.po +0 -850
- languages/wpcf7-vi.po +0 -405
- languages/wpcf7-zh_CN.po +0 -306
- languages/wpcf7-zh_TW.po +0 -833
- languages/wpcf7.pot +145 -136
- modules/acceptance.php +57 -11
- modules/captcha.php +7 -16
- modules/checkbox.php +21 -22
- modules/file.php +18 -17
- modules/quiz.php +3 -15
- modules/response.php +4 -4
- modules/select.php +6 -12
- modules/text.php +25 -20
- modules/textarea.php +23 -20
- readme.txt +12 -20
- scripts.js +185 -140
- styles.css +4 -0
- wp-contact-form-7.php +2 -2
admin/scripts.js
CHANGED
@@ -1,112 +1,116 @@
|
|
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 |
-
jQuery(this).removeClass('focus');
|
36 |
-
jQuery(this).css({
|
37 |
-
cursor: 'pointer',
|
38 |
-
color: '#555',
|
39 |
-
border: 'none',
|
40 |
-
font: 'bold 20px serif',
|
41 |
-
'background-color': '#fff'
|
42 |
});
|
43 |
-
});
|
44 |
|
45 |
-
jQuery('input#wpcf7-title').change(function() {
|
46 |
updateTag();
|
47 |
-
});
|
48 |
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
jQuery('#mail-2-fields').hide();
|
54 |
|
55 |
-
|
56 |
-
if (
|
57 |
-
|
58 |
-
|
59 |
-
} else
|
60 |
-
|
61 |
-
|
62 |
}
|
63 |
});
|
64 |
-
}
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
jQuery('#message-fields-toggle-switch').click(function() {
|
70 |
-
if (jQuery('#message-fields').is(':hidden')) {
|
71 |
-
jQuery('#message-fields').slideDown('fast');
|
72 |
-
jQuery('#message-fields-toggle-switch').text(_wpcf7L10n.hide);
|
73 |
} else {
|
74 |
-
|
75 |
-
|
76 |
}
|
77 |
-
});
|
78 |
-
|
79 |
-
if ('' == jQuery.trim(jQuery('#wpcf7-additional-settings').text())) {
|
80 |
-
jQuery('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.show);
|
81 |
-
jQuery('#additional-settings-fields').hide();
|
82 |
-
} else {
|
83 |
-
jQuery('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.hide);
|
84 |
-
jQuery('#additional-settings-fields').show();
|
85 |
-
}
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
});
|
100 |
|
101 |
-
function updateTag() {
|
102 |
-
|
103 |
|
104 |
-
|
105 |
-
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
110 |
|
111 |
-
|
112 |
-
}
|
1 |
+
(function($) {
|
2 |
+
|
3 |
+
$(function() {
|
4 |
+
try {
|
5 |
+
$.extend($.tgPanes, _wpcf7.tagGenerators);
|
6 |
+
$('#taggenerator').tagGenerator(_wpcf7L10n.generateTag,
|
7 |
+
{ dropdownIconUrl: _wpcf7.pluginUrl + '/images/dropdown.gif' });
|
8 |
+
|
9 |
+
$('input#wpcf7-title:enabled').css({
|
10 |
+
cursor: 'pointer'
|
11 |
+
});
|
12 |
+
|
13 |
+
$('input#wpcf7-title').mouseover(function() {
|
14 |
+
$(this).not('.focus').css({
|
15 |
+
'background-color': '#ffffdd'
|
16 |
+
});
|
17 |
+
});
|
18 |
+
|
19 |
+
$('input#wpcf7-title').mouseout(function() {
|
20 |
+
$(this).css({
|
21 |
+
'background-color': '#fff'
|
22 |
+
});
|
23 |
});
|
|
|
24 |
|
25 |
+
$('input#wpcf7-title').focus(function() {
|
26 |
+
$(this).addClass('focus');
|
27 |
+
$(this).css({
|
28 |
+
cursor: 'text',
|
29 |
+
color: '#333',
|
30 |
+
border: '1px solid #777',
|
31 |
+
font: 'normal 13px Verdana, Arial, Helvetica, sans-serif',
|
32 |
+
'background-color': '#fff'
|
33 |
+
});
|
34 |
});
|
35 |
+
|
36 |
+
$('input#wpcf7-title').blur(function() {
|
37 |
+
$(this).removeClass('focus');
|
38 |
+
$(this).css({
|
39 |
+
cursor: 'pointer',
|
40 |
+
color: '#555',
|
41 |
+
border: 'none',
|
42 |
+
font: 'bold 20px serif',
|
43 |
+
'background-color': '#fff'
|
44 |
+
});
|
45 |
});
|
46 |
+
|
47 |
+
$('input#wpcf7-title').change(function() {
|
48 |
+
updateTag();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
});
|
|
|
50 |
|
|
|
51 |
updateTag();
|
|
|
52 |
|
53 |
+
if ($.support.objectAll) {
|
54 |
+
if (! $('#wpcf7-mail-2-active').is(':checked'))
|
55 |
+
$('#mail-2-fields').hide();
|
56 |
+
|
57 |
+
$('#wpcf7-mail-2-active').click(function() {
|
58 |
+
if ($('#mail-2-fields').is(':hidden')
|
59 |
+
&& $('#wpcf7-mail-2-active').is(':checked')) {
|
60 |
+
$('#mail-2-fields').slideDown('fast');
|
61 |
+
} else if ($('#mail-2-fields').is(':visible')
|
62 |
+
&& $('#wpcf7-mail-2-active').not(':checked')) {
|
63 |
+
$('#mail-2-fields').slideUp('fast');
|
64 |
+
}
|
65 |
+
});
|
66 |
+
}
|
67 |
|
68 |
+
$('#message-fields-toggle-switch').text(_wpcf7L10n.show);
|
69 |
+
$('#message-fields').hide();
|
|
|
70 |
|
71 |
+
$('#message-fields-toggle-switch').click(function() {
|
72 |
+
if ($('#message-fields').is(':hidden')) {
|
73 |
+
$('#message-fields').slideDown('fast');
|
74 |
+
$('#message-fields-toggle-switch').text(_wpcf7L10n.hide);
|
75 |
+
} else {
|
76 |
+
$('#message-fields').hide('fast');
|
77 |
+
$('#message-fields-toggle-switch').text(_wpcf7L10n.show);
|
78 |
}
|
79 |
});
|
|
|
80 |
|
81 |
+
if ('' == $.trim($('#wpcf7-additional-settings').text())) {
|
82 |
+
$('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.show);
|
83 |
+
$('#additional-settings-fields').hide();
|
|
|
|
|
|
|
|
|
84 |
} else {
|
85 |
+
$('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.hide);
|
86 |
+
$('#additional-settings-fields').show();
|
87 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
+
$('#additional-settings-fields-toggle-switch').click(function() {
|
90 |
+
if ($('#additional-settings-fields').is(':hidden')) {
|
91 |
+
$('#additional-settings-fields').slideDown('fast');
|
92 |
+
$('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.hide);
|
93 |
+
} else {
|
94 |
+
$('#additional-settings-fields').hide('fast');
|
95 |
+
$('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.show);
|
96 |
+
}
|
97 |
+
});
|
98 |
|
99 |
+
} catch (e) {
|
100 |
+
}
|
101 |
+
});
|
102 |
|
103 |
+
function updateTag() {
|
104 |
+
var title = $('input#wpcf7-title').val();
|
105 |
|
106 |
+
if (title)
|
107 |
+
title = title.replace(/["'\[\]]/g, '');
|
108 |
|
109 |
+
$('input#wpcf7-title').val(title);
|
110 |
+
var current = $('input#wpcf7-id').val();
|
111 |
+
var tag = '[contact-form ' + current + ' "' + title + '"]';
|
112 |
+
|
113 |
+
$('input#contact-form-anchor-text').val(tag);
|
114 |
+
}
|
115 |
|
116 |
+
})(jQuery);
|
|
includes/classes.php
CHANGED
@@ -33,6 +33,20 @@ class WPCF7_ContactForm {
|
|
33 |
return false;
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/* Generating Form HTML */
|
37 |
|
38 |
function form_html() {
|
@@ -46,12 +60,11 @@ class WPCF7_ContactForm {
|
|
46 |
$url .= '#' . $this->unit_tag;
|
47 |
|
48 |
$url = apply_filters( 'wpcf7_form_action_url', $url );
|
49 |
-
$url = esc_url_raw( $url );
|
50 |
-
|
51 |
$enctype = apply_filters( 'wpcf7_form_enctype', '' );
|
|
|
52 |
|
53 |
-
$form .= '<form action="' . $url
|
54 |
-
. '
|
55 |
$form .= '<div style="display: none;">' . "\n";
|
56 |
$form .= '<input type="hidden" name="_wpcf7" value="'
|
57 |
. esc_attr( $this->id ) . '" />' . "\n";
|
@@ -122,8 +135,10 @@ class WPCF7_ContactForm {
|
|
122 |
|
123 |
$form = $this->form;
|
124 |
|
125 |
-
if ( WPCF7_AUTOP )
|
|
|
126 |
$form = wpcf7_autop( $form );
|
|
|
127 |
|
128 |
$form = $wpcf7_shortcode_manager->do_shortcode( $form );
|
129 |
$this->scanned_form_tags = $wpcf7_shortcode_manager->scanned_tags;
|
@@ -584,4 +599,41 @@ function wpcf7_contact_form_default_pack( $locale = null ) {
|
|
584 |
return $contact_form;
|
585 |
}
|
586 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
587 |
?>
|
33 |
return false;
|
34 |
}
|
35 |
|
36 |
+
function clear_post() {
|
37 |
+
$fes = $this->form_scan_shortcode();
|
38 |
+
|
39 |
+
foreach ( $fes as $fe ) {
|
40 |
+
$name = $fe['name'];
|
41 |
+
|
42 |
+
if ( empty( $name ) )
|
43 |
+
continue;
|
44 |
+
|
45 |
+
if ( isset( $_POST[$name] ) )
|
46 |
+
unset( $_POST[$name] );
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
/* Generating Form HTML */
|
51 |
|
52 |
function form_html() {
|
60 |
$url .= '#' . $this->unit_tag;
|
61 |
|
62 |
$url = apply_filters( 'wpcf7_form_action_url', $url );
|
|
|
|
|
63 |
$enctype = apply_filters( 'wpcf7_form_enctype', '' );
|
64 |
+
$class = apply_filters( 'wpcf7_form_class_attr', 'wpcf7-form' );
|
65 |
|
66 |
+
$form .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
|
67 |
+
. ' class="' . esc_attr( $class ) . '"' . $enctype . '>' . "\n";
|
68 |
$form .= '<div style="display: none;">' . "\n";
|
69 |
$form .= '<input type="hidden" name="_wpcf7" value="'
|
70 |
. esc_attr( $this->id ) . '" />' . "\n";
|
135 |
|
136 |
$form = $this->form;
|
137 |
|
138 |
+
if ( WPCF7_AUTOP ) {
|
139 |
+
$form = $wpcf7_shortcode_manager->normalize_shortcode( $form );
|
140 |
$form = wpcf7_autop( $form );
|
141 |
+
}
|
142 |
|
143 |
$form = $wpcf7_shortcode_manager->do_shortcode( $form );
|
144 |
$this->scanned_form_tags = $wpcf7_shortcode_manager->scanned_tags;
|
599 |
return $contact_form;
|
600 |
}
|
601 |
|
602 |
+
function wpcf7_get_current_contact_form() {
|
603 |
+
global $wpcf7_contact_form;
|
604 |
+
|
605 |
+
if ( ! is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
|
606 |
+
return null;
|
607 |
+
|
608 |
+
return $wpcf7_contact_form;
|
609 |
+
}
|
610 |
+
|
611 |
+
function wpcf7_is_posted() {
|
612 |
+
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
613 |
+
return false;
|
614 |
+
|
615 |
+
return $contact_form->is_posted();
|
616 |
+
}
|
617 |
+
|
618 |
+
function wpcf7_get_validation_error( $name ) {
|
619 |
+
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
620 |
+
return '';
|
621 |
+
|
622 |
+
return $contact_form->validation_error( $name );
|
623 |
+
}
|
624 |
+
|
625 |
+
function wpcf7_get_message( $status ) {
|
626 |
+
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
627 |
+
return '';
|
628 |
+
|
629 |
+
return $contact_form->message( $status );
|
630 |
+
}
|
631 |
+
|
632 |
+
function wpcf7_scan_shortcode( $cond = null ) {
|
633 |
+
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
634 |
+
return null;
|
635 |
+
|
636 |
+
return $contact_form->form_scan_shortcode( $cond );
|
637 |
+
}
|
638 |
+
|
639 |
?>
|
includes/controller.php
CHANGED
@@ -63,19 +63,19 @@ function wpcf7_ajax_json_echo() {
|
|
63 |
'message' => $reason );
|
64 |
}
|
65 |
|
66 |
-
$items['message'] =
|
67 |
$items['invalids'] = $invalids;
|
68 |
|
69 |
} elseif ( ! $wpcf7_contact_form->accepted() ) { // Not accepted terms
|
70 |
-
$items['message'] =
|
71 |
|
72 |
} elseif ( $wpcf7_contact_form->akismet() ) { // Spam!
|
73 |
-
$items['message'] =
|
74 |
$items['spam'] = true;
|
75 |
|
76 |
} elseif ( $wpcf7_contact_form->mail() ) {
|
77 |
$items['mailSent'] = true;
|
78 |
-
$items['message'] =
|
79 |
|
80 |
$on_sent_ok = $wpcf7_contact_form->additional_setting( 'on_sent_ok', false );
|
81 |
if ( ! empty( $on_sent_ok ) ) {
|
@@ -88,7 +88,7 @@ function wpcf7_ajax_json_echo() {
|
|
88 |
do_action_ref_array( 'wpcf7_mail_sent', array( &$wpcf7_contact_form ) );
|
89 |
|
90 |
} else {
|
91 |
-
$items['message'] =
|
92 |
}
|
93 |
|
94 |
// remove upload files
|
@@ -125,15 +125,17 @@ function wpcf7_process_nonajax_submitting() {
|
|
125 |
if ( ! $validation['valid'] ) {
|
126 |
$_POST['_wpcf7_validation_errors'] = array( 'id' => $id, 'messages' => $validation['reason'] );
|
127 |
} elseif ( ! $wpcf7_contact_form->accepted() ) { // Not accepted terms
|
128 |
-
$_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => false, 'message' =>
|
129 |
} elseif ( $wpcf7_contact_form->akismet() ) { // Spam!
|
130 |
-
$_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => false, 'message' =>
|
131 |
} elseif ( $wpcf7_contact_form->mail() ) {
|
132 |
-
$_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => true, 'message' =>
|
133 |
|
134 |
do_action_ref_array( 'wpcf7_mail_sent', array( &$wpcf7_contact_form ) );
|
|
|
|
|
135 |
} else {
|
136 |
-
$_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => false, 'message' =>
|
137 |
}
|
138 |
|
139 |
// remove upload files
|
@@ -244,6 +246,12 @@ if ( WPCF7_LOAD_JS )
|
|
244 |
add_action( 'wp_print_scripts', 'wpcf7_enqueue_scripts' );
|
245 |
|
246 |
function wpcf7_enqueue_scripts() {
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
$in_footer = true;
|
248 |
if ( 'header' === WPCF7_LOAD_JS )
|
249 |
$in_footer = false;
|
63 |
'message' => $reason );
|
64 |
}
|
65 |
|
66 |
+
$items['message'] = wpcf7_get_message( 'validation_error' );
|
67 |
$items['invalids'] = $invalids;
|
68 |
|
69 |
} elseif ( ! $wpcf7_contact_form->accepted() ) { // Not accepted terms
|
70 |
+
$items['message'] = wpcf7_get_message( 'accept_terms' );
|
71 |
|
72 |
} elseif ( $wpcf7_contact_form->akismet() ) { // Spam!
|
73 |
+
$items['message'] = wpcf7_get_message( 'akismet_says_spam' );
|
74 |
$items['spam'] = true;
|
75 |
|
76 |
} elseif ( $wpcf7_contact_form->mail() ) {
|
77 |
$items['mailSent'] = true;
|
78 |
+
$items['message'] = wpcf7_get_message( 'mail_sent_ok' );
|
79 |
|
80 |
$on_sent_ok = $wpcf7_contact_form->additional_setting( 'on_sent_ok', false );
|
81 |
if ( ! empty( $on_sent_ok ) ) {
|
88 |
do_action_ref_array( 'wpcf7_mail_sent', array( &$wpcf7_contact_form ) );
|
89 |
|
90 |
} else {
|
91 |
+
$items['message'] = wpcf7_get_message( 'mail_sent_ng' );
|
92 |
}
|
93 |
|
94 |
// remove upload files
|
125 |
if ( ! $validation['valid'] ) {
|
126 |
$_POST['_wpcf7_validation_errors'] = array( 'id' => $id, 'messages' => $validation['reason'] );
|
127 |
} elseif ( ! $wpcf7_contact_form->accepted() ) { // Not accepted terms
|
128 |
+
$_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => false, 'message' => wpcf7_get_message( 'accept_terms' ) );
|
129 |
} elseif ( $wpcf7_contact_form->akismet() ) { // Spam!
|
130 |
+
$_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => false, 'message' => wpcf7_get_message( 'akismet_says_spam' ), 'spam' => true );
|
131 |
} elseif ( $wpcf7_contact_form->mail() ) {
|
132 |
+
$_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => true, 'message' => wpcf7_get_message( 'mail_sent_ok' ) );
|
133 |
|
134 |
do_action_ref_array( 'wpcf7_mail_sent', array( &$wpcf7_contact_form ) );
|
135 |
+
|
136 |
+
$wpcf7_contact_form->clear_post();
|
137 |
} else {
|
138 |
+
$_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => false, 'message' => wpcf7_get_message( 'mail_sent_ng' ) );
|
139 |
}
|
140 |
|
141 |
// remove upload files
|
246 |
add_action( 'wp_print_scripts', 'wpcf7_enqueue_scripts' );
|
247 |
|
248 |
function wpcf7_enqueue_scripts() {
|
249 |
+
// jquery.form.js originally bundled with WordPress is out of date and deprecated
|
250 |
+
// so we need to deregister it and re-register the latest one
|
251 |
+
wp_deregister_script( 'jquery-form' );
|
252 |
+
wp_register_script( 'jquery-form', wpcf7_plugin_url( 'jquery.form.js' ),
|
253 |
+
array( 'jquery' ), '2.47', true );
|
254 |
+
|
255 |
$in_footer = true;
|
256 |
if ( 'header' === WPCF7_LOAD_JS )
|
257 |
$in_footer = false;
|
includes/functions.php
CHANGED
@@ -96,32 +96,58 @@ function wpcf7_default_messages_template() {
|
|
96 |
}
|
97 |
|
98 |
function wpcf7_upload_dir( $type = false ) {
|
|
|
|
|
99 |
$siteurl = get_option( 'siteurl' );
|
100 |
$upload_path = trim( get_option( 'upload_path' ) );
|
101 |
-
|
|
|
|
|
|
|
102 |
$dir = WP_CONTENT_DIR . '/uploads';
|
103 |
-
else
|
104 |
$dir = $upload_path;
|
105 |
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
if ( ! $url = get_option( 'upload_url_path' ) ) {
|
109 |
-
if ( empty( $upload_path )
|
|
|
|
|
110 |
$url = WP_CONTENT_URL . '/uploads';
|
111 |
else
|
112 |
$url = trailingslashit( $siteurl ) . $upload_path;
|
113 |
}
|
114 |
|
115 |
-
if ( defined( 'UPLOADS' )
|
|
|
116 |
$dir = ABSPATH . UPLOADS;
|
117 |
$url = trailingslashit( $siteurl ) . UPLOADS;
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
if ( 'dir' == $type )
|
121 |
-
return $dir;
|
122 |
if ( 'url' == $type )
|
123 |
-
return $url;
|
124 |
-
|
|
|
125 |
}
|
126 |
|
127 |
function wpcf7_l10n() {
|
96 |
}
|
97 |
|
98 |
function wpcf7_upload_dir( $type = false ) {
|
99 |
+
global $switched;
|
100 |
+
|
101 |
$siteurl = get_option( 'siteurl' );
|
102 |
$upload_path = trim( get_option( 'upload_path' ) );
|
103 |
+
|
104 |
+
$main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site();
|
105 |
+
|
106 |
+
if ( empty( $upload_path ) ) {
|
107 |
$dir = WP_CONTENT_DIR . '/uploads';
|
108 |
+
} else {
|
109 |
$dir = $upload_path;
|
110 |
|
111 |
+
if ( 'wp-content/uploads' == $upload_path ) {
|
112 |
+
$dir = WP_CONTENT_DIR . '/uploads';
|
113 |
+
} elseif ( 0 !== strpos( $dir, ABSPATH ) ) {
|
114 |
+
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
|
115 |
+
$dir = path_join( ABSPATH, $dir );
|
116 |
+
}
|
117 |
+
}
|
118 |
|
119 |
if ( ! $url = get_option( 'upload_url_path' ) ) {
|
120 |
+
if ( empty( $upload_path )
|
121 |
+
|| ( 'wp-content/uploads' == $upload_path )
|
122 |
+
|| ( $upload_path == $dir ) )
|
123 |
$url = WP_CONTENT_URL . '/uploads';
|
124 |
else
|
125 |
$url = trailingslashit( $siteurl ) . $upload_path;
|
126 |
}
|
127 |
|
128 |
+
if ( defined( 'UPLOADS' ) && ! $main_override
|
129 |
+
&& ( ! isset( $switched ) || $switched === false ) ) {
|
130 |
$dir = ABSPATH . UPLOADS;
|
131 |
$url = trailingslashit( $siteurl ) . UPLOADS;
|
132 |
}
|
133 |
|
134 |
+
if ( is_multisite() && ! $main_override
|
135 |
+
&& ( ! isset( $switched ) || $switched === false ) ) {
|
136 |
+
|
137 |
+
if ( defined( 'BLOGUPLOADDIR' ) )
|
138 |
+
$dir = untrailingslashit( BLOGUPLOADDIR );
|
139 |
+
|
140 |
+
$url = str_replace( UPLOADS, 'files', $url );
|
141 |
+
}
|
142 |
+
|
143 |
+
$uploads = apply_filters( 'wpcf7_upload_dir', array( 'dir' => $dir, 'url' => $url ) );
|
144 |
+
|
145 |
if ( 'dir' == $type )
|
146 |
+
return $uploads['dir'];
|
147 |
if ( 'url' == $type )
|
148 |
+
return $uploads['url'];
|
149 |
+
|
150 |
+
return $uploads;
|
151 |
}
|
152 |
|
153 |
function wpcf7_l10n() {
|
includes/shortcodes.php
CHANGED
@@ -21,16 +21,33 @@ class WPCF7_ShortcodeManager {
|
|
21 |
unset( $this->shortcode_tags[$tag] );
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
function do_shortcode( $content, $exec = true ) {
|
25 |
$this->exec = (bool) $exec;
|
26 |
$this->scanned_tags = array();
|
27 |
|
28 |
-
if ( empty( $this->shortcode_tags ) || ! is_array( $this->shortcode_tags) )
|
29 |
return $content;
|
30 |
|
31 |
$pattern = $this->get_shortcode_regex();
|
32 |
return preg_replace_callback( '/' . $pattern . '/s',
|
33 |
-
array(&$this, 'do_shortcode_tag'), $content );
|
34 |
}
|
35 |
|
36 |
function scan_shortcode( $content ) {
|
21 |
unset( $this->shortcode_tags[$tag] );
|
22 |
}
|
23 |
|
24 |
+
function normalize_shortcode( $content ) {
|
25 |
+
if ( empty( $this->shortcode_tags ) || ! is_array( $this->shortcode_tags ) )
|
26 |
+
return $content;
|
27 |
+
|
28 |
+
$pattern = $this->get_shortcode_regex();
|
29 |
+
return preg_replace_callback( '/' . $pattern . '/s',
|
30 |
+
array( &$this, 'normalize_space_cb' ), $content );
|
31 |
+
}
|
32 |
+
|
33 |
+
function normalize_space_cb( $m ) {
|
34 |
+
// allow [[foo]] syntax for escaping a tag
|
35 |
+
if ( $m[1] == '[' && $m[6] == ']' )
|
36 |
+
return $m[0];
|
37 |
+
|
38 |
+
return preg_replace( '/\s+/', ' ', $m[0] );
|
39 |
+
}
|
40 |
+
|
41 |
function do_shortcode( $content, $exec = true ) {
|
42 |
$this->exec = (bool) $exec;
|
43 |
$this->scanned_tags = array();
|
44 |
|
45 |
+
if ( empty( $this->shortcode_tags ) || ! is_array( $this->shortcode_tags ) )
|
46 |
return $content;
|
47 |
|
48 |
$pattern = $this->get_shortcode_regex();
|
49 |
return preg_replace_callback( '/' . $pattern . '/s',
|
50 |
+
array( &$this, 'do_shortcode_tag' ), $content );
|
51 |
}
|
52 |
|
53 |
function scan_shortcode( $content ) {
|
jquery.form.js
ADDED
@@ -0,0 +1,781 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* jQuery Form Plugin
|
3 |
+
* version: 2.47 (04-SEP-2010)
|
4 |
+
* @requires jQuery v1.3.2 or later
|
5 |
+
*
|
6 |
+
* Examples and documentation at: http://malsup.com/jquery/form/
|
7 |
+
* Dual licensed under the MIT and GPL licenses:
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
* http://www.gnu.org/licenses/gpl.html
|
10 |
+
*/
|
11 |
+
;(function($) {
|
12 |
+
|
13 |
+
/*
|
14 |
+
Usage Note:
|
15 |
+
-----------
|
16 |
+
Do not use both ajaxSubmit and ajaxForm on the same form. These
|
17 |
+
functions are intended to be exclusive. Use ajaxSubmit if you want
|
18 |
+
to bind your own submit handler to the form. For example,
|
19 |
+
|
20 |
+
$(document).ready(function() {
|
21 |
+
$('#myForm').bind('submit', function() {
|
22 |
+
$(this).ajaxSubmit({
|
23 |
+
target: '#output'
|
24 |
+
});
|
25 |
+
return false; // <-- important!
|
26 |
+
});
|
27 |
+
});
|
28 |
+
|
29 |
+
Use ajaxForm when you want the plugin to manage all the event binding
|
30 |
+
for you. For example,
|
31 |
+
|
32 |
+
$(document).ready(function() {
|
33 |
+
$('#myForm').ajaxForm({
|
34 |
+
target: '#output'
|
35 |
+
});
|
36 |
+
});
|
37 |
+
|
38 |
+
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
39 |
+
at the appropriate time.
|
40 |
+
*/
|
41 |
+
|
42 |
+
/**
|
43 |
+
* ajaxSubmit() provides a mechanism for immediately submitting
|
44 |
+
* an HTML form using AJAX.
|
45 |
+
*/
|
46 |
+
$.fn.ajaxSubmit = function(options) {
|
47 |
+
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
|
48 |
+
if (!this.length) {
|
49 |
+
log('ajaxSubmit: skipping submit process - no element selected');
|
50 |
+
return this;
|
51 |
+
}
|
52 |
+
|
53 |
+
if (typeof options == 'function') {
|
54 |
+
options = { success: options };
|
55 |
+
}
|
56 |
+
|
57 |
+
var url = $.trim(this.attr('action'));
|
58 |
+
if (url) {
|
59 |
+
// clean url (don't include hash vaue)
|
60 |
+
url = (url.match(/^([^#]+)/)||[])[1];
|
61 |
+
}
|
62 |
+
url = url || window.location.href || '';
|
63 |
+
|
64 |
+
options = $.extend(true, {
|
65 |
+
url: url,
|
66 |
+
type: this.attr('method') || 'GET',
|
67 |
+
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
|
68 |
+
}, options);
|
69 |
+
|
70 |
+
// hook for manipulating the form data before it is extracted;
|
71 |
+
// convenient for use with rich editors like tinyMCE or FCKEditor
|
72 |
+
var veto = {};
|
73 |
+
this.trigger('form-pre-serialize', [this, options, veto]);
|
74 |
+
if (veto.veto) {
|
75 |
+
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
|
76 |
+
return this;
|
77 |
+
}
|
78 |
+
|
79 |
+
// provide opportunity to alter form data before it is serialized
|
80 |
+
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
|
81 |
+
log('ajaxSubmit: submit aborted via beforeSerialize callback');
|
82 |
+
return this;
|
83 |
+
}
|
84 |
+
|
85 |
+
var n,v,a = this.formToArray(options.semantic);
|
86 |
+
if (options.data) {
|
87 |
+
options.extraData = options.data;
|
88 |
+
for (n in options.data) {
|
89 |
+
if(options.data[n] instanceof Array) {
|
90 |
+
for (var k in options.data[n]) {
|
91 |
+
a.push( { name: n, value: options.data[n][k] } );
|
92 |
+
}
|
93 |
+
}
|
94 |
+
else {
|
95 |
+
v = options.data[n];
|
96 |
+
v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
|
97 |
+
a.push( { name: n, value: v } );
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
// give pre-submit callback an opportunity to abort the submit
|
103 |
+
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
|
104 |
+
log('ajaxSubmit: submit aborted via beforeSubmit callback');
|
105 |
+
return this;
|
106 |
+
}
|
107 |
+
|
108 |
+
// fire vetoable 'validate' event
|
109 |
+
this.trigger('form-submit-validate', [a, this, options, veto]);
|
110 |
+
if (veto.veto) {
|
111 |
+
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
|
112 |
+
return this;
|
113 |
+
}
|
114 |
+
|
115 |
+
var q = $.param(a);
|
116 |
+
|
117 |
+
if (options.type.toUpperCase() == 'GET') {
|
118 |
+
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
119 |
+
options.data = null; // data is null for 'get'
|
120 |
+
}
|
121 |
+
else {
|
122 |
+
options.data = q; // data is the query string for 'post'
|
123 |
+
}
|
124 |
+
|
125 |
+
var $form = this, callbacks = [];
|
126 |
+
if (options.resetForm) {
|
127 |
+
callbacks.push(function() { $form.resetForm(); });
|
128 |
+
}
|
129 |
+
if (options.clearForm) {
|
130 |
+
callbacks.push(function() { $form.clearForm(); });
|
131 |
+
}
|
132 |
+
|
133 |
+
// perform a load on the target only if dataType is not provided
|
134 |
+
if (!options.dataType && options.target) {
|
135 |
+
var oldSuccess = options.success || function(){};
|
136 |
+
callbacks.push(function(data) {
|
137 |
+
var fn = options.replaceTarget ? 'replaceWith' : 'html';
|
138 |
+
$(options.target)[fn](data).each(oldSuccess, arguments);
|
139 |
+
});
|
140 |
+
}
|
141 |
+
else if (options.success) {
|
142 |
+
callbacks.push(options.success);
|
143 |
+
}
|
144 |
+
|
145 |
+
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
|
146 |
+
var context = options.context || options; // jQuery 1.4+ supports scope context
|
147 |
+
for (var i=0, max=callbacks.length; i < max; i++) {
|
148 |
+
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
|
149 |
+
}
|
150 |
+
};
|
151 |
+
|
152 |
+
// are there files to upload?
|
153 |
+
var fileInputs = $('input:file', this).length > 0;
|
154 |
+
var mp = 'multipart/form-data';
|
155 |
+
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
|
156 |
+
|
157 |
+
// options.iframe allows user to force iframe mode
|
158 |
+
// 06-NOV-09: now defaulting to iframe mode if file input is detected
|
159 |
+
if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
|
160 |
+
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
161 |
+
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
162 |
+
if (options.closeKeepAlive) {
|
163 |
+
$.get(options.closeKeepAlive, fileUpload);
|
164 |
+
}
|
165 |
+
else {
|
166 |
+
fileUpload();
|
167 |
+
}
|
168 |
+
}
|
169 |
+
else {
|
170 |
+
$.ajax(options);
|
171 |
+
}
|
172 |
+
|
173 |
+
// fire 'notify' event
|
174 |
+
this.trigger('form-submit-notify', [this, options]);
|
175 |
+
return this;
|
176 |
+
|
177 |
+
|
178 |
+
// private function for handling file uploads (hat tip to YAHOO!)
|
179 |
+
function fileUpload() {
|
180 |
+
var form = $form[0];
|
181 |
+
|
182 |
+
if ($(':input[name=submit],:input[id=submit]', form).length) {
|
183 |
+
// if there is an input with a name or id of 'submit' then we won't be
|
184 |
+
// able to invoke the submit fn on the form (at least not x-browser)
|
185 |
+
alert('Error: Form elements must not have name or id of "submit".');
|
186 |
+
return;
|
187 |
+
}
|
188 |
+
|
189 |
+
var s = $.extend(true, {}, $.ajaxSettings, options);
|
190 |
+
s.context = s.context || s;
|
191 |
+
var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
|
192 |
+
window[fn] = function() {
|
193 |
+
var f = $io.data('form-plugin-onload');
|
194 |
+
if (f) {
|
195 |
+
f();
|
196 |
+
window[fn] = undefined;
|
197 |
+
try { delete window[fn]; } catch(e){}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" onload="window[\'_\'+this.id]()" />');
|
201 |
+
var io = $io[0];
|
202 |
+
|
203 |
+
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
204 |
+
|
205 |
+
var xhr = { // mock object
|
206 |
+
aborted: 0,
|
207 |
+
responseText: null,
|
208 |
+
responseXML: null,
|
209 |
+
status: 0,
|
210 |
+
statusText: 'n/a',
|
211 |
+
getAllResponseHeaders: function() {},
|
212 |
+
getResponseHeader: function() {},
|
213 |
+
setRequestHeader: function() {},
|
214 |
+
abort: function() {
|
215 |
+
this.aborted = 1;
|
216 |
+
$io.attr('src', s.iframeSrc); // abort op in progress
|
217 |
+
}
|
218 |
+
};
|
219 |
+
|
220 |
+
var g = s.global;
|
221 |
+
// trigger ajax global events so that activity/block indicators work like normal
|
222 |
+
if (g && ! $.active++) {
|
223 |
+
$.event.trigger("ajaxStart");
|
224 |
+
}
|
225 |
+
if (g) {
|
226 |
+
$.event.trigger("ajaxSend", [xhr, s]);
|
227 |
+
}
|
228 |
+
|
229 |
+
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
|
230 |
+
if (s.global) {
|
231 |
+
$.active--;
|
232 |
+
}
|
233 |
+
return;
|
234 |
+
}
|
235 |
+
if (xhr.aborted) {
|
236 |
+
return;
|
237 |
+
}
|
238 |
+
|
239 |
+
var cbInvoked = false;
|
240 |
+
var timedOut = 0;
|
241 |
+
|
242 |
+
// add submitting element to data if we know it
|
243 |
+
var sub = form.clk;
|
244 |
+
if (sub) {
|
245 |
+
var n = sub.name;
|
246 |
+
if (n && !sub.disabled) {
|
247 |
+
s.extraData = s.extraData || {};
|
248 |
+
s.extraData[n] = sub.value;
|
249 |
+
if (sub.type == "image") {
|
250 |
+
s.extraData[n+'.x'] = form.clk_x;
|
251 |
+
s.extraData[n+'.y'] = form.clk_y;
|
252 |
+
}
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
// take a breath so that pending repaints get some cpu time before the upload starts
|
257 |
+
function doSubmit() {
|
258 |
+
// make sure form attrs are set
|
259 |
+
var t = $form.attr('target'), a = $form.attr('action');
|
260 |
+
|
261 |
+
// update form attrs in IE friendly way
|
262 |
+
form.setAttribute('target',id);
|
263 |
+
if (form.getAttribute('method') != 'POST') {
|
264 |
+
form.setAttribute('method', 'POST');
|
265 |
+
}
|
266 |
+
if (form.getAttribute('action') != s.url) {
|
267 |
+
form.setAttribute('action', s.url);
|
268 |
+
}
|
269 |
+
|
270 |
+
// ie borks in some cases when setting encoding
|
271 |
+
if (! s.skipEncodingOverride) {
|
272 |
+
$form.attr({
|
273 |
+
encoding: 'multipart/form-data',
|
274 |
+
enctype: 'multipart/form-data'
|
275 |
+
});
|
276 |
+
}
|
277 |
+
|
278 |
+
// support timout
|
279 |
+
if (s.timeout) {
|
280 |
+
setTimeout(function() { timedOut = true; cb(); }, s.timeout);
|
281 |
+
}
|
282 |
+
|
283 |
+
// add "extra" data to form if provided in options
|
284 |
+
var extraInputs = [];
|
285 |
+
try {
|
286 |
+
if (s.extraData) {
|
287 |
+
for (var n in s.extraData) {
|
288 |
+
extraInputs.push(
|
289 |
+
$('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
|
290 |
+
.appendTo(form)[0]);
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
// add iframe to doc and submit the form
|
295 |
+
$io.appendTo('body');
|
296 |
+
$io.data('form-plugin-onload', cb);
|
297 |
+
form.submit();
|
298 |
+
}
|
299 |
+
finally {
|
300 |
+
// reset attrs and remove "extra" input elements
|
301 |
+
form.setAttribute('action',a);
|
302 |
+
if(t) {
|
303 |
+
form.setAttribute('target', t);
|
304 |
+
} else {
|
305 |
+
$form.removeAttr('target');
|
306 |
+
}
|
307 |
+
$(extraInputs).remove();
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
if (s.forceSync) {
|
312 |
+
doSubmit();
|
313 |
+
}
|
314 |
+
else {
|
315 |
+
setTimeout(doSubmit, 10); // this lets dom updates render
|
316 |
+
}
|
317 |
+
|
318 |
+
var data, doc, domCheckCount = 50;
|
319 |
+
|
320 |
+
function cb() {
|
321 |
+
if (cbInvoked) {
|
322 |
+
return;
|
323 |
+
}
|
324 |
+
|
325 |
+
$io.removeData('form-plugin-onload');
|
326 |
+
|
327 |
+
var ok = true;
|
328 |
+
try {
|
329 |
+
if (timedOut) {
|
330 |
+
throw 'timeout';
|
331 |
+
}
|
332 |
+
// extract the server response from the iframe
|
333 |
+
doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
|
334 |
+
|
335 |
+
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
|
336 |
+
log('isXml='+isXml);
|
337 |
+
if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
|
338 |
+
if (--domCheckCount) {
|
339 |
+
// in some browsers (Opera) the iframe DOM is not always traversable when
|
340 |
+
// the onload callback fires, so we loop a bit to accommodate
|
341 |
+
log('requeing onLoad callback, DOM not available');
|
342 |
+
setTimeout(cb, 250);
|
343 |
+
return;
|
344 |
+
}
|
345 |
+
// let this fall through because server response could be an empty document
|
346 |
+
//log('Could not access iframe DOM after mutiple tries.');
|
347 |
+
//throw 'DOMException: not available';
|
348 |
+
}
|
349 |
+
|
350 |
+
//log('response detected');
|
351 |
+
cbInvoked = true;
|
352 |
+
xhr.responseText = doc.documentElement ? doc.documentElement.innerHTML : null;
|
353 |
+
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
354 |
+
xhr.getResponseHeader = function(header){
|
355 |
+
var headers = {'content-type': s.dataType};
|
356 |
+
return headers[header];
|
357 |
+
};
|
358 |
+
|
359 |
+
var scr = /(json|script)/.test(s.dataType);
|
360 |
+
if (scr || s.textarea) {
|
361 |
+
// see if user embedded response in textarea
|
362 |
+
var ta = doc.getElementsByTagName('textarea')[0];
|
363 |
+
if (ta) {
|
364 |
+
xhr.responseText = ta.value;
|
365 |
+
}
|
366 |
+
else if (scr) {
|
367 |
+
// account for browsers injecting pre around json response
|
368 |
+
var pre = doc.getElementsByTagName('pre')[0];
|
369 |
+
if (pre) {
|
370 |
+
xhr.responseText = pre.innerHTML;
|
371 |
+
}
|
372 |
+
}
|
373 |
+
}
|
374 |
+
else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
375 |
+
xhr.responseXML = toXml(xhr.responseText);
|
376 |
+
}
|
377 |
+
data = $.httpData(xhr, s.dataType);
|
378 |
+
}
|
379 |
+
catch(e){
|
380 |
+
log('error caught:',e);
|
381 |
+
ok = false;
|
382 |
+
xhr.error = e;
|
383 |
+
$.handleError(s, xhr, 'error', e);
|
384 |
+
}
|
385 |
+
|
386 |
+
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
387 |
+
if (ok) {
|
388 |
+
s.success.call(s.context, data, 'success', xhr);
|
389 |
+
if (g) {
|
390 |
+
$.event.trigger("ajaxSuccess", [xhr, s]);
|
391 |
+
}
|
392 |
+
}
|
393 |
+
if (g) {
|
394 |
+
$.event.trigger("ajaxComplete", [xhr, s]);
|
395 |
+
}
|
396 |
+
if (g && ! --$.active) {
|
397 |
+
$.event.trigger("ajaxStop");
|
398 |
+
}
|
399 |
+
if (s.complete) {
|
400 |
+
s.complete.call(s.context, xhr, ok ? 'success' : 'error');
|
401 |
+
}
|
402 |
+
|
403 |
+
// clean up
|
404 |
+
setTimeout(function() {
|
405 |
+
$io.removeData('form-plugin-onload');
|
406 |
+
$io.remove();
|
407 |
+
xhr.responseXML = null;
|
408 |
+
}, 100);
|
409 |
+
}
|
410 |
+
|
411 |
+
function toXml(s, doc) {
|
412 |
+
if (window.ActiveXObject) {
|
413 |
+
doc = new ActiveXObject('Microsoft.XMLDOM');
|
414 |
+
doc.async = 'false';
|
415 |
+
doc.loadXML(s);
|
416 |
+
}
|
417 |
+
else {
|
418 |
+
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
419 |
+
}
|
420 |
+
return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
|
421 |
+
}
|
422 |
+
}
|
423 |
+
};
|
424 |
+
|
425 |
+
/**
|
426 |
+
* ajaxForm() provides a mechanism for fully automating form submission.
|
427 |
+
*
|
428 |
+
* The advantages of using this method instead of ajaxSubmit() are:
|
429 |
+
*
|
430 |
+
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
431 |
+
* is used to submit the form).
|
432 |
+
* 2. This method will include the submit element's name/value data (for the element that was
|
433 |
+
* used to submit the form).
|
434 |
+
* 3. This method binds the submit() method to the form for you.
|
435 |
+
*
|
436 |
+
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
437 |
+
* passes the options argument along after properly binding events for submit elements and
|
438 |
+
* the form itself.
|
439 |
+
*/
|
440 |
+
$.fn.ajaxForm = function(options) {
|
441 |
+
// in jQuery 1.3+ we can fix mistakes with the ready state
|
442 |
+
if (this.length === 0) {
|
443 |
+
var o = { s: this.selector, c: this.context };
|
444 |
+
if (!$.isReady && o.s) {
|
445 |
+
log('DOM not ready, queuing ajaxForm');
|
446 |
+
$(function() {
|
447 |
+
$(o.s,o.c).ajaxForm(options);
|
448 |
+
});
|
449 |
+
return this;
|
450 |
+
}
|
451 |
+
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
|
452 |
+
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
|
453 |
+
return this;
|
454 |
+
}
|
455 |
+
|
456 |
+
return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
|
457 |
+
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
|
458 |
+
e.preventDefault();
|
459 |
+
$(this).ajaxSubmit(options);
|
460 |
+
}
|
461 |
+
}).bind('click.form-plugin', function(e) {
|
462 |
+
var target = e.target;
|
463 |
+
var $el = $(target);
|
464 |
+
if (!($el.is(":submit,input:image"))) {
|
465 |
+
// is this a child element of the submit el? (ex: a span within a button)
|
466 |
+
var t = $el.closest(':submit');
|
467 |
+
if (t.length == 0) {
|
468 |
+
return;
|
469 |
+
}
|
470 |
+
target = t[0];
|
471 |
+
}
|
472 |
+
var form = this;
|
473 |
+
form.clk = target;
|
474 |
+
if (target.type == 'image') {
|
475 |
+
if (e.offsetX != undefined) {
|
476 |
+
form.clk_x = e.offsetX;
|
477 |
+
form.clk_y = e.offsetY;
|
478 |
+
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
479 |
+
var offset = $el.offset();
|
480 |
+
form.clk_x = e.pageX - offset.left;
|
481 |
+
form.clk_y = e.pageY - offset.top;
|
482 |
+
} else {
|
483 |
+
form.clk_x = e.pageX - target.offsetLeft;
|
484 |
+
form.clk_y = e.pageY - target.offsetTop;
|
485 |
+
}
|
486 |
+
}
|
487 |
+
// clear form vars
|
488 |
+
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
|
489 |
+
});
|
490 |
+
};
|
491 |
+
|
492 |
+
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
493 |
+
$.fn.ajaxFormUnbind = function() {
|
494 |
+
return this.unbind('submit.form-plugin click.form-plugin');
|
495 |
+
};
|
496 |
+
|
497 |
+
/**
|
498 |
+
* formToArray() gathers form element data into an array of objects that can
|
499 |
+
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
500 |
+
* Each object in the array has both a 'name' and 'value' property. An example of
|
501 |
+
* an array for a simple login form might be:
|
502 |
+
*
|
503 |
+
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
504 |
+
*
|
505 |
+
* It is this array that is passed to pre-submit callback functions provided to the
|
506 |
+
* ajaxSubmit() and ajaxForm() methods.
|
507 |
+
*/
|
508 |
+
$.fn.formToArray = function(semantic) {
|
509 |
+
var a = [];
|
510 |
+
if (this.length === 0) {
|
511 |
+
return a;
|
512 |
+
}
|
513 |
+
|
514 |
+
var form = this[0];
|
515 |
+
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
516 |
+
if (!els) {
|
517 |
+
return a;
|
518 |
+
}
|
519 |
+
|
520 |
+
var i,j,n,v,el;
|
521 |
+
for(i=0, max=els.length; i < max; i++) {
|
522 |
+
el = els[i];
|
523 |
+
n = el.name;
|
524 |
+
if (!n) {
|
525 |
+
continue;
|
526 |
+
}
|
527 |
+
|
528 |
+
if (semantic && form.clk && el.type == "image") {
|
529 |
+
// handle image inputs on the fly when semantic == true
|
530 |
+
if(!el.disabled && form.clk == el) {
|
531 |
+
a.push({name: n, value: $(el).val()});
|
532 |
+
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
533 |
+
}
|
534 |
+
continue;
|
535 |
+
}
|
536 |
+
|
537 |
+
v = $.fieldValue(el, true);
|
538 |
+
if (v && v.constructor == Array) {
|
539 |
+
for(j=0, jmax=v.length; j < jmax; j++) {
|
540 |
+
a.push({name: n, value: v[j]});
|
541 |
+
}
|
542 |
+
}
|
543 |
+
else if (v !== null && typeof v != 'undefined') {
|
544 |
+
a.push({name: n, value: v});
|
545 |
+
}
|
546 |
+
}
|
547 |
+
|
548 |
+
if (!semantic && form.clk) {
|
549 |
+
// input type=='image' are not found in elements array! handle it here
|
550 |
+
var $input = $(form.clk), input = $input[0];
|
551 |
+
n = input.name;
|
552 |
+
if (n && !input.disabled && input.type == 'image') {
|
553 |
+
a.push({name: n, value: $input.val()});
|
554 |
+
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
555 |
+
}
|
556 |
+
}
|
557 |
+
return a;
|
558 |
+
};
|
559 |
+
|
560 |
+
/**
|
561 |
+
* Serializes form data into a 'submittable' string. This method will return a string
|
562 |
+
* in the format: name1=value1&name2=value2
|
563 |
+
*/
|
564 |
+
$.fn.formSerialize = function(semantic) {
|
565 |
+
//hand off to jQuery.param for proper encoding
|
566 |
+
return $.param(this.formToArray(semantic));
|
567 |
+
};
|
568 |
+
|
569 |
+
/**
|
570 |
+
* Serializes all field elements in the jQuery object into a query string.
|
571 |
+
* This method will return a string in the format: name1=value1&name2=value2
|
572 |
+
*/
|
573 |
+
$.fn.fieldSerialize = function(successful) {
|
574 |
+
var a = [];
|
575 |
+
this.each(function() {
|
576 |
+
var n = this.name;
|
577 |
+
if (!n) {
|
578 |
+
return;
|
579 |
+
}
|
580 |
+
var v = $.fieldValue(this, successful);
|
581 |
+
if (v && v.constructor == Array) {
|
582 |
+
for (var i=0,max=v.length; i < max; i++) {
|
583 |
+
a.push({name: n, value: v[i]});
|
584 |
+
}
|
585 |
+
}
|
586 |
+
else if (v !== null && typeof v != 'undefined') {
|
587 |
+
a.push({name: this.name, value: v});
|
588 |
+
}
|
589 |
+
});
|
590 |
+
//hand off to jQuery.param for proper encoding
|
591 |
+
return $.param(a);
|
592 |
+
};
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
596 |
+
*
|
597 |
+
* <form><fieldset>
|
598 |
+
* <input name="A" type="text" />
|
599 |
+
* <input name="A" type="text" />
|
600 |
+
* <input name="B" type="checkbox" value="B1" />
|
601 |
+
* <input name="B" type="checkbox" value="B2"/>
|
602 |
+
* <input name="C" type="radio" value="C1" />
|
603 |
+
* <input name="C" type="radio" value="C2" />
|
604 |
+
* </fieldset></form>
|
605 |
+
*
|
606 |
+
* var v = $(':text').fieldValue();
|
607 |
+
* // if no values are entered into the text inputs
|
608 |
+
* v == ['','']
|
609 |
+
* // if values entered into the text inputs are 'foo' and 'bar'
|
610 |
+
* v == ['foo','bar']
|
611 |
+
*
|
612 |
+
* var v = $(':checkbox').fieldValue();
|
613 |
+
* // if neither checkbox is checked
|
614 |
+
* v === undefined
|
615 |
+
* // if both checkboxes are checked
|
616 |
+
* v == ['B1', 'B2']
|
617 |
+
*
|
618 |
+
* var v = $(':radio').fieldValue();
|
619 |
+
* // if neither radio is checked
|
620 |
+
* v === undefined
|
621 |
+
* // if first radio is checked
|
622 |
+
* v == ['C1']
|
623 |
+
*
|
624 |
+
* The successful argument controls whether or not the field element must be 'successful'
|
625 |
+
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
626 |
+
* The default value of the successful argument is true. If this value is false the value(s)
|
627 |
+
* for each element is returned.
|
628 |
+
*
|
629 |
+
* Note: This method *always* returns an array. If no valid value can be determined the
|
630 |
+
* array will be empty, otherwise it will contain one or more values.
|
631 |
+
*/
|
632 |
+
$.fn.fieldValue = function(successful) {
|
633 |
+
for (var val=[], i=0, max=this.length; i < max; i++) {
|
634 |
+
var el = this[i];
|
635 |
+
var v = $.fieldValue(el, successful);
|
636 |
+
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
|
637 |
+
continue;
|
638 |
+
}
|
639 |
+
v.constructor == Array ? $.merge(val, v) : val.push(v);
|
640 |
+
}
|
641 |
+
return val;
|
642 |
+
};
|
643 |
+
|
644 |
+
/**
|
645 |
+
* Returns the value of the field element.
|
646 |
+
*/
|
647 |
+
$.fieldValue = function(el, successful) {
|
648 |
+
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
649 |
+
if (successful === undefined) {
|
650 |
+
successful = true;
|
651 |
+
}
|
652 |
+
|
653 |
+
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
654 |
+
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
655 |
+
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
656 |
+
tag == 'select' && el.selectedIndex == -1)) {
|
657 |
+
return null;
|
658 |
+
}
|
659 |
+
|
660 |
+
if (tag == 'select') {
|
661 |
+
var index = el.selectedIndex;
|
662 |
+
if (index < 0) {
|
663 |
+
return null;
|
664 |
+
}
|
665 |
+
var a = [], ops = el.options;
|
666 |
+
var one = (t == 'select-one');
|
667 |
+
var max = (one ? index+1 : ops.length);
|
668 |
+
for(var i=(one ? index : 0); i < max; i++) {
|
669 |
+
var op = ops[i];
|
670 |
+
if (op.selected) {
|
671 |
+
var v = op.value;
|
672 |
+
if (!v) { // extra pain for IE...
|
673 |
+
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
674 |
+
}
|
675 |
+
if (one) {
|
676 |
+
return v;
|
677 |
+
}
|
678 |
+
a.push(v);
|
679 |
+
}
|
680 |
+
}
|
681 |
+
return a;
|
682 |
+
}
|
683 |
+
return $(el).val();
|
684 |
+
};
|
685 |
+
|
686 |
+
/**
|
687 |
+
* Clears the form data. Takes the following actions on the form's input fields:
|
688 |
+
* - input text fields will have their 'value' property set to the empty string
|
689 |
+
* - select elements will have their 'selectedIndex' property set to -1
|
690 |
+
* - checkbox and radio inputs will have their 'checked' property set to false
|
691 |
+
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
692 |
+
* - button elements will *not* be effected
|
693 |
+
*/
|
694 |
+
$.fn.clearForm = function() {
|
695 |
+
return this.each(function() {
|
696 |
+
$('input,select,textarea', this).clearFields();
|
697 |
+
});
|
698 |
+
};
|
699 |
+
|
700 |
+
/**
|
701 |
+
* Clears the selected form elements.
|
702 |
+
*/
|
703 |
+
$.fn.clearFields = $.fn.clearInputs = function() {
|
704 |
+
return this.each(function() {
|
705 |
+
var t = this.type, tag = this.tagName.toLowerCase();
|
706 |
+
if (t == 'text' || t == 'password' || tag == 'textarea') {
|
707 |
+
this.value = '';
|
708 |
+
}
|
709 |
+
else if (t == 'checkbox' || t == 'radio') {
|
710 |
+
this.checked = false;
|
711 |
+
}
|
712 |
+
else if (tag == 'select') {
|
713 |
+
this.selectedIndex = -1;
|
714 |
+
}
|
715 |
+
});
|
716 |
+
};
|
717 |
+
|
718 |
+
/**
|
719 |
+
* Resets the form data. Causes all form elements to be reset to their original value.
|
720 |
+
*/
|
721 |
+
$.fn.resetForm = function() {
|
722 |
+
return this.each(function() {
|
723 |
+
// guard against an input with the name of 'reset'
|
724 |
+
// note that IE reports the reset function as an 'object'
|
725 |
+
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
|
726 |
+
this.reset();
|
727 |
+
}
|
728 |
+
});
|
729 |
+
};
|
730 |
+
|
731 |
+
/**
|
732 |
+
* Enables or disables any matching elements.
|
733 |
+
*/
|
734 |
+
$.fn.enable = function(b) {
|
735 |
+
if (b === undefined) {
|
736 |
+
b = true;
|
737 |
+
}
|
738 |
+
return this.each(function() {
|
739 |
+
this.disabled = !b;
|
740 |
+
});
|
741 |
+
};
|
742 |
+
|
743 |
+
/**
|
744 |
+
* Checks/unchecks any matching checkboxes or radio buttons and
|
745 |
+
* selects/deselects and matching option elements.
|
746 |
+
*/
|
747 |
+
$.fn.selected = function(select) {
|
748 |
+
if (select === undefined) {
|
749 |
+
select = true;
|
750 |
+
}
|
751 |
+
return this.each(function() {
|
752 |
+
var t = this.type;
|
753 |
+
if (t == 'checkbox' || t == 'radio') {
|
754 |
+
this.checked = select;
|
755 |
+
}
|
756 |
+
else if (this.tagName.toLowerCase() == 'option') {
|
757 |
+
var $sel = $(this).parent('select');
|
758 |
+
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
759 |
+
// deselect all other options
|
760 |
+
$sel.find('option').selected(false);
|
761 |
+
}
|
762 |
+
this.selected = select;
|
763 |
+
}
|
764 |
+
});
|
765 |
+
};
|
766 |
+
|
767 |
+
// helper fn for console logging
|
768 |
+
// set $.fn.ajaxSubmit.debug to true to enable debug logging
|
769 |
+
function log() {
|
770 |
+
if ($.fn.ajaxSubmit.debug) {
|
771 |
+
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
772 |
+
if (window.console && window.console.log) {
|
773 |
+
window.console.log(msg);
|
774 |
+
}
|
775 |
+
else if (window.opera && window.opera.postError) {
|
776 |
+
window.opera.postError(msg);
|
777 |
+
}
|
778 |
+
}
|
779 |
+
};
|
780 |
+
|
781 |
+
})(jQuery);
|
languages/readme.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
== For Translators ==
|
2 |
+
|
3 |
+
Note: this folder contains MO files and POT file only. If you are looking for PO file, you can download it from here:
|
4 |
+
|
5 |
+
http://plugins.svn.wordpress.org/contact-form-7/branches/languages/
|
6 |
+
|
7 |
+
If you have created your own translation, or have an update of an existing one, please send it to Takayuki Miyoshi <takayukister@gmail.com> so that I can bundle it into the next release of Contact Form 7.
|
8 |
+
|
9 |
+
Thank you.
|
languages/wpcf7-af.po
DELETED
@@ -1,809 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Contact Form 7\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2010-01-06 16:43+0900\n"
|
6 |
-
"PO-Revision-Date: \n"
|
7 |
-
"Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
|
8 |
-
"Language-Team: Schalk Burger\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Poedit-Language: Afrikaans\n"
|
13 |
-
"X-Poedit-Country: South Africa\n"
|
14 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
-
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_c\n"
|
16 |
-
"X-Poedit-Basepath: ../..\n"
|
17 |
-
"Plural-Forms: nplurals=1; plural=0;\n"
|
18 |
-
"X-Poedit-SearchPath-0: contact-form-7\n"
|
19 |
-
|
20 |
-
#: contact-form-7/admin/admin-panel.php:9
|
21 |
-
#, php-format
|
22 |
-
msgid "<strong>The database table for Contact Form 7 does not exist.</strong> You must <a href=\"%s\">create the table</a> for it to work."
|
23 |
-
msgstr "<strong>Die databasis tabel vir Contact Form 7 bestaan nie.</strong> Jy moet eers 'n <a href=\"%s\">tabel skep</a> vir dit om te werk."
|
24 |
-
|
25 |
-
#: contact-form-7/admin/admin-panel.php:12
|
26 |
-
msgid "<strong>The database table for Contact Form 7 does not exist.</strong>"
|
27 |
-
msgstr "<strong>Die databasis tabel vir Contact Form 7 bestaan nie.</strong>"
|
28 |
-
|
29 |
-
#: contact-form-7/admin/admin-panel.php:17
|
30 |
-
#: contact-form-7/admin/admin-panel.php:30
|
31 |
-
#: contact-form-7/admin/admin.php:117
|
32 |
-
msgid "Contact Form 7"
|
33 |
-
msgstr "Contact Form 7"
|
34 |
-
|
35 |
-
#: contact-form-7/admin/admin-panel.php:45
|
36 |
-
msgid "Add new"
|
37 |
-
msgstr "Nuwe byvoeging"
|
38 |
-
|
39 |
-
#: contact-form-7/admin/admin-panel.php:67
|
40 |
-
msgid "Copy this code and paste it into your post, page or text widget content."
|
41 |
-
msgstr "Kopie die code en sit dit in jou berig, bladsy of teks widget."
|
42 |
-
|
43 |
-
#: contact-form-7/admin/admin-panel.php:75
|
44 |
-
#: contact-form-7/admin/admin-panel.php:309
|
45 |
-
msgid "Save"
|
46 |
-
msgstr "Stoor"
|
47 |
-
|
48 |
-
#: contact-form-7/admin/admin-panel.php:82
|
49 |
-
msgid "Copy"
|
50 |
-
msgstr "Kopie"
|
51 |
-
|
52 |
-
#: contact-form-7/admin/admin-panel.php:87
|
53 |
-
msgid "Delete"
|
54 |
-
msgstr "Skrap"
|
55 |
-
|
56 |
-
#: contact-form-7/admin/admin-panel.php:89
|
57 |
-
msgid ""
|
58 |
-
"You are about to delete this contact form.\n"
|
59 |
-
" 'Cancel' to stop, 'OK' to delete."
|
60 |
-
msgstr ""
|
61 |
-
"Jy is besig om hierdie kontak vorm te verwyder.\n"
|
62 |
-
" 'Kanseleer' om te stop, 'OK' om dit te skrap."
|
63 |
-
|
64 |
-
#: contact-form-7/admin/admin-panel.php:104
|
65 |
-
msgid "Form"
|
66 |
-
msgstr "Vorm"
|
67 |
-
|
68 |
-
#: contact-form-7/admin/admin-panel.php:128
|
69 |
-
msgid "Mail"
|
70 |
-
msgstr "Pos"
|
71 |
-
|
72 |
-
#: contact-form-7/admin/admin-panel.php:135
|
73 |
-
#: contact-form-7/admin/admin-panel.php:202
|
74 |
-
msgid "To:"
|
75 |
-
msgstr "Aan:"
|
76 |
-
|
77 |
-
#: contact-form-7/admin/admin-panel.php:140
|
78 |
-
#: contact-form-7/admin/admin-panel.php:207
|
79 |
-
msgid "From:"
|
80 |
-
msgstr "Van:"
|
81 |
-
|
82 |
-
#: contact-form-7/admin/admin-panel.php:145
|
83 |
-
#: contact-form-7/admin/admin-panel.php:212
|
84 |
-
msgid "Subject:"
|
85 |
-
msgstr "Onderwerp:"
|
86 |
-
|
87 |
-
#: contact-form-7/admin/admin-panel.php:152
|
88 |
-
#: contact-form-7/admin/admin-panel.php:219
|
89 |
-
msgid "Additional headers:"
|
90 |
-
msgstr "Aanvullende headers:"
|
91 |
-
|
92 |
-
#: contact-form-7/admin/admin-panel.php:157
|
93 |
-
#: contact-form-7/admin/admin-panel.php:224
|
94 |
-
msgid "File attachments:"
|
95 |
-
msgstr "LÍer skakels:"
|
96 |
-
|
97 |
-
#: contact-form-7/admin/admin-panel.php:165
|
98 |
-
#: contact-form-7/admin/admin-panel.php:232
|
99 |
-
msgid "Use HTML content type"
|
100 |
-
msgstr "Gebruik HTML inhoud tipe"
|
101 |
-
|
102 |
-
#: contact-form-7/admin/admin-panel.php:172
|
103 |
-
#: contact-form-7/admin/admin-panel.php:239
|
104 |
-
#: contact-form-7/includes/functions.php:73
|
105 |
-
msgid "Message body:"
|
106 |
-
msgstr "Boodskap teks"
|
107 |
-
|
108 |
-
#: contact-form-7/admin/admin-panel.php:188
|
109 |
-
msgid "Mail (2)"
|
110 |
-
msgstr "Mail (2)"
|
111 |
-
|
112 |
-
#: contact-form-7/admin/admin-panel.php:194
|
113 |
-
msgid "Use mail (2)"
|
114 |
-
msgstr "Gebruik mail (2)"
|
115 |
-
|
116 |
-
#: contact-form-7/admin/admin-panel.php:255
|
117 |
-
msgid "Messages"
|
118 |
-
msgstr "Boodskappe"
|
119 |
-
|
120 |
-
#: contact-form-7/admin/admin-panel.php:285
|
121 |
-
msgid "Additional Settings"
|
122 |
-
msgstr "Aanvullende Stellings"
|
123 |
-
|
124 |
-
#: contact-form-7/admin/admin-panel.php:333
|
125 |
-
#, php-format
|
126 |
-
msgid "Use the default language (%s)"
|
127 |
-
msgstr "Gebruik die standaard taal (%s)"
|
128 |
-
|
129 |
-
#: contact-form-7/admin/admin-panel.php:334
|
130 |
-
#: contact-form-7/admin/admin-panel.php:347
|
131 |
-
msgid "Add New"
|
132 |
-
msgstr "Nuwe byvoeging"
|
133 |
-
|
134 |
-
#: contact-form-7/admin/admin-panel.php:337
|
135 |
-
msgid "Or"
|
136 |
-
msgstr "Of"
|
137 |
-
|
138 |
-
#: contact-form-7/admin/admin-panel.php:342
|
139 |
-
msgid "(select language)"
|
140 |
-
msgstr "(kies taal)"
|
141 |
-
|
142 |
-
#: contact-form-7/admin/admin.php:117
|
143 |
-
msgid "Contact"
|
144 |
-
msgstr "Kontak"
|
145 |
-
|
146 |
-
#: contact-form-7/admin/admin.php:120
|
147 |
-
msgid "Edit Contact Forms"
|
148 |
-
msgstr "Wysig kontak vorms"
|
149 |
-
|
150 |
-
#: contact-form-7/admin/admin.php:120
|
151 |
-
msgid "Edit"
|
152 |
-
msgstr "Wysig"
|
153 |
-
|
154 |
-
#: contact-form-7/admin/admin.php:159
|
155 |
-
msgid "Generate Tag"
|
156 |
-
msgstr "Genereer Merker"
|
157 |
-
|
158 |
-
#: contact-form-7/admin/admin.php:160
|
159 |
-
msgid "Show"
|
160 |
-
msgstr "Wys"
|
161 |
-
|
162 |
-
#: contact-form-7/admin/admin.php:161
|
163 |
-
msgid "Hide"
|
164 |
-
msgstr "Versteek"
|
165 |
-
|
166 |
-
#: contact-form-7/admin/admin.php:305
|
167 |
-
msgid "Contact form"
|
168 |
-
msgstr "Kontak vorm"
|
169 |
-
|
170 |
-
#: contact-form-7/admin/admin.php:324
|
171 |
-
msgid "Settings"
|
172 |
-
msgstr "Stellings"
|
173 |
-
|
174 |
-
#: contact-form-7/admin/admin.php:335
|
175 |
-
msgid "http://contactform7.com/"
|
176 |
-
msgstr "http://contactform7.com/"
|
177 |
-
|
178 |
-
#: contact-form-7/admin/admin.php:336
|
179 |
-
msgid "Contactform7.com"
|
180 |
-
msgstr "Contactform7.com"
|
181 |
-
|
182 |
-
#: contact-form-7/admin/admin.php:337
|
183 |
-
msgid "http://contactform7.com/docs/"
|
184 |
-
msgstr "http://contactform7.com/docs/"
|
185 |
-
|
186 |
-
#: contact-form-7/admin/admin.php:338
|
187 |
-
msgid "Docs"
|
188 |
-
msgstr "Docs"
|
189 |
-
|
190 |
-
#: contact-form-7/admin/admin.php:339
|
191 |
-
msgid "http://contactform7.com/faq/"
|
192 |
-
msgstr "http://contactform7.com/faq/"
|
193 |
-
|
194 |
-
#: contact-form-7/admin/admin.php:340
|
195 |
-
msgid "FAQ"
|
196 |
-
msgstr "FAQ"
|
197 |
-
|
198 |
-
#: contact-form-7/admin/admin.php:341
|
199 |
-
msgid "http://contactform7.com/support/"
|
200 |
-
msgstr "http://contactform7.com/support/"
|
201 |
-
|
202 |
-
#: contact-form-7/admin/admin.php:342
|
203 |
-
msgid "Support"
|
204 |
-
msgstr "Hulp"
|
205 |
-
|
206 |
-
#: contact-form-7/admin/admin.php:353
|
207 |
-
msgid "Contact form created."
|
208 |
-
msgstr "Kontak vorm geskape"
|
209 |
-
|
210 |
-
#: contact-form-7/admin/admin.php:356
|
211 |
-
msgid "Contact form saved."
|
212 |
-
msgstr "Kontak vorm gestoor"
|
213 |
-
|
214 |
-
#: contact-form-7/admin/admin.php:359
|
215 |
-
msgid "Contact form deleted."
|
216 |
-
msgstr "Kontak vorm verwyder"
|
217 |
-
|
218 |
-
#: contact-form-7/admin/admin.php:362
|
219 |
-
msgid "Database table created."
|
220 |
-
msgstr "Databasis tabel geskape"
|
221 |
-
|
222 |
-
#: contact-form-7/admin/admin.php:365
|
223 |
-
msgid "Failed to create database table."
|
224 |
-
msgstr "Kon nie databasis tabel skape nie."
|
225 |
-
|
226 |
-
#: contact-form-7/admin/admin.php:398
|
227 |
-
msgid "Contact Form 7 needs your support. Please donate today."
|
228 |
-
msgstr "Contact Form 7 benodig jou ondersteuning. Skenk 'n donasie asseblief."
|
229 |
-
|
230 |
-
#: contact-form-7/admin/admin.php:399
|
231 |
-
msgid "Is this plugin useful for you? If you like it, please help the developer."
|
232 |
-
msgstr "Is hierdie plugin nuttig vir jou? As jy daarvan hou, ondersteun asseblief die ontwikkelaar"
|
233 |
-
|
234 |
-
#: contact-form-7/admin/admin.php:400
|
235 |
-
msgid "Your contribution is needed for making this plugin better."
|
236 |
-
msgstr "Jou bydra word benodig om hierdie plugin beter te maak."
|
237 |
-
|
238 |
-
#: contact-form-7/admin/admin.php:401
|
239 |
-
msgid "Developing a plugin and providing user support is really hard work. Please help."
|
240 |
-
msgstr "Om 'n plugin te ontwikkel en gebruikershulp aan te bied is baie harde werk. Help asseblief."
|
241 |
-
|
242 |
-
#: contact-form-7/includes/classes.php:568
|
243 |
-
msgid "Untitled"
|
244 |
-
msgstr "Naamloos"
|
245 |
-
|
246 |
-
#: contact-form-7/includes/functions.php:6
|
247 |
-
msgid "Sender's message was sent successfully"
|
248 |
-
msgstr "Boodskap was suksesvol gestuur"
|
249 |
-
|
250 |
-
#: contact-form-7/includes/functions.php:7
|
251 |
-
msgid "Your message was sent successfully. Thanks."
|
252 |
-
msgstr "Jou boodskap was suksevol gestuur. Dankie."
|
253 |
-
|
254 |
-
#: contact-form-7/includes/functions.php:11
|
255 |
-
msgid "Sender's message was failed to send"
|
256 |
-
msgstr "Boodskap het nie gestuur nie."
|
257 |
-
|
258 |
-
#: contact-form-7/includes/functions.php:12
|
259 |
-
#: contact-form-7/includes/functions.php:17
|
260 |
-
msgid "Failed to send your message. Please try later or contact administrator by other way."
|
261 |
-
msgstr "Kon nie boodskap stuur nie. Probeer later weer of kontak die administrateur op 'n ander manier"
|
262 |
-
|
263 |
-
#: contact-form-7/includes/functions.php:16
|
264 |
-
msgid "Akismet judged the sending activity as spamming"
|
265 |
-
msgstr "Akismet het die stuur van die boodskap as spam opgetel."
|
266 |
-
|
267 |
-
#: contact-form-7/includes/functions.php:21
|
268 |
-
msgid "Validation errors occurred"
|
269 |
-
msgstr "Validasie probleme het voorgeval."
|
270 |
-
|
271 |
-
#: contact-form-7/includes/functions.php:22
|
272 |
-
msgid "Validation errors occurred. Please confirm the fields and submit it again."
|
273 |
-
msgstr "Validasie probleme het voorgeval. Maak seker die vorm areas is ingevul en probeer weer stuur."
|
274 |
-
|
275 |
-
#: contact-form-7/includes/functions.php:26
|
276 |
-
msgid "There is a field of term that sender is needed to accept"
|
277 |
-
msgstr "Daar is 'n vorm area of term wat aanvaar moet word voor dit gestuur kan word"
|
278 |
-
|
279 |
-
#: contact-form-7/includes/functions.php:27
|
280 |
-
msgid "Please accept the terms to proceed."
|
281 |
-
msgstr "Aanvaar die terme asseblief om voort te gaan."
|
282 |
-
|
283 |
-
#: contact-form-7/includes/functions.php:31
|
284 |
-
msgid "Email address that sender entered is invalid"
|
285 |
-
msgstr "E-pos adres van die afsender is ongeldig"
|
286 |
-
|
287 |
-
#: contact-form-7/includes/functions.php:32
|
288 |
-
msgid "Email address seems invalid."
|
289 |
-
msgstr "E-pos adres blyk ongeldig."
|
290 |
-
|
291 |
-
#: contact-form-7/includes/functions.php:36
|
292 |
-
msgid "There is a field that sender is needed to fill in"
|
293 |
-
msgstr "Daar is 'n vorm area wat die afsender moet invul. "
|
294 |
-
|
295 |
-
#: contact-form-7/includes/functions.php:37
|
296 |
-
msgid "Please fill the required field."
|
297 |
-
msgstr "Vul asseblief die vereiste vorm area in."
|
298 |
-
|
299 |
-
#: contact-form-7/includes/functions.php:45
|
300 |
-
msgid "Your Name"
|
301 |
-
msgstr "Jou Naam"
|
302 |
-
|
303 |
-
#: contact-form-7/includes/functions.php:45
|
304 |
-
#: contact-form-7/includes/functions.php:47
|
305 |
-
msgid "(required)"
|
306 |
-
msgstr "(vereis)"
|
307 |
-
|
308 |
-
#: contact-form-7/includes/functions.php:47
|
309 |
-
msgid "Your Email"
|
310 |
-
msgstr "Jou E-pos"
|
311 |
-
|
312 |
-
#: contact-form-7/includes/functions.php:49
|
313 |
-
msgid "Subject"
|
314 |
-
msgstr "Onderwerp"
|
315 |
-
|
316 |
-
#: contact-form-7/includes/functions.php:51
|
317 |
-
msgid "Your Message"
|
318 |
-
msgstr "Jou Boodskappe"
|
319 |
-
|
320 |
-
#: contact-form-7/includes/functions.php:53
|
321 |
-
msgid "Send"
|
322 |
-
msgstr "Stuur"
|
323 |
-
|
324 |
-
#: contact-form-7/includes/functions.php:60
|
325 |
-
#, php-format
|
326 |
-
msgid "From: %s"
|
327 |
-
msgstr "Van: %s"
|
328 |
-
|
329 |
-
#: contact-form-7/includes/functions.php:61
|
330 |
-
#, php-format
|
331 |
-
msgid "Subject: %s"
|
332 |
-
msgstr "Onderwerp: %s"
|
333 |
-
|
334 |
-
#: contact-form-7/includes/functions.php:62
|
335 |
-
msgid "Message Body:"
|
336 |
-
msgstr "Boodskap teks:"
|
337 |
-
|
338 |
-
#: contact-form-7/includes/functions.php:63
|
339 |
-
#: contact-form-7/includes/functions.php:74
|
340 |
-
#, php-format
|
341 |
-
msgid "This mail is sent via contact form on %1$s %2$s"
|
342 |
-
msgstr "Die pos is gestuur deur die kontak vorm op %1$s %2$s"
|
343 |
-
|
344 |
-
#: contact-form-7/includes/functions.php:163
|
345 |
-
msgid "Albanian"
|
346 |
-
msgstr "Albaans"
|
347 |
-
|
348 |
-
#: contact-form-7/includes/functions.php:164
|
349 |
-
msgid "Arabic"
|
350 |
-
msgstr "Arabies"
|
351 |
-
|
352 |
-
#: contact-form-7/includes/functions.php:165
|
353 |
-
msgid "Bangla"
|
354 |
-
msgstr "Bangla"
|
355 |
-
|
356 |
-
#: contact-form-7/includes/functions.php:166
|
357 |
-
msgid "Bosnian"
|
358 |
-
msgstr "Bosnies"
|
359 |
|