Contact Form 7 - Version 2.1

Version Description

  • The required WordPress version has been changed and now requires WordPress 2.8 or higher. If you use WordPress 2.7, you will need to upgrade WordPress.
  • New "special mail tags" ([wpcf7.post_id], [wpcf7.post_name], [wpcf7.post_title], and [wpcf7.post_url]) have been introduced.
  • The multilingualization functionality has been improved. You are now able to create contact forms in any languages with just a few clicks.
  • The Tag Generator's JavaScript coding has been wholly reconstructed and you can extend it from the additional modules.
  • Interoperability with cache plugins (WP Super Cache, etc.) has been improved.
  • When known issues are found on your web host, a warning message is shown on the administration panel.
  • Uninstall.php file has been added. This will clean up its table from your database when you remove Contact Form 7 from your site.
  • Translations for Estonian (by Egon Elbre), German (by Ivan Graf), Hindi (by Ashish) and Italian (by Gianni Diurno) have been updated.

Releases

=

Download this release

Release Info

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

Code changes from version 2.0.7 to 2.1

README.txt CHANGED
@@ -1,10 +1,10 @@
1
=== Contact Form 7 ===
2
Contributors: takayukister
3
Donate link: http://pledgie.com/campaigns/3117
4
- Tags: contact, contact form, email, ajax, captcha, akismet, WPML, multilingual
5
- Requires at least: 2.7
6
- Tested up to: 2.9-rare
7
- Stable tag: 2.0.7
8
9
Just another contact form plugin. Simple but flexible.
10
@@ -29,21 +29,21 @@ Contact Form 7 can manage multiple contact forms, plus you can customize the for
29
* Czech (cs_CZ) - Korry, [Radovan Fiser](http://algymsa.cz/)
30
* Danish (da_DK) - [Jens Griebel](http://www.kompas-it.dk/), [Georg S. Adamsen](http://wordpress.blogos.dk/)
31
* Dutch (nl_NL) - [Chris Devriese](http://www.100it.be/), [Martin Hein](http://www.split-a-pixel.nl/)
32
- * Estonian (et) - [Peeter Rahuvarm](http://www.kraabus.ee)
33
* Finnish (fi) - [Miika Turunen](http://www.webwork.fi/)
34
* French (fr_FR) - [Jillij](http://www.jillij.com/), [Maître Mô](http://maitremo.fr/)
35
* Georgian (ka_GE) - [Nodar Davituri](http://omedia.ge/)
36
* German (de_DE) - [Marcel Spitau](http://blog.spitau.de), [Ivan Graf](http://blog.bildergallery.com/)
37
* Greek (el) - [Nick Mouratidis](http://www.kepik.gr/), [Pr. friedlich](http://friedlich.wordpress.com/)
38
* Hebrew (he_IL) - [Yaron Ofer](http://www.gadgetguru.co.il/)
39
- * Hindi (hi_IN) - [Tarun Joshi](http://www.readers-cafe.net/)
40
* Hungarian (hu_HU) - [Andras Hirschler](http://hia.itblog.hu/), [János Csárdi-Braunstein](http://blogocska.org/)
41
* Indonesian (id_ID) - [Hendry Lee](http://blogbuildingu.com/)
42
* Italian (it_IT) - [Bruno](http://www.brunosalzano.com), [Gianni Diurno](http://gidibao.net/)
43
* Japanese (ja) - [Takayuki Miyoshi](http://ideasilo.wordpress.com)
44
* Korean (ko_KR) - Seong Eun Lee, [Jong-In Kim](http://incommunity.codex.kr/wordpress/)
45
* Latvian (lv) - [Sandis Veinbergs](http://www.kleofass.lv/)
46
- * Lithuanian(lt_LT) - [Ernestas Kardzys](http://www.ernestas.info/)
47
* Norwegian (nb_NO) - Kjetil M. Bergem, [aanvik.net](http://www.aanvik.net)
48
* Persian (Farsi; fa_IR) - [Mohammad Musavi](http://www.musavis.com/)
49
* Polish (pl_PL) - [Zbigniew Czernik](http://zibik.jogger.pl/), [Daniel Fruzynski](http://www.poradnik-webmastera.com)
@@ -60,11 +60,7 @@ Contact Form 7 can manage multiple contact forms, plus you can customize the for
60
* Ukrainian (uk_UA) - [Andrey Kovba](http://myserver.com.ua/)
61
* Vietnamese (vi) - Thanh Hải, Hà
62
63
- If you have created your own language pack, or have an update of an existing one, you can send [gettext .po and .mo files](http://codex.wordpress.org/Translating_WordPress) to me so that I can bundle it into Contact Form 7.
64
-
65
- = How to use Contact Form 7 in multilingual websites =
66
-
67
- Starting with version 2.0, Contact Form 7 can create multilingual contact form using the WPML plugin. See the detail on [WPML.org](http://wpml.org/wordpress-translation/translation-for-texts-by-other-plugins-and-themes/how-to-use-contact-form-7-in-multilingual-websites/).
68
69
== Installation ==
70
@@ -79,10 +75,10 @@ For basic usage, you can also have a look at the [plugin homepage](http://contac
79
80
Do you have questions or issues with Contact Form 7? Use these support channels appropriately.
81
82
1. [FAQ](http://contactform7.com/faq/)
83
1. [Support Forum](http://wordpress.org/tags/contact-form-7?forum_id=10)
84
1. [WordPress HelpCenter](http://wphelpcenter.com/)
85
- 1. [Customization Service](http://contactform7.com/customization/)
86
87
[Support](http://contactform7.com/support/)
88
@@ -92,13 +88,19 @@ Do you have questions or issues with Contact Form 7? Use these support channels
92
93
== Changelog ==
94
95
- = 2.0.7 =
96
- * add new filter hook (`wpcf7_validation_error`) and action hooks (`wpcf7_admin_after_general_settings`, `wpcf7_admin_after_form`, `wpcf7_admin_after_mail`, `wpcf7_admin_after_mail_2`, `wpcf7_admin_after_messages`, and `wpcf7_admin_after_additional_settings`)
97
- * call `$captcha->cleanup()` if available and shorten cleanup period (in `modules/captcha.php`)
98
- * various fixes with administration panels
99
- * improve DB table check
100
- * fix bug relating to disappearing backslashes
101
- * sanitize filenames with multiple extensions (relating to the issue discussed on [Ticket #11122](http://core.trac.wordpress.org/ticket/11122))
102
- * update translation for Persian (props: Mohammad Musavi)
103
104
[Releases](http://contactform7.com/category/releases/)
1
=== Contact Form 7 ===
2
Contributors: takayukister
3
Donate link: http://pledgie.com/campaigns/3117
4
+ Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
5
+ Requires at least: 2.8
6
+ Tested up to: 3.0-alpha
7
+ Stable tag: 2.1
8
9
Just another contact form plugin. Simple but flexible.
10
29
* Czech (cs_CZ) - Korry, [Radovan Fiser](http://algymsa.cz/)
30
* Danish (da_DK) - [Jens Griebel](http://www.kompas-it.dk/), [Georg S. Adamsen](http://wordpress.blogos.dk/)
31
* Dutch (nl_NL) - [Chris Devriese](http://www.100it.be/), [Martin Hein](http://www.split-a-pixel.nl/)
32
+ * Estonian (et) - [Peeter Rahuvarm](http://www.kraabus.ee), Egon Elbre
33
* Finnish (fi) - [Miika Turunen](http://www.webwork.fi/)
34
* French (fr_FR) - [Jillij](http://www.jillij.com/), [Maître Mô](http://maitremo.fr/)
35
* Georgian (ka_GE) - [Nodar Davituri](http://omedia.ge/)
36
* German (de_DE) - [Marcel Spitau](http://blog.spitau.de), [Ivan Graf](http://blog.bildergallery.com/)
37
* Greek (el) - [Nick Mouratidis](http://www.kepik.gr/), [Pr. friedlich](http://friedlich.wordpress.com/)
38
* Hebrew (he_IL) - [Yaron Ofer](http://www.gadgetguru.co.il/)
39
+ * Hindi (hi_IN) - [Tarun Joshi](http://www.readers-cafe.net/), [Ashish](http://outshinesolutions.com/)
40
* Hungarian (hu_HU) - [Andras Hirschler](http://hia.itblog.hu/), [János Csárdi-Braunstein](http://blogocska.org/)
41
* Indonesian (id_ID) - [Hendry Lee](http://blogbuildingu.com/)
42
* Italian (it_IT) - [Bruno](http://www.brunosalzano.com), [Gianni Diurno](http://gidibao.net/)
43
* Japanese (ja) - [Takayuki Miyoshi](http://ideasilo.wordpress.com)
44
* Korean (ko_KR) - Seong Eun Lee, [Jong-In Kim](http://incommunity.codex.kr/wordpress/)
45
* Latvian (lv) - [Sandis Veinbergs](http://www.kleofass.lv/)
46
+ * Lithuanian (lt_LT) - [Ernestas Kardzys](http://www.ernestas.info/)
47
* Norwegian (nb_NO) - Kjetil M. Bergem, [aanvik.net](http://www.aanvik.net)
48
* Persian (Farsi; fa_IR) - [Mohammad Musavi](http://www.musavis.com/)
49
* Polish (pl_PL) - [Zbigniew Czernik](http://zibik.jogger.pl/), [Daniel Fruzynski](http://www.poradnik-webmastera.com)
60
* Ukrainian (uk_UA) - [Andrey Kovba](http://myserver.com.ua/)
61
* Vietnamese (vi) - Thanh Hải, Hà
62
63
+ If you have created your own language pack, or have an update of an existing one, you can send [gettext PO and MO files](http://codex.wordpress.org/Translating_WordPress) to [me](http://ideasilo.wordpress.com/about/) so that I can bundle it into Contact Form 7. You can [download the latest POT file from here](http://plugins.svn.wordpress.org/contact-form-7/trunk/languages/wpcf7.pot).
64
65
== Installation ==
66
75
76
Do you have questions or issues with Contact Form 7? Use these support channels appropriately.
77
78
+ 1. [Docs](http://contactform7.com/docs/)
79
1. [FAQ](http://contactform7.com/faq/)
80
1. [Support Forum](http://wordpress.org/tags/contact-form-7?forum_id=10)
81
1. [WordPress HelpCenter](http://wphelpcenter.com/)
82
83
[Support](http://contactform7.com/support/)
84
88
89
== Changelog ==
90
91
+ = 2.1 =
92
+ * The required WordPress version has been changed and now requires WordPress 2.8 or higher. If you use WordPress 2.7, you will need to upgrade WordPress.
93
+ * New "special mail tags" (`[wpcf7.post_id]`, `[wpcf7.post_name]`, `[wpcf7.post_title]`, and `[wpcf7.post_url]`) have been introduced.
94
+ * The multilingualization functionality has been improved. You are now able to create contact forms in any languages with just a few clicks.
95
+ * The Tag Generator's JavaScript coding has been wholly reconstructed and you can extend it from the additional modules.
96
+ * Interoperability with cache plugins (WP Super Cache, etc.) has been improved.
97
+ * When known issues are found on your web host, a warning message is shown on the administration panel.
98
+ * Uninstall.php file has been added. This will clean up its table from your database when you remove Contact Form 7 from your site.
99
+ * Translations for Estonian (by Egon Elbre), German (by Ivan Graf), Hindi (by Ashish) and Italian (by Gianni Diurno) have been updated.
100
101
[Releases](http://contactform7.com/category/releases/)
102
+
103
+ == Upgrade Notice ==
104
+
105
+ = 2.1 =
106
+ Required WordPress version is changed to WordPress 2.8 and higher. Multilingualization functionality is improved and you don't need `[icl]` tags any more.
admin/admin.php CHANGED
@@ -18,7 +18,9 @@ function wpcf7_admin_add_pages() {
18
}
19
20
$title = trim( $_POST['wpcf7-title'] );
21
$form = trim( $_POST['wpcf7-form'] );
22
$mail = array(
23
'subject' => trim( $_POST['wpcf7-mail-subject'] ),
24
'sender' => trim( $_POST['wpcf7-mail-sender'] ),
@@ -28,6 +30,7 @@ function wpcf7_admin_add_pages() {
28
'attachments' => trim( $_POST['wpcf7-mail-attachments'] ),
29
'use_html' => ( 1 == $_POST['wpcf7-mail-use-html'] ) ? true : false
30
);
31
$mail_2 = array(
32
'active' => ( 1 == $_POST['wpcf7-mail-2-active'] ) ? true : false,
33
'subject' => trim( $_POST['wpcf7-mail-2-subject'] ),
@@ -38,21 +41,14 @@ function wpcf7_admin_add_pages() {
38
'attachments' => trim( $_POST['wpcf7-mail-2-attachments'] ),
39
'use_html' => ( 1 == $_POST['wpcf7-mail-2-use-html'] ) ? true : false
40
);
41
- $messages = array(
42
- 'mail_sent_ok' => trim( $_POST['wpcf7-message-mail-sent-ok'] ),
43
- 'mail_sent_ng' => trim( $_POST['wpcf7-message-mail-sent-ng'] ),
44
- 'akismet_says_spam' => trim( $_POST['wpcf7-message-akismet-says-spam'] ),
45
- 'validation_error' => trim( $_POST['wpcf7-message-validation-error'] ),
46
- 'accept_terms' => trim( $_POST['wpcf7-message-accept-terms'] ),
47
- 'invalid_email' => trim( $_POST['wpcf7-message-invalid-email'] ),
48
- 'invalid_required' => trim( $_POST['wpcf7-message-invalid-required'] ),
49
- 'quiz_answer_not_correct' => trim( $_POST['wpcf7-message-quiz-answer-not-correct'] ),
50
- 'captcha_not_match' => trim( $_POST['wpcf7-message-captcha-not-match'] ),
51
- 'upload_failed' => trim( $_POST['wpcf7-message-upload-failed'] ),
52
- 'upload_file_type_invalid' => trim( $_POST['wpcf7-message-upload-file-type-invalid'] ),
53
- 'upload_file_too_large' => trim( $_POST['wpcf7-message-upload-file-too-large'] ),
54
- 'upload_failed_php_error' => trim( $_POST['wpcf7-message-upload-failed-php-error'] )
55
- );
56
$additional_settings = trim( $_POST['wpcf7-additional-settings'] );
57
58
$query = array();
@@ -68,7 +64,7 @@ function wpcf7_admin_add_pages() {
68
$contact_form->save();
69
70
$query['contactform'] = $contact_form->id;
71
- $redirect_to = wpcf7_admin_url( 'admin.php', $query );
72
wp_redirect( $redirect_to );
73
exit();
74
} elseif ( isset( $_POST['wpcf7-copy'] ) && wpcf7_admin_has_edit_cap() ) {
@@ -87,7 +83,7 @@ function wpcf7_admin_add_pages() {
87
$query['contactform'] = $contact_form->id;
88
}
89
90
- $redirect_to = wpcf7_admin_url( 'admin.php', $query );
91
wp_redirect( $redirect_to );
92
exit();
93
} elseif ( isset( $_POST['wpcf7-delete'] ) && wpcf7_admin_has_edit_cap() ) {
@@ -97,7 +93,7 @@ function wpcf7_admin_add_pages() {
97
if ( $contact_form = wpcf7_contact_form( $id ) )
98
$contact_form->delete();
99
100
- $redirect_to = wpcf7_admin_url( 'admin.php', array( 'message' => 'deleted' ) );
101
wp_redirect( $redirect_to );
102
exit();
103
} elseif ( isset( $_GET['wpcf7-create-table'] ) ) {
@@ -114,24 +110,15 @@ function wpcf7_admin_add_pages() {
114
}
115
}
116
117
- wp_redirect( wpcf7_admin_url( 'admin.php', $query ) );
118
exit();
119
}
120
121
add_menu_page( __( 'Contact Form 7', 'wpcf7' ), __( 'Contact', 'wpcf7' ),
122
- WPCF7_ADMIN_READ_CAPABILITY, wpcf7_plugin_path( 'admin/admin.php' ),
123
- 'wpcf7_admin_management_page' );
124
125
- wpcf7_add_contact_page( __( 'Edit Contact Forms', 'wpcf7' ), __( 'Edit', 'wpcf7' ),
126
- WPCF7_ADMIN_READ_CAPABILITY, wpcf7_plugin_path( 'admin/admin.php' ),
127
- 'wpcf7_admin_management_page' );
128
- }
129
-
130
- function wpcf7_add_contact_page( $page_title, $menu_title, $access_level,
131
- $file, $function = '', $icon_url = '' ) {
132
-
133
- add_submenu_page( wpcf7_plugin_path( 'admin/admin.php' ),
134
- $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '' );
135
}
136
137
add_action( 'admin_print_styles', 'wpcf7_admin_enqueue_styles' );
@@ -139,130 +126,70 @@ add_action( 'admin_print_styles', 'wpcf7_admin_enqueue_styles' );
139
function wpcf7_admin_enqueue_styles() {
140
global $plugin_page;
141
142
- if ( ! isset( $plugin_page ) || 0 !== strpos( $plugin_page, WPCF7_PLUGIN_NAME ) )
143
return;
144
145
- wp_enqueue_style( 'contact-form-7-admin', wpcf7_plugin_url( 'admin/admin-stylesheet.css' ),
146
array(), WPCF7_VERSION, 'all' );
147
148
if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
149
wp_enqueue_style( 'contact-form-7-admin-rtl',
150
- wpcf7_plugin_url( 'admin/admin-stylesheet-rtl.css' ),
151
- array(), WPCF7_VERSION, 'all' );
152
}
153
}
154
155
- add_action( 'admin_head', 'wpcf7_admin_head' );
156
-
157
- function wpcf7_admin_head() {
158
- global $plugin_page;
159
-
160
- if ( ! isset( $plugin_page ) || 0 !== strpos( $plugin_page, WPCF7_PLUGIN_NAME ) )
161
- return;
162
-
163
- ?>
164
- <script type="text/javascript">
165
- //<![CDATA[
166
- var _wpcf7 = {
167
- captchaMod: <?php echo ( class_exists( 'ReallySimpleCaptcha' ) ) ? 'true' : 'false' ?>,
168
- pluginUrl: '<?php echo wpcf7_plugin_url(); ?>'
169
- };
170
- //]]>
171
- </script>
172
- <?php
173
- }
174
-
175
add_action( 'admin_print_scripts', 'wpcf7_admin_enqueue_scripts' );
176
177
function wpcf7_admin_enqueue_scripts() {
178
global $plugin_page;
179
180
- if ( ! isset( $plugin_page ) || 0 !== strpos( $plugin_page, WPCF7_PLUGIN_NAME ) )
181
return;
182
183
- wp_enqueue_script( 'wpcf7-admin', wpcf7_plugin_url( 'admin/wpcf7-admin.js' ),
184
- array('jquery'), WPCF7_VERSION, true );
185
wp_localize_script( 'wpcf7-admin', '_wpcf7L10n', array(
186
- 'optional' => __( 'optional', 'wpcf7' ),
187
'generateTag' => __( 'Generate Tag', 'wpcf7' ),
188
- 'textField' => __( 'Text field', 'wpcf7' ),
189
- 'emailField' => __( 'Email field', 'wpcf7' ),
190
- 'textArea' => __( 'Text area', 'wpcf7' ),
191
- 'menu' => __( 'Drop-down menu', 'wpcf7' ),
192
- 'checkboxes' => __( 'Checkboxes', 'wpcf7' ),
193
- 'radioButtons' => __( 'Radio buttons', 'wpcf7' ),
194
- 'acceptance' => __( 'Acceptance', 'wpcf7' ),
195
- 'isAcceptanceDefaultOn' => __( "Make this checkbox checked by default?", 'wpcf7' ),
196
- 'isAcceptanceInvert' => __( "Make this checkbox work inversely?", 'wpcf7' ),
197
- 'isAcceptanceInvertMeans' => __( "* That means visitor who accepts the term unchecks it.", 'wpcf7' ),
198
- 'captcha' => __( 'CAPTCHA', 'wpcf7' ),
199
- 'quiz' => __( 'Quiz', 'wpcf7' ),
200
- 'quizzes' => __( 'Quizzes', 'wpcf7' ),
201
- 'quizFormatDesc' => __( "* quiz|answer (e.g. 1+1=?|2)", 'wpcf7' ),
202
- 'fileUpload' => __( 'File upload', 'wpcf7' ),
203
- 'bytes' => __( 'bytes', 'wpcf7' ),
204
- 'submit' => __( 'Submit button', 'wpcf7' ),
205
- 'tagName' => __( 'Name', 'wpcf7' ),
206
- 'isRequiredField' => __( 'Required field?', 'wpcf7' ),
207
- 'allowsMultipleSelections' => __( 'Allow multiple selections?', 'wpcf7' ),
208
- 'insertFirstBlankOption' => __( 'Insert a blank item as the first option?', 'wpcf7' ),
209
- 'makeCheckboxesExclusive' => __( 'Make checkboxes exclusive?', 'wpcf7' ),
210
- 'menuChoices' => __( 'Choices', 'wpcf7' ),
211
- 'label' => __( 'Label', 'wpcf7' ),
212
- 'defaultValue' => __( 'Default value', 'wpcf7' ),
213
- 'akismet' => __( 'Akismet', 'wpcf7' ),
214
- 'akismetAuthor' => __( "This field requires author's name", 'wpcf7' ),
215
- 'akismetAuthorUrl' => __( "This field requires author's URL", 'wpcf7' ),
216
- 'akismetAuthorEmail' => __( "This field requires author's email address", 'wpcf7' ),
217
- 'generatedTag' => __( "Copy this code and paste it into the form left.", 'wpcf7' ),
218
- 'fgColor' => __( "Foreground color", 'wpcf7' ),
219
- 'bgColor' => __( "Background color", 'wpcf7' ),
220
- 'imageSize' => __( "Image size", 'wpcf7' ),
221
- 'imageSizeSmall' => __( "Small", 'wpcf7' ),
222
- 'imageSizeMedium' => __( "Medium", 'wpcf7' ),
223
- 'imageSizeLarge' => __( "Large", 'wpcf7' ),
224
- 'imageSettings' => __( "Image settings", 'wpcf7' ),
225
- 'inputFieldSettings' => __( "Input field settings", 'wpcf7' ),
226
- 'tagForImage' => __( "For image", 'wpcf7' ),
227
- 'tagForInputField' => __( "For input field", 'wpcf7' ),
228
- 'oneChoicePerLine' => __( "* One choice per line.", 'wpcf7' ),
229
'show' => __( "Show", 'wpcf7' ),
230
- 'hide' => __( "Hide", 'wpcf7' ),
231
- 'fileSizeLimit' => __( "File size limit", 'wpcf7' ),
232
- 'acceptableFileTypes' => __( "Acceptable file types", 'wpcf7' ),
233
- 'needReallySimpleCaptcha' => __( "Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed.", 'wpcf7' )
234
- ) );
235
}
236
237
- function wpcf7_admin_management_page() {
238
- global $wp_version;
239
240
- switch ( $_GET['message'] ) {
241
- case 'created':
242
- $updated_message = __( "Contact form created.", 'wpcf7' );
243
- break;
244
- case 'saved':
245
- $updated_message = __( "Contact form saved.", 'wpcf7' );
246
- break;
247
- case 'deleted':
248
- $updated_message = __( "Contact form deleted.", 'wpcf7' );
249
- break;
250
- case 'table_created':
251
- $updated_message = __( "Database table created.", 'wpcf7' );
252
- break;
253
- case 'table_not_created':
254
- $updated_message = __( "Failed to create database table.", 'wpcf7' );
255
- break;
256
}
257
258
$contact_forms = wpcf7_contact_forms();
259
260
- $id = $_POST['wpcf7-id'];
261
-
262
if ( 'new' == $_GET['contactform'] ) {
263
$unsaved = true;
264
$current = -1;
265
- $cf = wpcf7_contact_form_default_pack();
266
} elseif ( $cf = wpcf7_contact_form( $_GET['contactform'] ) ) {
267
$current = (int) $_GET['contactform'];
268
} else {
@@ -271,7 +198,55 @@ function wpcf7_admin_management_page() {
271
$cf = wpcf7_contact_form( $current );
272
}
273
274
- require_once WPCF7_PLUGIN_DIR . '/admin/admin-panel.php';
275
}
276
277
/* Install and default settings */
@@ -308,7 +283,8 @@ function wpcf7_install() {
308
return false; // Failed to create
309
310
$legacy_data = get_option( 'wpcf7' );
311
- if ( is_array( $legacy_data ) ) {
312
foreach ( $legacy_data['contact_forms'] as $key => $value ) {
313
$wpdb->insert( $table_name, array(
314
'cf7_unit_id' => $key,
@@ -342,7 +318,7 @@ function wpcf7_plugin_action_links( $links, $file ) {
342
if ( $file != WPCF7_PLUGIN_BASENAME )
343
return $links;
344
345
- $url = wpcf7_admin_url( 'admin.php' );
346
347
$settings_link = '<a href="' . esc_attr( $url ) . '">'
348
. esc_html( __( 'Settings', 'wpcf7' ) ) . '</a>';
@@ -352,15 +328,70 @@ function wpcf7_plugin_action_links( $links, $file ) {
352
return $links;
353
}
354
355
- function wpcf7_donation_link() {
356
if ( ! WPCF7_SHOW_DONATION_LINK )
357
return;
358
359
if ( 'new' == $_GET['contactform'] || ! empty($_GET['message']) )
360
return;
361
362
$num = mt_rand(0, 99);
363
if ($num >= 10) // 90%
364
return;
365
366
$texts = array(
18
}
19
20
$title = trim( $_POST['wpcf7-title'] );
21
+
22
$form = trim( $_POST['wpcf7-form'] );
23
+
24
$mail = array(
25
'subject' => trim( $_POST['wpcf7-mail-subject'] ),
26
'sender' => trim( $_POST['wpcf7-mail-sender'] ),
30
'attachments' => trim( $_POST['wpcf7-mail-attachments'] ),
31
'use_html' => ( 1 == $_POST['wpcf7-mail-use-html'] ) ? true : false
32
);
33
+
34
$mail_2 = array(
35
'active' => ( 1 == $_POST['wpcf7-mail-2-active'] ) ? true : false,
36
'subject' => trim( $_POST['wpcf7-mail-2-subject'] ),
41
'attachments' => trim( $_POST['wpcf7-mail-2-attachments'] ),
42
'use_html' => ( 1 == $_POST['wpcf7-mail-2-use-html'] ) ? true : false
43
);
44
+
45
+ $messages = $contact_form->messages;
46
+ foreach ( wpcf7_messages() as $key => $arr ) {
47
+ $field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
48
+ if ( isset( $_POST[$field_name] ) )
49
+ $messages[$key] = trim( $_POST[$field_name] );
50
+ }
51
+
52
$additional_settings = trim( $_POST['wpcf7-additional-settings'] );
53
54
$query = array();
64
$contact_form->save();
65
66
$query['contactform'] = $contact_form->id;
67
+ $redirect_to = wpcf7_admin_url( $query );
68
wp_redirect( $redirect_to );
69
exit();
70
} elseif ( isset( $_POST['wpcf7-copy'] ) && wpcf7_admin_has_edit_cap() ) {
83
$query['contactform'] = $contact_form->id;
84
}
85
86
+ $redirect_to = wpcf7_admin_url( $query );
87
wp_redirect( $redirect_to );
88
exit();
89
} elseif ( isset( $_POST['wpcf7-delete'] ) && wpcf7_admin_has_edit_cap() ) {
93
if ( $contact_form = wpcf7_contact_form( $id ) )
94
$contact_form->delete();
95
96
+ $redirect_to = wpcf7_admin_url( array( 'message' => 'deleted' ) );
97
wp_redirect( $redirect_to );
98
exit();
99
} elseif ( isset( $_GET['wpcf7-create-table'] ) ) {
110
}
111
}
112
113
+ wp_redirect( wpcf7_admin_url( $query ) );
114
exit();
115
}
116
117
add_menu_page( __( 'Contact Form 7', 'wpcf7' ), __( 'Contact', 'wpcf7' ),
118
+ WPCF7_ADMIN_READ_CAPABILITY, 'wpcf7', 'wpcf7_admin_management_page' );
119
120
+ add_submenu_page( 'wpcf7', __( 'Edit Contact Forms', 'wpcf7' ), __( 'Edit', 'wpcf7' ),
121
+ WPCF7_ADMIN_READ_CAPABILITY, 'wpcf7', 'wpcf7_admin_management_page' );
122
}
123
124
add_action( 'admin_print_styles', 'wpcf7_admin_enqueue_styles' );
126
function wpcf7_admin_enqueue_styles() {
127
global $plugin_page;
128
129
+ if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page )
130
return;
131
132
+ wp_enqueue_style( 'thickbox' );
133
+
134
+ wp_enqueue_style( 'contact-form-7-admin', wpcf7_plugin_url( 'admin/styles.css' ),
135
array(), WPCF7_VERSION, 'all' );
136
137
if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
138
wp_enqueue_style( 'contact-form-7-admin-rtl',
139
+ wpcf7_plugin_url( 'admin/styles-rtl.css' ), array(), WPCF7_VERSION, 'all' );
140
}
141
}
142
143
add_action( 'admin_print_scripts', 'wpcf7_admin_enqueue_scripts' );
144
145
function wpcf7_admin_enqueue_scripts() {
146
global $plugin_page;
147
148
+ if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page )
149
return;
150
151
+ wp_enqueue_script( 'thickbox' );
152
+
153
+ wp_enqueue_script( 'wpcf7-admin-taggenerator', wpcf7_plugin_url( 'admin/taggenerator.js' ),
154
+ array( 'jquery' ), WPCF7_VERSION, true );
155
+
156
+ wp_enqueue_script( 'wpcf7-admin', wpcf7_plugin_url( 'admin/scripts.js' ),
157
+ array( 'jquery', 'wpcf7-admin-taggenerator' ), WPCF7_VERSION, true );
158
wp_localize_script( 'wpcf7-admin', '_wpcf7L10n', array(
159
'generateTag' => __( 'Generate Tag', 'wpcf7' ),
160
'show' => __( "Show", 'wpcf7' ),
161
+ 'hide' => __( "Hide", 'wpcf7' ) ) );
162
}
163
164
+ add_action( 'admin_footer', 'wpcf7_admin_footer' );
165
166
+ function wpcf7_admin_footer() {
167
+ global $plugin_page;
168
+
169
+ if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page )
170
+ return;
171
+
172
+ ?>
173
+ <script type="text/javascript">
174
+ /* <![CDATA[ */
175
+ var _wpcf7 = {
176
+ pluginUrl: '<?php echo wpcf7_plugin_url(); ?>',
177
+ tagGenerators: {
178
+ <?php wpcf7_print_tag_generators(); ?>
179
}
180
+ };
181
+ /* ]]> */
182
+ </script>
183
+ <?php
184
+ }
185
186
+ function wpcf7_admin_management_page() {
187
$contact_forms = wpcf7_contact_forms();
188
189
if ( 'new' == $_GET['contactform'] ) {
190
$unsaved = true;
191
$current = -1;
192
+ $cf = wpcf7_contact_form_default_pack( $_GET['locale'] );
193
} elseif ( $cf = wpcf7_contact_form( $_GET['contactform'] ) ) {
194
$current = (int) $_GET['contactform'];
195
} else {
198
$cf = wpcf7_contact_form( $current );
199
}
200
201
+ require_once WPCF7_PLUGIN_DIR . '/admin/edit.php';
202
+ }
203
+
204
+ /* Tag generator */
205
+
206
+ function wpcf7_add_tag_generator( $name, $title, $elm_id, $callback, $options = array() ) {
207
+ global $wpcf7_tag_generators;
208
+
209
+ $name = trim( $name );
210
+ if ( '' == $name )
211
+ return false;
212
+
213
+ if ( ! is_array( $wpcf7_tag_generators ) )
214
+ $wpcf7_tag_generators = array();
215
+
216
+ $wpcf7_tag_generators[$name] = array(
217
+ 'title' => $title,
218
+ 'content' => $elm_id,
219
+ 'options' => $options );
220
+
221
+ if ( is_callable( $callback ) )
222
+ add_action( 'wpcf7_admin_footer', $callback );
223
+
224
+ return true;
225
+ }
226
+
227
+ function wpcf7_print_tag_generators() {
228
+ global $wpcf7_tag_generators;
229
+
230
+ $output = array();
231
+
232
+ foreach ( (array) $wpcf7_tag_generators as $name => $tg ) {
233
+ $pane = " " . esc_js( $name ) . ": { ";
234
+ $pane .= "title: '" . esc_js( $tg['title'] ) . "'";
235
+ $pane .= ", content: '" . esc_js( $tg['content'] ) . "'";
236
+
237
+ foreach ( (array) $tg['options'] as $option_name => $option_value ) {
238
+ if ( is_int( $option_value ) )
239
+ $pane .= ", $option_name: $option_value";
240
+ else
241
+ $pane .= ", $option_name: '" . esc_js( $option_value ) . "'";
242
+ }
243
+
244
+ $pane .= " }";
245
+
246
+ $output[] = $pane;
247
+ }
248
+
249
+ echo implode( ",\n", $output ) . "\n";
250
}
251
252
/* Install and default settings */
283
return false; // Failed to create
284
285
$legacy_data = get_option( 'wpcf7' );
286
+ if ( is_array( $legacy_data )
287
+ && is_array( $legacy_data['contact_forms'] ) && $legacy_data['contact_forms'] ) {
288
foreach ( $legacy_data['contact_forms'] as $key => $value ) {
289
$wpdb->insert( $table_name, array(
290
'cf7_unit_id' => $key,
318
if ( $file != WPCF7_PLUGIN_BASENAME )
319
return $links;
320
321
+ $url = wpcf7_admin_url( array( 'page' => 'wpcf7' ) );
322
323
$settings_link = '<a href="' . esc_attr( $url ) . '">'
324
. esc_html( __( 'Settings', 'wpcf7' ) ) . '</a>';
328
return $links;
329
}
330
331
+ add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_cf7com_links', 9 );
332
+
333
+ function wpcf7_cf7com_links( &$contact_form ) {
334
+ $links = '<div class="cf7com-links">'
335
+ . '<a href="' . esc_url_raw( __( 'http://contactform7.com/', 'wpcf7' ) ) . '" target="_blank">'
336
+ . esc_html( __( 'Contactform7.com', 'wpcf7' ) ) . '</a>&ensp;'
337
+ . '<a href="' . esc_url_raw( __( 'http://contactform7.com/docs/', 'wpcf7' ) ) . '" target="_blank">'
338
+ . esc_html( __( 'Docs', 'wpcf7' ) ) . '</a> - '
339
+ . '<a href="' . esc_url_raw( __( 'http://contactform7.com/faq/', 'wpcf7' ) ) . '" target="_blank">'
340
+ . esc_html( __( 'FAQ', 'wpcf7' ) ) . '</a> - '
341
+ . '<a href="' . esc_url_raw( __( 'http://contactform7.com/support/', 'wpcf7' ) ) . '" target="_blank">'
342
+ . esc_html( __( 'Support', 'wpcf7' ) ) . '</a>'
343
+ . '</div>';
344
+
345
+ echo apply_filters( 'wpcf7_cf7com_links', $links );
346
+ }
347
+
348
+ add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_updated_message' );
349
+
350
+ function wpcf7_updated_message( &$contact_form ) {
351
+ switch ( $_GET['message'] ) {
352
+ case 'created':
353
+ $updated_message = __( "Contact form created.", 'wpcf7' );
354
+ break;
355
+ case 'saved':
356
+ $updated_message = __( "Contact form saved.", 'wpcf7' );
357
+ break;
358
+ case 'deleted':
359
+ $updated_message = __( "Contact form deleted.", 'wpcf7' );
360
+ break;
361
+ case 'table_created':
362
+ $updated_message = __( "Database table created.", 'wpcf7' );
363
+ break;
364
+ case 'table_not_created':
365
+ $updated_message = __( "Failed to create database table.", 'wpcf7' );
366
+ break;
367
+ }
368
+
369
+ if ( ! $updated_message )
370
+ return;
371
+
372
+ ?>
373
+ <div id="message" class="updated fade"><p><?php echo esc_html( $updated_message ); ?></p></div>
374
+ <?php
375
+ }
376
+
377
+ add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_donation_link' );
378
+
379
+ function wpcf7_donation_link( &$contact_form ) {
380
if ( ! WPCF7_SHOW_DONATION_LINK )
381
return;
382
383
if ( 'new' == $_GET['contactform'] || ! empty($_GET['message']) )
384
return;
385
386
+ $show_link = true;
387
+
388
$num = mt_rand(0, 99);
389
if ($num >= 10) // 90%
390
+ $show_link = false;
391
+
392
+ $show_link = apply_filters( 'wpcf7_show_donation_link', $show_link );
393
+
394
+ if ( ! $show_link )
395
return;
396
397
$texts = array(
admin/{admin-panel.php → edit.php} RENAMED
@@ -3,7 +3,7 @@
3
/* No table warning */
4
if ( ! wpcf7_table_exists() ) {
5
if ( current_user_can( 'activate_plugins' ) ) {
6
- $create_table_link_url = wpcf7_admin_url( 'admin.php', array( 'wpcf7-create-table' => 1 ) );
7
$create_table_link_url = wp_nonce_url( $create_table_link_url, 'wpcf7-create-table' );
8
$message = sprintf(
9
__( '<strong>The database table for Contact Form 7 does not exist.</strong> You must <a href="%s">create the table</a> for it to work.', 'wpcf7' ),
@@ -25,33 +25,33 @@ if ( ! wpcf7_table_exists() ) {
25
26
?><div class="wrap wpcf7">
27
28
- <?php screen_icon( 'edit-pages' ); ?>
29
-
30
- <h2><?php echo esc_html( __( 'Contact Form 7', 'wpcf7' ) ); ?></h2>
31
32
- <?php wpcf7_donation_link(); ?>
33
34
- <?php if ( isset( $updated_message ) ) : ?>
35
- <div id="message" class="updated fade"><p><?php echo $updated_message; ?></p></div>
36
- <?php endif; ?>
37
38
- <ul class="subsubsub">
39
- <?php foreach ( $contact_forms as $v ) : ?>
40
- <li><a href="<?php echo wpcf7_admin_url( 'admin.php', array( 'contactform' => $v->id ) ); ?>"<?php if ( $v->id == $current ) echo ' class="current"'; ?>>
41
- <?php echo esc_html( $v->title ); ?></a> |</li>
42
- <?php endforeach; ?>
43
44
- <?php if ( wpcf7_admin_has_edit_cap() ) : ?>
45
- <li class="addnew"><a href="<?php echo wpcf7_admin_url( 'admin.php', array( 'contactform' => 'new' ) ); ?>"<?php if ( $unsaved ) echo ' class="current"'; ?>><?php echo esc_html( __( 'Add new', 'wpcf7' ) ); ?></a></li>
46
- <?php endif; ?>
47
- </ul>
48
49
- <br class="clear" />
50
51
<?php if ( $cf ) : ?>
52
<?php $disabled = ( wpcf7_admin_has_edit_cap() ) ? '' : ' disabled="disabled"'; ?>
53
54
- <form method="post" action="<?php echo wpcf7_admin_url( 'admin.php', array( 'contactform' => $current ) ); ?>" id="wpcf7-admin-form-element">
55
<?php if ( wpcf7_admin_has_edit_cap() ) wp_nonce_field( 'wpcf7-save_' . $current ); ?>
56
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo $current; ?>" />
57
@@ -111,7 +111,7 @@ if ( ! wpcf7_table_exists() ) {
111
</td>
112
113
<td scope="col" style="width: 50%;">
114
- <div id="tag-generator-div"></div>
115
</td>
116
117
</tr>
@@ -259,70 +259,15 @@ if ( ! wpcf7_table_exists() ) {
259
<td scope="col">
260
<div id="message-fields">
261
262
<div class="message-field">
263
- <label for="wpcf7-message-mail-sent-ok"><em># <?php echo esc_html( __( "Sender's message was sent successfully", 'wpcf7' ) ); ?></em></label><br />
264
- <input type="text" id="wpcf7-message-mail-sent-ok" name="wpcf7-message-mail-sent-ok" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['mail_sent_ok'] ); ?>" />
265
- </div>
266
-
267
- <div class="message-field">
268
- <label for="wpcf7-message-mail-sent-ng"><em># <?php echo esc_html( __( "Sender's message was failed to send", 'wpcf7' ) ); ?></em></label><br />
269
- <input type="text" id="wpcf7-message-mail-sent-ng" name="wpcf7-message-mail-sent-ng" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['mail_sent_ng'] ); ?>" />
270
- </div>
271
-
272
- <div class="message-field">
273
- <label for="wpcf7-message-akismet-says-spam"><em># <?php echo esc_html( __( "Akismet judged the sending activity as spamming", 'wpcf7' ) ); ?></em></label><br />
274
- <input type="text" id="wpcf7-message-akismet-says-spam" name="wpcf7-message-akismet-says-spam" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['akismet_says_spam'] ); ?>" />
275
- </div>
276
-
277
- <div class="message-field">
278
- <label for="wpcf7-message-validation-error"><em># <?php echo esc_html( __( "Validation errors occurred", 'wpcf7' ) ); ?></em></label><br />
279
- <input type="text" id="wpcf7-message-validation-error" name="wpcf7-message-validation-error" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['validation_error'] ); ?>" />
280
- </div>
281
-
282
- <div class="message-field" style="margin-top: 1em;">
283
- <label for="wpcf7-message-invalid-required"><em># <?php echo esc_html( __( "There is a field that sender is needed to fill in", 'wpcf7' ) ); ?></em></label><br />
284
- <input type="text" id="wpcf7-message-invalid-required" name="wpcf7-message-invalid-required" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['invalid_required'] ); ?>" />
285
- </div>
286
-
287
- <div class="message-field">
288
- <label for="wpcf7-message-invalid-email"><em># <?php echo esc_html( __( "Email address that sender entered is invalid", 'wpcf7' ) ); ?></em></label><br />
289
- <input type="text" id="wpcf7-message-invalid-email" name="wpcf7-message-invalid-email" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['invalid_email'] ); ?>" />
290
- </div>
291
-
292
- <div class="message-field">
293
- <label for="wpcf7-message-accept-terms"><em># <?php echo esc_html( __( "There is a field of term that sender is needed to accept", 'wpcf7' ) ); ?></em></label><br />
294
- <input type="text" id="wpcf7-message-accept-terms" name="wpcf7-message-accept-terms" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['accept_terms'] ); ?>" />
295
- </div>
296
-
297
- <div class="message-field">
298
- <label for="wpcf7-message-quiz-answer-not-correct"><em># <?php echo esc_html( __( "Sender doesn't enter the correct answer to the quiz", 'wpcf7' ) ); ?></em></label><br />
299
- <input type="text" id="wpcf7-message-quiz-answer-not-correct" name="wpcf7-message-quiz-answer-not-correct" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['quiz_answer_not_correct'] ); ?>" />
300
- </div>
301
-
302
- <div class="message-field">
303
- <label for="wpcf7-message-captcha-not-match"><em># <?php echo esc_html( __( "The code that sender entered does not match the CAPTCHA", 'wpcf7' ) ); ?></em></label><br />
304
- <input type="text" id="wpcf7-message-captcha-not-match" name="wpcf7-message-captcha-not-match" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['captcha_not_match'] ); ?>" />
305
- </div>
306
-
307
- <div class="message-field">
308
- <label for="wpcf7-message-upload-failed"><em># <?php echo esc_html( __( "Uploading a file fails for any reason", 'wpcf7' ) ); ?></em></label><br />
309
- <input type="text" id="wpcf7-message-upload-failed" name="wpcf7-message-upload-failed" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['upload_failed'] ); ?>" />
310
- </div>
311
-
312
- <div class="message-field">
313
- <label for="wpcf7-message-upload-file-type-invalid"><em># <?php echo esc_html( __( "Uploaded file is not allowed file type", 'wpcf7' ) ); ?></em></label><br />
314
- <input type="text" id="wpcf7-message-upload-file-type-invalid" name="wpcf7-message-upload-file-type-invalid" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['upload_file_type_invalid'] ); ?>" />
315
- </div>
316
-
317
- <div class="message-field">
318
- <label for="wpcf7-message-upload-file-too-large"><em># <?php echo esc_html( __( "Uploaded file is too large", 'wpcf7' ) ); ?></em></label><br />
319
- <input type="text" id="wpcf7-message-upload-file-too-large" name="wpcf7-message-upload-file-too-large" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['upload_file_too_large'] ); ?>" />
320
</div>
321
322
- <div class="message-field">
323
- <label for="wpcf7-message-upload-failed-php-error"><em># <?php echo esc_html( __( "Uploading a file fails for PHP error", 'wpcf7' ) ); ?></em></label><br />
324
- <input type="text" id="wpcf7-message-upload-failed-php-error" name="wpcf7-message-upload-failed-php-error" class="wide" size="70" value="<?php echo esc_attr( $cf->messages['upload_failed_php_error'] ); ?>" />
325
- </div>
326
327
</div>
328
</td>
@@ -350,6 +295,12 @@ if ( ! wpcf7_table_exists() ) {
350
</tbody>
351
</table>
352
353
<table class="widefat" style="margin-top: 1em;">
354
<tbody>
355
<tr>
@@ -364,9 +315,37 @@ if ( ! wpcf7_table_exists() ) {
364
365
<?php endif; ?>
366
367
- <?php do_action_ref_array( 'wpcf7_admin_after_additional_settings', array( &$cf ) ); ?>
368
-
369
</form>
370
371
<?php endif; ?>
372
</div>
3
/* No table warning */
4
if ( ! wpcf7_table_exists() ) {
5
if ( current_user_can( 'activate_plugins' ) ) {
6
+ $create_table_link_url = wpcf7_admin_url( array( 'wpcf7-create-table' => 1 ) );
7
$create_table_link_url = wp_nonce_url( $create_table_link_url, 'wpcf7-create-table' );
8
$message = sprintf(
9
__( '<strong>The database table for Contact Form 7 does not exist.</strong> You must <a href="%s">create the table</a> for it to work.', 'wpcf7' ),
25
26
?><div class="wrap wpcf7">
27
28
+ <?php screen_icon( 'edit-pages' ); ?>
29
30
+ <h2><?php echo esc_html( __( 'Contact Form 7', 'wpcf7' ) ); ?></h2>
31
32
+ <?php do_action_ref_array( 'wpcf7_admin_before_subsubsub', array( &$cf ) ); ?>
33
34
+ <ul class="subsubsub">
35
+ <?php
36
+ $first = array_shift( $contact_forms );
37
+ if ( ! is_null( $first ) ) : ?>
38
+ <li><a href="<?php echo wpcf7_admin_url( array( 'contactform' => $first->id ) ); ?>"<?php if ( $first->id == $current ) echo ' class="current"'; ?>><?php echo esc_html( $first->title ); ?></a></li>
39
+ <?php endif;
40
+ foreach ( $contact_forms as $v ) : ?>
41
+ <li>| <a href="<?php echo wpcf7_admin_url( array( 'contactform' => $v->id ) ); ?>"<?php if ( $v->id == $current ) echo ' class="current"'; ?>><?php echo esc_html( $v->title ); ?></a></li>
42
+ <?php endforeach; ?>
43
44
+ <?php if ( wpcf7_admin_has_edit_cap() ) : ?>
45
+ <li class="addnew"><a class="thickbox<?php if ( $unsaved ) echo ' current'; ?>" href="#TB_inline?height=300&width=400&inlineId=wpcf7-lang-select-modal"><?php echo esc_html( __( 'Add new', 'wpcf7' ) ); ?></a></li>
46
+ <?php endif; ?>
47
+ </ul>
48
49
+ <br class="clear" />
50
51
<?php if ( $cf ) : ?>
52
<?php $disabled = ( wpcf7_admin_has_edit_cap() ) ? '' : ' disabled="disabled"'; ?>
53
54
+ <form method="post" action="<?php echo wpcf7_admin_url( array( 'contactform' => $current ) ); ?>" id="wpcf7-admin-form-element">
55
<?php if ( wpcf7_admin_has_edit_cap() ) wp_nonce_field( 'wpcf7-save_' . $current ); ?>
56
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo $current; ?>" />
57
111
</td>
112
113
<td scope="col" style="width: 50%;">
114
+ <div id="taggenerator"></div>
115
</td>
116
117
</tr>
259
<td scope="col">
260
<div id="message-fields">
261
262
+ <?php foreach ( wpcf7_messages() as $key => $arr ) :
263
+ $field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
264
+ ?>
265
<div class="message-field">
266
+ <label for="<?php echo $field_name; ?>"><em># <?php echo esc_html( $arr['description'] ); ?></em></label><br />
267
+ <input type="text" id="<?php echo $field_name; ?>" name="<?php echo $field_name; ?>" class="wide" size="70" value="<?php echo esc_attr( $cf->messages[$key] ); ?>" />
268
</div>
269
270
+ <?php endforeach; ?>
271
272
</div>
273
</td>
295
</tbody>
296
</table>
297
298
+ <?php endif; ?>
299
+
300
+ <?php do_action_ref_array( 'wpcf7_admin_after_additional_settings', array( &$cf ) ); ?>
301
+
302
+ <?php if ( wpcf7_admin_has_edit_cap() ) : ?>
303
+
304
<table class="widefat" style="margin-top: 1em;">
305
<tbody>
306
<tr>
315
316
<?php endif; ?>
317
318
</form>
319
320
<?php endif; ?>
321
+
322
+ </div>
323
+
324
+ <div id="wpcf7-lang-select-modal" class="hidden">
325
+ <?php
326
+ $available_locales = wpcf7_l10n();
327
+ $default_locale = get_locale();
328
+
329
+ if ( ! isset( $available_locales[$default_locale] ) )
330
+ $default_locale = 'en_US';
331
+
332
+ ?>
333
+ <h4><?php echo esc_html( sprintf( __( 'Use the default language (%s)', 'wpcf7' ), $available_locales[$default_locale] ) ); ?></h4>
334
+ <p><a href="<?php echo wpcf7_admin_url( array( 'contactform' => 'new' ) ); ?>" class="button" /><?php echo esc_html( __( 'Add New', 'wpcf7' ) ); ?></a></p>
335
+
336
+ <?php unset( $available_locales[$default_locale] ); ?>
337
+ <h4><?php echo esc_html( __( 'Or', 'wpcf7' ) ); ?></h4>
338
+ <form action="" method="get">
339
+ <input type="hidden" name="page" value="wpcf7" />
340
+ <input type="hidden" name="contactform" value="new" />
341
+ <select name="locale">
342
+ <option value="" selected="selected"><?php echo esc_html( __( '(select language)', 'wpcf7' ) ); ?></option>
343
+ <?php foreach ( $available_locales as $code => $locale ) : ?>
344
+ <option value="<?php echo esc_attr( $code ); ?>"><?php echo esc_html( $locale ); ?></option>
345
+ <?php endforeach; ?>
346
+ </select>
347
+ <input type="submit" class="button" value="<?php echo esc_attr( __( 'Add New', 'wpcf7' ) ); ?>" />
348
+ </form>
349
</div>
350
+
351
+ <?php do_action_ref_array( 'wpcf7_admin_footer', array( &$cf ) ); ?>
admin/scripts.js ADDED
@@ -0,0 +1,110 @@
1
+ jQuery(document).ready(function() {
2
+ try {
3
+ jQuery.extend(jQuery.tgPanes, _wpcf7.tagGenerators);
4
+ jQuery('#taggenerator').tagGenerator(_wpcf7L10n.generateTag,
5
+ { dropdownIconUrl: _wpcf7.pluginUrl + '/images/dropdown.gif' });
6
+
7
+ jQuery('input#wpcf7-title:enabled').css({
8
+ cursor: 'pointer'
9
+ });
10
+
11
+ jQuery('input#wpcf7-title').mouseover(function() {
12
+ jQuery(this).not('.focus').css({
13
+ 'background-color': '#ffffdd'
14
+ });
15
+ });
16
+
17
+ jQuery('input#wpcf7-title').mouseout(function() {
18
+ jQuery(this).css({
19
+ 'background-color': '#fff'
20
+ });
21
+ });
22
+
23
+ jQuery('input#wpcf7-title').focus(function() {
24
+ jQuery(this).addClass('focus');
25
+ jQuery(this).css({
26
+ cursor: 'text',
27
+ color: '#333',
28
+ border: '1px solid #777',
29
+ font: 'normal 13px Verdana, Arial, Helvetica, sans-serif',
30
+ 'background-color': '#fff'
31
+ });
32
+ });
33
+
34
+ jQuery('input#wpcf7-title').blur(function() {
35
+ jQuery(this).removeClass('focus');
36
+ jQuery(this).css({
37
+ cursor: 'pointer',
38
+ color: '#555',
39
+ border: 'none',
40
+ font: 'bold 20px serif',
41
+ 'background-color': '#fff'
42
+ });
43
+ });
44
+
45
+ jQuery('input#wpcf7-title').change(function() {
46
+ updateTag();
47
+ });
48
+
49
+ updateTag();
50
+
51
+ if (! jQuery('#wpcf7-mail-2-active').is(':checked'))
52
+ jQuery('#mail-2-fields').hide();
53
+
54
+ jQuery('#wpcf7-mail-2-active').click(function() {
55
+ if (jQuery('#wpcf7-mail-2-active').is(':checked')) {
56
+ if (jQuery('#mail-2-fields').is(':hidden'))
57
+ jQuery('#mail-2-fields').slideDown('fast');
58
+ } else {
59
+ if (jQuery('#mail-2-fields').is(':visible'))
60
+ jQuery('#mail-2-fields').hide('fast');
61
+ }
62
+ });
63
+
64
+ jQuery('#message-fields-toggle-switch').text(_wpcf7L10n.show);
65
+ jQuery('#message-fields').hide();
66
+
67
+ jQuery('#message-fields-toggle-switch').click(function() {
68
+ if (jQuery('#message-fields').is(':hidden')) {
69
+ jQuery('#message-fields').slideDown('fast');
70
+ jQuery('#message-fields-toggle-switch').text(_wpcf7L10n.hide);
71
+ } else {
72
+ jQuery('#message-fields').hide('fast');
73
+ jQuery('#message-fields-toggle-switch').text(_wpcf7L10n.show);
74
+ }
75
+ });
76
+
77
+ if ('' == jQuery.trim(jQuery('#wpcf7-additional-settings').text())) {
78
+ jQuery('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.show);
79
+ jQuery('#additional-settings-fields').hide();
80
+ } else {
81
+ jQuery('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.hide);
82
+ jQuery('#additional-settings-fields').show();
83
+ }
84
+
85
+ jQuery('#additional-settings-fields-toggle-switch').click(function() {
86
+ if (jQuery('#additional-settings-fields').is(':hidden')) {
87
+ jQuery('#additional-settings-fields').slideDown('fast');
88
+ jQuery('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.hide);
89
+ } else {
90
+ jQuery('#additional-settings-fields').hide('fast');
91
+ jQuery('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.show);
92
+ }
93
+ });
94
+
95
+ } catch (e) {
96
+ }
97
+ });
98
+
99
+ function updateTag() {
100
+ var title = jQuery('input#wpcf7-title').val();
101
+
102
+ if (title)
103
+ title = title.replace(/["'\[\]]/g, '');
104
+
105
+ jQuery('input#wpcf7-title').val(title);
106
+ var current = jQuery('input#wpcf7-id').val();
107
+ var tag = '[contact-form ' + current + ' "' + title + '"]';
108
+
109
+ jQuery('input#contact-form-anchor-text').val(tag);
110
+ }
admin/{admin-stylesheet-rtl.css → styles-rtl.css} RENAMED
File without changes
admin/{admin-stylesheet.css → styles.css} RENAMED
@@ -1,3 +1,13 @@
1
div.wpcf7 div.donation {
2
border-width: 1px;
3
border-style: solid;
@@ -31,20 +41,25 @@ div.wpcf7 div.donation p em {
31
div.wpcf7 ul.subsubsub {
32
white-space: normal;
33
}
34
ul.subsubsub li.addnew {
35
margin-left: 0.5em;
36
}
37
ul.subsubsub li.addnew a {
38
color: #e6255b;
39
}
40
ul.subsubsub li.addnew a:hover,
41
ul.subsubsub li.addnew a:active {
42
color: #999;
43
}
44
div.save-contact-form {
45
padding: 1.4em 0 0 0;
46
text-align: right;
47
}
48
div.actions-link {
49
position: absolute;
50
top: 0;
@@ -52,6 +67,7 @@ div.actions-link {
52
margin: 0;
53
padding: 0;
54
}
55
div.actions-link input {
56
padding: 0;
57
margin: 0;
@@ -60,32 +76,38 @@ div.actions-link input {
60
font-size: 11px;
61
cursor: pointer;
62
}
63
div.actions-link input.copy {
64
color: #006505;
65
}
66
div.actions-link input.delete {
67
color: #bc0b0b;
68
}
69
input#wpcf7-title {
70
color: #555;
71
background-color: #fff;
72
border: none;
73
font: bold 20px serif;
74
}
75
p.tagcode {
76
color: #333;
77
margin: 2ex 0 1ex 1em;
78
}
79
input#contact-form-anchor-text {
80
color: #fff;
81
- background: #8a796d;
82
border: none;
83
- width: 96%;
84
-moz-border-radius: 6px;
85
-khtml-border-radius: 6px;
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;
@@ -93,27 +115,38 @@ span#message-fields-toggle-switch, span#additional-settings-fields-toggle-switch
93
color: #2583ad;
94
cursor: pointer;
95
}
96
div.pseudo-hr {
97
border-bottom: 1px solid #fff;
98
margin: 0.7em 0;
99
}
100
input, textarea {
101
border: 1px solid #dfdfdf;
102
}
103
input.wide {
104
width: 100%;
105
}
106
textarea {
107
width: 100%;
108
}
109
label.disabled {
110
color: #777;
111
}
112
div.tag-generator {
113
position: relative;
114
background: #fff;
115
padding: 5px 0 5px 1px;
116
}
117
div.tg-pane {
118
border: 1px dashed #999;
119
background: #f1f1f1;
@@ -124,32 +157,75 @@ div.tg-pane {
124
-webkit-border-radius: 6px;
125
border-radius: 6px;
126
}
127
div.tg-pane table {
128
width: 100%;
129
margin: 0 0 0.7em 0;
130
}
131
div.tg-pane table caption {
132
text-align: left;
133
padding: 0 0 0.2em 0;
134
font-weight: bolder;
135
color: #777;
136
}
137
div.tg-pane table code {
138
background-color: inherit;
139
}
140
div.tg-pane table td {
141
vertical-align: top;
142
width: 50%;
143
}
144
- div.tg-pane input.tag {
145
border: none;
146
color: #fff;
147
- background-color: #8a796d;
148
-moz-border-radius: 6px;
149
-khtml-border-radius: 6px;
150
-webkit-border-radius: 6px;
151
border-radius: 6px;
152
}
153
div.tg-dropdown {
154
position: absolute;
155
top: 26px;
@@ -157,14 +233,16 @@ div.tg-dropdown {
157
z-index: 10;
158
border: 1px solid #ddd;
159
}
160
span.tg-closebutton {
161
color: #777;
162
font: bold 18px monospace;
163
padding: 1px 4px;
164
cursor: pointer;
165
}
166
div.tg-panetitle {
167
font: bold 132% sans-serif;
168
margin: 0 0 10px;
169
color: #777;
170
- }
1
+ div.wpcf7 div.cf7com-links {
2
+ text-align: right;
3
+ font-size: .8em;
4
+ margin-top: -1.6em;
5
+ }
6
+
7
+ div.wpcf7 div.cf7com-links a {
8
+ text-decoration: none;
9
+ }
10
+
11
div.wpcf7 div.donation {
12
border-width: 1px;
13
border-style: solid;
41
div.wpcf7 ul.subsubsub {
42
white-space: normal;
43
}
44
+
45
ul.subsubsub li.addnew {
46
margin-left: 0.5em;
47
}
48
+
49
ul.subsubsub li.addnew a {
50
color: #e6255b;
51
}
52
+
53
ul.subsubsub li.addnew a:hover,
54
ul.subsubsub li.addnew a:active {
55
color: #999;
56
}
57
+
58
div.save-contact-form {
59
padding: 1.4em 0 0 0;
60
text-align: right;
61
}
62
+
63
div.actions-link {
64
position: absolute;
65
top: 0;
67
margin: 0;
68
padding: 0;
69
}
70
+
71
div.actions-link input {
72
padding: 0;
73
margin: 0;
76
font-size: 11px;
77
cursor: pointer;
78
}
79
+
80
div.actions-link input.copy {
81
color: #006505;
82
}
83
+
84
div.actions-link input.delete {
85
color: #bc0b0b;
86
}
87
+
88
input#wpcf7-title {
89
color: #555;
90
background-color: #fff;
91
border: none;
92
font: bold 20px serif;
93
}
94
+
95
p.tagcode {
96
color: #333;
97
margin: 2ex 0 1ex 1em;
98
}
99
+
100
input#contact-form-anchor-text {
101
color: #fff;
102
+ background: #7e4e0b;
103
border: none;
104
+ width: 99%;
105
-moz-border-radius: 6px;
106
-khtml-border-radius: 6px;
107
-webkit-border-radius: 6px;
108
border-radius: 6px;
109
}
110
+
111
span#message-fields-toggle-switch, span#additional-settings-fields-toggle-switch {
112
margin-left: 1em;
113
font-weight: normal;
115
color: #2583ad;
116
cursor: pointer;
117
}
118
+
119
div.pseudo-hr {
120
border-bottom: 1px solid #fff;
121
margin: 0.7em 0;
122
}
123
+
124
input, textarea {
125
border: 1px solid #dfdfdf;
126
}
127
+
128
input.wide {
129
width: 100%;
130
}
131
+
132
textarea {
133
width: 100%;
134
}
135
+
136
label.disabled {
137
color: #777;
138
}
139
+
140
+ div.message-field {
141
+ margin: .2em 0 .4em;
142
+ }
143
+
144
div.tag-generator {
145
position: relative;
146
background: #fff;
147
padding: 5px 0 5px 1px;
148
}
149
+
150
div.tg-pane {
151
border: 1px dashed #999;
152
background: #f1f1f1;
157
-webkit-border-radius: 6px;
158
border-radius: 6px;
159
}
160
+
161
div.tg-pane table {
162
width: 100%;
163
margin: 0 0 0.7em 0;
164
}
165
+
166
div.tg-pane table caption {
167
text-align: left;
168
padding: 0 0 0.2em 0;
169
font-weight: bolder;
170
color: #777;
171
}
172
+
173
div.tg-pane table code {
174
background-color: inherit;
175
}
176
+
177
div.tg-pane table td {
178
vertical-align: top;
179
width: 50%;
180
+ border: none;
181
}
182
+
183
+ div.tg-pane input.tag, div.tg-pane input.mail-tag {
184
+ width: 100%;
185
border: none;
186
color: #fff;
187
+ background-color: #7e4e0b;
188
-moz-border-radius: 6px;
189
-khtml-border-radius: 6px;
190
-webkit-border-radius: 6px;
191
border-radius: 6px;
192
}
193
+
194
+ div.tg-pane input.mail-tag {
195
+ width: 50%;
196
+ background-color: #404f03;
197
+ }
198
+
199
+ div.tg-mail-tag {
200
+ margin-top: 2.4em;
201
+ text-align: right;
202
+ }
203
+
204
+ div.tg-pane span.arrow {
205
+ font-family: monospace;
206
+ font-size: 1.2em;
207
+ color: #333;
208
+ }
209
+
210
+ div.tg-pane input.tg-name {
211
+ border-color: #555;
212
+ }
213
+
214
+ div.tg-pane input.oneline {
215
+ width: 98%;
216
+ font-size: smaller;
217
+ }
218
+
219
+ div.tg-pane textarea {
220
+ width: 98%;
221
+ height: 100px;
222
+ font-size: smaller;
223
+ }
224
+
225
+ div.tg-pane div.tg-tag {
226
+ margin: .4em 0;
227
+ }
228
+
229
div.tg-dropdown {
230
position: absolute;
231
top: 26px;
233
z-index: 10;
234
border: 1px solid #ddd;
235
}
236
+
237
span.tg-closebutton {
238
color: #777;
239
font: bold 18px monospace;
240
padding: 1px 4px;
241
cursor: pointer;
242
}
243
+
244
div.tg-panetitle {
245
font: bold 132% sans-serif;
246
margin: 0 0 10px;
247
color: #777;
248
+ }
admin/taggenerator.js ADDED
@@ -0,0 +1,258 @@
1
+ (function($) {
2
+
3
+ $.fn.tagGenerator = function(title, options) {
4
+ var menu = $('<div class="tag-generator"></div>');
5
+
6
+ var selector = $('<span>' + title + '</span>');
7
+
8
+ selector.css({
9
+ border: '1px solid #ddd',
10
+ padding: '2px 4px',
11
+ background: '#fff url( ../wp-admin/images/fade-butt.png ) repeat-x 0 0',
12
+ '-moz-border-radius': '3px',
13
+ '-khtml-border-radius': '3px',
14
+ '-webkit-border-radius': '3px',
15
+ 'border-radius': '3px'
16
+ });
17
+
18
+ selector.mouseover(function() {
19
+ $(this).css({ 'border-color': '#bbb' });
20
+ });
21
+ selector.mouseout(function() {
22
+ $(this).css({ 'border-color': '#ddd' });
23
+ });
24
+ selector.mousedown(function() {
25
+ $(this).css({ background: '#ddd' });
26
+ });
27
+ selector.mouseup(function() {
28
+ $(this).css({
29
+ background: '#fff url( ../wp-admin/images/fade-butt.png ) repeat-x 0 0'
30
+ });
31
+ });
32
+ selector.click(function() {
33
+ dropdown.slideDown('fast');
34
+ return false;
35
+ });
36
+ $('body').click(function() {
37
+ dropdown.hide();
38
+ });
39
+
40
+ if (options.dropdownIconUrl) {
41
+ var dropdown_icon = $('<img src="' + options.dropdownIconUrl + '" />');
42
+ dropdown_icon.css({ 'vertical-align': 'bottom' });
43
+ selector.append(dropdown_icon);
44
+ }
45
+
46
+ menu.append(selector);
47
+
48
+ var pane = $('<div class="tg-pane"></div>');
49
+ pane.hide();
50
+ menu.append(pane);
51
+
52
+ var dropdown = $('<div class="tg-dropdown"></div>');
53
+ dropdown.hide();
54
+ menu.append(dropdown);
55
+
56
+ $.each($.tgPanes, function(i, n) {
57
+ var submenu = $('<div>' + $.tgPanes[i].title + '</div>');
58
+ submenu.css({
59
+ margin: 0,
60
+ padding: '0 4px',
61
+ 'line-height': '180%',
62
+ background: '#fff'
63
+ });
64
+ submenu.mouseover(function() {
65
+ $(this).css({ background: '#d4f2f2' });
66
+ });
67
+ submenu.mouseout(function() {
68
+ $(this).css({ background: '#fff' });
69
+ });
70
+ submenu.click(function() {
71
+ dropdown.hide();
72
+ pane.hide();
73
+ pane.empty();
74
+ $.tgPane(pane, i);
75
+ pane.slideDown('fast');
76
+ return false;
77
+ });
78
+ dropdown.append(submenu);
79
+ });
80
+
81
+ this.append(menu);
82
+ };
83
+
84
+ $.tgPane = function(pane, tagType) {
85
+ var closeButtonDiv = $('<div></div>');
86
+ closeButtonDiv.css({ float: 'right' });
87
+
88
+ var closeButton = $('<span class="tg-closebutton">&#215;</span>');
89
+ closeButton.click(function() {
90
+ pane.slideUp('fast').empty();
91
+ });
92
+ closeButtonDiv.append(closeButton);
93
+
94
+ pane.append(closeButtonDiv);
95
+
96
+ var paneTitle = $('<div class="tg-panetitle">' + $.tgPanes[tagType].title + '</div>');
97
+ pane.append(paneTitle);
98
+
99
+ pane.append($('#' + $.tgPanes[tagType].content).clone().contents());
100
+
101
+ pane.find(':checkbox.exclusive').change(function() {
102
+ if ($(this).is(':checked'))
103
+ $(this).siblings(':checkbox.exclusive').removeAttr('checked');
104
+ });
105
+
106
+ if ($.isFunction($.tgPanes[tagType].change))
107
+ $.tgPanes[tagType].change(pane, tagType);
108
+ else
109
+ $.tgCreateTag(pane, tagType);
110
+
111
+ pane.find(':input').change(function() {
112
+ if ($.isFunction($.tgPanes[tagType].change))
113
+ $.tgPanes[tagType].change(pane, tagType);
114
+ else
115
+ $.tgCreateTag(pane, tagType);
116
+ });
117
+ }
118
+
119
+ $.tgCreateTag = function(pane, tagType) {
120
+ pane.find(':input').empty();
121
+
122
+ pane.find('input[name="name"]').each(function(i) {
123
+ var val = $(this).val();
124
+ val = val.replace(/[^0-9a-zA-Z:._-]/g, '').replace(/^[^a-zA-Z]+/, '');
125
+ if ('' == val) {
126
+ var rand = Math.floor(Math.random() * 1000);
127
+ val = tagType + '-' + rand;
128
+ }
129
+ $(this).val(val);
130
+ });
131
+
132
+ pane.find(':input.numeric').each(function(i) {
133
+ var val = $(this).val();
134
+ val = val.replace(/[^0-9]/g, '');
135
+ $(this).val(val);
136
+ });
137
+
138
+ pane.find(':input.idvalue').each(function(i) {
139
+ var val = $(this).val();
140
+ val = val.replace(/[^-0-9a-zA-Z_]/g, '');
141
+ $(this).val(val);
142
+ });
143
+
144
+ pane.find(':input.classvalue').each(function(i) {
145
+ var val = $(this).val();
146
+ val = $.map(val.split(' '), function(n) {
147
+ return n.replace(/[^-0-9a-zA-Z_]/g, '');
148
+ }).join(' ');
149
+ val = $.trim(val.replace(/\s+/g, ' '));
150
+ $(this).val(val);
151
+ });
152
+
153
+ pane.find(':input.color').each(function(i) {
154
+ var val = $(this).val();
155
+ val = val.replace(/[^0-9a-fA-F]/g, '');
156
+ $(this).val(val);
157
+ });
158
+
159
+ pane.find(':input.filesize').each(function(i) {
160
+ var val = $(this).val();
161
+ val = val.replace(/[^0-9kKmMbB]/g, '');
162
+ $(this).val(val);
163
+ });
164
+
165
+ pane.find(':input.filetype').each(function(i) {
166
+ var val = $(this).val();
167
+ val = val.replace(/[^0-9a-zA-Z.\s]/g, '');
168
+ $(this).val(val);
169
+ });
170
+
171
+ pane.find(':input[name="values"]').each(function(i) {
172
+ var val = $(this).val();
173
+ val = $.trim(val);
174
+ $(this).val(val);
175
+ });
176
+
177
+ pane.find('input.tag').each(function(i) {
178
+ var type = $(this).attr('name');
179
+
180
+ var scope = pane.find('.scope.' + type);
181
+ if (! scope.length)
182
+ scope = pane;
183
+
184
+ if (pane.find(':input[name="required"]').is(':checked'))
185
+ type += '*';
186
+
187
+ var name = pane.find(':input[name="name"]').val();
188
+
189
+ var options = [];
190
+
191
+ var size = scope.find(':input[name="size"]').val();
192
+ var maxlength = scope.find(':input[name="maxlength"]').val();
193
+ if (size || maxlength)
194
+ options.push(size + '/' + maxlength);
195
+
196
+ var cols = scope.find(':input[name="cols"]').val();
197
+ var rows = scope.find(':input[name="rows"]').val();
198
+ if (cols || rows)
199
+ options.push(cols + 'x' + rows);
200
+
201
+ scope.find('input:text.option').each(function(i) {
202
+ if (-1 < $.inArray($(this).attr('name'), ['size', 'maxlength', 'cols', 'rows']))
203
+ return;
204
+
205
+ var val = $(this).val();
206
+
207
+ if (! val)
208
+ return;
209
+
210
+ if ($(this).hasClass('filetype'))
211
+ val = val.split(' ').join('|');
212
+
213
+ if ($(this).hasClass('color'))
214
+ val = '#' + val;
215
+
216
+ if ('class' == $(this).attr('name')) {
217
+ $.each(val.split(' '), function(i, n) { options.push('class:' + n) });
218
+ } else {
219
+ options.push($(this).attr('name') + ':' + val);
220
+ }
221
+ });
222
+
223
+ scope.find('input:checkbox.option').each(function(i) {
224
+ if ($(this).is(':checked'))
225
+ options.push($(this).attr('name'));
226
+ });
227
+
228
+ options = (options.length > 0) ? ' ' + options.join(' ') : '';
229
+
230
+ var value = '';
231
+
232
+ if (scope.find(':input[name="values"]').val()) {
233
+ $.each(scope.find(':input[name="values"]').val().split("\n"), function(i, n) {
234
+ value += ' "' + n.replace(/["]/g, '&quot;') + '"';
235
+ });
236
+ }
237
+
238
+ if ($.tgPanes[tagType].nameless)
239
+ var tag = '[' + type + options + value + ']';
240
+ else
241
+ var tag = name ? '[' + type + ' ' + name + options + value + ']' : '';
242
+
243
+ $(this).val(tag);
244
+ });
245
+
246
+ pane.find('input.mail-tag').each(function(i) {
247
+ var name = pane.find(':input[name="name"]').val();
248
+
249
+ var tag = name ? '[' + name + ']' : '';
250
+
251
+ $(this).val(tag);
252
+ });
253
+
254
+ }
255
+
256
+ $.tgPanes = {};
257
+
258
+ })(jQuery);
admin/wpcf7-admin.js DELETED
@@ -1,796 +0,0 @@
1
- jQuery(document).ready(function() {
2
- try {
3
- jQuery('#tag-generator-div').append(tagGenerator());
4
-
5
- jQuery('input#wpcf7-title:enabled').css({
6
- cursor: 'pointer'
7
- });
8
-
9
- jQuery('input#wpcf7-title').mouseover(function() {
10
- jQuery(this).not('.focus').css({
11
- 'background-color': '#ffffdd'
12
- });
13
- });
14
-
15
- jQuery('input#wpcf7-title').mouseout(function() {
16
- jQuery(this).css({
17
- 'background-color': '#fff'
18
- });
19
- });
20
-
21
- jQuery('input#wpcf7-title').focus(function() {
22
- jQuery(this).addClass('focus');
23
- jQuery(this).css({
24
- cursor: 'text',
25
- color: '#333',
26
- border: '1px solid #777',
27
- font: 'normal 13px Verdana, Arial, Helvetica, sans-serif',
28
- 'background-color': '#fff'
29
- });
30
- });
31
-
32
- jQuery('input#wpcf7-title').blur(function() {
33
- jQuery(this).removeClass('focus');
34
- jQuery(this).css({
35
- cursor: 'pointer',
36
- color: '#555',
37
- border: 'none',
38
- font: 'bold 20px serif',
39
- 'background-color': '#fff'
40
- });
41
- });
42
-
43
- jQuery('input#wpcf7-title').change(function() {
44
- updateTag();
45
- });
46
-
47
- updateTag();
48
-
49
- if (! jQuery('#wpcf7-mail-2-active').is(':checked'))
50
- jQuery('#mail-2-fields').hide();
51
-
52
- jQuery('#wpcf7-mail-2-active').click(function() {
53
- if (jQuery('#wpcf7-mail-2-active').is(':checked')) {
54
- if (jQuery('#mail-2-fields').is(':hidden'))
55
- jQuery('#mail-2-fields').slideDown('fast');
56
- } else {
57
- if (jQuery('#mail-2-fields').is(':visible'))
58
- jQuery('#mail-2-fields').hide('fast');
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
-
93
- } catch (e) {
94
- }
95
- });
96
-
97
- function updateTag() {
98
- var title = jQuery('input#wpcf7-title').val();
99
- if (title)
100
- title = title.replace(/["'\[\]]/g, '');
101
- jQuery('input#wpcf7-title').val(title);
102
- var current = jQuery('input#wpcf7-id').val();
103
- var tag = '[contact-form ' + current + ' "' + title + '"]';
104
- jQuery('input#contact-form-anchor-text').val(tag);
105
- }
106
-
107
- function tagGenerator() {
108
- var menu = jQuery('<div class="tag-generator"></div>');
109
-
110
- var dropdown_icon = jQuery('<img src="' + _wpcf7.pluginUrl + '/images/dropdown.gif" />');
111
- dropdown_icon.css({ 'vertical-align': 'bottom' });
112
-
113
- var selector = jQuery('<span>' + _wpcf7L10n.generateTag + '</span>');
114
- selector.append(dropdown_icon);
115
- selector.css({
116
- border: '1px solid #ddd',
117
- padding: '2px 4px',
118
- background: '#fff url( ../wp-admin/images/fade-butt.png ) repeat-x 0 0',
119
- '-moz-border-radius': '3px',
120
- '-khtml-border-radius': '3px',
121
- '-webkit-border-radius': '3px',
122
- 'border-radius': '3px'
123
- });
124
- selector.mouseover(function() {
125
- jQuery(this).css({ 'border-color': '#bbb' });
126
- });
127
- selector.mouseout(function() {
128
- jQuery(this).css({ 'border-color': '#ddd' });
129
- });
130
- selector.mousedown(function() {
131
- jQuery(this).css({ background: '#ddd' });
132
- });
133
- selector.mouseup(function() {
134
- jQuery(this).css({ background: '#fff url( ../wp-admin/images/fade-butt.png ) repeat-x 0 0' });
135
- });
136
- selector.click(function() {
137
- dropdown.slideDown('fast');
138
- return false;
139
- });
140
- jQuery('body').click(function() {
141
- dropdown.hide();
142
- });
143
- menu.append(selector);
144
-
145
- var pane = jQuery('<div class="tg-pane"></div>');
146
- pane.hide();
147
- menu.append(pane);
148
-
149
- var dropdown = jQuery('<div class="tg-dropdown"></div>');
150
- dropdown.hide();
151
-
152
- var tag_types = [
153
- 'textField', 'emailField', 'textArea', 'menu', 'checkboxes', 'radioButtons',
154
- 'acceptance', 'quiz', 'captcha', 'fileUpload', 'submit'];
155
-
156
- jQuery.each(tag_types, function(i, n) {
157
- var submenu = jQuery('<div>' + _wpcf7L10n[n] + '</div>');
158
- submenu.css({
159
- margin: 0,
160
- padding: '0 4px',
161
- 'line-height': '180%',
162
- background: '#fff'
163
- });
164
- submenu.mouseover(function() {
165
- jQuery(this).css({ background: '#d4f2f2' });
166
- });
167
- submenu.mouseout(function() {
168
- jQuery(this).css({ background: '#fff' });
169
- });
170
- submenu.click(function() {
171
- dropdown.hide();
172
- pane.hide();
173
- pane.empty();
174
- tgPane(pane, n);
175
- pane.slideDown('fast');
176
- return false;
177
- });
178
- dropdown.append(submenu);
179
- });
180
-
181
- menu.append(dropdown);
182
-
183
- return menu;
184
- }
185
-
186
- function tgPane(pane, tagType) {
187
- var closeButtonDiv = jQuery('<div></div>');
188
- closeButtonDiv.css({ float: 'right' });
189
- var closeButton = jQuery('<span class="tg-closebutton">&#215;</span>');
190
- closeButton.click(function() {
191
- pane.slideUp('fast').empty();
192
- });
193
- closeButtonDiv.append(closeButton);
194
- pane.append(closeButtonDiv);
195
-
196
- var paneTitle = jQuery('<div class="tg-panetitle">' + _wpcf7L10n[tagType] + '</div>');
197
- pane.append(paneTitle);
198
-
199
- var tgInputs = {};
200
- jQuery.each([ 'tagName', 'tagId', 'tagClasses', 'tagId2', 'tagClasses2', 'defaultValue',
201
- 'tagSize', 'tagMaxLength', 'tagFileSizeLimit', 'tagAcceptableFileTypes', 'tagCols', 'tagRows', 'label', 'fgColor', 'bgColor' ], function(i, n) {
202
- tgInputs[n] = jQuery('<input type="text" />');
203
- tgInputs[n].css({ width: '98%', 'font-size': 'smaller' });
204
- tgInputs[n].change(function() {
205
- tgCreateTag(tagType, tgInputs, n);
206
- });
207
- });
208
- tgInputs.tagName.css({ 'border-color': '#555' });
209
- jQuery.each([ 'isRequiredField', 'allowsMultipleSelections', 'insertFirstBlankOption', 'makeCheckboxesExclusive',
210
- 'isAcceptanceDefaultOn', 'isAcceptanceInvert',
211
- 'akismetAuthor', 'akismetAuthorEmail', 'akismetAuthorUrl',
212
- 'imageSizeSmall', 'imageSizeMedium', 'imageSizeLarge' ], function(i, n) {
213
- tgInputs[n] = jQuery('<input type="checkbox" />');
214
- tgInputs[n].change(function() {
215
- tgCreateTag(tagType, tgInputs, n);
216
- });
217
- });
218
- jQuery.each([ 'menuChoices' ], function(i, n) {
219
- tgInputs[n] = jQuery('<textarea></textarea>');
220
- tgInputs[n].css({ width: '98%', height: '100px', 'font-size': 'smaller' });
221
- tgInputs[n].change(function() {
222
- tgCreateTag(tagType, tgInputs, n);
223
- });
224
- });
225
- jQuery.each([ 'tag1st', 'tag2nd' ], function(i, n) {
226
- tgInputs[n] = jQuery('<input type="text" class="tag" readonly="readonly" onfocus="this.select()" />');
227
- tgInputs[n].css({ width: '98%' });
228
- });
229
-
230
- switch (tagType) {
231
- case 'textField':
232
- case 'emailField':
233
- var table1 = jQuery('<table></table>');
234
- pane.append(table1);
235
- table1.append(tgTr(
236
- jQuery('<span>&nbsp;' + _wpcf7L10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
237
- ));
238
- table1.append(tgTr(
239
- jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
240
- jQuery('<span></span>')
241
- ));
242
-
243
- var table2 = jQuery('<table></table>');
244
- pane.append(table2);
245
- table2.append(tgTr(
246
- jQuery('<span><code>size</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagSize),
247
- jQuery('<span><code>maxlength</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagMaxLength)
248
- ));
249
- table2.append(tgTr(
250
- jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
251
- jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
252
- ));
253
- var akismetOpts = jQuery('<span>' + _wpcf7L10n.akismet + ' (' + _wpcf7L10n.optional + ')<br /></span>');
254
- if ('textField' == tagType) {
255
- akismetOpts.append(tgInputs.akismetAuthor).append('&nbsp;' + _wpcf7L10n.akismetAuthor);
256
- akismetOpts.append('<br />');
257
- akismetOpts.append(tgInputs.akismetAuthorUrl).append('&nbsp;' + _wpcf7L10n.akismetAuthorUrl);
258
- } else if ('emailField' == tagType) {
259
- akismetOpts.append(tgInputs.akismetAuthorEmail).append('&nbsp;' + _wpcf7L10n.akismetAuthorEmail);
260
- }
261
- table2.append(tgTr(
262
- akismetOpts,
263
- jQuery('<span>' + _wpcf7L10n.defaultValue + ' (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.defaultValue)
264
- ));
265
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
266
- break;
267
- case 'textArea':
268
- var table1 = jQuery('<table></table>');
269
- pane.append(table1);
270
- table1.append(tgTr(
271
- jQuery('<span>&nbsp;' + _wpcf7L10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
272
- ));
273
- table1.append(tgTr(
274
- jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
275
- jQuery('<span></span>')
276
- ));
277
-
278
- var table2 = jQuery('<table></table>');
279
- pane.append(table2);
280
- table2.append(tgTr(
281
- jQuery('<span><code>cols</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagCols),
282
- jQuery('<span><code>rows</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagRows)
283
- ));
284
- table2.append(tgTr(
285
- jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
286
- jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
287
- ));
288
- table2.append(tgTr(
289
- jQuery('<span>' + _wpcf7L10n.defaultValue + ' (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.defaultValue)
290
- ));
291
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
292
- break;
293
- case 'menu':
294
- case 'checkboxes':
295
- case 'radioButtons':
296
- var table1 = jQuery('<table></table>');
297
- pane.append(table1);
298
- if ('radioButtons' != tagType)
299
- table1.append(tgTr(
300
- jQuery('<span>&nbsp;' + _wpcf7L10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
301
- ));
302
- table1.append(tgTr(
303
- jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
304
- jQuery('<span></span>')
305
- ));
306
-
307
- var table2 = jQuery('<table></table>');
308
- pane.append(table2);
309
- table2.append(tgTr(
310
- jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
311
- jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
312
- ));
313
-
314
- if ('menu' == tagType) {
315
- var menuOpt1 = jQuery('<span>&nbsp;' + _wpcf7L10n.allowsMultipleSelections + '</span>').prepend(tgInputs.allowsMultipleSelections).prepend('<br />');
316
- var menuOpt2 = jQuery('<span>&nbsp;' + _wpcf7L10n.insertFirstBlankOption + '</span>').prepend(tgInputs.insertFirstBlankOption).prepend('<br />');
317
-
318
- table2.append(tgTr(
319
- jQuery('<span>' + _wpcf7L10n.menuChoices + '<br /></span>').append(tgInputs.menuChoices)
320
- .append('<br /><span style="font-size: smaller">' + _wpcf7L10n.oneChoicePerLine + '</span>'),
321
- menuOpt1.append(menuOpt2)
322
- ));
323
- } else if ('checkboxes' == tagType) {
324
- table2.append(tgTr(
325
- jQuery('<span>' + _wpcf7L10n.menuChoices + '<br /></span>').append(tgInputs.menuChoices)
326
- .append('<br /><span style="font-size: smaller">' + _wpcf7L10n.oneChoicePerLine + '</span>'),
327
- jQuery('<span>&nbsp;' + _wpcf7L10n.makeCheckboxesExclusive + '</span>').prepend(tgInputs.makeCheckboxesExclusive).prepend('<br />')
328
- ));
329
- } else {
330
- table2.append(tgTr(
331
- jQuery('<span>' + _wpcf7L10n.menuChoices + '<br /></span>').append(tgInputs.menuChoices)
332
- .append('<br /><span style="font-size: smaller">' + _wpcf7L10n.oneChoicePerLine + '</span>')
333
- ));
334
- }
335
-
336
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
337
- break;
338
- case 'acceptance':
339
- var table1 = jQuery('<table></table>');
340
- pane.append(table1);
341
-
342
- table1.append(tgTr(
343
- jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
344
- jQuery('<span></span>')
345
- ));
346
-
347
- var table2 = jQuery('<table></table>');
348
- pane.append(table2);
349
- table2.append(tgTr(
350
- jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
351
- jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
352
- ));
353
-
354
- var menuOpt1 = jQuery('<span>&nbsp;' + _wpcf7L10n.isAcceptanceDefaultOn + '</span>').prepend(tgInputs.isAcceptanceDefaultOn).prepend('<br />');
355
- var menuOpt2 = jQuery('<span>&nbsp;' + _wpcf7L10n.isAcceptanceInvert + '</span>').prepend(tgInputs.isAcceptanceInvert).prepend('<br />');
356
- menuOpt2.append('<br /><span style="font-size: smaller;">' + _wpcf7L10n.isAcceptanceInvertMeans + '</span>');
357
-
358
- table2.append(jQuery('<tr></tr>').append(jQuery('<td colspan="2"></td>').append(menuOpt1).append(menuOpt2)));
359
-
360
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
361
- break;
362
- case 'quiz':
363
- var table1 = jQuery('<table></table>');
364
- pane.append(table1);
365
-
366
- table1.append(tgTr(
367
- jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
368
- jQuery('<span></span>')
369
- ));
370
-
371
- var table2 = jQuery('<table></table>');
372
- pane.append(table2);
373
- table2.append(tgTr(
374
- jQuery('<span><code>size</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagSize),
375
- jQuery('<span><code>maxlength</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagMaxLength)
376
- ));
377
- table2.append(tgTr(
378
- jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
379
- jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
380
- ));
381
- table2.append(tgTr(
382
- jQuery('<span>' + _wpcf7L10n.quizzes + '<br /></span>').append(tgInputs.menuChoices)
383
- .append('<br /><span style="font-size: smaller">' + _wpcf7L10n.quizFormatDesc + '</span>')
384
- ));
385
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
386
- break;
387
- case 'captcha':
388
- var table1 = jQuery('<table></table>');
389
- pane.append(table1);
390
-
391
- if (! _wpcf7.captchaMod) {
392
- table1.append('<tr><td colspan="2"><strong style="color: #e6255b">' +
393
- _wpcf7L10n.needReallySimpleCaptcha + '</strong><br />' +
394
- '<a href="http://wordpress.org/extend/plugins/really-simple-captcha/">' +
395
- 'http://wordpress.org/extend/plugins/really-simple-captcha/</a></td></tr>');
396
- }
397
-
398
- table1.append(tgTr(
399
- jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
400
- jQuery('<span></span>')
401
- ));
402
-
403
- var table2 = jQuery('<table></table>');
404
- pane.append(table2);
405
- table2.append('<caption>' + _wpcf7L10n.imageSettings + '</caption>');
406
- var imageSizeOpts = jQuery('<span>' + _wpcf7L10n.imageSize + ' (' + _wpcf7L10n.optional + ')<br /></span>');
407
- imageSizeOpts.append(tgInputs.imageSizeSmall).append('&nbsp;' + _wpcf7L10n.imageSizeSmall);
408
- imageSizeOpts.append('&emsp;');
409
- imageSizeOpts.append(tgInputs.imageSizeMedium).append('&nbsp;' + _wpcf7L10n.imageSizeMedium);
410
- imageSizeOpts.append('&emsp;');
411
- imageSizeOpts.append(tgInputs.imageSizeLarge).append('&nbsp;' + _wpcf7L10n.imageSizeLarge);
412
- table2.append(jQuery('<tr></tr>').append(jQuery('<td colspan="2"></td>').append(imageSizeOpts)));
413
- table2.append(tgTr(
414
- jQuery('<span>' + _wpcf7L10n.fgColor + ' (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.fgColor),
415
- jQuery('<span>' + _wpcf7L10n.bgColor + ' (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.bgColor)
416
- ));
417
- table2.append(tgTr(
418
- jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
419
- jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
420
- ));
421
-
422
- var table3 = jQuery('<table></table>');
423
- pane.append(table3);
424
- table3.append('<caption>' + _wpcf7L10n.inputFieldSettings + '</caption>');
425
- table3.append(tgTr(
426
- jQuery('<span><code>size</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagSize),
427
- jQuery('<span><code>maxlength</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagMaxLength)
428
- ));
429
- table3.append(tgTr(
430
- jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId2),
431
- jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses2)
432
- ));
433
- pane.append(
434
- jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '</div>')
435
- .append('<br />').append('1) ' + _wpcf7L10n.tagForImage)
436
- .append(tgInputs.tag1st)
437
- .append('<br />').append('2) ' + _wpcf7L10n.tagForInputField)
438
- .append(tgInputs.tag2nd)
439
- );
440
- break;
441
- case 'fileUpload':
442
- var table1 = jQuery('<table></table>');
443
- pane.append(table1);
444
- table1.append(tgTr(
445
- jQuery('<span>&nbsp;' + _wpcf7L10n.isRequiredField + '</span>').prepend(tgInputs.isRequiredField)
446
- ));
447
- table1.append(tgTr(
448
- jQuery('<span>' + _wpcf7L10n.tagName + '<br /></span>').append(tgInputs.tagName),
449
- jQuery('<span></span>')
450
- ));
451
-
452
- var table2 = jQuery('<table></table>');
453
- pane.append(table2);
454
- table2.append(tgTr(
455
- jQuery('<span>' + _wpcf7L10n.fileSizeLimit + ' (' + _wpcf7L10n.bytes + ') (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagFileSizeLimit),
456
- jQuery('<span>' + _wpcf7L10n.acceptableFileTypes + ' (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagAcceptableFileTypes)
457
- ));
458
- table2.append(tgTr(
459
- jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
460
- jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
461
- ));
462
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
463
- break;
464
- case 'submit':
465
- var table = jQuery('<table></table>');
466
- pane.append(table);
467
-
468
- table.append(tgTr(
469
- jQuery('<span><code>id</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagId),
470
- jQuery('<span><code>class</code> (' + _wpcf7L10n.optional + ')<br /></span>').append(tgInputs.tagClasses)
471
- ));
472
-
473
- table.append(tgTr(
474
- jQuery('<span>' + _wpcf7L10n.label + '<br /></span>').append(tgInputs.label),
475
- jQuery('<span></span>')
476
- ));
477
- pane.append(jQuery('<div class="tg-tag">' + _wpcf7L10n.generatedTag + '<br /></div>').append(tgInputs.tag1st));
478
- break;
479
- }
480
-
481
- tgCreateTag(tagType, tgInputs);
482
- }
483
-
484
- function tgTr() {
485
- var tr = jQuery('<tr></tr>');
486
- jQuery.each(arguments, function(i, n) {
487
- var td = jQuery('<td></td>').append(n);
488
- tr.append(td);
489
- });
490
- return tr;
491
- }
492
-
493
- function tgCreateTag(tagType, tgInputs, trigger) {
494
- tgInputs.tag1st.empty();
495
- tgInputs.tag2nd.empty();
496
-
497
- jQuery.each([ 'tagName' ], function(i, n) {
498
- var val = tgInputs[n].val();
499
- val = val.replace(/[^0-9a-zA-Z:._-]/g, '').replace(/^[^a-zA-Z]+/, '');
500
- if ('' == val)
501
- val = tgDefaultName(tagType);
502
- tgInputs[n].val(val);
503
- });
504
-
505
- jQuery.each([ 'tagSize', 'tagMaxLength', 'tagCols', 'tagRows' ], function(i, n) {
506
- var val = tgInputs[n].val();
507
- val = val.replace(/[^0-9]/g, '');
508
- tgInputs[n].val(val);
509
- });
510
-
511
- jQuery.each([ 'tagId', 'tagId2' ], function(i, n) {
512
- var val = tgInputs[n].val();
513
- val = val.replace(/[^-0-9a-zA-Z_]/g, '');
514
- tgInputs[n].val(val);
515
- });
516
-
517
- jQuery.each([ 'tagClasses', 'tagClasses2' ], function(i, n) {
518
- var val = tgInputs[n].val();
519
- val = jQuery.map(val.split(' '), function(n) {
520
- return n.replace(/[^-0-9a-zA-Z_]/g, '');
521
- }).join(' ');
522
- val = jQuery.trim(val.replace(/\s+/g, ' '));
523
- tgInputs[n].val(val);
524
- });
525
-
526
- jQuery.each([ 'fgColor', 'bgColor' ], function(i, n) {
527
- var val = tgInputs[n].val();
528
- val = val.replace(/[^0-9a-fA-F]/g, '');
529
- tgInputs[n].val(val);
530
- });
531
-
532
- jQuery.each([ 'tagFileSizeLimit' ], function(i, n) {
533
- var val = tgInputs[n].val();
534
- val = val.replace(/[^0-9kKmMbB]/g, '');
535
- tgInputs[n].val(val);
536
- });
537
-
538
- jQuery.each([ 'tagAcceptableFileTypes' ], function(i, n) {
539
- var val = tgInputs[n].val();
540
- val = val.replace(/[^0-9a-zA-Z.\s]/g, '');
541
- tgInputs[n].val(val);
542
- });
543
-
544
- if ('akismetAuthor' == trigger && tgInputs.akismetAuthor.is(':checked')) {
545
- tgInputs.akismetAuthorUrl.removeAttr('checked');
546
- tgInputs.akismetAuthorEmail.removeAttr('checked');
547
- } else if ('akismetAuthorUrl' == trigger && tgInputs.akismetAuthorUrl.is(':checked')) {
548
- tgInputs.akismetAuthor.removeAttr('checked');
549
- tgInputs.akismetAuthorEmail.removeAttr('checked');
550
- } else if ('akismetAuthorEmail' == trigger && tgInputs.akismetAuthorEmail.is(':checked')) {
551
- tgInputs.akismetAuthor.removeAttr('checked');
552
- tgInputs.akismetAuthorUrl.removeAttr('checked');
553
- }
554
-
555
- if ('imageSizeSmall' == trigger && tgInputs.imageSizeSmall.is(':checked')) {
556
- tgInputs.imageSizeMedium.removeAttr('checked');
557
- tgInputs.imageSizeLarge.removeAttr('checked');
558
- } else if ('imageSizeMedium' == trigger && tgInputs.imageSizeMedium.is(':checked')) {
559
- tgInputs.imageSizeSmall.removeAttr('checked');
560
- tgInputs.imageSizeLarge.removeAttr('checked');
561
- } else if ('imageSizeLarge' == trigger && tgInputs.imageSizeLarge.is(':checked')) {
562
- tgInputs.imageSizeSmall.removeAttr('checked');
563
- tgInputs.imageSizeMedium.removeAttr('checked');
564
- }
565
-
566
- switch (tagType) {
567
- case 'textField':
568
- case 'emailField':
569
- var type = ('emailField' == tagType) ? 'email' : 'text';
570
- if (tgInputs.isRequiredField.is(':checked'))
571
- type += '*';
572
- var name = tgInputs.tagName.val();
573
- var options = [];
574
- if (tgInputs.tagSize.val() || tgInputs.tagMaxLength.val())
575
- options.push(tgInputs.tagSize.val() + '/' + tgInputs.tagMaxLength.val());
576
- if (tgInputs.tagId.val())
577
- options.push('id:' + tgInputs.tagId.val());
578
- if (tgInputs.tagClasses.val())
579
- jQuery.each(tgInputs.tagClasses.val().split(' '), function(i, n) {
580
- options.push('class:' + n);
581
- });
582
- if (tgInputs.akismetAuthor.is(':checked'))
583
- options.push('akismet:author');
584
- if (tgInputs.akismetAuthorUrl.is(':checked'))
585
- options.push('akismet:author_url');
586
- if (tgInputs.akismetAuthorEmail.is(':checked'))
587
- options.push('akismet:author_email');
588
- options = (options.length > 0) ? ' ' + options.join(' ') : '';
589
- var dv = '';
590
- if (tgInputs.defaultValue.val()) {
591
- dv = ' "' + tgInputs.defaultValue.val().replace(/["]/g, '&quot;') + '"';
592
- }
593
- var tag = name ? '[' + type + ' ' + name + options + dv + ']' : '';
594
- tgInputs.tag1st.val(tag);
595
- break;
596
- case 'textArea':
597
- var type = 'textarea';
598
- if (tgInputs.isRequiredField.is(':checked'))
599
- type += '*';
600
- var name = tgInputs.tagName.val();
601
- var options = [];
602
- if (tgInputs.tagCols.val() || tgInputs.tagRows.val())
603
- options.push(tgInputs.tagCols.val() + 'x' + tgInputs.tagRows.val());
604
- if (tgInputs.tagId.val())
605
- options.push('id:' + tgInputs.tagId.val());
606
- if (tgInputs.tagClasses.val())
607
- jQuery.each(tgInputs.tagClasses.val().split(' '), function(i, n) {
608
- options.push('class:' + n);
609
- });
610
- options = (options.length > 0) ? ' ' + options.join(' ') : '';
611
- var dv = '';
612
- if (tgInputs.defaultValue.val()) {
613
- dv = ' "' + tgInputs.defaultValue.val().replace(/["]/g, '&quot;') + '"';
614
- }
615
- var tag = name ? '[' + type + ' ' + name + options + dv + ']' : '';
616
- tgInputs.tag1st.val(tag);
617
- break;
618
- case 'menu':
619
- case 'checkboxes':
620
- case 'radioButtons':
621
- var type = '';
622
- if ('menu' == tagType)
623
- type = 'select';
624
- else if ('checkboxes' == tagType)
625
- type = 'checkbox';
626
- else if ('radioButtons' == tagType)
627
- type = 'radio';
628
- if (tgInputs.isRequiredField.is(':checked'))
629
- type += '*';
630
-
631
- var name = tgInputs.tagName.val();
632
- var options = [];
633
- if (tgInputs.allowsMultipleSelections.is(':checked'))
634
- options.push('multiple');
635
- if (tgInputs.insertFirstBlankOption.is(':checked'))
636
- options.push('include_blank');
637
- if (tgInputs.makeCheckboxesExclusive.is(':checked'))
638
- options.push('exclusive');
639
- if (tgInputs.tagId.val())
640
- options.push('id:' + tgInputs.tagId.val());
641
- if (tgInputs.tagClasses.val())
642
- jQuery.each(tgInputs.tagClasses.val().split(' '), function(i, n) {
643
- options.push('class:' + n);
644
- });
645
- options = (options.length > 0) ? ' ' + options.join(' ') : '';
646
- var choices = '';
647
- if (tgInputs.menuChoices.val())
648
- jQuery.each(tgInputs.menuChoices.val().split("\n"), function(i, n) {
649
- choices += ' "' + n.replace(/["]/g, '&quot;') + '"';
650
- });
651
- var tag = name ? '[' + type + ' ' + name + options + choices + ']' : '';
652
- tgInputs.tag1st.val(tag);
653
- break;
654
- case 'acceptance':
655
- var type = 'acceptance';
656
- var name = tgInputs.tagName.val();
657
- var options = [];
658
- if (tgInputs.isAcceptanceDefaultOn.is(':checked'))
659
- options.push('default:on');
660
- if (tgInputs.isAcceptanceInvert.is(':checked'))
661
- options.push('invert');
662
- if (tgInputs.tagId.val())
663
- options.push('id:' + tgInputs.tagId.val());
664
- if (tgInputs.tagClasses.val())
665
- jQuery.each(tgInputs.tagClasses.val().split(' '), function(i, n) {
666
- options.push('class:' + n);
667
- });
668
- options = (options.length > 0) ? ' ' + options.join(' ') : '';
669
- var tag = name ? '[' + type + ' ' + name + options + ']' : '';
670
- tgInputs.tag1st.val(tag);
671
- break;
672
- case 'quiz':
673
- var type = 'quiz';
674
- var name = tgInputs.tagName.val();
675
- var options = [];
676
- if (tgInputs.tagSize.val() || tgInputs.tagMaxLength.val())
677
- options.push(tgInputs.tagSize.val() + '/' + tgInputs.tagMaxLength.val());
678
- if (tgInputs.tagId.val())
679
- options.push('id:' + tgInputs.tagId.val());
680
- if (tgInputs.tagClasses.val())
681
- jQuery.each(tgInputs.tagClasses.val().split(' '), function(i, n) {
682
- options.push('class:' + n);
683
- });
684
- options = (options.length > 0) ? ' ' + options.join(' ') : '';
685
- var choices = '';
686
- if (tgInputs.menuChoices.val())
687
- jQuery.each(tgInputs.menuChoices.val().split("\n"), function(i, n) {
688
- choices += ' "' + n.replace(/["]/g, '&quot;') + '"';
689
- });
690
- var tag = name ? '[' + type + ' ' + name + options + choices + ']' : '';
691
- tgInputs.tag1st.val(tag);
692
- break;
693
- case 'captcha':
694
- // for captchac
695
- var type = 'captchac';
696
- var name = tgInputs.tagName.val();
697
- var options = [];
698
- if (tgInputs.imageSizeSmall.is(':checked'))
699
- options.push('size:s');
700
- if (tgInputs.imageSizeMedium.is(':checked'))
701
- options.push('size:m');
702
- if (tgInputs.imageSizeLarge.is(':checked'))
703
- options.push('size:l');
704
- if (tgInputs.fgColor.val())
705
- options.push('fg:#' + tgInputs.fgColor.val());
706
- if (tgInputs.bgColor.val())
707
- options.push('bg:#' + tgInputs.bgColor.val());
708
- if (tgInputs.tagId.val())
709
- options.push('id:' + tgInputs.tagId.val());
710
- if (tgInputs.tagClasses.val())
711
- jQuery.each(tgInputs.tagClasses.val().split(' '), function(i, n) {
712
- options.push('class:' + n);
713
- });
714
- options = (options.length > 0) ? ' ' + options.join(' ') : '';
715
- var tag = name ? '[' + type + ' ' + name + options + ']' : '';
716
- tgInputs.tag1st.val(tag);
717
- // for captchar
718
- var type = 'captchar';
719
- var options = [];
720
- if (tgInputs.tagSize.val() || tgInputs.tagMaxLength.val())
721
- options.push(tgInputs.tagSize.val() + '/' + tgInputs.tagMaxLength.val());
722
- if (tgInputs.tagId2.val())
723
- options.push('id:' + tgInputs.tagId2.val());
724
- if (tgInputs.tagClasses2.val())
725
- jQuery.each(tgInputs.tagClasses2.val().split(' '), function(i, n) {
726
- options.push('class:' + n);
727
- });
728
- options = (options.length > 0) ? ' ' + options.join(' ') : '';
729
- var tag = name ? '[' + type + ' ' + name + options + ']' : '';
730
- tgInputs.tag2nd.val(tag);
731
- break;
732
- case 'fileUpload':
733
- var type = 'file';
734
- if (tgInputs.isRequiredField.is(':checked'))
735
- type += '*';
736
- var name = tgInputs.tagName.val();
737
- var options = [];
738
- if (tgInputs.tagId.val())
739
- options.push('id:' + tgInputs.tagId.val());
740
- if (tgInputs.tagClasses.val())
741
- jQuery.each(tgInputs.tagClasses.val().split(' '), function(i, n) {
742
- options.push('class:' + n);
743
- });
744
- if (tgInputs.tagFileSizeLimit.val())
745
- options.push('limit:' + tgInputs.tagFileSizeLimit.val());
746
- if (tgInputs.tagAcceptableFileTypes.val())
747
- options.push('filetypes:' + tgInputs.tagAcceptableFileTypes.val().split(' ').join('|'));
748
- options = (options.length > 0) ? ' ' + options.join(' ') : '';
749
- var tag = name ? '[' + type + ' ' + name + options + ']' : '';
750
- tgInputs.tag1st.val(tag);
751
- break;
752
- case 'submit':
753
- var type = 'submit';
754
-
755
- var options = [];
756
- if (tgInputs.tagId.val())
757
- options.push('id:' + tgInputs.tagId.val());
758
- if (tgInputs.tagClasses.val())
759
- jQuery.each(tgInputs.tagClasses.val().split(' '), function(i, n) {
760
- options.push('class:' + n);
761
- });
762
- options = (options.length > 0) ? ' ' + options.join(' ') : '';
763
-
764
- var label = tgInputs.label.val();
765
- if (label)
766
- label = ' "' + label.replace(/["]/g, '&quot;') + '"';
767
- var tag = '[' + type + options + label + ']';
768
- tgInputs.tag1st.val(tag);
769
- break;
770
- }
771
- }
772
-
773
- function tgDefaultName(tagType) {
774
- var rand = Math.floor(Math.random() * 1000);
775
- if ('textField' == tagType) {
776
- return 'text-' + rand;
777
- } else if ('emailField' == tagType) {
778
- return 'email-' + rand;
779
- } else if ('textArea' == tagType) {
780
- return 'textarea-' + rand;
781
- } else if ('menu' == tagType) {
782
- return 'menu-' + rand;
783
- } else if ('checkboxes' == tagType) {
784
- return 'checkbox-' + rand;
785
- } else if ('radioButtons' == tagType) {
786
- return 'radio-' + rand;
787
- } else if ('acceptance' == tagType) {
788
- return 'acceptance-' + rand;
789
- } else if ('quiz' == tagType) {
790
- return 'quiz-' + rand;
791
- } else if ('captcha' == tagType) {
792
- return 'captcha-' + rand;
793
- } else if ('fileUpload' == tagType) {
794
- return 'file-' + rand;
795
- }
796
- }