Contact Form 7 add confirm - Version 4.6

Version Description

Download this release

Release Info

Developer Yuichiro ABE
Plugin Icon wp plugin Contact Form 7 add confirm
Version 4.6
Comparing to
See all releases

Code changes from version 4.3.3 to 4.6

Files changed (3) hide show
  1. contact-form-7-confirm.php +2 -2
  2. includes/controller.php +147 -93
  3. readme.txt +7 -4
contact-form-7-confirm.php CHANGED
@@ -7,7 +7,7 @@ Author: Yuichiro ABE
7
  Author URI: http://www.eyeta.jp/
8
  Text Domain: contact-form-7-add-confirm
9
  Domain Path: /languages/
10
- Version: 4.3.3
11
  */
12
 
13
  /* Copyright 2014- Yuichiro ABE (email: y.abe at eyeta.jp)
@@ -28,7 +28,7 @@ Version: 4.3.3
28
  */
29
 
30
 
31
- define( 'WPCF7C_VERSION', '4.3.3' );
32
 
33
  if ( ! defined( 'WPCF7C_PLUGIN_BASENAME' ) )
34
  define( 'WPCF7C_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
7
  Author URI: http://www.eyeta.jp/
8
  Text Domain: contact-form-7-add-confirm
9
  Domain Path: /languages/
10
+ Version: 4.6
11
  */
12
 
13
  /* Copyright 2014- Yuichiro ABE (email: y.abe at eyeta.jp)
28
  */
29
 
30
 
31
+ define( 'WPCF7C_VERSION', '4.6' );
32
 
33
  if ( ! defined( 'WPCF7C_PLUGIN_BASENAME' ) )
34
  define( 'WPCF7C_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
includes/controller.php CHANGED
@@ -4,13 +4,13 @@
4
  *
5
  * Created by PhpStorm.
6
  * Author: Eyeta Co.,Ltd.(http://www.eyeta.jp)
7
- *
8
  */
9
 
10
 
11
  add_action( 'init', 'wpcf7c_control_init', 10 );
12
  function wpcf7c_control_init() {
13
- if(!class_exists('WPCF7_ContactForm')) {
14
  return false;
15
  }
16
 
@@ -21,12 +21,12 @@ function wpcf7c_control_init() {
21
  add_filter( 'wpcf7_validate_captchar', 'wpcf7c_captcha_validation_filter', 10, 2 );
22
 
23
 
24
- if (isset($_POST['_wpcf7c']) && 'step1' == $_POST["_wpcf7c"]) {
25
  remove_filter( 'wpcf7_ajax_onload', 'wpcf7_quiz_ajax_refill' );
26
  remove_filter( 'wpcf7_ajax_json_echo', 'wpcf7_quiz_ajax_refill' );
27
  }
28
 
29
- add_filter('nocache_headers', "wpcf7c_nocache_headers", 10, 1);
30
  add_action( 'wpcf7_enqueue_scripts', 'wpcf7c_enqueue_scripts' );
31
  add_action( 'wpcf7_enqueue_styles', 'wpcf7c_enqueue_styles' );
32
 
@@ -35,75 +35,129 @@ function wpcf7c_control_init() {
35
 
36
  function wpcf7c_ajax_json_echo() {
37
  //error_log("wpcf7c_ajax_json_echo: " . $_POST['_wpcf7c']);
38
- if (isset($_POST['_wpcf7c'])) switch($_POST["_wpcf7c"]) {
39
- case "step1":
40
- // $result = apply_filters( 'wpcf7_before_send_mail', $result );
41
- if(WPCF7_VERSION == '3.9' || WPCF7_VERSION == '3.9.1') {
42
- add_filter( 'wpcf7_acceptance', 'wpcf7c_acceptance_filter', 11, 1 );
43
- } else if(WPCF7_VERSION >= "3.9.2"){
44
- add_filter("wpcf7_skip_mail", '__return_true', 10, 2);
45
- } else {
46
- add_action("wpcf7_before_send_mail", "wpcf7c_before_send_mail_step1", 10, 2);
47
- //add_filter( 'wpcf7_acceptance', 'wpcf7c_acceptance_filter', 11, 1 );
48
- }
 
49
 
50
- //$items = apply_filters( 'wpcf7_ajax_json_echo', $items, $result );
51
- add_filter("wpcf7_ajax_json_echo", "wpcf7c_ajax_json_echo_step1", 10, 3);
52
-
53
- // flamingo対策
54
- remove_action( 'wpcf7_submit', 'wpcf7_flamingo_submit');
55
-
56
- // Contact Form DB対策
57
- //remove_action( 'wpcf7_before_send_mail', 'wpcf7_flamingo_submit');
58
- global $wp_filter, $merged_filters;
59
- //error_log(print_r($wp_filter,true));
60
- //error_log(print_r($wp_filter, true));
61
- if(isset($wp_filter["wpcf7_before_send_mail"])) {
62
- foreach($wp_filter["wpcf7_before_send_mail"] as $priority => $actions) {
63
- foreach($actions as $key => $action) {
64
- if(is_array($action["function"])) {
65
- if(is_object($action["function"][0])) {
66
- error_log(print_r($action["function"][0], true));
67
- if(get_class($action["function"][0]) == "CF7DBPlugin") {
68
-
69
- if($action["function"][1] == "saveFormData") {
70
- unset($wp_filter["wpcf7_before_send_mail"][$priority][$key]);
71
- if ( empty($wp_filter["wpcf7_before_send_mail"][$priority]) )
72
- unset($wp_filter["wpcf7_before_send_mail"][$priority]);
73
- unset($merged_filters["wpcf7_before_send_mail"]);
74
- } else if($action["function"][1] == "saveCF7FormData") {
75
- unset($wp_filter["wpcf7_before_send_mail"][$priority][$key]);
76
- if ( empty($wp_filter["wpcf7_before_send_mail"][$priority]) )
77
- unset($wp_filter["wpcf7_before_send_mail"][$priority]);
78
- unset($merged_filters["wpcf7_before_send_mail"]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
- } else if(get_class($action["function"][0]) == 'CFDBIntegrationContactForm7') {
81
- if($action["function"][1] == "saveFormData") {
82
- unset($wp_filter["wpcf7_before_send_mail"][$priority][$key]);
83
- if ( empty($wp_filter["wpcf7_before_send_mail"][$priority]) )
84
- unset($wp_filter["wpcf7_before_send_mail"][$priority]);
85
- unset($merged_filters["wpcf7_before_send_mail"]);
86
- } else if($action["function"][1] == "saveCF7FormData") {
87
- unset($wp_filter["wpcf7_before_send_mail"][$priority][$key]);
88
- if ( empty($wp_filter["wpcf7_before_send_mail"][$priority]) )
89
- unset($wp_filter["wpcf7_before_send_mail"][$priority]);
90
- unset($merged_filters["wpcf7_before_send_mail"]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
  }
93
  }
94
  }
95
  }
96
  }
97
- }
98
 
99
- break;
100
- case "step2":
101
- //$items = apply_filters( 'wpcf7_ajax_json_echo', $items, $result );
102
- add_filter("wpcf7_ajax_json_echo", "wpcf7c_ajax_json_echo_step2", 10, 3);
103
 
 
 
 
 
104
 
105
- break;
106
- }
 
107
 
108
 
109
  return;
@@ -114,36 +168,38 @@ function wpcf7c_ajax_json_echo() {
114
  * acceptanceの機能を利用してメール送信をスキップする。
115
  *
116
  * @param $accepted
 
117
  * @return bool
118
  */
119
- function wpcf7c_acceptance_filter($accepted) {
120
  global $wpcf7_confflag;
121
 
122
- if($accepted == false) {
123
  // すでにエラー
124
  return $accepted;
125
  }
126
 
127
  // これが呼ばれるときは必ずSTEP1
128
  $wpcf7_confflag = true;
 
129
  return false;
130
  }
131
 
132
- function wpcf7c_before_send_mail_step1(&$cls) {
133
  //eyeta_log("wpcf7c_before_send_mail_step1");
134
  $cls->skip_mail = true;
135
  }
136
 
137
 
138
- function wpcf7c_ajax_json_echo_step1($items, $result) {
139
  global $wpcf7_confflag;
140
 
141
  $flag = false;
142
 
143
- if(WPCF7_VERSION == '3.9' || WPCF7_VERSION == '3.9.1') {
144
  $flag = $wpcf7_confflag;
145
- } else if(WPCF7_VERSION >= "3.9.2"){
146
- if('mail_sent' == $result['status']) {
147
  $flag = true;
148
  }
149
  } else {
@@ -151,36 +207,34 @@ function wpcf7c_ajax_json_echo_step1($items, $result) {
151
  }
152
 
153
 
154
-
155
-
156
- if($flag) {
157
- if(!isset($items["onSubmit"]) || $items["onSubmit"] == null) {
158
- $items["onSubmit"] = array("wpcf7c_step1('" . $_POST['_wpcf7_unit_tag'] . "');");
159
  } else {
160
  $items["onSubmit"][] = "wpcf7c_step1('" . $_POST['_wpcf7_unit_tag'] . "');";
161
  }
162
 
163
  // オプションによる追加チェック
164
- $form = WPCF7_ContactForm::get_current();
165
  $on_confirm = $form->additional_setting( 'on_confirm', false );
166
  if ( ! empty( $on_confirm ) ) {
167
- foreach($on_confirm as $key => $on_confirm_func) {
168
  $items["onSubmit"][] = wpcf7_strip_quote( $on_confirm_func );
169
  }
170
  }
171
 
172
 
173
- $items["message"] = "";
174
  $items["mailSent"] = false;
175
 
176
- unset($items['captcha']);
177
 
178
  } else {
179
  // フィルタ指定があればエラー時にアンカーまでスクロールさせる
180
  $result = false;
181
- if(apply_filters( 'wpcf7c_input_error_scroll', $result )) {
182
- if(!isset($items["onSubmit"]) || $items["onSubmit"] == null) {
183
- $items["onSubmit"] = array("wpcf7c_scroll('" . $_POST['_wpcf7_unit_tag'] . "');");
184
  } else {
185
  $items["onSubmit"][] = "wpcf7c_scroll('" . $_POST['_wpcf7_unit_tag'] . "');";
186
  }
@@ -202,8 +256,8 @@ function wpcf7c_captcha_validation_filter( $result, $tag ) {
202
 
203
  $captchac = '_wpcf7_captcha_challenge_' . $name;
204
 
205
- $prefix = isset( $_POST[$captchac] ) ? (string) $_POST[$captchac] : '';
206
- $response = isset( $_POST[$name] ) ? (string) $_POST[$name] : '';
207
  $response = wpcf7_canonicalize( $response );
208
 
209
  if ( 0 == strlen( $prefix ) || ! wpcf7_check_captcha( $prefix, $response ) ) {
@@ -214,8 +268,8 @@ function wpcf7c_captcha_validation_filter( $result, $tag ) {
214
  }
215
  }
216
 
217
- if(0 != strlen( $prefix ) && $_POST["_wpcf7c"] == "step1") {
218
- } else if ( 0 != strlen( $prefix )) {
219
  wpcf7_remove_captcha( $prefix );
220
  }
221
 
@@ -223,28 +277,28 @@ function wpcf7c_captcha_validation_filter( $result, $tag ) {
223
  }
224
 
225
 
226
- function wpcf7c_ajax_json_echo_step2($items, $result) {
227
  //eyeta_log("wpcf7c_ajax_json_echo_step1");
228
  $flag = false;
229
 
230
- if(WPCF7_VERSION == '3.9' || WPCF7_VERSION == '3.9.1') {
231
  $flag = $items['mailSent'];
232
- } else if(WPCF7_VERSION >= "3.9.2"){
233
  $flag = $items['mailSent'];
234
  } else {
235
  $flag = $result['mail_sent'];
236
  }
237
 
238
 
239
- if($flag) {
240
- if(!isset($items["onSubmit"]) || $items["onSubmit"] == null) {
241
- $items["onSubmit"] = array("wpcf7c_step2('" . $_POST['_wpcf7_unit_tag'] . "');");
242
  } else {
243
  $items["onSubmit"][] = "wpcf7c_step2('" . $_POST['_wpcf7_unit_tag'] . "');";
244
  }
245
  } else {
246
- if(!isset($items["onSubmit"]) || $items["onSubmit"] == null) {
247
- $items["onSubmit"] = array("wpcf7c_step2_error('" . $_POST['_wpcf7_unit_tag'] . "');");
248
  } else {
249
  $items["onSubmit"][] = "wpcf7c_step2_error('" . $_POST['_wpcf7_unit_tag'] . "');";
250
  }
4
  *
5
  * Created by PhpStorm.
6
  * Author: Eyeta Co.,Ltd.(http://www.eyeta.jp)
7
+ *
8
  */
9
 
10
 
11
  add_action( 'init', 'wpcf7c_control_init', 10 );
12
  function wpcf7c_control_init() {
13
+ if ( ! class_exists( 'WPCF7_ContactForm' ) ) {
14
  return false;
15
  }
16
 
21
  add_filter( 'wpcf7_validate_captchar', 'wpcf7c_captcha_validation_filter', 10, 2 );
22
 
23
 
24
+ if ( isset( $_POST['_wpcf7c'] ) && 'step1' == $_POST["_wpcf7c"] ) {
25
  remove_filter( 'wpcf7_ajax_onload', 'wpcf7_quiz_ajax_refill' );
26
  remove_filter( 'wpcf7_ajax_json_echo', 'wpcf7_quiz_ajax_refill' );
27
  }
28
 
29
+ add_filter( 'nocache_headers', "wpcf7c_nocache_headers", 10, 1 );
30
  add_action( 'wpcf7_enqueue_scripts', 'wpcf7c_enqueue_scripts' );
31
  add_action( 'wpcf7_enqueue_styles', 'wpcf7c_enqueue_styles' );
32
 
35
 
36
  function wpcf7c_ajax_json_echo() {
37
  //error_log("wpcf7c_ajax_json_echo: " . $_POST['_wpcf7c']);
38
+ if ( isset( $_POST['_wpcf7c'] ) )
39
+ switch ( $_POST["_wpcf7c"] ) {
40
+ case "step1":
41
+ // $result = apply_filters( 'wpcf7_before_send_mail', $result );
42
+ if ( WPCF7_VERSION == '3.9' || WPCF7_VERSION == '3.9.1' ) {
43
+ add_filter( 'wpcf7_acceptance', 'wpcf7c_acceptance_filter', 11, 1 );
44
+ } else if ( WPCF7_VERSION >= "3.9.2" ) {
45
+ add_filter( "wpcf7_skip_mail", '__return_true', 10, 2 );
46
+ } else {
47
+ add_action( "wpcf7_before_send_mail", "wpcf7c_before_send_mail_step1", 10, 2 );
48
+ //add_filter( 'wpcf7_acceptance', 'wpcf7c_acceptance_filter', 11, 1 );
49
+ }
50
 
51
+ //$items = apply_filters( 'wpcf7_ajax_json_echo', $items, $result );
52
+ add_filter( "wpcf7_ajax_json_echo", "wpcf7c_ajax_json_echo_step1", 10, 3 );
53
+
54
+ // flamingo対策
55
+ remove_action( 'wpcf7_submit', 'wpcf7_flamingo_submit' );
56
+
57
+ // Contact Form DB対策
58
+ //remove_action( 'wpcf7_before_send_mail', 'wpcf7_flamingo_submit');
59
+ global $wp_filter, $merged_filters;
60
+ //error_log(print_r($wp_filter,true));
61
+ // error_log("aaa"); error_log(print_r($wp_filter, true));die;
62
+
63
+ if ( version_compare( get_bloginfo( 'version' ), '4.7', '<' ) ) {
64
+ if ( isset( $wp_filter["wpcf7_before_send_mail"] ) ) {
65
+ foreach ( $wp_filter["wpcf7_before_send_mail"] as $priority => $actions ) {
66
+ foreach ( $actions as $key => $action ) {
67
+ if ( is_array( $action["function"] ) ) {
68
+ if ( is_object( $action["function"][0] ) ) {
69
+ //error_log(print_r($action["function"][0], true));
70
+ if ( get_class( $action["function"][0] ) == "CF7DBPlugin" ) {
71
+
72
+ if ( $action["function"][1] == "saveFormData" ) {
73
+ unset( $wp_filter["wpcf7_before_send_mail"][ $priority ][ $key ] );
74
+ if ( empty( $wp_filter["wpcf7_before_send_mail"][ $priority ] ) ) {
75
+ unset( $wp_filter["wpcf7_before_send_mail"][ $priority ] );
76
+ }
77
+ unset( $merged_filters["wpcf7_before_send_mail"] );
78
+ } else if ( $action["function"][1] == "saveCF7FormData" ) {
79
+ unset( $wp_filter["wpcf7_before_send_mail"][ $priority ][ $key ] );
80
+ if ( empty( $wp_filter["wpcf7_before_send_mail"][ $priority ] ) ) {
81
+ unset( $wp_filter["wpcf7_before_send_mail"][ $priority ] );
82
+ }
83
+ unset( $merged_filters["wpcf7_before_send_mail"] );
84
+ }
85
+ } else if ( get_class( $action["function"][0] ) == 'CFDBIntegrationContactForm7' ) {
86
+ if ( $action["function"][1] == "saveFormData" ) {
87
+ unset( $wp_filter["wpcf7_before_send_mail"][ $priority ][ $key ] );
88
+ if ( empty( $wp_filter["wpcf7_before_send_mail"][ $priority ] ) ) {
89
+ unset( $wp_filter["wpcf7_before_send_mail"][ $priority ] );
90
+ }
91
+ unset( $merged_filters["wpcf7_before_send_mail"] );
92
+ } else if ( $action["function"][1] == "saveCF7FormData" ) {
93
+ unset( $wp_filter["wpcf7_before_send_mail"][ $priority ][ $key ] );
94
+ if ( empty( $wp_filter["wpcf7_before_send_mail"][ $priority ] ) ) {
95
+ unset( $wp_filter["wpcf7_before_send_mail"][ $priority ] );
96
+ }
97
+ unset( $merged_filters["wpcf7_before_send_mail"] );
98
+ }
99
+ }
100
  }
101
+ }
102
+ }
103
+ }
104
+ }
105
+ } else {
106
+ if ( isset( $wp_filter["wpcf7_before_send_mail"] ) ) {
107
+ $obj_hook = $wp_filter["wpcf7_before_send_mail"];
108
+
109
+
110
+ foreach ( $obj_hook->callbacks as $priority => $actions ) {
111
+ foreach ( $actions as $key => $action ) {
112
+ if ( is_array( $action["function"] ) ) {
113
+ if ( is_object( $action["function"][0] ) ) {
114
+ //error_log(print_r($action["function"][0], true));
115
+ if ( get_class( $action["function"][0] ) == "CF7DBPlugin" ) {
116
+
117
+ if ( $action["function"][1] == "saveFormData" ) {
118
+ unset( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ][ $key ] );
119
+ if ( empty( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ] ) ) {
120
+ unset( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ] );
121
+ }
122
+ unset( $merged_filters["wpcf7_before_send_mail"] );
123
+ } else if ( $action["function"][1] == "saveCF7FormData" ) {
124
+ unset( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ][ $key ] );
125
+ if ( empty( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ] ) ) {
126
+ unset( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ] );
127
+ }
128
+ unset( $merged_filters["wpcf7_before_send_mail"] );
129
+ }
130
+ } else if ( get_class( $action["function"][0] ) == 'CFDBIntegrationContactForm7' ) {
131
+ if ( $action["function"][1] == "saveFormData" ) {
132
+ unset( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ][ $key ] );
133
+ if ( empty( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ] ) ) {
134
+ unset( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ] );
135
+ }
136
+ unset( $merged_filters["wpcf7_before_send_mail"] );
137
+ } else if ( $action["function"][1] == "saveCF7FormData" ) {
138
+ unset( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ][ $key ] );
139
+ if ( empty( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ] ) ) {
140
+ unset( $wp_filter["wpcf7_before_send_mail"]->callbacks[ $priority ] );
141
+ }
142
+ unset( $merged_filters["wpcf7_before_send_mail"] );
143
+ }
144
+ }
145
  }
146
  }
147
  }
148
  }
149
  }
150
  }
 
151
 
 
 
 
 
152
 
153
+ break;
154
+ case "step2":
155
+ //$items = apply_filters( 'wpcf7_ajax_json_echo', $items, $result );
156
+ add_filter( "wpcf7_ajax_json_echo", "wpcf7c_ajax_json_echo_step2", 10, 3 );
157
 
158
+
159
+ break;
160
+ }
161
 
162
 
163
  return;
168
  * acceptanceの機能を利用してメール送信をスキップする。
169
  *
170
  * @param $accepted
171
+ *
172
  * @return bool
173
  */
174
+ function wpcf7c_acceptance_filter( $accepted ) {
175
  global $wpcf7_confflag;
176
 
177
+ if ( $accepted == false ) {
178
  // すでにエラー
179
  return $accepted;
180
  }
181
 
182
  // これが呼ばれるときは必ずSTEP1
183
  $wpcf7_confflag = true;
184
+
185
  return false;
186
  }
187
 
188
+ function wpcf7c_before_send_mail_step1( &$cls ) {
189
  //eyeta_log("wpcf7c_before_send_mail_step1");
190
  $cls->skip_mail = true;
191
  }
192
 
193
 
194
+ function wpcf7c_ajax_json_echo_step1( $items, $result ) {
195
  global $wpcf7_confflag;
196
 
197
  $flag = false;
198
 
199
+ if ( WPCF7_VERSION == '3.9' || WPCF7_VERSION == '3.9.1' ) {
200
  $flag = $wpcf7_confflag;
201
+ } else if ( WPCF7_VERSION >= "3.9.2" ) {
202
+ if ( 'mail_sent' == $result['status'] ) {
203
  $flag = true;
204
  }
205
  } else {
207
  }
208
 
209
 
210
+ if ( $flag ) {
211
+ if ( ! isset( $items["onSubmit"] ) || $items["onSubmit"] == null ) {
212
+ $items["onSubmit"] = array( "wpcf7c_step1('" . $_POST['_wpcf7_unit_tag'] . "');" );
 
 
213
  } else {
214
  $items["onSubmit"][] = "wpcf7c_step1('" . $_POST['_wpcf7_unit_tag'] . "');";
215
  }
216
 
217
  // オプションによる追加チェック
218
+ $form = WPCF7_ContactForm::get_current();
219
  $on_confirm = $form->additional_setting( 'on_confirm', false );
220
  if ( ! empty( $on_confirm ) ) {
221
+ foreach ( $on_confirm as $key => $on_confirm_func ) {
222
  $items["onSubmit"][] = wpcf7_strip_quote( $on_confirm_func );
223
  }
224
  }
225
 
226
 
227
+ $items["message"] = "";
228
  $items["mailSent"] = false;
229
 
230
+ unset( $items['captcha'] );
231
 
232
  } else {
233
  // フィルタ指定があればエラー時にアンカーまでスクロールさせる
234
  $result = false;
235
+ if ( apply_filters( 'wpcf7c_input_error_scroll', $result ) ) {
236
+ if ( ! isset( $items["onSubmit"] ) || $items["onSubmit"] == null ) {
237
+ $items["onSubmit"] = array( "wpcf7c_scroll('" . $_POST['_wpcf7_unit_tag'] . "');" );
238
  } else {
239
  $items["onSubmit"][] = "wpcf7c_scroll('" . $_POST['_wpcf7_unit_tag'] . "');";
240
  }
256
 
257
  $captchac = '_wpcf7_captcha_challenge_' . $name;
258
 
259
+ $prefix = isset( $_POST[ $captchac ] ) ? (string) $_POST[ $captchac ] : '';
260
+ $response = isset( $_POST[ $name ] ) ? (string) $_POST[ $name ] : '';
261
  $response = wpcf7_canonicalize( $response );
262
 
263
  if ( 0 == strlen( $prefix ) || ! wpcf7_check_captcha( $prefix, $response ) ) {
268
  }
269
  }
270
 
271
+ if ( 0 != strlen( $prefix ) && $_POST["_wpcf7c"] == "step1" ) {
272
+ } else if ( 0 != strlen( $prefix ) ) {
273
  wpcf7_remove_captcha( $prefix );
274
  }
275
 
277
  }
278
 
279
 
280
+ function wpcf7c_ajax_json_echo_step2( $items, $result ) {
281
  //eyeta_log("wpcf7c_ajax_json_echo_step1");
282
  $flag = false;
283
 
284
+ if ( WPCF7_VERSION == '3.9' || WPCF7_VERSION == '3.9.1' ) {
285
  $flag = $items['mailSent'];
286
+ } else if ( WPCF7_VERSION >= "3.9.2" ) {
287
  $flag = $items['mailSent'];
288
  } else {
289
  $flag = $result['mail_sent'];
290
  }
291
 
292
 
293
+ if ( $flag ) {
294
+ if ( ! isset( $items["onSubmit"] ) || $items["onSubmit"] == null ) {
295
+ $items["onSubmit"] = array( "wpcf7c_step2('" . $_POST['_wpcf7_unit_tag'] . "');" );
296
  } else {
297
  $items["onSubmit"][] = "wpcf7c_step2('" . $_POST['_wpcf7_unit_tag'] . "');";
298
  }
299
  } else {
300
+ if ( ! isset( $items["onSubmit"] ) || $items["onSubmit"] == null ) {
301
+ $items["onSubmit"] = array( "wpcf7c_step2_error('" . $_POST['_wpcf7_unit_tag'] . "');" );
302
  } else {
303
  $items["onSubmit"][] = "wpcf7c_step2_error('" . $_POST['_wpcf7_unit_tag'] . "');";
304
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Yuichiro ABE
3
  Donate link:
4
  Tags: contact, form, contact form
5
  Requires at least: 3.8
6
- Tested up to: 4.5.3
7
- Stable tag: 4.3.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Text Domain: contact-form-7-add-confirm
@@ -126,7 +126,10 @@ An answer to that question.
126
 
127
  4.3.2
128
  Contact Form 7がインストールされていないときに管理画面がおかしくなるバグを修正
129
- == Upgrade notice ==
130
  4.3.3
131
  アンカースクロールバグ修正
132
-
 
 
 
3
  Donate link:
4
  Tags: contact, form, contact form
5
  Requires at least: 3.8
6
+ Tested up to: 4.7
7
+ Stable tag: 4.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Text Domain: contact-form-7-add-confirm
126
 
127
  4.3.2
128
  Contact Form 7がインストールされていないときに管理画面がおかしくなるバグを修正
129
+
130
  4.3.3
131
  アンカースクロールバグ修正
132
+
133
+ == Upgrade notice ==
134
+ 4.6
135
+ WordPress4.7対応