Contact Form 7 - Version 1.10

Version Description

Download this release

Release Info

Developer takayukister
Plugin Icon 128x128 Contact Form 7
Version 1.10
Comparing to
See all releases

Code changes from version 1.9.5.1 to 1.10

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: takayukister
3
Donate link: http://pledgie.com/campaigns/3117
4
Tags: contact, contact form, email, ajax, captcha, akismet
5
Requires at least: 2.5
6
- Tested up to: 2.7.1
7
- Stable tag: 1.9.5.1
8
9
Just another contact form plugin. Simple but flexible.
10
@@ -20,6 +20,7 @@ Since being published in August 2007, Contact Form 7 has been translated into a
20
21
* Albanian (sq) - [Olgi Zenullari](http://www.olgizenullari.com/)
22
* Arabic (ar) - [Tarek Chaaban](http://www.chaaban.info/) and Muhammed Lardi
23
* Brazilian Portuguese (pt_BR) - [Leonardo Pinheiro](http://www.eletrikabarbarella.com.br/) (updated by [Henrique Vianna](http://henriquevianna.com/))
24
* Bulgarian (bg_BG) - [Iliyan Darganov](http://www.darganov.com/)
25
* Catalan (ca_ES) - [Jordi Sancho](http://www.qasolutions.net/blog)
@@ -49,10 +50,11 @@ Since being published in August 2007, Contact Form 7 has been translated into a
49
* Portuguese (pt_PT) - [Hugo Baeta](http://hugobaeta.com)
50
* Russian (ru_RU) - [Dmitry Volotovich](http://www.volnov.com)
51
* Romanian (ro_RO) - [Stas Sushkov](http://stas.nerd.ro/)
52
* Slovene (sl_SI) - [Mihael Simonič](http://smihael.bplaced.net)
53
* Spanish (es_ES) - [Jordi Sancho](http://www.qasolutions.net/blog)
54
(updated by [Vladimir Prieto](http://vladimir.prie.to/), [Federico Mikaelian](http://www.fedemika.com.ar/) and [Matias Baldanza](http://matiasbaldanza.com/))
55
- * Swedish (sv_SE) - [Fredrik Jonsson](http://www.fredda-o-ac.se/)
56
* Turkish (tr_TR) - [Roman Neumuller](http://katpatuka.wordpress.com) (updated by [Hasan Yılmaz](http://hedefturkce.com/))
57
* Ukrainian (uk_UA) - [Andrey Kovba](http://myserver.com.ua/)
58
* Vietnamese (vi) - Thanh Hải, Hà
3
Donate link: http://pledgie.com/campaigns/3117
4
Tags: contact, contact form, email, ajax, captcha, akismet
5
Requires at least: 2.5
6
+ Tested up to: 2.8-beta2
7
+ Stable tag: 1.10
8
9
Just another contact form plugin. Simple but flexible.
10
20
21
* Albanian (sq) - [Olgi Zenullari](http://www.olgizenullari.com/)
22
* Arabic (ar) - [Tarek Chaaban](http://www.chaaban.info/) and Muhammed Lardi
23
+ * Bosnian (bs) - [Vedran](http://www.seorabbit.com/)
24
* Brazilian Portuguese (pt_BR) - [Leonardo Pinheiro](http://www.eletrikabarbarella.com.br/) (updated by [Henrique Vianna](http://henriquevianna.com/))
25
* Bulgarian (bg_BG) - [Iliyan Darganov](http://www.darganov.com/)
26
* Catalan (ca_ES) - [Jordi Sancho](http://www.qasolutions.net/blog)
50
* Portuguese (pt_PT) - [Hugo Baeta](http://hugobaeta.com)
51
* Russian (ru_RU) - [Dmitry Volotovich](http://www.volnov.com)
52
* Romanian (ro_RO) - [Stas Sushkov](http://stas.nerd.ro/)
53
+ * Serbian (sr_RS) - [Vedran](http://www.seorabbit.com/)
54
* Slovene (sl_SI) - [Mihael Simonič](http://smihael.bplaced.net)
55
* Spanish (es_ES) - [Jordi Sancho](http://www.qasolutions.net/blog)
56
(updated by [Vladimir Prieto](http://vladimir.prie.to/), [Federico Mikaelian](http://www.fedemika.com.ar/) and [Matias Baldanza](http://matiasbaldanza.com/))
57
+ * Swedish (sv_SE) - [Fredrik Jonsson](http://www.fredda-o-ac.se/) (updated by [the Swedish community](http://wp-support.se/))
58
* Turkish (tr_TR) - [Roman Neumuller](http://katpatuka.wordpress.com) (updated by [Hasan Yılmaz](http://hedefturkce.com/))
59
* Ukrainian (uk_UA) - [Andrey Kovba](http://myserver.com.ua/)
60
* Vietnamese (vi) - Thanh Hải, Hà
admin/admin-panel.php CHANGED
@@ -1,34 +1,34 @@
1
- <?php if (! version_compare($wp_version, '2.7', '>=') && isset($updated_message)) : ?>
2
<div id="message" class="updated fade"><p><strong><?php echo $updated_message; ?></strong></p></div>
3
<?php endif; ?>
4
<div class="wrap wpcf7">
5
- <?php if (function_exists('screen_icon')) screen_icon(); ?>
6
- <h2><?php _e('Contact Form 7', 'wpcf7'); ?></h2>
7
-
8
- <?php if (version_compare($wp_version, '2.7', '>=') && isset($updated_message)) : ?>
9
<div id="message" class="updated fade"><p><strong><?php echo $updated_message; ?></strong></p></div>
10
<?php endif; ?>
11
12
<ul class="subsubsub">
13
- <?php foreach ($contact_forms as $k => $v) : ?>
14
- <li><a href="<?php echo $base_url . '?page=' . $page . '&contactform=' . $k ?>"<?php if ($k == $current) echo ' class="current"'; ?>>
15
<?php echo $v['title']; ?></a> |</li>
16
<?php endforeach; ?>
17
18
- <?php if ($this->has_edit_cap()) : ?>
19
<li class="addnew">
20
- <a href="<?php echo $base_url . '?page=' . $page . '&contactform=new'; ?>"<?php if ($unsaved) echo ' class="current"'; ?>>
21
- <?php _e('Add new', 'wpcf7'); ?></a></li>
22
<?php endif; ?>
23
</ul>
24
25
<br class="clear" />
26
27
- <?php if ($cf) : ?>
28
- <?php $disabled = ($this->has_edit_cap()) ? '' : ' disabled="disabled"'; ?>
29
30
<form method="post" action="<?php echo $base_url . '?page=' . $page . '&contactform=' . $current; ?>" id="wpcf7-admin-form-element">
31
- <?php if ($this->has_edit_cap()) wp_nonce_field('wpcf7-save_' . $current); ?>
32
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo $current; ?>" />
33
34
<table class="widefat">
@@ -36,30 +36,32 @@
36
<tr>
37
<td scope="col">
38
<div style="position: relative;">
39
- <input type="text" id="wpcf7-title" name="wpcf7-title" size="40" value="<?php echo htmlspecialchars($cf['title']); ?>"<?php echo $disabled; ?> />
40
41
- <?php if (! $unsaved) : ?>
42
<p class="tagcode">
43
- <?php _e('Copy this code and paste it into your post, page or text widget content.', 'wpcf7'); ?><br />
44
<input type="text" id="contact-form-anchor-text" onfocus="this.select();" readonly="readonly" />
45
</p>
46
<?php endif; ?>
47
48
- <?php if ($this->has_edit_cap()) : ?>
49
<div class="save-contact-form">
50
- <input type="submit" class="button button-highlighted" name="wpcf7-save" value="<?php _e('Save', 'wpcf7'); ?>" />
51
</div>
52
<?php endif; ?>
53
54
- <?php if ($this->has_edit_cap() && ! $unsaved) : ?>
55
<div class="actions-link">
56
- <?php $copy_nonce = wp_create_nonce('wpcf7-copy_' . $current); ?>
57
- <input type="submit" name="wpcf7-copy" class="copy" value="<?php _e('Copy', 'wpcf7'); ?>"
58
<?php echo "onclick=\"this.form._wpnonce.value = '$copy_nonce'; return true;\""; ?> />
59
|
60
- <?php $delete_nonce = wp_create_nonce('wpcf7-delete_' . $current); ?>
61
- <input type="submit" name="wpcf7-delete" class="delete" value="<?php _e('Delete', 'wpcf7'); ?>"
62
- <?php echo "onclick=\"if (confirm('" . js_escape(__("You are about to delete this contact form.\n 'Cancel' to stop, 'OK' to delete.", 'wpcf7')) . "')) {this.form._wpnonce.value = '$delete_nonce'; return true;} return false;\""; ?> />
63
</div>
64
<?php endif; ?>
65
</div>
@@ -68,19 +70,19 @@
68
</tbody>
69
</table>
70
71
- <?php if ($this->has_edit_cap()) : ?>
72
73
<table class="widefat" style="margin-top: 1em;">
74
<thead>
75
<tr>
76
- <th scope="col" colspan="2"><?php _e('Form', 'wpcf7'); ?></th>
77
</tr>
78
</thead>
79
<tbody>
80
<tr>
81
<td scope="col" style="width: 50%;">
82
<div>
83
- <textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="20"><?php echo htmlspecialchars($cf['form']); ?></textarea>
84
</div>
85
</td>
86
<td scope="col" style="width: 50%;">
@@ -93,43 +95,47 @@
93
<table class="widefat" style="margin-top: 1em;">
94
<thead>
95
<tr>
96
- <th scope="col" colspan="2"><?php _e('Mail', 'wpcf7'); ?></th>
97
</tr>
98
</thead>
99
<tbody>
100
<tr>
101
<td scope="col" style="width: 50%;">
102
<div class="mail-field">
103
- <label for="wpcf7-mail-recipient"><?php _e('To:', 'wpcf7'); ?></label><br />
104
- <input type="text" id="wpcf7-mail-recipient" name="wpcf7-mail-recipient" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail']['recipient']); ?>" />
105
</div>
106
<div class="mail-field">
107
- <label for="wpcf7-mail-sender"><?php _e('From:', 'wpcf7'); ?></label><br />
108
- <input type="text" id="wpcf7-mail-sender" name="wpcf7-mail-sender" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail']['sender']); ?>" />
109
</div>
110
<div class="mail-field">
111
- <label for="wpcf7-mail-subject"><?php _e('Subject:', 'wpcf7'); ?></label><br />
112
- <input type="text" id="wpcf7-mail-subject" name="wpcf7-mail-subject" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail']['subject']); ?>" />
113
</div>
114
<div class="pseudo-hr"></div>
115
<div class="mail-field">
116
- <label for="wpcf7-mail-attachments"><?php _e('File attachments:', 'wpcf7'); ?></label>
117
- <?php if (version_compare($wp_version, '2.7', '<')) : ?>
118
- <span style="color: #ff3300; margin-left: 0.5em;"><?php _e('(You need WordPress 2.7 or greater to use this feature)', 'wpcf7'); ?></span>
119
<?php endif; ?>
120
<br />
121
- <input type="text" id="wpcf7-mail-attachments" name="wpcf7-mail-attachments" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail']['attachments']); ?>" />
122
</div>
123
<div class="pseudo-hr"></div>
124
<div class="mail-field">
125
- <input type="checkbox" id="wpcf7-mail-use-html" name="wpcf7-mail-use-html" value="1"<?php echo ($cf['mail']['use_html']) ? ' checked="checked"' : ''; ?> />
126
- <label for="wpcf7-mail-use-html"><?php _e('Use HTML content type', 'wpcf7'); ?></label>
127
</div>
128
</td>
129
<td scope="col" style="width: 50%;">
130
<div class="mail-field">
131
- <label for="wpcf7-mail-body"><?php _e('Message body:', 'wpcf7'); ?></label><br />
132
- <textarea id="wpcf7-mail-body" name="wpcf7-mail-body" cols="100" rows="16"><?php echo htmlspecialchars($cf['mail']['body']); ?></textarea>
133
</div>
134
</td>
135
</tr>
@@ -139,49 +145,53 @@
139
<table class="widefat" style="margin-top: 1em;">
140
<thead>
141
<tr>
142
- <th scope="col" colspan="2"><?php _e('Mail (2)', 'wpcf7'); ?></th>
143
</tr>
144
</thead>
145
<tbody>
146
<tr>
147
<td scope="col" colspan="2">
148
- <input type="checkbox" id="wpcf7-mail-2-active" name="wpcf7-mail-2-active" value="1"<?php echo ($cf['mail_2']['active']) ? ' checked="checked"' : ''; ?> />
149
- <label for="wpcf7-mail-2-active"><?php _e('Use mail (2)', 'wpcf7'); ?></label>
150
</td>
151
</tr>
152
<tr id="mail-2-fields">
153
<td scope="col" style="width: 50%;">
154
<div class="mail-field">
155
- <label for="wpcf7-mail-2-recipient"><?php _e('To:', 'wpcf7'); ?></label><br />
156
- <input type="text" id="wpcf7-mail-2-recipient" name="wpcf7-mail-2-recipient" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail_2']['recipient']); ?>" />
157
</div>
158
<div class="mail-field">
159
- <label for="wpcf7-mail-2-sender"><?php _e('From:', 'wpcf7'); ?></label><br />
160
- <input type="text" id="wpcf7-mail-2-sender" name="wpcf7-mail-2-sender" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail_2']['sender']); ?>" />
161
</div>
162
<div class="mail-field">
163
- <label for="wpcf7-mail-2-subject"><?php _e('Subject:', 'wpcf7'); ?></label><br />
164
- <input type="text" id="wpcf7-mail-2-subject" name="wpcf7-mail-2-subject" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail_2']['subject']); ?>" />
165
</div>
166
<div class="pseudo-hr"></div>
167
<div class="mail-field">
168
- <label for="wpcf7-mail-2-attachments"><?php _e('File attachments:', 'wpcf7'); ?></label>
169
- <?php if (version_compare($wp_version, '2.7', '<')) : ?>
170
- <span style="color: #ff3300; margin-left: 0.5em;"><?php _e('(You need WordPress 2.7 or greater to use this feature)', 'wpcf7'); ?></span>
171
<?php endif; ?>
172
<br />
173
- <input type="text" id="wpcf7-mail-2-attachments" name="wpcf7-mail-2-attachments" class="wide" size="70" value="<?php echo htmlspecialchars($cf['mail_2']['attachments']); ?>" />
174
</div>
175
<div class="pseudo-hr"></div>
176
<div class="mail-field">
177
- <input type="checkbox" id="wpcf7-mail-2-use-html" name="wpcf7-mail-2-use-html" value="1"<?php echo ($cf['mail_2']['use_html']) ? ' checked="checked"' : ''; ?> />
178
- <label for="wpcf7-mail-2-use-html"><?php _e('Use HTML content type', 'wpcf7'); ?></label>
179
</div>
180
</td>
181
<td scope="col" style="width: 50%;">
182
<div class="mail-field">
183
- <label for="wpcf7-mail-2-body"><?php _e('Message body:', 'wpcf7'); ?></label><br />
184
- <textarea id="wpcf7-mail-2-body" name="wpcf7-mail-2-body" cols="100" rows="16"><?php echo htmlspecialchars($cf['mail_2']['body']); ?></textarea>
185
</div>
186
</td>
187
</tr>
@@ -191,7 +201,7 @@
191
<table class="widefat" style="margin-top: 1em;">
192
<thead>
193
<tr>
194
- <th scope="col"><?php _e('Messages', 'wpcf7'); ?> <span id="message-fields-toggle-switch"></span></th>
195
</tr>
196
</thead>
197
<tbody>
@@ -199,52 +209,52 @@
199
<td scope="col">
200
<div id="message-fields">
201
<div class="message-field">
202
- <label for="wpcf7-message-mail-sent-ok"><em># <?php _e("Sender's message was sent successfully", 'wpcf7'); ?></em></label><br />
203
- <input type="text" id="wpcf7-message-mail-sent-ok" name="wpcf7-message-mail-sent-ok" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['mail_sent_ok']); ?>" />
204
</div>
205
<div class="message-field">
206
- <label for="wpcf7-message-mail-sent-ng"><em># <?php _e("Sender's message was failed to send", 'wpcf7'); ?></em></label><br />
207
- <input type="text" id="wpcf7-message-mail-sent-ng" name="wpcf7-message-mail-sent-ng" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['mail_sent_ng']); ?>" />
208
</div>
209
<div class="message-field">
210
- <label for="wpcf7-message-akismet-says-spam"><em># <?php _e("Akismet judged the sending activity as spamming", 'wpcf7'); ?></em></label><br />
211
- <input type="text" id="wpcf7-message-akismet-says-spam" name="wpcf7-message-akismet-says-spam" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['akismet_says_spam']); ?>" />
212
</div>
213
<div class="message-field">
214
- <label for="wpcf7-message-validation-error"><em># <?php _e("Validation errors occurred", 'wpcf7'); ?></em></label><br />
215
- <input type="text" id="wpcf7-message-validation-error" name="wpcf7-message-validation-error" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['validation_error']); ?>" />
216
</div>
217
<div class="message-field" style="margin-top: 1em;">
218
- <label for="wpcf7-message-invalid-required"><em># <?php _e("There is a field that sender is needed to fill in", 'wpcf7'); ?></em></label><br />
219
- <input type="text" id="wpcf7-message-invalid-required" name="wpcf7-message-invalid-required" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['invalid_required']); ?>" />
220
</div>
221
<div class="message-field">
222
- <label for="wpcf7-message-invalid-email"><em># <?php _e("Email address that sender entered is invalid", 'wpcf7'); ?></em></label><br />
223
- <input type="text" id="wpcf7-message-invalid-email" name="wpcf7-message-invalid-email" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['invalid_email']); ?>" />
224
</div>
225
<div class="message-field">
226
- <label for="wpcf7-message-accept-terms"><em># <?php _e("There is a field of term that sender is needed to accept", 'wpcf7'); ?></em></label><br />
227
- <input type="text" id="wpcf7-message-accept-terms" name="wpcf7-message-accept-terms" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['accept_terms']); ?>" />
228
</div>
229
<div class="message-field">
230
- <label for="wpcf7-message-quiz-answer-not-correct"><em># <?php _e("Sender doesn't enter the correct answer to the quiz", 'wpcf7'); ?></em></label><br />
231
- <input type="text" id="wpcf7-message-quiz-answer-not-correct" name="wpcf7-message-quiz-answer-not-correct" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['quiz_answer_not_correct']); ?>" />
232
</div>
233
<div class="message-field">
234
- <label for="wpcf7-message-captcha-not-match"><em># <?php _e("The code that sender entered does not match the CAPTCHA", 'wpcf7'); ?></em></label><br />
235
- <input type="text" id="wpcf7-message-captcha-not-match" name="wpcf7-message-captcha-not-match" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['captcha_not_match']); ?>" />
236
</div>
237
<div class="message-field">
238
- <label for="wpcf7-message-upload-failed"><em># <?php _e("Uploading a file fails for any reason", 'wpcf7'); ?></em></label><br />
239
- <input type="text" id="wpcf7-message-upload-failed" name="wpcf7-message-upload-failed" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['upload_failed']); ?>" />
240
</div>
241
<div class="message-field">
242
- <label for="wpcf7-message-upload-file-type-invalid"><em># <?php _e("Uploaded file is not allowed file type", 'wpcf7'); ?></em></label><br />
243
- <input type="text" id="wpcf7-message-upload-file-type-invalid" name="wpcf7-message-upload-file-type-invalid" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['upload_file_type_invalid']); ?>" />
244
</div>
245
<div class="message-field">
246
- <label for="wpcf7-message-upload-file-too-large"><em># <?php _e("Uploaded file is too large", 'wpcf7'); ?></em></label><br />
247
- <input type="text" id="wpcf7-message-upload-file-too-large" name="wpcf7-message-upload-file-too-large" class="wide" size="70" value="<?php echo htmlspecialchars($cf['messages']['upload_file_too_large']); ?>" />
248
</div>
249
</div>
250
@@ -253,14 +263,31 @@
253
</tbody>
254
</table>
255
256
- <input type="hidden" id="wpcf7-options-recipient" name="wpcf7-options-recipient" value="<?php echo htmlspecialchars($cf['options']['recipient']); ?>" />
257
258
<table class="widefat" style="margin-top: 1em;">
259
<tbody>
260
<tr>
261
<td scope="col">
262
<div class="save-contact-form">
263
- <input type="submit" class="button button-highlighted" name="wpcf7-save" value="<?php _e('Save', 'wpcf7'); ?>" />
264
</div>
265
</td>
266
</tr>
@@ -272,4 +299,4 @@
272
</form>
273
274
<?php endif; ?>
275
- </div>
1
+ <?php if ( ! version_compare( $wp_version, '2.7', '>=' ) && isset( $updated_message ) ) : ?>
2
<div id="message" class="updated fade"><p><strong><?php echo $updated_message; ?></strong></p></div>
3
<?php endif; ?>
4
<div class="wrap wpcf7">
5
+ <?php if ( function_exists( 'screen_icon' ) ) screen_icon(); ?>
6
+ <h2><?php _e( 'Contact Form 7', 'wpcf7' ); ?></h2>
7
+ <?php wpcf7_donation_link(); ?>
8
+ <?php if ( version_compare( $wp_version, '2.7', '>=' ) && isset( $updated_message ) ) : ?>
9
<div id="message" class="updated fade"><p><strong><?php echo $updated_message; ?></strong></p></div>
10
<?php endif; ?>
11
12
<ul class="subsubsub">
13
+ <?php foreach ( $contact_forms as $k => $v ) : ?>
14
+ <li><a href="<?php echo $base_url . '?page=' . $page . '&contactform=' . $k ?>"<?php if ( $k == $current ) echo ' class="current"'; ?>>
15
<?php echo $v['title']; ?></a> |</li>
16
<?php endforeach; ?>
17
18
+ <?php if ( wpcf7_admin_has_edit_cap() ) : ?>
19
<li class="addnew">
20
+ <a href="<?php echo $base_url . '?page=' . $page . '&contactform=new'; ?>"<?php if ( $unsaved ) echo ' class="current"'; ?>>
21
+ <?php _e( 'Add new', 'wpcf7' ); ?></a></li>
22
<?php endif; ?>
23
</ul>
24
25
<br class="clear" />
26
27
+ <?php if ( $cf ) : ?>
28
+ <?php $disabled = ( wpcf7_admin_has_edit_cap() ) ? '' : ' disabled="disabled"'; ?>
29
30
<form method="post" action="<?php echo $base_url . '?page=' . $page . '&contactform=' . $current; ?>" id="wpcf7-admin-form-element">
31
+ <?php if ( wpcf7_admin_has_edit_cap() ) wp_nonce_field( 'wpcf7-save_' . $current ); ?>
32
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo $current; ?>" />
33
34
<table class="widefat">
36
<tr>
37
<td scope="col">
38
<div style="position: relative;">
39
+ <input type="text" id="wpcf7-title" name="wpcf7-title" size="40" value="<?php echo htmlspecialchars( $cf->title ); ?>"<?php echo $disabled; ?> />
40
41
+ <?php if ( ! $unsaved ) : ?>
42
<p class="tagcode">
43
+ <?php _e( 'Copy this code and paste it into your post, page or text widget content.', 'wpcf7' ); ?><br />
44
<input type="text" id="contact-form-anchor-text" onfocus="this.select();" readonly="readonly" />
45
</p>
46
<?php endif; ?>
47
48
+ <?php if ( wpcf7_admin_has_edit_cap() ) : ?>
49
<div class="save-contact-form">
50
+ <input type="submit" class="button button-highlighted" name="wpcf7-save" value="<?php _e( 'Save', 'wpcf7' ); ?>" />
51
</div>
52
<?php endif; ?>
53
54
+ <?php if ( wpcf7_admin_has_edit_cap() && ! $unsaved ) : ?>
55
<div class="actions-link">
56
+ <?php $copy_nonce = wp_create_nonce( 'wpcf7-copy_' . $current ); ?>
57
+ <input type="submit" name="wpcf7-copy" class="copy" value="<?php _e( 'Copy', 'wpcf7' ); ?>"
58
<?php echo "onclick=\"this.form._wpnonce.value = '$copy_nonce'; return true;\""; ?> />
59
|
60
+ <?php $delete_nonce = wp_create_nonce( 'wpcf7-delete_' . $current ); ?>
61
+ <input type="submit" name="wpcf7-delete" class="delete" value="<?php _e( 'Delete', 'wpcf7' ); ?>"
62
+ <?php echo "onclick=\"if (confirm('" .
63
+ esc_js( __( "You are about to delete this contact form.\n 'Cancel' to stop, 'OK' to delete.", 'wpcf7' ) ) .
64
+ "')) {this.form._wpnonce.value = '$delete_nonce'; return true;} return false;\""; ?> />
65
</div>
66
<?php endif; ?>
67
</div>
70
</tbody>
71
</table>
72
73
+ <?php if ( wpcf7_admin_has_edit_cap() ) : ?>
74
75
<table class="widefat" style="margin-top: 1em;">
76
<thead>
77
<tr>
78
+ <th scope="col" colspan="2"><?php _e( 'Form', 'wpcf7' ); ?></th>
79
</tr>
80
</thead>
81
<tbody>
82
<tr>
83
<td scope="col" style="width: 50%;">
84
<div>
85
+ <textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="20"><?php echo htmlspecialchars( $cf->form ); ?></textarea>
86
</div>
87
</td>
88
<td scope="col" style="width: 50%;">
95
<table class="widefat" style="margin-top: 1em;">
96
<thead>
97
<tr>
98
+ <th scope="col" colspan="2"><?php _e( 'Mail', 'wpcf7' ); ?></th>
99
</tr>
100
</thead>
101
<tbody>
102
<tr>
103
<td scope="col" style="width: 50%;">
104
<div class="mail-field">
105
+ <label for="wpcf7-mail-recipient"><?php _e( 'To:', 'wpcf7' ); ?></label><br />
106
+ <input type="text" id="wpcf7-mail-recipient" name="wpcf7-mail-recipient" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->mail['recipient'] ); ?>" />
107
</div>
108
<div class="mail-field">
109
+ <label for="wpcf7-mail-sender"><?php _e( 'From:', 'wpcf7' ); ?></label><br />
110
+ <input type="text" id="wpcf7-mail-sender" name="wpcf7-mail-sender" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->mail['sender'] ); ?>" />
111
</div>
112
<div class="mail-field">
113
+ <label for="wpcf7-mail-subject"><?php _e( 'Subject:', 'wpcf7' ); ?></label><br />
114
+ <input type="text" id="wpcf7-mail-subject" name="wpcf7-mail-subject" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->mail['subject'] ); ?>" />
115
</div>
116
<div class="pseudo-hr"></div>
117
<div class="mail-field">
118
+ <label for="wpcf7-mail-additional-headers"><?php _e( 'Additional headers:', 'wpcf7' ); ?></label><br />
119
+ <textarea id="wpcf7-mail-additional-headers" name="wpcf7-mail-additional-headers" cols="100" rows="2"><?php echo htmlspecialchars( $cf->mail['additional_headers'] ); ?></textarea>
120
+ </div>
121
+ <div class="mail-field">
122
+ <label for="wpcf7-mail-attachments"><?php _e( 'File attachments:', 'wpcf7' ); ?></label>
123
+ <?php if ( version_compare( $wp_version, '2.7', '<' ) ) : ?>
124
+ <span style="color: #ff3300; margin-left: 0.5em;"><?php _e( '(You need WordPress 2.7 or greater to use this feature)', 'wpcf7' ); ?></span>
125
<?php endif; ?>
126
<br />
127
+ <input type="text" id="wpcf7-mail-attachments" name="wpcf7-mail-attachments" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->mail['attachments'] ); ?>" />
128
</div>
129
<div class="pseudo-hr"></div>
130
<div class="mail-field">
131
+ <input type="checkbox" id="wpcf7-mail-use-html" name="wpcf7-mail-use-html" value="1"<?php echo ( $cf->mail['use_html'] ) ? ' checked="checked"' : ''; ?> />
132
+ <label for="wpcf7-mail-use-html"><?php _e( 'Use HTML content type', 'wpcf7' ); ?></label>
133
</div>
134
</td>
135
<td scope="col" style="width: 50%;">
136
<div class="mail-field">
137
+ <label for="wpcf7-mail-body"><?php _e( 'Message body:', 'wpcf7' ); ?></label><br />
138
+ <textarea id="wpcf7-mail-body" name="wpcf7-mail-body" cols="100" rows="16"><?php echo htmlspecialchars( $cf->mail['body'] ); ?></textarea>
139
</div>
140
</td>
141
</tr>
145
<table class="widefat" style="margin-top: 1em;">
146
<thead>
147
<tr>
148
+ <th scope="col" colspan="2"><?php _e( 'Mail (2)', 'wpcf7' ); ?></th>
149
</tr>
150
</thead>
151
<tbody>
152
<tr>
153
<td scope="col" colspan="2">
154
+ <input type="checkbox" id="wpcf7-mail-2-active" name="wpcf7-mail-2-active" value="1"<?php echo ( $cf->mail_2['active'] ) ? ' checked="checked"' : ''; ?> />
155
+ <label for="wpcf7-mail-2-active"><?php _e( 'Use mail (2)', 'wpcf7' ); ?></label>
156
</td>
157
</tr>
158
<tr id="mail-2-fields">
159
<td scope="col" style="width: 50%;">
160
<div class="mail-field">
161
+ <label for="wpcf7-mail-2-recipient"><?php _e( 'To:', 'wpcf7' ); ?></label><br />
162
+ <input type="text" id="wpcf7-mail-2-recipient" name="wpcf7-mail-2-recipient" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->mail_2['recipient'] ); ?>" />
163
</div>
164
<div class="mail-field">
165
+ <label for="wpcf7-mail-2-sender"><?php _e( 'From:', 'wpcf7' ); ?></label><br />
166
+ <input type="text" id="wpcf7-mail-2-sender" name="wpcf7-mail-2-sender" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->mail_2['sender'] ); ?>" />
167
</div>
168
<div class="mail-field">
169
+ <label for="wpcf7-mail-2-subject"><?php _e( 'Subject:', 'wpcf7' ); ?></label><br />
170
+ <input type="text" id="wpcf7-mail-2-subject" name="wpcf7-mail-2-subject" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->mail_2['subject'] ); ?>" />
171
</div>
172
<div class="pseudo-hr"></div>
173
<div class="mail-field">
174
+ <label for="wpcf7-mail-2-additional-headers"><?php _e( 'Additional headers:', 'wpcf7' ); ?></label><br />
175
+ <textarea id="wpcf7-mail-2-additional-headers" name="wpcf7-mail-2-additional-headers" cols="100" rows="2"><?php echo htmlspecialchars( $cf->mail_2['additional_headers'] ); ?></textarea>
176
+ </div>
177
+ <div class="mail-field">
178
+ <label for="wpcf7-mail-2-attachments"><?php _e( 'File attachments:', 'wpcf7' ); ?></label>
179
+ <?php if ( version_compare( $wp_version, '2.7', '<' ) ) : ?>
180
+ <span style="color: #ff3300; margin-left: 0.5em;"><?php _e( '(You need WordPress 2.7 or greater to use this feature)', 'wpcf7' ); ?></span>
181
<?php endif; ?>
182
<br />
183
+ <input type="text" id="wpcf7-mail-2-attachments" name="wpcf7-mail-2-attachments" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->mail_2['attachments'] ); ?>" />
184
</div>
185
<div class="pseudo-hr"></div>
186
<div class="mail-field">
187
+ <input type="checkbox" id="wpcf7-mail-2-use-html" name="wpcf7-mail-2-use-html" value="1"<?php echo ( $cf->mail_2['use_html'] ) ? ' checked="checked"' : ''; ?> />
188
+ <label for="wpcf7-mail-2-use-html"><?php _e( 'Use HTML content type', 'wpcf7' ); ?></label>
189
</div>
190
</td>
191
<td scope="col" style="width: 50%;">
192
<div class="mail-field">
193
+ <label for="wpcf7-mail-2-body"><?php _e( 'Message body:', 'wpcf7' ); ?></label><br />
194
+ <textarea id="wpcf7-mail-2-body" name="wpcf7-mail-2-body" cols="100" rows="16"><?php echo htmlspecialchars( $cf->mail_2['body'] ); ?></textarea>
195
</div>
196
</td>
197
</tr>
201
<table class="widefat" style="margin-top: 1em;">
202
<thead>
203
<tr>
204
+ <th scope="col"><?php _e( 'Messages', 'wpcf7' ); ?> <span id="message-fields-toggle-switch"></span></th>
205
</tr>
206
</thead>
207
<tbody>
209
<td scope="col">
210
<div id="message-fields">
211
<div class="message-field">
212
+ <label for="wpcf7-message-mail-sent-ok"><em># <?php _e( "Sender's message was sent successfully", 'wpcf7' ); ?></em></label><br />
213
+ <input type="text" id="wpcf7-message-mail-sent-ok" name="wpcf7-message-mail-sent-ok" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['mail_sent_ok'] ); ?>" />
214
</div>
215
<div class="message-field">
216
+ <label for="wpcf7-message-mail-sent-ng"><em># <?php _e( "Sender's message was failed to send", 'wpcf7' ); ?></em></label><br />
217
+ <input type="text" id="wpcf7-message-mail-sent-ng" name="wpcf7-message-mail-sent-ng" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['mail_sent_ng'] ); ?>" />
218
</div>
219
<div class="message-field">
220
+ <label for="wpcf7-message-akismet-says-spam"><em># <?php _e( "Akismet judged the sending activity as spamming", 'wpcf7' ); ?></em></label><br />
221
+ <input type="text" id="wpcf7-message-akismet-says-spam" name="wpcf7-message-akismet-says-spam" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['akismet_says_spam'] ); ?>" />
222
</div>
223
<div class="message-field">
224
+ <label for="wpcf7-message-validation-error"><em># <?php _e( "Validation errors occurred", 'wpcf7' ); ?></em></label><br />
225
+ <input type="text" id="wpcf7-message-validation-error" name="wpcf7-message-validation-error" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['validation_error'] ); ?>" />
226
</div>
227
<div class="message-field" style="margin-top: 1em;">
228
+ <label for="wpcf7-message-invalid-required"><em># <?php _e( "There is a field that sender is needed to fill in", 'wpcf7' ); ?></em></label><br />
229
+ <input type="text" id="wpcf7-message-invalid-required" name="wpcf7-message-invalid-required" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['invalid_required'] ); ?>" />
230
</div>
231
<div class="message-field">
232
+ <label for="wpcf7-message-invalid-email"><em># <?php _e( "Email address that sender entered is invalid", 'wpcf7' ); ?></em></label><br />
233
+ <input type="text" id="wpcf7-message-invalid-email" name="wpcf7-message-invalid-email" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['invalid_email'] ); ?>" />
234
</div>
235
<div class="message-field">
236
+ <label for="wpcf7-message-accept-terms"><em># <?php _e( "There is a field of term that sender is needed to accept", 'wpcf7' ); ?></em></label><br />
237
+ <input type="text" id="wpcf7-message-accept-terms" name="wpcf7-message-accept-terms" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['accept_terms'] ); ?>" />
238
</div>
239
<div class="message-field">
240
+ <label for="wpcf7-message-quiz-answer-not-correct"><em># <?php _e( "Sender doesn't enter the correct answer to the quiz", 'wpcf7' ); ?></em></label><br />
241
+ <input type="text" id="wpcf7-message-quiz-answer-not-correct" name="wpcf7-message-quiz-answer-not-correct" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['quiz_answer_not_correct'] ); ?>" />
242
</div>
243
<div class="message-field">
244
+ <label for="wpcf7-message-captcha-not-match"><em># <?php _e( "The code that sender entered does not match the CAPTCHA", 'wpcf7' ); ?></em></label><br />
245
+ <input type="text" id="wpcf7-message-captcha-not-match" name="wpcf7-message-captcha-not-match" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['captcha_not_match'] ); ?>" />
246
</div>
247
<div class="message-field">
248
+ <label for="wpcf7-message-upload-failed"><em># <?php _e( "Uploading a file fails for any reason", 'wpcf7' ); ?></em></label><br />
249
+ <input type="text" id="wpcf7-message-upload-failed" name="wpcf7-message-upload-failed" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['upload_failed'] ); ?>" />
250
</div>
251
<div class="message-field">
252
+ <label for="wpcf7-message-upload-file-type-invalid"><em># <?php _e( "Uploaded file is not allowed file type", 'wpcf7' ); ?></em></label><br />
253
+ <input type="text" id="wpcf7-message-upload-file-type-invalid" name="wpcf7-message-upload-file-type-invalid" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['upload_file_type_invalid'] ); ?>" />
254
</div>
255
<div class="message-field">
256
+ <label for="wpcf7-message-upload-file-too-large"><em># <?php _e( "Uploaded file is too large", 'wpcf7' ); ?></em></label><br />
257
+ <input type="text" id="wpcf7-message-upload-file-too-large" name="wpcf7-message-upload-file-too-large" class="wide" size="70" value="<?php echo htmlspecialchars( $cf->messages['upload_file_too_large'] ); ?>" />
258
</div>
259
</div>
260
263
</tbody>
264
</table>
265
266
+ <table class="widefat" style="margin-top: 1em;">
267
+ <thead>
268
+ <tr>
269
+ <th scope="col"><?php _e( 'Additional Settings', 'wpcf7' ); ?> <span id="additional-settings-fields-toggle-switch"></span></th>
270
+ </tr>
271
+ </thead>
272
+ <tbody>
273
+ <tr>
274
+ <td scope="col">
275
+ <div id="additional-settings-fields">
276
+ <textarea id="wpcf7-additional-settings" name="wpcf7-additional-settings" cols="100" rows="8"><?php echo htmlspecialchars( $cf->additional_settings ); ?></textarea>
277
+ </div>
278
+ </td>
279
+ </tr>
280
+ </tbody>
281
+ </table>
282
+
283
+ <input type="hidden" id="wpcf7-options-recipient" name="wpcf7-options-recipient" value="<?php echo htmlspecialchars( $cf->options['recipient'] ); ?>" />
284
285
<table class="widefat" style="margin-top: 1em;">
286
<tbody>
287
<tr>
288
<td scope="col">
289
<div class="save-contact-form">
290
+ <input type="submit" class="button button-highlighted" name="wpcf7-save" value="<?php _e( 'Save', 'wpcf7' ); ?>" />
291
</div>
292
</td>
293
</tr>
299
</form>
300
301
<?php endif; ?>
302
+ </div>
admin/admin-stylesheet.css CHANGED
@@ -1,3 +1,33 @@
1
div.wpcf7 ul.subsubsub {
2
white-space: normal;
3
}
@@ -56,7 +86,7 @@ input#contact-form-anchor-text {
56
-webkit-border-radius: 6px;
57
border-radius: 6px;
58
}
59
- span#message-fields-toggle-switch {
60
margin-left: 1em;
61
font-weight: normal;
62
font-size: smaller;
1
+ div.wpcf7 div.donation {
2
+ border-width: 1px;
3
+ border-style: solid;
4
+ padding: 0 0.6em;
5
+ margin: 5px 0 15px;
6
+ -moz-border-radius: 3px;
7
+ -khtml-border-radius: 3px;
8
+ -webkit-border-radius: 3px;
9
+ border-radius: 3px;
10
+ background-color: #ffffe0;
11
+ border-color: #e6db55;
12
+ text-align: center;
13
+ }
14
+
15
+ div.wpcf7 div.donation p {
16
+ margin: 0.5em 0;
17
+ line-height: 1;
18
+ padding: 2px;
19
+ }
20
+
21
+ div.wpcf7 div.donation p img {
22
+ vertical-align: text-bottom;
23
+ }
24
+
25
+ div.wpcf7 div.donation p em {
26
+ padding-left: 1em;
27
+ color: #555;
28
+ font-weight: bold;
29
+ }
30
+
31
div.wpcf7 ul.subsubsub {
32
white-space: normal;
33
}
86
-webkit-border-radius: 6px;
87
border-radius: 6px;
88
}
89
+ span#message-fields-toggle-switch, span#additional-settings-fields-toggle-switch {
90
margin-left: 1em;
91
font-weight: normal;
92
font-size: smaller;
admin/admin.php ADDED
@@ -0,0 +1,372 @@
1
+ <?php
2
+
3
+ function wpcf7_admin_menu_parent() {
4
+ global $wp_version;
5
+ if ( version_compare( $wp_version, '2.7', '>=' ) )
6
+ return 'tools.php';
7
+ else
8
+ return 'edit.php';
9
+ }
10
+
11
+ function wpcf7_admin_has_edit_cap() {
12
+ return current_user_can( WPCF7_ADMIN_READ_WRITE_CAPABILITY );
13
+ }
14
+
15
+ function wpcf7_admin_add_pages() {
16
+ if ( function_exists( 'admin_url' ) ) {
17
+ $base_url = admin_url( wpcf7_admin_menu_parent() );
18
+ } else {
19
+ $base_url = get_option( 'siteurl' ) . '/wp-admin/' . wpcf7_admin_menu_parent();
20
+ }
21
+
22
+ $page = str_replace( '\\', '%5C', plugin_basename( __FILE__ ) );
23
+ $contact_forms = wpcf7_contact_forms();
24
+
25
+ if ( isset( $_POST['wpcf7-save'] ) && wpcf7_admin_has_edit_cap() ) {
26
+ $id = $_POST['wpcf7-id'];
27
+ check_admin_referer( 'wpcf7-save_' . $id );
28
+
29
+ $title = trim( $_POST['wpcf7-title'] );
30
+ $form = trim( $_POST['wpcf7-form'] );
31
+ $mail = array(
32
+ 'subject' => trim( $_POST['wpcf7-mail-subject'] ),
33
+ 'sender' => trim( $_POST['wpcf7-mail-sender'] ),
34
+ 'body' => trim( $_POST['wpcf7-mail-body'] ),
35
+ 'recipient' => trim( $_POST['wpcf7-mail-recipient'] ),
36
+ 'additional_headers' => trim( $_POST['wpcf7-mail-additional-headers'] ),
37
+ 'attachments' => trim( $_POST['wpcf7-mail-attachments'] ),
38
+ 'use_html' => ( 1 == $_POST['wpcf7-mail-use-html'] ) ? true : false
39
+ );
40
+ $mail_2 = array(
41
+ 'active' => ( 1 == $_POST['wpcf7-mail-2-active'] ) ? true : false,
42
+ 'subject' => trim( $_POST['wpcf7-mail-2-subject'] ),
43
+ 'sender' => trim( $_POST['wpcf7-mail-2-sender'] ),
44
+ 'body' => trim( $_POST['wpcf7-mail-2-body'] ),
45
+ 'recipient' => trim( $_POST['wpcf7-mail-2-recipient'] ),
46
+ 'additional_headers' => trim( $_POST['wpcf7-mail-2-additional-headers'] ),
47
+ 'attachments' => trim( $_POST['wpcf7-mail-2-attachments'] ),
48
+ 'use_html' => ( 1 == $_POST['wpcf7-mail-2-use-html'] ) ? true : false
49
+ );
50
+ $messages = array(
51
+ 'mail_sent_ok' => trim( $_POST['wpcf7-message-mail-sent-ok'] ),
52
+ 'mail_sent_ng' => trim( $_POST['wpcf7-message-mail-sent-ng'] ),
53
+ 'akismet_says_spam' => trim( $_POST['wpcf7-message-akismet-says-spam'] ),
54
+ 'validation_error' => trim( $_POST['wpcf7-message-validation-error'] ),
55
+ 'accept_terms' => trim( $_POST['wpcf7-message-accept-terms'] ),
56
+ 'invalid_email' => trim( $_POST['wpcf7-message-invalid-email'] ),
57
+ 'invalid_required' => trim( $_POST['wpcf7-message-invalid-required'] ),
58
+ 'quiz_answer_not_correct' => trim( $_POST['wpcf7-message-quiz-answer-not-correct'] ),
59
+ 'captcha_not_match' => trim( $_POST['wpcf7-message-captcha-not-match'] ),
60
+ 'upload_failed' => trim( $_POST['wpcf7-message-upload-failed'] ),
61
+ 'upload_file_type_invalid' => trim( $_POST['wpcf7-message-upload-file-type-invalid'] ),
62
+ 'upload_file_too_large' => trim( $_POST['wpcf7-message-upload-file-too-large'] )
63
+ );
64
+ $additional_settings = trim( $_POST['wpcf7-additional-settings'] );
65
+ $options = array(
66
+ 'recipient' => trim( $_POST['wpcf7-options-recipient'] ) // For backward compatibility.
67
+ );
68
+
69
+ $data = compact( 'title', 'form', 'mail', 'mail_2', 'messages', 'additional_settings', 'options' );
70
+
71
+ if ( array_key_exists( $id, $contact_forms ) ) {
72
+ $contact_forms[$id] = $data;
73
+ $redirect_to = $base_url . '?page=' . $page . '&contactform=' . $id . '&message=saved';
74
+ } else {
75
+ $key = ( empty( $contact_forms ) ) ? 1 : max( array_keys( $contact_forms ) ) + 1;
76
+ $contact_forms[$key] = $data;
77
+ $redirect_to = $base_url . '?page=' . $page . '&contactform=' . $key . '&message=created';
78
+ }
79
+
80
+ wpcf7_update_contact_forms( $contact_forms );
81
+
82
+ wp_redirect( $redirect_to );
83
+ exit();
84
+ } elseif ( isset( $_POST['wpcf7-copy'] ) && wpcf7_admin_has_edit_cap() ) {
85
+ $id = $_POST['wpcf7-id'];
86
+ check_admin_referer( 'wpcf7-copy_' . $id );
87
+
88
+ if ( array_key_exists( $id, $contact_forms ) ) {
89
+ $key = max( array_keys( $contact_forms ) ) + 1;
90
+ $contact_forms[$key] = $contact_forms[$id];
91
+ $contact_forms[$key]['title'] .= '_copy';
92
+ wpcf7_update_contact_forms( $contact_forms );
93
+ $redirect_to = $base_url . '?page=' . $page . '&contactform=' . $key . '&message=created';
94
+ } else {
95
+ $redirect_to = $base_url . '?page=' . $page . '&contactform=' . $id;
96
+ }
97
+
98
+ wp_redirect( $redirect_to );
99
+ exit();
100
+ } elseif ( isset( $_POST['wpcf7-delete'] ) && wpcf7_admin_has_edit_cap() ) {
101
+ $id = $_POST['wpcf7-id'];
102
+ check_admin_referer( 'wpcf7-delete_' . $id );
103
+
104
+ unset( $contact_forms[$id] );
105
+ wpcf7_update_contact_forms( $contact_forms );
106
+
107
+ wp_redirect( $base_url . '?page=' . $page . '&message=deleted' );
108
+ exit();
109
+ }
110
+
111
+ add_management_page( __( 'Contact Form 7', 'wpcf7' ), __( 'Contact Form 7', 'wpcf7' ), WPCF7_ADMIN_READ_CAPABILITY, __FILE__, 'wpcf7_admin_management_page' );
112
+ }
113
+
114
+ add_action( 'admin_menu', 'wpcf7_admin_add_pages' );
115
+
116
+ function wpcf7_admin_head() {
117
+ global $plugin_page;
118
+
119
+ if ( isset( $plugin_page ) && $plugin_page == plugin_basename( __FILE__ ) ) {
120
+
121
+ $admin_stylesheet_url = wpcf7_plugin_url( 'admin/admin-stylesheet.css' );
122
+ echo '<link rel="stylesheet" href="' . $admin_stylesheet_url . '" type="text/css" />';
123
+
124
+ if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
125
+ $admin_stylesheet_rtl_url = wpcf7_plugin_url( 'admin/admin-stylesheet-rtl.css' );
126
+ echo '<link rel="stylesheet" href="' . $admin_stylesheet_rtl_url . '" type="text/css" />';
127
+ }
128
+
129
+ ?>
130
+ <script type="text/javascript">
131
+ //<![CDATA[
132
+ var _wpcf7 = {
133
+ captchaMod: <?php echo ( class_exists( 'ReallySimpleCaptcha' ) ) ? 'true' : 'false' ?>
134
+ };
135
+ //]]>
136
+ </script>
137
+ <?php
138
+ }
139
+ }
140
+
141
+ add_action( 'admin_head', 'wpcf7_admin_head' );
142
+
143
+ function wpcf7_admin_load_js() {
144
+ global $pagenow;
145
+
146
+ if ( ! is_admin() )
147
+ return;
148
+
149
+ if ( wpcf7_admin_menu_parent() != $pagenow )
150
+ return;
151
+
152
+ if ( false === strpos( $_GET['page'], 'contact-form-7' ) )
153
+ return;
154
+
155
+ wp_enqueue_script( 'wpcf7-admin', wpcf7_plugin_url( 'admin/wpcf7-admin.js' ), array('jquery'), WPCF7_VERSION, true );
156
+ wp_localize_script( 'wpcf7-admin', '_wpcf7L10n', array(
157
+ 'optional' => __( 'optional', 'wpcf7' ),
158
+ 'generateTag' => __( 'Generate Tag', 'wpcf7' ),
159
+ 'textField' => __( 'Text field', 'wpcf7' ),
160
+ 'emailField' => __( 'Email field', 'wpcf7' ),
161
+ 'textArea' => __( 'Text area', 'wpcf7' ),
162
+ 'menu' => __( 'Drop-down menu', 'wpcf7' ),
163
+ 'checkboxes' => __( 'Checkboxes', 'wpcf7' ),
164
+ 'radioButtons' => __( 'Radio buttons', 'wpcf7' ),
165
+ 'acceptance' => __( 'Acceptance', 'wpcf7' ),
166
+ 'isAcceptanceDefaultOn' => __( "Make this checkbox checked by default?", 'wpcf7' ),
167
+ 'isAcceptanceInvert' => __( "Make this checkbox work inversely?", 'wpcf7' ),
168
+ 'isAcceptanceInvertMeans' => __( "* That means visitor who accepts the term unchecks it.", 'wpcf7' ),
169
+ 'captcha' => __( 'CAPTCHA', 'wpcf7' ),
170
+ 'quiz' => __( 'Quiz', 'wpcf7' ),
171
+ 'quizzes' => __( 'Quizzes', 'wpcf7' ),
172
+ 'quizFormatDesc' => __( "* quiz|answer (e.g. 1+1=?|2)", 'wpcf7' ),
173
+ 'fileUpload' => __( 'File upload', 'wpcf7' ),
174
+ 'bytes' => __( 'bytes', 'wpcf7' ),
175
+ 'submit' => __( 'Submit button', 'wpcf7' ),
176
+ 'tagName' => __( 'Name', 'wpcf7' ),
177
+ 'isRequiredField' => __( 'Required field?', 'wpcf7' ),
178
+ 'allowsMultipleSelections' => __( 'Allow multiple selections?', 'wpcf7' ),
179
+ 'insertFirstBlankOption' => __( 'Insert a blank item as the first option?', 'wpcf7' ),
180
+ 'makeCheckboxesExclusive' => __( 'Make checkboxes exclusive?', 'wpcf7' ),
181
+ 'menuChoices' => __( 'Choices', 'wpcf7' ),
182
+ 'label' => __( 'Label', 'wpcf7' ),
183
+ 'defaultValue' => __( 'Default value', 'wpcf7' ),
184
+ 'akismet' => __( 'Akismet', 'wpcf7' ),
185
+ 'akismetAuthor' => __( "This field requires author's name", 'wpcf7' ),
186
+ 'akismetAuthorUrl' => __( "This field requires author's URL", 'wpcf7' ),
187
+ 'akismetAuthorEmail' => __( "This field requires author's email address", 'wpcf7' ),
188
+ 'generatedTag' => __( "Copy this code and paste it into the form left.", 'wpcf7' ),
189
+ 'fgColor' => __( "Foreground color", 'wpcf7' ),
190
+ 'bgColor' => __( "Background color", 'wpcf7' ),
191
+ 'imageSize' => __( "Image size", 'wpcf7' ),
192
+ 'imageSizeSmall' => __( "Small", 'wpcf7' ),
193
+ 'imageSizeMedium' => __( "Medium", 'wpcf7' ),
194
+ 'imageSizeLarge' => __( "Large", 'wpcf7' ),
195
+ 'imageSettings' => __( "Image settings", 'wpcf7' ),
196
+ 'inputFieldSettings' => __( "Input field settings", 'wpcf7' ),
197
+ 'tagForImage' => __( "For image", 'wpcf7' ),
198
+ 'tagForInputField' => __( "For input field", 'wpcf7' ),
199
+ 'oneChoicePerLine' => __( "* One choice per line.", 'wpcf7' ),
200
+ 'show' => __( "Show", 'wpcf7' ),
201
+ 'hide' => __( "Hide", 'wpcf7' ),
202
+ 'fileSizeLimit' => __( "File size limit", 'wpcf7' ),
203
+ 'acceptableFileTypes' => __( "Acceptable file types", 'wpcf7' ),
204
+ 'needReallySimpleCaptcha' => __( "Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed.", 'wpcf7' )
205
+ ) );
206
+ }
207
+
208
+ add_action( 'wp_print_scripts', 'wpcf7_admin_load_js' );
209
+
210
+ function wpcf7_admin_management_page() {
211
+ global $wp_version;
212
+
213
+ if ( function_exists( 'admin_url' ) ) {
214
+ $base_url = admin_url( wpcf7_admin_menu_parent() );
215
+ } else {
216
+ $base_url = get_option( 'siteurl' ) . '/wp-admin/' . wpcf7_admin_menu_parent();
217
+ }
218
+
219
+ $page = plugin_basename( __FILE__ );
220
+
221
+ switch ( $_GET['message'] ) {
222
+ case 'created':
223
+ $updated_message = __( 'Contact form created.', 'wpcf7' );
224
+ break;
225
+ case 'saved':
226
+ $updated_message = __( 'Contact form saved.', 'wpcf7' );
227
+ break;
228
+ case 'deleted':
229
+ $updated_message = __( 'Contact form deleted.', 'wpcf7' );
230
+ break;
231
+ }
232
+
233
+ $contact_forms = wpcf7_contact_forms();
234
+
235
+ $id = $_POST['wpcf7-id'];
236
+
237
+ if ( 'new' == $_GET['contactform'] ) {
238
+ $unsaved = true;
239
+ $current = -1;
240
+ $cf = wpcf7_contact_form( wpcf7_default_pack( __( 'Untitled', 'wpcf7' ), true ) );
241
+ } elseif ( array_key_exists( $_GET['contactform'], $contact_forms ) ) {
242
+ $current = (int) $_GET['contactform'];
243
+ $cf = wpcf7_contact_form( $contact_forms[$current] );
244
+ } else {
245
+ $current = (int) array_shift( array_keys( $contact_forms ) );
246
+ $cf = wpcf7_contact_form( $contact_forms[$current] );
247
+ }
248
+
249
+ require_once WPCF7_PLUGIN_DIR . '/admin/admin-panel.php';
250
+ }
251
+
252
+ function wpcf7_default_form_template() {
253
+ $template .= '<p>' . __( 'Your Name', 'wpcf7' ) . ' ' . __( '(required)', 'wpcf7' ) . '<br />' . "\n";
254
+ $template .= ' [text* your-name] </p>' . "\n\n";
255
+ $template .= '<p>' . __( 'Your Email', 'wpcf7' ) . ' ' . __( '(required)', 'wpcf7' ) . '<br />' . "\n";
256
+ $template .= ' [email* your-email] </p>' . "\n\n";
257
+ $template .= '<p>' . __( 'Subject', 'wpcf7' ) . '<br />' . "\n";
258
+ $template .= ' [text your-subject] </p>' . "\n\n";
259
+ $template .= '<p>' . __( 'Your Message', 'wpcf7' ) . '<br />' . "\n";
260
+ $template .= ' [textarea your-message] </p>' . "\n\n";
261
+ $template .= '<p>[submit "' . __( 'Send', 'wpcf7' ) . '"]</p>';
262
+ return $template;
263
+ }
264
+
265
+ function wpcf7_default_mail_template() {
266
+ $subject = '[your-subject]';
267
+ $sender = '[your-name] <[your-email]>';
268
+ $body = '[your-message]';
269
+ $recipient = get_option( 'admin_email' );
270
+ return compact( 'subject', 'sender', 'body', 'recipient' );
271
+ }
272
+
273
+ function wpcf7_default_mail_2_template() {
274
+ $active = false;
275
+ $subject = '[your-subject]';
276
+ $sender = '[your-name] <[your-email]>';
277
+ $body = '[your-message]';
278
+ $recipient = '[your-email]';
279
+ return compact( 'active', 'subject', 'sender', 'body', 'recipient' );
280
+ }
281
+
282
+ function wpcf7_default_messages_template() {
283
+ $mail_sent_ok = wpcf7_default_message( 'mail_sent_ok' );
284
+ $mail_sent_ng = wpcf7_default_message( 'mail_sent_ng' );
285
+ $akismet_says_spam = wpcf7_default_message( 'akismet_says_spam' );
286
+ $validation_error = wpcf7_default_message( 'validation_error' );
287
+ $accept_terms = wpcf7_default_message( 'accept_terms' );
288
+ $invalid_email = wpcf7_default_message( 'invalid_email' );
289
+ $invalid_required = wpcf7_default_message( 'invalid_required' );
290
+ $quiz_answer_not_correct = wpcf7_default_message( 'quiz_answer_not_correct' );
291
+ $captcha_not_match = wpcf7_default_message( 'captcha_not_match' );
292
+ $upload_failed = wpcf7_default_message( 'upload_failed' );
293
+ $upload_file_type_invalid = wpcf7_default_message( 'upload_file_type_invalid' );
294
+ $upload_file_too_large = wpcf7_default_message( 'upload_file_too_large' );
295
+
296
+ return compact( 'mail_sent_ok', 'mail_sent_ng', 'akismet_says_spam',
297
+ 'validation_error', 'accept_terms', 'invalid_email', 'invalid_required', 'quiz_answer_not_correct',
298
+ 'captcha_not_match', 'upload_failed', 'upload_file_type_invalid', 'upload_file_too_large' );
299
+ }
300
+
301
+ function wpcf7_default_options_template() {
302
+ $recipient = get_option( 'admin_email' ); // For backward compatibility.
303
+ return compact( 'recipient' );
304
+ }
305
+
306
+ function wpcf7_default_pack( $title, $initial = false ) {
307
+ $cf = array(
308
+ 'title' => $title,
309
+ 'form' => wpcf7_default_form_template(),
310
+ 'mail' => wpcf7_default_mail_template(),
311
+ 'mail_2' => wpcf7_default_mail_2_template(),
312
+ 'messages' => wpcf7_default_messages_template(),
313
+ 'options' => wpcf7_default_options_template()
314
+ );
315
+
316
+ if ( $initial )
317
+ $cf['initial'] = true;
318
+
319
+ return $cf;
320
+ }
321
+
322
+ function wpcf7_plugin_action_links( $links, $file ) {
323
+ if ( $file != WPCF7_PLUGIN_BASENAME )
324
+ return $links;
325
+
326
+ if ( function_exists( 'admin_url' ) ) {
327
+ $base_url = admin_url( wpcf7_admin_menu_parent() );
328
+ } else {
329
+ $base_url = get_option( 'siteurl' ) . '/wp-admin/' . wpcf7_admin_menu_parent();
330
+ }
331
+
332
+ $url = $base_url . '?page=' . plugin_basename( __FILE__ );
333
+
334
+ $settings_link = '<a href="' . $url . '">' . __('Settings') . '</a>';
335
+
336
+ array_unshift( $links, $settings_link );
337
+
338
+ return $links;
339
+ }
340
+
341
+ add_filter( 'plugin_action_links', 'wpcf7_plugin_action_links', 10, 2 );
342
+
343
+ function wpcf7_donation_link() {
344
+ if ( ! WPCF7_SHOW_DONATION_LINK )
345
+ return;
346
+
347
+ if ( 'new' == $_GET['contactform'] || ! empty($_GET['message']) )
348
+ return;
349
+
350
+ $num = mt_rand(0, 99);
351
+ if ($num >= 10) // 90%
352
+ return;
353
+
354
+ $texts = array(
355
+ __( "Contact Form 7 needs your support. Please donate today.", 'wpcf7' ),
356
+ __( "Is this plugin useful for you? If you like it, please help the developer.", 'wpcf7' ),
357
+ __( "Your contribution is needed for making this plugin better.", 'wpcf7' ),
358
+ __( "Developing a plugin and providing user support is really hard work. Please help.", 'wpcf7' ) );
359
+
360
+ $text = $texts[array_rand( $texts )];
361
+
362
+ ?>
363
+ <div class="donation">
364
+ <p><a href="http://www.pledgie.com/campaigns/3117">
365
+ <img alt="Click here to lend your support to: Support Contact Form 7 and make a donation at www.pledgie.com !" src="http://www.pledgie.com/campaigns/3117.png?skin_name=chrome" border="0" width="149" height="37" /></a>
366
+ <em><?php echo $text; ?></em>
367
+ </p>
368
+ </div>
369
+ <?php
370
+ }
371
+
372
+ ?>
admin/wpcf7-admin.js CHANGED
@@ -59,16 +59,34 @@ jQuery(document).ready(function() {
59
}
60
});
61
62
- jQuery('#message-fields-toggle-switch').text(_wpcf7.l10n.show);
63
jQuery('#message-fields').hide();
64
65
jQuery('#message-fields-toggle-switch').click(function() {
66
if (jQuery('#message-fields').is(':hidden')) {
67
jQuery('#message-fields').slideDown('fast');
68
- jQuery('#message-fields-toggle-switch').text(_wpcf7.l10n.hide);
69
} else {
70
jQuery('#message-fields').hide('fast');
71
- jQuery('#message-fields-toggle-switch').text(_wpcf7.l10n.show);
72
}
73
});
74
@@ -103,7 +121,7 @@ function tagGenerator() {
103
var dropdown_icon = jQuery('<img src="../wp-content/plugins/contact-form-7/images/dropdown.gif" />');
104
dropdown_icon.css({ 'vertical-align': 'bottom' });
105
106
- var selector = jQuery('<span>' + _wpcf7.l10n.generateTag + '</span>');
107
selector.append(dropdown_icon);
108
selector.css({
109
border: '1px solid #ddd',
@@ -147,7 +165,7 @@ function tagGenerator() {
147
'acceptance', 'quiz', 'captcha', 'fileUpload', 'submit'];
148
149
jQuery.each(tag_types, function(i, n) {
150
- var submenu = jQuery('<div>' + _wpcf7.l10n[n] + '</div>');
151
submenu.css({
152
margin: 0,
153
padding: '0 4px',
@@ -186,7 +204,7 @@ function tgPane(pane, tagType) {
186
closeButtonDiv.append(closeButton);
187
pane.append(closeButtonDiv);
188
189
- var paneTitle = jQuery('<div class="tg-panetitle">' + _wpcf7.l10n[tagType] + '</div>');
190
pane.append(paneTitle);
191
192
var tgInputs = {};
@@ -226,62 +244,62 @@ function tgPane(pane, tagType) {
226
var table1 = jQuery('<table></table>');
227
pane.append(table1);
228
table1.append(tgTr(
229
- jQuery('<span>&nbsp;' + _wpcf7.l10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
230
));
231
table1.append(tgTr(
232
- jQuery('<span>' + _wpcf7.l10n.tagName + '<br /></span>').append(tgInputs.tagName),
233
jQuery('<span></span>')
234
));
235
236
var table2 = jQuery('<table></table>');
237
pane.append(table2);
238
table2.append(tgTr(
239
- jQuery('<span><code>size</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagSize),
240
- jQuery('<span><code>maxlength</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagMaxLength)
241
));
242
table2.append(tgTr(
243
- jQuery('<span><code>id</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagId),
244
- jQuery('<span><code>class</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
245
));
246
- var akismetOpts = jQuery('<span>' + _wpcf7.l10n.akismet + ' (' + _wpcf7.l10n.optional + ')<br /></span>');
247
if ('textField' == tagType) {
248
- akismetOpts.append(tgInputs.akismetAuthor).append('&nbsp;' + _wpcf7.l10n.akismetAuthor);
249
akismetOpts.append('<br />');
250
- akismetOpts.append(tgInputs.akismetAuthorUrl).append('&nbsp;' + _wpcf7.l10n.akismetAuthorUrl);
251
} else if ('emailField' == tagType) {
252
- akismetOpts.append(tgInputs.akismetAuthorEmail).append('&nbsp;' + _wpcf7.l10n.akismetAuthorEmail);
253
}
254
table2.append(tgTr(
255
akismetOpts,
256
- jQuery('<span>' + _wpcf7.l10n.defaultValue + ' (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.defaultValue)
257
));
258
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7.l10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
259
break;
260
case 'textArea':
261
var table1 = jQuery('<table></table>');
262
pane.append(table1);
263
table1.append(tgTr(
264
- jQuery('<span>&nbsp;' + _wpcf7.l10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
265
));
266
table1.append(tgTr(
267
- jQuery('<span>' + _wpcf7.l10n.tagName + '<br /></span>').append(tgInputs.tagName),
268
jQuery('<span></span>')
269
));
270
271
var table2 = jQuery('<table></table>');
272
pane.append(table2);
273
table2.append(tgTr(
274
- jQuery('<span><code>cols</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagCols),
275
- jQuery('<span><code>rows</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagRows)
276
));
277
table2.append(tgTr(
278
- jQuery('<span><code>id</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagId),
279
- jQuery('<span><code>class</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
280
));
281
table2.append(tgTr(
282
- jQuery('<span>' + _wpcf7.l10n.defaultValue + ' (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.defaultValue)
283
));
284
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7.l10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
285
break;
286
case 'menu':
287
case 'checkboxes':
@@ -290,92 +308,92 @@ function tgPane(pane, tagType) {
290
pane.append(table1);
291
if ('radioButtons' != tagType)
292
table1.append(tgTr(
293
- jQuery('<span>&nbsp;' + _wpcf7.l10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
294
));
295
table1.append(tgTr(
296
- jQuery('<span>' + _wpcf7.l10n.tagName + '<br /></span>').append(tgInputs.tagName),
297
jQuery('<span></span>')
298
));
299
300
var table2 = jQuery('<table></table>');
301
pane.append(table2);
302
table2.append(tgTr(
303
- jQuery('<span><code>id</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagId),
304
- jQuery('<span><code>class</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
305
));
306
307
if ('menu' == tagType) {
308
- var menuOpt1 = jQuery('<span>&nbsp;' + _wpcf7.l10n.allowsMultipleSelections + '</span>').prepend(tgInputs.allowsMultipleSelections).prepend('<br />');
309
- var menuOpt2 = jQuery('<span>&nbsp;' + _wpcf7.l10n.insertFirstBlankOption + '</span>').prepend(tgInputs.insertFirstBlankOption).prepend('<br />');
310
311
table2.append(tgTr(
312
- jQuery('<span>' + _wpcf7.l10n.menuChoices + '<br /></span>').append(tgInputs.menuChoices)
313
- .append('<br /><span style="font-size: smaller">' + _wpcf7.l10n.oneChoicePerLine + '</span>'),
314
menuOpt1.append(menuOpt2)
315
));
316
} else if ('checkboxes' == tagType) {
317
table2.append(tgTr(
318
- jQuery('<span>' + _wpcf7.l10n.menuChoices + '<br /></span>').append(tgInputs.menuChoices)
319
- .append('<br /><span style="font-size: smaller">' + _wpcf7.l10n.oneChoicePerLine + '</span>'),
320
- jQuery('<span>&nbsp;' + _wpcf7.l10n.makeCheckboxesExclusive + '</span>').prepend(tgInputs.makeCheckboxesExclusive).prepend('<br />')
321
));
322
} else {
323
table2.append(tgTr(
324
- jQuery('<span>' + _wpcf7.l10n.menuChoices + '<br /></span>').append(tgInputs.menuChoices)
325
- .append('<br /><span style="font-size: smaller">' + _wpcf7.l10n.oneChoicePerLine + '</span>')
326
));
327
}
328
329
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7.l10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
330
break;
331
case 'acceptance':
332
var table1 = jQuery('<table></table>');
333
pane.append(table1);
334
335
table1.append(tgTr(
336
- jQuery('<span>' + _wpcf7.l10n.tagName + '<br /></span>').append(tgInputs.tagName),
337
jQuery('<span></span>')
338
));
339
340
var table2 = jQuery('<table></table>');
341
pane.append(table2);
342
table2.append(tgTr(
343
- jQuery('<span><code>id</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagId),
344
- jQuery('<span><code>class</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
345
));
346
347
- var menuOpt1 = jQuery('<span>&nbsp;' + _wpcf7.l10n.isAcceptanceDefaultOn + '</span>').prepend(tgInputs.isAcceptanceDefaultOn).prepend('<br />');
348
- var menuOpt2 = jQuery('<span>&nbsp;' + _wpcf7.l10n.isAcceptanceInvert + '</span>').prepend(tgInputs.isAcceptanceInvert).prepend('<br />');
349
- menuOpt2.append('<br /><span style="font-size: smaller;">' + _wpcf7.l10n.isAcceptanceInvertMeans + '</span>');
350
351
table2.append(jQuery('<tr></tr>').append(jQuery('<td colspan="2"></td>').append(menuOpt1).append(menuOpt2)));
352
353
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7.l10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
354
break;
355
case 'quiz':
356
var table1 = jQuery('<table></table>');
357
pane.append(table1);
358
359
table1.append(tgTr(
360
- jQuery('<span>' + _wpcf7.l10n.tagName + '<br /></span>').append(tgInputs.tagName),
361
jQuery('<span></span>')
362
));
363
364
var table2 = jQuery('<table></table>');
365
pane.append(table2);
366
table2.append(tgTr(
367
- jQuery('<span><code>size</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagSize),
368
- jQuery('<span><code>maxlength</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagMaxLength)
369
));
370
table2.append(tgTr(
371
- jQuery('<span><code>id</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagId),
372
- jQuery('<span><code>class</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
373
));
374
table2.append(tgTr(
375
- jQuery('<span>' + _wpcf7.l10n.quizzes + '<br /></span>').append(tgInputs.menuChoices)
376
- .append('<br /><span style="font-size: smaller">' + _wpcf7.l10n.quizFormatDesc + '</span>')
377
));
378
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7.l10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
379
break;
380
case 'captcha':
381
var table1 = jQuery('<table></table>');
@@ -383,51 +401,51 @@ function tgPane(pane, tagType) {
383
384
if (! _wpcf7.captchaMod) {
385
table1.append('<tr><td colspan="2"><strong style="color: #e6255b">' +
386
- _wpcf7.l10n.needReallySimpleCaptcha + '</strong><br />' +
387
'<a href="http://wordpress.org/extend/plugins/really-simple-captcha/">' +
388
'http://wordpress.org/extend/plugins/really-simple-captcha/</a></td></tr>');
389
}
390
391
table1.append(tgTr(
392
- jQuery('<span>' + _wpcf7.l10n.tagName + '<br /></span>').append(tgInputs.tagName),
393
jQuery('<span></span>')
394
));
395
396
var table2 = jQuery('<table></table>');
397
pane.append(table2);
398
- table2.append('<caption>' + _wpcf7.l10n.imageSettings + '</caption>');
399
- var imageSizeOpts = jQuery('<span>' + _wpcf7.l10n.imageSize + ' (' + _wpcf7.l10n.optional + ')<br /></span>');
400
- imageSizeOpts.append(tgInputs.imageSizeSmall).append('&nbsp;' + _wpcf7.l10n.imageSizeSmall);
401
imageSizeOpts.append('&emsp;');
402
- imageSizeOpts.append(tgInputs.imageSizeMedium).append('&nbsp;' + _wpcf7.l10n.imageSizeMedium);
403
imageSizeOpts.append('&emsp;');
404
- imageSizeOpts.append(tgInputs.imageSizeLarge).append('&nbsp;' + _wpcf7.l10n.imageSizeLarge);
405
table2.append(jQuery('<tr></tr>').append(jQuery('<td colspan="2"></td>').append(imageSizeOpts)));
406
table2.append(tgTr(
407
- jQuery('<span>' + _wpcf7.l10n.fgColor + ' (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.fgColor),
408
- jQuery('<span>' + _wpcf7.l10n.bgColor + ' (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.bgColor)
409
));
410
table2.append(tgTr(
411
- jQuery('<span><code>id</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagId),
412
- jQuery('<span><code>class</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
413
));
414
415
var table3 = jQuery('<table></table>');
416
pane.append(table3);
417
- table3.append('<caption>' + _wpcf7.l10n.inputFieldSettings + '</caption>');
418
table3.append(tgTr(
419
- jQuery('<span><code>size</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagSize),
420
- jQuery('<span><code>maxlength</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagMaxLength)
421
));
422
table3.append(tgTr(
423
- jQuery('<span><code>id</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagId2),
424
- jQuery('<span><code>class</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagClasses2)
425
));
426
pane.append(
427
- jQuery('<div class="tg-tag">' + _wpcf7.l10n.generatedTag + '</div>')
428
- .append('<br />').append('1) ' + _wpcf7.l10n.tagForImage)
429
.append(tgInputs.tag1st)
430
- .append('<br />').append('2) ' + _wpcf7.l10n.tagForInputField)
431
.append(tgInputs.tag2nd)
432
);
433
break;
@@ -435,39 +453,39 @@ function tgPane(pane, tagType) {
435
var table1 = jQuery('<table></table>');
436
pane.append(table1);
437
table1.append(tgTr(
438
- jQuery('<span>&nbsp;' + _wpcf7.l10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
439
));
440
table1.append(tgTr(
441
- jQuery('<span>' + _wpcf7.l10n.tagName + '<br /></span>').append(tgInputs.tagName),
442
jQuery('<span></span>')
443
));
444
445
var table2 = jQuery('<table></table>');
446
pane.append(table2);
447
table2.append(tgTr(
448
- jQuery('<span>' + _wpcf7.l10n.fileSizeLimit + ' (' + _wpcf7.l10n.bytes + ') (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagFileSizeLimit),
449
- jQuery('<span>' + _wpcf7.l10n.acceptableFileTypes + ' (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagAcceptableFileTypes)
450
));
451
table2.append(tgTr(
452
- jQuery('<span><code>id</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagId),
453
- jQuery('<span><code>class</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
454
));
455
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7.l10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
456
break;
457
case 'submit':
458
var table = jQuery('<table></table>');
459
pane.append(table);
460
461
table.append(tgTr(
462
- jQuery('<span><code>id</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagId),
463
- jQuery('<span><code>class</code> (' + _wpcf7.l10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
464
));
465
466
table.append(tgTr(
467
- jQuery('<span>' + _wpcf7.l10n.label + '<br /></span>').append(tgInputs.label),
468
jQuery('<span></span>')
469
));
470
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7.l10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
471
break;
472
}
473
@@ -495,7 +513,7 @@ function tgCreateTag(tagType, tgInputs, trigger) {
495
tgInputs[n].val(val);
496
});
497
498
- jQuery.each([ 'tagSize', 'tagMaxLength', 'tagCols', 'tagRows', 'tagFileSizeLimit' ], function(i, n) {
499
var val = tgInputs[n].val();
500
val = val.replace(/[^0-9]/g, '');
501
tgInputs[n].val(val);
@@ -522,6 +540,12 @@ function tgCreateTag(tagType, tgInputs, trigger) {
522
tgInputs[n].val(val);
523
});
524
525
jQuery.each([ 'tagAcceptableFileTypes' ], function(i, n) {
526
var val = tgInputs[n].val();
527
val = val.replace(/[^0-9a-zA-Z.\s]/g, '');
59
}
60
});
61
62
+ jQuery('#message-fields-toggle-switch').text(_wpcf7L10n.show);
63
jQuery('#message-fields').hide();
64
65
jQuery('#message-fields-toggle-switch').click(function() {
66
if (jQuery('#message-fields').is(':hidden')) {
67
jQuery('#message-fields').slideDown('fast');
68
+ jQuery('#message-fields-toggle-switch').text(_wpcf7L10n.hide);
69
} else {
70
jQuery('#message-fields').hide('fast');
71
+ jQuery('#message-fields-toggle-switch').text(_wpcf7L10n.show);
72
+ }
73
+ });
74
+
75
+ if ('' == jQuery.trim(jQuery('#wpcf7-additional-settings').text())) {
76
+ jQuery('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.show);
77
+ jQuery('#additional-settings-fields').hide();
78
+ } else {
79
+ jQuery('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.hide);
80
+ jQuery('#additional-settings-fields').show();
81
+ }
82
+
83
+ jQuery('#additional-settings-fields-toggle-switch').click(function() {
84
+ if (jQuery('#additional-settings-fields').is(':hidden')) {
85
+ jQuery('#additional-settings-fields').slideDown('fast');
86
+ jQuery('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.hide);
87
+ } else {
88
+ jQuery('#additional-settings-fields').hide('fast');
89
+ jQuery('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.show);
90
}
91
});
92
121
var dropdown_icon = jQuery('<img src="../wp-content/plugins/contact-form-7/images/dropdown.gif" />');
122
dropdown_icon.css({ 'vertical-align': 'bottom' });
123
124
+ var selector = jQuery('<span>' + _wpcf7L10n.generateTag + '</span>');
125
selector.append(dropdown_icon);
126
selector.css({
127
border: '1px solid #ddd',
165
'acceptance', 'quiz', 'captcha', 'fileUpload', 'submit'];
166
167
jQuery.each(tag_types, function(i, n) {
168
+ var submenu = jQuery('<div>' + _wpcf7L10n[n] + '</div>');
169
submenu.css({
170
margin: 0,
171
padding: '0 4px',
204
closeButtonDiv.append(closeButton);
205
pane.append(closeButtonDiv);
206
207
+ var paneTitle = jQuery('<div class="tg-panetitle">' + _wpcf7L10n[tagType] + '</div>');
208
pane.append(paneTitle);
209
210
var tgInputs = {};
244
var table1 = jQuery('<table></table>');
245
pane.append(table1);
246
table1.append(tgTr(
247
+ jQuery('<span>&nbsp;' + _wpcf7L10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
248
));
249
table1.append(tgTr(
250
+ jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
251
jQuery('<span></span>')
252
));
253
254
var table2 = jQuery('<table></table>');
255
pane.append(table2);
256
table2.append(tgTr(
257
+ jQuery('<span><code>size</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagSize),
258
+ jQuery('<span><code>maxlength</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagMaxLength)
259
));
260
table2.append(tgTr(
261
+ jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
262
+ jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
263
));
264
+ var akismetOpts = jQuery('<span>' + _wpcf7L10n.akismet + ' (' + _wpcf7L10n.optional + ')<br /></span>');
265
if ('textField' == tagType) {
266
+ akismetOpts.append(tgInputs.akismetAuthor).append('&nbsp;' + _wpcf7L10n.akismetAuthor);
267
akismetOpts.append('<br />');
268
+ akismetOpts.append(tgInputs.akismetAuthorUrl).append('&nbsp;' + _wpcf7L10n.akismetAuthorUrl);
269
} else if ('emailField' == tagType) {
270
+ akismetOpts.append(tgInputs.akismetAuthorEmail).append('&nbsp;' + _wpcf7L10n.akismetAuthorEmail);
271
}
272
table2.append(tgTr(
273
akismetOpts,
274
+ jQuery('<span>' + _wpcf7L10n.defaultValue + ' (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.defaultValue)
275
));
276
+ pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
277
break;
278
case 'textArea':
279
var table1 = jQuery('<table></table>');
280
pane.append(table1);
281
table1.append(tgTr(
282
+ jQuery('<span>&nbsp;' + _wpcf7L10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
283
));
284
table1.append(tgTr(
285
+ jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
286
jQuery('<span></span>')
287
));
288
289
var table2 = jQuery('<table></table>');
290
pane.append(table2);
291
table2.append(tgTr(
292
+ jQuery('<span><code>cols</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagCols),
293
+ jQuery('<span><code>rows</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagRows)
294
));
295
table2.append(tgTr(
296
+ jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
297
+ jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
298
));
299
table2.append(tgTr(
300
+ jQuery('<span>' + _wpcf7L10n.defaultValue + ' (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.defaultValue)
301
));
302
+ pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
303
break;
304
case 'menu':
305
case 'checkboxes':
308
pane.append(table1);
309
if ('radioButtons' != tagType)
310
table1.append(tgTr(
311
+ jQuery('<span>&nbsp;' + _wpcf7L10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
312
));
313
table1.append(tgTr(
314
+ jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
315
jQuery('<span></span>')
316
));
317
318
var table2 = jQuery('<table></table>');
319
pane.append(table2);
320
table2.append(tgTr(
321
+ jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
322
+ jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
323
));
324
325
if ('menu' == tagType) {
326
+ var menuOpt1 = jQuery('<span>&nbsp;' + _wpcf7L10n.allowsMultipleSelections + '</span>').prepend(tgInputs.allowsMultipleSelections).prepend('<br />');
327
+ var menuOpt2 = jQuery('<span>&nbsp;' + _wpcf7L10n.insertFirstBlankOption + '</span>').prepend(tgInputs.insertFirstBlankOption).prepend('<br />');
328
329
table2.append(tgTr(
330
+ jQuery('<span>' + _wpcf7L10n.menuChoices + '<br /></span>').append(tgInputs.menuChoices)
331
+ .append('<br /><span style="font-size: smaller">' + _wpcf7L10n.oneChoicePerLine + '</span>'),
332
menuOpt1.append(menuOpt2)
333
));
334
} else if ('checkboxes' == tagType) {
335
table2.append(tgTr(
336
+ jQuery('<span>' + _wpcf7L10n.menuChoices + '<br /></span>').append(tgInputs.menuChoices)
337
+ .append('<br /><span style="font-size: smaller">' + _wpcf7L10n.oneChoicePerLine + '</span>'),
338
+ jQuery('<span>&nbsp;' + _wpcf7L10n.makeCheckboxesExclusive + '</span>').prepend(tgInputs.makeCheckboxesExclusive).prepend('<br />')
339
));
340
} else {
341
table2.append(tgTr(
342
+ jQuery('<span>' + _wpcf7L10n.menuChoices + '<br /></span>').append(tgInputs.menuChoices)
343
+ .append('<br /><span style="font-size: smaller">' + _wpcf7L10n.oneChoicePerLine + '</span>')
344
));
345
}
346
347
+ pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
348
break;
349
case 'acceptance':
350
var table1 = jQuery('<table></table>');
351
pane.append(table1);
352
353
table1.append(tgTr(
354
+ jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
355
jQuery('<span></span>')
356
));
357
358
var table2 = jQuery('<table></table>');
359
pane.append(table2);
360
table2.append(tgTr(
361
+ jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
362
+ jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
363
));
364
365
+ var menuOpt1 = jQuery('<span>&nbsp;' + _wpcf7L10n.isAcceptanceDefaultOn + '</span>').prepend(tgInputs.isAcceptanceDefaultOn).prepend('<br />');
366
+ var menuOpt2 = jQuery('<span>&nbsp;' + _wpcf7L10n.isAcceptanceInvert + '</span>').prepend(tgInputs.isAcceptanceInvert).prepend('<br />');
367
+ menuOpt2.append('<br /><span style="font-size: smaller;">' + _wpcf7L10n.isAcceptanceInvertMeans + '</span>');
368
369
table2.append(jQuery('<tr></tr>').append(jQuery('<td colspan="2"></td>').append(menuOpt1).append(menuOpt2)));
370
371
+ pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
372
break;
373
case 'quiz':
374
var table1 = jQuery('<table></table>');
375
pane.append(table1);
376
377
table1.append(tgTr(
378
+ jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
379
jQuery('<span></span>')
380
));
381
382
var table2 = jQuery('<table></table>');
383
pane.append(table2);
384
table2.append(tgTr(
385
+ jQuery('<span><code>size</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagSize),
386
+ jQuery('<span><code>maxlength</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagMaxLength)
387
));
388
table2.append(tgTr(
389
+ jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
390
+ jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
391
));
392
table2.append(tgTr(
393
+ jQuery('<span>' + _wpcf7L10n.quizzes + '<br /></span>').append(tgInputs.menuChoices)
394
+ .append('<br /><span style="font-size: smaller">' + _wpcf7L10n.quizFormatDesc + '</span>')
395
));
396
+ pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
397
break;
398
case 'captcha':
399
var table1 = jQuery('<table></table>');
401
402
if (! _wpcf7.captchaMod) {
403
table1.append('<tr><td colspan="2"><strong style="color: #e6255b">' +
404
+ _wpcf7L10n.needReallySimpleCaptcha + '</strong><br />' +
405
'<a href="http://wordpress.org/extend/plugins/really-simple-captcha/">' +
406
'http://wordpress.org/extend/plugins/really-simple-captcha/</a></td></tr>');
407
}
408
409
table1.append(tgTr(
410
+ jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
411
jQuery('<span></span>')
412
));
413
414
var table2 = jQuery('<table></table>');
415
pane.append(table2);
416
+ table2.append('<caption>' + _wpcf7L10n.imageSettings + '</caption>');
417
+ var imageSizeOpts = jQuery('<span>' + _wpcf7L10n.imageSize + ' (' + _wpcf7L10n.optional + ')<br /></span>');
418
+ imageSizeOpts.append(tgInputs.imageSizeSmall).append('&nbsp;' + _wpcf7L10n.imageSizeSmall);
419
imageSizeOpts.append('&emsp;');
420
+ imageSizeOpts.append(tgInputs.imageSizeMedium).append('&nbsp;' + _wpcf7L10n.imageSizeMedium);
421
imageSizeOpts.append('&emsp;');
422
+ imageSizeOpts.append(tgInputs.imageSizeLarge).append('&nbsp;' + _wpcf7L10n.imageSizeLarge);
423
table2.append(jQuery('<tr></tr>').append(jQuery('<td colspan="2"></td>').append(imageSizeOpts)));
424
table2.append(tgTr(
425
+ jQuery('<span>' + _wpcf7L10n.fgColor + ' (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.fgColor),
426
+ jQuery('<span>' + _wpcf7L10n.bgColor + ' (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.bgColor)
427
));
428
table2.append(tgTr(
429
+ jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
430
+ jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
431
));
432
433
var table3 = jQuery('<table></table>');
434
pane.append(table3);
435
+ table3.append('<caption>' + _wpcf7L10n.inputFieldSettings + '</caption>');
436
table3.append(tgTr(
437
+ jQuery('<span><code>size</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagSize),
438
+ jQuery('<span><code>maxlength</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagMaxLength)
439
));
440
table3.append(tgTr(
441
+ jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId2),
442
+ jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses2)
443
));
444
pane.append(
445
+ jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '</div>')
446
+ .append('<br />').append('1) ' + _wpcf7L10n.tagForImage)
447
.append(tgInputs.tag1st)
448
+ .append('<br />').append('2) ' + _wpcf7L10n.tagForInputField)
449
.append(tgInputs.tag2nd)
450
);
451
break;
453
var table1 = jQuery('<table></table>');
454
pane.append(table1);
455
table1.append(tgTr(
456
+ jQuery('<span>&nbsp;' + _wpcf7L10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
457
));
458
table1.append(tgTr(
459
+ jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
460
jQuery('<span></span>')
461
));
462
463
var table2 = jQuery('<table></table>');
464
pane.append(table2);
465
table2.append(tgTr(
466
+ jQuery('<span>' + _wpcf7L10n.fileSizeLimit + ' (' + _wpcf7L10n.bytes + ') (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagFileSizeLimit),
467
+ jQuery('<span>' + _wpcf7L10n.acceptableFileTypes + ' (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagAcceptableFileTypes)
468
));
469
table2.append(tgTr(
470
+ jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
471
+ jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
472
));
473
+ pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
474
break;
475
case 'submit':
476
var table = jQuery('<table></table>');
477
pane.append(table);
478
479
table.append(tgTr(
480
+ jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
481
+ jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
482
));
483
484
table.append(tgTr(
485
+ jQuery('<span>' + _wpcf7L10n.label + '<br /></span>').append(tgInputs.label),
486
jQuery('<span></span>')
487
));
488
+ pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
489
break;
490
}
491
513
tgInputs[n].val(val);
514
});
515
516
+ jQuery.each([ 'tagSize', 'tagMaxLength', 'tagCols', 'tagRows' ], function(i, n) {
517
var val = tgInputs[n].val();
518
val = val.replace(/[^0-9]/g, '');
519
tgInputs[n].val(val);
540
tgInputs[n].val(val);
541
});
542
543
+ jQuery.each([ 'tagFileSizeLimit' ], function(i, n) {
544
+ var val = tgInputs[n].val();
545
+ val = val.replace(/[^0-9kKmMbB]/g, '');
546
+ tgInputs[n].val(val);
547
+ });
548
+
549
jQuery.each([ 'tagAcceptableFileTypes' ], function(i, n) {
550
var val = tgInputs[n].val();
551
val = val.replace(/[^0-9a-zA-Z.\s]/g, '');
contact-form-7.js CHANGED
@@ -90,6 +90,9 @@ function wpcf7ProcessJson(data) {
90
if (1 == data.mailSent) {
91
jQuery(data.into).find('form').resetForm().clearForm();
92
wpcf7ResponseOutput.addClass('wpcf7-mail-sent-ok');
93
} else {
94
wpcf7ResponseOutput.addClass('wpcf7-mail-sent-ng');
95
}
90
if (1 == data.mailSent) {
91
jQuery(data.into).find('form').resetForm().clearForm();
92
wpcf7ResponseOutput.addClass('wpcf7-mail-sent-ok');
93
+
94
+ if (data.onSentOk)
95
+ jQuery.each(data.onSentOk, function(i, n) { eval(n) });
96
} else {
97
wpcf7ResponseOutput.addClass('wpcf7-mail-sent-ng');
98
}
includes/acceptance.php ADDED
@@ -0,0 +1,21 @@
1
+ <?php
2
+
3
+ function wpcf7_acceptance( $contact_form ) {
4
+ $fes = $contact_form->form_elements( false );
5
+
6
+ $accepted = true;
7
+
8
+ foreach ( $fes as $fe ) {
9
+ if ( 'acceptance' != $fe['type'] )
10
+ continue;
11
+
12
+ $invert = (bool) preg_grep( '%^invert$%', $fe['options'] );
13
+
14
+ if ( $invert && $_POST[$fe['name']] || ! $invert && ! $_POST[$fe['name']] )
15
+ $accepted = false;
16
+ }
17
+
18
+ return $accepted;
19
+ }
20
+
21
+ ?>
includes/akismet.php ADDED
@@ -0,0 +1,73 @@
1
+ <?php
2
+
3
+ function wpcf7_akismet( $contact_form ) {
4
+ global $akismet_api_host, $akismet_api_port;
5
+
6
+ if ( ! function_exists( 'akismet_http_post' ) || ! ( get_option( 'wordpress_api_key' ) || $wpcom_api_key ) )
7
+ return false;
8
+
9
+ $akismet_ready = false;
10
+ $author = $author_email = $author_url = $content = '';
11
+ $fes = $contact_form->form_elements( false );
12
+
13
+ foreach ( $fes as $fe ) {
14
+ if ( ! is_array( $fe['options'] ) ) continue;
15
+
16
+ if ( preg_grep( '%^akismet:author$%', $fe['options'] ) && '' == $author ) {
17
+ $author = $_POST[$fe['name']];
18
+ $akismet_ready = true;
19
+ }
20
+
21
+ if ( preg_grep( '%^akismet:author_email$%', $fe['options'] ) && '' == $author_email ) {
22
+ $author_email = $_POST[$fe['name']];
23
+ $akismet_ready = true;
24
+ }
25
+
26
+ if ( preg_grep( '%^akismet:author_url$%', $fe['options'] ) && '' == $author_url ) {
27
+ $author_url = $_POST[$fe['name']];
28
+ $akismet_ready = true;
29
+ }
30
+
31
+ if ( '' != $content )
32
+ $content .= "\n\n";
33
+
34
+ $content .= $_POST[$fe['name']];
35
+ }
36
+
37
+ if ( ! $akismet_ready )
38
+ return false;
39
+
40
+ $c['blog'] = get_option( 'home' );
41
+ $c['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
42
+ $c['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
43
+ $c['referrer'] = $_SERVER['HTTP_REFERER'];
44
+ $c['comment_type'] = 'contactform7';
45
+ if ( $permalink = get_permalink() )
46
+ $c['permalink'] = $permalink;
47
+ if ( '' != $author )
48
+ $c['comment_author'] = $author;
49
+ if ( '' != $author_email )
50
+ $c['comment_author_email'] = $author_email;
51
+ if ( '' != $author_url )
52
+ $c['comment_author_url'] = $author_url;
53
+ if ( '' != $content )
54
+ $c['comment_content'] = $content;
55
+
56
+ $ignore = array( 'HTTP_COOKIE' );
57
+
58
+ foreach ( $_SERVER as $key => $value )
59
+ if ( ! in_array( $key, (array) $ignore ) )
60
+ $c["$key"] = $value;
61
+
62
+ $query_string = '';
63
+ foreach ( $c as $key => $data )
64
+ $query_string .= $key . '=' . urlencode( stripslashes( $data ) ) . '&';
65
+
66
+ $response = akismet_http_post( $query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port );
67
+ if ( 'true' == $response[1] )
68
+ return true;
69
+ else
70
+ return false;
71
+ }
72
+
73
+ ?>
includes/captcha.php ADDED
@@ -0,0 +1,190 @@
1
+ <?php
2
+
3
+ $wpcf7_captcha = null;
4
+
5
+ function wpcf7_init_captcha() {
6
+ global $wpcf7_captcha;
7
+
8
+ if ( ! class_exists( 'ReallySimpleCaptcha' ) )
9
+ return false;
10
+
11
+ if ( ! is_object( $wpcf7_captcha ) )
12
+ $wpcf7_captcha = new ReallySimpleCaptcha();
13
+ $captcha =& $wpcf7_captcha;
14
+
15
+ $captcha->tmp_dir = trailingslashit( wpcf7_captcha_tmp_dir() );
16
+ wp_mkdir_p( $captcha->tmp_dir );
17
+ return true;
18
+ }
19
+
20
+ function wpcf7_generate_captcha( $options = null ) {
21
+ global $wpcf7_captcha;
22
+
23
+ if ( ! wpcf7_init_captcha() )
24
+ return false;
25
+ $captcha =& $wpcf7_captcha;
26
+
27
+ if ( ! is_dir( $captcha->tmp_dir ) || ! is_writable( $captcha->tmp_dir ) )
28
+ return false;
29
+
30
+ $img_type = imagetypes();
31
+ if ( $img_type & IMG_PNG )
32
+ $captcha->img_type = 'png';
33
+ elseif ( $img_type & IMG_GIF )
34
+ $captcha->img_type = 'gif';
35
+ elseif ( $img_type & IMG_JPG )
36
+ $captcha->img_type = 'jpeg';
37
+ else
38
+ return false;
39
+
40
+ if ( is_array( $options ) ) {
41
+ if ( isset( $options['img_size'] ) )
42
+ $captcha->img_size = $options['img_size'];
43
+ if ( isset( $options['base'] ) )
44
+ $captcha->base = $options['base'];
45
+ if ( isset( $options['font_size'] ) )
46
+ $captcha->font_size = $options['font_size'];
47
+ if ( isset( $options['font_char_width'] ) )
48
+ $captcha->font_char_width = $options['font_char_width'];
49
+ if ( isset( $options['fg'] ) )
50
+ $captcha->fg = $options['fg'];
51
+ if ( isset( $options['bg'] ) )
52
+ $captcha->bg = $options['bg'];
53
+ }
54
+
55
+ $prefix = mt_rand();
56
+ $captcha_word = $captcha->generate_random_word();
57
+ return $captcha->generate_image( $prefix, $captcha_word );
58
+ }
59
+
60
+ function wpcf7_check_captcha( $prefix, $response ) {
61
+ global $wpcf7_captcha;
62
+
63
+ if ( ! wpcf7_init_captcha() )
64
+ return false;
65
+ $captcha =& $wpcf7_captcha;
66
+
67
+ return $captcha->check( $prefix, $response );
68
+ }
69
+
70
+ function wpcf7_remove_captcha( $prefix ) {
71
+ global $wpcf7_captcha;
72
+
73
+ if ( ! wpcf7_init_captcha() )
74
+ return false;
75
+ $captcha =& $wpcf7_captcha;
76
+
77
+ $captcha->remove( $prefix );
78
+ }
79
+
80
+ function wpcf7_cleanup_captcha_files() {
81
+ $dir = trailingslashit( wpcf7_captcha_tmp_dir() );
82
+
83
+ if ( ! is_dir( $dir ) )
84
+ return false;
85
+ if ( ! is_readable( $dir ) )
86
+ return false;
87
+ if ( ! is_writable( $dir ) )
88
+ return false;
89
+
90
+ if ( $handle = @opendir( $dir ) ) {
91
+ while ( false !== ( $file = readdir( $handle ) ) ) {
92
+ if ( ! preg_match( '/^[0-9]+\.(php|png|gif|jpeg)#x2F;', $file ) )
93
+ continue;
94
+
95
+ $stat = stat( $dir . $file );
96
+ if ( $stat['mtime'] + 21600 < time() ) // 21600 secs == 6 hours
97
+ @unlink( $dir . $file );
98
+ }
99
+ closedir( $handle );
100
+ }
101
+ }
102
+
103
+ function wpcf7_captchac_options( $options ) {
104
+ if ( ! is_array( $options ) )
105
+ return array();
106
+
107
+ $op = array();
108
+ $image_size_array = preg_grep( '%^size:[smlSML]$%', $options );
109
+
110
+ if ( $image_size = array_shift( $image_size_array ) ) {
111
+ preg_match( '%^size:([smlSML])$%', $image_size, $is_matches );
112
+ switch ( strtolower( $is_matches[1] ) ) {
113
+ case 's':
114
+ $op['img_size'] = array( 60, 20 );
115
+ $op['base'] = array( 6, 15 );
116
+ $op['font_size'] = 11;
117
+ $op['font_char_width'] = 13;
118
+ break;
119
+ case 'l':
120
+ $op['img_size'] = array( 84, 28 );
121
+ $op['base'] = array( 6, 20 );
122
+ $op['font_size'] = 17;
123
+ $op['font_char_width'] = 19;
124
+ break;
125
+ case 'm':
126
+ default:
127
+ $op['img_size'] = array( 72, 24 );
128
+ $op['base'] = array( 6, 18 );
129
+ $op['font_size'] = 14;
130
+ $op['font_char_width'] = 15;
131
+ }
132
+ }
133
+
134
+ $fg_color_array = preg_grep( '%^fg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $options );
135
+ if ( $fg_color = array_shift( $fg_color_array ) ) {
136
+ preg_match( '%^fg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $fg_color, $fc_matches );
137
+ if ( 3 == strlen( $fc_matches[1] ) ) {
138
+ $r = substr( $fc_matches[1], 0, 1 );
139
+ $g = substr( $fc_matches[1], 1, 1 );
140
+ $b = substr( $fc_matches[1], 2, 1 );
141
+ $op['fg'] = array( hexdec( $r . $r ), hexdec( $g . $g ), hexdec( $b . $b ) );
142
+ } elseif ( 6 == strlen( $fc_matches[1] ) ) {
143
+ $r = substr( $fc_matches[1], 0, 2 );
144
+ $g = substr( $fc_matches[1], 2, 2 );
145
+ $b = substr( $fc_matches[1], 4, 2 );
146
+ $op['fg'] = array( hexdec( $r ), hexdec( $g ), hexdec( $b ) );
147
+ }
148
+ }
149
+
150
+ $bg_color_array = preg_grep( '%^bg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $options );
151
+ if ( $bg_color = array_shift( $bg_color_array ) ) {
152
+ preg_match( '%^bg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $bg_color, $bc_matches );
153
+ if ( 3 == strlen( $bc_matches[1] ) ) {
154
+ $r = substr( $bc_matches[1], 0, 1 );
155
+ $g = substr( $bc_matches[1], 1, 1 );
156
+ $b = substr( $bc_matches[1], 2, 1 );
157
+ $op['bg'] = array( hexdec( $r . $r ), hexdec( $g . $g ), hexdec( $b . $b ) );
158
+ } elseif ( 6 == strlen( $bc_matches[1] ) ) {
159
+ $r = substr( $bc_matches[1], 0, 2 );
160
+ $g = substr( $bc_matches[1], 2, 2 );
161
+ $b = substr( $bc_matches[1], 4, 2 );
162
+ $op['bg'] = array( hexdec( $r ), hexdec( $g ), hexdec( $b ) );
163
+ }
164
+ }
165
+
166
+ return $op;
167
+ }
168
+
169
+ function wpcf7_refill_captcha( $contact_form ) {
170
+ $fes = $contact_form->form_elements( false );
171
+ $refill = array();
172
+
173
+ foreach ( $fes as $fe ) {
174
+ $type = $fe['type'];
175
+ $name = $fe['name'];
176
+ $options = $fe['options'];
177
+
178
+ if ( 'captchac' == $type ) {
179
+ $op = wpcf7_captchac_options( $options );
180
+ if ( $filename = wpcf7_generate_captcha( $op ) ) {
181
+ $captcha_url = trailingslashit( wpcf7_captcha_tmp_url() ) . $filename;
182
+ $refill[$name] = $captcha_url;
183
+ }
184
+ }
185
+ }
186
+
187
+ return $refill;
188
+ }
189
+
190
+ ?>
includes/classes.php ADDED
@@ -0,0 +1,592 @@
1
+ <?php
2
+
3
+ class WPCF7_ContactForm {
4
+
5
+ var $id;
6
+
7
+ var $title;
8
+ var $form;
9
+ var $mail;
10
+ var $mail_2;
11
+ var $messages;
12
+ var $additional_settings;
13
+ var $options;
14
+
15
+ var $unit_tag;
16
+
17
+ var $responses_count = 0;
18
+
19
+ // Return true if this form is the same one as currently POSTed.
20
+ function is_posted() {
21
+ if ( ! isset( $_POST['_wpcf7_unit_tag'] ) || empty( $_POST['_wpcf7_unit_tag'] ) )
22
+ return false;
23
+
24
+ if ( $this->unit_tag == $_POST['_wpcf7_unit_tag'] )
25
+ return true;
26
+
27
+ return false;
28
+ }
29
+
30
+ /* Generating Form HTML */
31
+
32
+ function form_html() {
33
+ $form = '<div class="wpcf7" id="' . $this->unit_tag . '">';
34
+
35
+ $url = parse_url( $_SERVER['REQUEST_URI'] );
36
+ $url = $url['path'] . ( empty( $url['query'] ) ? '' : '?' . $url['query'] ) . '#' . $this->unit_tag;
37
+
38
+ $form_elements = $this->form_elements( false );
39
+ $multipart = false;
40
+
41
+ foreach ( $form_elements as $form_element ) {
42
+ if ( preg_match( '/^file[*]?#x2F;', $form_element['type'] ) ) {
43
+ $multipart = true;
44
+ break;
45
+ }
46
+ }
47
+
48
+ $enctype = $multipart ? ' enctype="multipart/form-data"' : '';
49
+
50
+ $form .= '<form action="' . $url . '" method="post" class="wpcf7-form"' . $enctype . '>';
51
+ $form .= '<div style="display: none;">';
52
+ $form .= '<input type="hidden" name="_wpcf7" value="' . $this->id . '" />';
53
+ $form .= '<input type="hidden" name="_wpcf7_version" value="' . WPCF7_VERSION . '" />';
54
+ $form .= '<input type="hidden" name="_wpcf7_unit_tag" value="' . $this->unit_tag . '" />';
55
+ $form .= '</div>';
56
+ $form .= $this->form_elements();
57
+
58
+ if ( ! $this->responses_count )
59
+ $form .= $this->form_response_output();
60
+
61
+ $form .= '</form>';
62
+
63
+ $form .= '</div>';
64
+
65
+ if ( WPCF7_AUTOP )
66
+ $form = wpcf7_wpautop_substitute( $form );
67
+
68
+ return $form;
69
+ }
70
+
71
+ function form_response_output() {
72
+ $class = 'wpcf7-response-output';
73
+
74
+ if ( $this->is_posted() ) { // Post response output for non-AJAX
75
+ if ( isset( $_POST['_wpcf7_mail_sent'] ) && $_POST['_wpcf7_mail_sent']['id'] == $this->id ) {
76
+ if ( $_POST['_wpcf7_mail_sent']['ok'] ) {
77
+ $class .= ' wpcf7-mail-sent-ok';
78
+ $content = $_POST['_wpcf7_mail_sent']['message'];
79
+ } else {
80
+ $class .= ' wpcf7-mail-sent-ng';
81
+ if ( $_POST['_wpcf7_mail_sent']['spam'] )
82
+ $class .= ' wpcf7-spam-blocked';
83
+ $content = $_POST['_wpcf7_mail_sent']['message'];
84
+ }
85
+ } elseif ( isset( $_POST['_wpcf7_validation_errors'] ) && $_POST['_wpcf7_validation_errors']['id'] == $this->id ) {
86
+ $class .= ' wpcf7-validation-errors';
87
+ $content = $this->message( 'validation_error' );
88
+ }
89
+ } else {
90
+ $class .= ' wpcf7-display-none';
91
+ }
92
+
93
+ $class = ' class="' . $class . '"';
94
+
95
+ return '<div' . $class . '>' . $content . '</div>';
96
+ }
97
+
98
+ /* Form Elements */
99
+
100
+ function form_elements( $replace = true ) {
101
+ $form = $this->form;
102
+
103
+ $types = 'text[*]?|email[*]?|textarea[*]?|select[*]?|checkbox[*]?|radio|acceptance|captchac|captchar|file[*]?|quiz';
104
+ $regex = '%\[\s*(' . $types . ')(\s+[a-zA-Z][0-9a-zA-Z:._-]*)([-0-9a-zA-Z:#_/|\s]*)?((?:\s*(?:"[^"]*"|\'[^\']*\'))*)?\s*\]%';
105
+ $submit_regex = '%\[\s*submit(\s[-0-9a-zA-Z:#_/\s]*)?(\s+(?:"[^"]*"|\'[^\']*\'))?\s*\]%';
106
+ $response_regex = '%\[\s*response\s*\]%';
107
+ if ( $replace ) {
108
+ $form = preg_replace_callback( $regex, array( &$this, 'form_element_replace_callback' ), $form );
109
+ // Submit button
110
+ $form = preg_replace_callback( $submit_regex, array( &$this, 'submit_replace_callback' ), $form );
111
+ // Response output
112
+ $form = preg_replace_callback( $response_regex, array( &$this, 'response_replace_callback' ), $form );
113
+ return $form;
114
+ } else {
115
+ $results = array();
116
+ preg_match_all( $regex, $form, $matches, PREG_SET_ORDER );
117
+ foreach ( $matches as $match ) {
118
+ $results[] = (array) $this->form_element_parse( $match );
119
+ }
120
+ return $results;
121
+ }
122
+ }
123
+
124
+ function form_element_replace_callback( $matches ) {
125
+ extract( (array) $this->form_element_parse( $matches ) ); // $type, $name, $options, $values, $raw_values
126
+
127
+ if ( $this->is_posted() ) {
128
+ $validation_error = $_POST['_wpcf7_validation_errors']['messages'][$name];
129
+ $validation_error = $validation_error ? '<span class="wpcf7-not-valid-tip-no-ajax">' . esc_html( $validation_error ) . '</span>' : '';
130
+ } else {
131
+ $validation_error = '';
132
+ }
133
+
134
+ $atts = '';
135
+ $options = (array) $options;
136
+
137
+ $id_array = preg_grep( '%^id:[-0-9a-zA-Z_]+$%', $options );
138
+ if ( $id = array_shift( $id_array ) ) {
139
+ preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $id, $id_matches );
140
+ if ( $id = $id_matches[1] )
141
+ $atts .= ' id="' . $id . '"';
142
+ }
143
+
144
+ $class_att = "";
145
+ $class_array = preg_grep( '%^class:[-0-9a-zA-Z_]+$%', $options );
146
+ foreach ( $class_array as $class ) {
147
+ preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $class, $class_matches );
148
+ if ( $class = $class_matches[1] )
149
+ $class_att .= ' ' . $class;
150
+ }
151
+
152
+ if ( preg_match( '/^email[*]?#x2F;', $type ) )
153
+ $class_att .= ' wpcf7-validates-as-email';
154
+ if ( preg_match( '/[*]#x2F;', $type ) )
155
+ $class_att .= ' wpcf7-validates-as-required';
156
+
157
+ if ( preg_match( '/^checkbox[*]?#x2F;', $type ) )
158
+ $class_att .= ' wpcf7-checkbox';
159
+
160
+ if ( 'radio' == $type )
161
+ $class_att .= ' wpcf7-radio';
162
+
163
+ if ( preg_match( '/^captchac#x2F;', $type ) )
164
+ $class_att .= ' wpcf7-captcha-' . $name;
165
+
166
+ if ( 'acceptance' == $type ) {
167
+ $class_att .= ' wpcf7-acceptance';
168
+ if ( preg_grep( '%^invert$%', $options ) )
169
+ $class_att .= ' wpcf7-invert';
170
+ }
171
+
172
+ if ( $class_att )
173
+ $atts .= ' class="' . trim( $class_att ) . '"';
174
+
175
+ // Value.
176
+ if ( $this->is_posted() ) {
177
+ if ( isset( $_POST['_wpcf7_mail_sent'] ) && $_POST['_wpcf7_mail_sent']['ok'] )
178
+ $value = '';
179
+ elseif ( 'captchar' == $type )
180
+ $value = '';
181
+ else
182
+ $value = $_POST[$name];
183
+ } else {
184
+ $value = $values[0];
185
+ }
186