Version Description
Download this release
Release Info
Developer | takayukister |
Plugin | ![]() |
Version | 5.0 |
Comparing to | |
See all releases |
Code changes from version 4.9.2 to 5.0
- admin/admin.php +14 -5
- admin/css/styles.css +21 -14
- admin/edit-contact-form.php +22 -8
- admin/includes/class-contact-forms-list-table.php +1 -1
- admin/includes/editor.php +33 -3
- admin/includes/welcome-panel.php +3 -3
- admin/js/scripts.js +18 -20
- admin/js/tag-generator.js +10 -1
- includes/config-validator.php +38 -30
- includes/contact-form.php +63 -39
- includes/css/styles.css +10 -7
- includes/form-tags-manager.php +20 -9
- includes/functions.php +13 -8
- includes/js/scripts.js +28 -16
- includes/mail.php +87 -92
- includes/rest-api.php +0 -8
- includes/special-mail-tags.php +165 -0
- includes/submission.php +82 -29
- license.txt +343 -1
- modules/acceptance.php +101 -24
- modules/akismet.php +3 -10
- modules/count.php +7 -1
- modules/file.php +96 -46
- modules/flamingo.php +72 -20
- modules/quiz.php +1 -0
- modules/really-simple-captcha.php +56 -22
- readme.txt +18 -48
- settings.php +1 -0
- wp-contact-form-7.php +3 -3
admin/admin.php
CHANGED
@@ -236,7 +236,8 @@ function wpcf7_load_contact_form_admin() {
|
|
236 |
WPCF7::update_option( 'bulk_validate', $result );
|
237 |
|
238 |
$query = array(
|
239 |
-
'message' => 'validated'
|
|
|
240 |
|
241 |
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
|
242 |
wp_safe_redirect( $redirect_to );
|
@@ -273,7 +274,8 @@ function wpcf7_load_contact_form_admin() {
|
|
273 |
|
274 |
add_screen_option( 'per_page', array(
|
275 |
'default' => 20,
|
276 |
-
'option' => 'cfseven_contact_forms_per_page'
|
|
|
277 |
}
|
278 |
}
|
279 |
|
@@ -314,12 +316,14 @@ function wpcf7_admin_enqueue_scripts( $hook_suffix ) {
|
|
314 |
? (int) $_GET['active-tab'] : 0,
|
315 |
'configValidator' => array(
|
316 |
'errors' => array(),
|
317 |
-
'howToCorrect' => __( "How to
|
318 |
'oneError' => __( '1 configuration error detected', 'contact-form-7' ),
|
319 |
'manyErrors' => __( '%d configuration errors detected', 'contact-form-7' ),
|
320 |
'oneErrorInTab' => __( '1 configuration error detected in this tab panel', 'contact-form-7' ),
|
321 |
'manyErrorsInTab' => __( '%d configuration errors detected in this tab panel', 'contact-form-7' ),
|
322 |
'docUrl' => WPCF7_ConfigValidator::get_doc_link(),
|
|
|
|
|
323 |
),
|
324 |
);
|
325 |
|
@@ -541,8 +545,13 @@ function wpcf7_plugin_action_links( $links, $file ) {
|
|
541 |
return $links;
|
542 |
}
|
543 |
|
544 |
-
|
545 |
-
|
|
|
|
|
|
|
|
|
|
|
546 |
|
547 |
array_unshift( $links, $settings_link );
|
548 |
|
236 |
WPCF7::update_option( 'bulk_validate', $result );
|
237 |
|
238 |
$query = array(
|
239 |
+
'message' => 'validated',
|
240 |
+
);
|
241 |
|
242 |
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
|
243 |
wp_safe_redirect( $redirect_to );
|
274 |
|
275 |
add_screen_option( 'per_page', array(
|
276 |
'default' => 20,
|
277 |
+
'option' => 'cfseven_contact_forms_per_page',
|
278 |
+
) );
|
279 |
}
|
280 |
}
|
281 |
|
316 |
? (int) $_GET['active-tab'] : 0,
|
317 |
'configValidator' => array(
|
318 |
'errors' => array(),
|
319 |
+
'howToCorrect' => __( "How to resolve?", 'contact-form-7' ),
|
320 |
'oneError' => __( '1 configuration error detected', 'contact-form-7' ),
|
321 |
'manyErrors' => __( '%d configuration errors detected', 'contact-form-7' ),
|
322 |
'oneErrorInTab' => __( '1 configuration error detected in this tab panel', 'contact-form-7' ),
|
323 |
'manyErrorsInTab' => __( '%d configuration errors detected in this tab panel', 'contact-form-7' ),
|
324 |
'docUrl' => WPCF7_ConfigValidator::get_doc_link(),
|
325 |
+
/* translators: screen reader text */
|
326 |
+
'iconAlt' => __( '(configuration error)', 'contact-form-7' ),
|
327 |
),
|
328 |
);
|
329 |
|
545 |
return $links;
|
546 |
}
|
547 |
|
548 |
+
if ( ! current_user_can( 'wpcf7_read_contact_forms' ) ) {
|
549 |
+
return $links;
|
550 |
+
}
|
551 |
+
|
552 |
+
$settings_link = sprintf( '<a href="%1$s">%2$s</a>',
|
553 |
+
menu_page_url( 'wpcf7', false ),
|
554 |
+
esc_html( __( 'Settings', 'contact-form-7' ) ) );
|
555 |
|
556 |
array_unshift( $links, $settings_link );
|
557 |
|
admin/css/styles.css
CHANGED
@@ -62,25 +62,19 @@ div.config-error, span.config-error, ul.config-error {
|
|
62 |
font-size: 13px;
|
63 |
}
|
64 |
|
65 |
-
div.config-error span.dashicons {
|
66 |
-
color: #82878c;
|
67 |
-
}
|
68 |
-
|
69 |
ul.config-error {
|
70 |
-
margin: 0;
|
71 |
}
|
72 |
|
73 |
ul.config-error li {
|
74 |
-
list-style:
|
75 |
-
padding:
|
76 |
margin: 0;
|
77 |
}
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
font-size: 18px;
|
83 |
-
vertical-align: middle;
|
84 |
}
|
85 |
|
86 |
[data-config-field][aria-invalid="true"] {
|
@@ -144,6 +138,15 @@ ul.config-error li a.external {
|
|
144 |
color: #82878c;
|
145 |
}
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
#contact-form-editor-tabs li.ui-tabs-active a span.dashicons {
|
148 |
display: none;
|
149 |
}
|
@@ -224,6 +227,10 @@ ul.config-error li a.external {
|
|
224 |
width: 200px;
|
225 |
}
|
226 |
|
|
|
|
|
|
|
|
|
227 |
.tag-generator-panel .control-box textarea.values {
|
228 |
width: 200px;
|
229 |
height: 6em;
|
@@ -320,8 +327,8 @@ ul.config-error li a.external {
|
|
320 |
width: 38%;
|
321 |
}
|
322 |
|
323 |
-
.wp-list-table .config-error span.dashicons {
|
324 |
-
color: #
|
325 |
}
|
326 |
|
327 |
/*
|
62 |
font-size: 13px;
|
63 |
}
|
64 |
|
|
|
|
|
|
|
|
|
65 |
ul.config-error {
|
66 |
+
margin: 2px 0;
|
67 |
}
|
68 |
|
69 |
ul.config-error li {
|
70 |
+
list-style: none;
|
71 |
+
padding: 2px 2px;
|
72 |
margin: 0;
|
73 |
}
|
74 |
|
75 |
+
div.config-error span.dashicons,
|
76 |
+
ul.config-error li span.dashicons {
|
77 |
+
color: #82878c;
|
|
|
|
|
78 |
}
|
79 |
|
80 |
[data-config-field][aria-invalid="true"] {
|
138 |
color: #82878c;
|
139 |
}
|
140 |
|
141 |
+
#contact-form-editor-tabs li a span.dashicons-warning,
|
142 |
+
#contact-form-editor .contact-form-editor-panel > div.config-error span.dashicons-warning {
|
143 |
+
color: #ca4a1f;
|
144 |
+
}
|
145 |
+
|
146 |
+
#contact-form-editor .contact-form-editor-panel > div.config-error {
|
147 |
+
margin-bottom: 1.4em;
|
148 |
+
}
|
149 |
+
|
150 |
#contact-form-editor-tabs li.ui-tabs-active a span.dashicons {
|
151 |
display: none;
|
152 |
}
|
227 |
width: 200px;
|
228 |
}
|
229 |
|
230 |
+
.tag-generator-panel .control-box input.large-text {
|
231 |
+
width: 400px;
|
232 |
+
}
|
233 |
+
|
234 |
.tag-generator-panel .control-box textarea.values {
|
235 |
width: 200px;
|
236 |
height: 6em;
|
327 |
width: 38%;
|
328 |
}
|
329 |
|
330 |
+
.wp-list-table .config-error span.dashicons-warning {
|
331 |
+
color: #ca4a1f;
|
332 |
}
|
333 |
|
334 |
/*
|
admin/edit-contact-form.php
CHANGED
@@ -88,8 +88,9 @@ if ( $post ) :
|
|
88 |
'id' => 'title',
|
89 |
'spellcheck' => 'true',
|
90 |
'autocomplete' => 'off',
|
91 |
-
'disabled' =>
|
92 |
-
? '' : 'disabled'
|
|
|
93 |
|
94 |
echo sprintf( '<input %s />', wpcf7_format_atts( $posttitle_atts ) );
|
95 |
?>
|
@@ -181,8 +182,16 @@ if ( $post ) :
|
|
181 |
<div id="postbox-container-2" class="postbox-container">
|
182 |
<div id="contact-form-editor">
|
183 |
<div class="keyboard-interaction"><?php
|
184 |
-
|
185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
?></div>
|
187 |
|
188 |
<?php
|
@@ -194,13 +203,17 @@ if ( $post ) :
|
|
194 |
$panels = array(
|
195 |
'form-panel' => array(
|
196 |
'title' => __( 'Form', 'contact-form-7' ),
|
197 |
-
'callback' => 'wpcf7_editor_panel_form'
|
|
|
198 |
'mail-panel' => array(
|
199 |
'title' => __( 'Mail', 'contact-form-7' ),
|
200 |
-
'callback' => 'wpcf7_editor_panel_mail'
|
|
|
201 |
'messages-panel' => array(
|
202 |
'title' => __( 'Messages', 'contact-form-7' ),
|
203 |
-
'callback' => 'wpcf7_editor_panel_messages'
|
|
|
|
|
204 |
|
205 |
$additional_settings = trim( $post->prop( 'additional_settings' ) );
|
206 |
$additional_settings = explode( "\n", $additional_settings );
|
@@ -214,7 +227,8 @@ if ( $post ) :
|
|
214 |
__( 'Additional Settings (%d)', 'contact-form-7' ),
|
215 |
$additional_settings )
|
216 |
: __( 'Additional Settings', 'contact-form-7' ),
|
217 |
-
'callback' => 'wpcf7_editor_panel_additional_settings'
|
|
|
218 |
}
|
219 |
|
220 |
$panels = apply_filters( 'wpcf7_editor_panels', $panels );
|
88 |
'id' => 'title',
|
89 |
'spellcheck' => 'true',
|
90 |
'autocomplete' => 'off',
|
91 |
+
'disabled' =>
|
92 |
+
current_user_can( 'wpcf7_edit_contact_form', $post_id ) ? '' : 'disabled',
|
93 |
+
);
|
94 |
|
95 |
echo sprintf( '<input %s />', wpcf7_format_atts( $posttitle_atts ) );
|
96 |
?>
|
182 |
<div id="postbox-container-2" class="postbox-container">
|
183 |
<div id="contact-form-editor">
|
184 |
<div class="keyboard-interaction"><?php
|
185 |
+
echo sprintf(
|
186 |
+
/* translators: 1: ◀ ▶ dashicon, 2: screen reader text for the dashicon */
|
187 |
+
esc_html( __( '%1$s %2$s keys switch panels', 'contact-form-7' ) ),
|
188 |
+
'<span class="dashicons dashicons-leftright" aria-hidden="true"></span>',
|
189 |
+
sprintf(
|
190 |
+
'<span class="screen-reader-text">%s</span>',
|
191 |
+
/* translators: screen reader text */
|
192 |
+
esc_html( __( '(left and right arrow)', 'contact-form-7' ) )
|
193 |
+
)
|
194 |
+
);
|
195 |
?></div>
|
196 |
|
197 |
<?php
|
203 |
$panels = array(
|
204 |
'form-panel' => array(
|
205 |
'title' => __( 'Form', 'contact-form-7' ),
|
206 |
+
'callback' => 'wpcf7_editor_panel_form',
|
207 |
+
),
|
208 |
'mail-panel' => array(
|
209 |
'title' => __( 'Mail', 'contact-form-7' ),
|
210 |
+
'callback' => 'wpcf7_editor_panel_mail',
|
211 |
+
),
|
212 |
'messages-panel' => array(
|
213 |
'title' => __( 'Messages', 'contact-form-7' ),
|
214 |
+
'callback' => 'wpcf7_editor_panel_messages',
|
215 |
+
),
|
216 |
+
);
|
217 |
|
218 |
$additional_settings = trim( $post->prop( 'additional_settings' ) );
|
219 |
$additional_settings = explode( "\n", $additional_settings );
|
227 |
__( 'Additional Settings (%d)', 'contact-form-7' ),
|
228 |
$additional_settings )
|
229 |
: __( 'Additional Settings', 'contact-form-7' ),
|
230 |
+
'callback' => 'wpcf7_editor_panel_additional_settings',
|
231 |
+
);
|
232 |
}
|
233 |
|
234 |
$panels = apply_filters( 'wpcf7_editor_panels', $panels );
|
admin/includes/class-contact-forms-list-table.php
CHANGED
@@ -135,7 +135,7 @@ class WPCF7_Contact_Form_List_Table extends WP_List_Table {
|
|
135 |
$count_errors, 'contact-form-7' ),
|
136 |
number_format_i18n( $count_errors ) );
|
137 |
$output .= sprintf(
|
138 |
-
'<div class="config-error"><span class="dashicons dashicons-warning"></span> %s</div>',
|
139 |
$error_notice );
|
140 |
}
|
141 |
}
|
135 |
$count_errors, 'contact-form-7' ),
|
136 |
number_format_i18n( $count_errors ) );
|
137 |
$output .= sprintf(
|
138 |
+
'<div class="config-error"><span class="dashicons dashicons-warning" aria-hidden="true"></span> %s</div>',
|
139 |
$error_notice );
|
140 |
}
|
141 |
}
|
admin/includes/editor.php
CHANGED
@@ -51,15 +51,25 @@ class WPCF7_Editor {
|
|
51 |
}
|
52 |
|
53 |
function wpcf7_editor_panel_form( $post ) {
|
|
|
|
|
|
|
|
|
|
|
54 |
?>
|
|
|
55 |
<h2><?php echo esc_html( __( 'Form', 'contact-form-7' ) ); ?></h2>
|
56 |
|
|
|
|
|
|
|
57 |
<?php
|
58 |
$tag_generator = WPCF7_TagGenerator::get_instance();
|
59 |
$tag_generator->print_buttons();
|
60 |
?>
|
61 |
|
62 |
<textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="24" class="large-text code" data-config-field="form.body"><?php echo esc_textarea( $post->prop( 'form' ) ); ?></textarea>
|
|
|
63 |
<?php
|
64 |
}
|
65 |
|
@@ -112,8 +122,22 @@ function wpcf7_editor_box_mail( $post, $args = '' ) {
|
|
112 |
?>
|
113 |
|
114 |
<fieldset>
|
115 |
-
<legend
|
116 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
<table class="form-table">
|
118 |
<tbody>
|
119 |
<tr>
|
@@ -181,6 +205,12 @@ function wpcf7_editor_box_mail( $post, $args = '' ) {
|
|
181 |
}
|
182 |
|
183 |
function wpcf7_editor_panel_messages( $post ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
$messages = wpcf7_messages();
|
185 |
|
186 |
if ( isset( $messages['captcha_not_match'] )
|
@@ -191,7 +221,7 @@ function wpcf7_editor_panel_messages( $post ) {
|
|
191 |
?>
|
192 |
<h2><?php echo esc_html( __( 'Messages', 'contact-form-7' ) ); ?></h2>
|
193 |
<fieldset>
|
194 |
-
<legend><?php echo
|
195 |
<?php
|
196 |
|
197 |
foreach ( $messages as $key => $arr ) {
|
51 |
}
|
52 |
|
53 |
function wpcf7_editor_panel_form( $post ) {
|
54 |
+
$desc_link = wpcf7_link(
|
55 |
+
__( 'https://contactform7.com/editing-form-template/', 'contact-form-7' ),
|
56 |
+
__( 'Editing Form Template', 'contact-form-7' ) );
|
57 |
+
$description = __( "You can edit the form template here. For details, see %s.", 'contact-form-7' );
|
58 |
+
$description = sprintf( esc_html( $description ), $desc_link );
|
59 |
?>
|
60 |
+
|
61 |
<h2><?php echo esc_html( __( 'Form', 'contact-form-7' ) ); ?></h2>
|
62 |
|
63 |
+
<fieldset>
|
64 |
+
<legend><?php echo $description; ?></legend>
|
65 |
+
|
66 |
<?php
|
67 |
$tag_generator = WPCF7_TagGenerator::get_instance();
|
68 |
$tag_generator->print_buttons();
|
69 |
?>
|
70 |
|
71 |
<textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="24" class="large-text code" data-config-field="form.body"><?php echo esc_textarea( $post->prop( 'form' ) ); ?></textarea>
|
72 |
+
</fieldset>
|
73 |
<?php
|
74 |
}
|
75 |
|
122 |
?>
|
123 |
|
124 |
<fieldset>
|
125 |
+
<legend>
|
126 |
+
<?php
|
127 |
+
$desc_link = wpcf7_link(
|
128 |
+
__( 'https://contactform7.com/setting-up-mail/', 'contact-form-7' ),
|
129 |
+
__( 'Setting Up Mail', 'contact-form-7' ) );
|
130 |
+
$description = __( "You can edit the mail template here. For details, see %s.", 'contact-form-7' );
|
131 |
+
$description = sprintf( esc_html( $description ), $desc_link );
|
132 |
+
echo $description;
|
133 |
+
echo '<br />';
|
134 |
+
|
135 |
+
echo esc_html( __( "In the following fields, you can use these mail-tags:",
|
136 |
+
'contact-form-7' ) );
|
137 |
+
echo '<br />';
|
138 |
+
$post->suggest_mail_tags( $args['name'] );
|
139 |
+
?>
|
140 |
+
</legend>
|
141 |
<table class="form-table">
|
142 |
<tbody>
|
143 |
<tr>
|
205 |
}
|
206 |
|
207 |
function wpcf7_editor_panel_messages( $post ) {
|
208 |
+
$desc_link = wpcf7_link(
|
209 |
+
__( 'https://contactform7.com/editing-messages/', 'contact-form-7' ),
|
210 |
+
__( 'Editing Messages', 'contact-form-7' ) );
|
211 |
+
$description = __( "You can edit messages used in various situations here. For details, see %s.", 'contact-form-7' );
|
212 |
+
$description = sprintf( esc_html( $description ), $desc_link );
|
213 |
+
|
214 |
$messages = wpcf7_messages();
|
215 |
|
216 |
if ( isset( $messages['captcha_not_match'] )
|
221 |
?>
|
222 |
<h2><?php echo esc_html( __( 'Messages', 'contact-form-7' ) ); ?></h2>
|
223 |
<fieldset>
|
224 |
+
<legend><?php echo $description; ?></legend>
|
225 |
<?php
|
226 |
|
227 |
foreach ( $messages as $key => $arr ) {
|
admin/includes/welcome-panel.php
CHANGED
@@ -19,7 +19,7 @@ function wpcf7_welcome_panel() {
|
|
19 |
<div class="welcome-panel-column-container">
|
20 |
|
21 |
<div class="welcome-panel-column">
|
22 |
-
<h3><span class="dashicons dashicons-shield"></span> <?php echo esc_html( __( "Getting spammed? You have protection.", 'contact-form-7' ) ); ?></h3>
|
23 |
|
24 |
<p><?php echo esc_html( __( "Spammers target everything; your contact forms aren’t an exception. Before you get spammed, protect your contact forms with the powerful anti-spam features Contact Form 7 provides.", 'contact-form-7' ) ); ?></p>
|
25 |
|
@@ -28,7 +28,7 @@ function wpcf7_welcome_panel() {
|
|
28 |
|
29 |
<?php if ( defined( 'FLAMINGO_VERSION' ) ) : ?>
|
30 |
<div class="welcome-panel-column">
|
31 |
-
<h3><span class="dashicons dashicons-megaphone"></span> <?php echo esc_html( __( "Contact Form 7 needs your support.", 'contact-form-7' ) ); ?></h3>
|
32 |
|
33 |
<p><?php echo esc_html( __( "It is hard to continue development and support for this plugin without contributions from users like you.", 'contact-form-7' ) ); ?></p>
|
34 |
|
@@ -38,7 +38,7 @@ function wpcf7_welcome_panel() {
|
|
38 |
</div>
|
39 |
<?php else: ?>
|
40 |
<div class="welcome-panel-column">
|
41 |
-
<h3><span class="dashicons dashicons-editor-help"></span> <?php echo esc_html( __( "Before you cry over spilt mail…", 'contact-form-7' ) ); ?></h3>
|
42 |
|
43 |
<p><?php echo esc_html( __( "Contact Form 7 doesn’t store submitted messages anywhere. Therefore, you may lose important messages forever if your mail server has issues or you make a mistake in mail configuration.", 'contact-form-7' ) ); ?></p>
|
44 |
|
19 |
<div class="welcome-panel-column-container">
|
20 |
|
21 |
<div class="welcome-panel-column">
|
22 |
+
<h3><span class="dashicons dashicons-shield" aria-hidden="true"></span> <?php echo esc_html( __( "Getting spammed? You have protection.", 'contact-form-7' ) ); ?></h3>
|
23 |
|
24 |
<p><?php echo esc_html( __( "Spammers target everything; your contact forms aren’t an exception. Before you get spammed, protect your contact forms with the powerful anti-spam features Contact Form 7 provides.", 'contact-form-7' ) ); ?></p>
|
25 |
|
28 |
|
29 |
<?php if ( defined( 'FLAMINGO_VERSION' ) ) : ?>
|
30 |
<div class="welcome-panel-column">
|
31 |
+
<h3><span class="dashicons dashicons-megaphone" aria-hidden="true"></span> <?php echo esc_html( __( "Contact Form 7 needs your support.", 'contact-form-7' ) ); ?></h3>
|
32 |
|
33 |
<p><?php echo esc_html( __( "It is hard to continue development and support for this plugin without contributions from users like you.", 'contact-form-7' ) ); ?></p>
|
34 |
|
38 |
</div>
|
39 |
<?php else: ?>
|
40 |
<div class="welcome-panel-column">
|
41 |
+
<h3><span class="dashicons dashicons-editor-help" aria-hidden="true"></span> <?php echo esc_html( __( "Before you cry over spilt mail…", 'contact-form-7' ) ); ?></h3>
|
42 |
|
43 |
<p><?php echo esc_html( __( "Contact Form 7 doesn’t store submitted messages anywhere. Therefore, you may lose important messages forever if your mail server has issues or you make a mistake in mail configuration.", 'contact-form-7' ) ); ?></p>
|
44 |
|
admin/js/scripts.js
CHANGED
@@ -157,17 +157,18 @@
|
|
157 |
} );
|
158 |
|
159 |
$.each( errors[ section ], function( i, val ) {
|
160 |
-
var $li = $( '<li></li>' ).
|
|
|
|
|
|
|
|
|
161 |
|
162 |
if ( val.link ) {
|
163 |
-
|
164 |
-
'href'
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
} ).text( wpcf7.configValidator.howToCorrect ) );
|
169 |
-
|
170 |
-
$li = $li.append( ' ' ).append( $link );
|
171 |
}
|
172 |
|
173 |
$li.appendTo( $list );
|
@@ -197,7 +198,7 @@
|
|
197 |
key = key.replace( /^mail_\d+\./, 'mail.' );
|
198 |
|
199 |
if ( key.replace( /\..*$/, '' ) == tab.replace( '-', '_' ) ) {
|
200 |
-
var $mark = $( '<span class="dashicons dashicons-warning"></span>' );
|
201 |
$item.find( 'a.ui-tabs-anchor' ).first().append( $mark );
|
202 |
return false;
|
203 |
}
|
@@ -208,7 +209,7 @@
|
|
208 |
|
209 |
if ( errorCount[ tab.replace( '-', '_' ) ] ) {
|
210 |
$tabPanelError
|
211 |
-
.append( '<span class="dashicons dashicons-warning"></span> ' );
|
212 |
|
213 |
if ( 1 < errorCount[ tab.replace( '-', '_' ) ] ) {
|
214 |
var manyErrorsInTab = wpcf7.configValidator.manyErrorsInTab
|
@@ -225,7 +226,7 @@
|
|
225 |
if ( errorCount.total ) {
|
226 |
var $warning = $( '<div></div>' )
|
227 |
.addClass( 'misc-pub-section config-error' )
|
228 |
-
.append( '<span class="dashicons dashicons-warning"></span> ' );
|
229 |
|
230 |
if ( 1 < errorCount.total ) {
|
231 |
$warning.append(
|
@@ -235,14 +236,11 @@
|
|
235 |
$warning.append( wpcf7.configValidator.oneError );
|
236 |
}
|
237 |
|
238 |
-
|
239 |
-
'
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
} ).text( wpcf7.configValidator.howToCorrect ) );
|
244 |
-
|
245 |
-
$warning.append( ' ' ).append( $link );
|
246 |
|
247 |
$( '#misc-publishing-actions' ).append( $warning );
|
248 |
}
|
157 |
} );
|
158 |
|
159 |
$.each( errors[ section ], function( i, val ) {
|
160 |
+
var $li = $( '<li></li>' ).append(
|
161 |
+
$( '<span class="dashicons dashicons-warning" aria-hidden="true"></span>' )
|
162 |
+
).append(
|
163 |
+
$( '<span class="screen-reader-text"></span>' ).text( wpcf7.configValidator.iconAlt )
|
164 |
+
).append( ' ' );
|
165 |
|
166 |
if ( val.link ) {
|
167 |
+
$li.append(
|
168 |
+
$( '<a></a>' ).attr( 'href', val.link ).text( val.message )
|
169 |
+
);
|
170 |
+
} else {
|
171 |
+
$li.text( val.message );
|
|
|
|
|
|
|
172 |
}
|
173 |
|
174 |
$li.appendTo( $list );
|
198 |
key = key.replace( /^mail_\d+\./, 'mail.' );
|
199 |
|
200 |
if ( key.replace( /\..*$/, '' ) == tab.replace( '-', '_' ) ) {
|
201 |
+
var $mark = $( '<span class="dashicons dashicons-warning" aria-hidden="true"></span>' );
|
202 |
$item.find( 'a.ui-tabs-anchor' ).first().append( $mark );
|
203 |
return false;
|
204 |
}
|
209 |
|
210 |
if ( errorCount[ tab.replace( '-', '_' ) ] ) {
|
211 |
$tabPanelError
|
212 |
+
.append( '<span class="dashicons dashicons-warning" aria-hidden="true"></span> ' );
|
213 |
|
214 |
if ( 1 < errorCount[ tab.replace( '-', '_' ) ] ) {
|
215 |
var manyErrorsInTab = wpcf7.configValidator.manyErrorsInTab
|
226 |
if ( errorCount.total ) {
|
227 |
var $warning = $( '<div></div>' )
|
228 |
.addClass( 'misc-pub-section config-error' )
|
229 |
+
.append( '<span class="dashicons dashicons-warning" aria-hidden="true"></span> ' );
|
230 |
|
231 |
if ( 1 < errorCount.total ) {
|
232 |
$warning.append(
|
236 |
$warning.append( wpcf7.configValidator.oneError );
|
237 |
}
|
238 |
|
239 |
+
$warning.append( '<br />' ).append(
|
240 |
+
$( '<a></a>' )
|
241 |
+
.attr( 'href', wpcf7.configValidator.docUrl )
|
242 |
+
.text( wpcf7.configValidator.howToCorrect )
|
243 |
+
);
|
|
|
|
|
|
|
244 |
|
245 |
$( '#misc-publishing-actions' ).append( $warning );
|
246 |
}
|
admin/js/tag-generator.js
CHANGED
@@ -153,7 +153,16 @@
|
|
153 |
} );
|
154 |
|
155 |
components = $.trim( components.join( ' ' ) );
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
};
|
158 |
|
159 |
wpcf7.taggen.normalize = function( $input ) {
|
153 |
} );
|
154 |
|
155 |
components = $.trim( components.join( ' ' ) );
|
156 |
+
components = '[' + components + ']';
|
157 |
+
|
158 |
+
var content = scope.find( ':input[name="content"]' ).val();
|
159 |
+
content = $.trim( content );
|
160 |
+
|
161 |
+
if ( content ) {
|
162 |
+
components += ' ' + content + ' [/' + tagType + ']';
|
163 |
+
}
|
164 |
+
|
165 |
+
return components;
|
166 |
};
|
167 |
|
168 |
wpcf7.taggen.normalize = function( $input ) {
|
includes/config-validator.php
CHANGED
@@ -100,8 +100,9 @@ class WPCF7_ConfigValidator {
|
|
100 |
}
|
101 |
|
102 |
$error_messages[$section][] = array(
|
103 |
-
'message' =>
|
104 |
-
'link' => esc_url( $link )
|
|
|
105 |
}
|
106 |
}
|
107 |
|
@@ -235,31 +236,15 @@ class WPCF7_ConfigValidator {
|
|
235 |
$tagname = $matches[2];
|
236 |
$values = $matches[3];
|
237 |
|
238 |
-
|
239 |
-
|
240 |
-
$values = wpcf7_strip_quote_deep( $matches[0] );
|
241 |
-
}
|
242 |
-
|
243 |
-
$do_not_heat = false;
|
244 |
-
|
245 |
-
if ( preg_match( '/^_raw_(.+)$/', $tagname, $matches ) ) {
|
246 |
-
$tagname = trim( $matches[1] );
|
247 |
-
$do_not_heat = true;
|
248 |
-
}
|
249 |
-
|
250 |
-
$format = '';
|
251 |
-
|
252 |
-
if ( preg_match( '/^_format_(.+)$/', $tagname, $matches ) ) {
|
253 |
-
$tagname = trim( $matches[1] );
|
254 |
-
$format = $values[0];
|
255 |
-
}
|
256 |
|
257 |
$example_email = 'example@example.com';
|
258 |
$example_text = 'example';
|
259 |
$example_blank = '';
|
260 |
|
261 |
$form_tags = $this->contact_form->scan_form_tags(
|
262 |
-
array( 'name' => $
|
263 |
|
264 |
if ( $form_tags ) {
|
265 |
$form_tag = new WPCF7_FormTag( $form_tags[0] );
|
@@ -272,7 +257,7 @@ class WPCF7_ConfigValidator {
|
|
272 |
|
273 |
if ( wpcf7_form_tag_supports( $form_tag->type, 'selectable-values' ) ) {
|
274 |
if ( $form_tag->pipes instanceof WPCF7_Pipes ) {
|
275 |
-
if ( $do_not_heat ) {
|
276 |
$before_pipes = $form_tag->pipes->collect_befores();
|
277 |
$last_item = array_pop( $before_pipes );
|
278 |
} else {
|
@@ -296,13 +281,28 @@ class WPCF7_ConfigValidator {
|
|
296 |
return $example_text;
|
297 |
}
|
298 |
|
299 |
-
} else {
|
300 |
-
|
|
|
301 |
|
302 |
-
if ( '
|
303 |
-
return $example_email;
|
304 |
-
} elseif ( '_' == substr( $tagname, 0, 1 ) ) { // maybe special mail tag
|
305 |
return $example_text;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
}
|
307 |
}
|
308 |
|
@@ -329,6 +329,8 @@ class WPCF7_ConfigValidator {
|
|
329 |
foreach ( $tags as $tag ) {
|
330 |
$is_multiple_controls_container = wpcf7_form_tag_supports(
|
331 |
$tag->type, 'multiple-controls-container' );
|
|
|
|
|
332 |
|
333 |
if ( $is_multiple_controls_container ) {
|
334 |
$fields_count += count( $tag->values );
|
@@ -336,6 +338,8 @@ class WPCF7_ConfigValidator {
|
|
336 |
if ( $tag->has_option( 'free_text' ) ) {
|
337 |
$fields_count += 1;
|
338 |
}
|
|
|
|
|
339 |
} elseif ( ! empty( $tag->name ) ) {
|
340 |
$fields_count += 1;
|
341 |
}
|
@@ -371,7 +375,7 @@ class WPCF7_ConfigValidator {
|
|
371 |
$ng_names = array();
|
372 |
|
373 |
foreach ( $ng_named_tags as $tag ) {
|
374 |
-
$ng_names[] = $tag
|
375 |
}
|
376 |
|
377 |
if ( $ng_names ) {
|
@@ -380,7 +384,11 @@ class WPCF7_ConfigValidator {
|
|
380 |
return $this->add_error( $section,
|
381 |
self::error_unavailable_names,
|
382 |
array(
|
383 |
-
|
|
|
|
|
|
|
|
|
384 |
'params' => array( 'names' => implode( ', ', $ng_names ) ),
|
385 |
'link' => self::get_doc_link( 'unavailable_names' ),
|
386 |
)
|
@@ -533,7 +541,7 @@ class WPCF7_ConfigValidator {
|
|
533 |
public function detect_file_not_found( $section, $content ) {
|
534 |
$path = path_join( WP_CONTENT_DIR, $content );
|
535 |
|
536 |
-
if ( !
|
537 |
return $this->add_error( $section,
|
538 |
self::error_file_not_found,
|
539 |
array(
|
100 |
}
|
101 |
|
102 |
$error_messages[$section][] = array(
|
103 |
+
'message' => $message,
|
104 |
+
'link' => esc_url( $link ),
|
105 |
+
);
|
106 |
}
|
107 |
}
|
108 |
|
236 |
$tagname = $matches[2];
|
237 |
$values = $matches[3];
|
238 |
|
239 |
+
$mail_tag = new WPCF7_MailTag( $tag, $tagname, $values );
|
240 |
+
$field_name = $mail_tag->field_name();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
$example_email = 'example@example.com';
|
243 |
$example_text = 'example';
|
244 |
$example_blank = '';
|
245 |
|
246 |
$form_tags = $this->contact_form->scan_form_tags(
|
247 |
+
array( 'name' => $field_name ) );
|
248 |
|
249 |
if ( $form_tags ) {
|
250 |
$form_tag = new WPCF7_FormTag( $form_tags[0] );
|
257 |
|
258 |
if ( wpcf7_form_tag_supports( $form_tag->type, 'selectable-values' ) ) {
|
259 |
if ( $form_tag->pipes instanceof WPCF7_Pipes ) {
|
260 |
+
if ( $mail_tag->get_option( 'do_not_heat' ) ) {
|
261 |
$before_pipes = $form_tag->pipes->collect_befores();
|
262 |
$last_item = array_pop( $before_pipes );
|
263 |
} else {
|
281 |
return $example_text;
|
282 |
}
|
283 |
|
284 |
+
} else { // maybe special mail tag
|
285 |
+
// for back-compat
|
286 |
+
$field_name = preg_replace( '/^wpcf7\./', '_', $field_name );
|
287 |
|
288 |
+
if ( '_user_agent' == $field_name ) {
|
|
|
|
|
289 |
return $example_text;
|
290 |
+
|
291 |
+
} elseif ( '_user_email' == $field_name ) {
|
292 |
+
return $this->contact_form->is_true( 'subscribers_only' )
|
293 |
+
? $example_email
|
294 |
+
: $example_blank;
|
295 |
+
|
296 |
+
} elseif ( '_user_' == substr( $field_name, 0, 6 ) ) {
|
297 |
+
return $this->contact_form->is_true( 'subscribers_only' )
|
298 |
+
? $example_text
|
299 |
+
: $example_blank;
|
300 |
+
|
301 |
+
} elseif ( '_' == substr( $field_name, 0, 1 ) ) {
|
302 |
+
return '_email' == substr( $field_name, -6 )
|
303 |
+
? $example_email
|
304 |
+
: $example_text;
|
305 |
+
|
306 |
}
|
307 |
}
|
308 |
|
329 |
foreach ( $tags as $tag ) {
|
330 |
$is_multiple_controls_container = wpcf7_form_tag_supports(
|
331 |
$tag->type, 'multiple-controls-container' );
|
332 |
+
$is_zero_controls_container = wpcf7_form_tag_supports(
|
333 |
+
$tag->type, 'zero-controls-container' );
|
334 |
|
335 |
if ( $is_multiple_controls_container ) {
|
336 |
$fields_count += count( $tag->values );
|
338 |
if ( $tag->has_option( 'free_text' ) ) {
|
339 |
$fields_count += 1;
|
340 |
}
|
341 |
+
} elseif ( $is_zero_controls_container ) {
|
342 |
+
$fields_count += 0;
|
343 |
} elseif ( ! empty( $tag->name ) ) {
|
344 |
$fields_count += 1;
|
345 |
}
|
375 |
$ng_names = array();
|
376 |
|
377 |
foreach ( $ng_named_tags as $tag ) {
|
378 |
+
$ng_names[] = sprintf( '"%s"', $tag->name );
|
379 |
}
|
380 |
|
381 |
if ( $ng_names ) {
|
384 |
return $this->add_error( $section,
|
385 |
self::error_unavailable_names,
|
386 |
array(
|
387 |
+
/* translators: %names%: a list of form control names */
|
388 |
+
'message' => _n(
|
389 |
+
"An unavailable name (%names%) is used for form controls.",
|
390 |
+
"Unavailable names (%names%) are used for form controls.",
|
391 |
+
count( $ng_names ), 'contact-form-7' ),
|
392 |
'params' => array( 'names' => implode( ', ', $ng_names ) ),
|
393 |
'link' => self::get_doc_link( 'unavailable_names' ),
|
394 |
)
|
541 |
public function detect_file_not_found( $section, $content ) {
|
542 |
$path = path_join( WP_CONTENT_DIR, $content );
|
543 |
|
544 |
+
if ( ! is_readable( $path ) || ! is_file( $path ) ) {
|
545 |
return $this->add_error( $section,
|
546 |
self::error_file_not_found,
|
547 |
array(
|
includes/contact-form.php
CHANGED
@@ -343,14 +343,29 @@ class WPCF7_ContactForm {
|
|
343 |
if ( $this->is_posted() ) {
|
344 |
$submission = WPCF7_Submission::get_instance();
|
345 |
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
}
|
355 |
}
|
356 |
|
@@ -450,14 +465,29 @@ class WPCF7_ContactForm {
|
|
450 |
$submission = WPCF7_Submission::get_instance();
|
451 |
$content = $submission->get_response();
|
452 |
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
}
|
462 |
} else {
|
463 |
$class .= ' wpcf7-display-none';
|
@@ -556,7 +586,7 @@ class WPCF7_ContactForm {
|
|
556 |
$manager = WPCF7_FormTagsManager::get_instance();
|
557 |
$form = $this->prop( 'form' );
|
558 |
|
559 |
-
if (
|
560 |
$form = $manager->normalize( $form );
|
561 |
$form = wpcf7_autop( $form );
|
562 |
}
|
@@ -599,10 +629,11 @@ class WPCF7_ContactForm {
|
|
599 |
}
|
600 |
|
601 |
public function collect_mail_tags( $args = '' ) {
|
|
|
|
|
602 |
$args = wp_parse_args( $args, array(
|
603 |
'include' => array(),
|
604 |
-
'exclude' =>
|
605 |
-
array( 'acceptance', 'captchac', 'captchar', 'quiz', 'count' ),
|
606 |
) );
|
607 |
|
608 |
$tags = $this->scan_form_tags();
|
@@ -662,7 +693,10 @@ class WPCF7_ContactForm {
|
|
662 |
|
663 |
public function submit( $args = '' ) {
|
664 |
$args = wp_parse_args( $args, array(
|
665 |
-
'skip_mail' =>
|
|
|
|
|
|
|
666 |
) );
|
667 |
|
668 |
if ( $this->is_true( 'subscribers_only' )
|
@@ -693,22 +727,6 @@ class WPCF7_ContactForm {
|
|
693 |
$result['invalid_fields'] = $submission->get_invalid_fields();
|
694 |
}
|
695 |
|
696 |
-
if ( $submission->is( 'mail_sent' ) ) {
|
697 |
-
$on_sent_ok = $this->additional_setting( 'on_sent_ok', false );
|
698 |
-
|
699 |
-
if ( ! empty( $on_sent_ok ) ) {
|
700 |
-
$result['scripts_on_sent_ok'] = array_map(
|
701 |
-
'wpcf7_strip_quote', $on_sent_ok );
|
702 |
-
}
|
703 |
-
}
|
704 |
-
|
705 |
-
$on_submit = $this->additional_setting( 'on_submit', false );
|
706 |
-
|
707 |
-
if ( ! empty( $on_submit ) ) {
|
708 |
-
$result['scripts_on_submit'] = array_map(
|
709 |
-
'wpcf7_strip_quote', $on_submit );
|
710 |
-
}
|
711 |
-
|
712 |
do_action( 'wpcf7_submit', $this, $result );
|
713 |
|
714 |
return $result;
|
@@ -721,14 +739,20 @@ class WPCF7_ContactForm {
|
|
721 |
$message = isset( $messages[$status] ) ? $messages[$status] : '';
|
722 |
|
723 |
if ( $filter ) {
|
724 |
-
$message =
|
725 |
-
$message = wpcf7_mail_replace_tags( $message, array( 'html' => true ) );
|
726 |
-
$message = apply_filters( 'wpcf7_display_message', $message, $status );
|
727 |
}
|
728 |
|
729 |
return $message;
|
730 |
}
|
731 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
732 |
/* Additional settings */
|
733 |
|
734 |
public function additional_setting( $name, $max = 1 ) {
|
343 |
if ( $this->is_posted() ) {
|
344 |
$submission = WPCF7_Submission::get_instance();
|
345 |
|
346 |
+
switch ( $submission->get_status() ) {
|
347 |
+
case 'validation_failed':
|
348 |
+
$class .= ' invalid';
|
349 |
+
break;
|
350 |
+
case 'acceptance_missing':
|
351 |
+
$class .= ' unaccepted';
|
352 |
+
break;
|
353 |
+
case 'spam':
|
354 |
+
$class .= ' spam';
|
355 |
+
break;
|
356 |
+
case 'aborted':
|
357 |
+
$class .= ' aborted';
|
358 |
+
break;
|
359 |
+
case 'mail_sent':
|
360 |
+
$class .= ' sent';
|
361 |
+
break;
|
362 |
+
case 'mail_failed':
|
363 |
+
$class .= ' failed';
|
364 |
+
break;
|
365 |
+
default:
|
366 |
+
$class .= sprintf( ' custom-%s',
|
367 |
+
preg_replace( '/[^0-9a-z]+/i', '-', $submission->get_status() )
|
368 |
+
);
|
369 |
}
|
370 |
}
|
371 |
|
465 |
$submission = WPCF7_Submission::get_instance();
|
466 |
$content = $submission->get_response();
|
467 |
|
468 |
+
switch ( $submission->get_status() ) {
|
469 |
+
case 'validation_failed':
|
470 |
+
$class .= ' wpcf7-validation-errors';
|
471 |
+
break;
|
472 |
+
case 'acceptance_missing':
|
473 |
+
$class .= ' wpcf7-acceptance-missing';
|
474 |
+
break;
|
475 |
+
case 'spam':
|
476 |
+
$class .= ' wpcf7-spam-blocked';
|
477 |
+
break;
|
478 |
+
case 'aborted':
|
479 |
+
$class .= ' wpcf7-aborted';
|
480 |
+
break;
|
481 |
+
case 'mail_sent':
|
482 |
+
$class .= ' wpcf7-mail-sent-ok';
|
483 |
+
break;
|
484 |
+
case 'mail_failed':
|
485 |
+
$class .= ' wpcf7-mail-sent-ng';
|
486 |
+
break;
|
487 |
+
default:
|
488 |
+
$class .= sprintf( ' wpcf7-custom-%s',
|
489 |
+
preg_replace( '/[^0-9a-z]+/i', '-', $submission->get_status() )
|
490 |
+
);
|
491 |
}
|
492 |
} else {
|
493 |
$class .= ' wpcf7-display-none';
|
586 |
$manager = WPCF7_FormTagsManager::get_instance();
|
587 |
$form = $this->prop( 'form' );
|
588 |
|
589 |
+
if ( wpcf7_autop_or_not() ) {
|
590 |
$form = $manager->normalize( $form );
|
591 |
$form = wpcf7_autop( $form );
|
592 |
}
|
629 |
}
|
630 |
|
631 |
public function collect_mail_tags( $args = '' ) {
|
632 |
+
$manager = WPCF7_FormTagsManager::get_instance();
|
633 |
+
|
634 |
$args = wp_parse_args( $args, array(
|
635 |
'include' => array(),
|
636 |
+
'exclude' => $manager->collect_tag_types( 'not-for-mail' ),
|
|
|
637 |
) );
|
638 |
|
639 |
$tags = $this->scan_form_tags();
|
693 |
|
694 |
public function submit( $args = '' ) {
|
695 |
$args = wp_parse_args( $args, array(
|
696 |
+
'skip_mail' =>
|
697 |
+
( $this->in_demo_mode()
|
698 |
+
|| $this->is_true( 'skip_mail' )
|
699 |
+
|| ! empty( $this->skip_mail ) ),
|
700 |
) );
|
701 |
|
702 |
if ( $this->is_true( 'subscribers_only' )
|
727 |
$result['invalid_fields'] = $submission->get_invalid_fields();
|
728 |
}
|
729 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
730 |
do_action( 'wpcf7_submit', $this, $result );
|
731 |
|
732 |
return $result;
|
739 |
$message = isset( $messages[$status] ) ? $messages[$status] : '';
|
740 |
|
741 |
if ( $filter ) {
|
742 |
+
$message = $this->filter_message( $message, $status );
|
|
|
|
|
743 |
}
|
744 |
|
745 |
return $message;
|
746 |
}
|
747 |
|
748 |
+
public function filter_message( $message, $status = '' ) {
|
749 |
+
$message = wp_strip_all_tags( $message );
|
750 |
+
$message = wpcf7_mail_replace_tags( $message, array( 'html' => true ) );
|
751 |
+
$message = apply_filters( 'wpcf7_display_message', $message, $status );
|
752 |
+
|
753 |
+
return $message;
|
754 |
+
}
|
755 |
+
|
756 |
/* Additional settings */
|
757 |
|
758 |
public function additional_setting( $name, $max = 1 ) {
|
includes/css/styles.css
CHANGED
@@ -3,11 +3,6 @@ div.wpcf7 {
|
|
3 |
padding: 0;
|
4 |
}
|
5 |
|
6 |
-
div.wpcf7-response-output {
|
7 |
-
margin: 2em 0.5em 1em;
|
8 |
-
padding: 0.2em 1em;
|
9 |
-
}
|
10 |
-
|
11 |
div.wpcf7 .screen-reader-response {
|
12 |
position: absolute;
|
13 |
overflow: hidden;
|
@@ -19,11 +14,18 @@ div.wpcf7 .screen-reader-response {
|
|
19 |
border: 0;
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
div.wpcf7-mail-sent-ok {
|
23 |
border: 2px solid #398f14;
|
24 |
}
|
25 |
|
26 |
-
div.wpcf7-mail-sent-ng
|
|
|
27 |
border: 2px solid #ff0000;
|
28 |
}
|
29 |
|
@@ -31,7 +33,8 @@ div.wpcf7-spam-blocked {
|
|
31 |
border: 2px solid #ffa500;
|
32 |
}
|
33 |
|
34 |
-
div.wpcf7-validation-errors
|
|
|
35 |
border: 2px solid #f7e700;
|
36 |
}
|
37 |
|
3 |
padding: 0;
|
4 |
}
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
div.wpcf7 .screen-reader-response {
|
7 |
position: absolute;
|
8 |
overflow: hidden;
|
14 |
border: 0;
|
15 |
}
|
16 |
|
17 |
+
div.wpcf7-response-output {
|
18 |
+
margin: 2em 0.5em 1em;
|
19 |
+
padding: 0.2em 1em;
|
20 |
+
border: 2px solid #ff0000;
|
21 |
+
}
|
22 |
+
|
23 |
div.wpcf7-mail-sent-ok {
|
24 |
border: 2px solid #398f14;
|
25 |
}
|
26 |
|
27 |
+
div.wpcf7-mail-sent-ng,
|
28 |
+
div.wpcf7-aborted {
|
29 |
border: 2px solid #ff0000;
|
30 |
}
|
31 |
|
33 |
border: 2px solid #ffa500;
|
34 |
}
|
35 |
|
36 |
+
div.wpcf7-validation-errors,
|
37 |
+
div.wpcf7-acceptance-missing {
|
38 |
border: 2px solid #f7e700;
|
39 |
}
|
40 |
|
includes/form-tags-manager.php
CHANGED
@@ -214,27 +214,38 @@ class WPCF7_FormTagsManager {
|
|
214 |
'feature' => '',
|
215 |
) );
|
216 |
|
217 |
-
$
|
218 |
-
$
|
219 |
-
$cond['feature']
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
|
222 |
$output = array();
|
223 |
|
224 |
foreach ( $tags as $tag ) {
|
225 |
$tag = new WPCF7_FormTag( $tag );
|
226 |
|
227 |
-
if ( $
|
228 |
continue;
|
229 |
}
|
230 |
|
231 |
-
if ( $
|
232 |
continue;
|
233 |
}
|
234 |
|
235 |
-
if ( $
|
236 |
-
|
237 |
-
|
|
|
|
|
|
|
|
|
|
|
238 |
}
|
239 |
|
240 |
$output[] = $tag;
|
214 |
'feature' => '',
|
215 |
) );
|
216 |
|
217 |
+
$type = array_filter( (array) $cond['type'] );
|
218 |
+
$name = array_filter( (array) $cond['name'] );
|
219 |
+
$feature = is_string( $cond['feature'] ) ? trim( $cond['feature'] ) : '';
|
220 |
+
|
221 |
+
if ( '!' == substr( $feature, 0, 1 ) ) {
|
222 |
+
$feature_negative = true;
|
223 |
+
$feature = trim( substr( $feature, 1 ) );
|
224 |
+
} else {
|
225 |
+
$feature_negative = false;
|
226 |
+
}
|
227 |
|
228 |
$output = array();
|
229 |
|
230 |
foreach ( $tags as $tag ) {
|
231 |
$tag = new WPCF7_FormTag( $tag );
|
232 |
|
233 |
+
if ( $type && ! in_array( $tag->type, $type, true ) ) {
|
234 |
continue;
|
235 |
}
|
236 |
|
237 |
+
if ( $name && ! in_array( $tag->name, $name, true ) ) {
|
238 |
continue;
|
239 |
}
|
240 |
|
241 |
+
if ( $feature ) {
|
242 |
+
if ( ! $this->tag_type_supports( $tag->type, $feature )
|
243 |
+
&& ! $feature_negative ) {
|
244 |
+
continue;
|
245 |
+
} elseif ( $this->tag_type_supports( $tag->type, $feature )
|
246 |
+
&& $feature_negative ) {
|
247 |
+
continue;
|
248 |
+
}
|
249 |
}
|
250 |
|
251 |
$output[] = $tag;
|
includes/functions.php
CHANGED
@@ -108,6 +108,10 @@ function wpcf7_validate_configuration() {
|
|
108 |
WPCF7_VALIDATE_CONFIGURATION );
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
111 |
function wpcf7_load_js() {
|
112 |
return apply_filters( 'wpcf7_load_js', WPCF7_LOAD_JS );
|
113 |
}
|
@@ -188,7 +192,8 @@ function wpcf7_register_post_types() {
|
|
188 |
function wpcf7_version( $args = '' ) {
|
189 |
$defaults = array(
|
190 |
'limit' => -1,
|
191 |
-
'only_major' => false
|
|
|
192 |
|
193 |
$args = wp_parse_args( $args, $defaults );
|
194 |
|
@@ -248,13 +253,13 @@ function wpcf7_enctype_value( $enctype ) {
|
|
248 |
|
249 |
function wpcf7_rmdir_p( $dir ) {
|
250 |
if ( is_file( $dir ) ) {
|
251 |
-
if ( ! $result =
|
252 |
-
$stat =
|
253 |
$perms = $stat['mode'];
|
254 |
-
|
255 |
|
256 |
-
if ( ! $result =
|
257 |
-
|
258 |
}
|
259 |
}
|
260 |
|
@@ -265,7 +270,7 @@ function wpcf7_rmdir_p( $dir ) {
|
|
265 |
return false;
|
266 |
}
|
267 |
|
268 |
-
if ( $handle =
|
269 |
while ( false !== ( $file = readdir( $handle ) ) ) {
|
270 |
if ( $file == "." || $file == ".." ) {
|
271 |
continue;
|
@@ -277,7 +282,7 @@ function wpcf7_rmdir_p( $dir ) {
|
|
277 |
closedir( $handle );
|
278 |
}
|
279 |
|
280 |
-
return
|
281 |
}
|
282 |
|
283 |
/* From _http_build_query in wp-includes/functions.php */
|
108 |
WPCF7_VALIDATE_CONFIGURATION );
|
109 |
}
|
110 |
|
111 |
+
function wpcf7_autop_or_not() {
|
112 |
+
return (bool) apply_filters( 'wpcf7_autop_or_not', WPCF7_AUTOP );
|
113 |
+
}
|
114 |
+
|
115 |
function wpcf7_load_js() {
|
116 |
return apply_filters( 'wpcf7_load_js', WPCF7_LOAD_JS );
|
117 |
}
|
192 |
function wpcf7_version( $args = '' ) {
|
193 |
$defaults = array(
|
194 |
'limit' => -1,
|
195 |
+
'only_major' => false,
|
196 |
+
);
|
197 |
|
198 |
$args = wp_parse_args( $args, $defaults );
|
199 |
|
253 |
|
254 |
function wpcf7_rmdir_p( $dir ) {
|
255 |
if ( is_file( $dir ) ) {
|
256 |
+
if ( ! $result = unlink( $dir ) ) {
|
257 |
+
$stat = stat( $dir );
|
258 |
$perms = $stat['mode'];
|
259 |
+
chmod( $dir, $perms | 0200 ); // add write for owner
|
260 |
|
261 |
+
if ( ! $result = unlink( $dir ) ) {
|
262 |
+
chmod( $dir, $perms );
|
263 |
}
|
264 |
}
|
265 |
|
270 |
return false;
|
271 |
}
|
272 |
|
273 |
+
if ( $handle = opendir( $dir ) ) {
|
274 |
while ( false !== ( $file = readdir( $handle ) ) ) {
|
275 |
if ( $file == "." || $file == ".." ) {
|
276 |
continue;
|
282 |
closedir( $handle );
|
283 |
}
|
284 |
|
285 |
+
return rmdir( $dir );
|
286 |
}
|
287 |
|
288 |
/* From _http_build_query in wp-includes/functions.php */
|
includes/js/scripts.js
CHANGED
@@ -237,6 +237,7 @@
|
|
237 |
var ajaxSuccess = function( data, status, xhr, $form ) {
|
238 |
detail.id = $( data.into ).attr( 'id' );
|
239 |
detail.status = data.status;
|
|
|
240 |
|
241 |
var $message = $( '.wpcf7-response-output', $form );
|
242 |
|
@@ -255,6 +256,12 @@
|
|
255 |
|
256 |
wpcf7.triggerEvent( data.into, 'invalid', detail );
|
257 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
case 'spam':
|
259 |
$message.addClass( 'wpcf7-spam-blocked' );
|
260 |
$form.addClass( 'spam' );
|
@@ -268,31 +275,33 @@
|
|
268 |
|
269 |
wpcf7.triggerEvent( data.into, 'spam', detail );
|
270 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
case 'mail_sent':
|
272 |
$message.addClass( 'wpcf7-mail-sent-ok' );
|
273 |
$form.addClass( 'sent' );
|
274 |
|
275 |
-
if ( data.onSentOk ) {
|
276 |
-
$.each( data.onSentOk, function( i, n ) { eval( n ) } );
|
277 |
-
}
|
278 |
-
|
279 |
wpcf7.triggerEvent( data.into, 'mailsent', detail );
|
280 |
break;
|
281 |
case 'mail_failed':
|
282 |
-
case 'acceptance_missing':
|
283 |
-
default:
|
284 |
$message.addClass( 'wpcf7-mail-sent-ng' );
|
285 |
$form.addClass( 'failed' );
|
286 |
|
287 |
wpcf7.triggerEvent( data.into, 'mailfailed', detail );
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
}
|
289 |
|
290 |
wpcf7.refill( $form, data );
|
291 |
|
292 |
-
if ( data.onSubmit ) {
|
293 |
-
$.each( data.onSubmit, function( i, n ) { eval( n ) } );
|
294 |
-
}
|
295 |
-
|
296 |
wpcf7.triggerEvent( data.into, 'submit', detail );
|
297 |
|
298 |
if ( 'mail_sent' == data.status ) {
|
@@ -380,13 +389,16 @@
|
|
380 |
|
381 |
$submit.prop( 'disabled', false );
|
382 |
|
383 |
-
$( '
|
384 |
-
var $
|
|
|
385 |
|
386 |
-
if ( $
|
387 |
-
|
388 |
-
$
|
389 |
-
|
|
|
|
|
390 |
}
|
391 |
} );
|
392 |
};
|
237 |
var ajaxSuccess = function( data, status, xhr, $form ) {
|
238 |
detail.id = $( data.into ).attr( 'id' );
|
239 |
detail.status = data.status;
|
240 |
+
detail.apiResponse = data;
|
241 |
|
242 |
var $message = $( '.wpcf7-response-output', $form );
|
243 |
|
256 |
|
257 |
wpcf7.triggerEvent( data.into, 'invalid', detail );
|
258 |
break;
|
259 |
+
case 'acceptance_missing':
|
260 |
+
$message.addClass( 'wpcf7-acceptance-missing' );
|
261 |
+
$form.addClass( 'unaccepted' );
|
262 |
+
|
263 |
+
wpcf7.triggerEvent( data.into, 'unaccepted', detail );
|
264 |
+
break;
|
265 |
case 'spam':
|
266 |
$message.addClass( 'wpcf7-spam-blocked' );
|
267 |
$form.addClass( 'spam' );
|
275 |
|
276 |
wpcf7.triggerEvent( data.into, 'spam', detail );
|
277 |
break;
|
278 |
+
case 'aborted':
|
279 |
+
$message.addClass( 'wpcf7-aborted' );
|
280 |
+
$form.addClass( 'aborted' );
|
281 |
+
|
282 |
+
wpcf7.triggerEvent( data.into, 'aborted', detail );
|
283 |
+
break;
|
284 |
case 'mail_sent':
|
285 |
$message.addClass( 'wpcf7-mail-sent-ok' );
|
286 |
$form.addClass( 'sent' );
|
287 |
|
|
|
|
|
|
|
|
|
288 |
wpcf7.triggerEvent( data.into, 'mailsent', detail );
|
289 |
break;
|
290 |
case 'mail_failed':
|
|
|
|
|
291 |
$message.addClass( 'wpcf7-mail-sent-ng' );
|
292 |
$form.addClass( 'failed' );
|
293 |
|
294 |
wpcf7.triggerEvent( data.into, 'mailfailed', detail );
|
295 |
+
break;
|
296 |
+
default:
|
297 |
+
var customStatusClass = 'custom-'
|
298 |
+
+ data.status.replace( /[^0-9a-z]+/i, '-' );
|
299 |
+
$message.addClass( 'wpcf7-' + customStatusClass );
|
300 |
+
$form.addClass( customStatusClass );
|
301 |
}
|
302 |
|
303 |
wpcf7.refill( $form, data );
|
304 |
|
|
|
|
|
|
|
|
|
305 |
wpcf7.triggerEvent( data.into, 'submit', detail );
|
306 |
|
307 |
if ( 'mail_sent' == data.status ) {
|
389 |
|
390 |
$submit.prop( 'disabled', false );
|
391 |
|
392 |
+
$( '.wpcf7-acceptance', $form ).each( function() {
|
393 |
+
var $span = $( this );
|
394 |
+
var $input = $( 'input:checkbox', $span );
|
395 |
|
396 |
+
if ( ! $span.hasClass( 'optional' ) ) {
|
397 |
+
if ( $span.hasClass( 'invert' ) && $input.is( ':checked' )
|
398 |
+
|| ! $span.hasClass( 'invert' ) && ! $input.is( ':checked' ) ) {
|
399 |
+
$submit.prop( 'disabled', true );
|
400 |
+
return false;
|
401 |
+
}
|
402 |
}
|
403 |
} );
|
404 |
};
|
includes/mail.php
CHANGED
@@ -5,6 +5,7 @@ class WPCF7_Mail {
|
|
5 |
private static $current = null;
|
6 |
|
7 |
private $name = '';
|
|
|
8 |
private $template = array();
|
9 |
private $use_html = false;
|
10 |
private $exclude_blank = false;
|
@@ -31,6 +32,11 @@ class WPCF7_Mail {
|
|
31 |
'additional_headers' => '',
|
32 |
'attachments' => '',
|
33 |
) );
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
public function name() {
|
@@ -60,9 +66,20 @@ class WPCF7_Mail {
|
|
60 |
}
|
61 |
|
62 |
private function htmlize( $body ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
$header = apply_filters( 'wpcf7_mail_html_header',
|
64 |
'<!doctype html>
|
65 |
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
66 |
<head>
|
67 |
<title>' . esc_html( $this->get( 'subject', true ) ) . '</title>
|
68 |
</head>
|
@@ -157,7 +174,7 @@ class WPCF7_Mail {
|
|
157 |
|
158 |
$path = path_join( WP_CONTENT_DIR, $line );
|
159 |
|
160 |
-
if (
|
161 |
$attachments[] = $path;
|
162 |
}
|
163 |
}
|
@@ -282,37 +299,23 @@ class WPCF7_MailTaggedText {
|
|
282 |
$tagname = $matches[2];
|
283 |
$values = $matches[3];
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
$values = wpcf7_strip_quote_deep( $matches[0] );
|
288 |
-
}
|
289 |
-
|
290 |
-
$do_not_heat = false;
|
291 |
-
|
292 |
-
if ( preg_match( '/^_raw_(.+)$/', $tagname, $matches ) ) {
|
293 |
-
$tagname = trim( $matches[1] );
|
294 |
-
$do_not_heat = true;
|
295 |
-
}
|
296 |
-
|
297 |
-
$format = '';
|
298 |
-
|
299 |
-
if ( preg_match( '/^_format_(.+)$/', $tagname, $matches ) ) {
|
300 |
-
$tagname = trim( $matches[1] );
|
301 |
-
$format = $values[0];
|
302 |
-
}
|
303 |
|
304 |
$submission = WPCF7_Submission::get_instance();
|
305 |
-
$submitted = $submission
|
|
|
|
|
306 |
|
307 |
if ( null !== $submitted ) {
|
308 |
|
309 |
-
if ( $do_not_heat ) {
|
310 |
-
$submitted = isset( $_POST[$
|
311 |
}
|
312 |
|
313 |
$replaced = $submitted;
|
314 |
|
315 |
-
if (
|
316 |
$replaced = $this->format( $replaced, $format );
|
317 |
}
|
318 |
|
@@ -323,8 +326,16 @@ class WPCF7_MailTaggedText {
|
|
323 |
$replaced = wptexturize( $replaced );
|
324 |
}
|
325 |
|
326 |
-
$
|
327 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
|
329 |
$replaced = wp_unslash( trim( $replaced ) );
|
330 |
|
@@ -332,9 +343,10 @@ class WPCF7_MailTaggedText {
|
|
332 |
return $replaced;
|
333 |
}
|
334 |
|
335 |
-
$special = apply_filters( 'wpcf7_special_mail_tags',
|
|
|
336 |
|
337 |
-
if (
|
338 |
$this->replaced_tags[$tag] = $special;
|
339 |
return $special;
|
340 |
}
|
@@ -355,90 +367,73 @@ class WPCF7_MailTaggedText {
|
|
355 |
}
|
356 |
}
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_special_mail_tag', 10, 3 );
|
361 |
|
362 |
-
|
363 |
-
$
|
|
|
|
|
|
|
|
|
364 |
|
365 |
-
$
|
|
|
|
|
366 |
|
367 |
-
|
368 |
-
|
369 |
-
|
|
|
370 |
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
} else {
|
375 |
-
return '';
|
376 |
}
|
377 |
-
}
|
378 |
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
} else {
|
383 |
-
return '';
|
384 |
}
|
385 |
-
}
|
386 |
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
} else {
|
391 |
-
return '';
|
392 |
}
|
393 |
}
|
394 |
|
395 |
-
|
396 |
-
|
397 |
-
if ( '_date' == $name ) {
|
398 |
-
return date_i18n( get_option( 'date_format' ), $timestamp );
|
399 |
-
}
|
400 |
-
|
401 |
-
if ( '_time' == $name ) {
|
402 |
-
return date_i18n( get_option( 'time_format' ), $timestamp );
|
403 |
-
}
|
404 |
-
}
|
405 |
-
|
406 |
-
return '';
|
407 |
}
|
408 |
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
if ( $post = get_post( $post_id ) ) {
|
413 |
-
if ( '_post_id' == $name ) {
|
414 |
-
return (string) $post->ID;
|
415 |
-
}
|
416 |
-
|
417 |
-
if ( '_post_name' == $name ) {
|
418 |
-
return $post->post_name;
|
419 |
-
}
|
420 |
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
|
429 |
-
|
|
|
|
|
|
|
430 |
|
431 |
-
|
432 |
-
|
433 |
-
|
|
|
|
|
|
|
434 |
|
435 |
-
if (
|
436 |
-
|
437 |
}
|
438 |
}
|
439 |
|
440 |
-
return
|
441 |
}
|
442 |
-
|
443 |
-
return $output;
|
444 |
}
|
5 |
private static $current = null;
|
6 |
|
7 |
private $name = '';
|
8 |
+
private $locale = '';
|
9 |
private $template = array();
|
10 |
private $use_html = false;
|
11 |
private $exclude_blank = false;
|
32 |
'additional_headers' => '',
|
33 |
'attachments' => '',
|
34 |
) );
|
35 |
+
|
36 |
+
if ( $submission = WPCF7_Submission::get_instance() ) {
|
37 |
+
$contact_form = $submission->get_contact_form();
|
38 |
+
$this->locale = $contact_form->locale();
|
39 |
+
}
|
40 |
}
|
41 |
|
42 |
public function name() {
|
66 |
}
|
67 |
|
68 |
private function htmlize( $body ) {
|
69 |
+
if ( $this->locale ) {
|
70 |
+
$lang_atts = sprintf( ' %s',
|
71 |
+
wpcf7_format_atts( array(
|
72 |
+
'dir' => wpcf7_is_rtl( $this->locale ) ? 'rtl' : 'ltr',
|
73 |
+
'lang' => str_replace( '_', '-', $this->locale ),
|
74 |
+
) )
|
75 |
+
);
|
76 |
+
} else {
|
77 |
+
$lang_atts = '';
|
78 |
+
}
|
79 |
+
|
80 |
$header = apply_filters( 'wpcf7_mail_html_header',
|
81 |
'<!doctype html>
|
82 |
+
<html xmlns="http://www.w3.org/1999/xhtml"' . $lang_atts . '>
|
83 |
<head>
|
84 |
<title>' . esc_html( $this->get( 'subject', true ) ) . '</title>
|
85 |
</head>
|
174 |
|
175 |
$path = path_join( WP_CONTENT_DIR, $line );
|
176 |
|
177 |
+
if ( is_readable( $path ) && is_file( $path ) ) {
|
178 |
$attachments[] = $path;
|
179 |
}
|
180 |
}
|
299 |
$tagname = $matches[2];
|
300 |
$values = $matches[3];
|
301 |
|
302 |
+
$mail_tag = new WPCF7_MailTag( $tag, $tagname, $values );
|
303 |
+
$field_name = $mail_tag->field_name();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
|
305 |
$submission = WPCF7_Submission::get_instance();
|
306 |
+
$submitted = $submission
|
307 |
+
? $submission->get_posted_data( $field_name )
|
308 |
+
: null;
|
309 |
|
310 |
if ( null !== $submitted ) {
|
311 |
|
312 |
+
if ( $mail_tag->get_option( 'do_not_heat' ) ) {
|
313 |
+
$submitted = isset( $_POST[$field_name] ) ? $_POST[$field_name] : '';
|
314 |
}
|
315 |
|
316 |
$replaced = $submitted;
|
317 |
|
318 |
+
if ( $format = $mail_tag->get_option( 'format' ) ) {
|
319 |
$replaced = $this->format( $replaced, $format );
|
320 |
}
|
321 |
|
326 |
$replaced = wptexturize( $replaced );
|
327 |
}
|
328 |
|
329 |
+
if ( $form_tag = $mail_tag->corresponding_form_tag() ) {
|
330 |
+
$type = $form_tag->type;
|
331 |
+
|
332 |
+
$replaced = apply_filters(
|
333 |
+
"wpcf7_mail_tag_replaced_{$type}", $replaced,
|
334 |
+
$submitted, $html, $mail_tag );
|
335 |
+
}
|
336 |
+
|
337 |
+
$replaced = apply_filters( 'wpcf7_mail_tag_replaced', $replaced,
|
338 |
+
$submitted, $html, $mail_tag );
|
339 |
|
340 |
$replaced = wp_unslash( trim( $replaced ) );
|
341 |
|
343 |
return $replaced;
|
344 |
}
|
345 |
|
346 |
+
$special = apply_filters( 'wpcf7_special_mail_tags', null,
|
347 |
+
$mail_tag->tag_name(), $html, $mail_tag );
|
348 |
|
349 |
+
if ( null !== $special ) {
|
350 |
$this->replaced_tags[$tag] = $special;
|
351 |
return $special;
|
352 |
}
|
367 |
}
|
368 |
}
|
369 |
|
370 |
+
class WPCF7_MailTag {
|
|
|
|
|
371 |
|
372 |
+
private $tag;
|
373 |
+
private $tagname = '';
|
374 |
+
private $name = '';
|
375 |
+
private $options = array();
|
376 |
+
private $values = array();
|
377 |
+
private $form_tag = null;
|
378 |
|
379 |
+
public function __construct( $tag, $tagname, $values ) {
|
380 |
+
$this->tag = $tag;
|
381 |
+
$this->name = $this->tagname = $tagname;
|
382 |
|
383 |
+
$this->options = array(
|
384 |
+
'do_not_heat' => false,
|
385 |
+
'format' => '',
|
386 |
+
);
|
387 |
|
388 |
+
if ( ! empty( $values ) ) {
|
389 |
+
preg_match_all( '/"[^"]*"|\'[^\']*\'/', $values, $matches );
|
390 |
+
$this->values = wpcf7_strip_quote_deep( $matches[0] );
|
|
|
|
|
391 |
}
|
|
|
392 |
|
393 |
+
if ( preg_match( '/^_raw_(.+)$/', $tagname, $matches ) ) {
|
394 |
+
$this->name = trim( $matches[1] );
|
395 |
+
$this->options['do_not_heat'] = true;
|
|
|
|
|
396 |
}
|
|
|
397 |
|
398 |
+
if ( preg_match( '/^_format_(.+)$/', $tagname, $matches ) ) {
|
399 |
+
$this->name = trim( $matches[1] );
|
400 |
+
$this->options['format'] = $this->values[0];
|
|
|
|
|
401 |
}
|
402 |
}
|
403 |
|
404 |
+
public function tag_name() {
|
405 |
+
return $this->tagname;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
}
|
407 |
|
408 |
+
public function field_name() {
|
409 |
+
return $this->name;
|
410 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
|
412 |
+
public function get_option( $option ) {
|
413 |
+
return $this->options[$option];
|
414 |
+
}
|
415 |
|
416 |
+
public function values() {
|
417 |
+
return $this->values;
|
418 |
+
}
|
419 |
|
420 |
+
public function corresponding_form_tag() {
|
421 |
+
if ( $this->form_tag instanceof WPCF7_FormTag ) {
|
422 |
+
return $this->form_tag;
|
423 |
+
}
|
424 |
|
425 |
+
if ( $submission = WPCF7_Submission::get_instance() ) {
|
426 |
+
$contact_form = $submission->get_contact_form();
|
427 |
+
$tags = $contact_form->scan_form_tags( array(
|
428 |
+
'name' => $this->name,
|
429 |
+
'feature' => '! zero-controls-container',
|
430 |
+
) );
|
431 |
|
432 |
+
if ( $tags ) {
|
433 |
+
$this->form_tag = $tags[0];
|
434 |
}
|
435 |
}
|
436 |
|
437 |
+
return $this->form_tag;
|
438 |
}
|
|
|
|
|
439 |
}
|
includes/rest-api.php
CHANGED
@@ -302,14 +302,6 @@ function wpcf7_rest_create_feedback( WP_REST_Request $request ) {
|
|
302 |
$response['invalidFields'] = $invalid_fields;
|
303 |
}
|
304 |
|
305 |
-
if ( ! empty( $result['scripts_on_sent_ok'] ) ) {
|
306 |
-
$response['onSentOk'] = $result['scripts_on_sent_ok'];
|
307 |
-
}
|
308 |
-
|
309 |
-
if ( ! empty( $result['scripts_on_submit'] ) ) {
|
310 |
-
$response['onSubmit'] = $result['scripts_on_submit'];
|
311 |
-
}
|
312 |
-
|
313 |
$response = apply_filters( 'wpcf7_ajax_json_echo', $response, $result );
|
314 |
|
315 |
return rest_ensure_response( $response );
|
302 |
$response['invalidFields'] = $invalid_fields;
|
303 |
}
|
304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
$response = apply_filters( 'wpcf7_ajax_json_echo', $response, $result );
|
306 |
|
307 |
return rest_ensure_response( $response );
|
includes/special-mail-tags.php
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
** Special Mail Tags
|
4 |
+
** https://contactform7.com/special-mail-tags/
|
5 |
+
**/
|
6 |
+
|
7 |
+
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_special_mail_tag', 10, 3 );
|
8 |
+
|
9 |
+
function wpcf7_special_mail_tag( $output, $name, $html ) {
|
10 |
+
$name = preg_replace( '/^wpcf7\./', '_', $name ); // for back-compat
|
11 |
+
|
12 |
+
$submission = WPCF7_Submission::get_instance();
|
13 |
+
|
14 |
+
if ( ! $submission ) {
|
15 |
+
return $output;
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( '_remote_ip' == $name ) {
|
19 |
+
if ( $remote_ip = $submission->get_meta( 'remote_ip' ) ) {
|
20 |
+
return $remote_ip;
|
21 |
+
} else {
|
22 |
+
return '';
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
if ( '_user_agent' == $name ) {
|
27 |
+
if ( $user_agent = $submission->get_meta( 'user_agent' ) ) {
|
28 |
+
return $html ? esc_html( $user_agent ) : $user_agent;
|
29 |
+
} else {
|
30 |
+
return '';
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
if ( '_url' == $name ) {
|
35 |
+
if ( $url = $submission->get_meta( 'url' ) ) {
|
36 |
+
return esc_url( $url );
|
37 |
+
} else {
|
38 |
+
return '';
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
if ( '_date' == $name || '_time' == $name ) {
|
43 |
+
if ( $timestamp = $submission->get_meta( 'timestamp' ) ) {
|
44 |
+
if ( '_date' == $name ) {
|
45 |
+
return date_i18n( get_option( 'date_format' ), $timestamp );
|
46 |
+
}
|
47 |
+
|
48 |
+
if ( '_time' == $name ) {
|
49 |
+
return date_i18n( get_option( 'time_format' ), $timestamp );
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
return '';
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( '_invalid_fields' == $name ) {
|
57 |
+
return count( $submission->get_invalid_fields() );
|
58 |
+
}
|
59 |
+
|
60 |
+
return $output;
|
61 |
+
}
|
62 |
+
|
63 |
+
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_post_related_smt', 10, 3 );
|
64 |
+
|
65 |
+
function wpcf7_post_related_smt( $output, $name, $html ) {
|
66 |
+
if ( '_post_' != substr( $name, 0, 6 ) ) {
|
67 |
+
return $output;
|
68 |
+
}
|
69 |
+
|
70 |
+
$submission = WPCF7_Submission::get_instance();
|
71 |
+
|
72 |
+
if ( ! $submission ) {
|
73 |
+
return $output;
|
74 |
+
}
|
75 |
+
|
76 |
+
$post_id = (int) $submission->get_meta( 'container_post_id' );
|
77 |
+
|
78 |
+
if ( ! $post_id || ! $post = get_post( $post_id ) ) {
|
79 |
+
return '';
|
80 |
+
}
|
81 |
+
|
82 |
+
if ( '_post_id' == $name ) {
|
83 |
+
return (string) $post->ID;
|
84 |
+
}
|
85 |
+
|
86 |
+
if ( '_post_name' == $name ) {
|
87 |
+
return $post->post_name;
|
88 |
+
}
|
89 |
+
|
90 |
+
if ( '_post_title' == $name ) {
|
91 |
+
return $html ? esc_html( $post->post_title ) : $post->post_title;
|
92 |
+
}
|
93 |
+
|
94 |
+
if ( '_post_url' == $name ) {
|
95 |
+
return get_permalink( $post->ID );
|
96 |
+
}
|
97 |
+
|
98 |
+
$user = new WP_User( $post->post_author );
|
99 |
+
|
100 |
+
if ( '_post_author' == $name ) {
|
101 |
+
return $user->display_name;
|
102 |
+
}
|
103 |
+
|
104 |
+
if ( '_post_author_email' == $name ) {
|
105 |
+
return $user->user_email;
|
106 |
+
}
|
107 |
+
|
108 |
+
return $output;
|
109 |
+
}
|
110 |
+
|
111 |
+
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_site_related_smt', 10, 3 );
|
112 |
+
|
113 |
+
function wpcf7_site_related_smt( $output, $name, $html ) {
|
114 |
+
$filter = $html ? 'display' : 'raw';
|
115 |
+
|
116 |
+
if ( '_site_title' == $name ) {
|
117 |
+
return get_bloginfo( 'name', $filter );
|
118 |
+
}
|
119 |
+
|
120 |
+
if ( '_site_description' == $name ) {
|
121 |
+
return get_bloginfo( 'description', $filter );
|
122 |
+
}
|
123 |
+
|
124 |
+
if ( '_site_url' == $name ) {
|
125 |
+
return get_bloginfo( 'url', $filter );
|
126 |
+
}
|
127 |
+
|
128 |
+
if ( '_site_admin_email' == $name ) {
|
129 |
+
return get_bloginfo( 'admin_email', $filter );
|
130 |
+
}
|
131 |
+
|
132 |
+
return $output;
|
133 |
+
}
|
134 |
+
|
135 |
+
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_user_related_smt', 10, 3 );
|
136 |
+
|
137 |
+
function wpcf7_user_related_smt( $output, $name, $html ) {
|
138 |
+
if ( '_user_' != substr( $name, 0, 6 ) || '_user_agent' == $name ) {
|
139 |
+
return $output;
|
140 |
+
}
|
141 |
+
|
142 |
+
$submission = WPCF7_Submission::get_instance();
|
143 |
+
|
144 |
+
if ( ! $submission ) {
|
145 |
+
return $output;
|
146 |
+
}
|
147 |
+
|
148 |
+
$user_id = (int) $submission->get_meta( 'current_user_id' );
|
149 |
+
|
150 |
+
if ( ! $user_id ) {
|
151 |
+
return '';
|
152 |
+
}
|
153 |
+
|
154 |
+
$primary_props = array( 'user_login', 'user_email', 'user_url' );
|
155 |
+
$opt = ltrim( $name, '_' );
|
156 |
+
$opt = in_array( $opt, $primary_props ) ? $opt : substr( $opt, 5 );
|
157 |
+
|
158 |
+
$user = new WP_User( $user_id );
|
159 |
+
|
160 |
+
if ( $user->has_prop( $opt ) ) {
|
161 |
+
return $user->get( $opt );
|
162 |
+
}
|
163 |
+
|
164 |
+
return '';
|
165 |
+
}
|
includes/submission.php
CHANGED
@@ -12,6 +12,7 @@ class WPCF7_Submission {
|
|
12 |
private $response = '';
|
13 |
private $invalid_fields = array();
|
14 |
private $meta = array();
|
|
|
15 |
|
16 |
private function __construct() {}
|
17 |
|
@@ -45,6 +46,15 @@ class WPCF7_Submission {
|
|
45 |
return $this->status;
|
46 |
}
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
public function is( $status ) {
|
49 |
return $this->status == $status;
|
50 |
}
|
@@ -53,6 +63,15 @@ class WPCF7_Submission {
|
|
53 |
return $this->response;
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
public function get_invalid_field( $name ) {
|
57 |
if ( isset( $this->invalid_fields[$name] ) ) {
|
58 |
return $this->invalid_fields[$name];
|
@@ -85,35 +104,37 @@ class WPCF7_Submission {
|
|
85 |
$tags = $this->contact_form->scan_form_tags();
|
86 |
|
87 |
foreach ( (array) $tags as $tag ) {
|
88 |
-
if ( empty( $tag
|
89 |
continue;
|
90 |
}
|
91 |
|
92 |
-
$
|
93 |
-
$
|
|
|
|
|
|
|
94 |
|
95 |
if ( isset( $posted_data[$name] ) ) {
|
96 |
-
$value = $posted_data[$name];
|
97 |
}
|
98 |
|
99 |
-
$pipes = $tag['pipes'];
|
100 |
-
|
101 |
if ( WPCF7_USE_PIPE
|
102 |
&& $pipes instanceof WPCF7_Pipes
|
103 |
&& ! $pipes->zero() ) {
|
104 |
-
if ( is_array( $
|
105 |
-
$
|
106 |
|
107 |
-
foreach ( $
|
108 |
-
$
|
109 |
}
|
110 |
-
|
111 |
-
$value = $new_value;
|
112 |
} else {
|
113 |
-
$value = $pipes->do_pipe( wp_unslash( $
|
114 |
}
|
115 |
}
|
116 |
|
|
|
|
|
|
|
117 |
$posted_data[$name] = $value;
|
118 |
}
|
119 |
|
@@ -148,31 +169,43 @@ class WPCF7_Submission {
|
|
148 |
isset( $_POST['_wpcf7_unit_tag'] ) ? $_POST['_wpcf7_unit_tag'] : '',
|
149 |
'container_post_id' => isset( $_POST['_wpcf7_container_post'] )
|
150 |
? (int) $_POST['_wpcf7_container_post'] : 0,
|
|
|
151 |
);
|
152 |
|
153 |
$contact_form = $this->contact_form;
|
154 |
|
155 |
if ( ! $this->validate() ) { // Validation error occured
|
156 |
-
$this->
|
157 |
-
$this->
|
158 |
|
159 |
} elseif ( ! $this->accepted() ) { // Not accepted terms
|
160 |
-
$this->
|
161 |
-
$this->
|
162 |
|
163 |
} elseif ( $this->spam() ) { // Spam!
|
164 |
-
$this->
|
165 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
} elseif ( $this->mail() ) {
|
168 |
-
$this->
|
169 |
-
$this->
|
170 |
|
171 |
do_action( 'wpcf7_mail_sent', $contact_form );
|
172 |
|
173 |
} else {
|
174 |
-
$this->
|
175 |
-
$this->
|
176 |
|
177 |
do_action( 'wpcf7_mail_failed', $contact_form );
|
178 |
}
|
@@ -222,7 +255,7 @@ class WPCF7_Submission {
|
|
222 |
$tags = $this->contact_form->scan_form_tags();
|
223 |
|
224 |
foreach ( $tags as $tag ) {
|
225 |
-
$type = $tag
|
226 |
$result = apply_filters( "wpcf7_validate_{$type}", $result, $tag );
|
227 |
}
|
228 |
|
@@ -234,7 +267,16 @@ class WPCF7_Submission {
|
|
234 |
}
|
235 |
|
236 |
private function accepted() {
|
237 |
-
return apply_filters( 'wpcf7_acceptance', true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
}
|
239 |
|
240 |
private function spam() {
|
@@ -282,12 +324,23 @@ class WPCF7_Submission {
|
|
282 |
|
283 |
/* Mail */
|
284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
private function mail() {
|
286 |
$contact_form = $this->contact_form;
|
287 |
|
288 |
-
|
289 |
-
|
290 |
-
$skip_mail = apply_filters( 'wpcf7_skip_mail', $this->skip_mail, $contact_form );
|
291 |
|
292 |
if ( $skip_mail ) {
|
293 |
return true;
|
@@ -330,7 +383,7 @@ class WPCF7_Submission {
|
|
330 |
public function remove_uploaded_files() {
|
331 |
foreach ( (array) $this->uploaded_files as $name => $path ) {
|
332 |
wpcf7_rmdir_p( $path );
|
333 |
-
|
334 |
}
|
335 |
}
|
336 |
|
12 |
private $response = '';
|
13 |
private $invalid_fields = array();
|
14 |
private $meta = array();
|
15 |
+
private $consent = array();
|
16 |
|
17 |
private function __construct() {}
|
18 |
|
46 |
return $this->status;
|
47 |
}
|
48 |
|
49 |
+
public function set_status( $status ) {
|
50 |
+
if ( preg_match( '/^[a-z][0-9a-z_]+$/', $status ) ) {
|
51 |
+
$this->status = $status;
|
52 |
+
return true;
|
53 |
+
}
|
54 |
+
|
55 |
+
return false;
|
56 |
+
}
|
57 |
+
|
58 |
public function is( $status ) {
|
59 |
return $this->status == $status;
|
60 |
}
|
63 |
return $this->response;
|
64 |
}
|
65 |
|
66 |
+
public function set_response( $response ) {
|
67 |
+
$this->response = $response;
|
68 |
+
return true;
|
69 |
+
}
|
70 |
+
|
71 |
+
public function get_contact_form() {
|
72 |
+
return $this->contact_form;
|
73 |
+
}
|
74 |
+
|
75 |
public function get_invalid_field( $name ) {
|
76 |
if ( isset( $this->invalid_fields[$name] ) ) {
|
77 |
return $this->invalid_fields[$name];
|
104 |
$tags = $this->contact_form->scan_form_tags();
|
105 |
|
106 |
foreach ( (array) $tags as $tag ) {
|
107 |
+
if ( empty( $tag->name ) ) {
|
108 |
continue;
|
109 |
}
|
110 |
|
111 |
+
$type = $tag->type;
|
112 |
+
$name = $tag->name;
|
113 |
+
$pipes = $tag->pipes;
|
114 |
+
|
115 |
+
$value_orig = $value = '';
|
116 |
|
117 |
if ( isset( $posted_data[$name] ) ) {
|
118 |
+
$value_orig = $value = $posted_data[$name];
|
119 |
}
|
120 |
|
|
|
|
|
121 |
if ( WPCF7_USE_PIPE
|
122 |
&& $pipes instanceof WPCF7_Pipes
|
123 |
&& ! $pipes->zero() ) {
|
124 |
+
if ( is_array( $value_orig ) ) {
|
125 |
+
$value = array();
|
126 |
|
127 |
+
foreach ( $value_orig as $v ) {
|
128 |
+
$value[] = $pipes->do_pipe( wp_unslash( $v ) );
|
129 |
}
|
|
|
|
|
130 |
} else {
|
131 |
+
$value = $pipes->do_pipe( wp_unslash( $value_orig ) );
|
132 |
}
|
133 |
}
|
134 |
|
135 |
+
$value = apply_filters( "wpcf7_posted_data_{$type}", $value,
|
136 |
+
$value_orig, $tag );
|
137 |
+
|
138 |
$posted_data[$name] = $value;
|
139 |
}
|
140 |
|
169 |
isset( $_POST['_wpcf7_unit_tag'] ) ? $_POST['_wpcf7_unit_tag'] : '',
|
170 |
'container_post_id' => isset( $_POST['_wpcf7_container_post'] )
|
171 |
? (int) $_POST['_wpcf7_container_post'] : 0,
|
172 |
+
'current_user_id' => get_current_user_id(),
|
173 |
);
|
174 |
|
175 |
$contact_form = $this->contact_form;
|
176 |
|
177 |
if ( ! $this->validate() ) { // Validation error occured
|
178 |
+
$this->set_status( 'validation_failed' );
|
179 |
+
$this->set_response( $contact_form->message( 'validation_error' ) );
|
180 |
|
181 |
} elseif ( ! $this->accepted() ) { // Not accepted terms
|
182 |
+
$this->set_status( 'acceptance_missing' );
|
183 |
+
$this->set_response( $contact_form->message( 'accept_terms' ) );
|
184 |
|
185 |
} elseif ( $this->spam() ) { // Spam!
|
186 |
+
$this->set_status( 'spam' );
|
187 |
+
$this->set_response( $contact_form->message( 'spam' ) );
|
188 |
+
|
189 |
+
} elseif ( ! $this->before_send_mail() ) {
|
190 |
+
if ( 'init' == $this->get_status() ) {
|
191 |
+
$this->set_status( 'aborted' );
|
192 |
+
}
|
193 |
+
|
194 |
+
if ( '' === $this->get_response() ) {
|
195 |
+
$this->set_response( $contact_form->filter_message(
|
196 |
+
__( "Sending mail has been aborted.", 'contact-form-7' ) )
|
197 |
+
);
|
198 |
+
}
|
199 |
|
200 |
} elseif ( $this->mail() ) {
|
201 |
+
$this->set_status( 'mail_sent' );
|
202 |
+
$this->set_response( $contact_form->message( 'mail_sent_ok' ) );
|
203 |
|
204 |
do_action( 'wpcf7_mail_sent', $contact_form );
|
205 |
|
206 |
} else {
|
207 |
+
$this->set_status( 'mail_failed' );
|
208 |
+
$this->set_response( $contact_form->message( 'mail_sent_ng' ) );
|
209 |
|
210 |
do_action( 'wpcf7_mail_failed', $contact_form );
|
211 |
}
|
255 |
$tags = $this->contact_form->scan_form_tags();
|
256 |
|
257 |
foreach ( $tags as $tag ) {
|
258 |
+
$type = $tag->type;
|
259 |
$result = apply_filters( "wpcf7_validate_{$type}", $result, $tag );
|
260 |
}
|
261 |
|
267 |
}
|
268 |
|
269 |
private function accepted() {
|
270 |
+
return apply_filters( 'wpcf7_acceptance', true, $this );
|
271 |
+
}
|
272 |
+
|
273 |
+
public function add_consent( $name, $conditions ) {
|
274 |
+
$this->consent[$name] = $conditions;
|
275 |
+
return true;
|
276 |
+
}
|
277 |
+
|
278 |
+
public function collect_consent() {
|
279 |
+
return (array) $this->consent;
|
280 |
}
|
281 |
|
282 |
private function spam() {
|
324 |
|
325 |
/* Mail */
|
326 |
|
327 |
+
private function before_send_mail() {
|
328 |
+
$abort = false;
|
329 |
+
|
330 |
+
do_action_ref_array( 'wpcf7_before_send_mail', array(
|
331 |
+
$this->contact_form,
|
332 |
+
&$abort,
|
333 |
+
$this,
|
334 |
+
) );
|
335 |
+
|
336 |
+
return ! $abort;
|
337 |
+
}
|
338 |
+
|
339 |
private function mail() {
|
340 |
$contact_form = $this->contact_form;
|
341 |
|
342 |
+
$skip_mail = apply_filters( 'wpcf7_skip_mail',
|
343 |
+
$this->skip_mail, $contact_form );
|
|
|
344 |
|
345 |
if ( $skip_mail ) {
|
346 |
return true;
|
383 |
public function remove_uploaded_files() {
|
384 |
foreach ( (array) $this->uploaded_files as $name => $path ) {
|
385 |
wpcf7_rmdir_p( $path );
|
386 |
+
rmdir( dirname( $path ) ); // remove parent dir if it's removable (empty).
|
387 |
}
|
388 |
}
|
389 |
|
license.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
Contact Form 7 WordPress Plugin, 2007-
|
2 |
Contact Form 7 is distributed under the terms of the GNU GPL
|
3 |
|
4 |
This program is free software; you can redistribute it and/or modify
|
@@ -14,3 +14,345 @@ GNU General Public License for more details.
|
|
14 |
You should have received a copy of the GNU General Public License
|
15 |
along with this program; if not, write to the Free Software
|
16 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|