MW WP Form - Version 4.0.3

Version Description

  • Fix saved contact data list bug.
  • Fix nocache headers bug.
Download this release

Release Info

Developer inc2734
Plugin Icon wp plugin MW WP Form
Version 4.0.3
Comparing to
See all releases

Code changes from version 4.0.2 to 4.0.3

classes/controllers/class.contact-data-list.php CHANGED
@@ -62,14 +62,16 @@ class MW_WP_Form_Contact_Data_List_Controller extends MW_WP_Form_Controller {
62
  return;
63
  }
64
 
65
- $post_type = $wp_query->get( 'post_type' );
 
 
66
  $args = apply_filters( 'mwform_get_inquiry_data_args-' . $post_type, array() );
67
  if ( empty( $args ) || ! is_array( $args ) ) {
68
  $args = array();
69
  }
70
  $args = array_merge( $args, array(
71
  'post_type' => $post_type,
72
- 'post_status' => 'any',
73
  ) );
74
 
75
  foreach ( $args as $key => $value ) {
62
  return;
63
  }
64
 
65
+ $post_type = $wp_query->get( 'post_type' );
66
+ $post_status = $wp_query->get( 'post_status' );
67
+
68
  $args = apply_filters( 'mwform_get_inquiry_data_args-' . $post_type, array() );
69
  if ( empty( $args ) || ! is_array( $args ) ) {
70
  $args = array();
71
  }
72
  $args = array_merge( $args, array(
73
  'post_type' => $post_type,
74
+ 'post_status' => $post_status,
75
  ) );
76
 
77
  foreach ( $args as $key => $value ) {
classes/controllers/class.main.php CHANGED
@@ -27,6 +27,13 @@ class MW_WP_Form_Main_Controller {
27
  protected $Validation;
28
 
29
  public function __construct() {
 
 
 
 
 
 
 
30
  add_action( 'parse_request' , array( $this, '_remove_query_vars_from_post' ) );
31
  add_filter( 'nocache_headers' , array( $this, '_nocache_headers' ) , 1 );
32
  add_filter( 'template_include', array( $this, '_template_include' ), 10000 );
@@ -137,9 +144,15 @@ class MW_WP_Form_Main_Controller {
137
  );
138
  }
139
 
 
 
140
  $Redirected->redirect();
141
 
142
  } else {
 
 
 
 
143
 
144
  /**
145
  * [mwform], [mwform_formkey] の登録
@@ -325,4 +338,40 @@ class MW_WP_Form_Main_Controller {
325
  $this->Data->push_uploaded_file_keys( $uploaded_files );
326
  $this->Data->regenerate_upload_file_keys();
327
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  }
27
  protected $Validation;
28
 
29
  public function __construct() {
30
+
31
+ nocache_headers();
32
+ add_filter( 'nocache_headers' , function($headers) {
33
+ $headers['X-Accel-Expires'] = 0;
34
+ return $headers;
35
+ }, 1 );
36
+
37
  add_action( 'parse_request' , array( $this, '_remove_query_vars_from_post' ) );
38
  add_filter( 'nocache_headers' , array( $this, '_nocache_headers' ) , 1 );
39
  add_filter( 'template_include', array( $this, '_template_include' ), 10000 );
144
  );
145
  }
146
 
147
+ $this->_set_transient_for_nocache_headers();
148
+
149
  $Redirected->redirect();
150
 
151
  } else {
152
+ $transient = $this->_get_transient_for_nocache_headers();
153
+ if ( $transient ) {
154
+ nocache_headers();
155
+ }
156
 
157
  /**
158
  * [mwform], [mwform_formkey] の登録
338
  $this->Data->push_uploaded_file_keys( $uploaded_files );
339
  $this->Data->regenerate_upload_file_keys();
340
  }
341
+
342
+ /**
343
+ * Return transient name of nocache headers
344
+ *
345
+ * @return string
346
+ */
347
+ protected function _get_transient_name_for_nocache_headers() {
348
+ $url = $_SERVER['REQUEST_URI'];
349
+ $hash = base64_encode( pack( 'H*', sha1( $url ) ) );
350
+ return 'mwform_keyurl_' . $hash;
351
+ }
352
+
353
+ /**
354
+ * Set transient for nocache headers
355
+ *
356
+ * @return void
357
+ */
358
+ protected function _set_transient_for_nocache_headers() {
359
+ $transient_name = $this->_get_transient_name_for_nocache_headers();
360
+ $transient = get_transient( $transient_name );
361
+ if ( ! $transient ) {
362
+ $transient = [];
363
+ }
364
+ $transient[] = $form_key;
365
+ set_transient( $transient_name, $transient, 1 );
366
+ }
367
+
368
+ /**
369
+ * Return transient for nocache headers
370
+ *
371
+ * @return array
372
+ */
373
+ protected function _get_transient_for_nocache_headers() {
374
+ $transient_name = $this->_get_transient_name_for_nocache_headers();
375
+ return get_transient( $transient_name );
376
+ }
377
  }
classes/services/class.redirected.php CHANGED
@@ -184,8 +184,6 @@ class MW_WP_Form_Redirected {
184
 
185
  do_action( 'mwform_before_redirect_' . $this->form_key );
186
 
187
- $redirect = wp_sanitize_redirect( $redirect );
188
- $redirect = wp_validate_redirect( $redirect, home_url() );
189
  wp_safe_redirect( $redirect );
190
  exit();
191
  }
184
 
185
  do_action( 'mwform_before_redirect_' . $this->form_key );
186
 
 
 
187
  wp_safe_redirect( $redirect );
188
  exit();
189
  }
mw-wp-form.php CHANGED
@@ -3,11 +3,11 @@
3
  * Plugin Name: MW WP Form
4
  * Plugin URI: https://plugins.2inc.org/mw-wp-form/
5
  * Description: MW WP Form is shortcode base contact form plugin. This plugin have many features. For example you can use many validation rules, inquiry data saving, and chart aggregation using saved inquiry data.
6
- * Version: 4.0.2
7
  * Author: Takashi Kitajima
8
  * Author URI: https://2inc.org
9
  * Created : September 25, 2012
10
- * Modified: September 8, 2019
11
  * Text Domain: mw-wp-form
12
  * License: GPLv2 or later
13
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
3
  * Plugin Name: MW WP Form
4
  * Plugin URI: https://plugins.2inc.org/mw-wp-form/
5
  * Description: MW WP Form is shortcode base contact form plugin. This plugin have many features. For example you can use many validation rules, inquiry data saving, and chart aggregation using saved inquiry data.
6
+ * Version: 4.0.3
7
  * Author: Takashi Kitajima
8
  * Author URI: https://2inc.org
9
  * Created : September 25, 2012
10
+ * Modified: September 11, 2019
11
  * Text Domain: mw-wp-form
12
  * License: GPLv2 or later
13
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.amazon.co.jp/registry/wishlist/39ANKRNSTNW40
4
  Tags: plugin, form, confirm, preview, shortcode, mail, chart, graph, html, contact form, form creation, form creator, form manager, form builder, custom form
5
  Requires at least: 4.0
6
  Tested up to: 4.9.8
7
- Stable tag: 4.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -71,6 +71,10 @@ Do you have questions or issues with MW WP Form? Use these support channels appr
71
 
72
  == Changelog ==
73
 
 
 
 
 
74
  = 4.0.2 =
75
  * Fixed a bug caused by erroneous use of set_error_handler()
76
 
4
  Tags: plugin, form, confirm, preview, shortcode, mail, chart, graph, html, contact form, form creation, form creator, form manager, form builder, custom form
5
  Requires at least: 4.0
6
  Tested up to: 4.9.8
7
+ Stable tag: 4.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
71
 
72
  == Changelog ==
73
 
74
+ = 4.0.3 =
75
+ * Fix saved contact data list bug.
76
+ * Fix nocache headers bug.
77
+
78
  = 4.0.2 =
79
  * Fixed a bug caused by erroneous use of set_error_handler()
80