MW WP Form - Version 2.2.6

Version Description

  • Added : Adding MW_WP_Form_Data object to augment of mail related hooks.
  • Added : Adding MW_WP_Form_Data object to augment of mwform_validation hook.
  • Bug fix : Fixed a bug that post_title is not parsed when contact data saving in database.
  • Bug fix : Fixed a bug that post value is sent and saved when children attribute separate at post value and display value.
Download this release

Release Info

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

Code changes from version 2.2.5 to 2.2.6

classes/controllers/class.main.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MW WP Form Main Controller
4
  * Description: フロントエンドにおいて、適切な画面にリダイレクトさせる
5
- * Version : 1.0.1
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : December 23, 2014
9
- * Modified : January 14, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -114,7 +114,8 @@ class MW_WP_Form_Main_Controller {
114
  $this->Validation = apply_filters(
115
  'mwform_validation_' . $form_key,
116
  $this->Validation,
117
- $this->Data->gets()
 
118
  );
119
 
120
  $post_condition = $this->Data->get_post_condition();
2
  /**
3
  * Name : MW WP Form Main Controller
4
  * Description: フロントエンドにおいて、適切な画面にリダイレクトさせる
5
+ * Version : 1.0.2
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : December 23, 2014
9
+ * Modified : January 22, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
114
  $this->Validation = apply_filters(
115
  'mwform_validation_' . $form_key,
116
  $this->Validation,
117
+ $this->Data->gets(),
118
+ clone $this->Data
119
  );
120
 
121
  $post_condition = $this->Data->get_post_condition();
classes/form-fields/class.checkbox.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MW WP Form Field Checkbox
4
  * Description: チェックボックスを出力
5
- * Version : 1.5.2
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : December 14, 2012
9
- * Modified : January 21, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -54,14 +54,15 @@ class MW_WP_Form_Field_Checkbox extends MW_WP_Form_Abstract_Form_Field {
54
  * @return string HTML
55
  */
56
  protected function input_page() {
57
- $children = $this->get_children( $this->atts['children'] );
58
- $value = $this->get_children( $this->atts['value'] );
59
  $separator = ( $this->atts['separator'] ) ? $this->atts['separator'] : $this->defaults['separator'];
60
  $_ret = $this->Form->checkbox( $this->atts['name'], $children, array(
61
  'id' => $this->atts['id'],
62
  'value' => $value,
63
  'vertically' => $this->atts['vertically'],
64
  ), $separator );
 
65
  if ( $this->atts['show_error'] !== 'false' ) {
66
  $_ret .= $this->get_error( $this->atts['name'] );
67
  }
@@ -79,6 +80,7 @@ class MW_WP_Form_Field_Checkbox extends MW_WP_Form_Abstract_Form_Field {
79
  $posted_value = $this->Form->get_separated_raw_value( $this->atts['name'], $children );
80
  $_ret = esc_html( $value );
81
  $_ret .= $this->Form->hidden( $this->atts['name'] . '[data]', $posted_value );
 
82
  $_ret .= $this->Form->separator( $this->atts['name'] );
83
  return $_ret;
84
  }
2
  /**
3
  * Name : MW WP Form Field Checkbox
4
  * Description: チェックボックスを出力
5
+ * Version : 1.5.3
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : December 14, 2012
9
+ * Modified : January 22, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
54
  * @return string HTML
55
  */
56
  protected function input_page() {
57
+ $children = $this->get_children( $this->atts['children'] );
58
+ $value = $this->get_children( $this->atts['value'] );
59
  $separator = ( $this->atts['separator'] ) ? $this->atts['separator'] : $this->defaults['separator'];
60
  $_ret = $this->Form->checkbox( $this->atts['name'], $children, array(
61
  'id' => $this->atts['id'],
62
  'value' => $value,
63
  'vertically' => $this->atts['vertically'],
64
  ), $separator );
65
+ $_ret .= $this->Form->children( $this->atts['name'], $children );
66
  if ( $this->atts['show_error'] !== 'false' ) {
67
  $_ret .= $this->get_error( $this->atts['name'] );
68
  }
80
  $posted_value = $this->Form->get_separated_raw_value( $this->atts['name'], $children );
81
  $_ret = esc_html( $value );
82
  $_ret .= $this->Form->hidden( $this->atts['name'] . '[data]', $posted_value );
83
+ $_ret .= $this->Form->children( $this->atts['name'], $children );
84
  $_ret .= $this->Form->separator( $this->atts['name'] );
85
  return $_ret;
86
  }
classes/form-fields/class.radio.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MW WP Form Field Radio
4
  * Description: ラジオボタンを出力
5
- * Version : 1.5.1
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : December 14, 2012
9
- * Modified : January 20, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -59,6 +59,7 @@ class MW_WP_Form_Field_Radio extends MW_WP_Form_Abstract_Form_Field {
59
  'value' => $this->atts['value'],
60
  'vertically' => $this->atts['vertically'],
61
  ) );
 
62
  if ( $this->atts['show_error'] !== 'false' ) {
63
  $_ret .= $this->get_error( $this->atts['name'] );
64
  }
@@ -76,6 +77,7 @@ class MW_WP_Form_Field_Radio extends MW_WP_Form_Abstract_Form_Field {
76
  $posted_value = $this->Form->get_raw( $this->atts['name'] );
77
  $_ret = esc_html( $value );
78
  $_ret .= $this->Form->hidden( $this->atts['name'], $posted_value );
 
79
  return $_ret;
80
  }
81
 
2
  /**
3
  * Name : MW WP Form Field Radio
4
  * Description: ラジオボタンを出力
5
+ * Version : 1.5.2
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : December 14, 2012
9
+ * Modified : January 22, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
59
  'value' => $this->atts['value'],
60
  'vertically' => $this->atts['vertically'],
61
  ) );
62
+ $_ret .= $this->Form->children( $this->atts['name'], $children );
63
  if ( $this->atts['show_error'] !== 'false' ) {
64
  $_ret .= $this->get_error( $this->atts['name'] );
65
  }
77
  $posted_value = $this->Form->get_raw( $this->atts['name'] );
78
  $_ret = esc_html( $value );
79
  $_ret .= $this->Form->hidden( $this->atts['name'], $posted_value );
80
+ $_ret .= $this->Form->children( $this->atts['name'], $children );
81
  return $_ret;
82
  }
83
 
classes/form-fields/class.select.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MW WP Form Field Select
4
  * Description: セレクトボックスを出力
5
- * Version : 1.5.1
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : December 14, 2012
9
- * Modified : January 20, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -57,6 +57,7 @@ class MW_WP_Form_Field_Select extends MW_WP_Form_Abstract_Form_Field {
57
  'id' => $this->atts['id'],
58
  'value' => $this->atts['value'],
59
  ) );
 
60
  if ( $this->atts['show_error'] !== 'false' ) {
61
  $_ret .= $this->get_error( $this->atts['name'] );
62
  }
@@ -74,6 +75,7 @@ class MW_WP_Form_Field_Select extends MW_WP_Form_Abstract_Form_Field {
74
  $posted_value = $this->Form->get_raw( $this->atts['name'] );
75
  $_ret = esc_html( $value );
76
  $_ret .= $this->Form->hidden( $this->atts['name'], $posted_value );
 
77
  return $_ret;
78
  }
79
 
2
  /**
3
  * Name : MW WP Form Field Select
4
  * Description: セレクトボックスを出力
5
+ * Version : 1.5.2
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : December 14, 2012
9
+ * Modified : January 22, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
57
  'id' => $this->atts['id'],
58
  'value' => $this->atts['value'],
59
  ) );
60
+ $_ret .= $this->Form->children( $this->atts['name'], $children );
61
  if ( $this->atts['show_error'] !== 'false' ) {
62
  $_ret .= $this->get_error( $this->atts['name'] );
63
  }
75
  $posted_value = $this->Form->get_raw( $this->atts['name'] );
76
  $_ret = esc_html( $value );
77
  $_ret .= $this->Form->hidden( $this->atts['name'], $posted_value );
78
+ $_ret .= $this->Form->children( $this->atts['name'], $children );
79
  return $_ret;
80
  }
81
 
classes/models/class.data.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MW WP Form Data
4
  * Description: MW WP Form のデータ操作用
5
- * Version : 1.3.3
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : October 10, 2013
9
- * Modified : January 21, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -292,12 +292,46 @@ class MW_WP_Form_Data {
292
  return;
293
  }
294
  if ( is_array( $this->data[$key]['data'] ) ) {
 
 
 
 
295
  return $this->get_separated_value( $key );
296
  } else {
297
- return $this->data[$key]['data'];
 
 
 
 
 
 
 
298
  }
299
  } else {
300
- return $this->data[$key];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  }
302
  }
303
  }
2
  /**
3
  * Name : MW WP Form Data
4
  * Description: MW WP Form のデータ操作用
5
+ * Version : 1.3.4
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : October 10, 2013
9
+ * Modified : January 22, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
292
  return;
293
  }
294
  if ( is_array( $this->data[$key]['data'] ) ) {
295
+ if ( isset( $this->data['__children'][$key] ) ) {
296
+ $children = json_decode( $this->data['__children'][$key], true );
297
+ return $this->get_separated_value( $key, $children );
298
+ }
299
  return $this->get_separated_value( $key );
300
  } else {
301
+ $value = $this->data[$key]['data'];
302
+ if ( isset( $this->data['__children'][$key] ) ) {
303
+ $children = json_decode( $this->data['__children'][$key], true );
304
+ if ( isset( $children[$value] ) ) {
305
+ return $children[$value];
306
+ }
307
+ }
308
+ return $value;
309
  }
310
  } else {
311
+ $value = $this->get_raw( $key );
312
+ if ( isset( $this->data['__children'][$key] ) ) {
313
+ $children = json_decode( $this->data['__children'][$key], true );
314
+ if ( isset( $children[$value] ) ) {
315
+ return $children[$value];
316
+ }
317
+ }
318
+ return $value;
319
+ }
320
+ }
321
+ }
322
+
323
+ /**
324
+ * get_in_children
325
+ * $children の中に値が含まれているときだけ返す
326
+ * @param string $key name属性
327
+ * @param array $children
328
+ * @return string
329
+ */
330
+ public function get_in_children( $key, array $children ) {
331
+ $value = $this->get_raw( $key );
332
+ if ( !is_null( $value ) && !is_array( $value ) ) {
333
+ if ( isset( $children[$value] ) ) {
334
+ return $children[$value];
335
  }
336
  }
337
  }
classes/models/class.form.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MW WP Form Form
4
  * Description: フォームヘルパー
5
- * Version : 1.5.1
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : September 25, 2012
9
- * Modified : January 21, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -97,12 +97,7 @@ class MW_WP_Form_Form {
97
  * @return string
98
  */
99
  public function get_radio_value( $key, array $data ) {
100
- $value = $this->get_raw( $key );
101
- if ( !is_null( $value ) && !is_array( $value ) ) {
102
- if ( isset( $data[$value] ) ) {
103
- return $data[$value];
104
- }
105
- }
106
  }
107
  public function getRadioValue( $key, array $data ) {
108
  MWF_Functions::deprecated_message(
@@ -175,6 +170,18 @@ class MW_WP_Form_Form {
175
  return $this->get_separator_value( $key );
176
  }
177
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  /**
179
  * start
180
  * フォームタグ生成
2
  /**
3
  * Name : MW WP Form Form
4
  * Description: フォームヘルパー
5
+ * Version : 1.5.2
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : September 25, 2012
9
+ * Modified : January 22, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
97
  * @return string
98
  */
99
  public function get_radio_value( $key, array $data ) {
100
+ return $this->Data->get_in_children( $key, $data );
 
 
 
 
 
101
  }
102
  public function getRadioValue( $key, array $data ) {
103
  MWF_Functions::deprecated_message(
170
  return $this->get_separator_value( $key );
171
  }
172
 
173
+ /**
174
+ * children
175
+ * childrenを設定するためのhiddenを返す
176
+ * @param string $key name属性
177
+ * @param array $children 選択肢の配列(必ず MW_WP_Form_Abstract_Form_Field::get_children の値 )
178
+ * @return string HTML
179
+ */
180
+ public function children( $key, array $children ) {
181
+ $name = sprintf( '__children[%s]', $key );
182
+ return $this->hidden( $name, json_encode( $children ) );
183
+ }
184
+
185
  /**
186
  * start
187
  * フォームタグ生成
classes/services/class.mail.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
  * Name : MW WP Form Mail Service
4
- * Version : 1.0.0
5
  * Author : Takashi Kitajima
6
  * Author URI : http://2inc.org
7
  * Created : January 1, 2015
8
- * Modified :
9
  * License : GPLv2
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
@@ -316,7 +316,8 @@ class MW_WP_Form_Mail_Service {
316
  return apply_filters(
317
  'mwform_admin_mail_raw_' . $this->form_key,
318
  $Mail,
319
- $this->Data->gets()
 
320
  );
321
  }
322
 
@@ -329,7 +330,8 @@ class MW_WP_Form_Mail_Service {
329
  return apply_filters(
330
  'mwform_mail_' . $this->form_key,
331
  $Mail,
332
- $this->Data->gets()
 
333
  );
334
  }
335
 
@@ -342,7 +344,8 @@ class MW_WP_Form_Mail_Service {
342
  return apply_filters(
343
  'mwform_admin_mail_' . $this->form_key,
344
  $Mail,
345
- $this->Data->gets()
 
346
  );
347
  }
348
 
@@ -355,7 +358,8 @@ class MW_WP_Form_Mail_Service {
355
  return apply_filters(
356
  'mwform_auto_mail_raw_' . $this->form_key,
357
  $Mail,
358
- $this->Data->gets()
 
359
  );
360
  }
361
 
@@ -368,7 +372,8 @@ class MW_WP_Form_Mail_Service {
368
  return apply_filters(
369
  'mwform_auto_mail_' . $this->form_key,
370
  $Mail,
371
- $this->Data->gets()
 
372
  );
373
  }
374
 
@@ -431,7 +436,7 @@ class MW_WP_Form_Mail_Service {
431
  public function save_contact_data( MW_WP_Form_Mail $Mail, array $files = array() ) {
432
  $form_id = $this->Setting->get( 'post_id' );
433
  $insert_contact_data_id = wp_insert_post( array(
434
- 'post_title' => $Mail->subject,
435
  'post_status' => 'publish',
436
  'post_type' => MWF_Config::DBDATA . $form_id,
437
  ) );
1
  <?php
2
  /**
3
  * Name : MW WP Form Mail Service
4
+ * Version : 1.0.2
5
  * Author : Takashi Kitajima
6
  * Author URI : http://2inc.org
7
  * Created : January 1, 2015
8
+ * Modified : January 22, 2015
9
  * License : GPLv2
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
316
  return apply_filters(
317
  'mwform_admin_mail_raw_' . $this->form_key,
318
  $Mail,
319
+ $this->Data->gets(),
320
+ clone $this->Data
321
  );
322
  }
323
 
330
  return apply_filters(
331
  'mwform_mail_' . $this->form_key,
332
  $Mail,
333
+ $this->Data->gets(),
334
+ clone $this->Data
335
  );
336
  }
337
 
344
  return apply_filters(
345
  'mwform_admin_mail_' . $this->form_key,
346
  $Mail,
347
+ $this->Data->gets(),
348
+ clone $this->Data
349
  );
350
  }
351
 
358
  return apply_filters(
359
  'mwform_auto_mail_raw_' . $this->form_key,
360
  $Mail,
361
+ $this->Data->gets(),
362
+ clone $this->Data
363
  );
364
  }
365
 
372
  return apply_filters(
373
  'mwform_auto_mail_' . $this->form_key,
374
  $Mail,
375
+ $this->Data->gets(),
376
+ clone $this->Data
377
  );
378
  }
379
 
436
  public function save_contact_data( MW_WP_Form_Mail $Mail, array $files = array() ) {
437
  $form_id = $this->Setting->get( 'post_id' );
438
  $insert_contact_data_id = wp_insert_post( array(
439
+ 'post_title' => $this->parse_mail_content( $Mail->subject ),
440
  'post_status' => 'publish',
441
  'post_type' => MWF_Config::DBDATA . $form_id,
442
  ) );
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.2.5
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : September 25, 2012
10
- * Modified: January 21, 2015
11
  * Text Domain: mw-wp-form
12
  * Domain Path: /languages/
13
  * License: GPLv2
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.2.6
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : September 25, 2012
10
+ * Modified: January 22, 2015
11
  * Text Domain: mw-wp-form
12
  * Domain Path: /languages/
13
  * License: GPLv2
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.1
7
- Stable tag: 2.2.5
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -71,6 +71,12 @@ Do you have questions or issues with MW WP Form? Use these support channels appr
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
 
74
  = 2.2.5 =
75
  * Bug fix : Fixed a checkbox bug.
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: 3.7
6
  Tested up to: 4.1
7
+ Stable tag: 2.2.6
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
71
 
72
  == Changelog ==
73
 
74
+ = 2.2.6 =
75
+ * Added : Adding MW_WP_Form_Data object to augment of mail related hooks.
76
+ * Added : Adding MW_WP_Form_Data object to augment of mwform_validation hook.
77
+ * Bug fix : Fixed a bug that post_title is not parsed when contact data saving in database.
78
+ * Bug fix : Fixed a bug that post value is sent and saved when children attribute separate at post value and display value.
79
+
80
  = 2.2.5 =
81
  * Bug fix : Fixed a checkbox bug.
82