Version Description
- Offer nonce verification for contact forms.
- Add several options to retrieve logged-in user info as default value of field.
- Introduce wpcf7_validate filter for validation independent from specific form tag type.
- Search contact form by title when failed to find by ID.
- Include all $_POST variables into $cf->posted_data and make them referable from mail.
- Add watermark option to captchar (CAPTCHA-response) field.
- Introduce wpcf7_ajax_loader() function and wpcf7_ajax_loader filter.
- Introduce wpcf7_akismet_comment_check filter.
- Introduce menu icons created by Takao Honda.
- Translation for Azeri has been created.
- Translations for Italian, Russian, Arabic, Danish, Persian, Romanian, and Portuguese have been updated.
=
Download this release
Release Info
Developer | takayukister |
Plugin | ![]() |
Version | 3.1 |
Comparing to | |
See all releases |
Code changes from version 3.0.2.1 to 3.1
- admin/admin.php +319 -329
- admin/edit.php +159 -159
- {images → admin/images}/dropdown.gif +0 -0
- admin/images/menu-icon.png +0 -0
- admin/images/screen-icon.png +0 -0
- admin/scripts.js +74 -74
- admin/styles-rtl.css +17 -17
- admin/styles.css +274 -270
- includes/classes.php +732 -576
- includes/controller.php +17 -73
- includes/functions.php +259 -252
- includes/pipe.php +66 -66
- includes/shortcodes.php +10 -2
- includes/taggenerator.php +0 -25
- jquery.form.js +2 -2
- languages/wpcf7-ar.mo +0 -0
- languages/wpcf7-az_AZ.mo +0 -0
- languages/wpcf7-da_DK.mo +0 -0
- languages/wpcf7-fa_IR.mo +0 -0
- languages/wpcf7-it_IT.mo +0 -0
- languages/wpcf7-ja.mo +0 -0
- languages/wpcf7-pt_PT.mo +0 -0
- languages/wpcf7-ro_RO.mo +0 -0
- languages/wpcf7-ru_RU.mo +0 -0
- languages/wpcf7.pot +173 -169
- modules/acceptance.php +11 -8
- modules/akismet.php +5 -0
- modules/captcha.php +22 -12
- modules/checkbox.php +6 -28
- modules/file.php +7 -11
- modules/quiz.php +8 -9
- modules/select.php +12 -23
- modules/submit.php +2 -10
- modules/text.php +26 -12
- modules/textarea.php +6 -4
- readme.txt +132 -145
- scripts.js +218 -197
- settings.php +1 -1
- styles-rtl.css +12 -12
- styles.css +64 -64
- wp-contact-form-7.php +75 -72
admin/admin.php
CHANGED
@@ -1,330 +1,320 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function wpcf7_admin_has_edit_cap() {
|
4 |
-
return current_user_can( WPCF7_ADMIN_READ_WRITE_CAPABILITY );
|
5 |
-
}
|
6 |
-
|
7 |
-
add_action( 'admin_init', 'wpcf7_admin_init' );
|
8 |
-
|
9 |
-
function wpcf7_admin_init() {
|
10 |
-
if ( ! wpcf7_admin_has_edit_cap() )
|
11 |
-
return;
|
12 |
-
|
13 |
-
if ( isset( $_POST['wpcf7-save'] ) ) {
|
14 |
-
$id = $_POST['post_ID'];
|
15 |
-
check_admin_referer( 'wpcf7-save_' . $id );
|
16 |
-
|
17 |
-
if ( ! $contact_form = wpcf7_contact_form( $id ) ) {
|
18 |
-
$contact_form = new WPCF7_ContactForm();
|
19 |
-
$contact_form->initial = true;
|
20 |
-
}
|
21 |
-
|
22 |
-
$contact_form->title = trim( $_POST['wpcf7-title'] );
|
23 |
-
|
24 |
-
$form = trim( $_POST['wpcf7-form'] );
|
25 |
-
|
26 |
-
$mail = array(
|
27 |
-
'subject' => trim( $_POST['wpcf7-mail-subject'] ),
|
28 |
-
'sender' => trim( $_POST['wpcf7-mail-sender'] ),
|
29 |
-
'body' => trim( $_POST['wpcf7-mail-body'] ),
|
30 |
-
'recipient' => trim( $_POST['wpcf7-mail-recipient'] ),
|
31 |
-
'additional_headers' => trim( $_POST['wpcf7-mail-additional-headers'] ),
|
32 |
-
'attachments' => trim( $_POST['wpcf7-mail-attachments'] ),
|
33 |
-
'use_html' =>
|
34 |
-
isset( $_POST['wpcf7-mail-use-html'] ) && 1 == $_POST['wpcf7-mail-use-html']
|
35 |
-
);
|
36 |
-
|
37 |
-
$mail_2 = array(
|
38 |
-
'active' =>
|
39 |
-
isset( $_POST['wpcf7-mail-2-active'] ) && 1 == $_POST['wpcf7-mail-2-active'],
|
40 |
-
'subject' => trim( $_POST['wpcf7-mail-2-subject'] ),
|
41 |
-
'sender' => trim( $_POST['wpcf7-mail-2-sender'] ),
|
42 |
-
'body' => trim( $_POST['wpcf7-mail-2-body'] ),
|
43 |
-
'recipient' => trim( $_POST['wpcf7-mail-2-recipient'] ),
|
44 |
-
'additional_headers' => trim( $_POST['wpcf7-mail-2-additional-headers'] ),
|
45 |
-
'attachments' => trim( $_POST['wpcf7-mail-2-attachments'] ),
|
46 |
-
'use_html' =>
|
47 |
-
isset( $_POST['wpcf7-mail-2-use-html'] ) && 1 == $_POST['wpcf7-mail-2-use-html']
|
48 |
-
);
|
49 |
-
|
50 |
-
$messages = isset( $contact_form->messages ) ? $contact_form->messages : array();
|
51 |
-
|
52 |
-
foreach ( wpcf7_messages() as $key => $arr ) {
|
53 |
-
$field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
|
54 |
-
if ( isset( $_POST[$field_name] ) )
|
55 |
-
$messages[$key] = trim( $_POST[$field_name] );
|
56 |
-
}
|
57 |
-
|
58 |
-
$additional_settings = trim( $_POST['wpcf7-additional-settings'] );
|
59 |
-
|
60 |
-
$props = apply_filters( 'wpcf7_contact_form_admin_posted_properties',
|
61 |
-
compact( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ) );
|
62 |
-
|
63 |
-
foreach ( (array) $props as $key => $prop )
|
64 |
-
$contact_form->{$key} = $prop;
|
65 |
-
|
66 |
-
$query = array();
|
67 |
-
$query['message'] = ( $contact_form->initial ) ? 'created' : 'saved';
|
68 |
-
|
69 |
-
$contact_form->save();
|
70 |
-
|
71 |
-
$query['contactform'] = $contact_form->id;
|
72 |
-
$redirect_to = wpcf7_admin_url( $query );
|
73 |
-
wp_safe_redirect( $redirect_to );
|
74 |
-
exit();
|
75 |
-
}
|
76 |
-
|
77 |
-
if ( isset( $_POST['wpcf7-copy'] ) ) {
|
78 |
-
$id = $_POST['post_ID'];
|
79 |
-
check_admin_referer( 'wpcf7-copy_' . $id );
|
80 |
-
|
81 |
-
$query = array();
|
82 |
-
|
83 |
-
if ( $contact_form = wpcf7_contact_form( $id ) ) {
|
84 |
-
$new_contact_form = $contact_form->copy();
|
85 |
-
$new_contact_form->save();
|
86 |
-
|
87 |
-
$query['contactform'] = $new_contact_form->id;
|
88 |
-
$query['message'] = 'created';
|
89 |
-
} else {
|
90 |
-
$query['contactform'] = $contact_form->id;
|
91 |
-
}
|
92 |
-
|
93 |
-
$redirect_to = wpcf7_admin_url( $query );
|
94 |
-
wp_safe_redirect( $redirect_to );
|
95 |
-
exit();
|
96 |
-
}
|
97 |
-
|
98 |
-
if ( isset( $_POST['wpcf7-delete'] ) ) {
|
99 |
-
$id = $_POST['post_ID'];
|
100 |
-
check_admin_referer( 'wpcf7-delete_' . $id );
|
101 |
-
|
102 |
-
if ( $contact_form = wpcf7_contact_form( $id ) )
|
103 |
-
$contact_form->delete();
|
104 |
-
|
105 |
-
$redirect_to = wpcf7_admin_url( array( 'message' => 'deleted' ) );
|
106 |
-
wp_safe_redirect( $redirect_to );
|
107 |
-
exit();
|
108 |
-
}
|
109 |
-
}
|
110 |
-
|
111 |
-
add_action( 'admin_menu', 'wpcf7_admin_menu', 9 );
|
112 |
-
|
113 |
-
function wpcf7_admin_menu() {
|
114 |
-
add_menu_page( __( 'Contact Form 7', 'wpcf7' ), __( 'Contact', 'wpcf7' ),
|
115 |
-
WPCF7_ADMIN_READ_CAPABILITY, 'wpcf7', 'wpcf7_admin_management_page
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
}
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
wp_enqueue_script( '
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
$
|
191 |
-
|
192 |
-
|
193 |
-
$
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
if (
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
$
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
if ( ! version_compare( $wp_version, WPCF7_REQUIRED_WP_VERSION, '<' ) )
|
321 |
-
return;
|
322 |
-
|
323 |
-
?>
|
324 |
-
<div class="error">
|
325 |
-
<p><?php echo sprintf( __( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'wpcf7' ), WPCF7_VERSION, WPCF7_REQUIRED_WP_VERSION, admin_url( 'update-core.php' ) ); ?></p>
|
326 |
-
</div>
|
327 |
-
<?php
|
328 |
-
}
|
329 |
-
|
330 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wpcf7_admin_has_edit_cap() {
|
4 |
+
return current_user_can( WPCF7_ADMIN_READ_WRITE_CAPABILITY );
|
5 |
+
}
|
6 |
+
|
7 |
+
add_action( 'admin_init', 'wpcf7_admin_init' );
|
8 |
+
|
9 |
+
function wpcf7_admin_init() {
|
10 |
+
if ( ! wpcf7_admin_has_edit_cap() )
|
11 |
+
return;
|
12 |
+
|
13 |
+
if ( isset( $_POST['wpcf7-save'] ) ) {
|
14 |
+
$id = $_POST['post_ID'];
|
15 |
+
check_admin_referer( 'wpcf7-save_' . $id );
|
16 |
+
|
17 |
+
if ( ! $contact_form = wpcf7_contact_form( $id ) ) {
|
18 |
+
$contact_form = new WPCF7_ContactForm();
|
19 |
+
$contact_form->initial = true;
|
20 |
+
}
|
21 |
+
|
22 |
+
$contact_form->title = trim( $_POST['wpcf7-title'] );
|
23 |
+
|
24 |
+
$form = trim( $_POST['wpcf7-form'] );
|
25 |
+
|
26 |
+
$mail = array(
|
27 |
+
'subject' => trim( $_POST['wpcf7-mail-subject'] ),
|
28 |
+
'sender' => trim( $_POST['wpcf7-mail-sender'] ),
|
29 |
+
'body' => trim( $_POST['wpcf7-mail-body'] ),
|
30 |
+
'recipient' => trim( $_POST['wpcf7-mail-recipient'] ),
|
31 |
+
'additional_headers' => trim( $_POST['wpcf7-mail-additional-headers'] ),
|
32 |
+
'attachments' => trim( $_POST['wpcf7-mail-attachments'] ),
|
33 |
+
'use_html' =>
|
34 |
+
isset( $_POST['wpcf7-mail-use-html'] ) && 1 == $_POST['wpcf7-mail-use-html']
|
35 |
+
);
|
36 |
+
|
37 |
+
$mail_2 = array(
|
38 |
+
'active' =>
|
39 |
+
isset( $_POST['wpcf7-mail-2-active'] ) && 1 == $_POST['wpcf7-mail-2-active'],
|
40 |
+
'subject' => trim( $_POST['wpcf7-mail-2-subject'] ),
|
41 |
+
'sender' => trim( $_POST['wpcf7-mail-2-sender'] ),
|
42 |
+
'body' => trim( $_POST['wpcf7-mail-2-body'] ),
|
43 |
+
'recipient' => trim( $_POST['wpcf7-mail-2-recipient'] ),
|
44 |
+
'additional_headers' => trim( $_POST['wpcf7-mail-2-additional-headers'] ),
|
45 |
+
'attachments' => trim( $_POST['wpcf7-mail-2-attachments'] ),
|
46 |
+
'use_html' =>
|
47 |
+
isset( $_POST['wpcf7-mail-2-use-html'] ) && 1 == $_POST['wpcf7-mail-2-use-html']
|
48 |
+
);
|
49 |
+
|
50 |
+
$messages = isset( $contact_form->messages ) ? $contact_form->messages : array();
|
51 |
+
|
52 |
+
foreach ( wpcf7_messages() as $key => $arr ) {
|
53 |
+
$field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
|
54 |
+
if ( isset( $_POST[$field_name] ) )
|
55 |
+
$messages[$key] = trim( $_POST[$field_name] );
|
56 |
+
}
|
57 |
+
|
58 |
+
$additional_settings = trim( $_POST['wpcf7-additional-settings'] );
|
59 |
+
|
60 |
+
$props = apply_filters( 'wpcf7_contact_form_admin_posted_properties',
|
61 |
+
compact( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ) );
|
62 |
+
|
63 |
+
foreach ( (array) $props as $key => $prop )
|
64 |
+
$contact_form->{$key} = $prop;
|
65 |
+
|
66 |
+
$query = array();
|
67 |
+
$query['message'] = ( $contact_form->initial ) ? 'created' : 'saved';
|
68 |
+
|
69 |
+
$contact_form->save();
|
70 |
+
|
71 |
+
$query['contactform'] = $contact_form->id;
|
72 |
+
$redirect_to = wpcf7_admin_url( $query );
|
73 |
+
wp_safe_redirect( $redirect_to );
|
74 |
+
exit();
|
75 |
+
}
|
76 |
+
|
77 |
+
if ( isset( $_POST['wpcf7-copy'] ) ) {
|
78 |
+
$id = $_POST['post_ID'];
|
79 |
+
check_admin_referer( 'wpcf7-copy_' . $id );
|
80 |
+
|
81 |
+
$query = array();
|
82 |
+
|
83 |
+
if ( $contact_form = wpcf7_contact_form( $id ) ) {
|
84 |
+
$new_contact_form = $contact_form->copy();
|
85 |
+
$new_contact_form->save();
|
86 |
+
|
87 |
+
$query['contactform'] = $new_contact_form->id;
|
88 |
+
$query['message'] = 'created';
|
89 |
+
} else {
|
90 |
+
$query['contactform'] = $contact_form->id;
|
91 |
+
}
|
92 |
+
|
93 |
+
$redirect_to = wpcf7_admin_url( $query );
|
94 |
+
wp_safe_redirect( $redirect_to );
|
95 |
+
exit();
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( isset( $_POST['wpcf7-delete'] ) ) {
|
99 |
+
$id = $_POST['post_ID'];
|
100 |
+
check_admin_referer( 'wpcf7-delete_' . $id );
|
101 |
+
|
102 |
+
if ( $contact_form = wpcf7_contact_form( $id ) )
|
103 |
+
$contact_form->delete();
|
104 |
+
|
105 |
+
$redirect_to = wpcf7_admin_url( array( 'message' => 'deleted' ) );
|
106 |
+
wp_safe_redirect( $redirect_to );
|
107 |
+
exit();
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
add_action( 'admin_menu', 'wpcf7_admin_menu', 9 );
|
112 |
+
|
113 |
+
function wpcf7_admin_menu() {
|
114 |
+
add_menu_page( __( 'Contact Form 7', 'wpcf7' ), __( 'Contact', 'wpcf7' ),
|
115 |
+
WPCF7_ADMIN_READ_CAPABILITY, 'wpcf7', 'wpcf7_admin_management_page',
|
116 |
+
wpcf7_plugin_url( 'admin/images/menu-icon.png' ) );
|
117 |
+
|
118 |
+
add_submenu_page( 'wpcf7', __( 'Edit Contact Forms', 'wpcf7' ), __( 'Edit', 'wpcf7' ),
|
119 |
+
WPCF7_ADMIN_READ_CAPABILITY, 'wpcf7', 'wpcf7_admin_management_page' );
|
120 |
+
}
|
121 |
+
|
122 |
+
add_action( 'admin_enqueue_scripts', 'wpcf7_admin_enqueue_styles' );
|
123 |
+
|
124 |
+
function wpcf7_admin_enqueue_styles() {
|
125 |
+
global $plugin_page;
|
126 |
+
|
127 |
+
if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page )
|
128 |
+
return;
|
129 |
+
|
130 |
+
wp_enqueue_style( 'thickbox' );
|
131 |
+
|
132 |
+
wp_enqueue_style( 'contact-form-7-admin', wpcf7_plugin_url( 'admin/styles.css' ),
|
133 |
+
array(), WPCF7_VERSION, 'all' );
|
134 |
+
|
135 |
+
if ( wpcf7_is_rtl() ) {
|
136 |
+
wp_enqueue_style( 'contact-form-7-admin-rtl',
|
137 |
+
wpcf7_plugin_url( 'admin/styles-rtl.css' ), array(), WPCF7_VERSION, 'all' );
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
add_action( 'admin_enqueue_scripts', 'wpcf7_admin_enqueue_scripts' );
|
142 |
+
|
143 |
+
function wpcf7_admin_enqueue_scripts() {
|
144 |
+
global $plugin_page, $wpcf7_tag_generators;
|
145 |
+
|
146 |
+
if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page )
|
147 |
+
return;
|
148 |
+
|
149 |
+
wp_enqueue_script( 'thickbox' );
|
150 |
+
wp_enqueue_script( 'postbox' );
|
151 |
+
|
152 |
+
wp_enqueue_script( 'wpcf7-admin-taggenerator', wpcf7_plugin_url( 'admin/taggenerator.js' ),
|
153 |
+
array( 'jquery' ), WPCF7_VERSION, true );
|
154 |
+
|
155 |
+
wp_enqueue_script( 'wpcf7-admin', wpcf7_plugin_url( 'admin/scripts.js' ),
|
156 |
+
array( 'jquery', 'wpcf7-admin-taggenerator' ), WPCF7_VERSION, true );
|
157 |
+
|
158 |
+
$taggenerators = array();
|
159 |
+
|
160 |
+
foreach ( (array) $wpcf7_tag_generators as $name => $tg ) {
|
161 |
+
$taggenerators[$name] = array_merge(
|
162 |
+
(array) $tg['options'],
|
163 |
+
array( 'title' => $tg['title'], 'content' => $tg['content'] ) );
|
164 |
+
}
|
165 |
+
|
166 |
+
wp_localize_script( 'wpcf7-admin', '_wpcf7', array(
|
167 |
+
'generateTag' => __( 'Generate Tag', 'wpcf7' ),
|
168 |
+
'pluginUrl' => wpcf7_plugin_url(),
|
169 |
+
'tagGenerators' => $taggenerators ) );
|
170 |
+
}
|
171 |
+
|
172 |
+
function wpcf7_admin_management_page() {
|
173 |
+
$contact_forms = get_posts( array(
|
174 |
+
'numberposts' => -1,
|
175 |
+
'orderby' => 'ID',
|
176 |
+
'order' => 'ASC',
|
177 |
+
'post_type' => 'wpcf7_contact_form' ) );
|
178 |
+
|
179 |
+
$cf = null;
|
180 |
+
$unsaved = false;
|
181 |
+
|
182 |
+
if ( ! isset( $_GET['contactform'] ) )
|
183 |
+
$_GET['contactform'] = '';
|
184 |
+
|
185 |
+
if ( 'new' == $_GET['contactform'] && wpcf7_admin_has_edit_cap() ) {
|
186 |
+
$unsaved = true;
|
187 |
+
$current = -1;
|
188 |
+
$cf = wpcf7_get_contact_form_default_pack(
|
189 |
+
array( 'locale' => ( isset( $_GET['locale'] ) ? $_GET['locale'] : '' ) ) );
|
190 |
+
} elseif ( $cf = wpcf7_contact_form( $_GET['contactform'] ) ) {
|
191 |
+
$current = (int) $_GET['contactform'];
|
192 |
+
} else {
|
193 |
+
$first = reset( $contact_forms ); // Returns first item
|
194 |
+
|
195 |
+
if ( $first ) {
|
196 |
+
$current = $first->ID;
|
197 |
+
$cf = wpcf7_contact_form( $current );
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
require_once WPCF7_PLUGIN_DIR . '/admin/includes/meta-boxes.php';
|
202 |
+
require_once WPCF7_PLUGIN_DIR . '/admin/edit.php';
|
203 |
+
}
|
204 |
+
|
205 |
+
/* Misc */
|
206 |
+
|
207 |
+
add_filter( 'plugin_action_links', 'wpcf7_plugin_action_links', 10, 2 );
|
208 |
+
|
209 |
+
function wpcf7_plugin_action_links( $links, $file ) {
|
210 |
+
if ( $file != WPCF7_PLUGIN_BASENAME )
|
211 |
+
return $links;
|
212 |
+
|
213 |
+
$url = wpcf7_admin_url();
|
214 |
+
|
215 |
+
$settings_link = '<a href="' . esc_attr( $url ) . '">'
|
216 |
+
. esc_html( __( 'Settings', 'wpcf7' ) ) . '</a>';
|
217 |
+
|
218 |
+
array_unshift( $links, $settings_link );
|
219 |
+
|
220 |
+
return $links;
|
221 |
+
}
|
222 |
+
|
223 |
+
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_cf7com_links', 9 );
|
224 |
+
|
225 |
+
function wpcf7_cf7com_links( &$contact_form ) {
|
226 |
+
$links = '<div class="cf7com-links">'
|
227 |
+
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/', 'wpcf7' ) ) . '" target="_blank">'
|
228 |
+
. esc_html( __( 'Contactform7.com', 'wpcf7' ) ) . '</a> '
|
229 |
+
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/docs/', 'wpcf7' ) ) . '" target="_blank">'
|
230 |
+
. esc_html( __( 'Docs', 'wpcf7' ) ) . '</a> - '
|
231 |
+
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/faq/', 'wpcf7' ) ) . '" target="_blank">'
|
232 |
+
. esc_html( __( 'FAQ', 'wpcf7' ) ) . '</a> - '
|
233 |
+
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/support/', 'wpcf7' ) ) . '" target="_blank">'
|
234 |
+
. esc_html( __( 'Support', 'wpcf7' ) ) . '</a>'
|
235 |
+
. '</div>';
|
236 |
+
|
237 |
+
echo apply_filters( 'wpcf7_cf7com_links', $links );
|
238 |
+
}
|
239 |
+
|
240 |
+
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_updated_message' );
|
241 |
+
|
242 |
+
function wpcf7_updated_message( &$contact_form ) {
|
243 |
+
if ( ! isset( $_GET['message'] ) )
|
244 |
+
return;
|
245 |
+
|
246 |
+
switch ( $_GET['message'] ) {
|
247 |
+
case 'created':
|
248 |
+
$updated_message = __( "Contact form created.", 'wpcf7' );
|
249 |
+
break;
|
250 |
+
case 'saved':
|
251 |
+
$updated_message = __( "Contact form saved.", 'wpcf7' );
|
252 |
+
break;
|
253 |
+
case 'deleted':
|
254 |
+
$updated_message = __( "Contact form deleted.", 'wpcf7' );
|
255 |
+
break;
|
256 |
+
}
|
257 |
+
|
258 |
+
if ( ! $updated_message )
|
259 |
+
return;
|
260 |
+
|
261 |
+
?>
|
262 |
+
<div id="message" class="updated"><p><?php echo esc_html( $updated_message ); ?></p></div>
|
263 |
+
<?php
|
264 |
+
}
|
265 |
+
|
266 |
+
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_donation_link' );
|
267 |
+
|
268 |
+
function wpcf7_donation_link( &$contact_form ) {
|
269 |
+
if ( ! WPCF7_SHOW_DONATION_LINK )
|
270 |
+
return;
|
271 |
+
|
272 |
+
if ( 'new' == $_GET['contactform'] || ! empty( $_GET['message'] ) )
|
273 |
+
return;
|
274 |
+
|
275 |
+
$show_link = true;
|
276 |
+
|
277 |
+
$num = mt_rand( 0, 99 );
|
278 |
+
|
279 |
+
if ( $num >= 20 )
|
280 |
+
$show_link = false;
|
281 |
+
|
282 |
+
$show_link = apply_filters( 'wpcf7_show_donation_link', $show_link );
|
283 |
+
|
284 |
+
if ( ! $show_link )
|
285 |
+
return;
|
286 |
+
|
287 |
+
$texts = array(
|
288 |
+
__( "Contact Form 7 needs your support. Please donate today.", 'wpcf7' ),
|
289 |
+
__( "Your contribution is needed for making this plugin better.", 'wpcf7' ) );
|
290 |
+
|
291 |
+
$text = $texts[array_rand( $texts )];
|
292 |
+
|
293 |
+
?>
|
294 |
+
<div class="donation">
|
295 |
+
<p><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/donate/', 'wpcf7' ) ); ?>"><?php echo esc_html( $text ); ?></a> <a href="<?php echo esc_url_raw( __( 'http://contactform7.com/donate/', 'wpcf7' ) ); ?>" class="button"><?php echo esc_html( __( "Donate", 'wpcf7' ) ); ?></a></p>
|
296 |
+
</div>
|
297 |
+
<?php
|
298 |
+
}
|
299 |
+
|
300 |
+
add_action( 'admin_notices', 'wpcf7_old_wp_version_error', 9 );
|
301 |
+
|
302 |
+
function wpcf7_old_wp_version_error() {
|
303 |
+
global $plugin_page;
|
304 |
+
|
305 |
+
if ( 'wpcf7' != $plugin_page )
|
306 |
+
return;
|
307 |
+
|
308 |
+
$wp_version = get_bloginfo( 'version' );
|
309 |
+
|
310 |
+
if ( ! version_compare( $wp_version, WPCF7_REQUIRED_WP_VERSION, '<' ) )
|
311 |
+
return;
|
312 |
+
|
313 |
+
?>
|
314 |
+
<div class="error">
|
315 |
+
<p><?php echo sprintf( __( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'wpcf7' ), WPCF7_VERSION, WPCF7_REQUIRED_WP_VERSION, admin_url( 'update-core.php' ) ); ?></p>
|
316 |
+
</div>
|
317 |
+
<?php
|
318 |
+
}
|
319 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
?>
|
admin/edit.php
CHANGED
@@ -1,159 +1,159 @@
|
|
1 |
-
<div class="wrap">
|
2 |
-
|
3 |
-
<?php screen_icon
|
4 |
-
|
5 |
-
<h2><?php echo esc_html( __( 'Contact Form 7', 'wpcf7' ) ); ?></h2>
|
6 |
-
|
7 |
-
<?php do_action_ref_array( 'wpcf7_admin_before_subsubsub', array( &$cf ) ); ?>
|
8 |
-
|
9 |
-
<ul class="subsubsub">
|
10 |
-
<?php
|
11 |
-
$first = array_shift( $contact_forms );
|
12 |
-
if ( ! is_null( $first ) ) : ?>
|
13 |
-
<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->post_title ); ?></a></li>
|
14 |
-
<?php endif;
|
15 |
-
foreach ( $contact_forms as $v ) : ?>
|
16 |
-
<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->post_title ); ?></a></li>
|
17 |
-
<?php endforeach; ?>
|
18 |
-
|
19 |
-
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
20 |
-
<li class="addnew"><a class="button 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>
|
21 |
-
<?php endif; ?>
|
22 |
-
</ul>
|
23 |
-
|
24 |
-
<br class="clear" />
|
25 |
-
|
26 |
-
<?php if ( $cf ) : ?>
|
27 |
-
<?php $disabled = ( wpcf7_admin_has_edit_cap() ) ? '' : ' disabled="disabled"'; ?>
|
28 |
-
|
29 |
-
<form method="post" action="<?php echo wpcf7_admin_url( array( 'contactform' => $current ) ); ?>" id="wpcf7-admin-form-element"<?php do_action( 'wpcf7_post_edit_form_tag' ); ?>>
|
30 |
-
<?php if ( wpcf7_admin_has_edit_cap() ) wp_nonce_field( 'wpcf7-save_' . $current ); ?>
|
31 |
-
<input type="hidden" id="post_ID" name="post_ID" value="<?php echo (int) $current; ?>" />
|
32 |
-
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo (int) get_post_meta( $cf->id, '_old_cf7_unit_id', true ); ?>" />
|
33 |
-
|
34 |
-
<div id="poststuff" class="metabox-holder">
|
35 |
-
|
36 |
-
<div id="titlediv">
|
37 |
-
<input type="text" id="wpcf7-title" name="wpcf7-title" size="40" value="<?php echo esc_attr( $cf->title ); ?>"<?php echo $disabled; ?> />
|
38 |
-
|
39 |
-
<?php if ( ! $unsaved ) : ?>
|
40 |
-
<p class="tagcode">
|
41 |
-
<?php echo esc_html( __( "Copy this code and paste it into your post, page or text widget content.", 'wpcf7' ) ); ?><br />
|
42 |
-
|
43 |
-
<input type="text" id="contact-form-anchor-text" onfocus="this.select();" readonly="readonly" />
|
44 |
-
</p>
|
45 |
-
|
46 |
-
<p class="tagcode" style="display: none;">
|
47 |
-
<?php echo esc_html( __( "Old code is also available.", 'wpcf7' ) ); ?><br />
|
48 |
-
|
49 |
-
<input type="text" id="contact-form-anchor-text-old" onfocus="this.select();" readonly="readonly" />
|
50 |
-
</p>
|
51 |
-
<?php endif; ?>
|
52 |
-
|
53 |
-
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
54 |
-
<div class="save-contact-form">
|
55 |
-
<input type="submit" class="button" name="wpcf7-save" value="<?php echo esc_attr( __( 'Save', 'wpcf7' ) ); ?>" />
|
56 |
-
</div>
|
57 |
-
<?php endif; ?>
|
58 |
-
|
59 |
-
<?php if ( wpcf7_admin_has_edit_cap() && ! $unsaved ) : ?>
|
60 |
-
<div class="actions-link">
|
61 |
-
<?php $copy_nonce = wp_create_nonce( 'wpcf7-copy_' . $current ); ?>
|
62 |
-
<input type="submit" name="wpcf7-copy" class="copy" value="<?php echo esc_attr( __( 'Copy', 'wpcf7' ) ); ?>"
|
63 |
-
<?php echo "onclick=\"this.form._wpnonce.value = '$copy_nonce'; return true;\""; ?> />
|
64 |
-
|
|
65 |
-
|
66 |
-
<?php $delete_nonce = wp_create_nonce( 'wpcf7-delete_' . $current ); ?>
|
67 |
-
<input type="submit" name="wpcf7-delete" class="delete" value="<?php echo esc_attr( __( 'Delete', 'wpcf7' ) ); ?>"
|
68 |
-
<?php echo "onclick=\"if (confirm('" .
|
69 |
-
esc_js( __( "You are about to delete this contact form.\n 'Cancel' to stop, 'OK' to delete.", 'wpcf7' ) ) .
|
70 |
-
"')) {this.form._wpnonce.value = '$delete_nonce'; return true;} return false;\""; ?> />
|
71 |
-
</div>
|
72 |
-
<?php endif; ?>
|
73 |
-
</div>
|
74 |
-
|
75 |
-
<?php
|
76 |
-
|
77 |
-
if ( wpcf7_admin_has_edit_cap() ) {
|
78 |
-
add_meta_box( 'formdiv', __( 'Form', 'wpcf7' ),
|
79 |
-
'wpcf7_form_meta_box', 'cfseven', 'form', 'core' );
|
80 |
-
|
81 |
-
add_meta_box( 'maildiv', __( 'Mail', 'wpcf7' ),
|
82 |
-
'wpcf7_mail_meta_box', 'cfseven', 'mail', 'core' );
|
83 |
-
|
84 |
-
add_meta_box( 'mail2div', __( 'Mail (2)', 'wpcf7' ),
|
85 |
-
'wpcf7_mail_meta_box', 'cfseven', 'mail_2', 'core',
|
86 |
-
array(
|
87 |
-
'id' => 'wpcf7-mail-2',
|
88 |
-
'name' => 'mail_2',
|
89 |
-
'use' => __( 'Use mail (2)', 'wpcf7' ) ) );
|
90 |
-
|
91 |
-
add_meta_box( 'messagesdiv', __( 'Messages', 'wpcf7' ),
|
92 |
-
'wpcf7_messages_meta_box', 'cfseven', 'messages', 'core' );
|
93 |
-
|
94 |
-
add_meta_box( 'additionalsettingsdiv', __( 'Additional Settings', 'wpcf7' ),
|
95 |
-
'wpcf7_additional_settings_meta_box', 'cfseven', 'additional_settings', 'core' );
|
96 |
-
}
|
97 |
-
|
98 |
-
do_action_ref_array( 'wpcf7_admin_after_general_settings', array( &$cf ) );
|
99 |
-
|
100 |
-
do_meta_boxes( 'cfseven', 'form', $cf );
|
101 |
-
|
102 |
-
do_action_ref_array( 'wpcf7_admin_after_form', array( &$cf ) );
|
103 |
-
|
104 |
-
do_meta_boxes( 'cfseven', 'mail', $cf );
|
105 |
-
|
106 |
-
do_action_ref_array( 'wpcf7_admin_after_mail', array( &$cf ) );
|
107 |
-
|
108 |
-
do_meta_boxes( 'cfseven', 'mail_2', $cf );
|
109 |
-
|
110 |
-
do_action_ref_array( 'wpcf7_admin_after_mail_2', array( &$cf ) );
|
111 |
-
|
112 |
-
do_meta_boxes( 'cfseven', 'messages', $cf );
|
113 |
-
|
114 |
-
do_action_ref_array( 'wpcf7_admin_after_messages', array( &$cf ) );
|
115 |
-
|
116 |
-
do_meta_boxes( 'cfseven', 'additional_settings', $cf );
|
117 |
-
|
118 |
-
do_action_ref_array( 'wpcf7_admin_after_additional_settings', array( &$cf ) );
|
119 |
-
|
120 |
-
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
121 |
-
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
122 |
-
|
123 |
-
?>
|
124 |
-
</div>
|
125 |
-
|
126 |
-
</form>
|
127 |
-
|
128 |
-
<?php endif; ?>
|
129 |
-
|
130 |
-
</div>
|
131 |
-
|
132 |
-
<div id="wpcf7-lang-select-modal" class="hidden">
|
133 |
-
<?php
|
134 |
-
$available_locales = wpcf7_l10n();
|
135 |
-
$default_locale = get_locale();
|
136 |
-
|
137 |
-
if ( ! isset( $available_locales[$default_locale] ) )
|
138 |
-
$default_locale = 'en_US';
|
139 |
-
|
140 |
-
?>
|
141 |
-
<h4><?php echo esc_html( sprintf( __( 'Use the default language (%s)', 'wpcf7' ), $available_locales[$default_locale] ) ); ?></h4>
|
142 |
-
<p><a href="<?php echo wpcf7_admin_url( array( 'contactform' => 'new' ) ); ?>" class="button" /><?php echo esc_html( __( 'Add New', 'wpcf7' ) ); ?></a></p>
|
143 |
-
|
144 |
-
<?php unset( $available_locales[$default_locale] ); ?>
|
145 |
-
<h4><?php echo esc_html( __( 'Or', 'wpcf7' ) ); ?></h4>
|
146 |
-
<form action="" method="get">
|
147 |
-
<input type="hidden" name="page" value="wpcf7" />
|
148 |
-
<input type="hidden" name="contactform" value="new" />
|
149 |
-
<select name="locale">
|
150 |
-
<option value="" selected="selected"><?php echo esc_html( __( '(select language)', 'wpcf7' ) ); ?></option>
|
151 |
-
<?php foreach ( $available_locales as $code => $locale ) : ?>
|
152 |
-
<option value="<?php echo esc_attr( $code ); ?>"><?php echo esc_html( $locale ); ?></option>
|
153 |
-
<?php endforeach; ?>
|
154 |
-
</select>
|
155 |
-
<input type="submit" class="button" value="<?php echo esc_attr( __( 'Add New', 'wpcf7' ) ); ?>" />
|
156 |
-
</form>
|
157 |
-
</div>
|
158 |
-
|
159 |
-
<?php do_action_ref_array( 'wpcf7_admin_footer', array( &$cf ) ); ?>
|
1 |
+
<div class="wrap">
|
2 |
+
|
3 |
+
<?php screen_icon(); ?>
|
4 |
+
|
5 |
+
<h2><?php echo esc_html( __( 'Contact Form 7', 'wpcf7' ) ); ?></h2>
|
6 |
+
|
7 |
+
<?php do_action_ref_array( 'wpcf7_admin_before_subsubsub', array( &$cf ) ); ?>
|
8 |
+
|
9 |
+
<ul class="subsubsub">
|
10 |
+
<?php
|
11 |
+
$first = array_shift( $contact_forms );
|
12 |
+
if ( ! is_null( $first ) ) : ?>
|
13 |
+
<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->post_title ); ?></a></li>
|
14 |
+
<?php endif;
|
15 |
+
foreach ( $contact_forms as $v ) : ?>
|
16 |
+
<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->post_title ); ?></a></li>
|
17 |
+
<?php endforeach; ?>
|
18 |
+
|
19 |
+
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
20 |
+
<li class="addnew"><a class="button 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>
|
21 |
+
<?php endif; ?>
|
22 |
+
</ul>
|
23 |
+
|
24 |
+
<br class="clear" />
|
25 |
+
|
26 |
+
<?php if ( $cf ) : ?>
|
27 |
+
<?php $disabled = ( wpcf7_admin_has_edit_cap() ) ? '' : ' disabled="disabled"'; ?>
|
28 |
+
|
29 |
+
<form method="post" action="<?php echo wpcf7_admin_url( array( 'contactform' => $current ) ); ?>" id="wpcf7-admin-form-element"<?php do_action( 'wpcf7_post_edit_form_tag' ); ?>>
|
30 |
+
<?php if ( wpcf7_admin_has_edit_cap() ) wp_nonce_field( 'wpcf7-save_' . $current ); ?>
|
31 |
+
<input type="hidden" id="post_ID" name="post_ID" value="<?php echo (int) $current; ?>" />
|
32 |
+
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo (int) get_post_meta( $cf->id, '_old_cf7_unit_id', true ); ?>" />
|
33 |
+
|
34 |
+
<div id="poststuff" class="metabox-holder">
|
35 |
+
|
36 |
+
<div id="titlediv">
|
37 |
+
<input type="text" id="wpcf7-title" name="wpcf7-title" size="40" value="<?php echo esc_attr( $cf->title ); ?>"<?php echo $disabled; ?> />
|
38 |
+
|
39 |
+
<?php if ( ! $unsaved ) : ?>
|
40 |
+
<p class="tagcode">
|
41 |
+
<?php echo esc_html( __( "Copy this code and paste it into your post, page or text widget content.", 'wpcf7' ) ); ?><br />
|
42 |
+
|
43 |
+
<input type="text" id="contact-form-anchor-text" onfocus="this.select();" readonly="readonly" />
|
44 |
+
</p>
|
45 |
+
|
46 |
+
<p class="tagcode" style="display: none;">
|
47 |
+
<?php echo esc_html( __( "Old code is also available.", 'wpcf7' ) ); ?><br />
|
48 |
+
|
49 |
+
<input type="text" id="contact-form-anchor-text-old" onfocus="this.select();" readonly="readonly" />
|
50 |
+
</p>
|
51 |
+
<?php endif; ?>
|
52 |
+
|
53 |
+
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
54 |
+
<div class="save-contact-form">
|
55 |
+
<input type="submit" class="button" name="wpcf7-save" value="<?php echo esc_attr( __( 'Save', 'wpcf7' ) ); ?>" />
|
56 |
+
</div>
|
57 |
+
<?php endif; ?>
|
58 |
+
|
59 |
+
<?php if ( wpcf7_admin_has_edit_cap() && ! $unsaved ) : ?>
|
60 |
+
<div class="actions-link">
|
61 |
+
<?php $copy_nonce = wp_create_nonce( 'wpcf7-copy_' . $current ); ?>
|
62 |
+
<input type="submit" name="wpcf7-copy" class="copy" value="<?php echo esc_attr( __( 'Copy', 'wpcf7' ) ); ?>"
|
63 |
+
<?php echo "onclick=\"this.form._wpnonce.value = '$copy_nonce'; return true;\""; ?> />
|
64 |
+
|
|
65 |
+
|
66 |
+
<?php $delete_nonce = wp_create_nonce( 'wpcf7-delete_' . $current ); ?>
|
67 |
+
<input type="submit" name="wpcf7-delete" class="delete" value="<?php echo esc_attr( __( 'Delete', 'wpcf7' ) ); ?>"
|
68 |
+
<?php echo "onclick=\"if (confirm('" .
|
69 |
+
esc_js( __( "You are about to delete this contact form.\n 'Cancel' to stop, 'OK' to delete.", 'wpcf7' ) ) .
|
70 |
+
"')) {this.form._wpnonce.value = '$delete_nonce'; return true;} return false;\""; ?> />
|
71 |
+
</div>
|
72 |
+
<?php endif; ?>
|
73 |
+
</div>
|
74 |
+
|
75 |
+
<?php
|
76 |
+
|
77 |
+
if ( wpcf7_admin_has_edit_cap() ) {
|
78 |
+
add_meta_box( 'formdiv', __( 'Form', 'wpcf7' ),
|
79 |
+
'wpcf7_form_meta_box', 'cfseven', 'form', 'core' );
|
80 |
+
|
81 |
+
add_meta_box( 'maildiv', __( 'Mail', 'wpcf7' ),
|
82 |
+
'wpcf7_mail_meta_box', 'cfseven', 'mail', 'core' );
|
83 |
+
|
84 |
+
add_meta_box( 'mail2div', __( 'Mail (2)', 'wpcf7' ),
|
85 |
+
'wpcf7_mail_meta_box', 'cfseven', 'mail_2', 'core',
|
86 |
+
array(
|
87 |
+
'id' => 'wpcf7-mail-2',
|
88 |
+
'name' => 'mail_2',
|
89 |
+
'use' => __( 'Use mail (2)', 'wpcf7' ) ) );
|
90 |
+
|
91 |
+
add_meta_box( 'messagesdiv', __( 'Messages', 'wpcf7' ),
|
92 |
+
'wpcf7_messages_meta_box', 'cfseven', 'messages', 'core' );
|
93 |
+
|
94 |
+
add_meta_box( 'additionalsettingsdiv', __( 'Additional Settings', 'wpcf7' ),
|
95 |
+
'wpcf7_additional_settings_meta_box', 'cfseven', 'additional_settings', 'core' );
|
96 |
+
}
|
97 |
+
|
98 |
+
do_action_ref_array( 'wpcf7_admin_after_general_settings', array( &$cf ) );
|
99 |
+
|
100 |
+
do_meta_boxes( 'cfseven', 'form', $cf );
|
101 |
+
|
102 |
+
do_action_ref_array( 'wpcf7_admin_after_form', array( &$cf ) );
|
103 |
+
|
104 |
+
do_meta_boxes( 'cfseven', 'mail', $cf );
|
105 |
+
|
106 |
+
do_action_ref_array( 'wpcf7_admin_after_mail', array( &$cf ) );
|
107 |
+
|
108 |
+
do_meta_boxes( 'cfseven', 'mail_2', $cf );
|
109 |
+
|
110 |
+
do_action_ref_array( 'wpcf7_admin_after_mail_2', array( &$cf ) );
|
111 |
+
|
112 |
+
do_meta_boxes( 'cfseven', 'messages', $cf );
|
113 |
+
|
114 |
+
do_action_ref_array( 'wpcf7_admin_after_messages', array( &$cf ) );
|
115 |
+
|
116 |
+
do_meta_boxes( 'cfseven', 'additional_settings', $cf );
|
117 |
+
|
118 |
+
do_action_ref_array( 'wpcf7_admin_after_additional_settings', array( &$cf ) );
|
119 |
+
|
120 |
+
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
121 |
+
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
122 |
+
|
123 |
+
?>
|
124 |
+
</div>
|
125 |
+
|
126 |
+
</form>
|
127 |
+
|
128 |
+
<?php endif; ?>
|
129 |
+
|
130 |
+
</div>
|
131 |
+
|
132 |
+
<div id="wpcf7-lang-select-modal" class="hidden">
|
133 |
+
<?php
|
134 |
+
$available_locales = wpcf7_l10n();
|
135 |
+
$default_locale = get_locale();
|
136 |
+
|
137 |
+
if ( ! isset( $available_locales[$default_locale] ) )
|
138 |
+
$default_locale = 'en_US';
|
139 |
+
|
140 |
+
?>
|
141 |
+
<h4><?php echo esc_html( sprintf( __( 'Use the default language (%s)', 'wpcf7' ), $available_locales[$default_locale] ) ); ?></h4>
|
142 |
+
<p><a href="<?php echo wpcf7_admin_url( array( 'contactform' => 'new' ) ); ?>" class="button" /><?php echo esc_html( __( 'Add New', 'wpcf7' ) ); ?></a></p>
|
143 |
+
|
144 |
+
<?php unset( $available_locales[$default_locale] ); ?>
|
145 |
+
<h4><?php echo esc_html( __( 'Or', 'wpcf7' ) ); ?></h4>
|
146 |
+
<form action="" method="get">
|
147 |
+
<input type="hidden" name="page" value="wpcf7" />
|
148 |
+
<input type="hidden" name="contactform" value="new" />
|
149 |
+
<select name="locale">
|
150 |
+
<option value="" selected="selected"><?php echo esc_html( __( '(select language)', 'wpcf7' ) ); ?></option>
|
151 |
+
<?php foreach ( $available_locales as $code => $locale ) : ?>
|
152 |
+
<option value="<?php echo esc_attr( $code ); ?>"><?php echo esc_html( $locale ); ?></option>
|
153 |
+
<?php endforeach; ?>
|
154 |
+
</select>
|
155 |
+
<input type="submit" class="button" value="<?php echo esc_attr( __( 'Add New', 'wpcf7' ) ); ?>" />
|
156 |
+
</form>
|
157 |
+
</div>
|
158 |
+
|
159 |
+
<?php do_action_ref_array( 'wpcf7_admin_footer', array( &$cf ) ); ?>
|
{images → admin/images}/dropdown.gif
RENAMED
File without changes
|
admin/images/menu-icon.png
ADDED
Binary file
|
admin/images/screen-icon.png
ADDED
Binary file
|
admin/scripts.js
CHANGED
@@ -1,75 +1,75 @@
|
|
1 |
-
(function($) {
|
2 |
-
|
3 |
-
$(function() {
|
4 |
-
try {
|
5 |
-
$('div.cf7com-links').insertAfter($('div.wrap h2:first'));
|
6 |
-
|
7 |
-
$.extend($.tgPanes, _wpcf7.tagGenerators);
|
8 |
-
$('#taggenerator').tagGenerator(
|
9 |
-
{ dropdownIconUrl: _wpcf7.pluginUrl + '/images/dropdown.gif' });
|
10 |
-
|
11 |
-
$('input#wpcf7-title:disabled').css({cursor: 'default'});
|
12 |
-
|
13 |
-
$('input#wpcf7-title').mouseover(function() {
|
14 |
-
$(this).not('.focus').addClass('mouseover');
|
15 |
-
});
|
16 |
-
|
17 |
-
$('input#wpcf7-title').mouseout(function() {
|
18 |
-
$(this).removeClass('mouseover');
|
19 |
-
});
|
20 |
-
|
21 |
-
$('input#wpcf7-title').focus(function() {
|
22 |
-
$(this).addClass('focus').removeClass('mouseover');
|
23 |
-
});
|
24 |
-
|
25 |
-
$('input#wpcf7-title').blur(function() {
|
26 |
-
$(this).removeClass('focus');
|
27 |
-
});
|
28 |
-
|
29 |
-
$('input#wpcf7-title').change(function() {
|
30 |
-
updateTag();
|
31 |
-
});
|
32 |
-
|
33 |
-
updateTag();
|
34 |
-
|
35 |
-
$('.check-if-these-fields-are-active').each(function(index) {
|
36 |
-
if (! $(this).is(':checked'))
|
37 |
-
$(this).parent().siblings('.mail-fields').hide();
|
38 |
-
|
39 |
-
$(this).click(function() {
|
40 |
-
if ($(this).parent().siblings('.mail-fields').is(':hidden')
|
41 |
-
&& $(this).is(':checked')) {
|
42 |
-
$(this).parent().siblings('.mail-fields').slideDown('fast');
|
43 |
-
} else if ($(this).parent().siblings('.mail-fields').is(':visible')
|
44 |
-
&& $(this).not(':checked')) {
|
45 |
-
$(this).parent().siblings('.mail-fields').slideUp('fast');
|
46 |
-
}
|
47 |
-
});
|
48 |
-
});
|
49 |
-
|
50 |
-
postboxes.add_postbox_toggles('cfseven');
|
51 |
-
|
52 |
-
} catch (e) {
|
53 |
-
}
|
54 |
-
});
|
55 |
-
|
56 |
-
function updateTag() {
|
57 |
-
var title = $('input#wpcf7-title').val();
|
58 |
-
|
59 |
-
if (title)
|
60 |
-
title = title.replace(/["'\[\]]/g, '');
|
61 |
-
|
62 |
-
$('input#wpcf7-title').val(title);
|
63 |
-
var postId = $('input#post_ID').val();
|
64 |
-
var tag = '[contact-form-7 id="' + postId + '" title="' + title + '"]';
|
65 |
-
$('input#contact-form-anchor-text').val(tag);
|
66 |
-
|
67 |
-
var oldId = $('input#wpcf7-id').val();
|
68 |
-
|
69 |
-
if (0 != oldId) {
|
70 |
-
var tagOld = '[contact-form ' + oldId + ' "' + title + '"]';
|
71 |
-
$('input#contact-form-anchor-text-old').val(tagOld).parent('p.tagcode').show();
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
})(jQuery);
|
1 |
+
(function($) {
|
2 |
+
|
3 |
+
$(function() {
|
4 |
+
try {
|
5 |
+
$('div.cf7com-links').insertAfter($('div.wrap h2:first'));
|
6 |
+
|
7 |
+
$.extend($.tgPanes, _wpcf7.tagGenerators);
|
8 |
+
$('#taggenerator').tagGenerator(_wpcf7.generateTag,
|
9 |
+
{ dropdownIconUrl: _wpcf7.pluginUrl + '/admin/images/dropdown.gif' });
|
10 |
+
|
11 |
+
$('input#wpcf7-title:disabled').css({cursor: 'default'});
|
12 |
+
|
13 |
+
$('input#wpcf7-title').mouseover(function() {
|
14 |
+
$(this).not('.focus').addClass('mouseover');
|
15 |
+
});
|
16 |
+
|
17 |
+
$('input#wpcf7-title').mouseout(function() {
|
18 |
+
$(this).removeClass('mouseover');
|
19 |
+
});
|
20 |
+
|
21 |
+
$('input#wpcf7-title').focus(function() {
|
22 |
+
$(this).addClass('focus').removeClass('mouseover');
|
23 |
+
});
|
24 |
+
|
25 |
+
$('input#wpcf7-title').blur(function() {
|
26 |
+
$(this).removeClass('focus');
|
27 |
+
});
|
28 |
+
|
29 |
+
$('input#wpcf7-title').change(function() {
|
30 |
+
updateTag();
|
31 |
+
});
|
32 |
+
|
33 |
+
updateTag();
|
34 |
+
|
35 |
+
$('.check-if-these-fields-are-active').each(function(index) {
|
36 |
+
if (! $(this).is(':checked'))
|
37 |
+
$(this).parent().siblings('.mail-fields').hide();
|
38 |
+
|
39 |
+
$(this).click(function() {
|
40 |
+
if ($(this).parent().siblings('.mail-fields').is(':hidden')
|
41 |
+
&& $(this).is(':checked')) {
|
42 |
+
$(this).parent().siblings('.mail-fields').slideDown('fast');
|
43 |
+
} else if ($(this).parent().siblings('.mail-fields').is(':visible')
|
44 |
+
&& $(this).not(':checked')) {
|
45 |
+
$(this).parent().siblings('.mail-fields').slideUp('fast');
|
46 |
+
}
|
47 |
+
});
|
48 |
+
});
|
49 |
+
|
50 |
+
postboxes.add_postbox_toggles('cfseven');
|
51 |
+
|
52 |
+
} catch (e) {
|
53 |
+
}
|
54 |
+
});
|
55 |
+
|
56 |
+
function updateTag() {
|
57 |
+
var title = $('input#wpcf7-title').val();
|
58 |
+
|
59 |
+
if (title)
|
60 |
+
title = title.replace(/["'\[\]]/g, '');
|
61 |
+
|
62 |
+
$('input#wpcf7-title').val(title);
|
63 |
+
var postId = $('input#post_ID').val();
|
64 |
+
var tag = '[contact-form-7 id="' + postId + '" title="' + title + '"]';
|
65 |
+
$('input#contact-form-anchor-text').val(tag);
|
66 |
+
|
67 |
+
var oldId = $('input#wpcf7-id').val();
|
68 |
+
|
69 |
+
if (0 != oldId) {
|
70 |
+
var tagOld = '[contact-form ' + oldId + ' "' + title + '"]';
|
71 |
+
$('input#contact-form-anchor-text-old').val(tagOld).parent('p.tagcode').show();
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
})(jQuery);
|
admin/styles-rtl.css
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
ul.subsubsub li.addnew {
|
2 |
-
margin-left: 0;
|
3 |
-
margin-right: 0.5em;
|
4 |
-
}
|
5 |
-
div.save-contact-form {
|
6 |
-
direction: rtl;
|
7 |
-
}
|
8 |
-
div.actions-link {
|
9 |
-
right: auto;
|
10 |
-
left: 0;
|
11 |
-
}
|
12 |
-
div.tg-pane table caption {
|
13 |
-
text-align: right;
|
14 |
-
}
|
15 |
-
div.tg-dropdown {
|
16 |
-
left: auto;
|
17 |
-
right: 0;
|
18 |
}
|
1 |
+
ul.subsubsub li.addnew {
|
2 |
+
margin-left: 0;
|
3 |
+
margin-right: 0.5em;
|
4 |
+
}
|
5 |
+
div.save-contact-form {
|
6 |
+
direction: rtl;
|
7 |
+
}
|
8 |
+
div.actions-link {
|
9 |
+
right: auto;
|
10 |
+
left: 0;
|
11 |
+
}
|
12 |
+
div.tg-pane table caption {
|
13 |
+
text-align: right;
|
14 |
+
}
|
15 |
+
div.tg-dropdown {
|
16 |
+
left: auto;
|
17 |
+
right: 0;
|
18 |
}
|
admin/styles.css
CHANGED
@@ -1,271 +1,275 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
}
|
10 |
-
|
11 |
-
div.wrap div.
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
border-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
font-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
}
|
38 |
-
|
39 |
-
div.wrap
|
40 |
-
|
41 |
-
}
|
42 |
-
|
43 |
-
ul.subsubsub
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
ul.subsubsub li.addnew
|
48 |
-
|
49 |
-
}
|
50 |
-
|
51 |
-
ul.subsubsub li.addnew a
|
52 |
-
|
53 |
-
}
|
54 |
-
|
55 |
-
ul.subsubsub li.addnew a
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
padding:
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
padding:
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
}
|
91 |
-
|
92 |
-
div.actions-link input.
|
93 |
-
color: #
|
94 |
-
}
|
95 |
-
|
96 |
-
|
97 |
-
color: #
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
color:
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
background-color:
|
114 |
-
}
|
115 |
-
|
116 |
-
|
117 |
-
color: #
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
}
|
138 |
-
|
139 |
-
.postbox .
|
140 |
-
margin-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
}
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
}
|
156 |
-
|
157 |
-
input
|
158 |
-
|
159 |
-
}
|
160 |
-
|
161 |
-
|
162 |
-
width: 100%;
|
163 |
-
}
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
}
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
}
|
200 |
-
|
201 |
-
div.tg-pane table
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
border
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
}
|
236 |
-
|
237 |
-
div.tg-pane input.
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
}
|
251 |
-
|
252 |
-
div.tg-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
|
|
|
|
|
|
271 |
}
|
1 |
+
#icon-wpcf7 {
|
2 |
+
background: transparent url(./images/screen-icon.png) no-repeat 2px 1px;
|
3 |
+
}
|
4 |
+
|
5 |
+
div.wrap div.cf7com-links {
|
6 |
+
text-align: right;
|
7 |
+
font-size: .9em;
|
8 |
+
margin-top: -1.6em;
|
9 |
+
}
|
10 |
+
|
11 |
+
div.wrap div.cf7com-links a {
|
12 |
+
text-decoration: none;
|
13 |
+
}
|
14 |
+
|
15 |
+
div.wrap div.donation {
|
16 |
+
border-width: 1px;
|
17 |
+
border-style: solid;
|
18 |
+
padding: 0 0.6em;
|
19 |
+
margin: 5px 0 15px;
|
20 |
+
-webkit-border-radius: 3px;
|
21 |
+
border-radius: 3px;
|
22 |
+
background-color: #ffffe0;
|
23 |
+
border-color: #e6db55;
|
24 |
+
text-align: center;
|
25 |
+
}
|
26 |
+
|
27 |
+
div.wrap div.donation p {
|
28 |
+
margin: .7em 0;
|
29 |
+
line-height: 1;
|
30 |
+
padding: 2px;
|
31 |
+
font-size: 107%;
|
32 |
+
}
|
33 |
+
|
34 |
+
div.wrap div.donation p a {
|
35 |
+
font-weight: bold;
|
36 |
+
color: #3f3f3f;
|
37 |
+
}
|
38 |
+
|
39 |
+
div.wrap div.donation p a.button {
|
40 |
+
margin-left: 1em;
|
41 |
+
}
|
42 |
+
|
43 |
+
div.wrap ul.subsubsub {
|
44 |
+
white-space: normal;
|
45 |
+
}
|
46 |
+
|
47 |
+
ul.subsubsub li.addnew {
|
48 |
+
margin-left: 0.5em;
|
49 |
+
}
|
50 |
+
|
51 |
+
ul.subsubsub li.addnew a {
|
52 |
+
color: #e6255b;
|
53 |
+
}
|
54 |
+
|
55 |
+
ul.subsubsub li.addnew a.current {
|
56 |
+
border: 1px solid #bbb;
|
57 |
+
}
|
58 |
+
|
59 |
+
ul.subsubsub li.addnew a:hover,
|
60 |
+
ul.subsubsub li.addnew a:active {
|
61 |
+
color: #999;
|
62 |
+
}
|
63 |
+
|
64 |
+
#titlediv {
|
65 |
+
margin-bottom: 20px;
|
66 |
+
position: relative;
|
67 |
+
border: 1px solid #c7c7c7;
|
68 |
+
padding: 6px;
|
69 |
+
}
|
70 |
+
|
71 |
+
div.save-contact-form {
|
72 |
+
padding: 1.4em 0 0 0;
|
73 |
+
text-align: right;
|
74 |
+
}
|
75 |
+
|
76 |
+
div.actions-link {
|
77 |
+
position: absolute;
|
78 |
+
top: 0;
|
79 |
+
right: 0;
|
80 |
+
margin: 0;
|
81 |
+
padding: 6px;
|
82 |
+
}
|
83 |
+
|
84 |
+
div.actions-link input {
|
85 |
+
padding: 0;
|
86 |
+
margin: 0;
|
87 |
+
border: none;
|
88 |
+
font-size: 11px;
|
89 |
+
cursor: pointer;
|
90 |
+
}
|
91 |
+
|
92 |
+
div.actions-link input.copy {
|
93 |
+
color: #006505;
|
94 |
+
}
|
95 |
+
|
96 |
+
div.actions-link input.delete {
|
97 |
+
color: #bc0b0b;
|
98 |
+
}
|
99 |
+
|
100 |
+
input#wpcf7-title {
|
101 |
+
color: #555;
|
102 |
+
border: none;
|
103 |
+
font: bold 20px serif;
|
104 |
+
cursor: pointer;
|
105 |
+
background-color: transparent;
|
106 |
+
}
|
107 |
+
|
108 |
+
input#wpcf7-title.focus {
|
109 |
+
color: #333;
|
110 |
+
border: 1px solid #777;
|
111 |
+
font: normal 13px Verdana, Arial, Helvetica, sans-serif;
|
112 |
+
cursor: text;
|
113 |
+
background-color: transparent;
|
114 |
+
}
|
115 |
+
|
116 |
+
input#wpcf7-title.mouseover {
|
117 |
+
background-color: #ffffdd;
|
118 |
+
}
|
119 |
+
|
120 |
+
p.tagcode {
|
121 |
+
color: #333;
|
122 |
+
margin: 2ex 0 1ex 0;
|
123 |
+
}
|
124 |
+
|
125 |
+
input#contact-form-anchor-text, input#contact-form-anchor-text-old {
|
126 |
+
color: #fff;
|
127 |
+
background: #7e4e0b;
|
128 |
+
border: none;
|
129 |
+
width: 100%;
|
130 |
+
-webkit-border-radius: 6px;
|
131 |
+
border-radius: 6px;
|
132 |
+
}
|
133 |
+
|
134 |
+
.postbox .half, .postbox .half-left, .postbox .half-right {
|
135 |
+
float: left;
|
136 |
+
width: 50%;
|
137 |
+
}
|
138 |
+
|
139 |
+
.postbox .half-right > * {
|
140 |
+
margin-left: 10px;
|
141 |
+
}
|
142 |
+
|
143 |
+
.postbox .mail-field, .postbox .message-field {
|
144 |
+
margin-top: 6px;
|
145 |
+
margin-bottom: 8px;
|
146 |
+
}
|
147 |
+
|
148 |
+
.postbox .mail-field label, .postbox .message-field label {
|
149 |
+
line-height: 1.4em;
|
150 |
+
}
|
151 |
+
|
152 |
+
div.pseudo-hr {
|
153 |
+
border-bottom: 1px solid transparent;
|
154 |
+
margin: 8px 0;
|
155 |
+
}
|
156 |
+
|
157 |
+
input, textarea {
|
158 |
+
border: 1px solid #dfdfdf;
|
159 |
+
}
|
160 |
+
|
161 |
+
input.wide {
|
162 |
+
width: 100%;
|
163 |
+
}
|
164 |
+
|
165 |
+
textarea {
|
166 |
+
width: 100%;
|
167 |
+
}
|
168 |
+
|
169 |
+
label.disabled {
|
170 |
+
color: #777;
|
171 |
+
}
|
172 |
+
|
173 |
+
div.tag-generator {
|
174 |
+
position: relative;
|
175 |
+
background: transparent;
|
176 |
+
padding: 0 0 5px 1px;
|
177 |
+
}
|
178 |
+
|
179 |
+
div.tg-pane {
|
180 |
+
border: 1px dashed #999;
|
181 |
+
background: #f1f1f1;
|
182 |
+
margin: 1ex 0 0 0;
|
183 |
+
padding: 10px;
|
184 |
+
-webkit-border-radius: 6px;
|
185 |
+
border-radius: 6px;
|
186 |
+
line-height: 140%;
|
187 |
+
}
|
188 |
+
|
189 |
+
div.tg-pane table {
|
190 |
+
width: 100%;
|
191 |
+
margin: 0 0 0.7em 0;
|
192 |
+
}
|
193 |
+
|
194 |
+
div.tg-pane table caption {
|
195 |
+
text-align: left;
|
196 |
+
padding: 0 0 0.2em 0;
|
197 |
+
font-weight: bolder;
|
198 |
+
color: #777;
|
199 |
+
}
|
200 |
+
|
201 |
+
div.tg-pane table code {
|
202 |
+
background-color: inherit;
|
203 |
+
}
|
204 |
+
|
205 |
+
div.tg-pane table td {
|
206 |
+
vertical-align: top;
|
207 |
+
width: 50%;
|
208 |
+
border: none;
|
209 |
+
padding: 2px 0;
|
210 |
+
}
|
211 |
+
|
212 |
+
div.tg-pane input.tag, div.tg-pane input.mail-tag {
|
213 |
+
width: 100%;
|
214 |
+
border: none;
|
215 |
+
color: #fff;
|
216 |
+
background-color: #7e4e0b;
|
217 |
+
-webkit-border-radius: 6px;
|
218 |
+
border-radius: 6px;
|
219 |
+
}
|
220 |
+
|
221 |
+
div.tg-pane input.mail-tag {
|
222 |
+
width: 50%;
|
223 |
+
background-color: #404f03;
|
224 |
+
}
|
225 |
+
|
226 |
+
div.tg-mail-tag {
|
227 |
+
margin-top: 2.4em;
|
228 |
+
text-align: right;
|
229 |
+
}
|
230 |
+
|
231 |
+
div.tg-pane span.arrow {
|
232 |
+
font-family: monospace;
|
233 |
+
font-size: 1.2em;
|
234 |
+
color: #333;
|
235 |
+
}
|
236 |
+
|
237 |
+
div.tg-pane input.tg-name {
|
238 |
+
border-color: #555;
|
239 |
+
}
|
240 |
+
|
241 |
+
div.tg-pane input.oneline {
|
242 |
+
width: 98%;
|
243 |
+
font-size: smaller;
|
244 |
+
}
|
245 |
+
|
246 |
+
div.tg-pane textarea {
|
247 |
+
width: 98%;
|
248 |
+
height: 100px;
|
249 |
+
font-size: smaller;
|
250 |
+
}
|
251 |
+
|
252 |
+
div.tg-pane div.tg-tag {
|
253 |
+
margin: .4em 0;
|
254 |
+
}
|
255 |
+
|
256 |
+
div.tg-dropdown {
|
257 |
+
position: absolute;
|
258 |
+
top: 26px;
|
259 |
+
left: 0;
|
260 |
+
z-index: 10;
|
261 |
+
border: 1px solid #ddd;
|
262 |
+
}
|
263 |
+
|
264 |
+
span.tg-closebutton {
|
265 |
+
color: #777;
|
266 |
+
font: bold 18px monospace;
|
267 |
+
padding: 1px 4px;
|
268 |
+
cursor: pointer;
|
269 |
+
}
|
270 |
+
|
271 |
+
div.tg-panetitle {
|
272 |
+
font: bold 132% sans-serif;
|
273 |
+
margin: 0 0 10px;
|
274 |
+
color: #777;
|
275 |
}
|
includes/classes.php
CHANGED
@@ -1,577 +1,733 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WPCF7_ContactForm {
|
4 |
-
|
5 |
-
var $initial = false;
|
6 |
-
|
7 |
-
var $id;
|
8 |
-
var $title;
|
9 |
-
|
10 |
-
var $unit_tag;
|
11 |
-
|
12 |
-
var $responses_count = 0;
|
13 |
-
var $scanned_form_tags;
|
14 |
-
|
15 |
-
var $posted_data;
|
16 |
-
var $uploaded_files = array();
|
17 |
-
|
18 |
-
var $skip_mail = false;
|
19 |
-
|
20 |
-
// Return true if this form is the same one as currently POSTed.
|
21 |
-
function is_posted() {
|
22 |
-
if ( ! isset( $_POST['_wpcf7_unit_tag'] ) || empty( $_POST['_wpcf7_unit_tag'] ) )
|
23 |
-
return false;
|
24 |
-
|
25 |
-
if ( $this->unit_tag == $_POST['_wpcf7_unit_tag'] )
|
26 |
-
return true;
|
27 |
-
|
28 |
-
return false;
|
29 |
-
}
|
30 |
-
|
31 |
-
function clear_post() {
|
32 |
-
$fes = $this->form_scan_shortcode();
|
33 |
-
|
34 |
-
foreach ( $fes as $fe ) {
|
35 |
-
if ( ! isset( $fe['name'] ) || empty( $fe['name'] ) )
|
36 |
-
continue;
|
37 |
-
|
38 |
-
$name = $fe['name'];
|
39 |
-
|
40 |
-
if ( isset( $_POST[$name] ) )
|
41 |
-
unset( $_POST[$name] );
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
/* Generating Form HTML */
|
46 |
-
|
47 |
-
function form_html() {
|
48 |
-
$form = '<div class="wpcf7" id="' . $this->unit_tag . '">';
|
49 |
-
|
50 |
-
$url = wpcf7_get_request_uri();
|
51 |
-
|
52 |
-
if ( $frag = strstr( $url, '#' ) )
|
53 |
-
$url = substr( $url, 0, -strlen( $frag ) );
|
54 |
-
|
55 |
-
$url .= '#' . $this->unit_tag;
|
56 |
-
|
57 |
-
$url = apply_filters( 'wpcf7_form_action_url', $url );
|
58 |
-
$enctype = apply_filters( 'wpcf7_form_enctype', '' );
|
59 |
-
$class = apply_filters( 'wpcf7_form_class_attr', 'wpcf7-form' );
|
60 |
-
|
61 |
-
$form .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
|
62 |
-
. ' class="' . esc_attr( $class ) . '"' . $enctype . '>' . "\n";
|
63 |
-
|
64 |
-
$form .=
|
65 |
-
|
66 |
-
$form .=
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
$form .=
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
$
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
$
|
134 |
-
|
135 |
-
if (
|
136 |
-
$
|
137 |
-
|
138 |
-
}
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
$
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
$
|
225 |
-
$
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
$value = $
|
236 |
-
}
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
}
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
$
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
}
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
$
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WPCF7_ContactForm {
|
4 |
+
|
5 |
+
var $initial = false;
|
6 |
+
|
7 |
+
var $id;
|
8 |
+
var $title;
|
9 |
+
|
10 |
+
var $unit_tag;
|
11 |
+
|
12 |
+
var $responses_count = 0;
|
13 |
+
var $scanned_form_tags;
|
14 |
+
|
15 |
+
var $posted_data;
|
16 |
+
var $uploaded_files = array();
|
17 |
+
|
18 |
+
var $skip_mail = false;
|
19 |
+
|
20 |
+
// Return true if this form is the same one as currently POSTed.
|
21 |
+
function is_posted() {
|
22 |
+
if ( ! isset( $_POST['_wpcf7_unit_tag'] ) || empty( $_POST['_wpcf7_unit_tag'] ) )
|
23 |
+
return false;
|
24 |
+
|
25 |
+
if ( $this->unit_tag == $_POST['_wpcf7_unit_tag'] )
|
26 |
+
return true;
|
27 |
+
|
28 |
+
return false;
|
29 |
+
}
|
30 |
+
|
31 |
+
function clear_post() {
|
32 |
+
$fes = $this->form_scan_shortcode();
|
33 |
+
|
34 |
+
foreach ( $fes as $fe ) {
|
35 |
+
if ( ! isset( $fe['name'] ) || empty( $fe['name'] ) )
|
36 |
+
continue;
|
37 |
+
|
38 |
+
$name = $fe['name'];
|
39 |
+
|
40 |
+
if ( isset( $_POST[$name] ) )
|
41 |
+
unset( $_POST[$name] );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/* Generating Form HTML */
|
46 |
+
|
47 |
+
function form_html() {
|
48 |
+
$form = '<div class="wpcf7" id="' . $this->unit_tag . '">';
|
49 |
+
|
50 |
+
$url = wpcf7_get_request_uri();
|
51 |
+
|
52 |
+
if ( $frag = strstr( $url, '#' ) )
|
53 |
+
$url = substr( $url, 0, -strlen( $frag ) );
|
54 |
+
|
55 |
+
$url .= '#' . $this->unit_tag;
|
56 |
+
|
57 |
+
$url = apply_filters( 'wpcf7_form_action_url', $url );
|
58 |
+
$enctype = apply_filters( 'wpcf7_form_enctype', '' );
|
59 |
+
$class = apply_filters( 'wpcf7_form_class_attr', 'wpcf7-form' );
|
60 |
+
|
61 |
+
$form .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
|
62 |
+
. ' class="' . esc_attr( $class ) . '"' . $enctype . '>' . "\n";
|
63 |
+
|
64 |
+
$form .= $this->form_hidden_fields();
|
65 |
+
|
66 |
+
$form .= $this->form_elements();
|
67 |
+
|
68 |
+
if ( ! $this->responses_count )
|
69 |
+
$form .= $this->form_response_output();
|
70 |
+
|
71 |
+
$form .= '</form>';
|
72 |
+
|
73 |
+
$form .= '</div>';
|
74 |
+
|
75 |
+
return $form;
|
76 |
+
}
|
77 |
+
|
78 |
+
function form_hidden_fields() {
|
79 |
+
$hidden_fields = array(
|
80 |
+
'_wpcf7' => $this->id,
|
81 |
+
'_wpcf7_version' => WPCF7_VERSION,
|
82 |
+
'_wpcf7_unit_tag' => $this->unit_tag );
|
83 |
+
|
84 |
+
if ( WPCF7_VERIFY_NONCE )
|
85 |
+
$hidden_fields['_wpnonce'] = wp_create_nonce( $this->unit_tag );
|
86 |
+
|
87 |
+
$content = '';
|
88 |
+
|
89 |
+
foreach ( $hidden_fields as $name => $value ) {
|
90 |
+
$content .= '<input type="hidden"'
|
91 |
+
. ' name="' . esc_attr( $name ) . '"'
|
92 |
+
. ' value="' . esc_attr( $value ) . '" />' . "\n";
|
93 |
+
}
|
94 |
+
|
95 |
+
return '<div style="display: none;">' . "\n" . $content . '</div>' . "\n";
|
96 |
+
}
|
97 |
+
|
98 |
+
function form_response_output() {
|
99 |
+
$class = 'wpcf7-response-output';
|
100 |
+
$content = '';
|
101 |
+
|
102 |
+
if ( $this->is_posted() ) { // Post response output for non-AJAX
|
103 |
+
if ( isset( $_POST['_wpcf7_mail_sent'] ) && $_POST['_wpcf7_mail_sent']['id'] == $this->id ) {
|
104 |
+
if ( $_POST['_wpcf7_mail_sent']['ok'] ) {
|
105 |
+
$class .= ' wpcf7-mail-sent-ok';
|
106 |
+
$content = $_POST['_wpcf7_mail_sent']['message'];
|
107 |
+
} else {
|
108 |
+
$class .= ' wpcf7-mail-sent-ng';
|
109 |
+
if ( $_POST['_wpcf7_mail_sent']['spam'] )
|
110 |
+
$class .= ' wpcf7-spam-blocked';
|
111 |
+
$content = $_POST['_wpcf7_mail_sent']['message'];
|
112 |
+
}
|
113 |
+
} elseif ( isset( $_POST['_wpcf7_validation_errors'] ) && $_POST['_wpcf7_validation_errors']['id'] == $this->id ) {
|
114 |
+
$class .= ' wpcf7-validation-errors';
|
115 |
+
$content = $this->message( 'validation_error' );
|
116 |
+
}
|
117 |
+
} else {
|
118 |
+
$class .= ' wpcf7-display-none';
|
119 |
+
}
|
120 |
+
|
121 |
+
$class = ' class="' . $class . '"';
|
122 |
+
|
123 |
+
return '<div' . $class . '>' . $content . '</div>';
|
124 |
+
}
|
125 |
+
|
126 |
+
function validation_error( $name ) {
|
127 |
+
if ( ! $this->is_posted() )
|
128 |
+
return '';
|
129 |
+
|
130 |
+
if ( ! isset( $_POST['_wpcf7_validation_errors']['messages'][$name] ) )
|
131 |
+
return '';
|
132 |
+
|
133 |
+
$ve = trim( $_POST['_wpcf7_validation_errors']['messages'][$name] );
|
134 |
+
|
135 |
+
if ( ! empty( $ve ) ) {
|
136 |
+
$ve = '<span class="wpcf7-not-valid-tip-no-ajax">' . esc_html( $ve ) . '</span>';
|
137 |
+
return apply_filters( 'wpcf7_validation_error', $ve, $name, $this );
|
138 |
+
}
|
139 |
+
|
140 |
+
return '';
|
141 |
+
}
|
142 |
+
|
143 |
+
/* Form Elements */
|
144 |
+
|
145 |
+
function form_do_shortcode() {
|
146 |
+
global $wpcf7_shortcode_manager;
|
147 |
+
|
148 |
+
$form = $this->form;
|
149 |
+
|
150 |
+
if ( WPCF7_AUTOP ) {
|
151 |
+
$form = $wpcf7_shortcode_manager->normalize_shortcode( $form );
|
152 |
+
$form = wpcf7_autop( $form );
|
153 |
+
}
|
154 |
+
|
155 |
+
$form = $wpcf7_shortcode_manager->do_shortcode( $form );
|
156 |
+
$this->scanned_form_tags = $wpcf7_shortcode_manager->scanned_tags;
|
157 |
+
|
158 |
+
return $form;
|
159 |
+
}
|
160 |
+
|
161 |
+
function form_scan_shortcode( $cond = null ) {
|
162 |
+
global $wpcf7_shortcode_manager;
|
163 |
+
|
164 |
+
if ( ! empty( $this->scanned_form_tags ) ) {
|
165 |
+
$scanned = $this->scanned_form_tags;
|
166 |
+
} else {
|
167 |
+
$scanned = $wpcf7_shortcode_manager->scan_shortcode( $this->form );
|
168 |
+
$this->scanned_form_tags = $scanned;
|
169 |
+
}
|
170 |
+
|
171 |
+
if ( empty( $scanned ) )
|
172 |
+
return null;
|
173 |
+
|
174 |
+
if ( ! is_array( $cond ) || empty( $cond ) )
|
175 |
+
return $scanned;
|
176 |
+
|
177 |
+
for ( $i = 0, $size = count( $scanned ); $i < $size; $i++ ) {
|
178 |
+
|
179 |
+
if ( isset( $cond['type'] ) ) {
|
180 |
+
if ( is_string( $cond['type'] ) && ! empty( $cond['type'] ) ) {
|
181 |
+
if ( $scanned[$i]['type'] != $cond['type'] ) {
|
182 |
+
unset( $scanned[$i] );
|
183 |
+
continue;
|
184 |
+
}
|
185 |
+
} elseif ( is_array( $cond['type'] ) ) {
|
186 |
+
if ( ! in_array( $scanned[$i]['type'], $cond['type'] ) ) {
|
187 |
+
unset( $scanned[$i] );
|
188 |
+
continue;
|
189 |
+
}
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
if ( isset( $cond['name'] ) ) {
|
194 |
+
if ( is_string( $cond['name'] ) && ! empty( $cond['name'] ) ) {
|
195 |
+
if ( $scanned[$i]['name'] != $cond['name'] ) {
|
196 |
+
unset ( $scanned[$i] );
|
197 |
+
continue;
|
198 |
+
}
|
199 |
+
} elseif ( is_array( $cond['name'] ) ) {
|
200 |
+
if ( ! in_array( $scanned[$i]['name'], $cond['name'] ) ) {
|
201 |
+
unset( $scanned[$i] );
|
202 |
+
continue;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
return array_values( $scanned );
|
209 |
+
}
|
210 |
+
|
211 |
+
function form_elements() {
|
212 |
+
return apply_filters( 'wpcf7_form_elements', $this->form_do_shortcode() );
|
213 |
+
}
|
214 |
+
|
215 |
+
function setup_posted_data() {
|
216 |
+
$posted_data = (array) $_POST;
|
217 |
+
|
218 |
+
$fes = $this->form_scan_shortcode();
|
219 |
+
|
220 |
+
foreach ( $fes as $fe ) {
|
221 |
+
if ( empty( $fe['name'] ) )
|
222 |
+
continue;
|
223 |
+
|
224 |
+
$name = $fe['name'];
|
225 |
+
$pipes = $fe['pipes'];
|
226 |
+
$value = $_POST[$name];
|
227 |
+
|
228 |
+
if ( WPCF7_USE_PIPE && is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) {
|
229 |
+
if ( is_array( $value) ) {
|
230 |
+
$new_value = array();
|
231 |
+
|
232 |
+
foreach ( $value as $v )
|
233 |
+
$new_value[] = $pipes->do_pipe( stripslashes( $v ) );
|
234 |
+
|
235 |
+
$value = $new_value;
|
236 |
+
} else {
|
237 |
+
$value = $pipes->do_pipe( stripslashes( $value ) );
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
$posted_data[$name] = $value;
|
242 |
+
}
|
243 |
+
|
244 |
+
$this->posted_data = apply_filters( 'wpcf7_posted_data', $posted_data );
|
245 |
+
|
246 |
+
return $this->posted_data;
|
247 |
+
}
|
248 |
+
|
249 |
+
function submit( $ajax = false ) {
|
250 |
+
$result = array(
|
251 |
+
'valid' => true,
|
252 |
+
'invalid_reasons' => array(),
|
253 |
+
'spam' => false,
|
254 |
+
'message' => '',
|
255 |
+
'mail_sent' => false,
|
256 |
+
'scripts_on_sent_ok' => null );
|
257 |
+
|
258 |
+
$this->setup_posted_data();
|
259 |
+
|
260 |
+
$validation = $this->validate();
|
261 |
+
|
262 |
+
if ( ! $validation['valid'] ) { // Validation error occured
|
263 |
+
$result['valid'] = false;
|
264 |
+
$result['invalid_reasons'] = $validation['reason'];
|
265 |
+
$result['message'] = $this->message( 'validation_error' );
|
266 |
+
|
267 |
+
} elseif ( ! $this->accepted() ) { // Not accepted terms
|
268 |
+
$result['message'] = $this->message( 'accept_terms' );
|
269 |
+
|
270 |
+
} elseif ( $this->spam() ) { // Spam!
|
271 |
+
$result['message'] = $this->message( 'spam' );
|
272 |
+
$result['spam'] = true;
|
273 |
+
|
274 |
+
} elseif ( $this->mail() ) {
|
275 |
+
$result['mail_sent'] = true;
|
276 |
+
$result['message'] = $this->message( 'mail_sent_ok' );
|
277 |
+
|
278 |
+
do_action_ref_array( 'wpcf7_mail_sent', array( &$this ) );
|
279 |
+
|
280 |
+
if ( $ajax ) {
|
281 |
+
$on_sent_ok = $this->additional_setting( 'on_sent_ok', false );
|
282 |
+
|
283 |
+
if ( ! empty( $on_sent_ok ) )
|
284 |
+
$result['scripts_on_sent_ok'] = array_map( 'wpcf7_strip_quote', $on_sent_ok );
|
285 |
+
} else {
|
286 |
+
$this->clear_post();
|
287 |
+
}
|
288 |
+
|
289 |
+
} else {
|
290 |
+
$result['message'] = $this->message( 'mail_sent_ng' );
|
291 |
+
}
|
292 |
+
|
293 |
+
// remove upload files
|
294 |
+
foreach ( (array) $this->uploaded_files as $name => $path ) {
|
295 |
+
@unlink( $path );
|
296 |
+
}
|
297 |
+
|
298 |
+
return $result;
|
299 |
+
}
|
300 |
+
|
301 |
+
/* Validate */
|
302 |
+
|
303 |
+
function validate() {
|
304 |
+
$fes = $this->form_scan_shortcode();
|
305 |
+
|
306 |
+
$result = array( 'valid' => true, 'reason' => array() );
|
307 |
+
|
308 |
+
foreach ( $fes as $fe ) {
|
309 |
+
$result = apply_filters( 'wpcf7_validate_' . $fe['type'], $result, $fe );
|
310 |
+
}
|
311 |
+
|
312 |
+
$result = apply_filters( 'wpcf7_validate', $result );
|
313 |
+
|
314 |
+
return $result;
|
315 |
+
}
|
316 |
+
|
317 |
+
function accepted() {
|
318 |
+
$accepted = true;
|
319 |
+
|
320 |
+
return apply_filters( 'wpcf7_acceptance', $accepted );
|
321 |
+
}
|
322 |
+
|
323 |
+
function spam() {
|
324 |
+
$spam = false;
|
325 |
+
|
326 |
+
if ( WPCF7_VERIFY_NONCE && ! $this->verify_nonce() )
|
327 |
+
$spam = true;
|
328 |
+
|
329 |
+
return apply_filters( 'wpcf7_spam', $spam );
|
330 |
+
}
|
331 |
+
|
332 |
+
function verify_nonce() {
|
333 |
+
return wp_verify_nonce( $_POST['_wpnonce'], $_POST['_wpcf7_unit_tag'] );
|
334 |
+
}
|
335 |
+
|
336 |
+
/* Mail */
|
337 |
+
|
338 |
+
function mail() {
|
339 |
+
if ( $this->in_demo_mode() )
|
340 |
+
$this->skip_mail = true;
|
341 |
+
|
342 |
+
do_action_ref_array( 'wpcf7_before_send_mail', array( &$this ) );
|
343 |
+
|
344 |
+
if ( $this->skip_mail )
|
345 |
+
return true;
|
346 |
+
|
347 |
+
$result = $this->compose_mail( $this->setup_mail_template( $this->mail, 'mail' ) );
|
348 |
+
|
349 |
+
if ( $result ) {
|
350 |
+
$additional_mail = array();
|
351 |
+
|
352 |
+
if ( $this->mail_2['active'] )
|
353 |
+
$additional_mail[] = $this->setup_mail_template( $this->mail_2, 'mail_2' );
|
354 |
+
|
355 |
+
$additional_mail = apply_filters_ref_array( 'wpcf7_additional_mail',
|
356 |
+
array( $additional_mail, &$this ) );
|
357 |
+
|
358 |
+
foreach ( $additional_mail as $mail )
|
359 |
+
$this->compose_mail( $mail );
|
360 |
+
|
361 |
+
return true;
|
362 |
+
}
|
363 |
+
|
364 |
+
return false;
|
365 |
+
}
|
366 |
+
|
367 |
+
function setup_mail_template( $mail_template, $name = '' ) {
|
368 |
+
$defaults = array(
|
369 |
+
'subject' => '', 'sender' => '', 'body' => '',
|
370 |
+
'recipient' => '', 'additional_headers' => '',
|
371 |
+
'attachments' => '', 'use_html' => false );
|
372 |
+
|
373 |
+
$mail_template = wp_parse_args( $mail_template, $defaults );
|
374 |
+
|
375 |
+
$name = trim( $name );
|
376 |
+
|
377 |
+
if ( ! empty( $name ) )
|
378 |
+
$mail_template['name'] = $name;
|
379 |
+
|
380 |
+
return $mail_template;
|
381 |
+
}
|
382 |
+
|
383 |
+
function compose_mail( $mail_template, $send = true ) {
|
384 |
+
$this->mail_template_in_process = $mail_template;
|
385 |
+
|
386 |
+
$regex = '/(\[?)\[\s*([a-zA-Z_][0-9a-zA-Z:._-]*)\s*\](\]?)/';
|
387 |
+
|
388 |
+
$use_html = (bool) $mail_template['use_html'];
|
389 |
+
|
390 |
+
$callback = array( &$this, 'mail_callback' );
|
391 |
+
$callback_html = array( &$this, 'mail_callback_html' );
|
392 |
+
|
393 |
+
$subject = preg_replace_callback( $regex, $callback, $mail_template['subject'] );
|
394 |
+
$sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] );
|
395 |
+
$recipient = preg_replace_callback( $regex, $callback, $mail_template['recipient'] );
|
396 |
+
$additional_headers =
|
397 |
+
preg_replace_callback( $regex, $callback, $mail_template['additional_headers'] );
|
398 |
+
|
399 |
+
if ( $use_html ) {
|
400 |
+
$body = preg_replace_callback( $regex, $callback_html, $mail_template['body'] );
|
401 |
+
$body = wpautop( $body );
|
402 |
+
} else {
|
403 |
+
$body = preg_replace_callback( $regex, $callback, $mail_template['body'] );
|
404 |
+
}
|
405 |
+
|
406 |
+
$attachments = array();
|
407 |
+
|
408 |
+
foreach ( (array) $this->uploaded_files as $name => $path ) {
|
409 |
+
if ( false === strpos( $mail_template['attachments'], "[${name}]" ) || empty( $path ) )
|
410 |
+
continue;
|
411 |
+
|
412 |
+
$attachments[] = $path;
|
413 |
+
}
|
414 |
+
|
415 |
+
$components = compact(
|
416 |
+
'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments' );
|
417 |
+
|
418 |
+
$components = apply_filters_ref_array( 'wpcf7_mail_components',
|
419 |
+
array( $components, &$this ) );
|
420 |
+
|
421 |
+
extract( $components );
|
422 |
+
|
423 |
+
$headers = "From: $sender\n";
|
424 |
+
|
425 |
+
if ( $use_html )
|
426 |
+
$headers .= "Content-Type: text/html\n";
|
427 |
+
|
428 |
+
$headers .= trim( $additional_headers ) . "\n";
|
429 |
+
|
430 |
+
if ( $send )
|
431 |
+
return @wp_mail( $recipient, $subject, $body, $headers, $attachments );
|
432 |
+
|
433 |
+
return compact( 'subject', 'sender', 'body', 'recipient', 'headers', 'attachments' );
|
434 |
+
}
|
435 |
+
|
436 |
+
function mail_callback_html( $matches ) {
|
437 |
+
return $this->mail_callback( $matches, true );
|
438 |
+
}
|
439 |
+
|
440 |
+
function mail_callback( $matches, $html = false ) {
|
441 |
+
// allow [[foo]] syntax for escaping a tag
|
442 |
+
if ( $matches[1] == '[' && $matches[3] == ']' )
|
443 |
+
return substr( $matches[0], 1, -1 );
|
444 |
+
|
445 |
+
if ( isset( $this->posted_data[$matches[2]] ) ) {
|
446 |
+
$submitted = $this->posted_data[$matches[2]];
|
447 |
+
|
448 |
+
if ( is_array( $submitted ) )
|
449 |
+
$replaced = join( ', ', $submitted );
|
450 |
+
else
|
451 |
+
$replaced = $submitted;
|
452 |
+
|
453 |
+
if ( $html ) {
|
454 |
+
$replaced = strip_tags( $replaced );
|
455 |
+
$replaced = wptexturize( $replaced );
|
456 |
+
}
|
457 |
+
|
458 |
+
$replaced = apply_filters( 'wpcf7_mail_tag_replaced', $replaced, $submitted );
|
459 |
+
|
460 |
+
return stripslashes( $replaced );
|
461 |
+
}
|
462 |
+
|
463 |
+
if ( $special = apply_filters( 'wpcf7_special_mail_tags', '', $matches[2] ) )
|
464 |
+
return $special;
|
465 |
+
|
466 |
+
return $matches[0];
|
467 |
+
}
|
468 |
+
|
469 |
+
/* Message */
|
470 |
+
|
471 |
+
function message( $status ) {
|
472 |
+
$messages = $this->messages;
|
473 |
+
$message = isset( $messages[$status] ) ? $messages[$status] : '';
|
474 |
+
|
475 |
+
return apply_filters( 'wpcf7_display_message', $message, $status );
|
476 |
+
}
|
477 |
+
|
478 |
+
/* Additional settings */
|
479 |
+
|
480 |
+
function additional_setting( $name, $max = 1 ) {
|
481 |
+
$tmp_settings = (array) explode( "\n", $this->additional_settings );
|
482 |
+
|
483 |
+
$count = 0;
|
484 |
+
$values = array();
|
485 |
+
|
486 |
+
foreach ( $tmp_settings as $setting ) {
|
487 |
+
if ( preg_match('/^([a-zA-Z0-9_]+)\s*:(.*)#x2F;', $setting, $matches ) ) {
|
488 |
+
if ( $matches[1] != $name )
|
489 |
+
continue;
|
490 |
+
|
491 |
+
if ( ! $max || $count < (int) $max ) {
|
492 |
+
$values[] = trim( $matches[2] );
|
493 |
+
$count += 1;
|
494 |
+
}
|
495 |
+
}
|
496 |
+
}
|
497 |
+
|
498 |
+
return $values;
|
499 |
+
}
|
500 |
+
|
501 |
+
function in_demo_mode() {
|
502 |
+
$settings = $this->additional_setting( 'demo_mode', false );
|
503 |
+
|
504 |
+
foreach ( $settings as $setting ) {
|
505 |
+
if ( in_array( $setting, array( 'on', 'true', '1' ) ) )
|
506 |
+
return true;
|
507 |
+
}
|
508 |
+
|
509 |
+
return false;
|
510 |
+
}
|
511 |
+
|
512 |
+
/* Upgrade */
|
513 |
+
|
514 |
+
function upgrade() {
|
515 |
+
if ( ! isset( $this->mail['recipient'] ) )
|
516 |
+
$this->mail['recipient'] = get_option( 'admin_email' );
|
517 |
+
|
518 |
+
|
519 |
+
if ( ! is_array( $this->messages ) )
|
520 |
+
$this->messages = array();
|
521 |
+
|
522 |
+
|
523 |
+
foreach ( wpcf7_messages() as $key => $arr ) {
|
524 |
+
if ( ! isset( $this->messages[$key] ) )
|
525 |
+
$this->messages[$key] = $arr['default'];
|
526 |
+
}
|
527 |
+
}
|
528 |
+
|
529 |
+
/* Save */
|
530 |
+
|
531 |
+
function save() {
|
532 |
+
$postarr = array(
|
533 |
+
'ID' => (int) $this->id,
|
534 |
+
'post_type' => 'wpcf7_contact_form',
|
535 |
+
'post_status' => 'publish',
|
536 |
+
'post_title' => $this->title );
|
537 |
+
|
538 |
+
$post_id = wp_insert_post( $postarr );
|
539 |
+
|
540 |
+
if ( $post_id ) {
|
541 |
+
$metas = array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' );
|
542 |
+
|
543 |
+
foreach ( $metas as $meta )
|
544 |
+
update_post_meta( $post_id, $meta, wpcf7_normalize_newline_deep( $this->{$meta} ) );
|
545 |
+
|
546 |
+
if ( $this->initial ) {
|
547 |
+
$this->initial = false;
|
548 |
+
$this->id = $post_id;
|
549 |
+
do_action_ref_array( 'wpcf7_after_create', array( &$this ) );
|
550 |
+
} else {
|
551 |
+
do_action_ref_array( 'wpcf7_after_update', array( &$this ) );
|
552 |
+
}
|
553 |
+
|
554 |
+
do_action_ref_array( 'wpcf7_after_save', array( &$this ) );
|
555 |
+
}
|
556 |
+
|
557 |
+
return $post_id;
|
558 |
+
}
|
559 |
+
|
560 |
+
function copy() {
|
561 |
+
$new = new WPCF7_ContactForm();
|
562 |
+
$new->initial = true;
|
563 |
+
$new->title = $this->title . '_copy';
|
564 |
+
|
565 |
+
$new->form = $this->form;
|
566 |
+
$new->mail = $this->mail;
|
567 |
+
$new->mail_2 = $this->mail_2;
|
568 |
+
$new->messages = $this->messages;
|
569 |
+
$new->additional_settings = $this->additional_settings;
|
570 |
+
|
571 |
+
$new = apply_filters_ref_array( 'wpcf7_copy', array( &$new, &$this ) );
|
572 |
+
|
573 |
+
return $new;
|
574 |
+
}
|
575 |
+
|
576 |
+
function delete() {
|
577 |
+
if ( $this->initial )
|
578 |
+
return;
|
579 |
+
|
580 |
+
wp_delete_post( $this->id, true );
|
581 |
+
|
582 |
+
$this->initial = true;
|
583 |
+
$this->id = null;
|
584 |
+
}
|
585 |
+
}
|
586 |
+
|
587 |
+
function wpcf7_contact_form( $id ) {
|
588 |
+
$post = get_post( $id );
|
589 |
+
|
590 |
+
if ( empty( $post ) || 'wpcf7_contact_form' != get_post_type( $post ) )
|
591 |
+
return false;
|
592 |
+
|
593 |
+
$contact_form = new WPCF7_ContactForm();
|
594 |
+
$contact_form->id = $post->ID;
|
595 |
+
$contact_form->title = $post->post_title;
|
596 |
+
|
597 |
+
$contact_form->form = get_post_meta( $post->ID, 'form', true );
|
598 |
+
$contact_form->mail = get_post_meta( $post->ID, 'mail', true );
|
599 |
+
$contact_form->mail_2 = get_post_meta( $post->ID, 'mail_2', true );
|
600 |
+
$contact_form->messages = get_post_meta( $post->ID, 'messages', true );
|
601 |
+
$contact_form->additional_settings = get_post_meta( $post->ID, 'additional_settings', true );
|
602 |
+
|
603 |
+
$contact_form->upgrade();
|
604 |
+
|
605 |
+
$contact_form = apply_filters_ref_array( 'wpcf7_contact_form', array( &$contact_form ) );
|
606 |
+
|
607 |
+
return $contact_form;
|
608 |
+
}
|
609 |
+
|
610 |
+
function wpcf7_get_contact_form_by_old_id( $old_id ) {
|
611 |
+
global $wpdb;
|
612 |
+
|
613 |
+
$q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'"
|
614 |
+
. $wpdb->prepare( " AND meta_value = %d", $old_id );
|
615 |
+
|
616 |
+
if ( $new_id = $wpdb->get_var( $q ) )
|
617 |
+
return wpcf7_contact_form( $new_id );
|
618 |
+
}
|
619 |
+
|
620 |
+
function wpcf7_get_contact_form_by_title( $title ) {
|
621 |
+
$page = get_page_by_title( $title, OBJECT, 'wpcf7_contact_form' );
|
622 |
+
|
623 |
+
if ( $page )
|
624 |
+
return wpcf7_contact_form( $page->ID );
|
625 |
+
|
626 |
+
return null;
|
627 |
+
}
|
628 |
+
|
629 |
+
function wpcf7_contact_form_default_pack( $locale = null ) {
|
630 |
+
// For backward compatibility
|
631 |
+
|
632 |
+
return wpcf7_get_contact_form_default_pack( array( 'locale' => $locale ) );
|
633 |
+
}
|
634 |
+
|
635 |
+
function wpcf7_get_contact_form_default_pack( $args = '' ) {
|
636 |
+
global $l10n;
|
637 |
+
|
638 |
+
$defaults = array( 'locale' => null, 'title' => '' );
|
639 |
+
$args = wp_parse_args( $args, $defaults );
|
640 |
+
|
641 |
+
$locale = $args['locale'];
|
642 |
+
$title = $args['title'];
|
643 |
+
|
644 |
+
if ( $locale && $locale != get_locale() ) {
|
645 |
+
$mo_orig = $l10n['wpcf7'];
|
646 |
+
unset( $l10n['wpcf7'] );
|
647 |
+
|
648 |
+
if ( 'en_US' != $locale ) {
|
649 |
+
$mofile = wpcf7_plugin_path( 'languages/wpcf7-' . $locale . '.mo' );
|
650 |
+
if ( ! load_textdomain( 'wpcf7', $mofile ) ) {
|
651 |
+
$l10n['wpcf7'] = $mo_orig;
|
652 |
+
unset( $mo_orig );
|
653 |
+
}
|
654 |
+
}
|
655 |
+
}
|
656 |
|