Version Description
- Added : mwform_csv_button_
- Bug fix: nameMW_Form::getZipValue, MW_Form::getCheckedValue
Download this release
Release Info
Developer | inc2734 |
Plugin | MW WP Form |
Version | 0.9.9 |
Comparing to | |
See all releases |
Code changes from version 0.9.8 to 0.9.9
- mw-wp-form.php +7 -7
- readme.txt +9 -5
- system/mw_form.php +19 -15
- system/mw_wp_form_admin_page.php +17 -15
mw-wp-form.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Plugin Name: MW WP Form
|
4 |
* Plugin URI: http://2inc.org/blog/category/products/wordpress_plugins/mw-wp-form/
|
5 |
* Description: MW WP Form can create mail form with a confirmation screen.
|
6 |
-
* Version: 0.9.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: September 25, 2012
|
10 |
-
* Modified:
|
11 |
* Text Domain: mw-wp-form
|
12 |
* Domain Path: /languages/
|
13 |
* License: GPL2
|
@@ -311,7 +311,7 @@ class mw_wp_form {
|
|
311 |
if ( get_post_type() === MWF_Config::NAME ) {
|
312 |
$this->options_by_formkey = array_merge(
|
313 |
$this->defaults,
|
314 |
-
get_post_meta( $post->ID, MWF_Config::NAME, true )
|
315 |
);
|
316 |
$this->options_by_formkey['post_id'] = $post->ID;
|
317 |
$this->key = MWF_Config::NAME.'-'.$atts['key'];
|
@@ -337,7 +337,7 @@ class mw_wp_form {
|
|
337 |
* }
|
338 |
*/
|
339 |
protected function apply_filters_mwform_validation() {
|
340 |
-
$filterName = 'mwform_validation_'
|
341 |
|
342 |
if ( $this->options_by_formkey ) {
|
343 |
foreach ( $this->options_by_formkey['validation'] as $validation ) {
|
@@ -491,11 +491,11 @@ class mw_wp_form {
|
|
491 |
);
|
492 |
}
|
493 |
|
494 |
-
$filter_name = 'mwform_mail_'
|
495 |
$Mail = apply_filters( $filter_name, $Mail, $this->Data->getValues() );
|
496 |
|
497 |
if ( $this->options_by_formkey && !empty( $Mail ) ) {
|
498 |
-
$filter_name = 'mwform_auto_mail_'
|
499 |
$Mail = apply_filters( $filter_name, $Mail, $this->Data->getValues() );
|
500 |
$Mail->send();
|
501 |
|
@@ -525,7 +525,7 @@ class mw_wp_form {
|
|
525 |
// 自動返信メールからは添付ファイルを削除
|
526 |
$Mail->attachments = array();
|
527 |
|
528 |
-
$filter_name = 'mwform_admin_mail_'
|
529 |
$Mail = apply_filters( $filter_name, $Mail, $this->Data->getValues() );
|
530 |
$Mail->send();
|
531 |
}
|
3 |
* Plugin Name: MW WP Form
|
4 |
* Plugin URI: http://2inc.org/blog/category/products/wordpress_plugins/mw-wp-form/
|
5 |
* Description: MW WP Form can create mail form with a confirmation screen.
|
6 |
+
* Version: 0.9.9
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: September 25, 2012
|
10 |
+
* Modified: September 5, 2013
|
11 |
* Text Domain: mw-wp-form
|
12 |
* Domain Path: /languages/
|
13 |
* License: GPL2
|
311 |
if ( get_post_type() === MWF_Config::NAME ) {
|
312 |
$this->options_by_formkey = array_merge(
|
313 |
$this->defaults,
|
314 |
+
( array )get_post_meta( $post->ID, MWF_Config::NAME, true )
|
315 |
);
|
316 |
$this->options_by_formkey['post_id'] = $post->ID;
|
317 |
$this->key = MWF_Config::NAME.'-'.$atts['key'];
|
337 |
* }
|
338 |
*/
|
339 |
protected function apply_filters_mwform_validation() {
|
340 |
+
$filterName = 'mwform_validation_' . $this->key;
|
341 |
|
342 |
if ( $this->options_by_formkey ) {
|
343 |
foreach ( $this->options_by_formkey['validation'] as $validation ) {
|
491 |
);
|
492 |
}
|
493 |
|
494 |
+
$filter_name = 'mwform_mail_' . $this->key;
|
495 |
$Mail = apply_filters( $filter_name, $Mail, $this->Data->getValues() );
|
496 |
|
497 |
if ( $this->options_by_formkey && !empty( $Mail ) ) {
|
498 |
+
$filter_name = 'mwform_auto_mail_' . $this->key;
|
499 |
$Mail = apply_filters( $filter_name, $Mail, $this->Data->getValues() );
|
500 |
$Mail->send();
|
501 |
|
525 |
// 自動返信メールからは添付ファイルを削除
|
526 |
$Mail->attachments = array();
|
527 |
|
528 |
+
$filter_name = 'mwform_admin_mail_' . $this->key;
|
529 |
$Mail = apply_filters( $filter_name, $Mail, $this->Data->getValues() );
|
530 |
$Mail->send();
|
531 |
}
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
===
|
2 |
Contributors: inc2734
|
3 |
Donate link:
|
4 |
Tags: plugin, form, confirm, preview
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 3.5
|
7 |
-
Stable tag: 0.9.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -37,11 +37,12 @@ http://2inc.org/blog/category/products/wordpress_plugins/mw-wp-form/
|
|
37 |
|
38 |
== Changelog ==
|
39 |
|
|
|
|
|
|
|
|
|
40 |
= 0.9.8 =
|
41 |
* Added : 管理者用・自動返信用メール設定それぞれに 送信元メールアドレス・送信者名の設定を追加
|
42 |
-
|
43 |
-
= 0.9.7 =
|
44 |
-
* Bug fix: CSVダウンロードのバグ修正
|
45 |
* Added : mwform_admin_mail_識別子 フィルターフック追加
|
46 |
* Added : mwform_auto_mail_識別子 フィルターフック追加
|
47 |
* Deleted: mwform_admin_mail_from_識別子 フィルターフック
|
@@ -49,6 +50,9 @@ http://2inc.org/blog/category/products/wordpress_plugins/mw-wp-form/
|
|
49 |
* Deleted: mwform_auto_mail_from_識別子 フィルターフック
|
50 |
* Deleted: mwform_auto_mail_sender_識別子 フィルターフック
|
51 |
|
|
|
|
|
|
|
52 |
= 0.9.6 =
|
53 |
* Bug fix: 電話番号のバリデーションチェックを修正
|
54 |
* Added : CSVダウンロード機能追加
|
1 |
+
=== MW WP Form ===
|
2 |
Contributors: inc2734
|
3 |
Donate link:
|
4 |
Tags: plugin, form, confirm, preview
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 3.5
|
7 |
+
Stable tag: 0.9.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
37 |
|
38 |
== Changelog ==
|
39 |
|
40 |
+
= 0.9.9 =
|
41 |
+
* Added : mwform_csv_button_識別子 フィルターフック
|
42 |
+
* Bug fix: name属性が未指定のとき、MW_Form::getZipValue, MW_Form::getCheckedValue でエラーがでるバグ修正
|
43 |
+
|
44 |
= 0.9.8 =
|
45 |
* Added : 管理者用・自動返信用メール設定それぞれに 送信元メールアドレス・送信者名の設定を追加
|
|
|
|
|
|
|
46 |
* Added : mwform_admin_mail_識別子 フィルターフック追加
|
47 |
* Added : mwform_auto_mail_識別子 フィルターフック追加
|
48 |
* Deleted: mwform_admin_mail_from_識別子 フィルターフック
|
50 |
* Deleted: mwform_auto_mail_from_識別子 フィルターフック
|
51 |
* Deleted: mwform_auto_mail_sender_識別子 フィルターフック
|
52 |
|
53 |
+
= 0.9.7 =
|
54 |
+
* Bug fix: CSVダウンロードのバグ修正
|
55 |
+
|
56 |
= 0.9.6 =
|
57 |
* Bug fix: 電話番号のバリデーションチェックを修正
|
58 |
* Added : CSVダウンロード機能追加
|
system/mw_form.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Name: MW Form
|
4 |
* URI: http://2inc.org
|
5 |
* Description: フォームクラス
|
6 |
-
* Version: 1.3.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: September 25, 2012
|
10 |
-
* Modified:
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
@@ -189,12 +189,14 @@ class MW_Form {
|
|
189 |
$_ret = null;
|
190 |
$separator = $this->getSeparatorValue( $key );
|
191 |
// すべて空のからのときはimplodeしないように(---がいってしまうため)
|
192 |
-
if (
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
|
|
198 |
}
|
199 |
}
|
200 |
}
|
@@ -221,15 +223,17 @@ class MW_Form {
|
|
221 |
public function getCheckedValue( $key, Array $data ) {
|
222 |
$_ret = null;
|
223 |
$separator = $this->getSeparatorValue( $key );
|
224 |
-
if (
|
225 |
-
$
|
226 |
-
|
227 |
-
|
228 |
-
$
|
|
|
|
|
229 |
}
|
|
|
|
|
230 |
}
|
231 |
-
$_ret = implode( $separator, $rightData );
|
232 |
-
$_ret = $this->e( $_ret );
|
233 |
}
|
234 |
return $_ret;
|
235 |
}
|
3 |
* Name: MW Form
|
4 |
* URI: http://2inc.org
|
5 |
* Description: フォームクラス
|
6 |
+
* Version: 1.3.4
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: September 25, 2012
|
10 |
+
* Modified: September 5, 2013
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
189 |
$_ret = null;
|
190 |
$separator = $this->getSeparatorValue( $key );
|
191 |
// すべて空のからのときはimplodeしないように(---がいってしまうため)
|
192 |
+
if ( isset( $this->data[$key] ) && is_array( $this->data[$key] ) ) {
|
193 |
+
if ( isset( $this->data[$key]['data'] ) && is_array( $this->data[$key]['data'] ) && !empty( $separator ) ) {
|
194 |
+
foreach ( $this->data[$key]['data'] as $value ) {
|
195 |
+
if ( !( $value === '' || $value === null ) ) {
|
196 |
+
$_ret = implode( $separator, $this->data[$key]['data'] );
|
197 |
+
$_ret = $this->e( $_ret );
|
198 |
+
break;
|
199 |
+
}
|
200 |
}
|
201 |
}
|
202 |
}
|
223 |
public function getCheckedValue( $key, Array $data ) {
|
224 |
$_ret = null;
|
225 |
$separator = $this->getSeparatorValue( $key );
|
226 |
+
if ( isset( $this->data[$key] ) && is_array( $this->data[$key] ) ) {
|
227 |
+
if ( isset( $this->data[$key]['data'] ) && is_array( $this->data[$key]['data'] ) && !empty( $separator ) ) {
|
228 |
+
$rightData = array();
|
229 |
+
foreach ( $this->data[$key]['data'] as $value ) {
|
230 |
+
if ( isset( $data[$value] ) && !in_array( $data[$value], $rightData ) ) {
|
231 |
+
$rightData[] = $data[$value];
|
232 |
+
}
|
233 |
}
|
234 |
+
$_ret = implode( $separator, $rightData );
|
235 |
+
$_ret = $this->e( $_ret );
|
236 |
}
|
|
|
|
|
237 |
}
|
238 |
return $_ret;
|
239 |
}
|
system/mw_wp_form_admin_page.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Name: MW WP Form Admin Page
|
4 |
* URI: http://2inc.org
|
5 |
* Description: 管理画面クラス
|
6 |
-
* Version: 1.5.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: February 21, 2013
|
10 |
-
* Modified:
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
@@ -53,6 +53,8 @@ class MW_WP_Form_Admin_Page {
|
|
53 |
*/
|
54 |
public function add_csv_download_button() {
|
55 |
$post_type = get_post_type();
|
|
|
|
|
56 |
$page = ( basename( $_SERVER['PHP_SELF'] ) );
|
57 |
if ( in_array( $post_type, $this->form_post_type ) && $page == 'edit.php' ) {
|
58 |
$action = $_SERVER['REQUEST_URI'];
|
@@ -224,56 +226,56 @@ class MW_WP_Form_Admin_Page {
|
|
224 |
$this->postdata = get_post_meta( $post->ID, MWF_Config::NAME, true );
|
225 |
// 完了画面内容
|
226 |
add_meta_box(
|
227 |
-
MWF_Config::NAME.'_complete_message_metabox',
|
228 |
__( 'Complete Message', MWF_Config::DOMAIN ),
|
229 |
array( $this, 'add_complete_message' ),
|
230 |
MWF_Config::NAME, 'normal'
|
231 |
);
|
232 |
// 入力画面URL
|
233 |
add_meta_box(
|
234 |
-
MWF_Config::NAME.'_url',
|
235 |
__( 'URL Options', MWF_Config::DOMAIN ),
|
236 |
array( $this, 'add_url' ),
|
237 |
MWF_Config::NAME, 'normal'
|
238 |
);
|
239 |
// バリデーション
|
240 |
add_meta_box(
|
241 |
-
MWF_Config::NAME.'_validation',
|
242 |
__( 'Validation Rule', MWF_Config::DOMAIN ),
|
243 |
array( $this, 'add_validation_rule' ),
|
244 |
MWF_Config::NAME, 'normal'
|
245 |
);
|
246 |
// フォーム識別子
|
247 |
add_meta_box(
|
248 |
-
MWF_Config::NAME.'_formkey',
|
249 |
__( 'Form Key', MWF_Config::DOMAIN ),
|
250 |
array( $this, 'display_form_key' ),
|
251 |
MWF_Config::NAME, 'side'
|
252 |
);
|
253 |
// 自動返信メール設定
|
254 |
add_meta_box(
|
255 |
-
MWF_Config::NAME.'_mail',
|
256 |
__( 'Automatic Reply Email Options', MWF_Config::DOMAIN ),
|
257 |
array( $this, 'add_mail_options' ),
|
258 |
MWF_Config::NAME, 'side'
|
259 |
);
|
260 |
// 管理者メール設定
|
261 |
add_meta_box(
|
262 |
-
MWF_Config::NAME.'_admin_mail',
|
263 |
__( 'Admin Email Options', MWF_Config::DOMAIN ),
|
264 |
array( $this, 'add_admin_mail_options' ),
|
265 |
MWF_Config::NAME, 'side'
|
266 |
);
|
267 |
// 設定
|
268 |
add_meta_box(
|
269 |
-
MWF_Config::NAME.'_settings',
|
270 |
__( 'settings', MWF_Config::DOMAIN ),
|
271 |
array( $this, 'settings' ),
|
272 |
MWF_Config::NAME, 'side'
|
273 |
);
|
274 |
} elseif ( in_array( $post_type, $this->form_post_type ) ) {
|
275 |
add_meta_box(
|
276 |
-
MWF_Config::NAME.'_custom_fields',
|
277 |
__( 'Custom Fields', MWF_Config::DOMAIN ),
|
278 |
array( $this, 'custom_fields' ),
|
279 |
$post_type
|
@@ -374,11 +376,11 @@ class MW_WP_Form_Admin_Page {
|
|
374 |
* @param $post_ID
|
375 |
*/
|
376 |
public function save_post( $post_ID ) {
|
377 |
-
if ( ! isset( $_POST[MWF_Config::NAME.'_nonce'] ) )
|
378 |
return $post_ID;
|
379 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
380 |
return $post_ID;
|
381 |
-
if ( !wp_verify_nonce( $_POST[MWF_Config::NAME.'_nonce'], MWF_Config::NAME ) )
|
382 |
return $post_ID;
|
383 |
if ( !current_user_can( 'manage_options', $post_ID ) )
|
384 |
return $post_ID;
|
@@ -439,7 +441,7 @@ class MW_WP_Form_Admin_Page {
|
|
439 |
<p>
|
440 |
<span id="formkey_field">[mwform_formkey key="<?php the_ID(); ?>"]</span>
|
441 |
<span class="mwf_note">
|
442 |
-
<?php _e( 'Copy and Paste this
|
443 |
<?php _e( 'The key to use with hook is ', MWF_Config::DOMAIN ); ?><?php echo MWF_Config::NAME; ?>-<?php echo $post->ID; ?>
|
444 |
</span>
|
445 |
</p>
|
@@ -489,8 +491,8 @@ class MW_WP_Form_Admin_Page {
|
|
489 |
public function add_complete_message() {
|
490 |
global $post;
|
491 |
$content = $this->get_post_data( 'complete_message' );
|
492 |
-
wp_editor( $content, MWF_Config::NAME.'_complete_message', array(
|
493 |
-
'textarea_name' => MWF_Config::NAME.'[complete_message]',
|
494 |
'textarea_rows' => 7,
|
495 |
) );
|
496 |
}
|
3 |
* Name: MW WP Form Admin Page
|
4 |
* URI: http://2inc.org
|
5 |
* Description: 管理画面クラス
|
6 |
+
* Version: 1.5.3
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: February 21, 2013
|
10 |
+
* Modified: September 5, 2013
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
53 |
*/
|
54 |
public function add_csv_download_button() {
|
55 |
$post_type = get_post_type();
|
56 |
+
if ( true !== apply_filters( 'mwform_csv_button_' . $post_type, true ) )
|
57 |
+
return;
|
58 |
$page = ( basename( $_SERVER['PHP_SELF'] ) );
|
59 |
if ( in_array( $post_type, $this->form_post_type ) && $page == 'edit.php' ) {
|
60 |
$action = $_SERVER['REQUEST_URI'];
|
226 |
$this->postdata = get_post_meta( $post->ID, MWF_Config::NAME, true );
|
227 |
// 完了画面内容
|
228 |
add_meta_box(
|
229 |
+
MWF_Config::NAME . '_complete_message_metabox',
|
230 |
__( 'Complete Message', MWF_Config::DOMAIN ),
|
231 |
array( $this, 'add_complete_message' ),
|
232 |
MWF_Config::NAME, 'normal'
|
233 |
);
|
234 |
// 入力画面URL
|
235 |
add_meta_box(
|
236 |
+
MWF_Config::NAME . '_url',
|
237 |
__( 'URL Options', MWF_Config::DOMAIN ),
|
238 |
array( $this, 'add_url' ),
|
239 |
MWF_Config::NAME, 'normal'
|
240 |
);
|
241 |
// バリデーション
|
242 |
add_meta_box(
|
243 |
+
MWF_Config::NAME . '_validation',
|
244 |
__( 'Validation Rule', MWF_Config::DOMAIN ),
|
245 |
array( $this, 'add_validation_rule' ),
|
246 |
MWF_Config::NAME, 'normal'
|
247 |
);
|
248 |
// フォーム識別子
|
249 |
add_meta_box(
|
250 |
+
MWF_Config::NAME . '_formkey',
|
251 |
__( 'Form Key', MWF_Config::DOMAIN ),
|
252 |
array( $this, 'display_form_key' ),
|
253 |
MWF_Config::NAME, 'side'
|
254 |
);
|
255 |
// 自動返信メール設定
|
256 |
add_meta_box(
|
257 |
+
MWF_Config::NAME . '_mail',
|
258 |
__( 'Automatic Reply Email Options', MWF_Config::DOMAIN ),
|
259 |
array( $this, 'add_mail_options' ),
|
260 |
MWF_Config::NAME, 'side'
|
261 |
);
|
262 |
// 管理者メール設定
|
263 |
add_meta_box(
|
264 |
+
MWF_Config::NAME . '_admin_mail',
|
265 |
__( 'Admin Email Options', MWF_Config::DOMAIN ),
|
266 |
array( $this, 'add_admin_mail_options' ),
|
267 |
MWF_Config::NAME, 'side'
|
268 |
);
|
269 |
// 設定
|
270 |
add_meta_box(
|
271 |
+
MWF_Config::NAME . '_settings',
|
272 |
__( 'settings', MWF_Config::DOMAIN ),
|
273 |
array( $this, 'settings' ),
|
274 |
MWF_Config::NAME, 'side'
|
275 |
);
|
276 |
} elseif ( in_array( $post_type, $this->form_post_type ) ) {
|
277 |
add_meta_box(
|
278 |
+
MWF_Config::NAME . '_custom_fields',
|
279 |
__( 'Custom Fields', MWF_Config::DOMAIN ),
|
280 |
array( $this, 'custom_fields' ),
|
281 |
$post_type
|
376 |
* @param $post_ID
|
377 |
*/
|
378 |
public function save_post( $post_ID ) {
|
379 |
+
if ( ! isset( $_POST[MWF_Config::NAME . '_nonce'] ) )
|
380 |
return $post_ID;
|
381 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
382 |
return $post_ID;
|
383 |
+
if ( !wp_verify_nonce( $_POST[MWF_Config::NAME . '_nonce'], MWF_Config::NAME ) )
|
384 |
return $post_ID;
|
385 |
if ( !current_user_can( 'manage_options', $post_ID ) )
|
386 |
return $post_ID;
|
441 |
<p>
|
442 |
<span id="formkey_field">[mwform_formkey key="<?php the_ID(); ?>"]</span>
|
443 |
<span class="mwf_note">
|
444 |
+
<?php _e( 'Copy and Paste this shortcodE . ', MWF_Config::DOMAIN ); ?><br />
|
445 |
<?php _e( 'The key to use with hook is ', MWF_Config::DOMAIN ); ?><?php echo MWF_Config::NAME; ?>-<?php echo $post->ID; ?>
|
446 |
</span>
|
447 |
</p>
|
491 |
public function add_complete_message() {
|
492 |
global $post;
|
493 |
$content = $this->get_post_data( 'complete_message' );
|
494 |
+
wp_editor( $content, MWF_Config::NAME . '_complete_message', array(
|
495 |
+
'textarea_name' => MWF_Config::NAME . '[complete_message]',
|
496 |
'textarea_rows' => 7,
|
497 |
) );
|
498 |
}
|