Version Description
- Bug fix : Fixed a bug that remove_query_vars_from_post() is not executed.
- Bug fix : Fixed a akismet feature bug.
- Bug fix : Fixed a uninstall bug.
Download this release
Release Info
Developer | inc2734 |
Plugin | MW WP Form |
Version | 2.2.1 |
Comparing to | |
See all releases |
Code changes from version 2.2.0 to 2.2.1
- classes/controllers/class.main.php +27 -7
- classes/models/class.data.php +3 -24
- classes/models/class.validation.php +3 -3
- classes/services/class.exec-shortcode.php +5 -6
- mw-wp-form.php +4 -2
- readme.txt +6 -1
classes/controllers/class.main.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Main Controller
|
4 |
* Description: フロントエンドにおいて、適切な画面にリダイレクトさせる
|
5 |
-
* Version : 1.0.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 23, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -55,9 +55,30 @@ class MW_WP_Form_Main_Controller {
|
|
55 |
*/
|
56 |
public function initialize() {
|
57 |
add_filter( 'nocache_headers' , array( $this, 'nocache_headers' ) , 1 );
|
|
|
58 |
add_filter( 'template_include', array( $this, 'template_include' ), 10000 );
|
59 |
}
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
/**
|
62 |
* template_include
|
63 |
* 表示画面でのプラグインの処理等
|
@@ -68,16 +89,15 @@ class MW_WP_Form_Main_Controller {
|
|
68 |
global $post;
|
69 |
|
70 |
$this->ExecShortcode = new MW_WP_Form_Exec_Shortcode( $post, $template );
|
71 |
-
$form_id = $this->ExecShortcode->get_form_id();
|
72 |
-
$form_key = $this->ExecShortcode->get( 'key' );
|
73 |
-
$this->Setting = new MW_WP_Form_Setting( $form_id );
|
74 |
-
|
75 |
$has_shortcode = $this->ExecShortcode->has_shortcode();
|
76 |
if ( !$has_shortcode ) {
|
77 |
return $template;
|
78 |
}
|
79 |
|
80 |
-
$this->
|
|
|
|
|
|
|
81 |
|
82 |
foreach ( $this->validation_rules as $validation_name => $validation_rule ) {
|
83 |
if ( is_callable( array( $validation_rule, 'set_Data' ) ) ) {
|
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 |
*/
|
55 |
*/
|
56 |
public function initialize() {
|
57 |
add_filter( 'nocache_headers' , array( $this, 'nocache_headers' ) , 1 );
|
58 |
+
add_action( 'parse_request' , array( $this, 'remove_query_vars_from_post' ) );
|
59 |
add_filter( 'template_include', array( $this, 'template_include' ), 10000 );
|
60 |
}
|
61 |
|
62 |
+
/**
|
63 |
+
* remove_query_vars_from_post
|
64 |
+
* WordPressへのリクエストに含まれている、$_POSTの値を削除
|
65 |
+
*/
|
66 |
+
public function remove_query_vars_from_post( $wp_query ) {
|
67 |
+
if ( strtolower( $_SERVER['REQUEST_METHOD'] ) === 'post' && isset( $_POST['token'] ) ) {
|
68 |
+
foreach ( $_POST as $key => $value ) {
|
69 |
+
if ( $key == 'token' ) {
|
70 |
+
continue;
|
71 |
+
}
|
72 |
+
if ( isset( $wp_query->query_vars[$key] ) &&
|
73 |
+
$wp_query->query_vars[$key] === $value &&
|
74 |
+
!empty( $value ) ) {
|
75 |
+
|
76 |
+
$wp_query->query_vars[$key] = '';
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
/**
|
83 |
* template_include
|
84 |
* 表示画面でのプラグインの処理等
|
89 |
global $post;
|
90 |
|
91 |
$this->ExecShortcode = new MW_WP_Form_Exec_Shortcode( $post, $template );
|
|
|
|
|
|
|
|
|
92 |
$has_shortcode = $this->ExecShortcode->has_shortcode();
|
93 |
if ( !$has_shortcode ) {
|
94 |
return $template;
|
95 |
}
|
96 |
|
97 |
+
$form_key = $this->ExecShortcode->get( 'key' );
|
98 |
+
$form_id = $this->ExecShortcode->get_form_id();
|
99 |
+
$this->Setting = new MW_WP_Form_Setting( $form_id );
|
100 |
+
$this->Data = MW_WP_Form_Data::getInstance( $form_key, $_POST, $_FILES );
|
101 |
|
102 |
foreach ( $this->validation_rules as $validation_name => $validation_rule ) {
|
103 |
if ( is_callable( array( $validation_rule, 'set_Data' ) ) ) {
|
classes/models/class.data.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Data
|
4 |
-
* Description:
|
5 |
-
* Version : 1.3.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : October 10, 2013
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -78,7 +78,6 @@ class MW_WP_Form_Data {
|
|
78 |
$this->set_request_valiables( $this->POST );
|
79 |
$this->set_files_valiables( $this->POST, $this->FILES );
|
80 |
add_filter( 'mwform_form_end_html', array( $this, 'mwform_form_end_html' ) );
|
81 |
-
add_action( 'parse_request' , array( $this, 'remove_query_vars_from_post' ) );
|
82 |
}
|
83 |
|
84 |
/**
|
@@ -397,24 +396,4 @@ class MW_WP_Form_Data {
|
|
397 |
}
|
398 |
}
|
399 |
}
|
400 |
-
|
401 |
-
/**
|
402 |
-
* remove_query_vars_from_post
|
403 |
-
* WordPressへのリクエストに含まれている、$_POSTの値を削除
|
404 |
-
*/
|
405 |
-
public function remove_query_vars_from_post( $wp_query ) {
|
406 |
-
if ( strtolower( $_SERVER['REQUEST_METHOD'] ) === 'post' && isset( $this->POST['token'] ) ) {
|
407 |
-
foreach ( $this->POST as $key => $value ) {
|
408 |
-
if ( $key == 'token' ) {
|
409 |
-
continue;
|
410 |
-
}
|
411 |
-
if ( isset( $wp_query->query_vars[$key] ) &&
|
412 |
-
$wp_query->query_vars[$key] === $value &&
|
413 |
-
!empty( $value ) ) {
|
414 |
-
|
415 |
-
$wp_query->query_vars[$key] = '';
|
416 |
-
}
|
417 |
-
}
|
418 |
-
}
|
419 |
-
}
|
420 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Data
|
4 |
+
* Description: MW WP Form のデータ操作用
|
5 |
+
* Version : 1.3.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : October 10, 2013
|
9 |
+
* Modified : January 14, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
78 |
$this->set_request_valiables( $this->POST );
|
79 |
$this->set_files_valiables( $this->POST, $this->FILES );
|
80 |
add_filter( 'mwform_form_end_html', array( $this, 'mwform_form_end_html' ) );
|
|
|
81 |
}
|
82 |
|
83 |
/**
|
396 |
}
|
397 |
}
|
398 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
}
|
classes/models/class.validation.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation
|
4 |
* Description: 与えられたデータに対してバリデーションエラーがあるかチェックする
|
5 |
-
* Version : 1.8.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 20, 2012
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -94,7 +94,7 @@ class MW_WP_Form_Validation {
|
|
94 |
$Setting->get( 'akismet_author' ),
|
95 |
$Setting->get( 'akismet_author_email' ),
|
96 |
$Setting->get( 'akismet_author_url' ),
|
97 |
-
$Data
|
98 |
);
|
99 |
if ( $akismet_check ) {
|
100 |
$this->set_rule( MWF_Config::AKISMET, 'akismet_check' );
|
2 |
/**
|
3 |
* Name : MW WP Form Validation
|
4 |
* Description: 与えられたデータに対してバリデーションエラーがあるかチェックする
|
5 |
+
* Version : 1.8.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 20, 2012
|
9 |
+
* Modified : January 14, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
94 |
$Setting->get( 'akismet_author' ),
|
95 |
$Setting->get( 'akismet_author_email' ),
|
96 |
$Setting->get( 'akismet_author_url' ),
|
97 |
+
$Data
|
98 |
);
|
99 |
if ( $akismet_check ) {
|
100 |
$this->set_rule( MWF_Config::AKISMET, 'akismet_check' );
|
classes/services/class.exec-shortcode.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Exec Shortcode
|
4 |
-
* Version : 1.0.
|
5 |
* Description: ExecShortcode(mwform、mwform_formkey)の存在有無のチェックとそれらの抽象化レイヤー
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 31, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -22,7 +22,7 @@ class MW_WP_Form_Exec_Shortcode {
|
|
22 |
/**
|
23 |
* $post
|
24 |
* ショートコードが埋め込まれた投稿のオブジェクト
|
25 |
-
* @var WP_Post
|
26 |
*/
|
27 |
protected $post;
|
28 |
|
@@ -46,16 +46,15 @@ class MW_WP_Form_Exec_Shortcode {
|
|
46 |
|
47 |
/**
|
48 |
* __construct
|
49 |
-
* @param WP_Post $
|
50 |
* @param string $template 使用テンプレートのパス
|
51 |
*/
|
52 |
-
public function __construct(
|
53 |
$this->post = $post;
|
54 |
$this->template = $template;
|
55 |
|
56 |
add_shortcode( 'mwform' , array( $this, 'set_settings_by_mwform' ) );
|
57 |
add_shortcode( 'mwform_formkey', array( $this, 'set_settings_by_mwform_formkey' ) );
|
58 |
-
do_shortcode( $this->post->post_content );
|
59 |
|
60 |
$exec_shortcode = $this->get_exec_shortcode();
|
61 |
if ( $exec_shortcode ) {
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Exec Shortcode
|
4 |
+
* Version : 1.0.1
|
5 |
* Description: ExecShortcode(mwform、mwform_formkey)の存在有無のチェックとそれらの抽象化レイヤー
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 31, 2014
|
9 |
+
* Modified : January 14, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
22 |
/**
|
23 |
* $post
|
24 |
* ショートコードが埋め込まれた投稿のオブジェクト
|
25 |
+
* @var WP_Post|null
|
26 |
*/
|
27 |
protected $post;
|
28 |
|
46 |
|
47 |
/**
|
48 |
* __construct
|
49 |
+
* @param WP_Post|null $_post
|
50 |
* @param string $template 使用テンプレートのパス
|
51 |
*/
|
52 |
+
public function __construct( $post, $template ) {
|
53 |
$this->post = $post;
|
54 |
$this->template = $template;
|
55 |
|
56 |
add_shortcode( 'mwform' , array( $this, 'set_settings_by_mwform' ) );
|
57 |
add_shortcode( 'mwform_formkey', array( $this, 'set_settings_by_mwform_formkey' ) );
|
|
|
58 |
|
59 |
$exec_shortcode = $this->get_exec_shortcode();
|
60 |
if ( $exec_shortcode ) {
|
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.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created : September 25, 2012
|
10 |
-
* Modified: January
|
11 |
* Text Domain: mw-wp-form
|
12 |
* Domain Path: /languages/
|
13 |
* License: GPLv2
|
@@ -223,6 +223,8 @@ class MW_WP_Form {
|
|
223 |
* アンインストールした時の処理
|
224 |
*/
|
225 |
public static function uninstall() {
|
|
|
|
|
226 |
$Admin = new MW_WP_Form_Admin();
|
227 |
$forms = $Admin->get_forms();
|
228 |
|
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.1
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created : September 25, 2012
|
10 |
+
* Modified: January 14, 2015
|
11 |
* Text Domain: mw-wp-form
|
12 |
* Domain Path: /languages/
|
13 |
* License: GPLv2
|
223 |
* アンインストールした時の処理
|
224 |
*/
|
225 |
public static function uninstall() {
|
226 |
+
$plugin_dir_path = plugin_dir_path( __FILE__ );
|
227 |
+
include_once( $plugin_dir_path . 'classes/models/class.admin.php' );
|
228 |
$Admin = new MW_WP_Form_Admin();
|
229 |
$forms = $Admin->get_forms();
|
230 |
|
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.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -71,6 +71,11 @@ Do you have questions or issues with MW WP Form? Use these support channels appr
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
|
|
|
|
74 |
= 2.2.0 =
|
75 |
* Refactoring
|
76 |
* Bug fix : Fixed a mwform_tracking_number_title filter hook bug.
|
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.1
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 2.2.1 =
|
75 |
+
* Bug fix : Fixed a bug that remove_query_vars_from_post() is not executed.
|
76 |
+
* Bug fix : Fixed a akismet feature bug.
|
77 |
+
* Bug fix : Fixed a uninstall bug.
|
78 |
+
|
79 |
= 2.2.0 =
|
80 |
* Refactoring
|
81 |
* Bug fix : Fixed a mwform_tracking_number_title filter hook bug.
|