Version Description
- Cahged : functions.php
- Added : [mwform_checkbox name="checkbox" children="A,B,C" separator=""]
Download this release
Release Info
Developer | inc2734 |
Plugin | MW WP Form |
Version | 0.8.1 |
Comparing to | |
See all releases |
Code changes from version 0.8 to 0.8.1
- form_fields/mw_form_field_checkbox.php +4 -3
- mw-wp-form.php +10 -4
- readme.txt +7 -4
- system/mw_form.php +11 -10
form_fields/mw_form_field_checkbox.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Name: MW Form Field Checkbox
|
4 |
* URI: http://2inc.org
|
5 |
* Description: チェックボックスを出力。
|
6 |
-
* Version: 1.1
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
10 |
-
* Modified:
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
@@ -43,6 +43,7 @@ class mw_form_field_checkbox extends mw_form_field {
|
|
43 |
'children' => '',
|
44 |
'value' => '',
|
45 |
'show_error' => 'true',
|
|
|
46 |
);
|
47 |
}
|
48 |
|
@@ -56,7 +57,7 @@ class mw_form_field_checkbox extends mw_form_field {
|
|
56 |
$children = $this->getChildren( $atts['children'] );
|
57 |
$_ret = $this->Form->checkbox( $atts['name'], $children, array(
|
58 |
'value' => $atts['value'],
|
59 |
-
) );
|
60 |
if ( $atts['show_error'] !== 'false' )
|
61 |
$_ret .= $this->getError( $atts['name'] );
|
62 |
return $_ret;
|
3 |
* Name: MW Form Field Checkbox
|
4 |
* URI: http://2inc.org
|
5 |
* Description: チェックボックスを出力。
|
6 |
+
* Version: 1.1.1
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
10 |
+
* Modified: June 18, 2013
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
43 |
'children' => '',
|
44 |
'value' => '',
|
45 |
'show_error' => 'true',
|
46 |
+
'separator' => ',',
|
47 |
);
|
48 |
}
|
49 |
|
57 |
$children = $this->getChildren( $atts['children'] );
|
58 |
$_ret = $this->Form->checkbox( $atts['name'], $children, array(
|
59 |
'value' => $atts['value'],
|
60 |
+
), $atts['separator'] );
|
61 |
if ( $atts['show_error'] !== 'false' )
|
62 |
$_ret .= $this->getError( $atts['name'] );
|
63 |
return $_ret;
|
mw-wp-form.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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.8
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: September 25, 2012
|
@@ -632,7 +632,7 @@ class mw_wp_form {
|
|
632 |
}
|
633 |
}
|
634 |
return
|
635 |
-
'<div id="mw_wp_form_' . $this->key . '" class="mw_wp_form">' .
|
636 |
$this->Form->start() .
|
637 |
do_shortcode( $content ) .
|
638 |
$upload_file_hidden .
|
@@ -749,6 +749,7 @@ class mw_wp_form_data {
|
|
749 |
|
750 |
/**
|
751 |
* getValue
|
|
|
752 |
* @param String $key データのキー
|
753 |
* @return String データ
|
754 |
*/
|
@@ -759,6 +760,7 @@ class mw_wp_form_data {
|
|
759 |
|
760 |
/**
|
761 |
* getValues
|
|
|
762 |
* @return Array データ
|
763 |
*/
|
764 |
public function getValues() {
|
@@ -769,6 +771,7 @@ class mw_wp_form_data {
|
|
769 |
|
770 |
/**
|
771 |
* setValue
|
|
|
772 |
* @param String $key データのキー
|
773 |
* @param String $value 値
|
774 |
*/
|
@@ -779,6 +782,7 @@ class mw_wp_form_data {
|
|
779 |
|
780 |
/**
|
781 |
* setValue
|
|
|
782 |
* @param Array 値
|
783 |
*/
|
784 |
public function setValues( Array $array ) {
|
@@ -789,7 +793,8 @@ class mw_wp_form_data {
|
|
789 |
}
|
790 |
|
791 |
/**
|
792 |
-
*
|
|
|
793 |
* @param String $key データのキー
|
794 |
*/
|
795 |
public function clearValue( $key ) {
|
@@ -798,7 +803,8 @@ class mw_wp_form_data {
|
|
798 |
}
|
799 |
|
800 |
/**
|
801 |
-
*
|
|
|
802 |
* @param String $key データのキー
|
803 |
* @param String $value 値
|
804 |
*/
|
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.8.1
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: September 25, 2012
|
632 |
}
|
633 |
}
|
634 |
return
|
635 |
+
'<div id="mw_wp_form_' . $this->key . '" class="mw_wp_form mw_wp_form_' . $this->viewFlg . '">' .
|
636 |
$this->Form->start() .
|
637 |
do_shortcode( $content ) .
|
638 |
$upload_file_hidden .
|
749 |
|
750 |
/**
|
751 |
* getValue
|
752 |
+
* データを取得
|
753 |
* @param String $key データのキー
|
754 |
* @return String データ
|
755 |
*/
|
760 |
|
761 |
/**
|
762 |
* getValues
|
763 |
+
* 全てのデータを取得
|
764 |
* @return Array データ
|
765 |
*/
|
766 |
public function getValues() {
|
771 |
|
772 |
/**
|
773 |
* setValue
|
774 |
+
* データを追加
|
775 |
* @param String $key データのキー
|
776 |
* @param String $value 値
|
777 |
*/
|
782 |
|
783 |
/**
|
784 |
* setValue
|
785 |
+
* 複数のデータを一括で追加
|
786 |
* @param Array 値
|
787 |
*/
|
788 |
public function setValues( Array $array ) {
|
793 |
}
|
794 |
|
795 |
/**
|
796 |
+
* clearValue
|
797 |
+
* データを消す
|
798 |
* @param String $key データのキー
|
799 |
*/
|
800 |
public function clearValue( $key ) {
|
803 |
}
|
804 |
|
805 |
/**
|
806 |
+
* pushValue
|
807 |
+
* 指定した $key をキーと配列にデータを追加
|
808 |
* @param String $key データのキー
|
809 |
* @param String $value 値
|
810 |
*/
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: plugin, form, confirm, preview
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 3.5
|
7 |
-
Stable tag: 0.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -32,12 +32,15 @@ http://2inc.org/blog/category/products/wordpress_plugins/mw-wp-form/
|
|
32 |
|
33 |
1. Upload `MW WP Form` to the `/wp-content/plugins/` directory
|
34 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
35 |
-
1. You can create a form by settings page
|
36 |
-
1. If you using functions.php, place `<?php add_filter( 'mwform_validation_{$key}', array( $this, 'my_validation_filter_name' ) ); ?>` in your functions.php
|
37 |
-
1. If you using functions.php, place `<?php add_filter( 'mwform_mail_{$key}', array( $this, 'my_mail_action_name' ) ); ?>` in your functions.php
|
38 |
|
39 |
== Changelog ==
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
= 0.8 =
|
42 |
* Added : 画像アップロードフィールドを追加
|
43 |
* Added : ファイルアップロードフィールドを追加
|
4 |
Tags: plugin, form, confirm, preview
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 3.5
|
7 |
+
Stable tag: 0.8.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
32 |
|
33 |
1. Upload `MW WP Form` to the `/wp-content/plugins/` directory
|
34 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
35 |
+
1. You can create a form by settings page.
|
|
|
|
|
36 |
|
37 |
== Changelog ==
|
38 |
|
39 |
+
= 0.8.1 =
|
40 |
+
* Cahged : functions.php を用いたフォーム作成は非推奨・サポート、メンテナンス停止
|
41 |
+
* Added : チェックボックスで区切り文字の設定機能を追加
|
42 |
+
[mwform_checkbox name="checkbox" children="A,B,C" separator="、"]
|
43 |
+
|
44 |
= 0.8 =
|
45 |
* Added : 画像アップロードフィールドを追加
|
46 |
* Added : ファイルアップロードフィールドを追加
|
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,7 +189,7 @@ class MW_Form {
|
|
189 |
$_ret = null;
|
190 |
$separator = $this->getSeparatorValue( $key );
|
191 |
// すべて空のからのときはimplodeしないように(---がいってしまうため)
|
192 |
-
if (
|
193 |
foreach ( $this->data[$key]['data'] as $value ) {
|
194 |
if ( !( $value === '' || $value === null ) ) {
|
195 |
$_ret = implode( $separator, $this->data[$key]['data'] );
|
@@ -221,14 +221,15 @@ class MW_Form {
|
|
221 |
public function getCheckedValue( $key, Array $data ) {
|
222 |
$_ret = null;
|
223 |
$separator = $this->getSeparatorValue( $key );
|
224 |
-
if (
|
|
|
225 |
foreach ( $this->data[$key]['data'] as $value ) {
|
226 |
-
if ( isset( $data[$value] ) ) {
|
227 |
-
$
|
228 |
-
$_ret = $this->e( $_ret );
|
229 |
-
break;
|
230 |
}
|
231 |
}
|
|
|
|
|
232 |
}
|
233 |
return $_ret;
|
234 |
}
|
@@ -505,10 +506,10 @@ class MW_Form {
|
|
505 |
* @param String name属性
|
506 |
* Array ( キー => 値, … )
|
507 |
* Array ( 'value' => Mixed )
|
|
|
508 |
* @return String htmlタグ
|
509 |
*/
|
510 |
-
public function checkbox( $name, $children = array(), $options = array() ) {
|
511 |
-
$separator = ',';
|
512 |
$defaults = array(
|
513 |
'value' => array()
|
514 |
);
|
3 |
* Name: MW Form
|
4 |
* URI: http://2inc.org
|
5 |
* Description: フォームクラス
|
6 |
+
* Version: 1.3.2
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: September 25, 2012
|
10 |
+
* Modified: June 18, 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 ( array_key_exists( 'data', $this->data[$key] ) && is_array( $this->data[$key]['data'] ) && !empty( $separator ) ) {
|
193 |
foreach ( $this->data[$key]['data'] as $value ) {
|
194 |
if ( !( $value === '' || $value === null ) ) {
|
195 |
$_ret = implode( $separator, $this->data[$key]['data'] );
|
221 |
public function getCheckedValue( $key, Array $data ) {
|
222 |
$_ret = null;
|
223 |
$separator = $this->getSeparatorValue( $key );
|
224 |
+
if ( array_key_exists( 'data', $this->data[$key] ) && is_array( $this->data[$key]['data'] ) && !empty( $separator ) ) {
|
225 |
+
$rightData = array();
|
226 |
foreach ( $this->data[$key]['data'] as $value ) {
|
227 |
+
if ( isset( $data[$value] ) && !in_array( $data[$value], $rightData ) ) {
|
228 |
+
$rightData[] = $data[$value];
|
|
|
|
|
229 |
}
|
230 |
}
|
231 |
+
$_ret = implode( $separator, $rightData );
|
232 |
+
$_ret = $this->e( $_ret );
|
233 |
}
|
234 |
return $_ret;
|
235 |
}
|
506 |
* @param String name属性
|
507 |
* Array ( キー => 値, … )
|
508 |
* Array ( 'value' => Mixed )
|
509 |
+
* String 区切り文字
|
510 |
* @return String htmlタグ
|
511 |
*/
|
512 |
+
public function checkbox( $name, $children = array(), $options = array(), $separator = ',' ) {
|
|
|
513 |
$defaults = array(
|
514 |
'value' => array()
|
515 |
);
|