MW WP Form - Version 2.5.3

Version Description

  • Added : Japanese zip code validation allows the format of the form 0000000.
  • Bugfix : Fixed a date validation bug.
Download this release

Release Info

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

Code changes from version 2.5.2 to 2.5.3

classes/validation-rules/class.date.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MW WP Form Validation Rule Date
4
  * Description: 日付が正しいかどうか
5
- * Version : 1.1.1
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : July 21, 2014
9
- * Modified : April 1, 2015
10
  * License : GPLv2 or later
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -34,10 +34,10 @@ class MW_WP_Form_Validation_Rule_Date extends MW_WP_Form_Abstract_Validation_Rul
34
  $options = array_merge( $defaults, $options );
35
  $timestamp = strtotime( $value );
36
  if ( !$timestamp ) {
37
- if ( preg_match( '/^(\d+)年(\d{1,2})月(\d{1,2})日$/', $value ) ) {
38
- $value = sprintf( '%d-%d-%d', $value[1], $value[2], $value[3] );
39
- $timestamp = strtotime( $value );
40
- }
41
  }
42
  $year = date( 'Y', $timestamp );
43
  $month = date( 'm', $timestamp );
@@ -48,6 +48,20 @@ class MW_WP_Form_Validation_Rule_Date extends MW_WP_Form_Abstract_Validation_Rul
48
  }
49
  }
50
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  /**
53
  * 設定パネルに追加
@@ -60,4 +74,4 @@ class MW_WP_Form_Validation_Rule_Date extends MW_WP_Form_Abstract_Validation_Rul
60
  <label><input type="checkbox" <?php checked( $value[$this->getName()], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][<?php echo esc_attr( $this->getName() ); ?>]" value="1" /><?php esc_html_e( 'Date', MWF_Config::DOMAIN ); ?></label>
61
  <?php
62
  }
63
- }
2
  /**
3
  * Name : MW WP Form Validation Rule Date
4
  * Description: 日付が正しいかどうか
5
+ * Version : 1.1.2
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : July 21, 2014
9
+ * Modified : October 16, 2015
10
  * License : GPLv2 or later
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
34
  $options = array_merge( $defaults, $options );
35
  $timestamp = strtotime( $value );
36
  if ( !$timestamp ) {
37
+ $timestamp = $this->convert_jpdate_to_timestamp( $value );
38
+ }
39
+ if ( !$timestamp ) {
40
+ return $options['message'];
41
  }
42
  $year = date( 'Y', $timestamp );
43
  $month = date( 'm', $timestamp );
48
  }
49
  }
50
  }
51
+
52
+ /**
53
+ * 日本語表記の日付をタイムスタンプに変換する
54
+ *
55
+ * @param string $jpdate yyyy年mm月dd日
56
+ * @return string|false
57
+ */
58
+ public function convert_jpdate_to_timestamp( $jpdate ) {
59
+ if ( preg_match( '/^(\d+)年(\d{1,2})月(\d{1,2})日$/', $jpdate, $reg ) ) {
60
+ $date = sprintf( '%d-%d-%d', $reg[1], $reg[2], $reg[3] );
61
+ return strtotime( $date );
62
+ }
63
+ return false;
64
+ }
65
 
66
  /**
67
  * 設定パネルに追加
74
  <label><input type="checkbox" <?php checked( $value[$this->getName()], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][<?php echo esc_attr( $this->getName() ); ?>]" value="1" /><?php esc_html_e( 'Date', MWF_Config::DOMAIN ); ?></label>
75
  <?php
76
  }
77
+ }
classes/validation-rules/class.zip.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MW WP Form Validation Rule Zip
4
  * Description: 値が郵便番号
5
- * Version : 1.1.2
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : July 21, 2014
9
- * Modified : April 1, 2015
10
  * License : GPLv2 or later
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -32,7 +32,10 @@ class MW_WP_Form_Validation_Rule_Zip extends MW_WP_Form_Abstract_Validation_Rule
32
  'message' => __( 'This is not the format of a zip code.', MWF_Config::DOMAIN )
33
  );
34
  $options = array_merge( $defaults, $options );
35
- if ( !preg_match( '/^\d{3}-\d{4}$/', $value ) ) {
 
 
 
36
  return $options['message'];
37
  }
38
  }
@@ -49,4 +52,4 @@ class MW_WP_Form_Validation_Rule_Zip extends MW_WP_Form_Abstract_Validation_Rule
49
  <label><input type="checkbox" <?php checked( $value[$this->getName()], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][<?php echo esc_attr( $this->getName() ); ?>]" value="1" /><?php esc_html_e( 'Zip Code', MWF_Config::DOMAIN ); ?></label>
50
  <?php
51
  }
52
- }
2
  /**
3
  * Name : MW WP Form Validation Rule Zip
4
  * Description: 値が郵便番号
5
+ * Version : 1.1.3
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : July 21, 2014
9
+ * Modified : September 23, 2015
10
  * License : GPLv2 or later
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
32
  'message' => __( 'This is not the format of a zip code.', MWF_Config::DOMAIN )
33
  );
34
  $options = array_merge( $defaults, $options );
35
+ if ( ! (
36
+ preg_match( '/^\d{3}-\d{4}$/', $value ) ||
37
+ preg_match( '/^\d{7}$/', $value )
38
+ ) ) {
39
  return $options['message'];
40
  }
41
  }
52
  <label><input type="checkbox" <?php checked( $value[$this->getName()], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][<?php echo esc_attr( $this->getName() ); ?>]" value="1" /><?php esc_html_e( 'Zip Code', MWF_Config::DOMAIN ); ?></label>
53
  <?php
54
  }
55
+ }
mw-wp-form.php CHANGED
@@ -3,11 +3,11 @@
3
  * Plugin Name: MW WP Form
4
  * Plugin URI: http://plugins.2inc.org/mw-wp-form/
5
  * Description: MW WP Form is shortcode base contact form plugin. This plugin have many feature. For example you can use many validation rules, contact data saving, and chart aggregation using saved contact data.
6
- * Version: 2.5.2
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : September 25, 2012
10
- * Modified: September 1, 2015
11
  * Text Domain: mw-wp-form
12
  * Domain Path: /languages/
13
  * License: GPLv2 or later
3
  * Plugin Name: MW WP Form
4
  * Plugin URI: http://plugins.2inc.org/mw-wp-form/
5
  * Description: MW WP Form is shortcode base contact form plugin. This plugin have many feature. For example you can use many validation rules, contact data saving, and chart aggregation using saved contact data.
6
+ * Version: 2.5.3
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : September 25, 2012
10
+ * Modified: October 16, 2015
11
  * Text Domain: mw-wp-form
12
  * Domain Path: /languages/
13
  * License: GPLv2 or later
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: inc2734, ryu263, tomothumb, nanniku, mt8.biz, NExt-Season, kuck1u, mypacecreator
3
  Donate link: http://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: 3.7
6
- Tested up to: 4.3
7
- Stable tag: 2.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -77,6 +77,10 @@ Do you have questions or issues with MW WP Form? Use these support channels appr
77
 
78
  == Changelog ==
79
 
 
 
 
 
80
  = 2.5.2 =
81
  * Added : Add new validation rule japanese kana.
82
  * Added : Add action hook mwform_before_send_admin_mail_mw-wp-form-xxx.
2
  Contributors: inc2734, ryu263, tomothumb, nanniku, mt8.biz, NExt-Season, kuck1u, mypacecreator
3
  Donate link: http://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.3.1
7
+ Stable tag: 2.5.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
77
 
78
  == Changelog ==
79
 
80
+ = 2.5.3 =
81
+ * Added : Japanese zip code validation allows the format of the form 0000000.
82
+ * Bugfix : Fixed a date validation bug.
83
+
84
  = 2.5.2 =
85
  * Added : Add new validation rule japanese kana.
86
  * Added : Add action hook mwform_before_send_admin_mail_mw-wp-form-xxx.