MW WP Form - Version 1.2.7

Version Description

  • Added : Support docx, xlsx, pptx upload.
  • Change : Change main process hook from get_header to template_include.
Download this release

Release Info

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

Code changes from version 1.2.6 to 1.2.7

Files changed (3) hide show
  1. mw-wp-form.php +10 -7
  2. readme.txt +5 -1
  3. system/mw_wp_form_file.php +14 -6
mw-wp-form.php CHANGED
@@ -3,16 +3,16 @@
3
  * Plugin Name: MW WP Form
4
  * Plugin URI: http://2inc.org/manual-mw-wp-form/
5
  * Description: MW WP Form can create mail form with a confirmation screen.
6
- * Version: 1.2.6
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : September 25, 2012
10
- * Modified: December 29, 2013
11
  * Text Domain: mw-wp-form
12
  * Domain Path: /languages/
13
  * License: GPL2
14
  *
15
- * Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
16
  *
17
  * This program is free software; you can redistribute it and/or modify
18
  * it under the terms of the GNU General Public License, version 2, as
@@ -116,7 +116,7 @@ class mw_wp_form {
116
  include_once( plugin_dir_path( __FILE__ ) . 'system/mw_validation.php' );
117
  include_once( plugin_dir_path( __FILE__ ) . 'system/mw_wp_form_data.php' );
118
  include_once( plugin_dir_path( __FILE__ ) . 'system/mw_wp_form_file.php' );
119
- add_action( 'get_header', array( $this, 'main' ) );
120
  add_action( 'parse_request', array( $this, 'remove_query_vars_from_post' ) );
121
  }
122
 
@@ -215,9 +215,11 @@ class mw_wp_form {
215
  /**
216
  * main
217
  * 表示画面でのプラグインの処理等。
 
 
218
  */
219
- public function main() {
220
- global $post, $template;
221
 
222
  // URL設定を取得
223
  add_shortcode( 'mwform', array( $this, '_meta_mwform' ) );
@@ -248,7 +250,7 @@ class mw_wp_form {
248
  is_null( $this->confirm ) ||
249
  is_null( $this->complete ) ||
250
  is_null( $this->validation_error ) )
251
- return;
252
 
253
  // セッション初期化
254
  $this->Session = MW_Session::start( $this->key );
@@ -333,6 +335,7 @@ class mw_wp_form {
333
  add_action( 'wp_footer', array( $this->Data, 'clearValues' ) );
334
  add_action( 'wp_print_styles', array( $this, 'original_style' ) );
335
  add_action( 'wp_print_scripts', array( $this, 'original_script' ) );
 
336
  }
337
 
338
  /**
3
  * Plugin Name: MW WP Form
4
  * Plugin URI: http://2inc.org/manual-mw-wp-form/
5
  * Description: MW WP Form can create mail form with a confirmation screen.
6
+ * Version: 1.2.7
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : September 25, 2012
10
+ * Modified: January 7, 2014
11
  * Text Domain: mw-wp-form
12
  * Domain Path: /languages/
13
  * License: GPL2
14
  *
15
+ * Copyright 2014 Takashi Kitajima (email : inc@2inc.org)
16
  *
17
  * This program is free software; you can redistribute it and/or modify
18
  * it under the terms of the GNU General Public License, version 2, as
116
  include_once( plugin_dir_path( __FILE__ ) . 'system/mw_validation.php' );
117
  include_once( plugin_dir_path( __FILE__ ) . 'system/mw_wp_form_data.php' );
118
  include_once( plugin_dir_path( __FILE__ ) . 'system/mw_wp_form_file.php' );
119
+ add_filter( 'template_include', array( $this, 'main' ), 10000 );
120
  add_action( 'parse_request', array( $this, 'remove_query_vars_from_post' ) );
121
  }
122
 
215
  /**
216
  * main
217
  * 表示画面でのプラグインの処理等。
218
+ * @param string $template
219
+ * @return string $template
220
  */
221
+ public function main( $template ) {
222
+ global $post;
223
 
224
  // URL設定を取得
225
  add_shortcode( 'mwform', array( $this, '_meta_mwform' ) );
250
  is_null( $this->confirm ) ||
251
  is_null( $this->complete ) ||
252
  is_null( $this->validation_error ) )
253
+ return $template;
254
 
255
  // セッション初期化
256
  $this->Session = MW_Session::start( $this->key );
335
  add_action( 'wp_footer', array( $this->Data, 'clearValues' ) );
336
  add_action( 'wp_print_styles', array( $this, 'original_style' ) );
337
  add_action( 'wp_print_scripts', array( $this, 'original_script' ) );
338
+ return $template;
339
  }
340
 
341
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.amazon.co.jp/registry/wishlist/39ANKRNSTNW40
4
  Tags: plugin, form, confirm, preview, shortcode
5
  Requires at least: 3.4
6
  Tested up to: 3.8.0
7
- Stable tag: 1.2.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -47,6 +47,10 @@ Do you have questions or issues with MW WP Form? Use these support channels appr
47
 
48
  == Changelog ==
49
 
 
 
 
 
50
  = 1.2.6 =
51
  * Added : mwform_styles フィルターフック
52
 
4
  Tags: plugin, form, confirm, preview, shortcode
5
  Requires at least: 3.4
6
  Tested up to: 3.8.0
7
+ Stable tag: 1.2.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
47
 
48
  == Changelog ==
49
 
50
+ = 1.2.7 =
51
+ * Added : Support docx, xlsx, pptx upload.
52
+ * Change : Change main process hook from get_header to template_include.
53
+
54
  = 1.2.6 =
55
  * Added : mwform_styles フィルターフック
56
 
system/mw_wp_form_file.php CHANGED
@@ -3,14 +3,14 @@
3
  * Name: MW WP Form File
4
  * URI: http://2inc.org
5
  * Description: Tempディレクトリ、ファイルアップロードの処理を行うクラス
6
- * Version: 1.0.3
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : October 10, 2013
10
- * Modified: December 11, 2013
11
  * License: GPL2
12
  *
13
- * Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
14
  *
15
  * This program is free software; you can redistribute it and/or modify
16
  * it under the terms of the GNU General Public License, version 2, as
@@ -35,9 +35,9 @@ class MW_WP_Form_File {
35
 
36
  /**
37
  * checkFileType
38
- * @param String アップロードされたファイルのパス
39
- * String ファイル名(未アップロード時の$_FILEの検査の場合、temp_nameは乱数になっているため)
40
- * @return Boolean
41
  */
42
  protected function checkFileType( $filepath, $filename = '' ) {
43
  // WordPress( get_allowed_mime_types ) で許可されたファイルタイプ限定
@@ -74,6 +74,14 @@ class MW_WP_Form_File {
74
  'video/mpeg',
75
  );
76
  break;
 
 
 
 
 
 
 
 
77
  }
78
 
79
  if ( version_compare( phpversion(), '5.3.0' ) >= 0 ) {
3
  * Name: MW WP Form File
4
  * URI: http://2inc.org
5
  * Description: Tempディレクトリ、ファイルアップロードの処理を行うクラス
6
+ * Version: 1.0.4
7
  * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created : October 10, 2013
10
+ * Modified: January 7, 2014
11
  * License: GPL2
12
  *
13
+ * Copyright 2014 Takashi Kitajima (email : inc@2inc.org)
14
  *
15
  * This program is free software; you can redistribute it and/or modify
16
  * it under the terms of the GNU General Public License, version 2, as
35
 
36
  /**
37
  * checkFileType
38
+ * @param string $filepath アップロードされたファイルのパス
39
+ * @param string $filename ファイル名(未アップロード時の$_FILEの検査の場合、temp_nameは乱数になっているため)
40
+ * @return boolean
41
  */
42
  protected function checkFileType( $filepath, $filename = '' ) {
43
  // WordPress( get_allowed_mime_types ) で許可されたファイルタイプ限定
74
  'video/mpeg',
75
  );
76
  break;
77
+ case 'docx' :
78
+ case 'xlsx' :
79
+ case 'pptx' :
80
+ $wp_check_filetype['type'] = array(
81
+ $wp_check_filetype['type'],
82
+ 'application/zip',
83
+ );
84
+ break;
85
  }
86
 
87
  if ( version_compare( phpversion(), '5.3.0' ) >= 0 ) {