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 3.9 3.9-beta 3.9.1 3.9.2 3.9.3 4.0 4.0.1 4.0.2 4.0.3 4.1 4.1-beta 4.1.1 4.1.2 4.2 4.2-beta 4.2.1 4.2.2 4.3 4.3.1 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6 4.6.1 4.7 4.8 4.8.1 4.9 4.9.1 4.9.2 5.0 5.0.1
contact-form-7 / admin / edit-contact-form.php
contact-form-7 / admin Last commit date
includes 8 months ago admin.php 10 months ago edit-contact-form.php 8 months ago
edit-contact-form.php
491 lines
1 <?php
2
3 // don't load directly
4 if ( ! defined( 'ABSPATH' ) ) {
5 die( '-1' );
6 }
7
8 $save_button = sprintf(
9 '<input %s />',
10 wpcf7_format_atts( array(
11 'type' => 'submit',
12 'class' => 'button-primary',
13 'name' => 'wpcf7-save',
14 'value' => __( 'Save', 'contact-form-7' ),
15 ) )
16 );
17
18 $formatter = new WPCF7_HTMLFormatter( array(
19 'allowed_html' => array_merge( wpcf7_kses_allowed_html(), array(
20 'form' => array(
21 'method' => true,
22 'action' => true,
23 'id' => true,
24 'class' => true,
25 'disabled' => true,
26 ),
27 ) ),
28 ) );
29
30 $formatter->append_start_tag( 'div', array(
31 'class' => 'wrap',
32 'id' => 'wpcf7-contact-form-editor',
33 ) );
34
35 $formatter->append_start_tag( 'h1', array(
36 'class' => 'wp-heading-inline',
37 ) );
38
39 $formatter->append_preformatted(
40 esc_html( $post->initial()
41 ? __( 'Add Contact Form', 'contact-form-7' )
42 : __( 'Edit Contact Form', 'contact-form-7' )
43 )
44 );
45
46 $formatter->end_tag( 'h1' );
47
48 if ( ! $post->initial() and current_user_can( 'wpcf7_edit_contact_forms' ) ) {
49 $formatter->append_whitespace();
50
51 $formatter->append_preformatted(
52 wpcf7_link(
53 menu_page_url( 'wpcf7-new', false ),
54 __( 'Add Contact Form', 'contact-form-7' ),
55 array( 'class' => 'page-title-action' )
56 )
57 );
58 }
59
60 $formatter->append_start_tag( 'hr', array(
61 'class' => 'wp-header-end',
62 ) );
63
64 $formatter->call_user_func( static function () use ( $post ) {
65 do_action( 'wpcf7_admin_warnings',
66 $post->initial() ? 'wpcf7-new' : 'wpcf7',
67 wpcf7_current_action(),
68 $post
69 );
70
71 do_action( 'wpcf7_admin_notices',
72 $post->initial() ? 'wpcf7-new' : 'wpcf7',
73 wpcf7_current_action(),
74 $post
75 );
76 } );
77
78 if ( $post ) {
79 $formatter->append_start_tag( 'form', array(
80 'method' => 'post',
81 'action' => esc_url( add_query_arg(
82 array( 'post' => $post_id ),
83 menu_page_url( 'wpcf7', false )
84 ) ),
85 'id' => 'wpcf7-admin-form-element',
86 'disabled' => ! current_user_can( 'wpcf7_edit_contact_form', $post_id ),
87 ) );
88
89 if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) {
90 $formatter->call_user_func( static function () use ( $post_id ) {
91 wp_nonce_field( 'wpcf7-save-contact-form_' . $post_id );
92 } );
93 }
94
95 $formatter->append_start_tag( 'input', array(
96 'type' => 'hidden',
97 'id' => 'post_ID',
98 'name' => 'post_ID',
99 'value' => (int) $post_id,
100 ) );
101
102 $formatter->append_start_tag( 'input', array(
103 'type' => 'hidden',
104 'id' => 'wpcf7-locale',
105 'name' => 'wpcf7-locale',
106 'value' => $post->locale(),
107 ) );
108
109 $formatter->append_start_tag( 'input', array(
110 'type' => 'hidden',
111 'id' => 'hiddenaction',
112 'name' => 'action',
113 'value' => 'save',
114 ) );
115
116 $formatter->append_start_tag( 'input', array(
117 'type' => 'hidden',
118 'id' => 'active-tab',
119 'name' => 'active-tab',
120 'value' => wpcf7_superglobal_get( 'active-tab' ),
121 ) );
122
123 $formatter->append_start_tag( 'div', array(
124 'id' => 'poststuff',
125 ) );
126
127 $formatter->append_start_tag( 'div', array(
128 'id' => 'post-body',
129 'class' => 'metabox-holder columns-2 wp-clearfix',
130 ) );
131
132 $formatter->append_start_tag( 'div', array(
133 'id' => 'post-body-content',
134 ) );
135
136 $formatter->append_start_tag( 'div', array(
137 'id' => 'titlediv',
138 ) );
139
140 $formatter->append_start_tag( 'div', array(
141 'id' => 'titlewrap',
142 ) );
143
144 $formatter->append_start_tag( 'input', array(
145 'type' => 'text',
146 'name' => 'post_title',
147 'value' => $post->initial() ? '' : $post->title(),
148 'id' => 'title',
149 'spellcheck' => 'true',
150 'autocomplete' => 'off',
151 'disabled' => ! current_user_can( 'wpcf7_edit_contact_form', $post_id ),
152 'placeholder' => __( 'Enter title here', 'contact-form-7' ),
153 'aria-label' => __( 'Enter title here', 'contact-form-7' ),
154 ) );
155
156 $formatter->end_tag( 'div' ); // #titlewrap
157
158 $formatter->append_start_tag( 'div', array(
159 'class' => 'inside',
160 ) );
161
162 if ( ! $post->initial() ) {
163 if ( $shortcode = $post->shortcode() ) {
164 $formatter->append_start_tag( 'p', array(
165 'class' => 'description',
166 ) );
167
168 $formatter->append_start_tag( 'label', array(
169 'for' => 'wpcf7-shortcode',
170 ) );
171
172 $formatter->append_preformatted(
173 esc_html( __( 'Copy this shortcode and paste it into your post, page, or text widget content:', 'contact-form-7' ) )
174 );
175
176 $formatter->end_tag( 'label' );
177
178 $formatter->append_whitespace();
179
180 $formatter->append_start_tag( 'span', array(
181 'class' => 'shortcode wp-ui-highlight',
182 ) );
183
184 $formatter->append_start_tag( 'input', array(
185 'type' => 'text',
186 'id' => 'wpcf7-shortcode',
187 'readonly' => true,
188 'class' => 'large-text code selectable',
189 'value' => $shortcode,
190 ) );
191
192 $formatter->end_tag( 'p' );
193 }
194
195 if ( $shortcode = $post->shortcode( array( 'use_old_format' => true ) ) ) {
196 $formatter->append_start_tag( 'p', array(
197 'class' => 'description',
198 ) );
199
200 $formatter->append_start_tag( 'label', array(
201 'for' => 'wpcf7-shortcode-old',
202 ) );
203
204 $formatter->append_preformatted(
205 esc_html( __( 'You can also use this old-style shortcode:', 'contact-form-7' ) )
206 );
207
208 $formatter->end_tag( 'label' );
209
210 $formatter->append_whitespace();
211
212 $formatter->append_start_tag( 'span', array(
213 'class' => 'shortcode old',
214 ) );
215
216 $formatter->append_start_tag( 'input', array(
217 'type' => 'text',
218 'id' => 'wpcf7-shortcode-old',
219 'readonly' => true,
220 'class' => 'large-text code selectable',
221 'value' => $shortcode,
222 ) );
223
224 $formatter->end_tag( 'p' );
225 }
226 }
227
228 $formatter->end_tag( 'div' ); // .inside
229 $formatter->end_tag( 'div' ); // #titlediv
230 $formatter->end_tag( 'div' ); // #post-body-content
231
232 $formatter->append_start_tag( 'div', array(
233 'id' => 'postbox-container-1',
234 'class' => 'postbox-container',
235 ) );
236
237 if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) {
238 $formatter->append_start_tag( 'section', array(
239 'id' => 'submitdiv',
240 'class' => 'postbox',
241 ) );
242
243 $formatter->append_start_tag( 'h2' );
244
245 $formatter->append_preformatted(
246 esc_html( __( 'Status', 'contact-form-7' ) )
247 );
248
249 $formatter->end_tag( 'h2' );
250
251 $formatter->append_start_tag( 'div', array(
252 'class' => 'inside',
253 ) );
254
255 $formatter->append_start_tag( 'div', array(
256 'class' => 'submitbox',
257 'id' => 'submitpost',
258 ) );
259
260 $formatter->append_start_tag( 'div', array(
261 'id' => 'minor-publishing-actions',
262 ) );
263
264 $formatter->append_start_tag( 'div', array(
265 'class' => 'hidden',
266 ) );
267
268 $formatter->append_start_tag( 'input', array(
269 'type' => 'submit',
270 'class' => 'button-primary',
271 'name' => 'wpcf7-save',
272 'value' => __( 'Save', 'contact-form-7' ),
273 ) );
274
275 $formatter->end_tag( 'div' ); // .hidden
276
277 if ( ! $post->initial() ) {
278 $formatter->append_start_tag( 'input', array(
279 'type' => 'submit',
280 'name' => 'wpcf7-copy',
281 'class' => 'copy button',
282 'value' => __( 'Duplicate', 'contact-form-7' ),
283 ) );
284 }
285
286 $formatter->end_tag( 'div' ); // #minor-publishing-actions
287
288 $formatter->append_start_tag( 'div', array(
289 'id' => 'misc-publishing-actions',
290 ) );
291
292 $formatter->call_user_func( static function () use ( $post_id ) {
293 do_action( 'wpcf7_admin_misc_pub_section', $post_id );
294 } );
295
296 $formatter->end_tag( 'div' ); // #misc-publishing-actions
297
298 $formatter->append_start_tag( 'div', array(
299 'id' => 'major-publishing-actions',
300 ) );
301
302 if ( ! $post->initial() ) {
303 $formatter->append_start_tag( 'div', array(
304 'id' => 'delete-action',
305 ) );
306
307 $formatter->append_start_tag( 'input', array(
308 'type' => 'submit',
309 'name' => 'wpcf7-delete',
310 'class' => 'delete submitdelete',
311 'value' => __( 'Delete', 'contact-form-7' ),
312 ) );
313
314 $formatter->end_tag( 'div' ); // #delete-action
315 }
316
317 $formatter->append_start_tag( 'div', array(
318 'id' => 'publishing-action',
319 ) );
320
321 $formatter->append_preformatted( '<span class="spinner"></span>' );
322 $formatter->append_preformatted( $save_button );
323
324 $formatter->end_tag( 'div' ); // #publishing-action
325
326 $formatter->append_preformatted( '<div class="clear"></div>' );
327
328 $formatter->end_tag( 'div' ); // #major-publishing-actions
329 $formatter->end_tag( 'div' ); // #submitpost
330 $formatter->end_tag( 'div' ); // .inside
331 $formatter->end_tag( 'section' ); // #submitdiv
332 }
333
334 $formatter->append_start_tag( 'section', array(
335 'id' => 'informationdiv',
336 'class' => 'postbox',
337 ) );
338
339 $formatter->append_start_tag( 'h2' );
340
341 $formatter->append_preformatted(
342 esc_html( __( 'Do you need help?', 'contact-form-7' ) )
343 );
344
345 $formatter->end_tag( 'h2' );
346
347 $formatter->append_start_tag( 'div', array(
348 'class' => 'inside',
349 ) );
350
351 $formatter->append_start_tag( 'p' );
352
353 $formatter->append_preformatted(
354 esc_html( __( 'Here are some available options to help solve your problems.', 'contact-form-7' ) )
355 );
356
357 $formatter->end_tag( 'p' );
358
359 $formatter->append_start_tag( 'ol' );
360
361 $formatter->append_start_tag( 'li' );
362
363 $formatter->append_preformatted(
364 sprintf(
365 /* translators: 1: FAQ, 2: Docs ("FAQ & Docs") */
366 __( '%1$s and %2$s', 'contact-form-7' ),
367 wpcf7_link(
368 __( 'https://contactform7.com/faq/', 'contact-form-7' ),
369 __( 'FAQ', 'contact-form-7' )
370 ),
371 wpcf7_link(
372 __( 'https://contactform7.com/docs/', 'contact-form-7' ),
373 __( 'docs', 'contact-form-7' )
374 )
375 )
376 );
377
378 $formatter->append_start_tag( 'li' );
379
380 $formatter->append_preformatted(
381 wpcf7_link(
382 __( 'https://wordpress.org/support/plugin/contact-form-7/', 'contact-form-7' ),
383 __( 'Support forums', 'contact-form-7' )
384 )
385 );
386
387 $formatter->append_start_tag( 'li' );
388
389 $formatter->append_preformatted(
390 wpcf7_link(
391 __( 'https://contactform7.com/custom-development/', 'contact-form-7' ),
392 __( 'Professional services', 'contact-form-7' )
393 )
394 );
395
396 $formatter->end_tag( 'ol' );
397 $formatter->end_tag( 'div' ); // .inside
398 $formatter->end_tag( 'section' ); // #informationdiv
399 $formatter->end_tag( 'div' ); // #postbox-container-1
400
401 $formatter->append_start_tag( 'div', array(
402 'id' => 'postbox-container-2',
403 'class' => 'postbox-container',
404 ) );
405
406 $formatter->append_start_tag( 'div', array(
407 'id' => 'contact-form-editor',
408 ) );
409
410 $formatter->call_user_func( static function () use ( $post, $post_id ) {
411 $editor = new WPCF7_Editor( $post );
412 $panels = array();
413
414 if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) {
415 $panels = array(
416 'form-panel' => array(
417 'title' => __( 'Form', 'contact-form-7' ),
418 'callback' => 'wpcf7_editor_panel_form',
419 ),
420 'mail-panel' => array(
421 'title' => __( 'Mail', 'contact-form-7' ),
422 'callback' => 'wpcf7_editor_panel_mail',
423 ),
424 'messages-panel' => array(
425 'title' => __( 'Messages', 'contact-form-7' ),
426 'callback' => 'wpcf7_editor_panel_messages',
427 ),
428 );
429
430 $additional_settings = $post->prop( 'additional_settings' );
431
432 if ( ! is_scalar( $additional_settings ) ) {
433 $additional_settings = '';
434 }
435
436 $additional_settings = trim( $additional_settings );
437 $additional_settings = explode( "\n", $additional_settings );
438 $additional_settings = array_filter( $additional_settings );
439 $additional_settings = count( $additional_settings );
440
441 $panels['additional-settings-panel'] = array(
442 'title' => $additional_settings
443 ? sprintf(
444 /* translators: %d: number of additional settings */
445 __( 'Additional Settings (%d)', 'contact-form-7' ),
446 $additional_settings
447 )
448 : __( 'Additional Settings', 'contact-form-7' ),
449 'callback' => 'wpcf7_editor_panel_additional_settings',
450 );
451 }
452
453 $panels = apply_filters( 'wpcf7_editor_panels', $panels );
454
455 foreach ( $panels as $id => $panel ) {
456 $editor->add_panel( $id, $panel['title'], $panel['callback'] );
457 }
458
459 $editor->display();
460 } );
461
462 $formatter->end_tag( 'div' ); // #contact-form-editor
463
464 if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) {
465 $formatter->append_start_tag( 'p', array(
466 'class' => 'submit',
467 ) );
468
469 $formatter->append_preformatted( $save_button );
470
471 $formatter->end_tag( 'p' );
472 }
473
474 $formatter->end_tag( 'div' ); // #postbox-container-2
475 $formatter->end_tag( 'div' ); // #post-body
476
477 $formatter->append_preformatted( '<br class="clear" />' );
478
479 $formatter->end_tag( 'div' ); // #poststuff
480 $formatter->end_tag( 'form' );
481 }
482
483 $formatter->end_tag( 'div' ); // .wrap
484
485 $formatter->print();
486
487 $tag_generator = WPCF7_TagGenerator::get_instance();
488 $tag_generator->print_panels( $post );
489
490 do_action( 'wpcf7_admin_footer', $post );
491