MW WP Form - Version 2.4.11

Version Description

Download this release

Release Info

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

Code changes from version 2.4.10 to 2.4.11

classes/controllers/class.contact-data-list.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
  * Name : MW WP Form Contact Data List Controller
4
- * Version : 1.1.0
5
  * Author : Takashi Kitajima
6
  * Author URI : http://2inc.org
7
  * Created : January 1, 2015
8
- * Modified : March 27, 2015
9
  * License : GPLv2
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
@@ -157,6 +157,10 @@ class MW_WP_Form_Contact_Data_List_Controller extends MW_WP_Form_Controller {
157
  } elseif ( is_array( $post_custom_keys ) && in_array( $column, $post_custom_keys ) ) {
158
  $post_meta = get_post_meta( $post_id, $column, true );
159
  if ( $Contact_Data_Setting->is_upload_file_key( $post, $column ) ) {
 
 
 
 
160
  $value = MWF_Functions::get_multimedia_data( $post_meta );
161
  } elseif ( $post_meta ) {
162
  $value = esc_html( $post_meta );
1
  <?php
2
  /**
3
  * Name : MW WP Form Contact Data List Controller
4
+ * Version : 1.1.1
5
  * Author : Takashi Kitajima
6
  * Author URI : http://2inc.org
7
  * Created : January 1, 2015
8
+ * Modified : May 26, 2015
9
  * License : GPLv2
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
157
  } elseif ( is_array( $post_custom_keys ) && in_array( $column, $post_custom_keys ) ) {
158
  $post_meta = get_post_meta( $post_id, $column, true );
159
  if ( $Contact_Data_Setting->is_upload_file_key( $post, $column ) ) {
160
+ // 過去バージョンでの不具合でメタデータが空になっていることがあるのでその場合は代替処理
161
+ if ( $post_meta === '' ) {
162
+ $post_meta = MWF_Functions::get_multimedia_id__fallback( $post, $column );
163
+ }
164
  $value = MWF_Functions::get_multimedia_data( $post_meta );
165
  } elseif ( $post_meta ) {
166
  $value = esc_html( $post_meta );
classes/functions.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MWF Functions
4
  * Description: 関数
5
- * Version : 1.4.3
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : May 29, 2013
9
- * Modified : April 23, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -191,6 +191,9 @@ class MWF_Functions {
191
 
192
  $wp_check_filetype = wp_check_filetype( $filepath );
193
  $post_type = get_post_type_object( self::get_contact_data_post_type_from_form_id( $form_id ) );
 
 
 
194
  $attachment = array(
195
  'post_mime_type' => $wp_check_filetype['type'],
196
  'post_title' => $key,
@@ -266,14 +269,20 @@ class MWF_Functions {
266
  }
267
 
268
  if ( version_compare( phpversion(), '5.3.0' ) >= 0 ) {
 
 
 
269
  $finfo = new finfo( FILEINFO_MIME_TYPE );
270
  $type = $finfo->file( $filepath );
 
 
 
271
  if ( is_array( $wp_check_filetype['type'] ) ) {
272
- if ( !( $finfo !== false && in_array( $type, $wp_check_filetype['type'] ) ) ) {
273
  return false;
274
  }
275
  } else {
276
- if ( !( $finfo !== false && $type === $wp_check_filetype['type'] ) ) {
277
  return false;
278
  }
279
  }
@@ -383,4 +392,26 @@ class MWF_Functions {
383
  return esc_html( $value );
384
  }
385
  }
386
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
  * Name : MWF Functions
4
  * Description: 関数
5
+ * Version : 1.4.4
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : May 29, 2013
9
+ * Modified : May 26, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
191
 
192
  $wp_check_filetype = wp_check_filetype( $filepath );
193
  $post_type = get_post_type_object( self::get_contact_data_post_type_from_form_id( $form_id ) );
194
+ if ( empty( $post_type->label ) ) {
195
+ continue;
196
+ }
197
  $attachment = array(
198
  'post_mime_type' => $wp_check_filetype['type'],
199
  'post_title' => $key,
269
  }
270
 
271
  if ( version_compare( phpversion(), '5.3.0' ) >= 0 ) {
272
+ if ( !file_exists( $filepath ) ) {
273
+ return false;
274
+ }
275
  $finfo = new finfo( FILEINFO_MIME_TYPE );
276
  $type = $finfo->file( $filepath );
277
+ if ( $finfo === false ) {
278
+ return false;
279
+ }
280
  if ( is_array( $wp_check_filetype['type'] ) ) {
281
+ if ( !in_array( $type, $wp_check_filetype['type'] ) ) {
282
  return false;
283
  }
284
  } else {
285
+ if ( $type !== $wp_check_filetype['type'] ) {
286
  return false;
287
  }
288
  }
392
  return esc_html( $value );
393
  }
394
  }
395
+
396
+ /**
397
+ * 添付データのIDを返す
398
+ * 過去バージョンでの不具合でアップロードファイルを示すメタデータが空になっていることがあるのでその場合の代替処理
399
+ *
400
+ * @param WP_Post $post
401
+ * @param int $meta_key
402
+ * @return int
403
+ */
404
+ public static function get_multimedia_id__fallback( $post, $meta_key ) {
405
+ $Contact_Data_Setting = new MW_WP_Form_Contact_Data_Setting( $post->ID );
406
+ $key = $Contact_Data_Setting->get_key_in_upload_file_keys( $post, $meta_key );
407
+ $attachments = get_posts( array(
408
+ 'post_type' => 'attachment',
409
+ 'post_parent' => $post->ID,
410
+ 'posts_per_page' => 1,
411
+ 'offset' => $key,
412
+ ) );
413
+ if ( isset( $attachments[0] ) ) {
414
+ return $attachments[0]->ID;
415
+ }
416
+ }
417
+ }
classes/models/class.admin.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MW WP Form Admin
4
  * Description: 管理画面クラス
5
- * Version : 2.0.2
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : February 21, 2013
9
- * Modified : April 15, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -29,6 +29,12 @@ class MW_WP_Form_Admin {
29
  return $post_id;
30
 
31
  $data = $_POST[MWF_Config::NAME];
 
 
 
 
 
 
32
  if ( !empty( $data['validation'] ) && is_array( $data['validation'] ) ) {
33
  $validation = array();
34
  foreach ( $data['validation'] as $_validation ) {
2
  /**
3
  * Name : MW WP Form Admin
4
  * Description: 管理画面クラス
5
+ * Version : 2.0.3
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : February 21, 2013
9
+ * Modified : May 25, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
29
  return $post_id;
30
 
31
  $data = $_POST[MWF_Config::NAME];
32
+
33
+ $triminglists = array( 'mail_from', 'mail_to', 'mail_cc', 'mail_bcc', 'admin_mail_from' );
34
+ foreach ( $triminglists as $name ) {
35
+ $data[$name] = trim( mb_convert_kana( $data[$name], 's', get_option( 'blog_charset' ) ) );
36
+ }
37
+
38
  if ( !empty( $data['validation'] ) && is_array( $data['validation'] ) ) {
39
  $validation = array();
40
  foreach ( $data['validation'] as $_validation ) {
classes/models/class.contact-data-setting.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MW WP Form Contact Data Setting
4
  * Description: 管理画面クラス
5
- * Version : 1.0.2
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : January 1, 2015
9
- * Modified : April 15, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -230,6 +230,21 @@ class MW_WP_Form_Contact_Data_Setting {
230
  return false;
231
  }
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  /**
234
  * その投稿がもつ upload_file_key を取得
235
  *
2
  /**
3
  * Name : MW WP Form Contact Data Setting
4
  * Description: 管理画面クラス
5
+ * Version : 1.0.3
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : January 1, 2015
9
+ * Modified : May 26, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
230
  return false;
231
  }
232
 
233
+ /**
234
+ * $meta_key が upload_file_key に含まれている場合にキーを返す
235
+ *
236
+ * @param WP_Post $post
237
+ * @param string $meta_key
238
+ * @return int|false
239
+ */
240
+ public function get_key_in_upload_file_keys( $post, $meta_key ) {
241
+ $upload_file_keys = $this->get_upload_file_keys( $post );
242
+ if ( is_array( $upload_file_keys ) ) {
243
+ return array_search( $meta_key, $upload_file_keys );
244
+ }
245
+ return false;
246
+ }
247
+
248
  /**
249
  * その投稿がもつ upload_file_key を取得
250
  *
classes/models/class.csv.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
  * Name : MW WP Form CSV
4
- * Version : 1.0.1
5
  * Author : Takashi Kitajima
6
  * Author URI : http://2inc.org
7
  * Created : April 3, 2015
8
- * Modified : April 5, 2015
9
  * License : GPLv2
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
@@ -176,6 +176,10 @@ class MW_WP_Form_CSV {
176
  } elseif ( isset( $post->$value ) ) {
177
  $post_meta = $post->$value;
178
  if ( $Contact_Data_Setting->is_upload_file_key( $post, $value ) ) {
 
 
 
 
179
  $column = wp_get_attachment_url( $post_meta );
180
  } else {
181
  $column = ( $post_meta ) ? $post_meta : '';
1
  <?php
2
  /**
3
  * Name : MW WP Form CSV
4
+ * Version : 1.0.2
5
  * Author : Takashi Kitajima
6
  * Author URI : http://2inc.org
7
  * Created : April 3, 2015
8
+ * Modified : May 26, 2015
9
  * License : GPLv2
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
176
  } elseif ( isset( $post->$value ) ) {
177
  $post_meta = $post->$value;
178
  if ( $Contact_Data_Setting->is_upload_file_key( $post, $value ) ) {
179
+ // 過去バージョンでの不具合でメタデータが空になっていることがあるのでその場合は代替処理
180
+ if ( $post_meta === '' ) {
181
+ $post_meta = MWF_Functions::get_multimedia_id__fallback( $post, $value );
182
+ }
183
  $column = wp_get_attachment_url( $post_meta );
184
  } else {
185
  $column = ( $post_meta ) ? $post_meta : '';
classes/services/class.mail-parser.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Name : MW WP Form Mail Parser
4
  * Description: メールパーサー
5
- * Version : 1.0.3
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : April 14, 2015
9
- * Modified : April 24, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
@@ -176,8 +176,11 @@ class MW_WP_Form_Mail_Parser {
176
  }
177
 
178
  // 値が null でも保存(チェッボックス未チェックで直送信でも保存させるため)
 
179
  if ( $do_update ) {
180
- update_post_meta( $this->insert_contact_data_id, $match, $value );
 
 
181
  }
182
  return $value;
183
  }
2
  /**
3
  * Name : MW WP Form Mail Parser
4
  * Description: メールパーサー
5
+ * Version : 1.0.4
6
  * Author : Takashi Kitajima
7
  * Author URI : http://2inc.org
8
  * Created : April 14, 2015
9
+ * Modified : May 25, 2015
10
  * License : GPLv2
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
176
  }
177
 
178
  // 値が null でも保存(チェッボックス未チェックで直送信でも保存させるため)
179
+ // ただし、画像の場合はURLが保存されないように調整がはいるため除外が必要
180
  if ( $do_update ) {
181
+ if ( !array_key_exists( $match, $this->Mail->attachments ) ) {
182
+ update_post_meta( $this->insert_contact_data_id, $match, $value );
183
+ }
184
  }
185
  return $value;
186
  }
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.4.10
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : September 25, 2012
10
- * Modified: May 11, 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.4.11
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : September 25, 2012
10
+ * Modified: May 25, 2015
11
  * Text Domain: mw-wp-form
12
  * Domain Path: /languages/
13
  * License: GPLv2
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === MW WP Form ===
2
- Contributors: inc2734, ryu263
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.2.2
7
- Stable tag: 2.4.10
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -47,6 +47,7 @@ Source: https://developers.google.com/chart/
47
 
48
  * [Takashi Kitajima](http://2inc.org) ( [inc2734](http://profiles.wordpress.org/inc2734) )
49
  * [Ryujiro Yamamoto](http://webcre-archive.com) ( [ryu263](http://profiles.wordpress.org/ryu263) )
 
50
 
51
  == Installation ==
52
 
@@ -71,6 +72,10 @@ Do you have questions or issues with MW WP Form? Use these support channels appr
71
 
72
  == Changelog ==
73
 
 
 
 
 
74
  = 2.4.10
75
  = Bugfix : Fixed a bug that does not scroll when you return to the input screen.
76
 
1
  === MW WP Form ===
2
+ Contributors: inc2734, ryu263, tomothumb
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.2.2
7
+ Stable tag: 2.4.11
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
47
 
48
  * [Takashi Kitajima](http://2inc.org) ( [inc2734](http://profiles.wordpress.org/inc2734) )
49
  * [Ryujiro Yamamoto](http://webcre-archive.com) ( [ryu263](http://profiles.wordpress.org/ryu263) )
50
+ * [Tsujimoto Tomoyuki](http://kee-non.com) ( [tomothumb](http://profiles.wordpress.org/tomothumb) )
51
 
52
  == Installation ==
53
 
72
 
73
  == Changelog ==
74
 
75
+ = 2.4.11
76
+ = Bugfix : Fixed a bug that attachment file does not displayed in contact data list page.
77
+ = Changed : Trim email address on inputs.
78
+
79
  = 2.4.10
80
  = Bugfix : Fixed a bug that does not scroll when you return to the input screen.
81
 
templates/contact-data/detail.php CHANGED
@@ -20,6 +20,10 @@
20
  <td>
21
  <?php
22
  if ( $Contact_Data_Setting->is_upload_file_key( $post, $key ) ) {
 
 
 
 
23
  echo MWF_Functions::get_multimedia_data( $value );
24
  } else {
25
  echo nl2br( esc_html( $value ) );
20
  <td>
21
  <?php
22
  if ( $Contact_Data_Setting->is_upload_file_key( $post, $key ) ) {
23
+ // 過去バージョンでの不具合でメタデータが空になっていることがあるのでその場合は代替処理
24
+ if ( $value === '' ) {
25
+ $value = MWF_Functions::get_multimedia_id__fallback( $post, $key );
26
+ }
27
  echo MWF_Functions::get_multimedia_data( $value );
28
  } else {
29
  echo nl2br( esc_html( $value ) );