Version Description
- Added :
- Added :
- Added :
- Added :
- Added : save
- Added : datepicker
- Added : mwform_add_shortcode, mwform_add_qtags
- Bug fix: ,
- Cahged :
Download this release
Release Info
Developer | inc2734 |
Plugin | MW WP Form |
Version | 0.8 |
Comparing to | |
See all releases |
Code changes from version 0.7.1 to 0.8
- css/admin.css +8 -0
- css/style.css +5 -0
- form_fields/mw_form_field_back_button.php +30 -9
- form_fields/mw_form_field_button.php +30 -9
- form_fields/{mw_form_checkbox.php → mw_form_field_checkbox.php} +37 -16
- form_fields/{mw_form_datepicker.php → mw_form_field_datepicker.php} +45 -19
- form_fields/{mw_form_error.php → mw_form_field_error.php} +29 -8
- form_fields/mw_form_field_file.php +98 -0
- form_fields/mw_form_field_hidden.php +31 -10
- form_fields/mw_form_field_image.php +98 -0
- form_fields/mw_form_field_password.php +36 -15
- form_fields/mw_form_field_preview_button.php +26 -9
- form_fields/{mw_form_radio.php → mw_form_field_radio.php} +36 -15
- form_fields/{mw_form_select.php → mw_form_field_select.php} +36 -15
- form_fields/mw_form_field_submit.php +32 -15
- form_fields/mw_form_field_submit_button.php +36 -11
- form_fields/mw_form_field_tel.php +34 -13
- form_fields/mw_form_field_text.php +36 -15
- form_fields/{mw_form_textarea.php → mw_form_field_textarea.php} +36 -15
- form_fields/mw_form_field_zip.php +34 -13
- js/admin.js +1 -1
- languages/mw-wp-form-ja.mo +0 -0
- languages/mw-wp-form-ja.po +166 -126
- languages/mw-wp-form.pot +165 -125
- mw-wp-form.php +239 -230
- readme.txt +19 -1
- system/mw_form.php +36 -18
- system/mw_form_field.php +67 -48
- system/mw_mail.php +17 -16
- system/mw_session.php +28 -8
- system/mw_validation.php +103 -49
- system/mw_wp_form_admin_page.php +176 -214
- system/mwf_config.php +53 -0
- system/mwf_functions.php +42 -0
css/admin.css
CHANGED
@@ -165,3 +165,11 @@ span#formkey_field {
|
|
165 |
width: 70%;
|
166 |
}
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
width: 70%;
|
166 |
}
|
167 |
|
168 |
+
/**
|
169 |
+
* 注釈
|
170 |
+
*/
|
171 |
+
.mwf_note {
|
172 |
+
color: #666;
|
173 |
+
font-size: 93%;
|
174 |
+
}
|
175 |
+
|
css/style.css
CHANGED
@@ -5,3 +5,8 @@
|
|
5 |
color : #B70000;
|
6 |
display : block;
|
7 |
}
|
|
|
|
|
|
|
|
|
|
5 |
color : #B70000;
|
6 |
display : block;
|
7 |
}
|
8 |
+
.ui-datepicker .ui-datepicker-title select.ui-datepicker-month,
|
9 |
+
.ui-datepicker .ui-datepicker-title select.ui-datepicker-year {
|
10 |
+
width: 40%;
|
11 |
+
margin: 0 5px;
|
12 |
+
}
|
form_fields/mw_form_field_back_button.php
CHANGED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Back Button
|
4 |
* URI: http://2inc.org
|
5 |
* Description: 戻るボタンを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_back_button extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -33,24 +39,39 @@ class mw_form_field_back_button extends mw_form_field {
|
|
33 |
*/
|
34 |
protected function setDefaults() {
|
35 |
return array(
|
36 |
-
'value' => __( 'Back',
|
37 |
);
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
* inputPage
|
42 |
* 入力ページでのフォーム項目を返す
|
|
|
43 |
* @return String HTML
|
44 |
*/
|
45 |
-
protected function inputPage() {
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
* previewPage
|
50 |
* 確認ページでのフォーム項目を返す
|
|
|
51 |
* @return String HTML
|
52 |
*/
|
53 |
-
protected function previewPage() {
|
54 |
-
return $this->Form->submit( $this->Form->getBackButtonName(), $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
}
|
3 |
* Name: MW Form Field Back Button
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_back_button extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_backButton';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
39 |
*/
|
40 |
protected function setDefaults() {
|
41 |
return array(
|
42 |
+
'value' => __( 'Back', MWF_Config::DOMAIN ),
|
43 |
);
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
* inputPage
|
48 |
* 入力ページでのフォーム項目を返す
|
49 |
+
* @param Array $atts
|
50 |
* @return String HTML
|
51 |
*/
|
52 |
+
protected function inputPage( $atts ) {
|
53 |
}
|
54 |
|
55 |
/**
|
56 |
* previewPage
|
57 |
* 確認ページでのフォーム項目を返す
|
58 |
+
* @param Array $atts
|
59 |
* @return String HTML
|
60 |
*/
|
61 |
+
protected function previewPage( $atts ) {
|
62 |
+
return $this->Form->submit( $this->Form->getBackButtonName(), $atts['value'] );
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* add_qtags
|
67 |
+
* QTags.addButton を出力
|
68 |
+
*/
|
69 |
+
protected function add_qtags() {
|
70 |
+
?>
|
71 |
+
'<?php echo $this->short_code_name; ?>',
|
72 |
+
'<?php _e( 'Back', MWF_Config::DOMAIN ); ?>',
|
73 |
+
'[<?php echo $this->short_code_name; ?>]',
|
74 |
+
''
|
75 |
+
<?php
|
76 |
}
|
77 |
}
|
form_fields/mw_form_field_button.php
CHANGED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Button
|
4 |
* URI: http://2inc.org
|
5 |
* Description: ボタンを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_button extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -41,18 +47,33 @@ class mw_form_field_button extends mw_form_field {
|
|
41 |
/**
|
42 |
* inputPage
|
43 |
* 入力ページでのフォーム項目を返す
|
|
|
44 |
* @return String HTML
|
45 |
*/
|
46 |
-
protected function inputPage() {
|
47 |
-
return $this->Form->button( $
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* previewPage
|
52 |
* 確認ページでのフォーム項目を返す
|
|
|
53 |
* @return String HTML
|
54 |
*/
|
55 |
-
protected function previewPage() {
|
56 |
-
return $this->inputPage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
}
|
3 |
* Name: MW Form Field Button
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_button extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_button';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
47 |
/**
|
48 |
* inputPage
|
49 |
* 入力ページでのフォーム項目を返す
|
50 |
+
* @param Array $atts
|
51 |
* @return String HTML
|
52 |
*/
|
53 |
+
protected function inputPage( $atts ) {
|
54 |
+
return $this->Form->button( $atts['name'], $atts['value'] );
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
* previewPage
|
59 |
* 確認ページでのフォーム項目を返す
|
60 |
+
* @param Array $atts
|
61 |
* @return String HTML
|
62 |
*/
|
63 |
+
protected function previewPage( $atts ) {
|
64 |
+
return $this->inputPage( $atts );
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* add_qtags
|
69 |
+
* QTags.addButton を出力
|
70 |
+
*/
|
71 |
+
protected function add_qtags() {
|
72 |
+
?>
|
73 |
+
'<?php echo $this->short_code_name; ?>',
|
74 |
+
'<?php _e( 'Button', MWF_Config::DOMAIN ); ?>',
|
75 |
+
'[<?php echo $this->short_code_name; ?> name=""]',
|
76 |
+
''
|
77 |
+
<?php
|
78 |
}
|
79 |
}
|
form_fields/{mw_form_checkbox.php → mw_form_field_checkbox.php}
RENAMED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Checkbox
|
4 |
* URI: http://2inc.org
|
5 |
* Description: チェックボックスを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_checkbox extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -43,29 +49,44 @@ class mw_form_field_checkbox extends mw_form_field {
|
|
43 |
/**
|
44 |
* inputPage
|
45 |
* 入力ページでのフォーム項目を返す
|
|
|
46 |
* @return String HTML
|
47 |
*/
|
48 |
-
protected function inputPage() {
|
49 |
-
$children = $this->getChildren();
|
50 |
-
$_ret = $this->Form->checkbox( $
|
51 |
-
'value' => $
|
52 |
) );
|
53 |
-
if ( $
|
54 |
-
$_ret .= $this->getError( $
|
55 |
return $_ret;
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
* previewPage
|
60 |
* 確認ページでのフォーム項目を返す
|
|
|
61 |
* @return String HTML
|
62 |
*/
|
63 |
-
protected function previewPage() {
|
64 |
-
$children = $this->getChildren();
|
65 |
-
$value = $this->Form->getCheckedValue( $
|
66 |
$_ret = $value;
|
67 |
-
$_ret .= $this->Form->hidden( $
|
68 |
-
$_ret .= $this->Form->separator( $
|
69 |
return $_ret;
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_checkbox extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_checkbox';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
49 |
/**
|
50 |
* inputPage
|
51 |
* 入力ページでのフォーム項目を返す
|
52 |
+
* @param Array $atts
|
53 |
* @return String HTML
|
54 |
*/
|
55 |
+
protected function inputPage( $atts ) {
|
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;
|
63 |
}
|
64 |
|
65 |
/**
|
66 |
* previewPage
|
67 |
* 確認ページでのフォーム項目を返す
|
68 |
+
* @param Array $atts
|
69 |
* @return String HTML
|
70 |
*/
|
71 |
+
protected function previewPage( $atts ) {
|
72 |
+
$children = $this->getChildren( $atts['children'] );
|
73 |
+
$value = $this->Form->getCheckedValue( $atts['name'], $children );
|
74 |
$_ret = $value;
|
75 |
+
$_ret .= $this->Form->hidden( $atts['name'] . '[data]', $value );
|
76 |
+
$_ret .= $this->Form->separator( $atts['name'] );
|
77 |
return $_ret;
|
78 |
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* add_qtags
|
82 |
+
* QTags.addButton を出力
|
83 |
+
*/
|
84 |
+
protected function add_qtags() {
|
85 |
+
?>
|
86 |
+
'<?php echo $this->short_code_name; ?>',
|
87 |
+
'<?php _e( 'Checkbox', MWF_Config::DOMAIN ); ?>',
|
88 |
+
'[<?php echo $this->short_code_name; ?> name="" children=""]',
|
89 |
+
''
|
90 |
+
<?php
|
91 |
+
}
|
92 |
}
|
form_fields/{mw_form_datepicker.php → mw_form_field_datepicker.php}
RENAMED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Datepicker
|
4 |
* URI: http://2inc.org
|
5 |
* Description: datepickerを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_datepicker extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -44,44 +50,64 @@ class mw_form_field_datepicker extends mw_form_field {
|
|
44 |
/**
|
45 |
* inputPage
|
46 |
* 入力ページでのフォーム項目を返す
|
|
|
47 |
* @return String HTML
|
48 |
*/
|
49 |
-
protected function inputPage() {
|
50 |
wp_enqueue_style( 'jquery.ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/base/jquery-ui.css', array(), '1.9.2' );
|
51 |
wp_enqueue_script( 'jquery-ui-datepicker' );
|
|
|
|
|
|
|
|
|
52 |
// 日本語の場合は日本語表記に変更
|
53 |
if ( get_locale() == 'ja' ) {
|
54 |
-
if ( !empty( $
|
55 |
-
$
|
56 |
-
$
|
|
|
57 |
dateFormat: "yy-mm-dd",
|
58 |
dayNames: ["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],
|
59 |
-
dayNamesMin: ["日","月","火","水","木","金","土"],
|
60 |
dayNamesShort: ["日曜","月曜","火曜","水曜","木曜","金曜","土曜"],
|
61 |
monthNames: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],
|
62 |
monthNamesShort: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]
|
63 |
';
|
64 |
}
|
65 |
$_ret = '';
|
66 |
-
$_ret .= $this->Form->datepicker( $
|
67 |
-
'size' => $
|
68 |
-
'js' => $
|
69 |
-
'value' => $
|
70 |
) );
|
71 |
-
if ( $
|
72 |
-
$_ret .= $this->getError( $
|
73 |
return $_ret;
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
* previewPage
|
78 |
* 確認ページでのフォーム項目を返す
|
|
|
79 |
* @return String HTML
|
80 |
*/
|
81 |
-
protected function previewPage() {
|
82 |
-
$value = $this->Form->getValue( $
|
83 |
$_ret = $value;
|
84 |
-
$_ret .= $this->Form->hidden( $
|
85 |
return $_ret;
|
86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
3 |
* Name: MW Form Field Datepicker
|
4 |
* URI: http://2inc.org
|
5 |
* Description: datepickerを出力。
|
6 |
+
* Version: 1.1
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
10 |
+
* Modified: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_datepicker extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_datepicker';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
50 |
/**
|
51 |
* inputPage
|
52 |
* 入力ページでのフォーム項目を返す
|
53 |
+
* @param Array $atts
|
54 |
* @return String HTML
|
55 |
*/
|
56 |
+
protected function inputPage( $atts ) {
|
57 |
wp_enqueue_style( 'jquery.ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/base/jquery-ui.css', array(), '1.9.2' );
|
58 |
wp_enqueue_script( 'jquery-ui-datepicker' );
|
59 |
+
// jsの指定がないときはデフォルトで年付き変更機能追加
|
60 |
+
if ( empty( $atts['js'] ) ) {
|
61 |
+
$atts['js'] = 'showMonthAfterYear: true, changeYear: true, changeMonth: true';
|
62 |
+
}
|
63 |
// 日本語の場合は日本語表記に変更
|
64 |
if ( get_locale() == 'ja' ) {
|
65 |
+
if ( !empty( $atts['js'] ) )
|
66 |
+
$atts['js'] = $atts['js'] . ',';
|
67 |
+
$atts['js'] .= '
|
68 |
+
yearSuffix: "年",
|
69 |
dateFormat: "yy-mm-dd",
|
70 |
dayNames: ["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],
|
71 |
+
dayNamesMin: ["日","月","火","水","木","金","土"],
|
72 |
dayNamesShort: ["日曜","月曜","火曜","水曜","木曜","金曜","土曜"],
|
73 |
monthNames: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],
|
74 |
monthNamesShort: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]
|
75 |
';
|
76 |
}
|
77 |
$_ret = '';
|
78 |
+
$_ret .= $this->Form->datepicker( $atts['name'], array(
|
79 |
+
'size' => $atts['size'],
|
80 |
+
'js' => $atts['js'],
|
81 |
+
'value' => $atts['value'],
|
82 |
) );
|
83 |
+
if ( $atts['show_error'] !== 'false' )
|
84 |
+
$_ret .= $this->getError( $atts['name'] );
|
85 |
return $_ret;
|
86 |
}
|
87 |
|
88 |
/**
|
89 |
* previewPage
|
90 |
* 確認ページでのフォーム項目を返す
|
91 |
+
* @param Array $atts
|
92 |
* @return String HTML
|
93 |
*/
|
94 |
+
protected function previewPage( $atts ) {
|
95 |
+
$value = $this->Form->getValue( $atts['name'] );
|
96 |
$_ret = $value;
|
97 |
+
$_ret .= $this->Form->hidden( $atts['name'], $value );
|
98 |
return $_ret;
|
99 |
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* add_qtags
|
103 |
+
* QTags.addButton を出力
|
104 |
+
*/
|
105 |
+
protected function add_qtags() {
|
106 |
+
?>
|
107 |
+
'<?php echo $this->short_code_name; ?>',
|
108 |
+
'<?php _e( 'Datepicker', MWF_Config::DOMAIN ); ?>',
|
109 |
+
'[<?php echo $this->short_code_name; ?> name=""]',
|
110 |
+
''
|
111 |
+
<?php
|
112 |
+
}
|
113 |
}
|
form_fields/{mw_form_error.php → mw_form_field_error.php}
RENAMED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Error
|
4 |
* URI: http://2inc.org
|
5 |
* Description: エラーを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_error extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -40,10 +46,11 @@ class mw_form_field_error extends mw_form_field {
|
|
40 |
/**
|
41 |
* inputPage
|
42 |
* 入力ページでのフォーム項目を返す
|
|
|
43 |
* @return String HTML
|
44 |
*/
|
45 |
-
protected function inputPage() {
|
46 |
-
$keys = explode( ',', $
|
47 |
$_ret = '';
|
48 |
foreach ( $keys as $key ) {
|
49 |
$_ret .= $this->getError( trim( $key ) );
|
@@ -54,8 +61,22 @@ class mw_form_field_error extends mw_form_field {
|
|
54 |
/**
|
55 |
* previewPage
|
56 |
* 確認ページでのフォーム項目を返す
|
|
|
57 |
* @return String HTML
|
58 |
*/
|
59 |
-
protected function previewPage() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
}
|
3 |
* Name: MW Form Field Error
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_error extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_error';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
46 |
/**
|
47 |
* inputPage
|
48 |
* 入力ページでのフォーム項目を返す
|
49 |
+
* @param Array $atts
|
50 |
* @return String HTML
|
51 |
*/
|
52 |
+
protected function inputPage( $atts ) {
|
53 |
+
$keys = explode( ',', $atts['keys'] );
|
54 |
$_ret = '';
|
55 |
foreach ( $keys as $key ) {
|
56 |
$_ret .= $this->getError( trim( $key ) );
|
61 |
/**
|
62 |
* previewPage
|
63 |
* 確認ページでのフォーム項目を返す
|
64 |
+
* @param Array $atts
|
65 |
* @return String HTML
|
66 |
*/
|
67 |
+
protected function previewPage( $atts ) {
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* add_qtags
|
72 |
+
* QTags.addButton を出力
|
73 |
+
*/
|
74 |
+
protected function add_qtags() {
|
75 |
+
?>
|
76 |
+
'<?php echo $this->short_code_name; ?>',
|
77 |
+
'<?php _e( 'Error Message', MWF_Config::DOMAIN ); ?>',
|
78 |
+
'[<?php echo $this->short_code_name; ?> keys=""]',
|
79 |
+
''
|
80 |
+
<?php
|
81 |
}
|
82 |
}
|
form_fields/mw_form_field_file.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Name: MW Form Field File
|
4 |
+
* URI: http://2inc.org
|
5 |
+
* Description: 画像アップロードフィールドを出力。
|
6 |
+
* Version: 1.1
|
7 |
+
* Author: Takashi Kitajima
|
8 |
+
* Author URI: http://2inc.org
|
9 |
+
* Created: May 17, 2013
|
10 |
+
* Modified: May 29, 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
|
17 |
+
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
+
* This program is distributed in the hope that it will be useful,
|
20 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
+
* You should have received a copy of the GNU General Public License
|
25 |
+
* along with this program; if not, write to the Free Software
|
26 |
+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
+
*/
|
28 |
+
class mw_form_field_file extends mw_form_field {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_file';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* setDefaults
|
37 |
+
* $this->defaultsを設定し返す
|
38 |
+
* @return Array defaults
|
39 |
+
*/
|
40 |
+
protected function setDefaults() {
|
41 |
+
return array(
|
42 |
+
'name' => '',
|
43 |
+
'size' => 60,
|
44 |
+
'show_error' => 'true',
|
45 |
+
);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* inputPage
|
50 |
+
* 入力ページでのフォーム項目を返す
|
51 |
+
* @param Array $atts
|
52 |
+
* @return String HTML
|
53 |
+
*/
|
54 |
+
protected function inputPage( $atts ) {
|
55 |
+
$_ret = $this->Form->file( $atts['name'], array(
|
56 |
+
'size' => $atts['size'],
|
57 |
+
) );
|
58 |
+
$value = $this->Form->getValue( $atts['name'] );
|
59 |
+
$upload_file_keys = $this->Form->getValue( MWF_Config::UPLOAD_FILE_KEYS );
|
60 |
+
if ( !empty( $value ) && is_array( $upload_file_keys ) && in_array( $atts['name'], $upload_file_keys ) ) {
|
61 |
+
$_ret .= '<div class="<?php echo MWF_Config::NAME; ?>_file">';
|
62 |
+
$_ret .= '<a href="' . esc_attr( $value ) . '" target="_blank">' . __( 'Uploaded.', MWF_Config::DOMAIN ) . '</a>';
|
63 |
+
$_ret .= $this->Form->hidden( $atts['name'], $value );
|
64 |
+
$_ret .= '</div>';
|
65 |
+
}
|
66 |
+
if ( $atts['show_error'] !== 'false' )
|
67 |
+
$_ret .= $this->getError( $atts['name'] );
|
68 |
+
return $_ret;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* previewPage
|
73 |
+
* 確認ページでのフォーム項目を返す
|
74 |
+
* @param Array $atts
|
75 |
+
* @return String HTML
|
76 |
+
*/
|
77 |
+
protected function previewPage( $atts ) {
|
78 |
+
$value = $this->Form->getValue( $atts['name'] );
|
79 |
+
$_ret = '<div class="<?php echo MWF_Config::NAME; ?>_file">';
|
80 |
+
$_ret .= '<a href="' . esc_attr( $value ) . '" target="_blank">' . __( 'Uploaded.', MWF_Config::DOMAIN ) . '</a>';
|
81 |
+
$_ret .= '</div>';
|
82 |
+
$_ret .= $this->Form->hidden( $atts['name'], $value );
|
83 |
+
return $_ret;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* add_qtags
|
88 |
+
* QTags.addButton を出力
|
89 |
+
*/
|
90 |
+
protected function add_qtags() {
|
91 |
+
?>
|
92 |
+
'<?php echo $this->short_code_name; ?>',
|
93 |
+
'<?php _e( 'File', MWF_Config::DOMAIN ); ?>',
|
94 |
+
'[<?php echo $this->short_code_name; ?> name=""]',
|
95 |
+
''
|
96 |
+
<?php
|
97 |
+
}
|
98 |
+
}
|
form_fields/mw_form_field_hidden.php
CHANGED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Hidden
|
4 |
* URI: http://2inc.org
|
5 |
* Description: hiddenフィールドを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_hidden extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -41,19 +47,34 @@ class mw_form_field_hidden extends mw_form_field {
|
|
41 |
/**
|
42 |
* inputPage
|
43 |
* 入力ページでのフォーム項目を返す
|
|
|
44 |
* @return String HTML
|
45 |
*/
|
46 |
-
protected function inputPage() {
|
47 |
-
return $this->Form->hidden( $
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* previewPage
|
52 |
* 確認ページでのフォーム項目を返す
|
|
|
53 |
* @return String HTML
|
54 |
*/
|
55 |
-
protected function previewPage() {
|
56 |
-
$value = $this->Form->getValue( $
|
57 |
-
return $this->Form->hidden( $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
}
|
3 |
* Name: MW Form Field Hidden
|
4 |
* URI: http://2inc.org
|
5 |
* Description: hiddenフィールドを出力。
|
6 |
+
* Version: 1.1
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
10 |
+
* Modified: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_hidden extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_hidden';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
47 |
/**
|
48 |
* inputPage
|
49 |
* 入力ページでのフォーム項目を返す
|
50 |
+
* @param Array $atts
|
51 |
* @return String HTML
|
52 |
*/
|
53 |
+
protected function inputPage( $atts ) {
|
54 |
+
return $this->Form->hidden( $atts['name'], $atts['value'] );
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
* previewPage
|
59 |
* 確認ページでのフォーム項目を返す
|
60 |
+
* @param Array $atts
|
61 |
* @return String HTML
|
62 |
*/
|
63 |
+
protected function previewPage( $atts ) {
|
64 |
+
$value = $this->Form->getValue( $atts['name'] );
|
65 |
+
return $this->Form->hidden( $atts['name'], $value );
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* add_qtags
|
70 |
+
* QTags.addButton を出力
|
71 |
+
*/
|
72 |
+
protected function add_qtags() {
|
73 |
+
?>
|
74 |
+
'<?php echo $this->short_code_name; ?>',
|
75 |
+
'<?php _e( 'Hidden', MWF_Config::DOMAIN ); ?>',
|
76 |
+
'[<?php echo $this->short_code_name; ?> name=""]',
|
77 |
+
''
|
78 |
+
<?php
|
79 |
}
|
80 |
}
|
form_fields/mw_form_field_image.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Name: MW Form Field Image
|
4 |
+
* URI: http://2inc.org
|
5 |
+
* Description: 画像アップロードフィールドを出力。
|
6 |
+
* Version: 1.1
|
7 |
+
* Author: Takashi Kitajima
|
8 |
+
* Author URI: http://2inc.org
|
9 |
+
* Created: May 17, 2013
|
10 |
+
* Modified: May 29, 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
|
17 |
+
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
+
* This program is distributed in the hope that it will be useful,
|
20 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
+
* You should have received a copy of the GNU General Public License
|
25 |
+
* along with this program; if not, write to the Free Software
|
26 |
+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
+
*/
|
28 |
+
class mw_form_field_image extends mw_form_field {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_image';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* setDefaults
|
37 |
+
* $this->defaultsを設定し返す
|
38 |
+
* @return Array defaults
|
39 |
+
*/
|
40 |
+
protected function setDefaults() {
|
41 |
+
return array(
|
42 |
+
'name' => '',
|
43 |
+
'size' => 60,
|
44 |
+
'show_error' => 'true',
|
45 |
+
);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* inputPage
|
50 |
+
* 入力ページでのフォーム項目を返す
|
51 |
+
* @param Array $atts
|
52 |
+
* @return String HTML
|
53 |
+
*/
|
54 |
+
protected function inputPage( $atts ) {
|
55 |
+
$_ret = $this->Form->file( $atts['name'], array(
|
56 |
+
'size' => $atts['size'],
|
57 |
+
) );
|
58 |
+
$value = $this->Form->getValue( $atts['name'] );
|
59 |
+
$upload_file_keys = $this->Form->getValue( MWF_Config::UPLOAD_FILE_KEYS );
|
60 |
+
if ( !empty( $value ) && is_array( $upload_file_keys ) && in_array( $atts['name'], $upload_file_keys ) ) {
|
61 |
+
$_ret .= '<div class="<?php echo MWF_Config::NAME; ?>_image">';
|
62 |
+
$_ret .= '<img src="' . esc_attr( $value ) . '" alt="" />';
|
63 |
+
$_ret .= $this->Form->hidden( $atts['name'], $value );
|
64 |
+
$_ret .= '</div>';
|
65 |
+
}
|
66 |
+
if ( $atts['show_error'] !== 'false' )
|
67 |
+
$_ret .= $this->getError( $atts['name'] );
|
68 |
+
return $_ret;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* previewPage
|
73 |
+
* 確認ページでのフォーム項目を返す
|
74 |
+
* @param Array $atts
|
75 |
+
* @return String HTML
|
76 |
+
*/
|
77 |
+
protected function previewPage( $atts ) {
|
78 |
+
$value = $this->Form->getValue( $atts['name'] );
|
79 |
+
$_ret = '<div class="<?php echo MWF_Config::NAME; ?>_image">';
|
80 |
+
$_ret .= '<img src="' . esc_attr( $value ) . '" alt="" />';
|
81 |
+
$_ret .= $this->Form->hidden( $atts['name'], $value );
|
82 |
+
$_ret .= '</div>';
|
83 |
+
return $_ret;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* add_qtags
|
88 |
+
* QTags.addButton を出力
|
89 |
+
*/
|
90 |
+
protected function add_qtags() {
|
91 |
+
?>
|
92 |
+
'<?php echo $this->short_code_name; ?>',
|
93 |
+
'<?php _e( 'Image', MWF_Config::DOMAIN ); ?>',
|
94 |
+
'[<?php echo $this->short_code_name; ?> name=""]',
|
95 |
+
''
|
96 |
+
<?php
|
97 |
+
}
|
98 |
+
}
|
form_fields/mw_form_field_password.php
CHANGED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Password
|
4 |
* URI: http://2inc.org
|
5 |
* Description: パスワードフィールドを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_password extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -44,26 +50,41 @@ class mw_form_field_password extends mw_form_field {
|
|
44 |
/**
|
45 |
* inputPage
|
46 |
* 入力ページでのフォーム項目を返す
|
|
|
47 |
* @return String HTML
|
48 |
*/
|
49 |
-
protected function inputPage() {
|
50 |
-
$_ret = $this->Form->password( $
|
51 |
-
'size' => $
|
52 |
-
'maxlength' => $
|
53 |
-
'value' => $
|
54 |
) );
|
55 |
-
if ( $
|
56 |
-
$_ret .= $this->getError( $
|
57 |
return $_ret;
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
* previewPage
|
62 |
* 確認ページでのフォーム項目を返す
|
|
|
63 |
* @return String HTML
|
64 |
*/
|
65 |
-
protected function previewPage() {
|
66 |
-
$value = $this->Form->getValue( $
|
67 |
-
return '*****' . $this->Form->hidden( $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
}
|
3 |
* Name: MW Form Field Password
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_password extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_password';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
50 |
/**
|
51 |
* inputPage
|
52 |
* 入力ページでのフォーム項目を返す
|
53 |
+
* @param Array $atts
|
54 |
* @return String HTML
|
55 |
*/
|
56 |
+
protected function inputPage( $atts ) {
|
57 |
+
$_ret = $this->Form->password( $atts['name'], array(
|
58 |
+
'size' => $atts['size'],
|
59 |
+
'maxlength' => $atts['maxlength'],
|
60 |
+
'value' => $atts['value'],
|
61 |
) );
|
62 |
+
if ( $atts['show_error'] !== 'false' )
|
63 |
+
$_ret .= $this->getError( $atts['name'] );
|
64 |
return $_ret;
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
* previewPage
|
69 |
* 確認ページでのフォーム項目を返す
|
70 |
+
* @param Array $atts
|
71 |
* @return String HTML
|
72 |
*/
|
73 |
+
protected function previewPage( $atts ) {
|
74 |
+
$value = $this->Form->getValue( $atts['name'] );
|
75 |
+
return '*****' . $this->Form->hidden( $atts['name'], $atts );
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* add_qtags
|
80 |
+
* QTags.addButton を出力
|
81 |
+
*/
|
82 |
+
protected function add_qtags() {
|
83 |
+
?>
|
84 |
+
'<?php echo $this->short_code_name; ?>',
|
85 |
+
'<?php _e( 'Password', MWF_Config::DOMAIN ); ?>',
|
86 |
+
'[<?php echo $this->short_code_name; ?> name=""]',
|
87 |
+
''
|
88 |
+
<?php
|
89 |
}
|
90 |
}
|
form_fields/mw_form_field_preview_button.php
CHANGED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Preview Button
|
4 |
* URI: http://2inc.org
|
5 |
* Description: 確認ボタンを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_preview_button extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -33,24 +39,35 @@ class mw_form_field_preview_button extends mw_form_field {
|
|
33 |
*/
|
34 |
protected function setDefaults() {
|
35 |
return array(
|
36 |
-
'value' => __( 'Confirm',
|
37 |
);
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
* inputPage
|
42 |
* 入力ページでのフォーム項目を返す
|
|
|
43 |
* @return String HTML
|
44 |
*/
|
45 |
-
protected function inputPage() {
|
46 |
-
return $this->Form->submit( $this->Form->getPreviewButtonName(), $
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
* previewPage
|
51 |
* 確認ページでのフォーム項目を返す
|
|
|
52 |
* @return String HTML
|
53 |
*/
|
54 |
-
protected function previewPage() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
}
|
3 |
* Name: MW Form Field Preview Button
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_preview_button extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_previewButton';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
39 |
*/
|
40 |
protected function setDefaults() {
|
41 |
return array(
|
42 |
+
'value' => __( 'Confirm', MWF_Config::DOMAIN ),
|
43 |
);
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
* inputPage
|
48 |
* 入力ページでのフォーム項目を返す
|
49 |
+
* @param Array $atts
|
50 |
* @return String HTML
|
51 |
*/
|
52 |
+
protected function inputPage( $atts ) {
|
53 |
+
return $this->Form->submit( $this->Form->getPreviewButtonName(), $atts['value'] );
|
54 |
}
|
55 |
|
56 |
/**
|
57 |
* previewPage
|
58 |
* 確認ページでのフォーム項目を返す
|
59 |
+
* @param Array $atts
|
60 |
* @return String HTML
|
61 |
*/
|
62 |
+
protected function previewPage( $atts ) {
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* add_qtags
|
67 |
+
* QTags.addButton を出力
|
68 |
+
*/
|
69 |
+
protected function add_qtags() {
|
70 |
+
}
|
71 |
+
public function _add_qtags() {
|
72 |
}
|
73 |
}
|
form_fields/{mw_form_radio.php → mw_form_field_radio.php}
RENAMED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Radio
|
4 |
* URI: http://2inc.org
|
5 |
* Description: ラジオボタンを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_radio extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -43,28 +49,43 @@ class mw_form_field_radio extends mw_form_field {
|
|
43 |
/**
|
44 |
* inputPage
|
45 |
* 入力ページでのフォーム項目を返す
|
|
|
46 |
* @return String HTML
|
47 |
*/
|
48 |
-
protected function inputPage() {
|
49 |
-
$children = $this->getChildren();
|
50 |
-
$_ret = $this->Form->radio( $
|
51 |
-
'value' => $
|
52 |
) );
|
53 |
-
if ( $
|
54 |
-
$_ret .= $this->getError( $
|
55 |
return $_ret;
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
* previewPage
|
60 |
* 確認ページでのフォーム項目を返す
|
|
|
61 |
* @return String HTML
|
62 |
*/
|
63 |
-
protected function previewPage() {
|
64 |
-
$children = $this->getChildren();
|
65 |
-
$value = $this->Form->getRadioValue( $
|
66 |
$_ret = $value;
|
67 |
-
$_ret .= $this->Form->hidden( $
|
68 |
return $_ret;
|
69 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
3 |
* Name: MW Form Field Radio
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_radio extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_radio';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
49 |
/**
|
50 |
* inputPage
|
51 |
* 入力ページでのフォーム項目を返す
|
52 |
+
* @param Array $atts
|
53 |
* @return String HTML
|
54 |
*/
|
55 |
+
protected function inputPage( $atts ) {
|
56 |
+
$children = $this->getChildren( $atts['children'] );
|
57 |
+
$_ret = $this->Form->radio( $atts['name'], $children, array(
|
58 |
+
'value' => $atts['value'],
|
59 |
) );
|
60 |
+
if ( $atts['show_error'] !== 'false' )
|
61 |
+
$_ret .= $this->getError( $atts['name'] );
|
62 |
return $_ret;
|
63 |
}
|
64 |
|
65 |
/**
|
66 |
* previewPage
|
67 |
* 確認ページでのフォーム項目を返す
|
68 |
+
* @param Array $atts
|
69 |
* @return String HTML
|
70 |
*/
|
71 |
+
protected function previewPage( $atts ) {
|
72 |
+
$children = $this->getChildren( $atts['children'] );
|
73 |
+
$value = $this->Form->getRadioValue( $atts['name'], $children );
|
74 |
$_ret = $value;
|
75 |
+
$_ret .= $this->Form->hidden( $atts['name'], $value );
|
76 |
return $_ret;
|
77 |
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* add_qtags
|
81 |
+
* QTags.addButton を出力
|
82 |
+
*/
|
83 |
+
protected function add_qtags() {
|
84 |
+
?>
|
85 |
+
'<?php echo $this->short_code_name; ?>',
|
86 |
+
'<?php _e( 'Radio', MWF_Config::DOMAIN ); ?>',
|
87 |
+
'[<?php echo $this->short_code_name; ?> name="" children=""]',
|
88 |
+
''
|
89 |
+
<?php
|
90 |
+
}
|
91 |
}
|
form_fields/{mw_form_select.php → mw_form_field_select.php}
RENAMED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Select
|
4 |
* URI: http://2inc.org
|
5 |
* Description: セレクトボックスを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_select extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -43,28 +49,43 @@ class mw_form_field_select extends mw_form_field {
|
|
43 |
/**
|
44 |
* inputPage
|
45 |
* 入力ページでのフォーム項目を返す
|
|
|
46 |
* @return String HTML
|
47 |
*/
|
48 |
-
protected function inputPage() {
|
49 |
-
$children = $this->getChildren();
|
50 |
-
$_ret = $this->Form->select( $
|
51 |
-
'value' => $
|
52 |
) );
|
53 |
-
if ( $
|
54 |
-
$_ret .= $this->getError( $
|
55 |
return $_ret;
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
* previewPage
|
60 |
* 確認ページでのフォーム項目を返す
|
|
|
61 |
* @return String HTML
|
62 |
*/
|
63 |
-
protected function previewPage() {
|
64 |
-
$children = $this->getChildren();
|
65 |
-
$value = $this->Form->getSelectedValue( $
|
66 |
$_ret = $value;
|
67 |
-
$_ret .= $this->Form->hidden( $
|
68 |
return $_ret;
|
69 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
3 |
* Name: MW Form Field Select
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_select extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_select';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
49 |
/**
|
50 |
* inputPage
|
51 |
* 入力ページでのフォーム項目を返す
|
52 |
+
* @param Array $atts
|
53 |
* @return String HTML
|
54 |
*/
|
55 |
+
protected function inputPage( $atts ) {
|
56 |
+
$children = $this->getChildren( $atts['children'] );
|
57 |
+
$_ret = $this->Form->select( $atts['name'], $children, array(
|
58 |
+
'value' => $atts['value'],
|
59 |
) );
|
60 |
+
if ( $atts['show_error'] !== 'false' )
|
61 |
+
$_ret .= $this->getError( $atts['name'] );
|
62 |
return $_ret;
|
63 |
}
|
64 |
|
65 |
/**
|
66 |
* previewPage
|
67 |
* 確認ページでのフォーム項目を返す
|
68 |
+
* @param Array $atts
|
69 |
* @return String HTML
|
70 |
*/
|
71 |
+
protected function previewPage( $atts ) {
|
72 |
+
$children = $this->getChildren( $atts['children'] );
|
73 |
+
$value = $this->Form->getSelectedValue( $atts['name'], $children );
|
74 |
$_ret = $value;
|
75 |
+
$_ret .= $this->Form->hidden( $atts['name'], $value );
|
76 |
return $_ret;
|
77 |
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* add_qtags
|
81 |
+
* QTags.addButton を出力
|
82 |
+
*/
|
83 |
+
protected function add_qtags() {
|
84 |
+
?>
|
85 |
+
'<?php echo $this->short_code_name; ?>',
|
86 |
+
'<?php _e( 'Select', MWF_Config::DOMAIN ); ?>',
|
87 |
+
'[<?php echo $this->short_code_name; ?> name="" children=""]',
|
88 |
+
''
|
89 |
+
<?php
|
90 |
+
}
|
91 |
}
|
form_fields/mw_form_field_submit.php
CHANGED
@@ -3,28 +3,34 @@
|
|
3 |
* Name: MW Form Field Submit Button
|
4 |
* URI: http://2inc.org
|
5 |
* Description: 確認ボタンと送信ボタンを自動出力。同一ページ変遷の場合に利用。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
-
class
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
/**
|
30 |
* setDefaults
|
@@ -34,29 +40,40 @@ class mw_form_field_submit_button extends mw_form_field {
|
|
34 |
protected function setDefaults() {
|
35 |
return array(
|
36 |
'name' => '',
|
37 |
-
'
|
38 |
-
'submit_value' => __( 'Send', self::DOMAIN ),
|
39 |
);
|
40 |
}
|
41 |
|
42 |
/**
|
43 |
* inputPage
|
44 |
* 入力ページでのフォーム項目を返す
|
|
|
45 |
* @return String HTML
|
46 |
*/
|
47 |
-
protected function inputPage() {
|
48 |
-
|
49 |
-
return $this->Form->submit( $this->Form->getPreviewButtonName(), $this->atts['preview_value'] );
|
50 |
-
}
|
51 |
-
return $this->Form->submit( $this->atts['name'], $this->atts['submit_value'] );
|
52 |
}
|
53 |
|
54 |
/**
|
55 |
* previewPage
|
56 |
* 確認ページでのフォーム項目を返す
|
|
|
57 |
* @return String HTML
|
58 |
*/
|
59 |
-
protected function previewPage() {
|
60 |
-
return $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
}
|
3 |
* Name: MW Form Field Submit Button
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
+
class mw_form_field_submit extends mw_form_field {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_submit';
|
34 |
|
35 |
/**
|
36 |
* setDefaults
|
40 |
protected function setDefaults() {
|
41 |
return array(
|
42 |
'name' => '',
|
43 |
+
'value' => __( 'Send', MWF_Config::DOMAIN ),
|
|
|
44 |
);
|
45 |
}
|
46 |
|
47 |
/**
|
48 |
* inputPage
|
49 |
* 入力ページでのフォーム項目を返す
|
50 |
+
* @param Array $atts
|
51 |
* @return String HTML
|
52 |
*/
|
53 |
+
protected function inputPage( $atts ) {
|
54 |
+
return $this->Form->submit( $atts['name'], $atts['value'] );
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
* previewPage
|
59 |
* 確認ページでのフォーム項目を返す
|
60 |
+
* @param Array $atts
|
61 |
* @return String HTML
|
62 |
*/
|
63 |
+
protected function previewPage( $atts ) {
|
64 |
+
return $this->inputPage( $atts );
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* add_qtags
|
69 |
+
* QTags.addButton を出力
|
70 |
+
*/
|
71 |
+
protected function add_qtags() {
|
72 |
+
?>
|
73 |
+
'<?php echo $this->short_code_name; ?>',
|
74 |
+
'<?php _e( 'Submit', MWF_Config::DOMAIN ); ?>',
|
75 |
+
'[<?php echo $this->short_code_name; ?> name="submit"]',
|
76 |
+
''
|
77 |
+
<?php
|
78 |
}
|
79 |
}
|
form_fields/mw_form_field_submit_button.php
CHANGED
@@ -3,28 +3,34 @@
|
|
3 |
* Name: MW Form Field Submit
|
4 |
* URI: http://2inc.org
|
5 |
* Description: サブミットボタンを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
-
class
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
/**
|
30 |
* setDefaults
|
@@ -34,25 +40,44 @@ class mw_form_field_submit extends mw_form_field {
|
|
34 |
protected function setDefaults() {
|
35 |
return array(
|
36 |
'name' => '',
|
37 |
-
'
|
|
|
38 |
);
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
* inputPage
|
43 |
* 入力ページでのフォーム項目を返す
|
|
|
44 |
* @return String HTML
|
45 |
*/
|
46 |
-
protected function inputPage() {
|
47 |
-
|
|
|
|
|
|
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* previewPage
|
52 |
* 確認ページでのフォーム項目を返す
|
|
|
53 |
* @return String HTML
|
54 |
*/
|
55 |
-
protected function previewPage() {
|
56 |
-
return $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
}
|
3 |
* Name: MW Form Field Submit
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
+
class mw_form_field_submit_button extends mw_form_field {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_submitButton';
|
34 |
|
35 |
/**
|
36 |
* setDefaults
|
40 |
protected function setDefaults() {
|
41 |
return array(
|
42 |
'name' => '',
|
43 |
+
'preview_value' => __( 'Confirm', MWF_Config::DOMAIN ),
|
44 |
+
'submit_value' => __( 'Send', MWF_Config::DOMAIN ),
|
45 |
);
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
* inputPage
|
50 |
* 入力ページでのフォーム項目を返す
|
51 |
+
* @param Array $atts
|
52 |
* @return String HTML
|
53 |
*/
|
54 |
+
protected function inputPage( $atts ) {
|
55 |
+
if ( !empty( $atts['preview_value'] ) ) {
|
56 |
+
return $this->Form->submit( $this->Form->getPreviewButtonName(), $atts['preview_value'] );
|
57 |
+
}
|
58 |
+
return $this->Form->submit( $atts['name'], $atts['submit_value'] );
|
59 |
}
|
60 |
|
61 |
/**
|
62 |
* previewPage
|
63 |
* 確認ページでのフォーム項目を返す
|
64 |
+
* @param Array $atts
|
65 |
* @return String HTML
|
66 |
*/
|
67 |
+
protected function previewPage( $atts ) {
|
68 |
+
return $this->Form->submit( $atts['name'], $atts['submit_value'] );
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* add_qtags
|
73 |
+
* QTags.addButton を出力
|
74 |
+
*/
|
75 |
+
protected function add_qtags() {
|
76 |
+
?>
|
77 |
+
'<?php echo $this->short_code_name; ?>',
|
78 |
+
'<?php _e( 'Confirm & Submit', MWF_Config::DOMAIN ); ?>',
|
79 |
+
'[<?php echo $this->short_code_name; ?>]',
|
80 |
+
''
|
81 |
+
<?php
|
82 |
}
|
83 |
}
|
form_fields/mw_form_field_tel.php
CHANGED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Tel
|
4 |
* URI: http://2inc.org
|
5 |
* Description: 電話番号フィールドを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_tel extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -41,25 +47,40 @@ class mw_form_field_tel extends mw_form_field {
|
|
41 |
/**
|
42 |
* inputPage
|
43 |
* 入力ページでのフォーム項目を返す
|
|
|
44 |
* @return String HTML
|
45 |
*/
|
46 |
-
protected function inputPage() {
|
47 |
-
$_ret = $this->Form->tel( $
|
48 |
-
if ( $
|
49 |
-
$_ret .= $this->getError( $
|
50 |
return $_ret;
|
51 |
}
|
52 |
|
53 |
/**
|
54 |
* previewPage
|
55 |
* 確認ページでのフォーム項目を返す
|
|
|
56 |
* @return String HTML
|
57 |
*/
|
58 |
-
protected function previewPage() {
|
59 |
-
$value = $this->Form->getTelValue( $
|
60 |
$_ret = $value;
|
61 |
-
$_ret .= $this->Form->hidden( $
|
62 |
-
$_ret .= $this->Form->separator( $
|
63 |
return $_ret;
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
3 |
* Name: MW Form Field Tel
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_tel extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_tel';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
47 |
/**
|
48 |
* inputPage
|
49 |
* 入力ページでのフォーム項目を返す
|
50 |
+
* @param Array $atts
|
51 |
* @return String HTML
|
52 |
*/
|
53 |
+
protected function inputPage( $atts ) {
|
54 |
+
$_ret = $this->Form->tel( $atts['name'] );
|
55 |
+
if ( $atts['show_error'] !== 'false' )
|
56 |
+
$_ret .= $this->getError( $atts['name'] );
|
57 |
return $_ret;
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
* previewPage
|
62 |
* 確認ページでのフォーム項目を返す
|
63 |
+
* @param Array $atts
|
64 |
* @return String HTML
|
65 |
*/
|
66 |
+
protected function previewPage( $atts ) {
|
67 |
+
$value = $this->Form->getTelValue( $atts['name'] );
|
68 |
$_ret = $value;
|
69 |
+
$_ret .= $this->Form->hidden( $atts['name'].'[data]', $value );
|
70 |
+
$_ret .= $this->Form->separator( $atts['name'] );
|
71 |
return $_ret;
|
72 |
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* add_qtags
|
76 |
+
* QTags.addButton を出力
|
77 |
+
*/
|
78 |
+
protected function add_qtags() {
|
79 |
+
?>
|
80 |
+
'<?php echo $this->short_code_name; ?>',
|
81 |
+
'<?php _e( 'Tel', MWF_Config::DOMAIN ); ?>',
|
82 |
+
'[<?php echo $this->short_code_name; ?> name=""]',
|
83 |
+
''
|
84 |
+
<?php
|
85 |
+
}
|
86 |
}
|
form_fields/mw_form_field_text.php
CHANGED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Text
|
4 |
* URI: http://2inc.org
|
5 |
* Description: テキストフィールドを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_text extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -44,28 +50,43 @@ class mw_form_field_text extends mw_form_field {
|
|
44 |
/**
|
45 |
* inputPage
|
46 |
* 入力ページでのフォーム項目を返す
|
|
|
47 |
* @return String HTML
|
48 |
*/
|
49 |
-
protected function inputPage() {
|
50 |
-
$_ret = $this->Form->text( $
|
51 |
-
'size' => $
|
52 |
-
'maxlength' => $
|
53 |
-
'value' => $
|
54 |
) );
|
55 |
-
if ( $
|
56 |
-
$_ret .= $this->getError( $
|
57 |
return $_ret;
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
* previewPage
|
62 |
* 確認ページでのフォーム項目を返す
|
|
|
63 |
* @return String HTML
|
64 |
*/
|
65 |
-
protected function previewPage() {
|
66 |
-
$value = $this->Form->getValue( $
|
67 |
$_ret = $value;
|
68 |
-
$_ret .= $this->Form->hidden( $
|
69 |
return $_ret;
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
3 |
* Name: MW Form Field Text
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_text extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_text';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
50 |
/**
|
51 |
* inputPage
|
52 |
* 入力ページでのフォーム項目を返す
|
53 |
+
* @param Array $atts
|
54 |
* @return String HTML
|
55 |
*/
|
56 |
+
protected function inputPage( $atts ) {
|
57 |
+
$_ret = $this->Form->text( $atts['name'], array(
|
58 |
+
'size' => $atts['size'],
|
59 |
+
'maxlength' => $atts['maxlength'],
|
60 |
+
'value' => $atts['value'],
|
61 |
) );
|
62 |
+
if ( $atts['show_error'] !== 'false' )
|
63 |
+
$_ret .= $this->getError( $atts['name'] );
|
64 |
return $_ret;
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
* previewPage
|
69 |
* 確認ページでのフォーム項目を返す
|
70 |
+
* @param Array $atts
|
71 |
* @return String HTML
|
72 |
*/
|
73 |
+
protected function previewPage( $atts ) {
|
74 |
+
$value = $this->Form->getValue( $atts['name'] );
|
75 |
$_ret = $value;
|
76 |
+
$_ret .= $this->Form->hidden( $atts['name'], $value );
|
77 |
return $_ret;
|
78 |
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* add_qtags
|
82 |
+
* QTags.addButton を出力
|
83 |
+
*/
|
84 |
+
protected function add_qtags() {
|
85 |
+
?>
|
86 |
+
'<?php echo $this->short_code_name; ?>',
|
87 |
+
'<?php _e( 'Text', MWF_Config::DOMAIN ); ?>',
|
88 |
+
'[<?php echo $this->short_code_name; ?> name=""]',
|
89 |
+
''
|
90 |
+
<?php
|
91 |
+
}
|
92 |
}
|
form_fields/{mw_form_textarea.php → mw_form_field_textarea.php}
RENAMED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field TextArea
|
4 |
* URI: http://2inc.org
|
5 |
* Description: テキストエリアを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_textarea extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -44,28 +50,43 @@ class mw_form_field_textarea extends mw_form_field {
|
|
44 |
/**
|
45 |
* inputPage
|
46 |
* 入力ページでのフォーム項目を返す
|
|
|
47 |
* @return String HTML
|
48 |
*/
|
49 |
-
protected function inputPage() {
|
50 |
-
$_ret = $this->Form->textarea( $
|
51 |
-
'cols' => $
|
52 |
-
'rows' => $
|
53 |
-
'value' => $
|
54 |
) );
|
55 |
-
if ( $
|
56 |
-
$_ret .= $this->getError( $
|
57 |
return $_ret;
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
* previewPage
|
62 |
* 確認ページでのフォーム項目を返す
|
|
|
63 |
* @return String HTML
|
64 |
*/
|
65 |
-
protected function previewPage() {
|
66 |
-
$value = $this->Form->getValue( $
|
67 |
$_ret = nl2br( $value );
|
68 |
-
$_ret .= $this->Form->hidden( $
|
69 |
return $_ret;
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
3 |
* Name: MW Form Field TextArea
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_textarea extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_textarea';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
50 |
/**
|
51 |
* inputPage
|
52 |
* 入力ページでのフォーム項目を返す
|
53 |
+
* @param Array $atts
|
54 |
* @return String HTML
|
55 |
*/
|
56 |
+
protected function inputPage( $atts ) {
|
57 |
+
$_ret = $this->Form->textarea( $atts['name'], array(
|
58 |
+
'cols' => $atts['cols'],
|
59 |
+
'rows' => $atts['rows'],
|
60 |
+
'value' => $atts['value'],
|
61 |
) );
|
62 |
+
if ( $atts['show_error'] !== 'false' )
|
63 |
+
$_ret .= $this->getError( $atts['name'] );
|
64 |
return $_ret;
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
* previewPage
|
69 |
* 確認ページでのフォーム項目を返す
|
70 |
+
* @param Array $atts
|
71 |
* @return String HTML
|
72 |
*/
|
73 |
+
protected function previewPage( $atts ) {
|
74 |
+
$value = $this->Form->getValue( $atts['name'] );
|
75 |
$_ret = nl2br( $value );
|
76 |
+
$_ret .= $this->Form->hidden( $atts['name'], $value );
|
77 |
return $_ret;
|
78 |
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* add_qtags
|
82 |
+
* QTags.addButton を出力
|
83 |
+
*/
|
84 |
+
protected function add_qtags() {
|
85 |
+
?>
|
86 |
+
'<?php echo $this->short_code_name; ?>',
|
87 |
+
'<?php _e( 'Textarea', MWF_Config::DOMAIN ); ?>',
|
88 |
+
'[<?php echo $this->short_code_name; ?> name=""]',
|
89 |
+
''
|
90 |
+
<?php
|
91 |
+
}
|
92 |
}
|
form_fields/mw_form_field_zip.php
CHANGED
@@ -3,29 +3,35 @@
|
|
3 |
* Name: MW Form Field Zip
|
4 |
* URI: http://2inc.org
|
5 |
* Description: 郵便番号フィールドを出力。
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
class mw_form_field_zip extends mw_form_field {
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* setDefaults
|
31 |
* $this->defaultsを設定し返す
|
@@ -41,25 +47,40 @@ class mw_form_field_zip extends mw_form_field {
|
|
41 |
/**
|
42 |
* inputPage
|
43 |
* 入力ページでのフォーム項目を返す
|
|
|
44 |
* @return String HTML
|
45 |
*/
|
46 |
-
protected function inputPage() {
|
47 |
-
$_ret = $this->Form->zip( $
|
48 |
-
if ( $
|
49 |
-
$_ret .= $this->getError( $
|
50 |
return $_ret;
|
51 |
}
|
52 |
|
53 |
/**
|
54 |
* previewPage
|
55 |
* 確認ページでのフォーム項目を返す
|
|
|
56 |
* @return String HTML
|
57 |
*/
|
58 |
-
protected function previewPage() {
|
59 |
-
$value = $this->Form->getZipValue( $
|
60 |
$_ret = $value;
|
61 |
-
$_ret .= $this->Form->hidden( $
|
62 |
-
$_ret .= $this->Form->separator( $
|
63 |
return $_ret;
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
3 |
* Name: MW Form Field Zip
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
class mw_form_field_zip extends mw_form_field {
|
29 |
|
30 |
+
/**
|
31 |
+
* String $short_code_name
|
32 |
+
*/
|
33 |
+
protected $short_code_name = 'mwform_zip';
|
34 |
+
|
35 |
/**
|
36 |
* setDefaults
|
37 |
* $this->defaultsを設定し返す
|
47 |
/**
|
48 |
* inputPage
|
49 |
* 入力ページでのフォーム項目を返す
|
50 |
+
* @param Array $atts
|
51 |
* @return String HTML
|
52 |
*/
|
53 |
+
protected function inputPage( $atts ) {
|
54 |
+
$_ret = $this->Form->zip( $atts['name'] );
|
55 |
+
if ( $atts['show_error'] !== 'false' )
|
56 |
+
$_ret .= $this->getError( $atts['name'] );
|
57 |
return $_ret;
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
* previewPage
|
62 |
* 確認ページでのフォーム項目を返す
|
63 |
+
* @param Array $atts
|
64 |
* @return String HTML
|
65 |
*/
|
66 |
+
protected function previewPage( $atts ) {
|
67 |
+
$value = $this->Form->getZipValue( $atts['name'] );
|
68 |
$_ret = $value;
|
69 |
+
$_ret .= $this->Form->hidden( $atts['name'].'[data]', $value );
|
70 |
+
$_ret .= $this->Form->separator( $atts['name'] );
|
71 |
return $_ret;
|
72 |
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* add_qtags
|
76 |
+
* QTags.addButton を出力
|
77 |
+
*/
|
78 |
+
protected function add_qtags() {
|
79 |
+
?>
|
80 |
+
'<?php echo $this->short_code_name; ?>',
|
81 |
+
'<?php _e( 'Zip Code', MWF_Config::DOMAIN ); ?>',
|
82 |
+
'[<?php echo $this->short_code_name; ?> name=""]',
|
83 |
+
''
|
84 |
+
<?php
|
85 |
+
}
|
86 |
}
|
js/admin.js
CHANGED
@@ -45,7 +45,7 @@ jQuery( function( $ ) {
|
|
45 |
* 完了ページの入力エリアからオリジナルボタンを消去
|
46 |
*/
|
47 |
$( window ).on( 'load', function() {
|
48 |
-
$( '#mw-wp-form_complete_message_metabox input[id^="qt_mw-wp-
|
49 |
} );
|
50 |
|
51 |
} );
|
45 |
* 完了ページの入力エリアからオリジナルボタンを消去
|
46 |
*/
|
47 |
$( window ).on( 'load', function() {
|
48 |
+
$( '#mw-wp-form_complete_message_metabox input[id^="qt_mw-wp-form_complete_message_mwform_"]' ).remove();
|
49 |
} );
|
50 |
|
51 |
} );
|
languages/mw-wp-form-ja.mo
CHANGED
Binary file
|
languages/mw-wp-form-ja.po
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
# This file is distributed under the same license as the MW WP Form package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: MW WP Form 0.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/mw-wp-form\n"
|
7 |
-
"POT-Creation-Date: 2013-05
|
8 |
-
"PO-Revision-Date: 2013-05
|
9 |
"Last-Translator: Takashi Kitajima <inc@2inc.org>\n"
|
10 |
"Language-Team: Takashi Kitajima <inc@2inc.org>\n"
|
11 |
"MIME-Version: 1.0\n"
|
@@ -18,66 +18,138 @@ msgstr ""
|
|
18 |
"X-Poedit-KeywordsList: __;_e;_x\n"
|
19 |
"X-Poedit-SearchPath-0: ..\n"
|
20 |
|
21 |
-
#: form_fields/mw_form_field_back_button.php:
|
22 |
-
#:
|
23 |
msgid "Back"
|
24 |
msgstr "戻る"
|
25 |
|
26 |
-
#: form_fields/
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
msgid "Confirm"
|
29 |
msgstr "確認画面へ"
|
30 |
|
31 |
-
#: form_fields/
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
msgid "Send"
|
34 |
msgstr "送信する"
|
35 |
|
36 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
msgid "Validation Object is not a MW Validation Class."
|
38 |
msgstr ""
|
39 |
|
|
|
|
|
|
|
|
|
40 |
#: system/mw_validation.php:75
|
41 |
msgid "This is required."
|
42 |
msgstr "必須項目です。"
|
43 |
|
44 |
-
#: system/mw_validation.php:95 system/mw_validation.php:
|
45 |
msgid "Please enter."
|
46 |
msgstr "未入力です。"
|
47 |
|
48 |
-
#: system/mw_validation.php:
|
49 |
msgid "Please enter with a half-width alphabetic character."
|
50 |
msgstr "半角英字で入力してください。"
|
51 |
|
52 |
-
#: system/mw_validation.php:
|
53 |
msgid "Please enter with a half-width number."
|
54 |
msgstr "半角数字で入力してください。"
|
55 |
|
56 |
-
#: system/mw_validation.php:
|
57 |
msgid "Please enter with a half-width alphanumeric character."
|
58 |
msgstr "半角英数字で入力してください。"
|
59 |
|
60 |
-
#: system/mw_validation.php:
|
61 |
msgid "This is not the format of a zip code."
|
62 |
msgstr "郵便番号の形式ではありません。"
|
63 |
|
64 |
-
#: system/mw_validation.php:
|
65 |
msgid "This is not the format of a tel number."
|
66 |
msgstr "電話番号の形式ではありません。"
|
67 |
|
68 |
-
#: system/mw_validation.php:
|
69 |
msgid "This is not the format of a mail address."
|
70 |
msgstr "メールアドレスの形式ではありません。"
|
71 |
|
72 |
-
#: system/mw_validation.php:
|
73 |
msgid "This is not the format of a url."
|
74 |
msgstr "URLの形式ではありません。"
|
75 |
|
76 |
-
#: system/mw_validation.php:
|
77 |
msgid "This is not in agreement."
|
78 |
msgstr "一致しません。"
|
79 |
|
80 |
-
#: system/mw_validation.php:
|
81 |
msgid "The number of characters is invalid."
|
82 |
msgstr "文字数が正しくありません。"
|
83 |
|
@@ -93,151 +165,103 @@ msgstr "値が不正です。"
|
|
93 |
msgid "This is not the format of a date."
|
94 |
msgstr "日付の形式ではありません。"
|
95 |
|
96 |
-
#: system/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
msgid "Add New Form"
|
98 |
msgstr "フォームを追加"
|
99 |
|
100 |
-
#: system/mw_wp_form_admin_page.php:
|
101 |
msgid "Edit Form"
|
102 |
msgstr "フォームを編集"
|
103 |
|
104 |
-
#: system/mw_wp_form_admin_page.php:
|
105 |
msgid "New Form"
|
106 |
msgstr "新しいフォーム"
|
107 |
|
108 |
-
#: system/mw_wp_form_admin_page.php:
|
109 |
msgid "View Form"
|
110 |
msgstr "フォームを表示"
|
111 |
|
112 |
-
#: system/mw_wp_form_admin_page.php:
|
113 |
msgid "Search Forms"
|
114 |
msgstr "フォームを検索"
|
115 |
|
116 |
-
#: system/mw_wp_form_admin_page.php:
|
117 |
msgid "No Forms found"
|
118 |
msgstr "フォームがありません"
|
119 |
|
120 |
-
#: system/mw_wp_form_admin_page.php:
|
121 |
msgid "No Forms found in Trash"
|
122 |
msgstr "ゴミ箱にフォームはありません"
|
123 |
|
124 |
-
#: system/mw_wp_form_admin_page.php:
|
125 |
msgid "Edit "
|
126 |
msgstr "編集"
|
127 |
|
128 |
-
#: system/mw_wp_form_admin_page.php:
|
129 |
msgid "View"
|
130 |
msgstr "表示"
|
131 |
|
132 |
-
#: system/mw_wp_form_admin_page.php:
|
133 |
msgid "Search"
|
134 |
msgstr "検索"
|
135 |
|
136 |
-
#: system/mw_wp_form_admin_page.php:
|
137 |
msgid "No data found"
|
138 |
msgstr "データがありません"
|
139 |
|
140 |
-
#: system/mw_wp_form_admin_page.php:
|
141 |
msgid "No data found in Trash"
|
142 |
msgstr "ゴミ箱にデータはありません"
|
143 |
|
144 |
-
#: system/mw_wp_form_admin_page.php:
|
145 |
msgid "Complete Message"
|
146 |
msgstr "完了画面メッセージ"
|
147 |
|
148 |
-
#: system/mw_wp_form_admin_page.php:
|
149 |
msgid "URL Options"
|
150 |
msgstr "URL設定"
|
151 |
|
152 |
-
#: system/mw_wp_form_admin_page.php:
|
153 |
msgid "Validation Rule"
|
154 |
msgstr "バリデーションルール"
|
155 |
|
156 |
-
#: system/mw_wp_form_admin_page.php:
|
157 |
msgid "Form Key"
|
158 |
msgstr "フォーム識別子"
|
159 |
|
160 |
-
#: system/mw_wp_form_admin_page.php:
|
161 |
msgid "Automatic Reply Email Options"
|
162 |
msgstr "自動返信メール設定"
|
163 |
|
164 |
-
#: system/mw_wp_form_admin_page.php:
|
165 |
msgid "Admin Email Options"
|
166 |
msgstr "管理者宛メール設定"
|
167 |
|
168 |
-
#: system/mw_wp_form_admin_page.php:
|
169 |
msgid "settings"
|
170 |
msgstr "設定"
|
171 |
|
172 |
-
#: system/mw_wp_form_admin_page.php:
|
173 |
msgid "Custom Fields"
|
174 |
msgstr "カスタムフィールド"
|
175 |
|
176 |
-
#: system/mw_wp_form_admin_page.php:
|
177 |
-
msgid "Text"
|
178 |
-
msgstr "テキストフィールド"
|
179 |
-
|
180 |
-
#: system/mw_wp_form_admin_page.php:237
|
181 |
-
msgid "Textarea"
|
182 |
-
msgstr "テキストエリア"
|
183 |
-
|
184 |
-
#: system/mw_wp_form_admin_page.php:243
|
185 |
-
msgid "Zip Code"
|
186 |
-
msgstr "郵便番号"
|
187 |
-
|
188 |
-
#: system/mw_wp_form_admin_page.php:249 system/mw_wp_form_admin_page.php:556
|
189 |
-
msgid "Tel"
|
190 |
-
msgstr "電話番号"
|
191 |
-
|
192 |
-
#: system/mw_wp_form_admin_page.php:255
|
193 |
-
msgid "Select"
|
194 |
-
msgstr "セレクトボックス"
|
195 |
-
|
196 |
-
#: system/mw_wp_form_admin_page.php:261
|
197 |
-
msgid "Radio"
|
198 |
-
msgstr "ラジオボタン"
|
199 |
-
|
200 |
-
#: system/mw_wp_form_admin_page.php:267
|
201 |
-
msgid "Checkbox"
|
202 |
-
msgstr "チェックボックス"
|
203 |
-
|
204 |
-
#: system/mw_wp_form_admin_page.php:273
|
205 |
-
msgid "Datepicker"
|
206 |
-
msgstr "日付"
|
207 |
-
|
208 |
-
#: system/mw_wp_form_admin_page.php:279
|
209 |
-
msgid "Password"
|
210 |
-
msgstr "パスワードフィールド"
|
211 |
-
|
212 |
-
#: system/mw_wp_form_admin_page.php:291
|
213 |
-
msgid "Confirm & Submit"
|
214 |
-
msgstr "確認・送信"
|
215 |
-
|
216 |
-
#: system/mw_wp_form_admin_page.php:297
|
217 |
-
msgid "Submit"
|
218 |
-
msgstr "送信"
|
219 |
-
|
220 |
-
#: system/mw_wp_form_admin_page.php:303
|
221 |
-
msgid "Button"
|
222 |
-
msgstr "ボタン"
|
223 |
-
|
224 |
-
#: system/mw_wp_form_admin_page.php:309
|
225 |
-
msgid "Hidden"
|
226 |
-
msgstr "hiddenフィールド"
|
227 |
-
|
228 |
-
#: system/mw_wp_form_admin_page.php:315
|
229 |
-
msgid "Error Message"
|
230 |
-
msgstr "エラーメッセージ"
|
231 |
-
|
232 |
-
#: system/mw_wp_form_admin_page.php:395
|
233 |
msgid "Copy and Paste this shortcode."
|
234 |
msgstr "このショートコードをコピー&ペーストしてください。"
|
235 |
|
236 |
-
#: system/mw_wp_form_admin_page.php:
|
237 |
msgid "Activate Query string of post"
|
238 |
msgstr "URL引数を有効にする"
|
239 |
|
240 |
-
#: system/mw_wp_form_admin_page.php:
|
241 |
msgid ""
|
242 |
"If this field is active, MW WP Form get the post as query string \"post_id\" "
|
243 |
"and you can use $post's property in editor"
|
@@ -245,35 +269,35 @@ msgstr ""
|
|
245 |
"有効にした場合、MW WP FormはURL引数 ”post_id\" をもとに投稿を取得して、その投"
|
246 |
"稿($post) のプロパティを使用できるようになります。"
|
247 |
|
248 |
-
#: system/mw_wp_form_admin_page.php:
|
249 |
msgid "Example: {ID}, {post_title}, {post_meta} etc..."
|
250 |
msgstr "例:{ID}、{post_title}、{post_meta}など…"
|
251 |
|
252 |
-
#: system/mw_wp_form_admin_page.php:
|
253 |
msgid "Saving contact data in database"
|
254 |
msgstr "問い合わせデータをデータベースに保存"
|
255 |
|
256 |
-
#: system/mw_wp_form_admin_page.php:
|
257 |
msgid "Subject"
|
258 |
msgstr "件名"
|
259 |
|
260 |
-
#: system/mw_wp_form_admin_page.php:
|
261 |
msgid "Ccontent"
|
262 |
msgstr "本文"
|
263 |
|
264 |
-
#: system/mw_wp_form_admin_page.php:
|
265 |
msgid "{key} is converted form data."
|
266 |
msgstr "{キー}でそのフォーム項目に変換されます。"
|
267 |
|
268 |
-
#: system/mw_wp_form_admin_page.php:
|
269 |
msgid "Automatic reply email"
|
270 |
msgstr "自動返信メール"
|
271 |
|
272 |
-
#: system/mw_wp_form_admin_page.php:
|
273 |
msgid "Please input the key to use as transmission to automatic reply email."
|
274 |
msgstr "自動返信メールに使用する項目のキーを入力してください。"
|
275 |
|
276 |
-
#: system/mw_wp_form_admin_page.php:
|
277 |
msgid ""
|
278 |
"If Admin Email Options is a blank, Automatic Replay Email Options is used as "
|
279 |
"Admin Email Options."
|
@@ -281,79 +305,95 @@ msgstr ""
|
|
281 |
"管理者宛メール設定が空のときは自動返信メール設定が管理者宛メール設定が使用さ"
|
282 |
"れます。"
|
283 |
|
284 |
-
#: system/mw_wp_form_admin_page.php:
|
285 |
msgid "To ( E-mail address )"
|
286 |
msgstr "送信先(E-mailアドレス)"
|
287 |
|
288 |
-
#: system/mw_wp_form_admin_page.php:
|
289 |
msgid "If empty: Using admin E-mail address."
|
290 |
msgstr "未入力の場合:管理者のE-mailアドレスを使用します。"
|
291 |
|
292 |
-
#: system/mw_wp_form_admin_page.php:
|
293 |
msgid "Input Page URL"
|
294 |
msgstr "入力画面URL"
|
295 |
|
296 |
-
#: system/mw_wp_form_admin_page.php:
|
297 |
msgid "Confirmation Page URL"
|
298 |
msgstr "確認画面URL"
|
299 |
|
300 |
-
#: system/mw_wp_form_admin_page.php:
|
301 |
msgid "Complete Page URL"
|
302 |
msgstr "完了画面URL"
|
303 |
|
304 |
-
#: system/mw_wp_form_admin_page.php:
|
305 |
msgid "Add Validation rule"
|
306 |
msgstr "バリデーションルールを追加"
|
307 |
|
308 |
-
#: system/mw_wp_form_admin_page.php:
|
309 |
msgid "The key which applies validation"
|
310 |
msgstr "バリデーションを適用する項目"
|
311 |
|
312 |
-
#: system/mw_wp_form_admin_page.php:
|
313 |
msgid "No empty"
|
314 |
msgstr "必須項目"
|
315 |
|
316 |
-
#: system/mw_wp_form_admin_page.php:
|
317 |
msgid "No empty( with checkbox )"
|
318 |
msgstr "必須項目(チェックボックス)"
|
319 |
|
320 |
-
#: system/mw_wp_form_admin_page.php:
|
321 |
msgid "Numeric"
|
322 |
msgstr "半角数字"
|
323 |
|
324 |
-
#: system/mw_wp_form_admin_page.php:
|
325 |
msgid "Alphabet"
|
326 |
msgstr "半角英字"
|
327 |
|
328 |
-
#: system/mw_wp_form_admin_page.php:
|
329 |
msgid "Alphabet and Numeric"
|
330 |
msgstr "半角英数字"
|
331 |
|
332 |
-
#: system/mw_wp_form_admin_page.php:
|
333 |
msgid "Zip code"
|
334 |
msgstr "郵便番号"
|
335 |
|
336 |
-
#: system/mw_wp_form_admin_page.php:
|
337 |
msgid "E-mail"
|
338 |
msgstr "メールアドレス"
|
339 |
|
340 |
-
#: system/mw_wp_form_admin_page.php:
|
341 |
msgid "Date"
|
342 |
msgstr "日付"
|
343 |
|
344 |
-
#: system/mw_wp_form_admin_page.php:
|
345 |
msgid "The key at same value"
|
346 |
msgstr "一致する項目"
|
347 |
|
348 |
-
#: system/mw_wp_form_admin_page.php:
|
349 |
msgid "The range of the number of characters"
|
350 |
msgstr "文字数の範囲"
|
351 |
|
352 |
-
#: system/mw_wp_form_admin_page.php:
|
353 |
msgid "The number of the minimum characters"
|
354 |
msgstr "最小文字数"
|
355 |
|
356 |
-
#: system/mw_wp_form_admin_page.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
msgid "Registed Date"
|
358 |
msgstr "登録日時"
|
359 |
|
2 |
# This file is distributed under the same license as the MW WP Form package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: MW WP Form 0.8\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/mw-wp-form\n"
|
7 |
+
"POT-Creation-Date: 2013-06-05 14:21:16+00:00\n"
|
8 |
+
"PO-Revision-Date: 2013-06-05 23:24+0900\n"
|
9 |
"Last-Translator: Takashi Kitajima <inc@2inc.org>\n"
|
10 |
"Language-Team: Takashi Kitajima <inc@2inc.org>\n"
|
11 |
"MIME-Version: 1.0\n"
|
18 |
"X-Poedit-KeywordsList: __;_e;_x\n"
|
19 |
"X-Poedit-SearchPath-0: ..\n"
|
20 |
|
21 |
+
#: form_fields/mw_form_field_back_button.php:42
|
22 |
+
#: form_fields/mw_form_field_back_button.php:72
|
23 |
msgid "Back"
|
24 |
msgstr "戻る"
|
25 |
|
26 |
+
#: form_fields/mw_form_field_button.php:74
|
27 |
+
msgid "Button"
|
28 |
+
msgstr "ボタン"
|
29 |
+
|
30 |
+
#: form_fields/mw_form_field_checkbox.php:87
|
31 |
+
msgid "Checkbox"
|
32 |
+
msgstr "チェックボックス"
|
33 |
+
|
34 |
+
#: form_fields/mw_form_field_datepicker.php:108
|
35 |
+
msgid "Datepicker"
|
36 |
+
msgstr "日付"
|
37 |
+
|
38 |
+
#: form_fields/mw_form_field_error.php:77
|
39 |
+
msgid "Error Message"
|
40 |
+
msgstr "エラーメッセージ"
|
41 |
+
|
42 |
+
#: form_fields/mw_form_field_file.php:62 form_fields/mw_form_field_file.php:80
|
43 |
+
msgid "Uploaded."
|
44 |
+
msgstr "アップロードしました。"
|
45 |
+
|
46 |
+
#: form_fields/mw_form_field_file.php:93
|
47 |
+
msgid "File"
|
48 |
+
msgstr "ファイルフィールド"
|
49 |
+
|
50 |
+
#: form_fields/mw_form_field_hidden.php:75
|
51 |
+
msgid "Hidden"
|
52 |
+
msgstr "hiddenフィールド"
|
53 |
+
|
54 |
+
#: form_fields/mw_form_field_image.php:93
|
55 |
+
msgid "Image"
|
56 |
+
msgstr "画像フィールド"
|
57 |
+
|
58 |
+
#: form_fields/mw_form_field_password.php:85
|
59 |
+
msgid "Password"
|
60 |
+
msgstr "パスワードフィールド"
|
61 |
+
|
62 |
+
#: form_fields/mw_form_field_preview_button.php:42
|
63 |
+
#: form_fields/mw_form_field_submit_button.php:43
|
64 |
msgid "Confirm"
|
65 |
msgstr "確認画面へ"
|
66 |
|
67 |
+
#: form_fields/mw_form_field_radio.php:86
|
68 |
+
msgid "Radio"
|
69 |
+
msgstr "ラジオボタン"
|
70 |
+
|
71 |
+
#: form_fields/mw_form_field_select.php:86
|
72 |
+
msgid "Select"
|
73 |
+
msgstr "セレクトボックス"
|
74 |
+
|
75 |
+
#: form_fields/mw_form_field_submit.php:43
|
76 |
+
#: form_fields/mw_form_field_submit_button.php:44
|
77 |
msgid "Send"
|
78 |
msgstr "送信する"
|
79 |
|
80 |
+
#: form_fields/mw_form_field_submit.php:74
|
81 |
+
msgid "Submit"
|
82 |
+
msgstr "送信"
|
83 |
+
|
84 |
+
#: form_fields/mw_form_field_submit_button.php:78
|
85 |
+
msgid "Confirm & Submit"
|
86 |
+
msgstr "確認・送信"
|
87 |
+
|
88 |
+
#: form_fields/mw_form_field_tel.php:81 system/mw_wp_form_admin_page.php:510
|
89 |
+
msgid "Tel"
|
90 |
+
msgstr "電話番号"
|
91 |
+
|
92 |
+
#: form_fields/mw_form_field_text.php:87
|
93 |
+
msgid "Text"
|
94 |
+
msgstr "テキストフィールド"
|
95 |
+
|
96 |
+
#: form_fields/mw_form_field_textarea.php:87
|
97 |
+
msgid "Textarea"
|
98 |
+
msgstr "テキストエリア"
|
99 |
+
|
100 |
+
#: form_fields/mw_form_field_zip.php:81
|
101 |
+
msgid "Zip Code"
|
102 |
+
msgstr "郵便番号"
|
103 |
+
|
104 |
+
#: mw-wp-form.php:311
|
105 |
msgid "Validation Object is not a MW Validation Class."
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: mw-wp-form.php:443
|
109 |
+
msgid "Uploaded from "
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
#: system/mw_validation.php:75
|
113 |
msgid "This is required."
|
114 |
msgstr "必須項目です。"
|
115 |
|
116 |
+
#: system/mw_validation.php:95 system/mw_validation.php:115
|
117 |
msgid "Please enter."
|
118 |
msgstr "未入力です。"
|
119 |
|
120 |
+
#: system/mw_validation.php:137
|
121 |
msgid "Please enter with a half-width alphabetic character."
|
122 |
msgstr "半角英字で入力してください。"
|
123 |
|
124 |
+
#: system/mw_validation.php:157
|
125 |
msgid "Please enter with a half-width number."
|
126 |
msgstr "半角数字で入力してください。"
|
127 |
|
128 |
+
#: system/mw_validation.php:177
|
129 |
msgid "Please enter with a half-width alphanumeric character."
|
130 |
msgstr "半角英数字で入力してください。"
|
131 |
|
132 |
+
#: system/mw_validation.php:197
|
133 |
msgid "This is not the format of a zip code."
|
134 |
msgstr "郵便番号の形式ではありません。"
|
135 |
|
136 |
+
#: system/mw_validation.php:224
|
137 |
msgid "This is not the format of a tel number."
|
138 |
msgstr "電話番号の形式ではありません。"
|
139 |
|
140 |
+
#: system/mw_validation.php:251
|
141 |
msgid "This is not the format of a mail address."
|
142 |
msgstr "メールアドレスの形式ではありません。"
|
143 |
|
144 |
+
#: system/mw_validation.php:271
|
145 |
msgid "This is not the format of a url."
|
146 |
msgstr "URLの形式ではありません。"
|
147 |
|
148 |
+
#: system/mw_validation.php:292
|
149 |
msgid "This is not in agreement."
|
150 |
msgstr "一致しません。"
|
151 |
|
152 |
+
#: system/mw_validation.php:316
|
153 |
msgid "The number of characters is invalid."
|
154 |
msgstr "文字数が正しくありません。"
|
155 |
|
165 |
msgid "This is not the format of a date."
|
166 |
msgstr "日付の形式ではありません。"
|
167 |
|
168 |
+
#: system/mw_validation.php:426
|
169 |
+
msgid "This file is invalid."
|
170 |
+
msgstr "許可されたファイルではありません。"
|
171 |
+
|
172 |
+
#: system/mw_validation.php:456
|
173 |
+
msgid "This file size is too big."
|
174 |
+
msgstr "ファイルサイズが大きすぎます。"
|
175 |
+
|
176 |
+
#: system/mw_wp_form_admin_page.php:66
|
177 |
msgid "Add New Form"
|
178 |
msgstr "フォームを追加"
|
179 |
|
180 |
+
#: system/mw_wp_form_admin_page.php:67
|
181 |
msgid "Edit Form"
|
182 |
msgstr "フォームを編集"
|
183 |
|
184 |
+
#: system/mw_wp_form_admin_page.php:68
|
185 |
msgid "New Form"
|
186 |
msgstr "新しいフォーム"
|
187 |
|
188 |
+
#: system/mw_wp_form_admin_page.php:69
|
189 |
msgid "View Form"
|
190 |
msgstr "フォームを表示"
|
191 |
|
192 |
+
#: system/mw_wp_form_admin_page.php:70
|
193 |
msgid "Search Forms"
|
194 |
msgstr "フォームを検索"
|
195 |
|
196 |
+
#: system/mw_wp_form_admin_page.php:71
|
197 |
msgid "No Forms found"
|
198 |
msgstr "フォームがありません"
|
199 |
|
200 |
+
#: system/mw_wp_form_admin_page.php:72
|
201 |
msgid "No Forms found in Trash"
|
202 |
msgstr "ゴミ箱にフォームはありません"
|
203 |
|
204 |
+
#: system/mw_wp_form_admin_page.php:93
|
205 |
msgid "Edit "
|
206 |
msgstr "編集"
|
207 |
|
208 |
+
#: system/mw_wp_form_admin_page.php:94
|
209 |
msgid "View"
|
210 |
msgstr "表示"
|
211 |
|
212 |
+
#: system/mw_wp_form_admin_page.php:95
|
213 |
msgid "Search"
|
214 |
msgstr "検索"
|
215 |
|
216 |
+
#: system/mw_wp_form_admin_page.php:96
|
217 |
msgid "No data found"
|
218 |
msgstr "データがありません"
|
219 |
|
220 |
+
#: system/mw_wp_form_admin_page.php:97
|
221 |
msgid "No data found in Trash"
|
222 |
msgstr "ゴミ箱にデータはありません"
|
223 |
|
224 |
+
#: system/mw_wp_form_admin_page.php:135
|
225 |
msgid "Complete Message"
|
226 |
msgstr "完了画面メッセージ"
|
227 |
|
228 |
+
#: system/mw_wp_form_admin_page.php:142
|
229 |
msgid "URL Options"
|
230 |
msgstr "URL設定"
|
231 |
|
232 |
+
#: system/mw_wp_form_admin_page.php:149
|
233 |
msgid "Validation Rule"
|
234 |
msgstr "バリデーションルール"
|
235 |
|
236 |
+
#: system/mw_wp_form_admin_page.php:156
|
237 |
msgid "Form Key"
|
238 |
msgstr "フォーム識別子"
|
239 |
|
240 |
+
#: system/mw_wp_form_admin_page.php:163
|
241 |
msgid "Automatic Reply Email Options"
|
242 |
msgstr "自動返信メール設定"
|
243 |
|
244 |
+
#: system/mw_wp_form_admin_page.php:170
|
245 |
msgid "Admin Email Options"
|
246 |
msgstr "管理者宛メール設定"
|
247 |
|
248 |
+
#: system/mw_wp_form_admin_page.php:177
|
249 |
msgid "settings"
|
250 |
msgstr "設定"
|
251 |
|
252 |
+
#: system/mw_wp_form_admin_page.php:184
|
253 |
msgid "Custom Fields"
|
254 |
msgstr "カスタムフィールド"
|
255 |
|
256 |
+
#: system/mw_wp_form_admin_page.php:347
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
msgid "Copy and Paste this shortcode."
|
258 |
msgstr "このショートコードをコピー&ペーストしてください。"
|
259 |
|
260 |
+
#: system/mw_wp_form_admin_page.php:361
|
261 |
msgid "Activate Query string of post"
|
262 |
msgstr "URL引数を有効にする"
|
263 |
|
264 |
+
#: system/mw_wp_form_admin_page.php:362
|
265 |
msgid ""
|
266 |
"If this field is active, MW WP Form get the post as query string \"post_id\" "
|
267 |
"and you can use $post's property in editor"
|
269 |
"有効にした場合、MW WP FormはURL引数 ”post_id\" をもとに投稿を取得して、その投"
|
270 |
"稿($post) のプロパティを使用できるようになります。"
|
271 |
|
272 |
+
#: system/mw_wp_form_admin_page.php:363
|
273 |
msgid "Example: {ID}, {post_title}, {post_meta} etc..."
|
274 |
msgstr "例:{ID}、{post_title}、{post_meta}など…"
|
275 |
|
276 |
+
#: system/mw_wp_form_admin_page.php:366
|
277 |
msgid "Saving contact data in database"
|
278 |
msgstr "問い合わせデータをデータベースに保存"
|
279 |
|
280 |
+
#: system/mw_wp_form_admin_page.php:392 system/mw_wp_form_admin_page.php:424
|
281 |
msgid "Subject"
|
282 |
msgstr "件名"
|
283 |
|
284 |
+
#: system/mw_wp_form_admin_page.php:396 system/mw_wp_form_admin_page.php:428
|
285 |
msgid "Ccontent"
|
286 |
msgstr "本文"
|
287 |
|
288 |
+
#: system/mw_wp_form_admin_page.php:398 system/mw_wp_form_admin_page.php:430
|
289 |
msgid "{key} is converted form data."
|
290 |
msgstr "{キー}でそのフォーム項目に変換されます。"
|
291 |
|
292 |
+
#: system/mw_wp_form_admin_page.php:401
|
293 |
msgid "Automatic reply email"
|
294 |
msgstr "自動返信メール"
|
295 |
|
296 |
+
#: system/mw_wp_form_admin_page.php:403
|
297 |
msgid "Please input the key to use as transmission to automatic reply email."
|
298 |
msgstr "自動返信メールに使用する項目のキーを入力してください。"
|
299 |
|
300 |
+
#: system/mw_wp_form_admin_page.php:416
|
301 |
msgid ""
|
302 |
"If Admin Email Options is a blank, Automatic Replay Email Options is used as "
|
303 |
"Admin Email Options."
|
305 |
"管理者宛メール設定が空のときは自動返信メール設定が管理者宛メール設定が使用さ"
|
306 |
"れます。"
|
307 |
|
308 |
+
#: system/mw_wp_form_admin_page.php:419
|
309 |
msgid "To ( E-mail address )"
|
310 |
msgstr "送信先(E-mailアドレス)"
|
311 |
|
312 |
+
#: system/mw_wp_form_admin_page.php:421
|
313 |
msgid "If empty: Using admin E-mail address."
|
314 |
msgstr "未入力の場合:管理者のE-mailアドレスを使用します。"
|
315 |
|
316 |
+
#: system/mw_wp_form_admin_page.php:445
|
317 |
msgid "Input Page URL"
|
318 |
msgstr "入力画面URL"
|
319 |
|
320 |
+
#: system/mw_wp_form_admin_page.php:451
|
321 |
msgid "Confirmation Page URL"
|
322 |
msgstr "確認画面URL"
|
323 |
|
324 |
+
#: system/mw_wp_form_admin_page.php:457
|
325 |
msgid "Complete Page URL"
|
326 |
msgstr "完了画面URL"
|
327 |
|
328 |
+
#: system/mw_wp_form_admin_page.php:494
|
329 |
msgid "Add Validation rule"
|
330 |
msgstr "バリデーションルールを追加"
|
331 |
|
332 |
+
#: system/mw_wp_form_admin_page.php:500
|
333 |
msgid "The key which applies validation"
|
334 |
msgstr "バリデーションを適用する項目"
|
335 |
|
336 |
+
#: system/mw_wp_form_admin_page.php:504
|
337 |
msgid "No empty"
|
338 |
msgstr "必須項目"
|
339 |
|
340 |
+
#: system/mw_wp_form_admin_page.php:505
|
341 |
msgid "No empty( with checkbox )"
|
342 |
msgstr "必須項目(チェックボックス)"
|
343 |
|
344 |
+
#: system/mw_wp_form_admin_page.php:506
|
345 |
msgid "Numeric"
|
346 |
msgstr "半角数字"
|
347 |
|
348 |
+
#: system/mw_wp_form_admin_page.php:507
|
349 |
msgid "Alphabet"
|
350 |
msgstr "半角英字"
|
351 |
|
352 |
+
#: system/mw_wp_form_admin_page.php:508
|
353 |
msgid "Alphabet and Numeric"
|
354 |
msgstr "半角英数字"
|
355 |
|
356 |
+
#: system/mw_wp_form_admin_page.php:509
|
357 |
msgid "Zip code"
|
358 |
msgstr "郵便番号"
|
359 |
|
360 |
+
#: system/mw_wp_form_admin_page.php:511
|
361 |
msgid "E-mail"
|
362 |
msgstr "メールアドレス"
|
363 |
|
364 |
+
#: system/mw_wp_form_admin_page.php:512
|
365 |
msgid "Date"
|
366 |
msgstr "日付"
|
367 |
|
368 |
+
#: system/mw_wp_form_admin_page.php:516
|
369 |
msgid "The key at same value"
|
370 |
msgstr "一致する項目"
|
371 |
|
372 |
+
#: system/mw_wp_form_admin_page.php:520
|
373 |
msgid "The range of the number of characters"
|
374 |
msgstr "文字数の範囲"
|
375 |
|
376 |
+
#: system/mw_wp_form_admin_page.php:528
|
377 |
msgid "The number of the minimum characters"
|
378 |
msgstr "最小文字数"
|
379 |
|
380 |
+
#: system/mw_wp_form_admin_page.php:532
|
381 |
+
msgid "Permitted Extension"
|
382 |
+
msgstr "拡張子制限"
|
383 |
+
|
384 |
+
#: system/mw_wp_form_admin_page.php:533
|
385 |
+
msgid "Example:jpg or jpg,txt,…"
|
386 |
+
msgstr "例:jpg もしくは jpg,txt…"
|
387 |
+
|
388 |
+
#: system/mw_wp_form_admin_page.php:536
|
389 |
+
msgid "Permitted file size"
|
390 |
+
msgstr "サイズ制限"
|
391 |
+
|
392 |
+
#: system/mw_wp_form_admin_page.php:537
|
393 |
+
msgid "bytes"
|
394 |
+
msgstr ""
|
395 |
+
|
396 |
+
#: system/mw_wp_form_admin_page.php:574
|
397 |
msgid "Registed Date"
|
398 |
msgstr "登録日時"
|
399 |
|
languages/mw-wp-form.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the MW WP Form package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: MW WP Form 0.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/mw-wp-form\n"
|
7 |
-
"POT-Creation-Date: 2013-05
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -18,66 +18,138 @@ msgstr ""
|
|
18 |
"X-Poedit-KeywordsList: __;_e\n"
|
19 |
"X-Poedit-SearchPath-0: ..\n"
|
20 |
|
21 |
-
#: form_fields/mw_form_field_back_button.php:
|
22 |
-
#:
|
23 |
msgid "Back"
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: form_fields/
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
msgid "Confirm"
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: form_fields/
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
msgid "Send"
|
34 |
msgstr ""
|
35 |
|
36 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
msgid "Validation Object is not a MW Validation Class."
|
38 |
msgstr ""
|
39 |
|
|
|
|
|
|
|
|
|
40 |
#: system/mw_validation.php:75
|
41 |
msgid "This is required."
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: system/mw_validation.php:95 system/mw_validation.php:
|
45 |
msgid "Please enter."
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: system/mw_validation.php:
|
49 |
msgid "Please enter with a half-width alphabetic character."
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: system/mw_validation.php:
|
53 |
msgid "Please enter with a half-width number."
|
54 |
msgstr ""
|
55 |
|
56 |
-
#: system/mw_validation.php:
|
57 |
msgid "Please enter with a half-width alphanumeric character."
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: system/mw_validation.php:
|
61 |
msgid "This is not the format of a zip code."
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: system/mw_validation.php:
|
65 |
msgid "This is not the format of a tel number."
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: system/mw_validation.php:
|
69 |
msgid "This is not the format of a mail address."
|
70 |
msgstr ""
|
71 |
|
72 |
-
#: system/mw_validation.php:
|
73 |
msgid "This is not the format of a url."
|
74 |
msgstr ""
|
75 |
|
76 |
-
#: system/mw_validation.php:
|
77 |
msgid "This is not in agreement."
|
78 |
msgstr ""
|
79 |
|
80 |
-
#: system/mw_validation.php:
|
81 |
msgid "The number of characters is invalid."
|
82 |
msgstr ""
|
83 |
|
@@ -93,263 +165,231 @@ msgstr ""
|
|
93 |
msgid "This is not the format of a date."
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: system/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
msgid "Add New Form"
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: system/mw_wp_form_admin_page.php:
|
101 |
msgid "Edit Form"
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: system/mw_wp_form_admin_page.php:
|
105 |
msgid "New Form"
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: system/mw_wp_form_admin_page.php:
|
109 |
msgid "View Form"
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: system/mw_wp_form_admin_page.php:
|
113 |
msgid "Search Forms"
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: system/mw_wp_form_admin_page.php:
|
117 |
msgid "No Forms found"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: system/mw_wp_form_admin_page.php:
|
121 |
msgid "No Forms found in Trash"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: system/mw_wp_form_admin_page.php:
|
125 |
msgid "Edit "
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: system/mw_wp_form_admin_page.php:
|
129 |
msgid "View"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: system/mw_wp_form_admin_page.php:
|
133 |
msgid "Search"
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: system/mw_wp_form_admin_page.php:
|
137 |
msgid "No data found"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: system/mw_wp_form_admin_page.php:
|
141 |
msgid "No data found in Trash"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: system/mw_wp_form_admin_page.php:
|
145 |
msgid "Complete Message"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: system/mw_wp_form_admin_page.php:
|
149 |
msgid "URL Options"
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: system/mw_wp_form_admin_page.php:
|
153 |
msgid "Validation Rule"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: system/mw_wp_form_admin_page.php:
|
157 |
msgid "Form Key"
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: system/mw_wp_form_admin_page.php:
|
161 |
msgid "Automatic Reply Email Options"
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: system/mw_wp_form_admin_page.php:
|
165 |
msgid "Admin Email Options"
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: system/mw_wp_form_admin_page.php:
|
169 |
msgid "settings"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: system/mw_wp_form_admin_page.php:
|
173 |
msgid "Custom Fields"
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: system/mw_wp_form_admin_page.php:
|
177 |
-
msgid "Text"
|
178 |
-
msgstr ""
|
179 |
-
|
180 |
-
#: system/mw_wp_form_admin_page.php:237
|
181 |
-
msgid "Textarea"
|
182 |
-
msgstr ""
|
183 |
-
|
184 |
-
#: system/mw_wp_form_admin_page.php:243
|
185 |
-
msgid "Zip Code"
|
186 |
-
msgstr ""
|
187 |
-
|
188 |
-
#: system/mw_wp_form_admin_page.php:249 system/mw_wp_form_admin_page.php:556
|
189 |
-
msgid "Tel"
|
190 |
-
msgstr ""
|
191 |
-
|
192 |
-
#: system/mw_wp_form_admin_page.php:255
|
193 |
-
msgid "Select"
|
194 |
-
msgstr ""
|
195 |
-
|
196 |
-
#: system/mw_wp_form_admin_page.php:261
|
197 |
-
msgid "Radio"
|
198 |
-
msgstr ""
|
199 |
-
|
200 |
-
#: system/mw_wp_form_admin_page.php:267
|
201 |
-
msgid "Checkbox"
|
202 |
-
msgstr ""
|
203 |
-
|
204 |
-
#: system/mw_wp_form_admin_page.php:273
|
205 |
-
msgid "Datepicker"
|
206 |
-
msgstr ""
|
207 |
-
|
208 |
-
#: system/mw_wp_form_admin_page.php:279
|
209 |
-
msgid "Password"
|
210 |
-
msgstr ""
|
211 |
-
|
212 |
-
#: system/mw_wp_form_admin_page.php:291
|
213 |
-
msgid "Confirm & Submit"
|
214 |
-
msgstr ""
|
215 |
-
|
216 |
-
#: system/mw_wp_form_admin_page.php:297
|
217 |
-
msgid "Submit"
|
218 |
-
msgstr ""
|
219 |
-
|
220 |
-
#: system/mw_wp_form_admin_page.php:303
|
221 |
-
msgid "Button"
|
222 |
-
msgstr ""
|
223 |
-
|
224 |
-
#: system/mw_wp_form_admin_page.php:309
|
225 |
-
msgid "Hidden"
|
226 |
-
msgstr ""
|
227 |
-
|
228 |
-
#: system/mw_wp_form_admin_page.php:315
|
229 |
-
msgid "Error Message"
|
230 |
-
msgstr ""
|
231 |
-
|
232 |
-
#: system/mw_wp_form_admin_page.php:395
|
233 |
msgid "Copy and Paste this shortcode."
|
234 |
msgstr ""
|
235 |
|
236 |
-
#: system/mw_wp_form_admin_page.php:
|
237 |
msgid "Activate Query string of post"
|
238 |
msgstr ""
|
239 |
|
240 |
-
#: system/mw_wp_form_admin_page.php:
|
241 |
msgid ""
|
242 |
"If this field is active, MW WP Form get the post as query string \"post_id\" "
|
243 |
"and you can use $post's property in editor"
|
244 |
msgstr ""
|
245 |
|
246 |
-
#: system/mw_wp_form_admin_page.php:
|
247 |
msgid "Example: {ID}, {post_title}, {post_meta} etc..."
|
248 |
msgstr ""
|
249 |
|
250 |
-
#: system/mw_wp_form_admin_page.php:
|
251 |
msgid "Saving contact data in database"
|
252 |
msgstr ""
|
253 |
|
254 |
-
#: system/mw_wp_form_admin_page.php:
|
255 |
msgid "Subject"
|
256 |
msgstr ""
|
257 |
|
258 |
-
#: system/mw_wp_form_admin_page.php:
|
259 |
msgid "Ccontent"
|
260 |
msgstr ""
|
261 |
|
262 |
-
#: system/mw_wp_form_admin_page.php:
|
263 |
msgid "{key} is converted form data."
|
264 |
msgstr ""
|
265 |
|
266 |
-
#: system/mw_wp_form_admin_page.php:
|
267 |
msgid "Automatic reply email"
|
268 |
msgstr ""
|
269 |
|
270 |
-
#: system/mw_wp_form_admin_page.php:
|
271 |
msgid "Please input the key to use as transmission to automatic reply email."
|
272 |
msgstr ""
|
273 |
|
274 |
-
#: system/mw_wp_form_admin_page.php:
|
275 |
msgid ""
|
276 |
"If Admin Email Options is a blank, Automatic Replay Email Options is used as "
|
277 |
"Admin Email Options."
|
278 |
msgstr ""
|
279 |
|
280 |
-
#: system/mw_wp_form_admin_page.php:
|
281 |
msgid "To ( E-mail address )"
|
282 |
msgstr ""
|
283 |
|
284 |
-
#: system/mw_wp_form_admin_page.php:
|
285 |
msgid "If empty: Using admin E-mail address."
|
286 |
msgstr ""
|
287 |
|
288 |
-
#: system/mw_wp_form_admin_page.php:
|
289 |
msgid "Input Page URL"
|
290 |
msgstr ""
|
291 |
|
292 |
-
#: system/mw_wp_form_admin_page.php:
|
293 |
msgid "Confirmation Page URL"
|
294 |
msgstr ""
|
295 |
|
296 |
-
#: system/mw_wp_form_admin_page.php:
|
297 |
msgid "Complete Page URL"
|
298 |
msgstr ""
|
299 |
|
300 |
-
#: system/mw_wp_form_admin_page.php:
|
301 |
msgid "Add Validation rule"
|
302 |
msgstr ""
|
303 |
|
304 |
-
#: system/mw_wp_form_admin_page.php:
|
305 |
msgid "The key which applies validation"
|
306 |
msgstr ""
|
307 |
|
308 |
-
#: system/mw_wp_form_admin_page.php:
|
309 |
msgid "No empty"
|
310 |
msgstr ""
|
311 |
|
312 |
-
#: system/mw_wp_form_admin_page.php:
|
313 |
msgid "No empty( with checkbox )"
|
314 |
msgstr ""
|
315 |
|
316 |
-
#: system/mw_wp_form_admin_page.php:
|
317 |
msgid "Numeric"
|
318 |
msgstr ""
|
319 |
|
320 |
-
#: system/mw_wp_form_admin_page.php:
|
321 |
msgid "Alphabet"
|
322 |
msgstr ""
|
323 |
|
324 |
-
#: system/mw_wp_form_admin_page.php:
|
325 |
msgid "Alphabet and Numeric"
|
326 |
msgstr ""
|
327 |
|
328 |
-
#: system/mw_wp_form_admin_page.php:
|
329 |
msgid "Zip code"
|
330 |
msgstr ""
|
331 |
|
332 |
-
#: system/mw_wp_form_admin_page.php:
|
333 |
msgid "E-mail"
|
334 |
msgstr ""
|
335 |
|
336 |
-
#: system/mw_wp_form_admin_page.php:
|
337 |
msgid "Date"
|
338 |
msgstr ""
|
339 |
|
340 |
-
#: system/mw_wp_form_admin_page.php:
|
341 |
msgid "The key at same value"
|
342 |
msgstr ""
|
343 |
|
344 |
-
#: system/mw_wp_form_admin_page.php:
|
345 |
msgid "The range of the number of characters"
|
346 |
msgstr ""
|
347 |
|
348 |
-
#: system/mw_wp_form_admin_page.php:
|
349 |
msgid "The number of the minimum characters"
|
350 |
msgstr ""
|
351 |
|
352 |
-
#: system/mw_wp_form_admin_page.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
msgid "Registed Date"
|
354 |
msgstr ""
|
355 |
|
2 |
# This file is distributed under the same license as the MW WP Form package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: MW WP Form 0.8\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/mw-wp-form\n"
|
7 |
+
"POT-Creation-Date: 2013-06-05 14:21:16+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
18 |
"X-Poedit-KeywordsList: __;_e\n"
|
19 |
"X-Poedit-SearchPath-0: ..\n"
|
20 |
|
21 |
+
#: form_fields/mw_form_field_back_button.php:42
|
22 |
+
#: form_fields/mw_form_field_back_button.php:72
|
23 |
msgid "Back"
|
24 |
msgstr ""
|
25 |
|
26 |
+
#: form_fields/mw_form_field_button.php:74
|
27 |
+
msgid "Button"
|
28 |
+
msgstr ""
|
29 |
+
|
30 |
+
#: form_fields/mw_form_field_checkbox.php:87
|
31 |
+
msgid "Checkbox"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: form_fields/mw_form_field_datepicker.php:108
|
35 |
+
msgid "Datepicker"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: form_fields/mw_form_field_error.php:77
|
39 |
+
msgid "Error Message"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: form_fields/mw_form_field_file.php:62 form_fields/mw_form_field_file.php:80
|
43 |
+
msgid "Uploaded."
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: form_fields/mw_form_field_file.php:93
|
47 |
+
msgid "File"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: form_fields/mw_form_field_hidden.php:75
|
51 |
+
msgid "Hidden"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: form_fields/mw_form_field_image.php:93
|
55 |
+
msgid "Image"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: form_fields/mw_form_field_password.php:85
|
59 |
+
msgid "Password"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: form_fields/mw_form_field_preview_button.php:42
|
63 |
+
#: form_fields/mw_form_field_submit_button.php:43
|
64 |
msgid "Confirm"
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: form_fields/mw_form_field_radio.php:86
|
68 |
+
msgid "Radio"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: form_fields/mw_form_field_select.php:86
|
72 |
+
msgid "Select"
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: form_fields/mw_form_field_submit.php:43
|
76 |
+
#: form_fields/mw_form_field_submit_button.php:44
|
77 |
msgid "Send"
|
78 |
msgstr ""
|
79 |
|
80 |
+
#: form_fields/mw_form_field_submit.php:74
|
81 |
+
msgid "Submit"
|
82 |
+
msgstr ""
|
83 |
+
|
84 |
+
#: form_fields/mw_form_field_submit_button.php:78
|
85 |
+
msgid "Confirm & Submit"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#: form_fields/mw_form_field_tel.php:81 system/mw_wp_form_admin_page.php:510
|
89 |
+
msgid "Tel"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: form_fields/mw_form_field_text.php:87
|
93 |
+
msgid "Text"
|
94 |
+
msgstr ""
|
95 |
+
|
96 |
+
#: form_fields/mw_form_field_textarea.php:87
|
97 |
+
msgid "Textarea"
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
#: form_fields/mw_form_field_zip.php:81
|
101 |
+
msgid "Zip Code"
|
102 |
+
msgstr ""
|
103 |
+
|
104 |
+
#: mw-wp-form.php:311
|
105 |
msgid "Validation Object is not a MW Validation Class."
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: mw-wp-form.php:443
|
109 |
+
msgid "Uploaded from "
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
#: system/mw_validation.php:75
|
113 |
msgid "This is required."
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: system/mw_validation.php:95 system/mw_validation.php:115
|
117 |
msgid "Please enter."
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: system/mw_validation.php:137
|
121 |
msgid "Please enter with a half-width alphabetic character."
|
122 |
msgstr ""
|
123 |
|
124 |
+
#: system/mw_validation.php:157
|
125 |
msgid "Please enter with a half-width number."
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: system/mw_validation.php:177
|
129 |
msgid "Please enter with a half-width alphanumeric character."
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: system/mw_validation.php:197
|
133 |
msgid "This is not the format of a zip code."
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: system/mw_validation.php:224
|
137 |
msgid "This is not the format of a tel number."
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: system/mw_validation.php:251
|
141 |
msgid "This is not the format of a mail address."
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: system/mw_validation.php:271
|
145 |
msgid "This is not the format of a url."
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: system/mw_validation.php:292
|
149 |
msgid "This is not in agreement."
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: system/mw_validation.php:316
|
153 |
msgid "The number of characters is invalid."
|
154 |
msgstr ""
|
155 |
|
165 |
msgid "This is not the format of a date."
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: system/mw_validation.php:426
|
169 |
+
msgid "This file is invalid."
|
170 |
+
msgstr ""
|
171 |
+
|
172 |
+
#: system/mw_validation.php:456
|
173 |
+
msgid "This file size is too big."
|
174 |
+
msgstr ""
|
175 |
+
|
176 |
+
#: system/mw_wp_form_admin_page.php:66
|
177 |
msgid "Add New Form"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: system/mw_wp_form_admin_page.php:67
|
181 |
msgid "Edit Form"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: system/mw_wp_form_admin_page.php:68
|
185 |
msgid "New Form"
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: system/mw_wp_form_admin_page.php:69
|
189 |
msgid "View Form"
|
190 |
msgstr ""
|
191 |
|
192 |
+
#: system/mw_wp_form_admin_page.php:70
|
193 |
msgid "Search Forms"
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: system/mw_wp_form_admin_page.php:71
|
197 |
msgid "No Forms found"
|
198 |
msgstr ""
|
199 |
|
200 |
+
#: system/mw_wp_form_admin_page.php:72
|
201 |
msgid "No Forms found in Trash"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: system/mw_wp_form_admin_page.php:93
|
205 |
msgid "Edit "
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: system/mw_wp_form_admin_page.php:94
|
209 |
msgid "View"
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: system/mw_wp_form_admin_page.php:95
|
213 |
msgid "Search"
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: system/mw_wp_form_admin_page.php:96
|
217 |
msgid "No data found"
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: system/mw_wp_form_admin_page.php:97
|
221 |
msgid "No data found in Trash"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: system/mw_wp_form_admin_page.php:135
|
225 |
msgid "Complete Message"
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: system/mw_wp_form_admin_page.php:142
|
229 |
msgid "URL Options"
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: system/mw_wp_form_admin_page.php:149
|
233 |
msgid "Validation Rule"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: system/mw_wp_form_admin_page.php:156
|
237 |
msgid "Form Key"
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: system/mw_wp_form_admin_page.php:163
|
241 |
msgid "Automatic Reply Email Options"
|
242 |
msgstr ""
|
243 |
|
244 |
+
#: system/mw_wp_form_admin_page.php:170
|
245 |
msgid "Admin Email Options"
|
246 |
msgstr ""
|
247 |
|
248 |
+
#: system/mw_wp_form_admin_page.php:177
|
249 |
msgid "settings"
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: system/mw_wp_form_admin_page.php:184
|
253 |
msgid "Custom Fields"
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: system/mw_wp_form_admin_page.php:347
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
msgid "Copy and Paste this shortcode."
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: system/mw_wp_form_admin_page.php:361
|
261 |
msgid "Activate Query string of post"
|
262 |
msgstr ""
|
263 |
|
264 |
+
#: system/mw_wp_form_admin_page.php:362
|
265 |
msgid ""
|
266 |
"If this field is active, MW WP Form get the post as query string \"post_id\" "
|
267 |
"and you can use $post's property in editor"
|
268 |
msgstr ""
|
269 |
|
270 |
+
#: system/mw_wp_form_admin_page.php:363
|
271 |
msgid "Example: {ID}, {post_title}, {post_meta} etc..."
|
272 |
msgstr ""
|
273 |
|
274 |
+
#: system/mw_wp_form_admin_page.php:366
|
275 |
msgid "Saving contact data in database"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: system/mw_wp_form_admin_page.php:392 system/mw_wp_form_admin_page.php:424
|
279 |
msgid "Subject"
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: system/mw_wp_form_admin_page.php:396 system/mw_wp_form_admin_page.php:428
|
283 |
msgid "Ccontent"
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: system/mw_wp_form_admin_page.php:398 system/mw_wp_form_admin_page.php:430
|
287 |
msgid "{key} is converted form data."
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: system/mw_wp_form_admin_page.php:401
|
291 |
msgid "Automatic reply email"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: system/mw_wp_form_admin_page.php:403
|
295 |
msgid "Please input the key to use as transmission to automatic reply email."
|
296 |
msgstr ""
|
297 |
|
298 |
+
#: system/mw_wp_form_admin_page.php:416
|
299 |
msgid ""
|
300 |
"If Admin Email Options is a blank, Automatic Replay Email Options is used as "
|
301 |
"Admin Email Options."
|
302 |
msgstr ""
|
303 |
|
304 |
+
#: system/mw_wp_form_admin_page.php:419
|
305 |
msgid "To ( E-mail address )"
|
306 |
msgstr ""
|
307 |
|
308 |
+
#: system/mw_wp_form_admin_page.php:421
|
309 |
msgid "If empty: Using admin E-mail address."
|
310 |
msgstr ""
|
311 |
|
312 |
+
#: system/mw_wp_form_admin_page.php:445
|
313 |
msgid "Input Page URL"
|
314 |
msgstr ""
|
315 |
|
316 |
+
#: system/mw_wp_form_admin_page.php:451
|
317 |
msgid "Confirmation Page URL"
|
318 |
msgstr ""
|
319 |
|
320 |
+
#: system/mw_wp_form_admin_page.php:457
|
321 |
msgid "Complete Page URL"
|
322 |
msgstr ""
|
323 |
|
324 |
+
#: system/mw_wp_form_admin_page.php:494
|
325 |
msgid "Add Validation rule"
|
326 |
msgstr ""
|
327 |
|
328 |
+
#: system/mw_wp_form_admin_page.php:500
|
329 |
msgid "The key which applies validation"
|
330 |
msgstr ""
|
331 |
|
332 |
+
#: system/mw_wp_form_admin_page.php:504
|
333 |
msgid "No empty"
|
334 |
msgstr ""
|
335 |
|
336 |
+
#: system/mw_wp_form_admin_page.php:505
|
337 |
msgid "No empty( with checkbox )"
|
338 |
msgstr ""
|
339 |
|
340 |
+
#: system/mw_wp_form_admin_page.php:506
|
341 |
msgid "Numeric"
|
342 |
msgstr ""
|
343 |
|
344 |
+
#: system/mw_wp_form_admin_page.php:507
|
345 |
msgid "Alphabet"
|
346 |
msgstr ""
|
347 |
|
348 |
+
#: system/mw_wp_form_admin_page.php:508
|
349 |
msgid "Alphabet and Numeric"
|
350 |
msgstr ""
|
351 |
|
352 |
+
#: system/mw_wp_form_admin_page.php:509
|
353 |
msgid "Zip code"
|
354 |
msgstr ""
|
355 |
|
356 |
+
#: system/mw_wp_form_admin_page.php:511
|
357 |
msgid "E-mail"
|
358 |
msgstr ""
|
359 |
|
360 |
+
#: system/mw_wp_form_admin_page.php:512
|
361 |
msgid "Date"
|
362 |
msgstr ""
|
363 |
|
364 |
+
#: system/mw_wp_form_admin_page.php:516
|
365 |
msgid "The key at same value"
|
366 |
msgstr ""
|
367 |
|
368 |
+
#: system/mw_wp_form_admin_page.php:520
|
369 |
msgid "The range of the number of characters"
|
370 |
msgstr ""
|
371 |
|
372 |
+
#: system/mw_wp_form_admin_page.php:528
|
373 |
msgid "The number of the minimum characters"
|
374 |
msgstr ""
|
375 |
|
376 |
+
#: system/mw_wp_form_admin_page.php:532
|
377 |
+
msgid "Permitted Extension"
|
378 |
+
msgstr ""
|
379 |
+
|
380 |
+
#: system/mw_wp_form_admin_page.php:533
|
381 |
+
msgid "Example:jpg or jpg,txt,…"
|
382 |
+
msgstr ""
|
383 |
+
|
384 |
+
#: system/mw_wp_form_admin_page.php:536
|
385 |
+
msgid "Permitted file size"
|
386 |
+
msgstr ""
|
387 |
+
|
388 |
+
#: system/mw_wp_form_admin_page.php:537
|
389 |
+
msgid "bytes"
|
390 |
+
msgstr ""
|
391 |
+
|
392 |
+
#: system/mw_wp_form_admin_page.php:574
|
393 |
msgid "Registed Date"
|
394 |
msgstr ""
|
395 |
|
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.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: September 25, 2012
|
10 |
-
* Modified: May
|
11 |
* Text Domain: mw-wp-form
|
12 |
* Domain Path: /languages/
|
13 |
* License: GPL2
|
@@ -27,21 +27,19 @@
|
|
27 |
* along with this program; if not, write to the Free Software
|
28 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
29 |
*/
|
|
|
|
|
30 |
$mw_wp_form = new mw_wp_form();
|
31 |
class mw_wp_form {
|
32 |
|
33 |
-
const NAME = 'mw-wp-form';
|
34 |
-
const DOMAIN = 'mw-wp-form';
|
35 |
-
const DBDATA = 'mwf_';
|
36 |
protected $key;
|
37 |
protected $input;
|
38 |
protected $preview;
|
39 |
protected $complete;
|
40 |
-
protected $
|
41 |
protected $Form;
|
42 |
protected $Validation;
|
43 |
protected $Error;
|
44 |
-
protected $Session;
|
45 |
protected $viewFlg = 'input';
|
46 |
protected $MW_WP_Form_Admin_Page;
|
47 |
protected $options_by_formkey;
|
@@ -51,7 +49,7 @@ class mw_wp_form {
|
|
51 |
* __construct
|
52 |
*/
|
53 |
public function __construct() {
|
54 |
-
load_plugin_textdomain(
|
55 |
|
56 |
// 有効化した時の処理
|
57 |
register_activation_hook( __FILE__, array( __CLASS__, 'activation' ) );
|
@@ -62,6 +60,15 @@ class mw_wp_form {
|
|
62 |
include_once( plugin_dir_path( __FILE__ ) . 'system/mw_wp_form_admin_page.php' );
|
63 |
$this->MW_WP_Form_Admin_Page = new MW_WP_Form_Admin_Page();
|
64 |
add_action( 'init', array( $this, 'register_post_type' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
if ( is_admin() ) return;
|
67 |
|
@@ -70,10 +77,6 @@ class mw_wp_form {
|
|
70 |
include_once( plugin_dir_path( __FILE__ ) . 'system/mw_mail.php' );
|
71 |
include_once( plugin_dir_path( __FILE__ ) . 'system/mw_session.php' );
|
72 |
include_once( plugin_dir_path( __FILE__ ) . 'system/mw_validation.php' );
|
73 |
-
include_once( plugin_dir_path( __FILE__ ) . 'system/mw_form_field.php' );
|
74 |
-
foreach ( glob( plugin_dir_path( __FILE__ ) . 'form_fields/*.php' ) as $form_field ) {
|
75 |
-
include_once $form_field;
|
76 |
-
}
|
77 |
add_action( 'wp', array( $this, 'init' ) );
|
78 |
add_action( 'wp_print_styles', array( $this, 'original_style' ) );
|
79 |
}
|
@@ -91,7 +94,7 @@ class mw_wp_form {
|
|
91 |
*/
|
92 |
public static function uninstall() {
|
93 |
$forms = get_posts( array(
|
94 |
-
'post_type' =>
|
95 |
'posts_per_page' => -1,
|
96 |
) );
|
97 |
if ( empty( $forms ) ) return;
|
@@ -104,7 +107,7 @@ class mw_wp_form {
|
|
104 |
if ( empty( $data_post_ids ) ) return;
|
105 |
foreach ( $data_post_ids as $data_post_id ) {
|
106 |
$data_posts = get_posts( array(
|
107 |
-
'post_type' =>
|
108 |
'posts_per_page' => -1,
|
109 |
) );
|
110 |
if ( empty( $data_posts ) ) continue;
|
@@ -127,10 +130,9 @@ class mw_wp_form {
|
|
127 |
* CSS適用
|
128 |
*/
|
129 |
public function original_style() {
|
130 |
-
if ( is_admin() ) return;
|
131 |
$url = plugin_dir_url( __FILE__ );
|
132 |
-
wp_register_style(
|
133 |
-
wp_enqueue_style(
|
134 |
}
|
135 |
|
136 |
/**
|
@@ -139,7 +141,6 @@ class mw_wp_form {
|
|
139 |
*/
|
140 |
public function init() {
|
141 |
global $post;
|
142 |
-
|
143 |
if ( empty( $post->ID ) ) return;
|
144 |
|
145 |
// URL設定を取得
|
@@ -162,15 +163,21 @@ class mw_wp_form {
|
|
162 |
// セッション初期化
|
163 |
$this->Session = MW_Session::start( $this->key );
|
164 |
// $_POSTがあるときは$_POST、無いときは$this->Session->getValues()
|
165 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
// フォームオブジェクト生成
|
167 |
-
$this->Form = new MW_Form( $this->
|
168 |
-
// セッションデータ設定
|
169 |
-
$this->Session->clearValues();
|
170 |
-
if ( !empty( $_POST ) ) $this->Session->save( $_POST );
|
171 |
|
172 |
// バリデーションオブジェクト生成
|
173 |
-
$this->Validation = new MW_Validation( $this->
|
174 |
// バリデーション実行(Validation->dataに値がないと$Errorは返さない(true))
|
175 |
$this->apply_filters_mwform_validation();
|
176 |
|
@@ -182,6 +189,7 @@ class mw_wp_form {
|
|
182 |
elseif ( $this->Form->isPreview() ) {
|
183 |
if ( $this->Validation->check() ) {
|
184 |
$this->viewFlg = 'preview';
|
|
|
185 |
$this->redirect( $this->preview );
|
186 |
} else {
|
187 |
$this->redirect( $this->input );
|
@@ -191,6 +199,7 @@ class mw_wp_form {
|
|
191 |
elseif ( $this->Form->isComplete() ) {
|
192 |
if ( $this->Validation->check() ) {
|
193 |
$this->viewFlg = 'complete';
|
|
|
194 |
|
195 |
// 管理画面作成・個別URL・現在画面と完了画面が同じとき以外はメール送信
|
196 |
$REQUEST_URI = $this->parse_url( $_SERVER['REQUEST_URI'] );
|
@@ -209,26 +218,9 @@ class mw_wp_form {
|
|
209 |
}
|
210 |
$this->Session->clearValues();
|
211 |
|
212 |
-
// ショートコード有効化
|
213 |
add_shortcode( 'mwform_formkey', array( $this, '_mwform_formkey' ) );
|
214 |
add_shortcode( 'mwform', array( $this, '_mwform' ) );
|
215 |
add_shortcode( 'mwform_complete_message', array( $this, '_mwform_complete_message' ) );
|
216 |
-
add_shortcode( 'mwform_error', array( $this, '_mwform_error' ) );
|
217 |
-
add_shortcode( 'mwform_text', array( $this, '_mwform_text' ) );
|
218 |
-
add_shortcode( 'mwform_submitButton', array( $this, '_mwform_submitButton' ) );
|
219 |
-
add_shortcode( 'mwform_submit', array( $this, '_mwform_submit' ) );
|
220 |
-
add_shortcode( 'mwform_previewButton', array( $this, '_mwform_previewButton' ) );
|
221 |
-
add_shortcode( 'mwform_backButton', array( $this, '_mwform_backButton' ) );
|
222 |
-
add_shortcode( 'mwform_button', array( $this, '_mwform_button' ) );
|
223 |
-
add_shortcode( 'mwform_hidden', array( $this, '_mwform_hidden' ) );
|
224 |
-
add_shortcode( 'mwform_password', array( $this, '_mwform_password' ) );
|
225 |
-
add_shortcode( 'mwform_zip', array( $this, '_mwform_zip' ) );
|
226 |
-
add_shortcode( 'mwform_tel', array( $this, '_mwform_tel' ) );
|
227 |
-
add_shortcode( 'mwform_textarea', array( $this, '_mwform_textarea' ) );
|
228 |
-
add_shortcode( 'mwform_select', array( $this, '_mwform_select' ) );
|
229 |
-
add_shortcode( 'mwform_radio', array( $this, '_mwform_radio' ) );
|
230 |
-
add_shortcode( 'mwform_checkbox', array( $this, '_mwform_checkbox' ) );
|
231 |
-
add_shortcode( 'mwform_datepicker', array( $this, '_mwform_datepicker' ) );
|
232 |
}
|
233 |
|
234 |
/**
|
@@ -274,10 +266,10 @@ class mw_wp_form {
|
|
274 |
$post = get_post( $atts['key'] );
|
275 |
if ( !empty( $post ) ) {
|
276 |
setup_postdata( $post );
|
277 |
-
if ( get_post_type() ===
|
278 |
-
$this->options_by_formkey = get_post_meta( $post->ID,
|
279 |
$this->options_by_formkey['post_id'] = $post->ID;
|
280 |
-
$this->key =
|
281 |
$this->input = $this->parse_url( $this->options_by_formkey['input_url'] );
|
282 |
$this->preview = $this->parse_url( $this->options_by_formkey['confirmation_url'] );
|
283 |
$this->complete = $this->parse_url( $this->options_by_formkey['complete_url'] );
|
@@ -303,10 +295,10 @@ class mw_wp_form {
|
|
303 |
|
304 |
if ( $this->options_by_formkey ) {
|
305 |
foreach ( $this->options_by_formkey['validation'] as $validation ) {
|
306 |
-
foreach ( $validation as $key => $
|
307 |
if ( $key == 'target' ) continue;
|
308 |
-
if ( is_array( $
|
309 |
-
$this->Validation->setRule( $validation['target'], $key, $
|
310 |
} else {
|
311 |
$this->Validation->setRule( $validation['target'], $key );
|
312 |
}
|
@@ -316,7 +308,7 @@ class mw_wp_form {
|
|
316 |
|
317 |
$this->Validation = apply_filters( $filterName, $this->Validation );
|
318 |
if ( !is_a( $this->Validation, 'MW_Validation' ) ) {
|
319 |
-
exit( __( 'Validation Object is not a MW Validation Class.',
|
320 |
}
|
321 |
}
|
322 |
|
@@ -348,6 +340,29 @@ class mw_wp_form {
|
|
348 |
if ( !empty( $this->options_by_formkey['admin_mail_content'] ) )
|
349 |
$admin_mail_content = $this->options_by_formkey['admin_mail_content'];
|
350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
if ( $this->options_by_formkey ) {
|
352 |
// 送信先を指定
|
353 |
if ( $mailto = $this->options_by_formkey['mail_to'] ) {
|
@@ -370,37 +385,83 @@ class mw_wp_form {
|
|
370 |
}
|
371 |
|
372 |
$actionName = 'mwform_mail_'.$this->key;
|
373 |
-
$Mail = apply_filters( $actionName, $Mail, $this->
|
374 |
|
375 |
if ( $this->options_by_formkey && !empty( $Mail ) ) {
|
376 |
$Mail->send();
|
377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
if ( !empty( $this->options_by_formkey['usedb'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
$this->insert_id = wp_insert_post( array(
|
380 |
'post_title' => $admin_mail_subject,
|
381 |
'post_status' => 'publish',
|
382 |
-
'post_type' =>
|
383 |
-
// 'post_content' => $Mail->body,
|
384 |
) );
|
|
|
385 |
preg_replace_callback(
|
386 |
'/{(.+?)}/',
|
387 |
array( $this, 'save_mail_body' ),
|
388 |
$admin_mail_content
|
389 |
);
|
390 |
-
}
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
}
|
405 |
}
|
406 |
}
|
@@ -427,26 +488,25 @@ class mw_wp_form {
|
|
427 |
* 第2引数でDB保存するか判定
|
428 |
*/
|
429 |
protected function parse_mail_body( $matches, $doUpdate = false ) {
|
430 |
-
|
|
|
431 |
return;
|
432 |
-
if ( is_array( $
|
433 |
-
if ( !array_key_exists( 'data', $
|
434 |
return;
|
435 |
-
if ( is_array( $
|
436 |
$value = $this->Form->getZipValue( $matches[1] );
|
437 |
if ( $doUpdate )
|
438 |
update_post_meta( $this->insert_id, $matches[1], $value );
|
439 |
return $value;
|
440 |
}
|
441 |
-
$value = $this->data[$matches[1]]['data'];
|
442 |
if ( $doUpdate )
|
443 |
-
update_post_meta( $this->insert_id, $matches[1], $
|
444 |
-
return $
|
445 |
} else {
|
446 |
-
$value = $this->data[$matches[1]];
|
447 |
if ( $doUpdate )
|
448 |
-
update_post_meta( $this->insert_id, $matches[1], $
|
449 |
-
return $
|
450 |
}
|
451 |
}
|
452 |
|
@@ -472,9 +532,8 @@ class mw_wp_form {
|
|
472 |
* @return String URL
|
473 |
*/
|
474 |
protected function parse_url( $url ) {
|
475 |
-
if ( empty( $url ) )
|
476 |
return '';
|
477 |
-
}
|
478 |
|
479 |
preg_match( '/(\?.*)$/', $url, $reg );
|
480 |
if ( !empty( $reg[1] ) ) {
|
@@ -487,7 +546,7 @@ class mw_wp_form {
|
|
487 |
}
|
488 |
$url = preg_replace( '/([^:])\/+/', '$1/', $url );
|
489 |
$url = trailingslashit( $url );
|
490 |
-
if ( !empty( $this->options_by_formkey['querystring'] ) &&
|
491 |
$url = $url . '?post_id=' . $_GET['post_id'];
|
492 |
}
|
493 |
return $url;
|
@@ -535,6 +594,7 @@ class mw_wp_form {
|
|
535 |
public function _mwform( $atts, $content = '' ) {
|
536 |
if ( $this->viewFlg == 'input' || $this->viewFlg == 'preview' ) {
|
537 |
$this->Error = $this->Validation->Error();
|
|
|
538 |
|
539 |
// ユーザー情報取得
|
540 |
$user = wp_get_current_user();
|
@@ -563,12 +623,19 @@ class mw_wp_form {
|
|
563 |
if ( !empty( $querystring ) ) {
|
564 |
$content = preg_replace_callback( '/{(.+?)}/', array( $this, 'get_post_propery' ), $content );
|
565 |
}
|
566 |
-
//$content = preg_replace( '/{.+?}/', '', $content );
|
567 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
568 |
return
|
569 |
'<div id="mw_wp_form_' . $this->key . '" class="mw_wp_form">' .
|
570 |
$this->Form->start() .
|
571 |
do_shortcode( $content ) .
|
|
|
572 |
$this->Form->end() .
|
573 |
'<!-- end .mw_wp_form --></div>';
|
574 |
}
|
@@ -583,7 +650,7 @@ class mw_wp_form {
|
|
583 |
public function get_post_propery( $matches ) {
|
584 |
if ( isset( $this->options_by_formkey['querystring'] ) )
|
585 |
$querystring = $this->options_by_formkey['querystring'];
|
586 |
-
if ( !empty( $querystring ) &&
|
587 |
$_post = get_post( $_GET['post_id'] );
|
588 |
if ( empty( $_post->ID ) )
|
589 |
return $matches[0];
|
@@ -613,188 +680,130 @@ class mw_wp_form {
|
|
613 |
}
|
614 |
|
615 |
/**
|
616 |
-
*
|
617 |
-
*
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
* 確認ボタンと送信ボタンを自動出力。同一ページ変遷の場合に利用。
|
640 |
-
* @example
|
641 |
-
* [mwform_submitButton name="hoge" preview_value="確認画面へ" submit_value="送信する"]
|
642 |
-
*
|
643 |
-
* viewFlg == inputで
|
644 |
-
* preview_valueあるときは確認ボタン
|
645 |
-
* preview_valueないときは送信ボタン
|
646 |
-
* viewFlg == preview
|
647 |
-
* 送信ボタン
|
648 |
-
* viewFlg == complete
|
649 |
-
* 非表示
|
650 |
-
*/
|
651 |
-
public function _mwform_submitButton( $atts ) {
|
652 |
-
$form_field = new mw_form_field_submit_button( $this->Form, $atts, $this->viewFlg, $this->Error );
|
653 |
-
return $form_field->getField();
|
654 |
-
}
|
655 |
-
|
656 |
-
/**
|
657 |
-
* _mwform_submit
|
658 |
-
* サブミットボタンを出力。
|
659 |
-
* @example
|
660 |
-
* [mwform_submit name="hoge" value="送信する"]
|
661 |
-
*/
|
662 |
-
public function _mwform_submit( $atts ) {
|
663 |
-
$form_field = new mw_form_field_submit( $this->Form, $atts, $this->viewFlg, $this->Error );
|
664 |
-
return $form_field->getField();
|
665 |
-
}
|
666 |
-
|
667 |
-
/**
|
668 |
-
* _mwform_previewButton
|
669 |
-
* 確認ボタンを出力。
|
670 |
-
* @example
|
671 |
-
* [mwform_previewButton value="確認画面へ"]
|
672 |
-
*/
|
673 |
-
public function _mwform_previewButton( $atts ) {
|
674 |
-
$form_field = new mw_form_field_preview_button( $this->Form, $atts, $this->viewFlg, $this->Error );
|
675 |
-
return $form_field->getField();
|
676 |
-
}
|
677 |
-
|
678 |
-
/**
|
679 |
-
* _mwform_backButton
|
680 |
-
* 戻るボタンを出力。
|
681 |
-
* @example
|
682 |
-
* [mwform_backButton value="戻る"]
|
683 |
-
*/
|
684 |
-
public function _mwform_backButton( $atts ) {
|
685 |
-
$form_field = new mw_form_field_back_button( $this->Form, $atts, $this->viewFlg, $this->Error );
|
686 |
-
return $form_field->getField();
|
687 |
-
}
|
688 |
-
|
689 |
-
/**
|
690 |
-
* _mwform_button
|
691 |
-
* ボタンを出力。
|
692 |
-
* @example
|
693 |
-
* [mwform_button name="hoge" value="hugaボタン"]
|
694 |
-
*/
|
695 |
-
public function _mwform_button( $atts ) {
|
696 |
-
$form_field = new mw_form_field_button( $this->Form, $atts, $this->viewFlg, $this->Error );
|
697 |
-
return $form_field->getField();
|
698 |
}
|
699 |
|
700 |
/**
|
701 |
-
*
|
702 |
-
*
|
703 |
-
* @
|
704 |
-
*
|
705 |
-
*/
|
706 |
-
|
707 |
-
$
|
708 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
709 |
}
|
|
|
710 |
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
}
|
721 |
|
722 |
/**
|
723 |
-
*
|
724 |
-
*
|
725 |
-
* 入力画面からの送信時は配列で送信されるので注意
|
726 |
-
* @example
|
727 |
-
* [mwform_zip name="hoge" show_error=""]
|
728 |
*/
|
729 |
-
public function
|
730 |
-
$
|
731 |
-
return $form_field->getField();
|
732 |
}
|
733 |
|
734 |
/**
|
735 |
-
*
|
736 |
-
*
|
737 |
-
*
|
738 |
-
* @example
|
739 |
-
* [mwform_tel name="hoge" show_error=""]
|
740 |
*/
|
741 |
-
public function
|
742 |
-
|
743 |
-
|
744 |
}
|
745 |
|
746 |
/**
|
747 |
-
*
|
748 |
-
*
|
749 |
-
* @example
|
750 |
-
* [mwform_textarea name="hoge" cols="50" rows="5" value="" show_error=""]
|
751 |
*/
|
752 |
-
public function
|
753 |
-
|
754 |
-
|
|
|
755 |
}
|
756 |
|
757 |
/**
|
758 |
-
*
|
759 |
-
*
|
760 |
-
* @
|
761 |
-
* [mwform_select name="hoge" children="日本,アメリカ,中国" value="初期値として選択状態にしたい値があれば指定" show_error=""]
|
762 |
*/
|
763 |
-
public function
|
764 |
-
$
|
765 |
-
|
766 |
}
|
767 |
|
768 |
/**
|
769 |
-
*
|
770 |
-
*
|
771 |
-
* @example
|
772 |
-
* [mwform_radio name="hoge" children="日本,アメリカ,中国" value="初期値として選択状態にしたい値があれば指定" show_error=""]
|
773 |
*/
|
774 |
-
public function
|
775 |
-
|
776 |
-
|
|
|
|
|
777 |
}
|
778 |
|
779 |
/**
|
780 |
-
*
|
781 |
-
*
|
782 |
-
* @example
|
783 |
-
* [mwform_checkbox name="hoge" children="日本,アメリカ,中国" value="初期値として選択状態にしたい値があれば,区切りで指定" show_error=""]
|
784 |
*/
|
785 |
-
public function
|
786 |
-
|
787 |
-
|
788 |
}
|
789 |
|
790 |
/**
|
791 |
-
*
|
792 |
-
*
|
793 |
-
* @
|
794 |
-
* [mwform_checkbox name="hoge" children="日本,アメリカ,中国" value="初期値として選択状態にしたい値があれば,区切りで指定" show_error=""]
|
795 |
*/
|
796 |
-
public function
|
797 |
-
$
|
798 |
-
|
799 |
}
|
800 |
}
|
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
|
10 |
+
* Modified: May 29, 2013
|
11 |
* Text Domain: mw-wp-form
|
12 |
* Domain Path: /languages/
|
13 |
* License: GPL2
|
27 |
* along with this program; if not, write to the Free Software
|
28 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
29 |
*/
|
30 |
+
include_once( plugin_dir_path( __FILE__ ) . 'system/mwf_functions.php' );
|
31 |
+
include_once( plugin_dir_path( __FILE__ ) . 'system/mwf_config.php' );
|
32 |
$mw_wp_form = new mw_wp_form();
|
33 |
class mw_wp_form {
|
34 |
|
|
|
|
|
|
|
35 |
protected $key;
|
36 |
protected $input;
|
37 |
protected $preview;
|
38 |
protected $complete;
|
39 |
+
protected $Data;
|
40 |
protected $Form;
|
41 |
protected $Validation;
|
42 |
protected $Error;
|
|
|
43 |
protected $viewFlg = 'input';
|
44 |
protected $MW_WP_Form_Admin_Page;
|
45 |
protected $options_by_formkey;
|
49 |
* __construct
|
50 |
*/
|
51 |
public function __construct() {
|
52 |
+
load_plugin_textdomain( MWF_Config::DOMAIN, false, basename( dirname( __FILE__ ) ) . '/languages' );
|
53 |
|
54 |
// 有効化した時の処理
|
55 |
register_activation_hook( __FILE__, array( __CLASS__, 'activation' ) );
|
60 |
include_once( plugin_dir_path( __FILE__ ) . 'system/mw_wp_form_admin_page.php' );
|
61 |
$this->MW_WP_Form_Admin_Page = new MW_WP_Form_Admin_Page();
|
62 |
add_action( 'init', array( $this, 'register_post_type' ) );
|
63 |
+
// フォームフィールドの読み込み、インスタンス化
|
64 |
+
include_once( plugin_dir_path( __FILE__ ) . 'system/mw_form_field.php' );
|
65 |
+
foreach ( glob( plugin_dir_path( __FILE__ ) . 'form_fields/*.php' ) as $form_field ) {
|
66 |
+
include_once $form_field;
|
67 |
+
$className = basename( $form_field, '.php' );
|
68 |
+
if ( class_exists( $className ) ) {
|
69 |
+
new $className();
|
70 |
+
}
|
71 |
+
}
|
72 |
|
73 |
if ( is_admin() ) return;
|
74 |
|
77 |
include_once( plugin_dir_path( __FILE__ ) . 'system/mw_mail.php' );
|
78 |
include_once( plugin_dir_path( __FILE__ ) . 'system/mw_session.php' );
|
79 |
include_once( plugin_dir_path( __FILE__ ) . 'system/mw_validation.php' );
|
|
|
|
|
|
|
|
|
80 |
add_action( 'wp', array( $this, 'init' ) );
|
81 |
add_action( 'wp_print_styles', array( $this, 'original_style' ) );
|
82 |
}
|
94 |
*/
|
95 |
public static function uninstall() {
|
96 |
$forms = get_posts( array(
|
97 |
+
'post_type' => MWF_Config::NAME,
|
98 |
'posts_per_page' => -1,
|
99 |
) );
|
100 |
if ( empty( $forms ) ) return;
|
107 |
if ( empty( $data_post_ids ) ) return;
|
108 |
foreach ( $data_post_ids as $data_post_id ) {
|
109 |
$data_posts = get_posts( array(
|
110 |
+
'post_type' => MWF_Config::DBDATA . $data_post_id,
|
111 |
'posts_per_page' => -1,
|
112 |
) );
|
113 |
if ( empty( $data_posts ) ) continue;
|
130 |
* CSS適用
|
131 |
*/
|
132 |
public function original_style() {
|
|
|
133 |
$url = plugin_dir_url( __FILE__ );
|
134 |
+
wp_register_style( MWF_Config::DOMAIN, $url.'css/style.css' );
|
135 |
+
wp_enqueue_style( MWF_Config::DOMAIN );
|
136 |
}
|
137 |
|
138 |
/**
|
141 |
*/
|
142 |
public function init() {
|
143 |
global $post;
|
|
|
144 |
if ( empty( $post->ID ) ) return;
|
145 |
|
146 |
// URL設定を取得
|
163 |
// セッション初期化
|
164 |
$this->Session = MW_Session::start( $this->key );
|
165 |
// $_POSTがあるときは$_POST、無いときは$this->Session->getValues()
|
166 |
+
$_data = ( !empty( $_POST ) ) ? $_POST : $this->Session->getValues();
|
167 |
+
$this->Data = new MW_WP_Form_Data( $this->key );
|
168 |
+
$this->Data->setValues( $_data );
|
169 |
+
|
170 |
+
// $_FILESがあるときは$this->dataに統合
|
171 |
+
foreach ( $_FILES as $key => $file ) {
|
172 |
+
if ( $this->Data->getValue( $key ) === null ) {
|
173 |
+
$this->Data->setValue( $key, $file['name'] );
|
174 |
+
}
|
175 |
+
}
|
176 |
// フォームオブジェクト生成
|
177 |
+
$this->Form = new MW_Form( $this->Data->getValues(), $this->key );
|
|
|
|
|
|
|
178 |
|
179 |
// バリデーションオブジェクト生成
|
180 |
+
$this->Validation = new MW_Validation( $this->Data->getValues() );
|
181 |
// バリデーション実行(Validation->dataに値がないと$Errorは返さない(true))
|
182 |
$this->apply_filters_mwform_validation();
|
183 |
|
189 |
elseif ( $this->Form->isPreview() ) {
|
190 |
if ( $this->Validation->check() ) {
|
191 |
$this->viewFlg = 'preview';
|
192 |
+
$this->fileUpload();
|
193 |
$this->redirect( $this->preview );
|
194 |
} else {
|
195 |
$this->redirect( $this->input );
|
199 |
elseif ( $this->Form->isComplete() ) {
|
200 |
if ( $this->Validation->check() ) {
|
201 |
$this->viewFlg = 'complete';
|
202 |
+
$this->fileUpload();
|
203 |
|
204 |
// 管理画面作成・個別URL・現在画面と完了画面が同じとき以外はメール送信
|
205 |
$REQUEST_URI = $this->parse_url( $_SERVER['REQUEST_URI'] );
|
218 |
}
|
219 |
$this->Session->clearValues();
|
220 |
|
|
|
221 |
add_shortcode( 'mwform_formkey', array( $this, '_mwform_formkey' ) );
|
222 |
add_shortcode( 'mwform', array( $this, '_mwform' ) );
|
223 |
add_shortcode( 'mwform_complete_message', array( $this, '_mwform_complete_message' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
}
|
225 |
|
226 |
/**
|
266 |
$post = get_post( $atts['key'] );
|
267 |
if ( !empty( $post ) ) {
|
268 |
setup_postdata( $post );
|
269 |
+
if ( get_post_type() === MWF_Config::NAME ) {
|
270 |
+
$this->options_by_formkey = get_post_meta( $post->ID, MWF_Config::NAME, true );
|
271 |
$this->options_by_formkey['post_id'] = $post->ID;
|
272 |
+
$this->key = MWF_Config::NAME.'-'.$atts['key'];
|
273 |
$this->input = $this->parse_url( $this->options_by_formkey['input_url'] );
|
274 |
$this->preview = $this->parse_url( $this->options_by_formkey['confirmation_url'] );
|
275 |
$this->complete = $this->parse_url( $this->options_by_formkey['complete_url'] );
|
295 |
|
296 |
if ( $this->options_by_formkey ) {
|
297 |
foreach ( $this->options_by_formkey['validation'] as $validation ) {
|
298 |
+
foreach ( $validation as $key => $value ) {
|
299 |
if ( $key == 'target' ) continue;
|
300 |
+
if ( is_array( $value ) ) {
|
301 |
+
$this->Validation->setRule( $validation['target'], $key, $value );
|
302 |
} else {
|
303 |
$this->Validation->setRule( $validation['target'], $key );
|
304 |
}
|
308 |
|
309 |
$this->Validation = apply_filters( $filterName, $this->Validation );
|
310 |
if ( !is_a( $this->Validation, 'MW_Validation' ) ) {
|
311 |
+
exit( __( 'Validation Object is not a MW Validation Class.', MWF_Config::DOMAIN ) );
|
312 |
}
|
313 |
}
|
314 |
|
340 |
if ( !empty( $this->options_by_formkey['admin_mail_content'] ) )
|
341 |
$admin_mail_content = $this->options_by_formkey['admin_mail_content'];
|
342 |
|
343 |
+
// 添付ファイルのデータをためた配列を作成
|
344 |
+
// $Mail->attachments を設定(メールにファイルを添付)
|
345 |
+
$attachments = array();
|
346 |
+
$upload_file_keys = $this->Data->getValue( MWF_Config::UPLOAD_FILE_KEYS );
|
347 |
+
if ( $upload_file_keys !== null ) {
|
348 |
+
if ( is_array( $upload_file_keys ) ) {
|
349 |
+
foreach ( $upload_file_keys as $key ) {
|
350 |
+
$upload_file_url = $this->Data->getValue( $key );
|
351 |
+
if ( !$upload_file_url ) continue;
|
352 |
+
$wp_upload_dir = wp_upload_dir();
|
353 |
+
$filepath = str_replace(
|
354 |
+
$wp_upload_dir['url'],
|
355 |
+
$wp_upload_dir['path'],
|
356 |
+
$upload_file_url
|
357 |
+
);
|
358 |
+
if ( file_exists( $filepath ) ) {
|
359 |
+
$attachments[$key] = $filepath;
|
360 |
+
}
|
361 |
+
}
|
362 |
+
$Mail->attachments = $attachments;
|
363 |
+
}
|
364 |
+
}
|
365 |
+
|
366 |
if ( $this->options_by_formkey ) {
|
367 |
// 送信先を指定
|
368 |
if ( $mailto = $this->options_by_formkey['mail_to'] ) {
|
385 |
}
|
386 |
|
387 |
$actionName = 'mwform_mail_'.$this->key;
|
388 |
+
$Mail = apply_filters( $actionName, $Mail, $this->Data->getValues() );
|
389 |
|
390 |
if ( $this->options_by_formkey && !empty( $Mail ) ) {
|
391 |
$Mail->send();
|
392 |
|
393 |
+
if ( isset( $this->options_by_formkey['automatic_reply_email'] ) ) {
|
394 |
+
$automatic_reply_email = $this->Data->getValue( $this->options_by_formkey['automatic_reply_email'] );
|
395 |
+
if ( $automatic_reply_email && !$this->Validation->mail( $automatic_reply_email ) ) {
|
396 |
+
// 送信先を指定
|
397 |
+
$Mail->to = $this->Data->getValue( $this->options_by_formkey['automatic_reply_email'] );
|
398 |
+
// タイトルを指定
|
399 |
+
$Mail->subject = $this->options_by_formkey['mail_subject'];
|
400 |
+
// 本文を指定
|
401 |
+
$Mail->body = preg_replace_callback(
|
402 |
+
'/{(.+?)}/',
|
403 |
+
array( $this, 'create_mail_body' ),
|
404 |
+
$this->options_by_formkey['mail_content']
|
405 |
+
);
|
406 |
+
// 自動返信メールからは添付ファイルを削除
|
407 |
+
$Mail->attachments = array();
|
408 |
+
$Mail->send();
|
409 |
+
}
|
410 |
+
}
|
411 |
+
|
412 |
+
// DB保存時
|
413 |
if ( !empty( $this->options_by_formkey['usedb'] ) ) {
|
414 |
+
// save_mail_body で登録されないように
|
415 |
+
foreach ( $attachments as $key => $filepath ) {
|
416 |
+
$this->Data->clearValue( $key );
|
417 |
+
}
|
418 |
+
|
419 |
+
// $this->insert_id を設定 ( save_mail_body で 使用 )
|
420 |
$this->insert_id = wp_insert_post( array(
|
421 |
'post_title' => $admin_mail_subject,
|
422 |
'post_status' => 'publish',
|
423 |
+
'post_type' => MWF_Config::DBDATA . $this->options_by_formkey['post_id'],
|
|
|
424 |
) );
|
425 |
+
// 保存
|
426 |
preg_replace_callback(
|
427 |
'/{(.+?)}/',
|
428 |
array( $this, 'save_mail_body' ),
|
429 |
$admin_mail_content
|
430 |
);
|
|
|
431 |
|
432 |
+
// 添付ファイルをメディアに保存
|
433 |
+
if ( !empty( $this->insert_id ) ) {
|
434 |
+
foreach ( $attachments as $key => $filepath ) {
|
435 |
+
// WordPress( get_allowed_mime_types ) で許可されたファイルタイプ限定
|
436 |
+
$wp_check_filetype = wp_check_filetype( $filepath );
|
437 |
+
if ( file_exists( $filepath ) && !empty( $wp_check_filetype['type'] ) ) {
|
438 |
+
$post_type = get_post_type_object( MWF_Config::DBDATA . $this->options_by_formkey['post_id'] );
|
439 |
+
$attachment = array(
|
440 |
+
'post_mime_type' => $wp_check_filetype['type'],
|
441 |
+
'post_title' => $key,
|
442 |
+
'post_status' => 'inherit',
|
443 |
+
'post_content' => __( 'Uploaded from ' ) . $post_type->label,
|
444 |
+
);
|
445 |
+
$attach_id = wp_insert_attachment( $attachment, $filepath, $this->insert_id );
|
446 |
+
require_once( ABSPATH . 'wp-admin' . '/includes/image.php' );
|
447 |
+
$attach_data = wp_generate_attachment_metadata( $attach_id, $filepath );
|
448 |
+
$update_attachment_flg = wp_update_attachment_metadata( $attach_id, $attach_data );
|
449 |
+
if ( $update_attachment_flg ) {
|
450 |
+
// 代わりにここで attachment_id を保存
|
451 |
+
update_post_meta( $this->insert_id, $key, $attach_id );
|
452 |
+
// $key が 添付ファイルのキーであるとわかるように隠し設定を保存
|
453 |
+
update_post_meta( $this->insert_id, '_' . MWF_Config::UPLOAD_FILE_KEYS, $key );
|
454 |
+
}
|
455 |
+
}
|
456 |
+
}
|
457 |
+
}
|
458 |
+
}
|
459 |
+
// DB非保存時
|
460 |
+
else {
|
461 |
+
foreach ( $attachments as $filepath ) {
|
462 |
+
if ( file_exists( $filepath ) )
|
463 |
+
unlink( $filepath );
|
464 |
+
}
|
465 |
}
|
466 |
}
|
467 |
}
|
488 |
* 第2引数でDB保存するか判定
|
489 |
*/
|
490 |
protected function parse_mail_body( $matches, $doUpdate = false ) {
|
491 |
+
$match = $this->Data->getValue( $matches[1] );
|
492 |
+
if ( $match === null )
|
493 |
return;
|
494 |
+
if ( is_array( $match ) ) {
|
495 |
+
if ( !array_key_exists( 'data', $match ) )
|
496 |
return;
|
497 |
+
if ( is_array( $match['data'] ) ) {
|
498 |
$value = $this->Form->getZipValue( $matches[1] );
|
499 |
if ( $doUpdate )
|
500 |
update_post_meta( $this->insert_id, $matches[1], $value );
|
501 |
return $value;
|
502 |
}
|
|
|
503 |
if ( $doUpdate )
|
504 |
+
update_post_meta( $this->insert_id, $matches[1], $match['data'] );
|
505 |
+
return $match['data'];
|
506 |
} else {
|
|
|
507 |
if ( $doUpdate )
|
508 |
+
update_post_meta( $this->insert_id, $matches[1], $match );
|
509 |
+
return $match;
|
510 |
}
|
511 |
}
|
512 |
|
532 |
* @return String URL
|
533 |
*/
|
534 |
protected function parse_url( $url ) {
|
535 |
+
if ( empty( $url ) )
|
536 |
return '';
|
|
|
537 |
|
538 |
preg_match( '/(\?.*)$/', $url, $reg );
|
539 |
if ( !empty( $reg[1] ) ) {
|
546 |
}
|
547 |
$url = preg_replace( '/([^:])\/+/', '$1/', $url );
|
548 |
$url = trailingslashit( $url );
|
549 |
+
if ( !empty( $this->options_by_formkey['querystring'] ) && MWF_Functions::is_numeric( $_GET['post_id'] ) ) {
|
550 |
$url = $url . '?post_id=' . $_GET['post_id'];
|
551 |
}
|
552 |
return $url;
|
594 |
public function _mwform( $atts, $content = '' ) {
|
595 |
if ( $this->viewFlg == 'input' || $this->viewFlg == 'preview' ) {
|
596 |
$this->Error = $this->Validation->Error();
|
597 |
+
do_action( 'mwform_add_shortcode', $this->Form, $this->viewFlg, $this->Error );
|
598 |
|
599 |
// ユーザー情報取得
|
600 |
$user = wp_get_current_user();
|
623 |
if ( !empty( $querystring ) ) {
|
624 |
$content = preg_replace_callback( '/{(.+?)}/', array( $this, 'get_post_propery' ), $content );
|
625 |
}
|
|
|
626 |
|
627 |
+
$upload_file_keys = $this->Form->getValue( MWF_Config::UPLOAD_FILE_KEYS );
|
628 |
+
$upload_file_hidden = '';
|
629 |
+
if ( is_array( $upload_file_keys ) ) {
|
630 |
+
foreach ( $upload_file_keys as $value ) {
|
631 |
+
$upload_file_hidden .= $this->Form->hidden( MWF_Config::UPLOAD_FILE_KEYS . '[]', $value );
|
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 .
|
639 |
$this->Form->end() .
|
640 |
'<!-- end .mw_wp_form --></div>';
|
641 |
}
|
650 |
public function get_post_propery( $matches ) {
|
651 |
if ( isset( $this->options_by_formkey['querystring'] ) )
|
652 |
$querystring = $this->options_by_formkey['querystring'];
|
653 |
+
if ( !empty( $querystring ) && MWF_Functions::is_numeric( $_GET['post_id'] ) ) {
|
654 |
$_post = get_post( $_GET['post_id'] );
|
655 |
if ( empty( $_post->ID ) )
|
656 |
return $matches[0];
|
680 |
}
|
681 |
|
682 |
/**
|
683 |
+
* fileUpload
|
684 |
+
* ファイルアップロード処理。$this->data[$key] にファイルの URL を入れる
|
685 |
+
*/
|
686 |
+
protected function fileUpload() {
|
687 |
+
foreach ( $_FILES as $key => $file ) {
|
688 |
+
if ( empty( $file['tmp_name'] ) )
|
689 |
+
continue;
|
690 |
+
$extension = pathinfo( $file['name'], PATHINFO_EXTENSION );
|
691 |
+
$uploadfile = $this->setUploadFileName( $extension );
|
692 |
+
// WordPress( get_allowed_mime_types ) で許可されたファイルタイプ限定
|
693 |
+
$wp_check_filetype = wp_check_filetype( $uploadfile['file'] );
|
694 |
+
if ( !( $file['error'] == UPLOAD_ERR_OK
|
695 |
+
&& is_uploaded_file( $file['tmp_name'] )
|
696 |
+
&& !empty( $wp_check_filetype['type'] ) ) )
|
697 |
+
continue;
|
698 |
+
$this->Data->setValue( $key, $uploadfile['url'] );
|
699 |
+
$upload_file_keys = $this->Data->getValue( MWF_Config::UPLOAD_FILE_KEYS );
|
700 |
+
if ( !( is_array( $upload_file_keys ) && in_array( $key, $upload_file_keys ) ) ) {
|
701 |
+
$this->Data->pushValue( MWF_Config::UPLOAD_FILE_KEYS, $key );
|
702 |
+
}
|
703 |
+
$this->Form = new MW_Form( $this->Data->getValues(), $this->key );
|
704 |
+
move_uploaded_file( $file['tmp_name'], $uploadfile['file'] );
|
705 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
706 |
}
|
707 |
|
708 |
/**
|
709 |
+
* setUploadFileName
|
710 |
+
* ファイルパスとファイルURL を返す
|
711 |
+
* @param String 拡張子 ( ex: jpg )
|
712 |
+
* @return Array ( file =>, url => )
|
713 |
+
*/
|
714 |
+
private function setUploadFileName( $extension ) {
|
715 |
+
$count = 0;
|
716 |
+
$filename = date( 'Ymdhis' ) . '.' . $extension;
|
717 |
+
$wp_upload_dir = wp_upload_dir();
|
718 |
+
$upload_dir = realpath( $wp_upload_dir['path'] );
|
719 |
+
$upload_url = $wp_upload_dir['url'];
|
720 |
+
$uploadfile['file'] = $upload_dir . '/' . $filename;
|
721 |
+
$uploadfile['url'] = $upload_url . '/' . $filename;
|
722 |
+
$slugname = preg_replace( '/\.[^.]+$/', '', basename( $uploadfile['file'] ) );
|
723 |
+
while ( file_exists( $uploadfile['file'] ) ) {
|
724 |
+
$count ++;
|
725 |
+
$uploadfile['file'] = $upload_dir . '/' . $slugname . '-' . $count . '.' . $extension;
|
726 |
+
$uploadfile['url'] = $upload_url . '/' . $slugname . '-' . $count . '.' . $extension;
|
727 |
+
}
|
728 |
+
return $uploadfile;
|
729 |
}
|
730 |
+
}
|
731 |
|
732 |
+
/**
|
733 |
+
* mw_wp_form_data
|
734 |
+
* mw_wp_form のデータ操作用
|
735 |
+
* Version: 1.0
|
736 |
+
* Created: May 29, 2013
|
737 |
+
*/
|
738 |
+
class mw_wp_form_data {
|
739 |
+
private $data;
|
740 |
+
private $Session;
|
|
|
741 |
|
742 |
/**
|
743 |
+
* __construct
|
744 |
+
* @param String $key データのキー
|
|
|
|
|
|
|
745 |
*/
|
746 |
+
public function __construct( $key ) {
|
747 |
+
$this->Session = MW_Session::start( $key );
|
|
|
748 |
}
|
749 |
|
750 |
/**
|
751 |
+
* getValue
|
752 |
+
* @param String $key データのキー
|
753 |
+
* @return String データ
|
|
|
|
|
754 |
*/
|
755 |
+
public function getValue( $key ) {
|
756 |
+
if ( isset( $this->data[$key] ) )
|
757 |
+
return $this->data[$key];
|
758 |
}
|
759 |
|
760 |
/**
|
761 |
+
* getValues
|
762 |
+
* @return Array データ
|
|
|
|
|
763 |
*/
|
764 |
+
public function getValues() {
|
765 |
+
if ( $this->data === null)
|
766 |
+
return array();
|
767 |
+
return $this->data;
|
768 |
}
|
769 |
|
770 |
/**
|
771 |
+
* setValue
|
772 |
+
* @param String $key データのキー
|
773 |
+
* @param String $value 値
|
|
|
774 |
*/
|
775 |
+
public function setValue( $key, $value ){
|
776 |
+
$this->data[$key] = $value;
|
777 |
+
$this->Session->setValue( $key, $value );
|
778 |
}
|
779 |
|
780 |
/**
|
781 |
+
* setValue
|
782 |
+
* @param Array 値
|
|
|
|
|
783 |
*/
|
784 |
+
public function setValues( Array $array ) {
|
785 |
+
foreach ( $array as $key => $value ) {
|
786 |
+
$this->data[$key] = $value;
|
787 |
+
$this->Session->setValue( $key, $value );
|
788 |
+
}
|
789 |
}
|
790 |
|
791 |
/**
|
792 |
+
* getValue
|
793 |
+
* @param String $key データのキー
|
|
|
|
|
794 |
*/
|
795 |
+
public function clearValue( $key ) {
|
796 |
+
unset( $this->data[$key] );
|
797 |
+
$this->Session->clearValue( $key );
|
798 |
}
|
799 |
|
800 |
/**
|
801 |
+
* getValue
|
802 |
+
* @param String $key データのキー
|
803 |
+
* @param String $value 値
|
|
|
804 |
*/
|
805 |
+
public function pushValue( $key, $value ) {
|
806 |
+
$this->data[$key][] = $value;
|
807 |
+
$this->Session->pushValue( $key, $value );
|
808 |
}
|
809 |
}
|
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 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -19,6 +19,13 @@ MW WP Form can create mail form with a confirmation screen using shortcode.
|
|
19 |
* The page changes by the same URL or individual URL are possible.
|
20 |
* Many validation rules
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
http://2inc.org/blog/category/products/wordpress_plugins/mw-wp-form/
|
23 |
|
24 |
== Installation ==
|
@@ -31,6 +38,17 @@ http://2inc.org/blog/category/products/wordpress_plugins/mw-wp-form/
|
|
31 |
|
32 |
== Changelog ==
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
= 0.7.1 =
|
35 |
* Added : メール設定を 自動返信メール設定 と 管理者宛メール設定 に分割
|
36 |
* Note : データベースには 管理者宛メール設定 のデータが保存される
|
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 |
|
19 |
* The page changes by the same URL or individual URL are possible.
|
20 |
* Many validation rules
|
21 |
|
22 |
+
MW WP Form はショートコードを使って確認画面付きのメールフォームを作成することができるプラグインです。
|
23 |
+
|
24 |
+
・ショートコードを使用したフォーム生成
|
25 |
+
・確認画面が表示可能
|
26 |
+
・同一URL・個別URLでの画面変遷が可能
|
27 |
+
・豊富なバリデーションルール
|
28 |
+
|
29 |
http://2inc.org/blog/category/products/wordpress_plugins/mw-wp-form/
|
30 |
|
31 |
== Installation ==
|
38 |
|
39 |
== Changelog ==
|
40 |
|
41 |
+
= 0.8 =
|
42 |
+
* Added : 画像アップロードフィールドを追加
|
43 |
+
* Added : ファイルアップロードフィールドを追加
|
44 |
+
* Added : ファイルタイプ バリデーション項目を追加
|
45 |
+
* Added : ファイルサイズ バリデーション項目を追加
|
46 |
+
* Added : 管理画面で不正な値は save しないように修正
|
47 |
+
* Added : datepickerで年月をセレクトボックスで選択できる設定をデフォルトに
|
48 |
+
* Added : アクションフック mwform_add_shortcode, mwform_add_qtags 追加
|
49 |
+
* Bug fix: バリデーション項目 文字数の範囲, 最小文字数 の挙動を修正
|
50 |
+
* Cahged : フォーム制作画面でビジュアルエディタを使えるように変更
|
51 |
+
|
52 |
= 0.7.1 =
|
53 |
* Added : メール設定を 自動返信メール設定 と 管理者宛メール設定 に分割
|
54 |
* Note : データベースには 管理者宛メール設定 のデータが保存される
|
system/mw_form.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Name: MW Form
|
4 |
* URI: http://2inc.org
|
5 |
* Description: フォームクラス
|
6 |
-
* Version: 1.
|
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)
|
@@ -190,8 +190,8 @@ class MW_Form {
|
|
190 |
$separator = $this->getSeparatorValue( $key );
|
191 |
// すべて空のからのときはimplodeしないように(---がいってしまうため)
|
192 |
if ( is_array( $this->data[$key]['data'] ) && array_key_exists( 'data', $this->data[$key] ) && !empty( $separator ) ) {
|
193 |
-
foreach ( $this->data[$key]['data'] as $
|
194 |
-
if ( !( $
|
195 |
$_ret = implode( $separator, $this->data[$key]['data'] );
|
196 |
$_ret = $this->e( $_ret );
|
197 |
break;
|
@@ -222,8 +222,8 @@ class MW_Form {
|
|
222 |
$_ret = null;
|
223 |
$separator = $this->getSeparatorValue( $key );
|
224 |
if ( isset( $this->data[$key]['data'] ) && is_array( $this->data[$key]['data'] ) && array_key_exists( 'data', $this->data[$key] ) && !empty( $separator ) ) {
|
225 |
-
foreach ( $this->data[$key]['data'] as $
|
226 |
-
if ( isset( $data[$
|
227 |
$_ret = implode( $separator, $this->data[$key]['data'] );
|
228 |
$_ret = $this->e( $_ret );
|
229 |
break;
|
@@ -289,7 +289,7 @@ class MW_Form {
|
|
289 |
}
|
290 |
|
291 |
/**
|
292 |
-
start
|
293 |
* フォームタグ生成
|
294 |
* @param Array ( 'action' =>, 'enctype' => )
|
295 |
* @return String form開始タグ
|
@@ -297,7 +297,8 @@ class MW_Form {
|
|
297 |
public function start( $options = array() ) {
|
298 |
$defaults = array(
|
299 |
'action' => '',
|
300 |
-
'enctype' => 'application/x-www-form-urlencoded',
|
|
|
301 |
);
|
302 |
$options = array_merge( $defaults, $options );
|
303 |
$_ret = sprintf( '<form method="%s" action="%s" enctype="%s">',
|
@@ -312,9 +313,8 @@ class MW_Form {
|
|
312 |
*/
|
313 |
public function end() {
|
314 |
$_ret = '';
|
315 |
-
if ( $this->method == 'post' )
|
316 |
-
$_ret .=
|
317 |
-
}
|
318 |
$_ret .= '</form>';
|
319 |
return $_ret;
|
320 |
}
|
@@ -465,10 +465,10 @@ class MW_Form {
|
|
465 |
$options = array_merge( $defaults, $options );
|
466 |
$value = ( isset( $this->data[$name] ) )? $this->data[$name] : $options['value'];
|
467 |
$_ret = sprintf( '<select name="%s">', $this->e( $name ) );
|
468 |
-
foreach ( $children as $key => $
|
469 |
$selected = ( $key == $value )? ' selected="selected"' : '';
|
470 |
$_ret .= sprintf( '<option value="%s"%s>%s</option>',
|
471 |
-
$this->e( $key ), $selected, $this->e( $
|
472 |
);
|
473 |
}
|
474 |
$_ret .= '</select>';
|
@@ -490,10 +490,10 @@ class MW_Form {
|
|
490 |
$options = array_merge( $defaults, $options );
|
491 |
$value = ( isset( $this->data[$name] ) )? $this->data[$name] : $options['value'];
|
492 |
$_ret = '';
|
493 |
-
foreach ( $children as $key => $
|
494 |
$checked = ( $key == $value )? ' checked="checked"' : '';
|
495 |
$_ret .= sprintf( '<label><input type="radio" name="%s" value="%s"%s />%s</label>',
|
496 |
-
$this->e( $name ), $this->e( $key ), $checked, $this->e( $
|
497 |
);
|
498 |
}
|
499 |
return $_ret;
|
@@ -522,10 +522,10 @@ class MW_Form {
|
|
522 |
$value = explode( $separator, $value );
|
523 |
}
|
524 |
$_ret = '';
|
525 |
-
foreach ( $children as $key => $
|
526 |
$checked = ( is_array( $value ) && in_array( $key, $value ) )? ' checked="checked"' : '';
|
527 |
$_ret .= sprintf( '<label><input type="checkbox" name="%s" value="%s"%s />%s</label>',
|
528 |
-
$this->e( $name.'[data][]' ), $this->e( $key ), $checked, $this->e( $
|
529 |
);
|
530 |
}
|
531 |
$_ret .= $this->separator( $name, $separator );
|
@@ -562,7 +562,7 @@ class MW_Form {
|
|
562 |
* @param String name属性
|
563 |
* String size属性
|
564 |
* String value属性
|
565 |
-
|
566 |
* @return String ボタン
|
567 |
*/
|
568 |
public function datepicker( $name, $options = array() ) {
|
@@ -586,6 +586,24 @@ class MW_Form {
|
|
586 |
return $_ret;
|
587 |
}
|
588 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
/**
|
590 |
* e
|
591 |
* htmlサニタイズ
|
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: May 29, 2013
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
190 |
$separator = $this->getSeparatorValue( $key );
|
191 |
// すべて空のからのときはimplodeしないように(---がいってしまうため)
|
192 |
if ( is_array( $this->data[$key]['data'] ) && array_key_exists( 'data', $this->data[$key] ) && !empty( $separator ) ) {
|
193 |
+
foreach ( $this->data[$key]['data'] as $value ) {
|
194 |
+
if ( !( $value === '' || $value === null ) ) {
|
195 |
$_ret = implode( $separator, $this->data[$key]['data'] );
|
196 |
$_ret = $this->e( $_ret );
|
197 |
break;
|
222 |
$_ret = null;
|
223 |
$separator = $this->getSeparatorValue( $key );
|
224 |
if ( isset( $this->data[$key]['data'] ) && is_array( $this->data[$key]['data'] ) && array_key_exists( 'data', $this->data[$key] ) && !empty( $separator ) ) {
|
225 |
+
foreach ( $this->data[$key]['data'] as $value ) {
|
226 |
+
if ( isset( $data[$value] ) ) {
|
227 |
$_ret = implode( $separator, $this->data[$key]['data'] );
|
228 |
$_ret = $this->e( $_ret );
|
229 |
break;
|
289 |
}
|
290 |
|
291 |
/**
|
292 |
+
* start
|
293 |
* フォームタグ生成
|
294 |
* @param Array ( 'action' =>, 'enctype' => )
|
295 |
* @return String form開始タグ
|
297 |
public function start( $options = array() ) {
|
298 |
$defaults = array(
|
299 |
'action' => '',
|
300 |
+
//'enctype' => 'application/x-www-form-urlencoded',
|
301 |
+
'enctype' => 'multipart/form-data',
|
302 |
);
|
303 |
$options = array_merge( $defaults, $options );
|
304 |
$_ret = sprintf( '<form method="%s" action="%s" enctype="%s">',
|
313 |
*/
|
314 |
public function end() {
|
315 |
$_ret = '';
|
316 |
+
if ( $this->method == 'post' )
|
317 |
+
$_ret .= $this->hidden( $this->tokenName, $this->token );
|
|
|
318 |
$_ret .= '</form>';
|
319 |
return $_ret;
|
320 |
}
|
465 |
$options = array_merge( $defaults, $options );
|
466 |
$value = ( isset( $this->data[$name] ) )? $this->data[$name] : $options['value'];
|
467 |
$_ret = sprintf( '<select name="%s">', $this->e( $name ) );
|
468 |
+
foreach ( $children as $key => $_value ) {
|
469 |
$selected = ( $key == $value )? ' selected="selected"' : '';
|
470 |
$_ret .= sprintf( '<option value="%s"%s>%s</option>',
|
471 |
+
$this->e( $key ), $selected, $this->e( $_value )
|
472 |
);
|
473 |
}
|
474 |
$_ret .= '</select>';
|
490 |
$options = array_merge( $defaults, $options );
|
491 |
$value = ( isset( $this->data[$name] ) )? $this->data[$name] : $options['value'];
|
492 |
$_ret = '';
|
493 |
+
foreach ( $children as $key => $_value ) {
|
494 |
$checked = ( $key == $value )? ' checked="checked"' : '';
|
495 |
$_ret .= sprintf( '<label><input type="radio" name="%s" value="%s"%s />%s</label>',
|
496 |
+
$this->e( $name ), $this->e( $key ), $checked, $this->e( $_value )
|
497 |
);
|
498 |
}
|
499 |
return $_ret;
|
522 |
$value = explode( $separator, $value );
|
523 |
}
|
524 |
$_ret = '';
|
525 |
+
foreach ( $children as $key => $_value ) {
|
526 |
$checked = ( is_array( $value ) && in_array( $key, $value ) )? ' checked="checked"' : '';
|
527 |
$_ret .= sprintf( '<label><input type="checkbox" name="%s" value="%s"%s />%s</label>',
|
528 |
+
$this->e( $name.'[data][]' ), $this->e( $key ), $checked, $this->e( $_value )
|
529 |
);
|
530 |
}
|
531 |
$_ret .= $this->separator( $name, $separator );
|
562 |
* @param String name属性
|
563 |
* String size属性
|
564 |
* String value属性
|
565 |
+
* String js datepickerの引数
|
566 |
* @return String ボタン
|
567 |
*/
|
568 |
public function datepicker( $name, $options = array() ) {
|
586 |
return $_ret;
|
587 |
}
|
588 |
|
589 |
+
/**
|
590 |
+
* file
|
591 |
+
* input[type=file]タグ生成
|
592 |
+
* @param String name属性
|
593 |
+
* Array ( 'size' => )
|
594 |
+
* @return String htmlタグ
|
595 |
+
*/
|
596 |
+
public function file( $name, $options = array() ) {
|
597 |
+
$defaults = array(
|
598 |
+
'size' => 60,
|
599 |
+
);
|
600 |
+
$options = array_merge( $defaults, $options );
|
601 |
+
$_ret = sprintf( '<input type="file" name="%s" size="%d" />',
|
602 |
+
$this->e( $name ), $this->e( $options['size'] )
|
603 |
+
);
|
604 |
+
return $_ret;
|
605 |
+
}
|
606 |
+
|
607 |
/**
|
608 |
* e
|
609 |
* htmlサニタイズ
|
system/mw_form_field.php
CHANGED
@@ -3,23 +3,24 @@
|
|
3 |
* Name: MW Form Field
|
4 |
* URI: http://2inc.org
|
5 |
* Description: フォームフィールドの抽象クラス
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: December 14, 2012
|
|
|
10 |
* License: GPL2
|
11 |
*
|
12 |
-
* Copyright
|
13 |
-
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License, version 2, as
|
16 |
* published by the Free Software Foundation.
|
17 |
-
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
-
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
@@ -27,9 +28,9 @@
|
|
27 |
abstract class mw_form_field {
|
28 |
|
29 |
/**
|
30 |
-
*
|
31 |
*/
|
32 |
-
|
33 |
|
34 |
/**
|
35 |
* Form $Form
|
@@ -41,16 +42,6 @@ abstract class mw_form_field {
|
|
41 |
*/
|
42 |
protected $defaults;
|
43 |
|
44 |
-
/**
|
45 |
-
* Array $atts 属性値等
|
46 |
-
*/
|
47 |
-
protected $atts;
|
48 |
-
|
49 |
-
/**
|
50 |
-
* String $viewFlg 表示ページ種別( input, preview )
|
51 |
-
*/
|
52 |
-
protected $viewFlg;
|
53 |
-
|
54 |
/**
|
55 |
* Error $Error エラーオブジェクト
|
56 |
*/
|
@@ -58,36 +49,13 @@ abstract class mw_form_field {
|
|
58 |
|
59 |
/**
|
60 |
* __construct
|
61 |
-
* @param mw_form $Form
|
62 |
-
* Array $atts 属性値等
|
63 |
-
* String $viewFlg 表示ページ種別( input, preview )
|
64 |
*/
|
65 |
-
public function __construct(
|
66 |
-
$this->Form = $Form;
|
67 |
$this->defaults = $this->setDefaults();
|
68 |
-
|
69 |
-
$this
|
70 |
-
$this->Error = $Error;
|
71 |
}
|
72 |
|
73 |
-
/**
|
74 |
-
* getField
|
75 |
-
* フォーム項目を返す
|
76 |
-
* @return String HTML
|
77 |
-
*/
|
78 |
-
public function getField() {
|
79 |
-
switch( $this->viewFlg ) {
|
80 |
-
case 'input' :
|
81 |
-
return $this->inputPage();
|
82 |
-
break;
|
83 |
-
case 'preview' :
|
84 |
-
return $this->previewPage();
|
85 |
-
break;
|
86 |
-
default :
|
87 |
-
exit( '$viewFlg is not right value.' );
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
/**
|
92 |
* getError
|
93 |
* @param String フォーム項目名
|
@@ -113,29 +81,80 @@ abstract class mw_form_field {
|
|
113 |
/**
|
114 |
* inputPage
|
115 |
* 入力ページでのフォーム項目を返す
|
|
|
116 |
* @return String HTML
|
117 |
*/
|
118 |
-
abstract protected function inputPage();
|
|
|
|
|
|
|
|
|
119 |
|
120 |
/**
|
121 |
* previewPage
|
122 |
* 確認ページでのフォーム項目を返す
|
|
|
123 |
* @return String HTML
|
124 |
*/
|
125 |
-
abstract protected function previewPage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
/**
|
128 |
* getChildren
|
129 |
* 選択肢の配列を返す
|
|
|
130 |
* @return Array $children
|
131 |
*/
|
132 |
-
protected function getChildren() {
|
133 |
$children = array();
|
134 |
-
if ( !is_array( $
|
135 |
-
$_children = explode( ',', $
|
136 |
foreach ( $_children as $child ) {
|
137 |
$children[$child] = $child;
|
138 |
}
|
139 |
return $children;
|
140 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
|
|
|
|
|
3 |
* Name: MW Form Field
|
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: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
abstract class mw_form_field {
|
29 |
|
30 |
/**
|
31 |
+
* String $short_code_name
|
32 |
*/
|
33 |
+
protected $short_code_name;
|
34 |
|
35 |
/**
|
36 |
* Form $Form
|
42 |
*/
|
43 |
protected $defaults;
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
/**
|
46 |
* Error $Error エラーオブジェクト
|
47 |
*/
|
49 |
|
50 |
/**
|
51 |
* __construct
|
|
|
|
|
|
|
52 |
*/
|
53 |
+
public function __construct() {
|
|
|
54 |
$this->defaults = $this->setDefaults();
|
55 |
+
add_action( 'mwform_add_shortcode', array( $this, 'add_shortcode' ), 10, 3 );
|
56 |
+
add_action( 'mwform_add_qtags', array( $this, '_add_qtags' ) );
|
|
|
57 |
}
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
/**
|
60 |
* getError
|
61 |
* @param String フォーム項目名
|
81 |
/**
|
82 |
* inputPage
|
83 |
* 入力ページでのフォーム項目を返す
|
84 |
+
* @param Array $atts
|
85 |
* @return String HTML
|
86 |
*/
|
87 |
+
abstract protected function inputPage( $atts );
|
88 |
+
public function _inputPage( $atts ) {
|
89 |
+
$atts = shortcode_atts( $this->defaults, $atts );
|
90 |
+
return $this->inputPage( $atts );
|
91 |
+
}
|
92 |
|
93 |
/**
|
94 |
* previewPage
|
95 |
* 確認ページでのフォーム項目を返す
|
96 |
+
* @param Array $atts
|
97 |
* @return String HTML
|
98 |
*/
|
99 |
+
abstract protected function previewPage( $atts );
|
100 |
+
public function _previewPage( $atts ) {
|
101 |
+
$atts = shortcode_atts( $this->defaults, $atts );
|
102 |
+
return $this->previewPage( $atts );
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* add_short_code
|
107 |
+
* フォーム項目を返す
|
108 |
+
* @param MW_Form $Form
|
109 |
+
* String $viewFlg
|
110 |
+
* MW_Error $Error
|
111 |
+
*/
|
112 |
+
public function add_shortcode( mw_form $Form, $viewFlg, mw_error $Error ) {
|
113 |
+
if ( !empty( $this->short_code_name ) ) {
|
114 |
+
$this->Form = $Form;
|
115 |
+
$this->Error = $Error;
|
116 |
+
switch( $viewFlg ) {
|
117 |
+
case 'input' :
|
118 |
+
add_shortcode( $this->short_code_name, array( $this, '_inputPage' ) );
|
119 |
+
break;
|
120 |
+
case 'preview' :
|
121 |
+
add_shortcode( $this->short_code_name, array( $this, '_previewPage' ) );
|
122 |
+
break;
|
123 |
+
default :
|
124 |
+
exit( '$viewFlg is not right value.' );
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
128 |
|
129 |
/**
|
130 |
* getChildren
|
131 |
* 選択肢の配列を返す
|
132 |
+
* @param String $_children
|
133 |
* @return Array $children
|
134 |
*/
|
135 |
+
protected function getChildren( $_children ) {
|
136 |
$children = array();
|
137 |
+
if ( !is_array( $_children ) )
|
138 |
+
$_children = explode( ',', $_children );
|
139 |
foreach ( $_children as $child ) {
|
140 |
$children[$child] = $child;
|
141 |
}
|
142 |
return $children;
|
143 |
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* add_qtags
|
147 |
+
* QTags.addButton を出力
|
148 |
+
*/
|
149 |
+
abstract protected function add_qtags();
|
150 |
+
public function _add_qtags() {
|
151 |
+
?>
|
152 |
+
QTags.addButton(
|
153 |
+
<?php $this->add_qtags(); ?>
|
154 |
+
);
|
155 |
+
<?php
|
156 |
+
}
|
157 |
}
|
158 |
+
|
159 |
+
|
160 |
+
|
system/mw_mail.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Name: MW Mail
|
4 |
* URI: http://2inc.org
|
5 |
* Description: メールクラス
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: July 20, 2012
|
10 |
-
* Modified:
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
@@ -27,11 +27,12 @@
|
|
27 |
*/
|
28 |
class MW_Mail {
|
29 |
|
30 |
-
public $to;
|
31 |
-
public $from;
|
32 |
-
public $sender;
|
33 |
-
public $subject;
|
34 |
-
public $body;
|
|
|
35 |
// private $targetEncodeing = 'ISO-2022-JP';
|
36 |
private $ENCODE = 'utf-8';
|
37 |
|
@@ -73,7 +74,7 @@ class MW_Mail {
|
|
73 |
$to = explode( ',', $this->to );
|
74 |
if ( isset( $to[0] ) ) {
|
75 |
$to = trim( $to[0] );
|
76 |
-
wp_mail( $to, $subject, $body, $header );
|
77 |
// mail( $to, $subject, $body, $header );
|
78 |
}
|
79 |
}
|
@@ -90,22 +91,22 @@ class MW_Mail {
|
|
90 |
'exclude' => array()
|
91 |
);
|
92 |
$options = array_merge( $defaults, $options );
|
93 |
-
foreach( $array as $key => $
|
94 |
if ( in_array( $key, $options['exclude'] ) ) continue;
|
95 |
-
if ( is_array( $
|
96 |
-
if ( is_array( $
|
97 |
-
foreach ( $
|
98 |
if ( !( $_val === '' || $_val === null ) ) {
|
99 |
-
$
|
100 |
break;
|
101 |
}
|
102 |
-
$
|
103 |
}
|
104 |
} else {
|
105 |
-
$
|
106 |
}
|
107 |
}
|
108 |
-
$_ret .= sprintf( "▼%s\n%s\n\n", $this->e( $key ), $this->e( $
|
109 |
}
|
110 |
return $_ret;
|
111 |
}
|
3 |
* Name: MW Mail
|
4 |
* URI: http://2inc.org
|
5 |
* Description: メールクラス
|
6 |
+
* Version: 1.3
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: July 20, 2012
|
10 |
+
* Modified: May 29, 2013
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
27 |
*/
|
28 |
class MW_Mail {
|
29 |
|
30 |
+
public $to; // 宛先
|
31 |
+
public $from; // 送信元
|
32 |
+
public $sender; // 送信者
|
33 |
+
public $subject; // 題名
|
34 |
+
public $body; // 本文
|
35 |
+
public $attachments; // 添付
|
36 |
// private $targetEncodeing = 'ISO-2022-JP';
|
37 |
private $ENCODE = 'utf-8';
|
38 |
|
74 |
$to = explode( ',', $this->to );
|
75 |
if ( isset( $to[0] ) ) {
|
76 |
$to = trim( $to[0] );
|
77 |
+
wp_mail( $to, $subject, $body, $header, $this->attachments );
|
78 |
// mail( $to, $subject, $body, $header );
|
79 |
}
|
80 |
}
|
91 |
'exclude' => array()
|
92 |
);
|
93 |
$options = array_merge( $defaults, $options );
|
94 |
+
foreach( $array as $key => $value ) {
|
95 |
if ( in_array( $key, $options['exclude'] ) ) continue;
|
96 |
+
if ( is_array( $value ) && array_key_exists( 'data', $value ) && array_key_exists( 'separator', $value ) ) {
|
97 |
+
if ( is_array( $value['data'] ) ) {
|
98 |
+
foreach ( $value['data'] as $_val ) {
|
99 |
if ( !( $_val === '' || $_val === null ) ) {
|
100 |
+
$value = implode( $value['separator'], $value['data'] );
|
101 |
break;
|
102 |
}
|
103 |
+
$value = '';
|
104 |
}
|
105 |
} else {
|
106 |
+
$value = $value['data'];
|
107 |
}
|
108 |
}
|
109 |
+
$_ret .= sprintf( "▼%s\n%s\n\n", $this->e( $key ), $this->e( $value ) );
|
110 |
}
|
111 |
return $_ret;
|
112 |
}
|
system/mw_session.php
CHANGED
@@ -3,24 +3,24 @@
|
|
3 |
* Name: MW Session
|
4 |
* URI: http://2inc.org
|
5 |
* Description: セッションクラス
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: July 17, 2012
|
10 |
-
* Modified:
|
11 |
* License: GPL2
|
12 |
*
|
13 |
-
* Copyright
|
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
|
17 |
* published by the Free Software Foundation.
|
18 |
-
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
-
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
@@ -67,11 +67,31 @@ class MW_Session {
|
|
67 |
* @param Array ( キー => 値, … )
|
68 |
*/
|
69 |
public function save( Array $data ) {
|
70 |
-
foreach ( $data as $key => $
|
71 |
-
$_SESSION[$this->name][$key] = $
|
72 |
}
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
/**
|
76 |
* getValue
|
77 |
* セッション変数から取得
|
3 |
* Name: MW Session
|
4 |
* URI: http://2inc.org
|
5 |
* Description: セッションクラス
|
6 |
+
* Version: 1.2
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: July 17, 2012
|
10 |
+
* Modified: May 29, 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
|
17 |
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
* This program is distributed in the hope that it will be useful,
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
* You should have received a copy of the GNU General Public License
|
25 |
* along with this program; if not, write to the Free Software
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
67 |
* @param Array ( キー => 値, … )
|
68 |
*/
|
69 |
public function save( Array $data ) {
|
70 |
+
foreach ( $data as $key => $value ) {
|
71 |
+
$_SESSION[$this->name][$key] = $value;
|
72 |
}
|
73 |
}
|
74 |
|
75 |
+
/**
|
76 |
+
* setValue
|
77 |
+
* セッション変数にセット
|
78 |
+
* @param String キー
|
79 |
+
* Mixed 値
|
80 |
+
*/
|
81 |
+
public function setValue( $key, $value ) {
|
82 |
+
$_SESSION[$this->name][$key] = $value;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* pushValue
|
87 |
+
* セッション変数にセット
|
88 |
+
* @param String キー
|
89 |
+
* Mixed 値
|
90 |
+
*/
|
91 |
+
public function pushValue( $key, $value ) {
|
92 |
+
$_SESSION[$this->name][$key][] = $value;
|
93 |
+
}
|
94 |
+
|
95 |
/**
|
96 |
* getValue
|
97 |
* セッション変数から取得
|
system/mw_validation.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Name: MW Validation
|
4 |
* URI: http://2inc.org
|
5 |
* Description: バリデーションクラス
|
6 |
-
* Version: 1.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: July 20, 2012
|
10 |
-
* Modified:
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
@@ -45,7 +45,7 @@ class MW_Validation {
|
|
45 |
|
46 |
private function getValue( $key ) {
|
47 |
$value = null;
|
48 |
-
if ( !
|
49 |
if ( is_array( $this->data[$key] ) ) {
|
50 |
if ( array_key_exists( 'data', $this->data[$key] ) ) {
|
51 |
if ( is_array( $this->data[$key]['data'] ) ) {
|
@@ -72,7 +72,7 @@ class MW_Validation {
|
|
72 |
$value = $this->getValue( $key );
|
73 |
if ( !isset( $value ) ) {
|
74 |
$defaults = array(
|
75 |
-
'message' => __( 'This is required.',
|
76 |
);
|
77 |
$options = array_merge( $defaults, $options );
|
78 |
$_ret = $options['message'];
|
@@ -90,14 +90,12 @@ class MW_Validation {
|
|
90 |
public function noEmpty( $key, $options = array() ) {
|
91 |
$_ret = '';
|
92 |
$value = $this->getValue( $key );
|
93 |
-
if ( isset( $value ) ) {
|
94 |
$defaults = array(
|
95 |
-
'message' => __( 'Please enter.',
|
96 |
);
|
97 |
$options = array_merge( $defaults, $options );
|
98 |
-
|
99 |
-
$_ret = $options['message'];
|
100 |
-
}
|
101 |
}
|
102 |
return $_ret;
|
103 |
}
|
@@ -114,7 +112,7 @@ class MW_Validation {
|
|
114 |
$value = $this->getValue( $key );
|
115 |
if ( isset( $value ) ) {
|
116 |
$defaults = array(
|
117 |
-
'message' => __( 'Please enter.',
|
118 |
);
|
119 |
$options = array_merge( $defaults, $options );
|
120 |
if ( empty( $value ) ) {
|
@@ -134,14 +132,12 @@ class MW_Validation {
|
|
134 |
public function alpha( $key, $options = array() ) {
|
135 |
$_ret = '';
|
136 |
$value = $this->getValue( $key );
|
137 |
-
if ( isset( $value ) ) {
|
138 |
$defaults = array(
|
139 |
-
'message' => __( 'Please enter with a half-width alphabetic character.',
|
140 |
);
|
141 |
$options = array_merge( $defaults, $options );
|
142 |
-
|
143 |
-
$_ret = $options['message'];
|
144 |
-
}
|
145 |
}
|
146 |
return $_ret;
|
147 |
}
|
@@ -156,14 +152,12 @@ class MW_Validation {
|
|
156 |
public function numeric( $key, $options = array() ) {
|
157 |
$_ret = '';
|
158 |
$value = $this->getValue( $key );
|
159 |
-
if ( isset( $value ) ) {
|
160 |
$defaults = array(
|
161 |
-
'message' => __( 'Please enter with a half-width number.',
|
162 |
);
|
163 |
$options = array_merge( $defaults, $options );
|
164 |
-
|
165 |
-
$_ret = $options['message'];
|
166 |
-
}
|
167 |
}
|
168 |
return $_ret;
|
169 |
}
|
@@ -178,14 +172,12 @@ class MW_Validation {
|
|
178 |
public function alphaNumeric( $key, $options = array() ) {
|
179 |
$_ret = '';
|
180 |
$value = $this->getValue( $key );
|
181 |
-
if ( isset( $value ) ) {
|
182 |
$defaults = array(
|
183 |
-
'message' => __( 'Please enter with a half-width alphanumeric character.',
|
184 |
);
|
185 |
$options = array_merge( $defaults, $options );
|
186 |
-
|
187 |
-
$_ret = $options['message'];
|
188 |
-
}
|
189 |
}
|
190 |
return $_ret;
|
191 |
}
|
@@ -202,7 +194,7 @@ class MW_Validation {
|
|
202 |
$value = $this->getValue( $key );
|
203 |
if ( isset( $value ) ) {
|
204 |
$defaults = array(
|
205 |
-
'message' => __( 'This is not the format of a zip code.',
|
206 |
);
|
207 |
$options = array_merge( $defaults, $options );
|
208 |
if ( !empty( $value ) ) {
|
@@ -229,7 +221,7 @@ class MW_Validation {
|
|
229 |
$value = $this->getValue( $key );
|
230 |
if ( isset( $value ) ) {
|
231 |
$defaults = array(
|
232 |
-
'message' => __( 'This is not the format of a tel number.',
|
233 |
);
|
234 |
$options = array_merge( $defaults, $options );
|
235 |
if ( !empty( $value ) ) {
|
@@ -254,14 +246,12 @@ class MW_Validation {
|
|
254 |
public function mail( $key, $options = array() ) {
|
255 |
$_ret = '';
|
256 |
$value = $this->getValue( $key );
|
257 |
-
if ( isset( $value ) ) {
|
258 |
$defaults = array(
|
259 |
-
'message' => __( 'This is not the format of a mail address.',
|
260 |
);
|
261 |
$options = array_merge( $defaults, $options );
|
262 |
-
|
263 |
-
$_ret = $options['message'];
|
264 |
-
}
|
265 |
}
|
266 |
return $_ret;
|
267 |
}
|
@@ -276,14 +266,12 @@ class MW_Validation {
|
|
276 |
public function url( $key, $options = array() ) {
|
277 |
$_ret = '';
|
278 |
$value = $this->getValue( $key );
|
279 |
-
if ( isset( $value ) ) {
|
280 |
$defaults = array(
|
281 |
-
'message' => __( 'This is not the format of a url.',
|
282 |
);
|
283 |
$options = array_merge( $defaults, $options );
|
284 |
-
|
285 |
-
$_ret = $options['message'];
|
286 |
-
}
|
287 |
}
|
288 |
return $_ret;
|
289 |
}
|
@@ -301,7 +289,7 @@ class MW_Validation {
|
|
301 |
if ( isset( $value ) ) {
|
302 |
$defaults = array(
|
303 |
'target' => null,
|
304 |
-
'message' => __( 'This is not in agreement.',
|
305 |
);
|
306 |
$options = array_merge( $defaults, $options );
|
307 |
if ( !( isset( $this->data[$options['target']] ) && $value == $this->data[$options['target']] ) ) {
|
@@ -321,16 +309,28 @@ class MW_Validation {
|
|
321 |
public function between( $key, $options = array() ) {
|
322 |
$_ret = '';
|
323 |
$value = $this->getValue( $key );
|
324 |
-
if ( isset( $value ) ) {
|
325 |
$defaults = array(
|
326 |
'min' => 0,
|
327 |
-
'max' => 0,
|
328 |
-
'message' => __( 'The number of characters is invalid.',
|
329 |
);
|
330 |
$options = array_merge( $defaults, $options );
|
331 |
$length = mb_strlen( $value, $this->ENCODE );
|
332 |
-
if (
|
333 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
}
|
335 |
}
|
336 |
return $_ret;
|
@@ -346,14 +346,14 @@ class MW_Validation {
|
|
346 |
public function minLength( $key, $options = array() ) {
|
347 |
$_ret = '';
|
348 |
$value = $this->getValue( $key );
|
349 |
-
if ( isset( $value ) ) {
|
350 |
$defaults = array(
|
351 |
'min' => 0,
|
352 |
-
'message' => __( 'The number of characters is a few.',
|
353 |
);
|
354 |
$options = array_merge( $defaults, $options );
|
355 |
$length = mb_strlen( $value, $this->ENCODE );
|
356 |
-
if (
|
357 |
$_ret = $options['message'];
|
358 |
}
|
359 |
}
|
@@ -373,7 +373,7 @@ class MW_Validation {
|
|
373 |
if ( isset( $value ) ) {
|
374 |
$defaults = array(
|
375 |
'options' => array(),
|
376 |
-
'message' => __( 'This value is invalid.',
|
377 |
);
|
378 |
$options = array_merge( $defaults, $options );
|
379 |
if ( !( isset( $options[ 'options' ] ) && is_array( $options[ 'options' ] ) ) ) {
|
@@ -395,7 +395,7 @@ class MW_Validation {
|
|
395 |
$value = $this->getValue( $key );
|
396 |
if ( isset( $value ) ) {
|
397 |
$defaults = array(
|
398 |
-
'message' => __( 'This is not the format of a date.',
|
399 |
);
|
400 |
$options = array_merge( $defaults, $options );
|
401 |
$timestamp = strtotime( $value );
|
@@ -410,6 +410,60 @@ class MW_Validation {
|
|
410 |
return $_ret;
|
411 |
}
|
412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
/**
|
414 |
* Error
|
415 |
* エラーオブジェクトを返す
|
@@ -487,7 +541,7 @@ class MW_Validation {
|
|
487 |
}
|
488 |
|
489 |
/**
|
490 |
-
*
|
491 |
* 値が空(0は許可)
|
492 |
* @param Mixed
|
493 |
* @return Boolean
|
3 |
* Name: MW Validation
|
4 |
* URI: http://2inc.org
|
5 |
* Description: バリデーションクラス
|
6 |
+
* Version: 1.3
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: July 20, 2012
|
10 |
+
* Modified: May 29, 2013
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
45 |
|
46 |
private function getValue( $key ) {
|
47 |
$value = null;
|
48 |
+
if ( !isset( $this->data[$key] ) ) return $value;
|
49 |
if ( is_array( $this->data[$key] ) ) {
|
50 |
if ( array_key_exists( 'data', $this->data[$key] ) ) {
|
51 |
if ( is_array( $this->data[$key]['data'] ) ) {
|
72 |
$value = $this->getValue( $key );
|
73 |
if ( !isset( $value ) ) {
|
74 |
$defaults = array(
|
75 |
+
'message' => __( 'This is required.', MWF_Config::DOMAIN )
|
76 |
);
|
77 |
$options = array_merge( $defaults, $options );
|
78 |
$_ret = $options['message'];
|
90 |
public function noEmpty( $key, $options = array() ) {
|
91 |
$_ret = '';
|
92 |
$value = $this->getValue( $key );
|
93 |
+
if ( isset( $value ) && $this->isEmpty( $value ) ) {
|
94 |
$defaults = array(
|
95 |
+
'message' => __( 'Please enter.', MWF_Config::DOMAIN )
|
96 |
);
|
97 |
$options = array_merge( $defaults, $options );
|
98 |
+
$_ret = $options['message'];
|
|
|
|
|
99 |
}
|
100 |
return $_ret;
|
101 |
}
|
112 |
$value = $this->getValue( $key );
|
113 |
if ( isset( $value ) ) {
|
114 |
$defaults = array(
|
115 |
+
'message' => __( 'Please enter.', MWF_Config::DOMAIN )
|
116 |
);
|
117 |
$options = array_merge( $defaults, $options );
|
118 |
if ( empty( $value ) ) {
|
132 |
public function alpha( $key, $options = array() ) {
|
133 |
$_ret = '';
|
134 |
$value = $this->getValue( $key );
|
135 |
+
if ( isset( $value ) && !preg_match( '/^[A-Za-z]+$/', $value ) && !$this->isEmpty( $value ) ) {
|
136 |
$defaults = array(
|
137 |
+
'message' => __( 'Please enter with a half-width alphabetic character.', MWF_Config::DOMAIN )
|
138 |
);
|
139 |
$options = array_merge( $defaults, $options );
|
140 |
+
$_ret = $options['message'];
|
|
|
|
|
141 |
}
|
142 |
return $_ret;
|
143 |
}
|
152 |
public function numeric( $key, $options = array() ) {
|
153 |
$_ret = '';
|
154 |
$value = $this->getValue( $key );
|
155 |
+
if ( isset( $value ) && !preg_match( '/^[0-9]+$/', $value ) && !$this->isEmpty( $value ) ) {
|
156 |
$defaults = array(
|
157 |
+
'message' => __( 'Please enter with a half-width number.', MWF_Config::DOMAIN )
|
158 |
);
|
159 |
$options = array_merge( $defaults, $options );
|
160 |
+
$_ret = $options['message'];
|
|
|
|
|
161 |
}
|
162 |
return $_ret;
|
163 |
}
|
172 |
public function alphaNumeric( $key, $options = array() ) {
|
173 |
$_ret = '';
|
174 |
$value = $this->getValue( $key );
|
175 |
+
if ( isset( $value ) && !preg_match( '/^[0-9A-Za-z]+$/', $value ) && !$this->isEmpty( $value ) ) {
|
176 |
$defaults = array(
|
177 |
+
'message' => __( 'Please enter with a half-width alphanumeric character.', MWF_Config::DOMAIN )
|
178 |
);
|
179 |
$options = array_merge( $defaults, $options );
|
180 |
+
$_ret = $options['message'];
|
|
|
|
|
181 |
}
|
182 |
return $_ret;
|
183 |
}
|
194 |
$value = $this->getValue( $key );
|
195 |
if ( isset( $value ) ) {
|
196 |
$defaults = array(
|
197 |
+
'message' => __( 'This is not the format of a zip code.', MWF_Config::DOMAIN )
|
198 |
);
|
199 |
$options = array_merge( $defaults, $options );
|
200 |
if ( !empty( $value ) ) {
|
221 |
$value = $this->getValue( $key );
|
222 |
if ( isset( $value ) ) {
|
223 |
$defaults = array(
|
224 |
+
'message' => __( 'This is not the format of a tel number.', MWF_Config::DOMAIN )
|
225 |
);
|
226 |
$options = array_merge( $defaults, $options );
|
227 |
if ( !empty( $value ) ) {
|
246 |
public function mail( $key, $options = array() ) {
|
247 |
$_ret = '';
|
248 |
$value = $this->getValue( $key );
|
249 |
+
if ( isset( $value ) && !preg_match( '/^[^@]+@[^@]+$/', $value ) && !$this->isEmpty( $value ) ) {
|
250 |
$defaults = array(
|
251 |
+
'message' => __( 'This is not the format of a mail address.', MWF_Config::DOMAIN )
|
252 |
);
|
253 |
$options = array_merge( $defaults, $options );
|
254 |
+
$_ret = $options['message'];
|
|
|
|
|
255 |
}
|
256 |
return $_ret;
|
257 |
}
|
266 |
public function url( $key, $options = array() ) {
|
267 |
$_ret = '';
|
268 |
$value = $this->getValue( $key );
|
269 |
+
if ( isset( $value ) && !preg_match( '/^https{0,1}:\/\//', $value ) && !$this->isEmpty( $value ) ) {
|
270 |
$defaults = array(
|
271 |
+
'message' => __( 'This is not the format of a url.', MWF_Config::DOMAIN )
|
272 |
);
|
273 |
$options = array_merge( $defaults, $options );
|
274 |
+
$_ret = $options['message'];
|
|
|
|
|
275 |
}
|
276 |
return $_ret;
|
277 |
}
|
289 |
if ( isset( $value ) ) {
|
290 |
$defaults = array(
|
291 |
'target' => null,
|
292 |
+
'message' => __( 'This is not in agreement.', MWF_Config::DOMAIN )
|
293 |
);
|
294 |
$options = array_merge( $defaults, $options );
|
295 |
if ( !( isset( $this->data[$options['target']] ) && $value == $this->data[$options['target']] ) ) {
|
309 |
public function between( $key, $options = array() ) {
|
310 |
$_ret = '';
|
311 |
$value = $this->getValue( $key );
|
312 |
+
if ( isset( $value ) && !$this->isEmpty( $value ) ) {
|
313 |
$defaults = array(
|
314 |
'min' => 0,
|
315 |
+
// 'max' => 0,
|
316 |
+
'message' => __( 'The number of characters is invalid.', MWF_Config::DOMAIN )
|
317 |
);
|
318 |
$options = array_merge( $defaults, $options );
|
319 |
$length = mb_strlen( $value, $this->ENCODE );
|
320 |
+
if ( MWF_Functions::is_numeric( $options['min'] ) ) {
|
321 |
+
if ( MWF_Functions::is_numeric( $options['max'] ) ) {
|
322 |
+
if ( !( $options['min'] <= $length && $length <= $options['max'] ) ) {
|
323 |
+
$_ret = $options['message'];
|
324 |
+
}
|
325 |
+
} else {
|
326 |
+
if ( $options['min'] > $length ) {
|
327 |
+
$_ret = $options['message'];
|
328 |
+
}
|
329 |
+
}
|
330 |
+
} elseif ( MWF_Functions::is_numeric( $options['max'] ) ) {
|
331 |
+
if ( $options['max'] < $length ) {
|
332 |
+
$_ret = $options['message'];
|
333 |
+
}
|
334 |
}
|
335 |
}
|
336 |
return $_ret;
|
346 |
public function minLength( $key, $options = array() ) {
|
347 |
$_ret = '';
|
348 |
$value = $this->getValue( $key );
|
349 |
+
if ( isset( $value ) && !$this->isEmpty( $value ) ) {
|
350 |
$defaults = array(
|
351 |
'min' => 0,
|
352 |
+
'message' => __( 'The number of characters is a few.', MWF_Config::DOMAIN )
|
353 |
);
|
354 |
$options = array_merge( $defaults, $options );
|
355 |
$length = mb_strlen( $value, $this->ENCODE );
|
356 |
+
if ( MWF_Functions::is_numeric( $options['min'] ) && $options['min'] > $length ) {
|
357 |
$_ret = $options['message'];
|
358 |
}
|
359 |
}
|
373 |
if ( isset( $value ) ) {
|
374 |
$defaults = array(
|
375 |
'options' => array(),
|
376 |
+
'message' => __( 'This value is invalid.', MWF_Config::DOMAIN )
|
377 |
);
|
378 |
$options = array_merge( $defaults, $options );
|
379 |
if ( !( isset( $options[ 'options' ] ) && is_array( $options[ 'options' ] ) ) ) {
|
395 |
$value = $this->getValue( $key );
|
396 |
if ( isset( $value ) ) {
|
397 |
$defaults = array(
|
398 |
+
'message' => __( 'This is not the format of a date.', MWF_Config::DOMAIN )
|
399 |
);
|
400 |
$options = array_merge( $defaults, $options );
|
401 |
$timestamp = strtotime( $value );
|
410 |
return $_ret;
|
411 |
}
|
412 |
|
413 |
+
/**
|
414 |
+
* fileType
|
415 |
+
* ファイル名が指定した拡張子を含む。types は , 区切り
|
416 |
+
* @param String キー
|
417 |
+
* Array ( 'types' =>, 'message' => )
|
418 |
+
* @return String エラーメッセージ
|
419 |
+
*/
|
420 |
+
public function fileType( $key, $options = array() ) {
|
421 |
+
$_ret = '';
|
422 |
+
$value = $this->getValue( $key );
|
423 |
+
if ( !empty( $value ) ) {
|
424 |
+
$defaults = array(
|
425 |
+
'types' => '',
|
426 |
+
'message' => __( 'This file is invalid.', MWF_Config::DOMAIN )
|
427 |
+
);
|
428 |
+
$options = array_merge( $defaults, $options );
|
429 |
+
$_types = explode( ',', $options['types'] );
|
430 |
+
foreach ( $_types as $type ) {
|
431 |
+
$types[] = preg_quote( trim( $type ) );
|
432 |
+
}
|
433 |
+
$types = implode( '|', $this->array_clean( $types ) );
|
434 |
+
$pattern = '/\.(' . $types . ')$/';
|
435 |
+
if ( !preg_match( $pattern, $value ) ) {
|
436 |
+
$_ret = $options['message'];
|
437 |
+
}
|
438 |
+
}
|
439 |
+
return $_ret;
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* fileSize
|
444 |
+
* ファイルが指定したサイズより小さい
|
445 |
+
* @param String キー
|
446 |
+
* Array ( 'bytes' =>, 'message' => )
|
447 |
+
* @return String エラーメッセージ
|
448 |
+
*/
|
449 |
+
public function fileSize( $key, $options = array() ) {
|
450 |
+
$_ret = '';
|
451 |
+
if ( isset( $_FILES[$key] ) ) {
|
452 |
+
$file = $_FILES[$key];
|
453 |
+
if ( !empty( $file['size'] ) ) {
|
454 |
+
$defaults = array(
|
455 |
+
'bytes' => '0',
|
456 |
+
'message' => __( 'This file size is too big.', MWF_Config::DOMAIN )
|
457 |
+
);
|
458 |
+
$options = array_merge( $defaults, $options );
|
459 |
+
if ( !( preg_match( '/^[\d]+$/', $options['bytes'] ) && $options['bytes'] > $file['size'] ) ) {
|
460 |
+
$_ret = $options['message'];
|
461 |
+
}
|
462 |
+
}
|
463 |
+
}
|
464 |
+
return $_ret;
|
465 |
+
}
|
466 |
+
|
467 |
/**
|
468 |
* Error
|
469 |
* エラーオブジェクトを返す
|
541 |
}
|
542 |
|
543 |
/**
|
544 |
+
* isEmpty
|
545 |
* 値が空(0は許可)
|
546 |
* @param Mixed
|
547 |
* @return Boolean
|
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.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: February 21, 2013
|
10 |
-
* Modified: May
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
@@ -27,9 +27,6 @@
|
|
27 |
*/
|
28 |
class MW_WP_Form_Admin_Page {
|
29 |
|
30 |
-
const NAME = 'mw-wp-form';
|
31 |
-
const DOMAIN = 'mw-wp-form';
|
32 |
-
const DBDATA = 'mwf_';
|
33 |
private $postdata;
|
34 |
private $form_post_type = array(); // DB登録使用時のカスタム投稿タイプ名
|
35 |
|
@@ -43,7 +40,7 @@ class MW_WP_Form_Admin_Page {
|
|
43 |
add_action( 'admin_head', array( $this, 'cpt_public_false' ) );
|
44 |
add_action( 'admin_head', array( $this, 'add_meta_box' ) );
|
45 |
add_action( 'save_post', array( $this, 'save_post' ) );
|
46 |
-
add_filter( 'user_can_richedit', array( $this, 'disable_visual_editor' ) );
|
47 |
add_action( 'admin_print_footer_scripts', array( $this, 'add_quicktag' ) );
|
48 |
}
|
49 |
|
@@ -61,47 +58,47 @@ class MW_WP_Form_Admin_Page {
|
|
61 |
* register_post_type
|
62 |
*/
|
63 |
public function register_post_type() {
|
64 |
-
register_post_type(
|
65 |
'label' => 'MW WP Form',
|
66 |
'labels' => array(
|
67 |
'name' => 'MW WP Form',
|
68 |
'singular_name' => 'MW WP Form',
|
69 |
-
'add_new_item' => __( 'Add New Form',
|
70 |
-
'edit_item' => __( 'Edit Form',
|
71 |
-
'new_item' => __( 'New Form',
|
72 |
-
'view_item' => __( 'View Form',
|
73 |
-
'search_items' => __( 'Search Forms',
|
74 |
-
'not_found' => __( 'No Forms found',
|
75 |
-
'not_found_in_trash' => __( 'No Forms found in Trash',
|
76 |
),
|
77 |
'public' => false,
|
78 |
'show_ui' => true,
|
79 |
) );
|
80 |
|
81 |
$_posts = get_posts( array(
|
82 |
-
'post_type' =>
|
83 |
'posts_per_page' => -1
|
84 |
) );
|
85 |
foreach ( $_posts as $_post ) {
|
86 |
-
$post_meta = get_post_meta( $_post->ID,
|
87 |
if ( empty( $post_meta['usedb'] ) )
|
88 |
continue;
|
89 |
|
90 |
-
$post_type =
|
91 |
register_post_type( $post_type, array(
|
92 |
'label' => $_post->post_title,
|
93 |
'labels' => array(
|
94 |
'name' => $_post->post_title,
|
95 |
'singular_name' => $_post->post_title,
|
96 |
-
'edit_item' => __( 'Edit ',
|
97 |
-
'view_item' => __( 'View',
|
98 |
-
'search_items' => __( 'Search',
|
99 |
-
'not_found' => __( 'No data found',
|
100 |
-
'not_found_in_trash' => __( 'No data found in Trash',
|
101 |
),
|
102 |
'public' => false,
|
103 |
'show_ui' => true,
|
104 |
-
'show_in_menu' => 'edit.php?post_type=' .
|
105 |
'supports' => array( 'title' ),
|
106 |
) );
|
107 |
$this->form_post_type[] = $post_type;
|
@@ -128,63 +125,63 @@ class MW_WP_Form_Admin_Page {
|
|
128 |
*/
|
129 |
public function add_meta_box() {
|
130 |
$post_type = get_post_type();
|
131 |
-
if (
|
132 |
global $post;
|
133 |
// 設定データ取得
|
134 |
-
$this->postdata = get_post_meta( $post->ID,
|
135 |
// 完了画面内容
|
136 |
add_meta_box(
|
137 |
-
|
138 |
-
__( 'Complete Message',
|
139 |
array( $this, 'add_complete_message' ),
|
140 |
-
|
141 |
);
|
142 |
// 入力画面URL
|
143 |
add_meta_box(
|
144 |
-
|
145 |
-
__( 'URL Options',
|
146 |
array( $this, 'add_url' ),
|
147 |
-
|
148 |
);
|
149 |
// バリデーション
|
150 |
add_meta_box(
|
151 |
-
|
152 |
-
__( 'Validation Rule',
|
153 |
array( $this, 'add_validation_rule' ),
|
154 |
-
|
155 |
);
|
156 |
// フォーム識別子
|
157 |
add_meta_box(
|
158 |
-
|
159 |
-
__( 'Form Key',
|
160 |
array( $this, 'display_form_key' ),
|
161 |
-
|
162 |
);
|
163 |
// 自動返信メール設定
|
164 |
add_meta_box(
|
165 |
-
|
166 |
-
__( 'Automatic Reply Email Options',
|
167 |
array( $this, 'add_mail_options' ),
|
168 |
-
|
169 |
);
|
170 |
// 管理者メール設定
|
171 |
add_meta_box(
|
172 |
-
|
173 |
-
__( 'Admin Email Options',
|
174 |
array( $this, 'add_admin_mail_options' ),
|
175 |
-
|
176 |
);
|
177 |
// 設定
|
178 |
add_meta_box(
|
179 |
-
|
180 |
-
__( 'settings',
|
181 |
array( $this, 'settings' ),
|
182 |
-
|
183 |
);
|
184 |
} elseif ( in_array( $post_type, $this->form_post_type ) ) {
|
185 |
add_meta_box(
|
186 |
-
|
187 |
-
__( 'Custom Fields',
|
188 |
array( $this, 'custom_fields' ),
|
189 |
$post_type
|
190 |
);
|
@@ -198,18 +195,39 @@ class MW_WP_Form_Admin_Page {
|
|
198 |
public function custom_fields() {
|
199 |
global $post;
|
200 |
$post_custom = get_post_custom( $post->ID );
|
|
|
201 |
if ( ! empty( $post_custom ) && is_array( $post_custom ) ) {
|
202 |
?>
|
203 |
<table border="0" cellpadding="0" cellspacing="0">
|
204 |
<?php
|
205 |
-
foreach ( $post_custom as $key => $
|
206 |
-
if ( $key
|
207 |
-
continue;
|
208 |
?>
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
<?php
|
214 |
}
|
215 |
?>
|
@@ -223,99 +241,10 @@ class MW_WP_Form_Admin_Page {
|
|
223 |
* HTMLエディタにクイックタグを追加
|
224 |
*/
|
225 |
public function add_quicktag() {
|
226 |
-
if (
|
227 |
<script type="text/javascript">
|
228 |
if ( typeof( QTags ) !== 'undefined' ) {
|
229 |
-
|
230 |
-
'<?php echo self::NAME; ?>_text',
|
231 |
-
'<?php _e( 'Text', self::DOMAIN ); ?>',
|
232 |
-
'[mwform_text name=""]',
|
233 |
-
''
|
234 |
-
);
|
235 |
-
QTags.addButton(
|
236 |
-
'<?php echo self::NAME; ?>_textarea',
|
237 |
-
'<?php _e( 'Textarea', self::DOMAIN ); ?>',
|
238 |
-
'[mwform_textarea name=""]',
|
239 |
-
''
|
240 |
-
);
|
241 |
-
QTags.addButton(
|
242 |
-
'<?php echo self::NAME; ?>_zip',
|
243 |
-
'<?php _e( 'Zip Code', self::DOMAIN ); ?>',
|
244 |
-
'[mwform_zip name=""]',
|
245 |
-
''
|
246 |
-
);
|
247 |
-
QTags.addButton(
|
248 |
-
'<?php echo self::NAME; ?>_tel',
|
249 |
-
'<?php _e( 'Tel', self::DOMAIN ); ?>',
|
250 |
-
'[mwform_tel name=""]',
|
251 |
-
''
|
252 |
-
);
|
253 |
-
QTags.addButton(
|
254 |
-
'<?php echo self::NAME; ?>_select',
|
255 |
-
'<?php _e( 'Select', self::DOMAIN ); ?>',
|
256 |
-
'[mwform_select name="" children=""]',
|
257 |
-
''
|
258 |
-
);
|
259 |
-
QTags.addButton(
|
260 |
-
'<?php echo self::NAME; ?>_radio',
|
261 |
-
'<?php _e( 'Radio', self::DOMAIN ); ?>',
|
262 |
-
'[mwform_radio name="" children=""]',
|
263 |
-
''
|
264 |
-
);
|
265 |
-
QTags.addButton(
|
266 |
-
'<?php echo self::NAME; ?>_checkbox',
|
267 |
-
'<?php _e( 'Checkbox', self::DOMAIN ); ?>',
|
268 |
-
'[mwform_checkbox name="" children=""]',
|
269 |
-
''
|
270 |
-
);
|
271 |
-
QTags.addButton(
|
272 |
-
'<?php echo self::NAME; ?>_datepicker',
|
273 |
-
'<?php _e( 'Datepicker', self::DOMAIN ); ?>',
|
274 |
-
'[mwform_datepicker name=""]',
|
275 |
-
''
|
276 |
-
);
|
277 |
-
QTags.addButton(
|
278 |
-
'<?php echo self::NAME; ?>_password',
|
279 |
-
'<?php _e( 'Password', self::DOMAIN ); ?>',
|
280 |
-
'[mwform_password name=""]',
|
281 |
-
''
|
282 |
-
);
|
283 |
-
QTags.addButton(
|
284 |
-
'<?php echo self::NAME; ?>_backButton',
|
285 |
-
'<?php _e( 'Back', self::DOMAIN ); ?>',
|
286 |
-
'[mwform_backButton]',
|
287 |
-
''
|
288 |
-
);
|
289 |
-
QTags.addButton(
|
290 |
-
'<?php echo self::NAME; ?>_submitButton',
|
291 |
-
'<?php _e( 'Confirm & Submit', self::DOMAIN ); ?>',
|
292 |
-
'[mwform_submitButton]',
|
293 |
-
''
|
294 |
-
);
|
295 |
-
QTags.addButton(
|
296 |
-
'<?php echo self::NAME; ?>_submit',
|
297 |
-
'<?php _e( 'Submit', self::DOMAIN ); ?>',
|
298 |
-
'[mwform_submit name="submit"]',
|
299 |
-
''
|
300 |
-
);
|
301 |
-
QTags.addButton(
|
302 |
-
'<?php echo self::NAME; ?>_button',
|
303 |
-
'<?php _e( 'Button', self::DOMAIN ); ?>',
|
304 |
-
'[mwform_button name=""]',
|
305 |
-
''
|
306 |
-
);
|
307 |
-
QTags.addButton(
|
308 |
-
'<?php echo self::NAME; ?>_hidden',
|
309 |
-
'<?php _e( 'Hidden', self::DOMAIN ); ?>',
|
310 |
-
'[mwform_hidden name=""]',
|
311 |
-
''
|
312 |
-
);
|
313 |
-
QTags.addButton(
|
314 |
-
'<?php echo self::NAME; ?>_error',
|
315 |
-
'<?php _e( 'Error Message', self::DOMAIN ); ?>',
|
316 |
-
'[mwform_error keys=""]',
|
317 |
-
''
|
318 |
-
);
|
319 |
}
|
320 |
</script>
|
321 |
<?php
|
@@ -328,10 +257,10 @@ class MW_WP_Form_Admin_Page {
|
|
328 |
*/
|
329 |
public function admin_style() {
|
330 |
$post_type = get_post_type();
|
331 |
-
if (
|
332 |
$url = plugin_dir_url( __FILE__ );
|
333 |
-
wp_register_style(
|
334 |
-
wp_enqueue_style(
|
335 |
}
|
336 |
}
|
337 |
|
@@ -340,10 +269,10 @@ class MW_WP_Form_Admin_Page {
|
|
340 |
* JavaScript適用
|
341 |
*/
|
342 |
public function admin_scripts() {
|
343 |
-
if (
|
344 |
$url = plugin_dir_url( __FILE__ );
|
345 |
-
wp_register_script(
|
346 |
-
wp_enqueue_script(
|
347 |
}
|
348 |
}
|
349 |
|
@@ -352,27 +281,50 @@ class MW_WP_Form_Admin_Page {
|
|
352 |
* @param $post_ID
|
353 |
*/
|
354 |
public function save_post( $post_ID ) {
|
355 |
-
if ( ! isset( $_POST[
|
356 |
return $post_ID;
|
357 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
358 |
return $post_ID;
|
359 |
-
if ( !wp_verify_nonce( $_POST[
|
360 |
return $post_ID;
|
361 |
if ( !current_user_can( 'manage_options', $post_ID ) )
|
362 |
return $post_ID;
|
363 |
|
364 |
-
$data = $_POST[
|
365 |
if ( !empty( $data['validation'] ) && is_array( $data['validation'] ) ) {
|
366 |
$validation = array();
|
367 |
foreach ( $data['validation'] as $_validation ) {
|
368 |
if ( empty( $_validation['target'] ) ) continue;
|
369 |
-
foreach ( $_validation as $key => $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
// 単一項目のとき
|
371 |
-
if ( empty( $
|
372 |
unset( $_validation[$key] );
|
373 |
}
|
374 |
// 配列のとき
|
375 |
-
elseif ( is_array( $
|
376 |
unset( $_validation[$key] );
|
377 |
}
|
378 |
}
|
@@ -380,8 +332,8 @@ class MW_WP_Form_Admin_Page {
|
|
380 |
}
|
381 |
$data['validation'] = $validation;
|
382 |
}
|
383 |
-
$old_data = get_post_meta( $post_ID,
|
384 |
-
update_post_meta( $post_ID,
|
385 |
}
|
386 |
|
387 |
/**
|
@@ -392,7 +344,7 @@ class MW_WP_Form_Admin_Page {
|
|
392 |
global $post;
|
393 |
?>
|
394 |
<p>
|
395 |
-
<?php _e( 'Copy and Paste this shortcode.',
|
396 |
<span id="formkey_field">[mwform_formkey key="<?php the_ID(); ?>"]</span>
|
397 |
</p>
|
398 |
<?php
|
@@ -406,12 +358,12 @@ class MW_WP_Form_Admin_Page {
|
|
406 |
global $post;
|
407 |
?>
|
408 |
<p>
|
409 |
-
<label><input type="checkbox" name="<?php echo esc_attr(
|
410 |
-
|
411 |
-
<?php _e( 'Example: {ID}, {post_title}, {post_meta} etc...',
|
412 |
</p>
|
413 |
<p>
|
414 |
-
<input type="checkbox" name="<?php echo esc_attr(
|
415 |
</p>
|
416 |
<?php
|
417 |
}
|
@@ -423,8 +375,8 @@ class MW_WP_Form_Admin_Page {
|
|
423 |
public function add_complete_message() {
|
424 |
global $post;
|
425 |
$content = $this->get_post_data( 'complete_message' );
|
426 |
-
wp_editor( $content,
|
427 |
-
'textarea_name' =>
|
428 |
'textarea_rows' => 7,
|
429 |
) );
|
430 |
}
|
@@ -437,18 +389,18 @@ class MW_WP_Form_Admin_Page {
|
|
437 |
global $post;
|
438 |
?>
|
439 |
<p>
|
440 |
-
<b><?php _e( 'Subject',
|
441 |
-
<input type="text" name="<?php echo esc_attr(
|
442 |
</p>
|
443 |
<p>
|
444 |
-
<b><?php _e( 'Ccontent',
|
445 |
-
<textarea name="<?php echo esc_attr(
|
446 |
-
|
447 |
</p>
|
448 |
<p>
|
449 |
-
<b><?php _e( 'Automatic reply email',
|
450 |
-
<input type="text" name="<?php echo esc_attr(
|
451 |
-
|
452 |
</p>
|
453 |
<?php
|
454 |
}
|
@@ -461,21 +413,21 @@ class MW_WP_Form_Admin_Page {
|
|
461 |
global $post;
|
462 |
?>
|
463 |
<p>
|
464 |
-
<?php _e( 'If Admin Email Options is a blank, Automatic Replay Email Options is used as Admin Email Options.',
|
465 |
</p>
|
466 |
<p>
|
467 |
-
<b><?php _e( 'To ( E-mail address )',
|
468 |
-
<input type="text" name="<?php echo esc_attr(
|
469 |
-
|
470 |
</p>
|
471 |
<p>
|
472 |
-
<b><?php _e( 'Subject',
|
473 |
-
<input type="text" name="<?php echo esc_attr(
|
474 |
</p>
|
475 |
<p>
|
476 |
-
<b><?php _e( 'Ccontent',
|
477 |
-
<textarea name="<?php echo esc_attr(
|
478 |
-
|
479 |
</p>
|
480 |
<?php
|
481 |
}
|
@@ -487,24 +439,24 @@ class MW_WP_Form_Admin_Page {
|
|
487 |
public function add_url() {
|
488 |
global $post;
|
489 |
?>
|
490 |
-
<input type="hidden" name="<?php echo esc_attr(
|
491 |
<table border="0" cellpadding="0" cellspacing="0">
|
492 |
<tr>
|
493 |
-
<th><?php _e( 'Input Page URL',
|
494 |
<td>
|
495 |
-
<input type="text" name="<?php echo esc_attr(
|
496 |
</td>
|
497 |
</tr>
|
498 |
<tr>
|
499 |
-
<th><?php _e( 'Confirmation Page URL',
|
500 |
<td>
|
501 |
-
<input type="text" name="<?php echo esc_attr(
|
502 |
</td>
|
503 |
</tr>
|
504 |
<tr>
|
505 |
-
<th><?php _e( 'Complete Page URL',
|
506 |
<td>
|
507 |
-
<input type="text" name="<?php echo esc_attr(
|
508 |
</td>
|
509 |
</tr>
|
510 |
</table>
|
@@ -533,46 +485,56 @@ class MW_WP_Form_Admin_Page {
|
|
533 |
'eq' => array(),
|
534 |
'between' => array(),
|
535 |
'minlength' => array(),
|
|
|
|
|
536 |
);
|
537 |
// 空の隠れバリデーションフィールド(コピー元)を挿入
|
538 |
array_unshift( $postdata, $validation_keys );
|
539 |
?>
|
540 |
-
<b id="add-validation-btn"><?php _e( 'Add Validation rule',
|
541 |
-
<?php foreach ( $postdata as $key => $
|
542 |
<div class="validation-box"<?php if ( $key === 0 ) : ?> style="display:none"<?php endif; ?>>
|
543 |
<div class="validation-remove"><b>×</b></div>
|
544 |
-
<div class="validation-btn"><span><?php echo esc_attr( $
|
545 |
<div class="validation-content">
|
546 |
-
<?php _e( 'The key which applies validation',
|
547 |
<table border="0" cellpadding="0" cellspacing="0">
|
548 |
<tr>
|
549 |
<td colspan="2">
|
550 |
-
<label><input type="checkbox" <?php checked( $
|
551 |
-
<label><input type="checkbox" <?php checked( $
|
552 |
-
<label><input type="checkbox" <?php checked( $
|
553 |
-
<label><input type="checkbox" <?php checked( $
|
554 |
-
<label><input type="checkbox" <?php checked( $
|
555 |
-
<label><input type="checkbox" <?php checked( $
|
556 |
-
<label><input type="checkbox" <?php checked( $
|
557 |
-
<label><input type="checkbox" <?php checked( $
|
558 |
-
<label><input type="checkbox" <?php checked( $
|
559 |
</td>
|
560 |
</tr>
|
561 |
<tr>
|
562 |
-
<td style="width:20%"><?php _e( 'The key at same value',
|
563 |
-
<td><input type="text" value="<?php echo esc_attr( @$
|
564 |
</tr>
|
565 |
<tr>
|
566 |
-
<td><?php _e( 'The range of the number of characters',
|
567 |
<td>
|
568 |
-
<input type="text" value="<?php echo esc_attr( @$
|
569 |
〜
|
570 |
-
<input type="text" value="<?php echo esc_attr( @$
|
571 |
</td>
|
572 |
</tr>
|
573 |
<tr>
|
574 |
-
<td><?php _e( 'The number of the minimum characters',
|
575 |
-
<td><input type="text" value="<?php echo esc_attr( @$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
576 |
</tr>
|
577 |
</table>
|
578 |
<!-- end .validation-content --></div>
|
@@ -586,7 +548,7 @@ class MW_WP_Form_Admin_Page {
|
|
586 |
* ビジュアルエディタを無効に
|
587 |
*/
|
588 |
public function disable_visual_editor() {
|
589 |
-
if (
|
590 |
return false;
|
591 |
}
|
592 |
return true;
|
@@ -609,12 +571,12 @@ class MW_WP_Form_Admin_Page {
|
|
609 |
public function add_form_columns_name( $columns ) {
|
610 |
global $posts;
|
611 |
unset( $columns['date'] );
|
612 |
-
$columns['post_date'] = __( 'Registed Date',
|
613 |
foreach ( $posts as $post ) {
|
614 |
$post_custom_keys = get_post_custom_keys( $post->ID );
|
615 |
if ( ! empty( $post_custom_keys ) && is_array( $post_custom_keys ) ) {
|
616 |
foreach ( $post_custom_keys as $key ) {
|
617 |
-
if (
|
618 |
continue;
|
619 |
$columns[$key] = $key;
|
620 |
}
|
3 |
* Name: MW WP Form Admin Page
|
4 |
* URI: http://2inc.org
|
5 |
* Description: 管理画面クラス
|
6 |
+
* Version: 1.3
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created: February 21, 2013
|
10 |
+
* Modified: May 29, 2013
|
11 |
* License: GPL2
|
12 |
*
|
13 |
* Copyright 2013 Takashi Kitajima (email : inc@2inc.org)
|
27 |
*/
|
28 |
class MW_WP_Form_Admin_Page {
|
29 |
|
|
|
|
|
|
|
30 |
private $postdata;
|
31 |
private $form_post_type = array(); // DB登録使用時のカスタム投稿タイプ名
|
32 |
|
40 |
add_action( 'admin_head', array( $this, 'cpt_public_false' ) );
|
41 |
add_action( 'admin_head', array( $this, 'add_meta_box' ) );
|
42 |
add_action( 'save_post', array( $this, 'save_post' ) );
|
43 |
+
// add_filter( 'user_can_richedit', array( $this, 'disable_visual_editor' ) );
|
44 |
add_action( 'admin_print_footer_scripts', array( $this, 'add_quicktag' ) );
|
45 |
}
|
46 |
|
58 |
* register_post_type
|
59 |
*/
|
60 |
public function register_post_type() {
|
61 |
+
register_post_type( MWF_Config::NAME, array(
|
62 |
'label' => 'MW WP Form',
|
63 |
'labels' => array(
|
64 |
'name' => 'MW WP Form',
|
65 |
'singular_name' => 'MW WP Form',
|
66 |
+
'add_new_item' => __( 'Add New Form', MWF_Config::DOMAIN ),
|
67 |
+
'edit_item' => __( 'Edit Form', MWF_Config::DOMAIN ),
|
68 |
+
'new_item' => __( 'New Form', MWF_Config::DOMAIN ),
|
69 |
+
'view_item' => __( 'View Form', MWF_Config::DOMAIN ),
|
70 |
+
'search_items' => __( 'Search Forms', MWF_Config::DOMAIN ),
|
71 |
+
'not_found' => __( 'No Forms found', MWF_Config::DOMAIN ),
|
72 |
+
'not_found_in_trash' => __( 'No Forms found in Trash', MWF_Config::DOMAIN ),
|
73 |
),
|
74 |
'public' => false,
|
75 |
'show_ui' => true,
|
76 |
) );
|
77 |
|
78 |
$_posts = get_posts( array(
|
79 |
+
'post_type' => MWF_Config::NAME,
|
80 |
'posts_per_page' => -1
|
81 |
) );
|
82 |
foreach ( $_posts as $_post ) {
|
83 |
+
$post_meta = get_post_meta( $_post->ID, MWF_Config::NAME, true );
|
84 |
if ( empty( $post_meta['usedb'] ) )
|
85 |
continue;
|
86 |
|
87 |
+
$post_type = MWF_Config::DBDATA . $_post->ID;
|
88 |
register_post_type( $post_type, array(
|
89 |
'label' => $_post->post_title,
|
90 |
'labels' => array(
|
91 |
'name' => $_post->post_title,
|
92 |
'singular_name' => $_post->post_title,
|
93 |
+
'edit_item' => __( 'Edit ', MWF_Config::DOMAIN ) . ':' . $_post->post_title,
|
94 |
+
'view_item' => __( 'View', MWF_Config::DOMAIN ) . ':' . $_post->post_title,
|
95 |
+
'search_items' => __( 'Search', MWF_Config::DOMAIN ) . ':' . $_post->post_title,
|
96 |
+
'not_found' => __( 'No data found', MWF_Config::DOMAIN ),
|
97 |
+
'not_found_in_trash' => __( 'No data found in Trash', MWF_Config::DOMAIN ),
|
98 |
),
|
99 |
'public' => false,
|
100 |
'show_ui' => true,
|
101 |
+
'show_in_menu' => 'edit.php?post_type=' . MWF_Config::NAME,
|
102 |
'supports' => array( 'title' ),
|
103 |
) );
|
104 |
$this->form_post_type[] = $post_type;
|
125 |
*/
|
126 |
public function add_meta_box() {
|
127 |
$post_type = get_post_type();
|
128 |
+
if ( MWF_Config::NAME == $post_type ) {
|
129 |
global $post;
|
130 |
// 設定データ取得
|
131 |
+
$this->postdata = get_post_meta( $post->ID, MWF_Config::NAME, true );
|
132 |
// 完了画面内容
|
133 |
add_meta_box(
|
134 |
+
MWF_Config::NAME.'_complete_message_metabox',
|
135 |
+
__( 'Complete Message', MWF_Config::DOMAIN ),
|
136 |
array( $this, 'add_complete_message' ),
|
137 |
+
MWF_Config::NAME, 'normal'
|
138 |
);
|
139 |
// 入力画面URL
|
140 |
add_meta_box(
|
141 |
+
MWF_Config::NAME.'_url',
|
142 |
+
__( 'URL Options', MWF_Config::DOMAIN ),
|
143 |
array( $this, 'add_url' ),
|
144 |
+
MWF_Config::NAME, 'normal'
|
145 |
);
|
146 |
// バリデーション
|
147 |
add_meta_box(
|
148 |
+
MWF_Config::NAME.'_validation',
|
149 |
+
__( 'Validation Rule', MWF_Config::DOMAIN ),
|
150 |
array( $this, 'add_validation_rule' ),
|
151 |
+
MWF_Config::NAME, 'normal'
|
152 |
);
|
153 |
// フォーム識別子
|
154 |
add_meta_box(
|
155 |
+
MWF_Config::NAME.'_formkey',
|
156 |
+
__( 'Form Key', MWF_Config::DOMAIN ),
|
157 |
array( $this, 'display_form_key' ),
|
158 |
+
MWF_Config::NAME, 'side'
|
159 |
);
|
160 |
// 自動返信メール設定
|
161 |
add_meta_box(
|
162 |
+
MWF_Config::NAME.'_mail',
|
163 |
+
__( 'Automatic Reply Email Options', MWF_Config::DOMAIN ),
|
164 |
array( $this, 'add_mail_options' ),
|
165 |
+
MWF_Config::NAME, 'side'
|
166 |
);
|
167 |
// 管理者メール設定
|
168 |
add_meta_box(
|
169 |
+
MWF_Config::NAME.'_admin_mail',
|
170 |
+
__( 'Admin Email Options', MWF_Config::DOMAIN ),
|
171 |
array( $this, 'add_admin_mail_options' ),
|
172 |
+
MWF_Config::NAME, 'side'
|
173 |
);
|
174 |
// 設定
|
175 |
add_meta_box(
|
176 |
+
MWF_Config::NAME.'_settings',
|
177 |
+
__( 'settings', MWF_Config::DOMAIN ),
|
178 |
array( $this, 'settings' ),
|
179 |
+
MWF_Config::NAME, 'side'
|
180 |
);
|
181 |
} elseif ( in_array( $post_type, $this->form_post_type ) ) {
|
182 |
add_meta_box(
|
183 |
+
MWF_Config::NAME.'_custom_fields',
|
184 |
+
__( 'Custom Fields', MWF_Config::DOMAIN ),
|
185 |
array( $this, 'custom_fields' ),
|
186 |
$post_type
|
187 |
);
|
195 |
public function custom_fields() {
|
196 |
global $post;
|
197 |
$post_custom = get_post_custom( $post->ID );
|
198 |
+
$upload_file_keys = get_post_custom_values( '_' . MWF_Config::UPLOAD_FILE_KEYS, $post->ID );
|
199 |
if ( ! empty( $post_custom ) && is_array( $post_custom ) ) {
|
200 |
?>
|
201 |
<table border="0" cellpadding="0" cellspacing="0">
|
202 |
<?php
|
203 |
+
foreach ( $post_custom as $key => $value ) {
|
204 |
+
if ( preg_match( '/^_/', $key ) ) continue;
|
|
|
205 |
?>
|
206 |
+
<tr>
|
207 |
+
<th><?php echo esc_html( $key ); ?></th>
|
208 |
+
<td>
|
209 |
+
<?php
|
210 |
+
if ( is_array( $upload_file_keys ) && in_array( $key, $upload_file_keys ) ) {
|
211 |
+
$mimetype = get_post_mime_type( $value[0] );
|
212 |
+
if ( $mimetype ) {
|
213 |
+
// 画像だったら
|
214 |
+
if ( preg_match( '/^image\/.+?$/', $mimetype ) ) {
|
215 |
+
$src = wp_get_attachment_image_src( $value[0], 'midium' );
|
216 |
+
echo '<img src="' . esc_url( $src[0] ) .'" alt="" />';
|
217 |
+
}
|
218 |
+
// 画像以外
|
219 |
+
else {
|
220 |
+
$src = wp_get_attachment_image_src( $value[0], 'none', true );
|
221 |
+
echo '<img src="' . esc_url( $src[0] ) .'" alt="" />';
|
222 |
+
echo '<a href="' . esc_url( wp_get_attachment_url( $value[0] ) ) .'" target="_blank">' . esc_url( wp_get_attachment_url( $value[0] ) ) .'</a>';
|
223 |
+
}
|
224 |
+
}
|
225 |
+
} else {
|
226 |
+
echo nl2br( esc_html( $value[0] ) );
|
227 |
+
}
|
228 |
+
?>
|
229 |
+
</td>
|
230 |
+
</tr>
|
231 |
<?php
|
232 |
}
|
233 |
?>
|
241 |
* HTMLエディタにクイックタグを追加
|
242 |
*/
|
243 |
public function add_quicktag() {
|
244 |
+
if ( MWF_Config::NAME == get_post_type() ) : ?>
|
245 |
<script type="text/javascript">
|
246 |
if ( typeof( QTags ) !== 'undefined' ) {
|
247 |
+
<?php do_action( 'mwform_add_qtags' ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
}
|
249 |
</script>
|
250 |
<?php
|
257 |
*/
|
258 |
public function admin_style() {
|
259 |
$post_type = get_post_type();
|
260 |
+
if ( MWF_Config::NAME == $post_type || in_array( $post_type, $this->form_post_type ) ) {
|
261 |
$url = plugin_dir_url( __FILE__ );
|
262 |
+
wp_register_style( MWF_Config::DOMAIN.'-admin', $url.'../css/admin.css' );
|
263 |
+
wp_enqueue_style( MWF_Config::DOMAIN.'-admin' );
|
264 |
}
|
265 |
}
|
266 |
|
269 |
* JavaScript適用
|
270 |
*/
|
271 |
public function admin_scripts() {
|
272 |
+
if ( MWF_Config::NAME == get_post_type() ) {
|
273 |
$url = plugin_dir_url( __FILE__ );
|
274 |
+
wp_register_script( MWF_Config::DOMAIN.'-admin', $url.'../js/admin.js' );
|
275 |
+
wp_enqueue_script( MWF_Config::DOMAIN.'-admin' );
|
276 |
}
|
277 |
}
|
278 |
|
281 |
* @param $post_ID
|
282 |
*/
|
283 |
public function save_post( $post_ID ) {
|
284 |
+
if ( ! isset( $_POST[MWF_Config::NAME.'_nonce'] ) )
|
285 |
return $post_ID;
|
286 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
287 |
return $post_ID;
|
288 |
+
if ( !wp_verify_nonce( $_POST[MWF_Config::NAME.'_nonce'], MWF_Config::NAME ) )
|
289 |
return $post_ID;
|
290 |
if ( !current_user_can( 'manage_options', $post_ID ) )
|
291 |
return $post_ID;
|
292 |
|
293 |
+
$data = $_POST[MWF_Config::NAME];
|
294 |
if ( !empty( $data['validation'] ) && is_array( $data['validation'] ) ) {
|
295 |
$validation = array();
|
296 |
foreach ( $data['validation'] as $_validation ) {
|
297 |
if ( empty( $_validation['target'] ) ) continue;
|
298 |
+
foreach ( $_validation as $key => $value ) {
|
299 |
+
// between min, max
|
300 |
+
if ( $key == 'between' ) {
|
301 |
+
if ( !MWF_Functions::is_numeric( $value['min'] ) ) {
|
302 |
+
unset( $_validation[$key]['min'] );
|
303 |
+
}
|
304 |
+
if ( !MWF_Functions::is_numeric( $value['max'] ) ) {
|
305 |
+
unset( $_validation[$key]['max'] );
|
306 |
+
}
|
307 |
+
}
|
308 |
+
// minlength min
|
309 |
+
elseif ( $key == 'minlength' && !MWF_Functions::is_numeric( $value['min'] ) ) {
|
310 |
+
unset( $_validation[$key] );
|
311 |
+
}
|
312 |
+
// fileType types
|
313 |
+
elseif ( $key == 'fileType' && isset( $value['types'] ) && !preg_match( '/^[0-9A-Za-z,]+$/', $value['types'] ) ) {
|
314 |
+
unset( $_validation[$key] );
|
315 |
+
}
|
316 |
+
// fileSize bytes
|
317 |
+
elseif ( $key == 'fileSize' && !MWF_Functions::is_numeric( $value['bytes'] ) ) {
|
318 |
+
unset( $_validation[$key] );
|
319 |
+
}
|
320 |
+
|
321 |
+
// 要素が空のときは削除
|
322 |
// 単一項目のとき
|
323 |
+
if ( empty( $value ) ) {
|
324 |
unset( $_validation[$key] );
|
325 |
}
|
326 |
// 配列のとき
|
327 |
+
elseif ( is_array( $value ) && !array_diff( $value, array( '' ) ) ) {
|
328 |
unset( $_validation[$key] );
|
329 |
}
|
330 |
}
|
332 |
}
|
333 |
$data['validation'] = $validation;
|
334 |
}
|
335 |
+
$old_data = get_post_meta( $post_ID, MWF_Config::NAME, true );
|
336 |
+
update_post_meta( $post_ID, MWF_Config::NAME, $data, $old_data );
|
337 |
}
|
338 |
|
339 |
/**
|
344 |
global $post;
|
345 |
?>
|
346 |
<p>
|
347 |
+
<?php _e( 'Copy and Paste this shortcode.', MWF_Config::DOMAIN ); ?><br />
|
348 |
<span id="formkey_field">[mwform_formkey key="<?php the_ID(); ?>"]</span>
|
349 |
</p>
|
350 |
<?php
|
358 |
global $post;
|
359 |
?>
|
360 |
<p>
|
361 |
+
<label><input type="checkbox" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[querystring]" value="1" <?php checked( $this->get_post_data( 'querystring' ), 1 ); ?> /> <?php _e( 'Activate Query string of post', MWF_Config::DOMAIN ); ?></label><br />
|
362 |
+
<span class="mwf_note"><?php _e( 'If this field is active, MW WP Form get the post as query string "post_id" and you can use $post\'s property in editor', MWF_Config::DOMAIN ); ?></span><br />
|
363 |
+
<?php _e( 'Example: {ID}, {post_title}, {post_meta} etc...', MWF_Config::DOMAIN ); ?>
|
364 |
</p>
|
365 |
<p>
|
366 |
+
<input type="checkbox" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[usedb]" value="1" <?php checked( $this->get_post_data( 'usedb' ), 1 ); ?> /> <?php _e( 'Saving contact data in database', MWF_Config::DOMAIN ); ?></label>
|
367 |
</p>
|
368 |
<?php
|
369 |
}
|
375 |
public function add_complete_message() {
|
376 |
global $post;
|
377 |
$content = $this->get_post_data( 'complete_message' );
|
378 |
+
wp_editor( $content, MWF_Config::NAME.'_complete_message', array(
|
379 |
+
'textarea_name' => MWF_Config::NAME.'[complete_message]',
|
380 |
'textarea_rows' => 7,
|
381 |
) );
|
382 |
}
|
389 |
global $post;
|
390 |
?>
|
391 |
<p>
|
392 |
+
<b><?php _e( 'Subject', MWF_Config::DOMAIN ); ?></b><br />
|
393 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_subject]" value="<?php echo esc_attr( $this->get_post_data( 'mail_subject' ) ); ?>" />
|
394 |
</p>
|
395 |
<p>
|
396 |
+
<b><?php _e( 'Ccontent', MWF_Config::DOMAIN ); ?></b><br />
|
397 |
+
<textarea name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_content]" cols="30" rows="10"><?php echo esc_attr( $this->get_post_data( 'mail_content' ) ); ?></textarea><br />
|
398 |
+
<span class="mwf_note"><?php _e( '{key} is converted form data.', MWF_Config::DOMAIN ); ?></span>
|
399 |
</p>
|
400 |
<p>
|
401 |
+
<b><?php _e( 'Automatic reply email', MWF_Config::DOMAIN ); ?></b><br />
|
402 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[automatic_reply_email]" value="<?php echo esc_attr( $this->get_post_data( 'automatic_reply_email') ); ?>" /><br />
|
403 |
+
<span class="mwf_note"><?php _e( 'Please input the key to use as transmission to automatic reply email.', MWF_Config::DOMAIN ); ?></span>
|
404 |
</p>
|
405 |
<?php
|
406 |
}
|
413 |
global $post;
|
414 |
?>
|
415 |
<p>
|
416 |
+
<?php _e( 'If Admin Email Options is a blank, Automatic Replay Email Options is used as Admin Email Options.', MWF_Config::DOMAIN ); ?>
|
417 |
</p>
|
418 |
<p>
|
419 |
+
<b><?php _e( 'To ( E-mail address )', MWF_Config::DOMAIN ); ?></b><br />
|
420 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_to]" value="<?php echo esc_attr( $this->get_post_data( 'mail_to' ) ); ?>" /><br />
|
421 |
+
<span class="mwf_note"><?php _e( 'If empty: Using admin E-mail address.', MWF_Config::DOMAIN ); ?></span>
|
422 |
</p>
|
423 |
<p>
|
424 |
+
<b><?php _e( 'Subject', MWF_Config::DOMAIN ); ?></b><br />
|
425 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[admin_mail_subject]" value="<?php echo esc_attr( $this->get_post_data( 'admin_mail_subject' ) ); ?>" />
|
426 |
</p>
|
427 |
<p>
|
428 |
+
<b><?php _e( 'Ccontent', MWF_Config::DOMAIN ); ?></b><br />
|
429 |
+
<textarea name="<?php echo esc_attr( MWF_Config::NAME ); ?>[admin_mail_content]" cols="30" rows="10"><?php echo esc_attr( $this->get_post_data( 'admin_mail_content' ) ); ?></textarea><br />
|
430 |
+
<span class="mwf_note"><?php _e( '{key} is converted form data.', MWF_Config::DOMAIN ); ?></span>
|
431 |
</p>
|
432 |
<?php
|
433 |
}
|
439 |
public function add_url() {
|
440 |
global $post;
|
441 |
?>
|
442 |
+
<input type="hidden" name="<?php echo esc_attr( MWF_Config::NAME ); ?>_nonce" value="<?php echo wp_create_nonce( MWF_Config::NAME ); ?>" />
|
443 |
<table border="0" cellpadding="0" cellspacing="0">
|
444 |
<tr>
|
445 |
+
<th><?php _e( 'Input Page URL', MWF_Config::DOMAIN ); ?></th>
|
446 |
<td>
|
447 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[input_url]" value="<?php echo esc_attr( $this->get_post_data( 'input_url' ) ); ?>" />
|
448 |
</td>
|
449 |
</tr>
|
450 |
<tr>
|
451 |
+
<th><?php _e( 'Confirmation Page URL', MWF_Config::DOMAIN ); ?></th>
|
452 |
<td>
|
453 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[confirmation_url]" value="<?php echo esc_attr( $this->get_post_data( 'confirmation_url' ) ); ?>" />
|
454 |
</td>
|
455 |
</tr>
|
456 |
<tr>
|
457 |
+
<th><?php _e( 'Complete Page URL', MWF_Config::DOMAIN ); ?></th>
|
458 |
<td>
|
459 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[complete_url]" value="<?php echo esc_attr( $this->get_post_data( 'complete_url' ) ); ?>" />
|
460 |
</td>
|
461 |
</tr>
|
462 |
</table>
|
485 |
'eq' => array(),
|
486 |
'between' => array(),
|
487 |
'minlength' => array(),
|
488 |
+
'fileType' => array(),
|
489 |
+
'fileSize' => array(),
|
490 |
);
|
491 |
// 空の隠れバリデーションフィールド(コピー元)を挿入
|
492 |
array_unshift( $postdata, $validation_keys );
|
493 |
?>
|
494 |
+
<b id="add-validation-btn"><?php _e( 'Add Validation rule', MWF_Config::DOMAIN ); ?></b>
|
495 |
+
<?php foreach ( $postdata as $key => $value ) : $value = array_merge( $validation_keys, $value ); ?>
|
496 |
<div class="validation-box"<?php if ( $key === 0 ) : ?> style="display:none"<?php endif; ?>>
|
497 |
<div class="validation-remove"><b>×</b></div>
|
498 |
+
<div class="validation-btn"><span><?php echo esc_attr( $value['target'] ); ?></span><b>▼</b></div>
|
499 |
<div class="validation-content">
|
500 |
+
<?php _e( 'The key which applies validation', MWF_Config::DOMAIN ); ?>:<input type="text" class="targetKey" value="<?php echo esc_attr( $value['target'] ); ?>" name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][target]" />
|
501 |
<table border="0" cellpadding="0" cellspacing="0">
|
502 |
<tr>
|
503 |
<td colspan="2">
|
504 |
+
<label><input type="checkbox" <?php checked( $value['noempty'], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][noempty]" value="1" /><?php _e( 'No empty', MWF_Config::DOMAIN ); ?></label>
|
505 |
+
<label><input type="checkbox" <?php checked( $value['required'], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][required]" value="1" /><?php _e( 'No empty( with checkbox )', MWF_Config::DOMAIN ); ?></label>
|
506 |
+
<label><input type="checkbox" <?php checked( $value['numeric'], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][numeric]" value="1" /><?php _e( 'Numeric', MWF_Config::DOMAIN ); ?></label>
|
507 |
+
<label><input type="checkbox" <?php checked( $value['alpha'], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][alpha]" value="1" /><?php _e( 'Alphabet', MWF_Config::DOMAIN ); ?></label>
|
508 |
+
<label><input type="checkbox" <?php checked( $value['alphanumeric'], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][alphanumeric]" value="1" /><?php _e( 'Alphabet and Numeric', MWF_Config::DOMAIN ); ?></label>
|
509 |
+
<label><input type="checkbox" <?php checked( $value['zip'], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][zip]" value="1" /><?php _e( 'Zip code', MWF_Config::DOMAIN ); ?></label>
|
510 |
+
<label><input type="checkbox" <?php checked( $value['tel'], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][tel]" value="1" /><?php _e( 'Tel', MWF_Config::DOMAIN ); ?></label>
|
511 |
+
<label><input type="checkbox" <?php checked( $value['mail'], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][mail]" value="1" /><?php _e( 'E-mail', MWF_Config::DOMAIN ); ?></label>
|
512 |
+
<label><input type="checkbox" <?php checked( $value['date'], 1 ); ?> name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][date]" value="1" /><?php _e( 'Date', MWF_Config::DOMAIN ); ?></label>
|
513 |
</td>
|
514 |
</tr>
|
515 |
<tr>
|
516 |
+
<td style="width:20%"><?php _e( 'The key at same value', MWF_Config::DOMAIN ); ?></td>
|
517 |
+
<td><input type="text" value="<?php echo esc_attr( @$value['eq']['target'] ); ?>" name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][eq][target]" /></td>
|
518 |
</tr>
|
519 |
<tr>
|
520 |
+
<td><?php _e( 'The range of the number of characters', MWF_Config::DOMAIN ); ?></td>
|
521 |
<td>
|
522 |
+
<input type="text" value="<?php echo esc_attr( @$value['between']['min'] ); ?>" size="3" name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][between][min]" />
|
523 |
〜
|
524 |
+
<input type="text" value="<?php echo esc_attr( @$value['between']['max'] ); ?>" size="3" name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][between][max]" />
|
525 |
</td>
|
526 |
</tr>
|
527 |
<tr>
|
528 |
+
<td><?php _e( 'The number of the minimum characters', MWF_Config::DOMAIN ); ?></td>
|
529 |
+
<td><input type="text" value="<?php echo esc_attr( @$value['minlength']['min'] ); ?>" size="3" name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][minlength][min]" /></td>
|
530 |
+
</tr>
|
531 |
+
<tr>
|
532 |
+
<td><?php _e( 'Permitted Extension', MWF_Config::DOMAIN ); ?></td>
|
533 |
+
<td><input type="text" value="<?php echo esc_attr( @$value['fileType']['types'] ); ?>" name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][fileType][types]" /> <span class="mwf_note"><?php _e( 'Example:jpg or jpg,txt,…', MWF_Config::DOMAIN ); ?></span></td>
|
534 |
+
</tr>
|
535 |
+
<tr>
|
536 |
+
<td><?php _e( 'Permitted file size', MWF_Config::DOMAIN ); ?></td>
|
537 |
+
<td><input type="text" value="<?php echo esc_attr( @$value['fileSize']['bytes'] ); ?>" name="<?php echo MWF_Config::NAME; ?>[validation][<?php echo $key; ?>][fileSize][bytes]" /> <span class="mwf_note"><?php _e( 'bytes', MWF_Config::DOMAIN ); ?></span></td>
|
538 |
</tr>
|
539 |
</table>
|
540 |
<!-- end .validation-content --></div>
|
548 |
* ビジュアルエディタを無効に
|
549 |
*/
|
550 |
public function disable_visual_editor() {
|
551 |
+
if ( MWF_Config::NAME == get_post_type() ) {
|
552 |
return false;
|
553 |
}
|
554 |
return true;
|
571 |
public function add_form_columns_name( $columns ) {
|
572 |
global $posts;
|
573 |
unset( $columns['date'] );
|
574 |
+
$columns['post_date'] = __( 'Registed Date', MWF_Config::DOMAIN );
|
575 |
foreach ( $posts as $post ) {
|
576 |
$post_custom_keys = get_post_custom_keys( $post->ID );
|
577 |
if ( ! empty( $post_custom_keys ) && is_array( $post_custom_keys ) ) {
|
578 |
foreach ( $post_custom_keys as $key ) {
|
579 |
+
if ( preg_match( '/^_/', $key ) )
|
580 |
continue;
|
581 |
$columns[$key] = $key;
|
582 |
}
|
system/mwf_config.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Name: MWF_Config
|
4 |
+
* URI: http://2inc.org
|
5 |
+
* Description: 設定ファイル
|
6 |
+
* Version: 1.0
|
7 |
+
* Author: Takashi Kitajima
|
8 |
+
* Author URI: http://2inc.org
|
9 |
+
* Created: May 29, 2013
|
10 |
+
* Modified:
|
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
|
17 |
+
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
+
* This program is distributed in the hope that it will be useful,
|
20 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
+
* You should have received a copy of the GNU General Public License
|
25 |
+
* along with this program; if not, write to the Free Software
|
26 |
+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
+
*/
|
28 |
+
class MWF_Config {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* NAME
|
32 |
+
* プラグイン識別子
|
33 |
+
*/
|
34 |
+
const NAME = 'mw-wp-form';
|
35 |
+
|
36 |
+
/**
|
37 |
+
* DOMAIN
|
38 |
+
* ネームスペース
|
39 |
+
*/
|
40 |
+
const DOMAIN = 'mw-wp-form';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* DBDATA
|
44 |
+
* DBに保存する問い合わせデータの post_type名 の接頭辞
|
45 |
+
*/
|
46 |
+
const DBDATA = 'mwf_';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* UPLOAD_FILE_KEYS
|
50 |
+
* アップロードファイルを示す name属性 を保存する配列、メタデータの名前
|
51 |
+
*/
|
52 |
+
const UPLOAD_FILE_KEYS = 'mwf_upload_files';
|
53 |
+
}
|
system/mwf_functions.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Name: MWF Functions
|
4 |
+
* URI: http://2inc.org
|
5 |
+
* Description: 関数
|
6 |
+
* Version: 1.0
|
7 |
+
* Author: Takashi Kitajima
|
8 |
+
* Author URI: http://2inc.org
|
9 |
+
* Created: May 29, 2013
|
10 |
+
* Modified:
|
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
|
17 |
+
* published by the Free Software Foundation.
|
18 |
+
*
|
19 |
+
* This program is distributed in the hope that it will be useful,
|
20 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
* GNU General Public License for more details.
|
23 |
+
*
|
24 |
+
* You should have received a copy of the GNU General Public License
|
25 |
+
* along with this program; if not, write to the Free Software
|
26 |
+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
+
*/
|
28 |
+
class MWF_Functions {
|
29 |
+
|
30 |
+
/**
|
31 |
+
* is_numeric
|
32 |
+
* 引数で渡された変数が存在し、かつ数値であるなら true
|
33 |
+
* @param String 参照渡し
|
34 |
+
* @return Boorelan
|
35 |
+
*/
|
36 |
+
public static function is_numeric( &$value ) {
|
37 |
+
if ( isset( $value ) && preg_match( '/^\d+$/', $value ) ) {
|
38 |
+
return true;
|
39 |
+
}
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
}
|