Version Description
- Refactoring
- Added : Add filter hook mwform_csv_encoding-mwf_xxx.
- Deleted : Delete some Deprecated hooks, methods.
- Bugfix : Fixed a csv bug.
- Deprecated: MW_WP_Form_Form::get_raw()
- Deprecated: MW_WP_Form_Form::get_raw_in_children()
- Deprecated: MW_WP_Form_Form::get_zip_value()
- Deprecated: MW_WP_Form_Form::get_tel_value()
- Deprecated: MW_WP_Form_Form::get_checked_value()
- Deprecated: MW_WP_Form_Form::get_radio_value()
- Deprecated: MW_WP_Form_Form::get_selected_value()
- Deprecated: MW_WP_Form_Form::get_separated_raw_value()
- Deprecated: MW_WP_Form_Form::get_separator_value()
Download this release
Release Info
Developer | inc2734 |
Plugin | MW WP Form |
Version | 2.4.0 |
Comparing to | |
See all releases |
Code changes from version 2.3.5 to 2.4.0
- classes/config.php +0 -10
- classes/controllers/class.admin-list.php +23 -16
- classes/controllers/class.admin.php +155 -68
- classes/controllers/class.chart.php +57 -67
- classes/controllers/class.contact-data-list.php +68 -240
- classes/controllers/class.contact-data.php +44 -86
- classes/controllers/class.controller.php +44 -0
- classes/controllers/class.main.php +87 -32
- classes/controllers/class.stores-inquiry-data-form-list.php +84 -0
- classes/form-fields/class.checkbox.php +13 -8
- classes/form-fields/class.datepicker.php +10 -5
- classes/form-fields/class.file.php +16 -10
- classes/form-fields/class.hidden.php +9 -6
- classes/form-fields/class.image.php +24 -15
- classes/form-fields/class.password.php +11 -6
- classes/form-fields/class.radio.php +10 -5
- classes/form-fields/class.select.php +11 -6
- classes/form-fields/class.tel.php +17 -4
- classes/form-fields/class.text.php +14 -10
- classes/form-fields/class.textarea.php +14 -9
- classes/form-fields/class.zip.php +16 -4
- classes/functions.php +52 -16
- classes/models/class.abstract-form-field.php +16 -84
- classes/models/class.abstract-validation-rule.php +10 -19
- classes/models/class.akismet.php +6 -6
- classes/models/class.contact-data-setting.php +28 -17
- classes/models/class.contact-data.php +1 -0
- classes/models/class.csv.php +202 -0
- classes/models/class.data.php +178 -226
- classes/models/class.error.php +3 -4
- classes/models/class.file.php +19 -18
- classes/models/class.form.php +212 -270
- classes/models/class.mail.php +7 -13
- classes/models/class.session.php +9 -13
- classes/models/class.setting.php +9 -33
- classes/models/class.validation.php +22 -21
- classes/services/class.exec-shortcode.php +360 -18
- classes/services/class.mail.php +19 -24
- classes/services/class.redirected.php +11 -12
- classes/validation-rules/class.akismet.php +6 -5
- classes/validation-rules/class.alpha.php +7 -6
- classes/validation-rules/class.alphanumeric.php +7 -6
- classes/validation-rules/class.between.php +7 -6
- classes/validation-rules/class.date.php +7 -6
- classes/validation-rules/class.eq.php +8 -7
- classes/validation-rules/class.filesize.php +5 -4
- classes/validation-rules/class.filetype.php +7 -6
- classes/validation-rules/class.hiragana.php +7 -6
- classes/validation-rules/class.in.php +7 -6
- classes/validation-rules/class.katakana.php +7 -6
- classes/validation-rules/class.mail.php +7 -6
- classes/validation-rules/class.minlength.php +7 -6
- classes/validation-rules/class.noempty.php +6 -5
- classes/validation-rules/class.nofalse.php +6 -5
- classes/validation-rules/class.numeric.php +7 -6
- classes/validation-rules/class.required.php +4 -3
- classes/validation-rules/class.tel.php +9 -7
- classes/validation-rules/class.url.php +8 -7
- classes/validation-rules/class.zip.php +7 -6
- classes/views/class.admin-list.php +0 -35
- classes/views/class.admin.php +0 -363
- classes/views/class.contact-data-list.php +0 -107
- classes/views/class.contact-data.php +0 -218
- classes/views/class.main.php +0 -323
- classes/views/class.view.php +0 -39
- languages/mw-wp-form-ja.mo +0 -0
- languages/mw-wp-form-ja.po +288 -283
- languages/mw-wp-form.pot +253 -252
- mw-wp-form.php +138 -38
- readme.txt +16 -1
- templates/admin-list/form-key.php +1 -0
- templates/admin/add-ons.php +4 -0
- templates/admin/admin-mail-options.php +41 -0
- templates/admin/form-key.php +7 -0
- templates/admin/mail-options.php +30 -0
- templates/admin/settings.php +29 -0
- templates/admin/style.php +10 -0
- templates/admin/tag-generator.php +24 -0
- templates/admin/url.php +31 -0
- templates/admin/validation-rule.php +22 -0
- classes/views/class.chart.php → templates/chart/index.php +0 -64
- templates/contact-data-list/admin-print-styles.php +5 -0
- templates/contact-data-list/column.php +1 -0
- templates/contact-data-list/csv-button.php +8 -0
- templates/contact-data/admin-print-styles.php +5 -0
- templates/contact-data/detail.php +47 -0
- templates/contact-data/returning-link.php +3 -0
- templates/stores-inquiry-data-form-list/index.php +26 -0
classes/config.php
CHANGED
@@ -13,61 +13,51 @@
|
|
13 |
class MWF_Config {
|
14 |
|
15 |
/**
|
16 |
-
* NAME
|
17 |
* プラグイン識別子
|
18 |
*/
|
19 |
const NAME = 'mw-wp-form';
|
20 |
|
21 |
/**
|
22 |
-
* DOMAIN
|
23 |
* ネームスペース
|
24 |
*/
|
25 |
const DOMAIN = 'mw-wp-form';
|
26 |
|
27 |
/**
|
28 |
-
* DBDATA
|
29 |
* DBに保存する問い合わせデータの post_type名 の接頭辞
|
30 |
*/
|
31 |
const DBDATA = 'mwf_';
|
32 |
|
33 |
/**
|
34 |
-
* UPLOAD_FILE_KEYS
|
35 |
* アップロードファイルを示す name属性 を保存する配列、メタデータの名前
|
36 |
*/
|
37 |
const UPLOAD_FILE_KEYS = 'mwf_upload_files';
|
38 |
|
39 |
/**
|
40 |
-
* UPLOAD_FILES
|
41 |
* $_FILES
|
42 |
*/
|
43 |
const UPLOAD_FILES = 'mwf_files';
|
44 |
|
45 |
/**
|
46 |
-
* AKISMET
|
47 |
* akismetのエラーを格納するValidationのキー
|
48 |
*/
|
49 |
const AKISMET = 'mwf_akismet';
|
50 |
|
51 |
/**
|
52 |
-
* CAPABILITY
|
53 |
* 権限
|
54 |
*/
|
55 |
const CAPABILITY = 'edit_pages';
|
56 |
|
57 |
/**
|
58 |
-
* TRACKINGNUMBER
|
59 |
* お問い合せ番号用のキー名
|
60 |
*/
|
61 |
const TRACKINGNUMBER = 'tracking_number';
|
62 |
|
63 |
/**
|
64 |
-
* CONFIRM_BUTTON
|
65 |
* 確認ボタンの名前
|
66 |
*/
|
67 |
const CONFIRM_BUTTON = 'submitConfirm';
|
68 |
|
69 |
/**
|
70 |
-
* BACK_BUTTON
|
71 |
* 戻るボタンの名前
|
72 |
*/
|
73 |
const BACK_BUTTON = 'submitBack';
|
13 |
class MWF_Config {
|
14 |
|
15 |
/**
|
|
|
16 |
* プラグイン識別子
|
17 |
*/
|
18 |
const NAME = 'mw-wp-form';
|
19 |
|
20 |
/**
|
|
|
21 |
* ネームスペース
|
22 |
*/
|
23 |
const DOMAIN = 'mw-wp-form';
|
24 |
|
25 |
/**
|
|
|
26 |
* DBに保存する問い合わせデータの post_type名 の接頭辞
|
27 |
*/
|
28 |
const DBDATA = 'mwf_';
|
29 |
|
30 |
/**
|
|
|
31 |
* アップロードファイルを示す name属性 を保存する配列、メタデータの名前
|
32 |
*/
|
33 |
const UPLOAD_FILE_KEYS = 'mwf_upload_files';
|
34 |
|
35 |
/**
|
|
|
36 |
* $_FILES
|
37 |
*/
|
38 |
const UPLOAD_FILES = 'mwf_files';
|
39 |
|
40 |
/**
|
|
|
41 |
* akismetのエラーを格納するValidationのキー
|
42 |
*/
|
43 |
const AKISMET = 'mwf_akismet';
|
44 |
|
45 |
/**
|
|
|
46 |
* 権限
|
47 |
*/
|
48 |
const CAPABILITY = 'edit_pages';
|
49 |
|
50 |
/**
|
|
|
51 |
* お問い合せ番号用のキー名
|
52 |
*/
|
53 |
const TRACKINGNUMBER = 'tracking_number';
|
54 |
|
55 |
/**
|
|
|
56 |
* 確認ボタンの名前
|
57 |
*/
|
58 |
const CONFIRM_BUTTON = 'submitConfirm';
|
59 |
|
60 |
/**
|
|
|
61 |
* 戻るボタンの名前
|
62 |
*/
|
63 |
const BACK_BUTTON = 'submitBack';
|
classes/controllers/class.admin-list.php
CHANGED
@@ -1,34 +1,42 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Admin List Controller
|
4 |
-
* Version : 1.0
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : January 1, 2015
|
8 |
-
* Modified :
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
-
class MW_WP_Form_Admin_List_Controller {
|
13 |
|
14 |
/**
|
15 |
* initialize
|
16 |
*/
|
17 |
public function initialize() {
|
18 |
-
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
/**
|
22 |
-
*
|
23 |
-
*
|
|
|
|
|
24 |
*/
|
25 |
-
public function
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
/**
|
@@ -66,10 +74,9 @@ class MW_WP_Form_Admin_List_Controller {
|
|
66 |
* @param int $post_id
|
67 |
*/
|
68 |
public function manage_posts_custom_column( $column_name, $post_id ) {
|
69 |
-
$
|
70 |
-
$View->set( 'post_id', get_the_ID() );
|
71 |
if ( $column_name === 'mwform_form_key' ) {
|
72 |
-
$
|
73 |
}
|
74 |
}
|
75 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Admin List Controller
|
4 |
+
* Version : 1.1.0
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : January 1, 2015
|
8 |
+
* Modified : March 27, 2015
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
+
class MW_WP_Form_Admin_List_Controller extends MW_WP_Form_Controller {
|
13 |
|
14 |
/**
|
15 |
* initialize
|
16 |
*/
|
17 |
public function initialize() {
|
18 |
+
$screen = get_current_screen();
|
19 |
+
add_filter( 'views_' . $screen->id , array( $this, 'donate_link' ) );
|
20 |
+
add_action( 'admin_head' , array( $this, 'add_columns' ) );
|
21 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
22 |
}
|
23 |
|
24 |
/**
|
25 |
+
* 寄付リンクを出力
|
26 |
+
*
|
27 |
+
* @param array $views
|
28 |
+
* @return array
|
29 |
*/
|
30 |
+
public function donate_link( $views ) {
|
31 |
+
$donation = array(
|
32 |
+
'donation' =>
|
33 |
+
'<div class="donation"><p>' .
|
34 |
+
__( 'Your contribution is needed for making this plugin better.', MWF_Config::DOMAIN ) .
|
35 |
+
' <a href="http://www.amazon.co.jp/registry/wishlist/39ANKRNSTNW40" class="button">' .
|
36 |
+
__( 'Donate', MWF_Config::DOMAIN ) . '</a></p></div>'
|
37 |
+
);
|
38 |
+
$views = array_merge( $donation, $views );
|
39 |
+
return $views;
|
40 |
}
|
41 |
|
42 |
/**
|
74 |
* @param int $post_id
|
75 |
*/
|
76 |
public function manage_posts_custom_column( $column_name, $post_id ) {
|
77 |
+
$this->assign( 'post_id', get_the_ID() );
|
|
|
78 |
if ( $column_name === 'mwform_form_key' ) {
|
79 |
+
$this->render( 'admin-list/form-key' );
|
80 |
}
|
81 |
}
|
82 |
}
|
classes/controllers/class.admin.php
CHANGED
@@ -1,23 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Admin Controller
|
4 |
-
* Version : 1.0
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : December 31, 2014
|
8 |
-
* Modified :
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
-
class MW_WP_Form_Admin_Controller {
|
13 |
|
14 |
/**
|
15 |
-
* $validation_rules
|
16 |
* バリデーションルールの配列
|
17 |
* @var array
|
18 |
*/
|
19 |
protected $validation_rules = array();
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
/**
|
22 |
* __construct
|
23 |
* @param array $validation_rules
|
@@ -28,66 +32,46 @@ class MW_WP_Form_Admin_Controller {
|
|
28 |
$this->validation_rules[$instance->getName()] = $instance;
|
29 |
}
|
30 |
}
|
|
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
* initialize
|
35 |
*/
|
36 |
public function initialize() {
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
*/
|
44 |
-
public function current_screen( $screen ) {
|
45 |
-
if ( $screen->id === MWF_Config::NAME ) {
|
46 |
-
$View = new MW_WP_Form_Admin_View();
|
47 |
-
$Admin = new MW_WP_Form_Admin();
|
48 |
-
add_action( 'add_meta_boxes' , array( $this , 'add_meta_boxes' ) );
|
49 |
-
add_filter( 'default_content' , array( $this , 'default_content' ) );
|
50 |
-
add_action( 'media_buttons' , array( $View , 'tag_generator' ) );
|
51 |
-
add_action( 'admin_enqueue_scripts' , array( $this , 'admin_enqueue_scripts' ) );
|
52 |
-
add_action( 'admin_print_footer_scripts', array( $View , 'quicktag' ) );
|
53 |
-
add_action( 'save_post' , array( $Admin, 'save_post' ) );
|
54 |
-
}
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
-
*
|
59 |
*/
|
60 |
public function add_meta_boxes() {
|
61 |
-
$View = new MW_WP_Form_Admin_View();
|
62 |
-
|
63 |
// 完了画面内容
|
64 |
-
$View->set( 'complete_message', $this->get_option( 'complete_message' ) );
|
65 |
add_meta_box(
|
66 |
MWF_Config::NAME . '_complete_message_metabox',
|
67 |
__( 'Complete Message', MWF_Config::DOMAIN ),
|
68 |
-
array( $
|
69 |
MWF_Config::NAME, 'normal'
|
70 |
);
|
71 |
|
72 |
-
//
|
73 |
-
$View->set( 'input_url' , $this->get_option( 'input_url' ) );
|
74 |
-
$View->set( 'confirmation_url' , $this->get_option( 'confirmation_url' ) );
|
75 |
-
$View->set( 'complete_url' , $this->get_option( 'complete_url' ) );
|
76 |
-
$View->set( 'validation_error_url', $this->get_option( 'validation_error_url' ) );
|
77 |
add_meta_box(
|
78 |
MWF_Config::NAME . '_url',
|
79 |
__( 'URL Options', MWF_Config::DOMAIN ),
|
80 |
-
array( $
|
81 |
MWF_Config::NAME, 'normal'
|
82 |
);
|
83 |
|
84 |
// バリデーション
|
85 |
-
$View->set( 'validation' , $this->get_option( 'validation' ) );
|
86 |
-
$View->set( 'validation_rules', $this->validation_rules );
|
87 |
add_meta_box(
|
88 |
MWF_Config::NAME . '_validation',
|
89 |
__( 'Validation Rule', MWF_Config::DOMAIN ),
|
90 |
-
array( $
|
91 |
MWF_Config::NAME, 'normal'
|
92 |
);
|
93 |
|
@@ -95,78 +79,165 @@ class MW_WP_Form_Admin_Controller {
|
|
95 |
add_meta_box(
|
96 |
MWF_Config::NAME . '_addon',
|
97 |
__( 'Add-ons', MWF_Config::DOMAIN ),
|
98 |
-
array( $
|
99 |
MWF_Config::NAME, 'side'
|
100 |
);
|
101 |
|
102 |
// フォーム識別子
|
103 |
-
$View->set( 'post_id', get_the_ID() );
|
104 |
add_meta_box(
|
105 |
MWF_Config::NAME . '_formkey',
|
106 |
__( 'Form Key', MWF_Config::DOMAIN ),
|
107 |
-
array( $
|
108 |
MWF_Config::NAME, 'side'
|
109 |
);
|
110 |
|
111 |
// 自動返信メール設定
|
112 |
-
$View->set( 'mail_subject' , $this->get_option( 'mail_subject' ) );
|
113 |
-
$View->set( 'mail_sender' , $this->get_option( 'mail_sender' ) );
|
114 |
-
$View->set( 'mail_from' , $this->get_option( 'mail_from' ) );
|
115 |
-
$View->set( 'mail_content' , $this->get_option( 'mail_content' ) );
|
116 |
-
$View->set( 'automatic_reply_email', $this->get_option( 'automatic_reply_email' ) );
|
117 |
add_meta_box(
|
118 |
MWF_Config::NAME . '_mail',
|
119 |
__( 'Automatic Reply Email Options', MWF_Config::DOMAIN ),
|
120 |
-
array( $
|
121 |
MWF_Config::NAME, 'side'
|
122 |
);
|
123 |
|
124 |
// 管理者メール設定
|
125 |
-
$View->set( 'mail_to' , $this->get_option( 'mail_to' ) );
|
126 |
-
$View->set( 'mail_cc' , $this->get_option( 'mail_cc' ) );
|
127 |
-
$View->set( 'mail_bcc' , $this->get_option( 'mail_bcc' ) );
|
128 |
-
$View->set( 'admin_mail_subject', $this->get_option( 'admin_mail_subject' ) );
|
129 |
-
$View->set( 'admin_mail_sender' , $this->get_option( 'admin_mail_sender' ) );
|
130 |
-
$View->set( 'admin_mail_from' , $this->get_option( 'admin_mail_from' ) );
|
131 |
-
$View->set( 'admin_mail_content', $this->get_option( 'admin_mail_content' ) );
|
132 |
add_meta_box(
|
133 |
MWF_Config::NAME . '_admin_mail',
|
134 |
__( 'Admin Email Options', MWF_Config::DOMAIN ),
|
135 |
-
array( $
|
136 |
MWF_Config::NAME, 'side'
|
137 |
);
|
138 |
|
139 |
// 設定
|
140 |
-
$View->set( 'querystring' , $this->get_option( 'querystring' ) );
|
141 |
-
$View->set( 'usedb' , $this->get_option( 'usedb' ) );
|
142 |
-
$View->set( 'scroll' , $this->get_option( 'scroll' ) );
|
143 |
-
$View->set( 'akismet_author' , $this->get_option( 'akismet_author' ) );
|
144 |
-
$View->set( 'akismet_author_email', $this->get_option( 'akismet_author_email' ) );
|
145 |
-
$View->set( 'akismet_author_url' , $this->get_option( 'akismet_author_url' ) );
|
146 |
add_meta_box(
|
147 |
MWF_Config::NAME . '_settings',
|
148 |
__( 'settings', MWF_Config::DOMAIN ),
|
149 |
-
array( $
|
150 |
MWF_Config::NAME, 'side'
|
151 |
);
|
152 |
|
153 |
-
//
|
154 |
-
|
155 |
-
if ( $styles ) {
|
156 |
-
$View->set( 'styles', $styles );
|
157 |
-
$View->set( 'style' , $this->get_option( 'style' ) );
|
158 |
add_meta_box(
|
159 |
MWF_Config::NAME . '_styles',
|
160 |
__( 'Style setting', MWF_Config::DOMAIN ),
|
161 |
-
array( $
|
162 |
MWF_Config::NAME, 'side'
|
163 |
);
|
164 |
}
|
165 |
}
|
166 |
|
167 |
/**
|
168 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
* 本文の初期値を設定
|
|
|
170 |
* @param string $content
|
171 |
* @return string
|
172 |
*/
|
@@ -174,6 +245,22 @@ class MW_WP_Form_Admin_Controller {
|
|
174 |
return apply_filters( 'mwform_default_content', '' );
|
175 |
}
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
/**
|
178 |
* get_option
|
179 |
* フォームの設定データを返す
|
@@ -204,7 +291,7 @@ class MW_WP_Form_Admin_Controller {
|
|
204 |
wp_enqueue_style( MWF_Config::NAME . '-admin', $url . '/css/admin.css' );
|
205 |
wp_enqueue_style( MWF_Config::NAME . '-admin-repeatable', $url . '/css/admin-repeatable.css' );
|
206 |
wp_enqueue_script( MWF_Config::NAME . '-repeatable', $url . '/js/mw-wp-form-repeatable.js' );
|
207 |
-
wp_enqueue_script( MWF_Config::NAME . '-admin', $url . '/js/admin.js' );
|
208 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
209 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
210 |
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Admin Controller
|
4 |
+
* Version : 1.1.0
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : December 31, 2014
|
8 |
+
* Modified : March 27, 2015
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
+
class MW_WP_Form_Admin_Controller extends MW_WP_Form_Controller {
|
13 |
|
14 |
/**
|
|
|
15 |
* バリデーションルールの配列
|
16 |
* @var array
|
17 |
*/
|
18 |
protected $validation_rules = array();
|
19 |
|
20 |
+
/**
|
21 |
+
* フォームスタイルの配列
|
22 |
+
*/
|
23 |
+
protected $styles = array();
|
24 |
+
|
25 |
/**
|
26 |
* __construct
|
27 |
* @param array $validation_rules
|
32 |
$this->validation_rules[$instance->getName()] = $instance;
|
33 |
}
|
34 |
}
|
35 |
+
$this->styles = apply_filters( 'mwform_styles', $this->styles );
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
* initialize
|
40 |
*/
|
41 |
public function initialize() {
|
42 |
+
$Admin = new MW_WP_Form_Admin();
|
43 |
+
add_action( 'add_meta_boxes' , array( $this , 'add_meta_boxes' ) );
|
44 |
+
add_filter( 'default_content' , array( $this , 'default_content' ) );
|
45 |
+
add_action( 'media_buttons' , array( $this , 'tag_generator' ) );
|
46 |
+
add_action( 'admin_enqueue_scripts' , array( $this , 'admin_enqueue_scripts' ) );
|
47 |
+
add_action( 'save_post' , array( $Admin, 'save_post' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
+
* カスタムフィールドを出力
|
52 |
*/
|
53 |
public function add_meta_boxes() {
|
|
|
|
|
54 |
// 完了画面内容
|
|
|
55 |
add_meta_box(
|
56 |
MWF_Config::NAME . '_complete_message_metabox',
|
57 |
__( 'Complete Message', MWF_Config::DOMAIN ),
|
58 |
+
array( $this, 'complete_message' ),
|
59 |
MWF_Config::NAME, 'normal'
|
60 |
);
|
61 |
|
62 |
+
// URL設定
|
|
|
|
|
|
|
|
|
63 |
add_meta_box(
|
64 |
MWF_Config::NAME . '_url',
|
65 |
__( 'URL Options', MWF_Config::DOMAIN ),
|
66 |
+
array( $this, 'url' ),
|
67 |
MWF_Config::NAME, 'normal'
|
68 |
);
|
69 |
|
70 |
// バリデーション
|
|
|
|
|
71 |
add_meta_box(
|
72 |
MWF_Config::NAME . '_validation',
|
73 |
__( 'Validation Rule', MWF_Config::DOMAIN ),
|
74 |
+
array( $this, 'validation_rule' ),
|
75 |
MWF_Config::NAME, 'normal'
|
76 |
);
|
77 |
|
79 |
add_meta_box(
|
80 |
MWF_Config::NAME . '_addon',
|
81 |
__( 'Add-ons', MWF_Config::DOMAIN ),
|
82 |
+
array( $this, 'add_ons' ),
|
83 |
MWF_Config::NAME, 'side'
|
84 |
);
|
85 |
|
86 |
// フォーム識別子
|
|
|
87 |
add_meta_box(
|
88 |
MWF_Config::NAME . '_formkey',
|
89 |
__( 'Form Key', MWF_Config::DOMAIN ),
|
90 |
+
array( $this, 'form_key' ),
|
91 |
MWF_Config::NAME, 'side'
|
92 |
);
|
93 |
|
94 |
// 自動返信メール設定
|
|
|
|
|
|
|
|
|
|
|
95 |
add_meta_box(
|
96 |
MWF_Config::NAME . '_mail',
|
97 |
__( 'Automatic Reply Email Options', MWF_Config::DOMAIN ),
|
98 |
+
array( $this, 'mail_options' ),
|
99 |
MWF_Config::NAME, 'side'
|
100 |
);
|
101 |
|
102 |
// 管理者メール設定
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
add_meta_box(
|
104 |
MWF_Config::NAME . '_admin_mail',
|
105 |
__( 'Admin Email Options', MWF_Config::DOMAIN ),
|
106 |
+
array( $this, 'admin_mail_options' ),
|
107 |
MWF_Config::NAME, 'side'
|
108 |
);
|
109 |
|
110 |
// 設定
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
add_meta_box(
|
112 |
MWF_Config::NAME . '_settings',
|
113 |
__( 'settings', MWF_Config::DOMAIN ),
|
114 |
+
array( $this, 'settings' ),
|
115 |
MWF_Config::NAME, 'side'
|
116 |
);
|
117 |
|
118 |
+
// スタイル
|
119 |
+
if ( $this->styles ) {
|
|
|
|
|
|
|
120 |
add_meta_box(
|
121 |
MWF_Config::NAME . '_styles',
|
122 |
__( 'Style setting', MWF_Config::DOMAIN ),
|
123 |
+
array( $this, 'style' ),
|
124 |
MWF_Config::NAME, 'side'
|
125 |
);
|
126 |
}
|
127 |
}
|
128 |
|
129 |
/**
|
130 |
+
* 完了画面内容
|
131 |
+
*/
|
132 |
+
public function complete_message() {
|
133 |
+
wp_editor(
|
134 |
+
$this->get_option( 'complete_message' ), MWF_Config::NAME . '_complete_message',
|
135 |
+
array(
|
136 |
+
'textarea_name' => MWF_Config::NAME . '[complete_message]',
|
137 |
+
'textarea_rows' => 7,
|
138 |
+
)
|
139 |
+
);
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* URL設定
|
144 |
+
*/
|
145 |
+
public function url() {
|
146 |
+
$this->assign( 'input_url' , $this->get_option( 'input_url' ) );
|
147 |
+
$this->assign( 'confirmation_url' , $this->get_option( 'confirmation_url' ) );
|
148 |
+
$this->assign( 'complete_url' , $this->get_option( 'complete_url' ) );
|
149 |
+
$this->assign( 'validation_error_url', $this->get_option( 'validation_error_url' ) );
|
150 |
+
$this->render( 'admin/url' );
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* バリデーション
|
155 |
+
*/
|
156 |
+
public function validation_rule() {
|
157 |
+
$validation = $this->get_option( 'validation' );
|
158 |
+
if ( !$validation ) {
|
159 |
+
$validation = array();
|
160 |
+
}
|
161 |
+
$validation_keys = array(
|
162 |
+
'target' => '',
|
163 |
+
);
|
164 |
+
foreach ( $this->validation_rules as $validation_rule => $instance ) {
|
165 |
+
$validation_keys[$instance->getName()] = '';
|
166 |
+
}
|
167 |
+
// 空の隠れバリデーションフィールド(コピー元)を挿入
|
168 |
+
array_unshift( $validation, $validation_keys );
|
169 |
+
$this->assign( 'validation' , $validation );
|
170 |
+
$this->assign( 'validation_rules', $this->validation_rules );
|
171 |
+
$this->assign( 'validation_keys' , $validation_keys );
|
172 |
+
$this->render( 'admin/validation-rule' );
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* アドオン
|
177 |
+
*/
|
178 |
+
public function add_ons() {
|
179 |
+
$this->render( 'admin/add-ons' );
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* フォーム識別子
|
184 |
+
*/
|
185 |
+
public function form_key() {
|
186 |
+
$this->assign( 'post_id', get_the_ID() );
|
187 |
+
$this->render( 'admin/form-key' );
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* 自動返信メール設定
|
192 |
+
*/
|
193 |
+
public function mail_options() {
|
194 |
+
$this->assign( 'mail_subject' , $this->get_option( 'mail_subject' ) );
|
195 |
+
$this->assign( 'mail_sender' , $this->get_option( 'mail_sender' ) );
|
196 |
+
$this->assign( 'mail_from' , $this->get_option( 'mail_from' ) );
|
197 |
+
$this->assign( 'mail_content' , $this->get_option( 'mail_content' ) );
|
198 |
+
$this->assign( 'automatic_reply_email', $this->get_option( 'automatic_reply_email' ) );
|
199 |
+
$this->render( 'admin/mail-options' );
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* 管理者メール設定
|
204 |
+
*/
|
205 |
+
public function admin_mail_options() {
|
206 |
+
$this->assign( 'mail_to' , $this->get_option( 'mail_to' ) );
|
207 |
+
$this->assign( 'mail_cc' , $this->get_option( 'mail_cc' ) );
|
208 |
+
$this->assign( 'mail_bcc' , $this->get_option( 'mail_bcc' ) );
|
209 |
+
$this->assign( 'admin_mail_subject', $this->get_option( 'admin_mail_subject' ) );
|
210 |
+
$this->assign( 'admin_mail_sender' , $this->get_option( 'admin_mail_sender' ) );
|
211 |
+
$this->assign( 'admin_mail_from' , $this->get_option( 'admin_mail_from' ) );
|
212 |
+
$this->assign( 'admin_mail_content', $this->get_option( 'admin_mail_content' ) );
|
213 |
+
$this->render( 'admin/admin-mail-options' );
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* 設定
|
218 |
+
*/
|
219 |
+
public function settings() {
|
220 |
+
$this->assign( 'querystring' , $this->get_option( 'querystring' ) );
|
221 |
+
$this->assign( 'usedb' , $this->get_option( 'usedb' ) );
|
222 |
+
$this->assign( 'scroll' , $this->get_option( 'scroll' ) );
|
223 |
+
$this->assign( 'akismet_author' , $this->get_option( 'akismet_author' ) );
|
224 |
+
$this->assign( 'akismet_author_email', $this->get_option( 'akismet_author_email' ) );
|
225 |
+
$this->assign( 'akismet_author_url' , $this->get_option( 'akismet_author_url' ) );
|
226 |
+
$this->render( 'admin/settings' );
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* スタイル
|
231 |
+
*/
|
232 |
+
public function style() {
|
233 |
+
$this->assign( 'styles', $this->styles );
|
234 |
+
$this->assign( 'style' , $this->get_option( 'style' ) );
|
235 |
+
$this->render( 'admin/style' );
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
* 本文の初期値を設定
|
240 |
+
*
|
241 |
* @param string $content
|
242 |
* @return string
|
243 |
*/
|
245 |
return apply_filters( 'mwform_default_content', '' );
|
246 |
}
|
247 |
|
248 |
+
/**
|
249 |
+
* タグジェネレータを出力
|
250 |
+
*
|
251 |
+
* @param string $editor_id
|
252 |
+
*/
|
253 |
+
public function tag_generator( $editor_id ) {
|
254 |
+
$post_type = get_post_type();
|
255 |
+
if ( $post_type !== MWF_Config::NAME ) {
|
256 |
+
return;
|
257 |
+
}
|
258 |
+
if ( $editor_id !== 'content' ) {
|
259 |
+
return;
|
260 |
+
}
|
261 |
+
$this->render( 'admin/tag-generator' );
|
262 |
+
}
|
263 |
+
|
264 |
/**
|
265 |
* get_option
|
266 |
* フォームの設定データを返す
|
291 |
wp_enqueue_style( MWF_Config::NAME . '-admin', $url . '/css/admin.css' );
|
292 |
wp_enqueue_style( MWF_Config::NAME . '-admin-repeatable', $url . '/css/admin-repeatable.css' );
|
293 |
wp_enqueue_script( MWF_Config::NAME . '-repeatable', $url . '/js/mw-wp-form-repeatable.js' );
|
294 |
+
wp_enqueue_script( MWF_Config::NAME . '-admin', $url . '/js/admin.js', array( 'jquery-ui-dialog', 'jquery-ui-sortable' ) );
|
295 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
296 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
297 |
|
classes/controllers/class.chart.php
CHANGED
@@ -1,32 +1,29 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Chart Controller
|
4 |
-
* Version : 1.0
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : January 1, 2015
|
8 |
-
* Modified :
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
-
class MW_WP_Form_Chart_Controller {
|
13 |
|
14 |
/**
|
15 |
-
* $formkey
|
16 |
* URL引数で渡される、そのグラフに使う投稿タイプ名
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $formkey;
|
20 |
|
21 |
/**
|
22 |
-
* $postdata
|
23 |
* フォームの設定データ
|
24 |
* @var array
|
25 |
*/
|
26 |
protected $postdata = array();
|
27 |
|
28 |
/**
|
29 |
-
* $option_group
|
30 |
* Settings API グループ名
|
31 |
* @var string
|
32 |
*/
|
@@ -46,45 +43,15 @@ class MW_WP_Form_Chart_Controller {
|
|
46 |
* initialize
|
47 |
*/
|
48 |
public function initialize() {
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* current_screen
|
56 |
-
* @param WP_Screen $screen
|
57 |
-
*/
|
58 |
-
public function current_screen( $screen ) {
|
59 |
-
if ( $screen->id === MWF_Config::NAME . '_page_' . MWF_Config::NAME . '-chart' ) {
|
60 |
-
$contact_data_post_types = MW_WP_Form_Contact_Data_Setting::get_posts();
|
61 |
-
if ( !in_array( $this->formkey, $contact_data_post_types ) ) {
|
62 |
-
exit;
|
63 |
-
}
|
64 |
-
|
65 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') );
|
66 |
}
|
|
|
67 |
}
|
68 |
|
69 |
/**
|
70 |
-
*
|
71 |
-
*/
|
72 |
-
public function admin_menu() {
|
73 |
-
$View = new MW_WP_Form_Chart_View();
|
74 |
-
$View->set( 'post_type', $this->formkey );
|
75 |
-
$View->set( 'option_group', $this->option_group );
|
76 |
-
add_submenu_page(
|
77 |
-
'edit.php?post_type=' . MWF_Config::NAME,
|
78 |
-
esc_html__( 'Chart', MWF_Config::DOMAIN ),
|
79 |
-
esc_html__( 'Chart', MWF_Config::DOMAIN ),
|
80 |
-
MWF_Config::CAPABILITY,
|
81 |
-
MWF_Config::NAME . '-chart',
|
82 |
-
array( $View, 'index' )
|
83 |
-
);
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* admin_enqueue_scripts
|
88 |
*/
|
89 |
public function admin_enqueue_scripts() {
|
90 |
global $wp_scripts;
|
@@ -124,37 +91,60 @@ class MW_WP_Form_Chart_Controller {
|
|
124 |
}
|
125 |
|
126 |
/**
|
127 |
-
*
|
128 |
*/
|
129 |
-
public function
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
|
|
|
|
|
|
141 |
}
|
142 |
-
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
$
|
155 |
}
|
156 |
}
|
157 |
}
|
158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
}
|
160 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Chart Controller
|
4 |
+
* Version : 1.1.0
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : January 1, 2015
|
8 |
+
* Modified : March 27, 2015
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
+
class MW_WP_Form_Chart_Controller extends MW_WP_Form_Controller {
|
13 |
|
14 |
/**
|
|
|
15 |
* URL引数で渡される、そのグラフに使う投稿タイプ名
|
16 |
* @var string
|
17 |
*/
|
18 |
protected $formkey;
|
19 |
|
20 |
/**
|
|
|
21 |
* フォームの設定データ
|
22 |
* @var array
|
23 |
*/
|
24 |
protected $postdata = array();
|
25 |
|
26 |
/**
|
|
|
27 |
* Settings API グループ名
|
28 |
* @var string
|
29 |
*/
|
43 |
* initialize
|
44 |
*/
|
45 |
public function initialize() {
|
46 |
+
$contact_data_post_types = MW_WP_Form_Contact_Data_Setting::get_posts();
|
47 |
+
if ( !in_array( $this->formkey, $contact_data_post_types ) ) {
|
48 |
+
exit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') );
|
51 |
}
|
52 |
|
53 |
/**
|
54 |
+
* CSS、JSの読み込み
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
*/
|
56 |
public function admin_enqueue_scripts() {
|
57 |
global $wp_scripts;
|
91 |
}
|
92 |
|
93 |
/**
|
94 |
+
* グラフページを表示
|
95 |
*/
|
96 |
+
public function index() {
|
97 |
+
$post_type = $this->formkey;
|
98 |
+
|
99 |
+
// form_posts
|
100 |
+
$default_args = array(
|
101 |
+
'posts_per_page' => -1,
|
102 |
+
);
|
103 |
+
$_args = apply_filters( 'mwform_get_inquiry_data_args-' . $post_type, $default_args );
|
104 |
+
$args = array(
|
105 |
+
'post_type' => $post_type,
|
106 |
+
);
|
107 |
+
if ( !empty( $_args ) && is_array( $_args ) ) {
|
108 |
+
$args = array_merge( $_args, $args );
|
109 |
+
} else {
|
110 |
+
$args = array_merge( $_args, $default_args );
|
111 |
}
|
112 |
+
$form_posts = get_posts( $args );
|
113 |
|
114 |
+
// custom_keys
|
115 |
+
$custom_keys = array();
|
116 |
+
foreach ( $form_posts as $post ) {
|
117 |
+
$post_custom_keys = get_post_custom_keys( $post->ID );
|
118 |
+
if ( is_array( $post_custom_keys ) ) {
|
119 |
+
foreach ( $post_custom_keys as $post_custom_key ) {
|
120 |
+
if ( preg_match( '/^_/', $post_custom_key ) ) {
|
121 |
+
continue;
|
122 |
+
}
|
123 |
+
$post_meta = get_post_meta( $post->ID, $post_custom_key, true );
|
124 |
+
$custom_keys[$post_custom_key][$post_meta][] = $post->ID;
|
125 |
}
|
126 |
}
|
127 |
}
|
128 |
+
|
129 |
+
// postdata
|
130 |
+
$postdata = array();
|
131 |
+
$option = get_option( MWF_Config::NAME . '-chart-' . $post_type );
|
132 |
+
if ( is_array( $option ) && isset( $option['chart'] ) && is_array( $option['chart'] ) ) {
|
133 |
+
$postdata = $option['chart'];
|
134 |
+
}
|
135 |
+
$default_keys = array(
|
136 |
+
'target' => '',
|
137 |
+
'separator' => '',
|
138 |
+
'chart' => '',
|
139 |
+
);
|
140 |
+
// 空の隠れフィールド(コピー元)を挿入
|
141 |
+
array_unshift( $postdata, $default_keys );
|
142 |
+
|
143 |
+
$this->assign( 'post_type' , $post_type );
|
144 |
+
$this->assign( 'option_group', $this->option_group );
|
145 |
+
$this->assign( 'form_posts' , $form_posts );
|
146 |
+
$this->assign( 'custom_keys' , $custom_keys );
|
147 |
+
$this->assign( 'postdata' , $postdata );
|
148 |
+
$this->render( 'chart/index' );
|
149 |
}
|
150 |
}
|
classes/controllers/class.contact-data-list.php
CHANGED
@@ -1,44 +1,48 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Contact Data List Controller
|
4 |
-
* Version : 1.0
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : January 1, 2015
|
8 |
-
* Modified :
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
-
class MW_WP_Form_Contact_Data_List_Controller {
|
13 |
|
14 |
/**
|
15 |
-
*
|
16 |
*/
|
17 |
-
|
18 |
-
add_action( 'current_screen', array( $this, 'current_screen' ) );
|
19 |
-
}
|
20 |
|
21 |
/**
|
22 |
-
*
|
23 |
-
* @param WP_Screen $screen
|
24 |
*/
|
25 |
-
public function
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
34 |
-
add_action( 'admin_print_styles' , array( $this, 'admin_print_styles' ) );
|
35 |
-
add_action( 'in_admin_footer' , array( $this, 'add_csv_download_button' ) );
|
36 |
-
add_filter( 'wp_count_posts' , array( $this, 'wp_count_posts' ), 10, 2 );
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
-
*
|
|
|
42 |
* @param WP_Query $wp_query
|
43 |
*/
|
44 |
public function pre_get_posts( $wp_query ) {
|
@@ -54,7 +58,7 @@ class MW_WP_Form_Contact_Data_List_Controller {
|
|
54 |
}
|
55 |
|
56 |
/**
|
57 |
-
*
|
58 |
*/
|
59 |
public function admin_enqueue_scripts() {
|
60 |
$url = plugins_url( MWF_Config::NAME );
|
@@ -63,21 +67,17 @@ class MW_WP_Form_Contact_Data_List_Controller {
|
|
63 |
}
|
64 |
|
65 |
/**
|
66 |
-
* admin_print_styles
|
67 |
* DB登録データの一覧で新規追加のリンクを消す
|
68 |
*/
|
69 |
public function admin_print_styles() {
|
70 |
-
$
|
71 |
-
$View->admin_print_styles_for_list();
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
-
* add_csv_download_button
|
76 |
* CSVダウンロードボタンを表示
|
77 |
*/
|
78 |
public function add_csv_download_button() {
|
79 |
-
$post_type
|
80 |
-
if ( true !== apply_filters( 'mwform_csv_button_' . $post_type, true ) ) {
|
81 |
return;
|
82 |
}
|
83 |
$page = ( basename( $_SERVER['PHP_SELF'] ) );
|
@@ -85,200 +85,20 @@ class MW_WP_Form_Contact_Data_List_Controller {
|
|
85 |
return;
|
86 |
}
|
87 |
$action = $_SERVER['REQUEST_URI'];
|
88 |
-
$
|
89 |
-
$
|
90 |
-
$View->csv_button();
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* csv_download
|
95 |
-
* CSVを生成、出力
|
96 |
-
*/
|
97 |
-
public function csv_download() {
|
98 |
-
if ( !$this->is_contact_data_list() ) {
|
99 |
-
return;
|
100 |
-
}
|
101 |
-
if ( !isset( $_GET['post_type'] ) ) {
|
102 |
-
return ;
|
103 |
-
}
|
104 |
-
|
105 |
-
$post_type = $_GET['post_type'];
|
106 |
-
$key_of_csv_download = MWF_Config::NAME . '-csv-download';
|
107 |
-
|
108 |
-
if ( !isset( $_POST[$key_of_csv_download] ) || !check_admin_referer( MWF_Config::NAME ) ) {
|
109 |
-
return;
|
110 |
-
}
|
111 |
-
|
112 |
-
$posts_per_page = $this->get_posts_per_page();
|
113 |
-
$paged = $this->get_paged();
|
114 |
-
|
115 |
-
$_args = apply_filters( 'mwform_get_inquiry_data_args-' . $post_type, array() );
|
116 |
-
$args = array(
|
117 |
-
'post_type' => $post_type,
|
118 |
-
'posts_per_page' => $posts_per_page,
|
119 |
-
'paged' => $paged,
|
120 |
-
'post_status' => 'any',
|
121 |
-
);
|
122 |
-
if ( !empty( $_args ) && is_array( $_args ) ) {
|
123 |
-
$args = array_merge( $_args, $args );
|
124 |
-
}
|
125 |
-
$posts_mwf = get_posts( $args );
|
126 |
-
|
127 |
-
// CSVの内容を貯める
|
128 |
-
$csv = '';
|
129 |
-
|
130 |
-
// 見出しを追加
|
131 |
-
$rows[0] = $this->get_csv_headings( $posts_mwf );
|
132 |
-
|
133 |
-
// 各データを追加
|
134 |
-
$rows = array_merge( $rows, $this->get_rows( $posts_mwf, $rows[0] ) );
|
135 |
-
|
136 |
-
// エンコード
|
137 |
-
foreach ( $rows as $key => $row ) {
|
138 |
-
foreach ( $row as $column_name => $column ) {
|
139 |
-
$row[$column_name] = $this->escape_double_quote( $column );
|
140 |
-
}
|
141 |
-
$csv .= implode( ',', $row ) . "\r\n";
|
142 |
-
}
|
143 |
-
$csv = mb_convert_encoding( $csv, 'sjis-win', get_option( 'blog_charset' ) );
|
144 |
-
|
145 |
-
$file_name = 'mw_wp_form_' . date( 'YmdHis' ) . '.csv';
|
146 |
-
header( 'Content-Type: application/octet-stream' );
|
147 |
-
header( 'Content-Disposition: attachment; filename=' . $file_name );
|
148 |
-
echo $csv;
|
149 |
-
exit;
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* get_csv_headings
|
154 |
-
* @param array $posts
|
155 |
-
* @return array
|
156 |
-
*/
|
157 |
-
protected function get_csv_headings( array $posts ) {
|
158 |
-
$default_headings = array(
|
159 |
-
'ID',
|
160 |
-
__( 'Response Status', MWF_Config::DOMAIN ),
|
161 |
-
'post_date',
|
162 |
-
'post_modified',
|
163 |
-
'post_title'
|
164 |
-
);
|
165 |
-
$rows[] = $default_headings;
|
166 |
-
$columns = array();
|
167 |
-
foreach ( $posts as $post ) {
|
168 |
-
$post_type = get_post_type( $post->ID );
|
169 |
-
$post_custom_keys = get_post_custom_keys( $post->ID );
|
170 |
-
$columns = array();
|
171 |
-
if ( !is_array( $post_custom_keys ) ) {
|
172 |
-
continue;
|
173 |
-
}
|
174 |
-
foreach ( $post_custom_keys as $key ) {
|
175 |
-
if ( preg_match( '/^_/', $key ) ) {
|
176 |
-
continue;
|
177 |
-
}
|
178 |
-
if ( $key === MWF_Config::TRACKINGNUMBER ) {
|
179 |
-
$column = MWF_Functions::get_tracking_number_title( $post_type );
|
180 |
-
} else {
|
181 |
-
$column = $key;
|
182 |
-
}
|
183 |
-
$columns[$key] = $column;
|
184 |
-
}
|
185 |
-
}
|
186 |
-
$rows[0] = array_merge( $rows[0], $columns );
|
187 |
-
$rows[0] = array_merge( $rows[0], array( __( 'Memo', MWF_Config::DOMAIN ) ) );
|
188 |
-
return $rows[0];
|
189 |
-
}
|
190 |
-
|
191 |
-
/**
|
192 |
-
* get_rows
|
193 |
-
* @param array $posts
|
194 |
-
* @param array $headings
|
195 |
-
* @return array
|
196 |
-
*/
|
197 |
-
protected function get_rows( array $posts, array $headings ) {
|
198 |
-
global $post;
|
199 |
-
$rows = array();
|
200 |
-
foreach ( $posts as $post ) {
|
201 |
-
setup_postdata( $post );
|
202 |
-
$columns = array();
|
203 |
-
foreach ( $headings as $key => $value ) {
|
204 |
-
$Contact_Data_Setting = new MW_WP_Form_Contact_Data_Setting( $post->ID );
|
205 |
-
$response_statuses = $Contact_Data_Setting->get_response_statuses();
|
206 |
-
$column = '';
|
207 |
-
if ( $value === __( 'Response Status', MWF_Config::DOMAIN ) ) {
|
208 |
-
$response_status = $Contact_Data_Setting->get( 'response_status' );
|
209 |
-
$column = $response_statuses[$response_status];
|
210 |
-
} elseif ( $value === __( 'Memo', MWF_Config::DOMAIN ) ) {
|
211 |
-
$column = $Contact_Data_Setting->get( 'memo' );
|
212 |
-
} elseif ( isset( $post->$value ) ) {
|
213 |
-
$post_meta = $post->$value;
|
214 |
-
if ( $Contact_Data_Setting->is_upload_file_key( $post, $value ) ) {
|
215 |
-
$column = wp_get_attachment_url( $post_meta );
|
216 |
-
} else {
|
217 |
-
$column = ( $post_meta ) ? $post_meta : '';
|
218 |
-
}
|
219 |
-
}
|
220 |
-
$columns[$key] = $column;
|
221 |
-
}
|
222 |
-
$rows[] = $columns;
|
223 |
-
}
|
224 |
-
wp_reset_postdata();
|
225 |
-
return $rows;
|
226 |
-
}
|
227 |
-
|
228 |
-
/**
|
229 |
-
* escape_double_quote
|
230 |
-
* @param string $value
|
231 |
-
* @return string
|
232 |
-
*/
|
233 |
-
protected function escape_double_quote( $value ) {
|
234 |
-
$value = str_replace( '"', '""', $value );
|
235 |
-
return '"' . $value . '"';
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* get_posts_per_page
|
240 |
-
* @return int
|
241 |
-
*/
|
242 |
-
protected function get_posts_per_page() {
|
243 |
-
$posts_per_page = -1;
|
244 |
-
if ( ( isset( $_POST['download-all'] ) && $_POST['download-all'] === 'true' ) === false ) {
|
245 |
-
$current_user = wp_get_current_user();
|
246 |
-
$_posts_per_page = get_user_meta( $current_user->ID, 'edit_' . $post_type . '_per_page', true );
|
247 |
-
if ( !empty( $_posts_per_page ) ) {
|
248 |
-
$posts_per_page = $_posts_per_page;
|
249 |
-
}
|
250 |
-
}
|
251 |
-
return $posts_per_page;
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* get_paged
|
256 |
-
* @return int
|
257 |
-
*/
|
258 |
-
protected function get_paged() {
|
259 |
-
$posts_per_page = $this->get_posts_per_page();
|
260 |
-
$paged = 1;
|
261 |
-
if ( isset( $_GET['paged'] ) ) {
|
262 |
-
$_paged = $_GET['paged'];
|
263 |
-
if ( MWF_Functions::is_numeric( $_paged ) && $posts_per_page > 0 ) {
|
264 |
-
$paged = $_paged;
|
265 |
-
}
|
266 |
-
}
|
267 |
-
return $paged;
|
268 |
}
|
269 |
|
270 |
/**
|
271 |
-
* add_columns
|
272 |
* DB登録使用時に問い合わせデータ一覧にカラムを追加
|
273 |
*/
|
274 |
public function add_columns() {
|
275 |
-
$post_type = get_post_type();
|
276 |
add_filter(
|
277 |
-
'manage_' . $post_type . '_posts_columns',
|
278 |
array( $this, 'add_form_columns_name' )
|
279 |
);
|
280 |
add_action(
|
281 |
-
'manage_' . $post_type . '_posts_custom_column',
|
282 |
array( $this, 'add_form_columns' ),
|
283 |
10,
|
284 |
2
|
@@ -286,7 +106,8 @@ class MW_WP_Form_Contact_Data_List_Controller {
|
|
286 |
}
|
287 |
|
288 |
/**
|
289 |
-
*
|
|
|
290 |
* @param array $columns
|
291 |
* @return array $columns
|
292 |
*/
|
@@ -295,6 +116,7 @@ class MW_WP_Form_Contact_Data_List_Controller {
|
|
295 |
unset( $columns['date'] );
|
296 |
$columns['post_date'] = __( 'Registed Date', MWF_Config::DOMAIN );
|
297 |
$columns['response_status'] = __( 'Response Status', MWF_Config::DOMAIN );
|
|
|
298 |
foreach ( $posts as $post ) {
|
299 |
$post_custom_keys = get_post_custom_keys( $post->ID );
|
300 |
if ( ! empty( $post_custom_keys ) && is_array( $post_custom_keys ) ) {
|
@@ -303,34 +125,55 @@ class MW_WP_Form_Contact_Data_List_Controller {
|
|
303 |
continue;
|
304 |
}
|
305 |
if ( $key === MWF_Config::TRACKINGNUMBER ) {
|
306 |
-
$
|
307 |
continue;
|
308 |
}
|
309 |
-
$
|
310 |
}
|
311 |
}
|
312 |
}
|
|
|
|
|
313 |
return $columns;
|
314 |
}
|
315 |
|
316 |
/**
|
317 |
-
*
|
|
|
318 |
* @param string $column カラム名
|
319 |
* @param int $post_id
|
320 |
*/
|
321 |
public function add_form_columns( $column, $post_id ) {
|
|
|
322 |
$post_custom_keys = get_post_custom_keys( $post_id );
|
323 |
$Contact_Data_Setting = new MW_WP_Form_Contact_Data_Setting( $post_id );
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
}
|
331 |
|
332 |
/**
|
333 |
-
*
|
|
|
334 |
* @param object $counts
|
335 |
* @param string $type 投稿タイプ名
|
336 |
* @return object
|
@@ -350,19 +193,4 @@ class MW_WP_Form_Contact_Data_List_Controller {
|
|
350 |
}
|
351 |
return $counts;
|
352 |
}
|
353 |
-
|
354 |
-
/**
|
355 |
-
* is_contact_data_list
|
356 |
-
* @return bool
|
357 |
-
*/
|
358 |
-
protected function is_contact_data_list() {
|
359 |
-
if ( isset( $_GET['post_type'] ) ) {
|
360 |
-
$post_type = $_GET['post_type'];
|
361 |
-
$contact_data_post_types = MW_WP_Form_Contact_Data_Setting::get_posts();
|
362 |
-
if ( in_array( $post_type, $contact_data_post_types ) ) {
|
363 |
-
return true;
|
364 |
-
}
|
365 |
-
}
|
366 |
-
return false;
|
367 |
-
}
|
368 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Contact Data List Controller
|
4 |
+
* Version : 1.1.0
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : January 1, 2015
|
8 |
+
* Modified : March 27, 2015
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
+
class MW_WP_Form_Contact_Data_List_Controller extends MW_WP_Form_Controller {
|
13 |
|
14 |
/**
|
15 |
+
* @var string
|
16 |
*/
|
17 |
+
protected $post_type;
|
|
|
|
|
18 |
|
19 |
/**
|
20 |
+
* initialize
|
|
|
21 |
*/
|
22 |
+
public function initialize() {
|
23 |
+
$contact_data_post_types = MW_WP_Form_Contact_Data_Setting::get_posts();
|
24 |
+
if ( !isset( $_GET['post_type'] ) ) {
|
25 |
+
exit;
|
26 |
+
}
|
27 |
+
$this->post_type = $_GET['post_type'];
|
28 |
+
if ( !in_array( $this->post_type, $contact_data_post_types ) ) {
|
29 |
+
exit;
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
+
|
32 |
+
$CSV = new MW_WP_Form_CSV( $this->post_type );
|
33 |
+
$CSV->download();
|
34 |
+
|
35 |
+
add_action( 'pre_get_posts' , array( $this, 'pre_get_posts' ) );
|
36 |
+
add_action( 'admin_head' , array( $this, 'add_columns' ) );
|
37 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
38 |
+
add_action( 'admin_print_styles' , array( $this, 'admin_print_styles' ) );
|
39 |
+
add_action( 'in_admin_footer' , array( $this, 'add_csv_download_button' ) );
|
40 |
+
add_filter( 'wp_count_posts' , array( $this, 'wp_count_posts' ), 10, 2 );
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
+
* フックで表示するレコードに変更があれば変更
|
45 |
+
*
|
46 |
* @param WP_Query $wp_query
|
47 |
*/
|
48 |
public function pre_get_posts( $wp_query ) {
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
+
* CSS と JS の読み込み
|
62 |
*/
|
63 |
public function admin_enqueue_scripts() {
|
64 |
$url = plugins_url( MWF_Config::NAME );
|
67 |
}
|
68 |
|
69 |
/**
|
|
|
70 |
* DB登録データの一覧で新規追加のリンクを消す
|
71 |
*/
|
72 |
public function admin_print_styles() {
|
73 |
+
$this->render( 'contact-data-list/admin-print-styles' );
|
|
|
74 |
}
|
75 |
|
76 |
/**
|
|
|
77 |
* CSVダウンロードボタンを表示
|
78 |
*/
|
79 |
public function add_csv_download_button() {
|
80 |
+
if ( true !== apply_filters( 'mwform_csv_button_' . $this->post_type, true ) ) {
|
|
|
81 |
return;
|
82 |
}
|
83 |
$page = ( basename( $_SERVER['PHP_SELF'] ) );
|
85 |
return;
|
86 |
}
|
87 |
$action = $_SERVER['REQUEST_URI'];
|
88 |
+
$this->assign( 'action', $action );
|
89 |
+
$this->render( 'contact-data-list/csv-button' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
|
92 |
/**
|
|
|
93 |
* DB登録使用時に問い合わせデータ一覧にカラムを追加
|
94 |
*/
|
95 |
public function add_columns() {
|
|
|
96 |
add_filter(
|
97 |
+
'manage_' . $this->post_type . '_posts_columns',
|
98 |
array( $this, 'add_form_columns_name' )
|
99 |
);
|
100 |
add_action(
|
101 |
+
'manage_' . $this->post_type . '_posts_custom_column',
|
102 |
array( $this, 'add_form_columns' ),
|
103 |
10,
|
104 |
2
|
106 |
}
|
107 |
|
108 |
/**
|
109 |
+
* カラム名を取得
|
110 |
+
*
|
111 |
* @param array $columns
|
112 |
* @return array $columns
|
113 |
*/
|
116 |
unset( $columns['date'] );
|
117 |
$columns['post_date'] = __( 'Registed Date', MWF_Config::DOMAIN );
|
118 |
$columns['response_status'] = __( 'Response Status', MWF_Config::DOMAIN );
|
119 |
+
$_columns = array();
|
120 |
foreach ( $posts as $post ) {
|
121 |
$post_custom_keys = get_post_custom_keys( $post->ID );
|
122 |
if ( ! empty( $post_custom_keys ) && is_array( $post_custom_keys ) ) {
|
125 |
continue;
|
126 |
}
|
127 |
if ( $key === MWF_Config::TRACKINGNUMBER ) {
|
128 |
+
$_columns[$key] = MWF_Functions::get_tracking_number_title( $this->post_type );
|
129 |
continue;
|
130 |
}
|
131 |
+
$_columns[$key] = $key;
|
132 |
}
|
133 |
}
|
134 |
}
|
135 |
+
ksort( $_columns );
|
136 |
+
$columns = array_merge( $columns, $_columns );
|
137 |
return $columns;
|
138 |
}
|
139 |
|
140 |
/**
|
141 |
+
* 各カラムのデータを出力
|
142 |
+
*
|
143 |
* @param string $column カラム名
|
144 |
* @param int $post_id
|
145 |
*/
|
146 |
public function add_form_columns( $column, $post_id ) {
|
147 |
+
$post = get_post( $post_id );
|
148 |
$post_custom_keys = get_post_custom_keys( $post_id );
|
149 |
$Contact_Data_Setting = new MW_WP_Form_Contact_Data_Setting( $post_id );
|
150 |
+
|
151 |
+
if ( $column === 'post_date' ) {
|
152 |
+
$value = esc_html( $post->post_date );
|
153 |
+
} elseif ( $column === 'response_status' ) {
|
154 |
+
$response_statuses = $Contact_Data_Setting->get_response_statuses();
|
155 |
+
$response_status = $Contact_Data_Setting->get( 'response_status' );
|
156 |
+
$value = $response_statuses[$response_status];
|
157 |
+
} elseif ( is_array( $post_custom_keys ) && in_array( $column, $post_custom_keys ) ) {
|
158 |
+
$post_meta = get_post_meta( $post_id, $column, true );
|
159 |
+
if ( $Contact_Data_Setting->is_upload_file_key( $post, $column ) ) {
|
160 |
+
$value = MWF_Functions::get_multimedia_data( $post_meta );
|
161 |
+
} elseif ( $post_meta ) {
|
162 |
+
$value = esc_html( $post_meta );
|
163 |
+
} else {
|
164 |
+
$value = ' ';
|
165 |
+
}
|
166 |
+
} else {
|
167 |
+
$value = ' ';
|
168 |
+
}
|
169 |
+
|
170 |
+
$this->assign( 'column', $value );
|
171 |
+
$this->render( 'contact-data-list/column' );
|
172 |
}
|
173 |
|
174 |
/**
|
175 |
+
* 件数をカスタマイズ
|
176 |
+
*
|
177 |
* @param object $counts
|
178 |
* @param string $type 投稿タイプ名
|
179 |
* @return object
|
193 |
}
|
194 |
return $counts;
|
195 |
}
|
196 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/controllers/class.contact-data.php
CHANGED
@@ -1,98 +1,52 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Contact Data Controller
|
4 |
-
* Version : 1.0
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : December 31, 2014
|
8 |
-
* Modified :
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
-
class MW_WP_Form_Contact_Data_Controller {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* $contact_data_post_types
|
16 |
-
* @var array
|
17 |
-
*/
|
18 |
-
protected $contact_data_post_types = array();
|
19 |
|
20 |
/**
|
21 |
* initialize
|
22 |
*/
|
23 |
public function initialize() {
|
24 |
-
$
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
}
|
43 |
-
// 詳細ページの制限
|
44 |
-
if ( $screen->base ==='post' &&
|
45 |
-
in_array( $screen->id, $contact_data_post_types ) ) {
|
46 |
-
$_args = apply_filters( 'mwform_get_inquiry_data_args-' . $screen->post_type, array() );
|
47 |
-
if ( !empty( $_args ) && is_array( $_args ) ) {
|
48 |
-
$args = array(
|
49 |
-
'post_type' => $screen->post_type,
|
50 |
-
'post_status' => 'publish',
|
51 |
-
'posts_per_page' => 1,
|
52 |
-
'p' => $_GET['post'],
|
53 |
-
);
|
54 |
-
$args = array_merge( $_args, $args );
|
55 |
-
$permit_posts = get_posts( $args );
|
56 |
-
if ( empty( $permit_posts ) ) {
|
57 |
-
exit;
|
58 |
-
}
|
59 |
}
|
60 |
}
|
61 |
-
|
62 |
-
$Contact_Data = new MW_WP_Form_Contact_Data();
|
63 |
-
add_action( 'add_meta_boxes' , array( $this, 'add_meta_boxes' ) );
|
64 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
65 |
-
add_action( 'admin_print_styles' , array( $this, 'admin_print_styles' ) );
|
66 |
-
add_action( 'edit_form_top' , array( $this, 'edit_form_top' ) );
|
67 |
-
add_action( 'save_post' , array( $Contact_Data, 'save_post' ) );
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* admin_menu
|
73 |
-
* 問い合わせデータ閲覧ページへのメニューを追加
|
74 |
-
*/
|
75 |
-
public function admin_menu() {
|
76 |
-
$View = new MW_WP_Form_Contact_Data_View();
|
77 |
-
$View->set( 'contact_data_post_types', $this->contact_data_post_types );
|
78 |
-
|
79 |
-
if ( empty( $this->contact_data_post_types ) ) {
|
80 |
-
return;
|
81 |
}
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
array( $View, 'index' ) // 表示用の関数
|
90 |
-
);
|
91 |
}
|
92 |
|
93 |
/**
|
94 |
-
*
|
95 |
-
* 本当は css, js のロードだけしたいけど、ここからしか post_id がとれないので渋々…
|
96 |
*/
|
97 |
public function admin_enqueue_scripts() {
|
98 |
$url = plugins_url( MWF_Config::NAME );
|
@@ -100,40 +54,44 @@ class MW_WP_Form_Contact_Data_Controller {
|
|
100 |
}
|
101 |
|
102 |
/**
|
103 |
-
* admin_print_styles
|
104 |
* 詳細画面で新規追加のリンクを消す
|
105 |
*/
|
106 |
public function admin_print_styles() {
|
107 |
-
$
|
108 |
-
$View->admin_print_styles_for_detail();
|
109 |
}
|
110 |
|
111 |
/**
|
112 |
-
*
|
113 |
*/
|
114 |
public function add_meta_boxes() {
|
115 |
$post_type = get_post_type();
|
116 |
-
$View = new MW_WP_Form_Contact_Data_View();
|
117 |
-
$View->set( 'post_type', $post_type );
|
118 |
-
$View->set( 'Contact_Data_Setting', new MW_WP_Form_Contact_Data_Setting( get_the_ID() ) );
|
119 |
add_meta_box(
|
120 |
substr( MWF_Config::CONTACT_DATA_NAME, 1 ) . '_custom_fields',
|
121 |
__( 'Custom Fields', MWF_Config::DOMAIN ),
|
122 |
-
array( $
|
123 |
$post_type
|
124 |
);
|
125 |
}
|
126 |
|
127 |
/**
|
128 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
* 問い合わせデータ詳細画面で一覧に戻るリンクを表示
|
|
|
130 |
* @param object $post
|
131 |
*/
|
132 |
public function edit_form_top( $post ) {
|
133 |
$post_type = get_post_type();
|
134 |
$link = admin_url( '/edit.php?post_type=' . $post_type );
|
135 |
-
$
|
136 |
-
$
|
137 |
-
$View->returning_link();
|
138 |
}
|
139 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Contact Data Controller
|
4 |
+
* Version : 1.1.0
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : December 31, 2014
|
8 |
+
* Modified : March 27, 2015
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
+
class MW_WP_Form_Contact_Data_Controller extends MW_WP_Form_Controller {
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* initialize
|
16 |
*/
|
17 |
public function initialize() {
|
18 |
+
$screen = get_current_screen();
|
19 |
+
$contact_data_post_types = MW_WP_Form_Contact_Data_Setting::get_posts();
|
20 |
+
if ( $screen->base ==='post' && !in_array( $screen->id, $contact_data_post_types ) ) {
|
21 |
+
exit;
|
22 |
+
}
|
23 |
+
if ( $screen->base ==='post' && in_array( $screen->id, $contact_data_post_types ) ) {
|
24 |
+
$_args = apply_filters( 'mwform_get_inquiry_data_args-' . $screen->post_type, array() );
|
25 |
+
if ( !empty( $_args ) && is_array( $_args ) ) {
|
26 |
+
$args = array(
|
27 |
+
'post_type' => $screen->post_type,
|
28 |
+
'post_status' => 'publish',
|
29 |
+
'posts_per_page' => 1,
|
30 |
+
'p' => $_GET['post'],
|
31 |
+
);
|
32 |
+
$args = array_merge( $_args, $args );
|
33 |
+
$permit_posts = get_posts( $args );
|
34 |
+
if ( empty( $permit_posts ) ) {
|
35 |
+
exit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
|
40 |
+
$Contact_Data = new MW_WP_Form_Contact_Data();
|
41 |
+
add_action( 'add_meta_boxes' , array( $this, 'add_meta_boxes' ) );
|
42 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
43 |
+
add_action( 'admin_print_styles' , array( $this, 'admin_print_styles' ) );
|
44 |
+
add_action( 'edit_form_top' , array( $this, 'edit_form_top' ) );
|
45 |
+
add_action( 'save_post' , array( $Contact_Data, 'save_post' ) );
|
|
|
|
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
+
* CSSの読み込み
|
|
|
50 |
*/
|
51 |
public function admin_enqueue_scripts() {
|
52 |
$url = plugins_url( MWF_Config::NAME );
|
54 |
}
|
55 |
|
56 |
/**
|
|
|
57 |
* 詳細画面で新規追加のリンクを消す
|
58 |
*/
|
59 |
public function admin_print_styles() {
|
60 |
+
$this->render( 'contact-data/admin-print-styles' );
|
|
|
61 |
}
|
62 |
|
63 |
/**
|
64 |
+
* メタボックスを追加
|
65 |
*/
|
66 |
public function add_meta_boxes() {
|
67 |
$post_type = get_post_type();
|
|
|
|
|
|
|
68 |
add_meta_box(
|
69 |
substr( MWF_Config::CONTACT_DATA_NAME, 1 ) . '_custom_fields',
|
70 |
__( 'Custom Fields', MWF_Config::DOMAIN ),
|
71 |
+
array( $this, 'detail' ),
|
72 |
$post_type
|
73 |
);
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
+
* 詳細
|
78 |
+
*/
|
79 |
+
public function detail( $post ) {
|
80 |
+
$this->assign( 'post', $post );
|
81 |
+
$this->assign( 'post_type', $post->post_type );
|
82 |
+
$this->assign( 'Contact_Data_Setting', new MW_WP_Form_Contact_Data_Setting( get_the_ID() ) );
|
83 |
+
$this->render( 'contact-data/detail' );
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
* 問い合わせデータ詳細画面で一覧に戻るリンクを表示
|
88 |
+
*
|
89 |
* @param object $post
|
90 |
*/
|
91 |
public function edit_form_top( $post ) {
|
92 |
$post_type = get_post_type();
|
93 |
$link = admin_url( '/edit.php?post_type=' . $post_type );
|
94 |
+
$this->assign( 'link', $link );
|
95 |
+
$this->render( 'contact-data/returning-link' );
|
|
|
96 |
}
|
97 |
}
|
classes/controllers/class.controller.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Name : MW WP Form Controller
|
4 |
+
* Version : 1.0.0
|
5 |
+
* Author : Takashi Kitajima
|
6 |
+
* Author URI : http://2inc.org
|
7 |
+
* Created : March 28, 2015
|
8 |
+
* Modified :
|
9 |
+
* License : GPLv2
|
10 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
class MW_WP_Form_Controller {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* assign したデータを保持する配列
|
16 |
+
* @var array
|
17 |
+
*/
|
18 |
+
protected $assign_data = array();
|
19 |
+
|
20 |
+
/**
|
21 |
+
* 任意のデータを assign
|
22 |
+
*
|
23 |
+
* @param string $key
|
24 |
+
* @param mixed $value
|
25 |
+
*/
|
26 |
+
protected function assign( $key, $value ) {
|
27 |
+
$this->assign_data[$key] = $value;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* テンプレートを読み込んで表示
|
32 |
+
*
|
33 |
+
* @param string $template ディレクトリ名/ファイル名(拡張子無し)
|
34 |
+
*/
|
35 |
+
protected function render( $template ) {
|
36 |
+
extract( $this->assign_data );
|
37 |
+
$template_dir = plugin_dir_path( __FILE__ ) . '../../templates/';
|
38 |
+
$template_path = $template_dir . $template . '.php';
|
39 |
+
if ( file_exists( $template_path ) ) {
|
40 |
+
include( $template_path );
|
41 |
+
$this->assign_data = array();
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
classes/controllers/class.main.php
CHANGED
@@ -2,46 +2,52 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Main Controller
|
4 |
* Description: フロントエンドにおいて、適切な画面にリダイレクトさせる
|
5 |
-
* Version : 1.0.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 23, 2014
|
9 |
-
* Modified : March
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Main_Controller {
|
14 |
|
15 |
/**
|
16 |
-
* $Data
|
17 |
* @var MW_WP_Form_Data
|
18 |
*/
|
19 |
protected $Data;
|
20 |
|
21 |
/**
|
22 |
-
* $ExecShortcode
|
23 |
* @var MW_WP_Form_Exec_Shortcode
|
24 |
*/
|
25 |
protected $ExecShortcode;
|
26 |
|
27 |
/**
|
28 |
-
* $Redirected
|
29 |
* @var MW_WP_Form_Redrected
|
30 |
*/
|
31 |
protected $Redirected;
|
32 |
|
33 |
/**
|
34 |
-
* $Setting
|
35 |
* @var MW_WP_Form_Setting
|
36 |
*/
|
37 |
protected $Setting;
|
38 |
|
39 |
/**
|
40 |
-
* $validation_rules
|
41 |
* @var array
|
42 |
*/
|
43 |
protected $validation_rules = array();
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
/**
|
46 |
* __construct
|
47 |
* @param array $validation_rules
|
@@ -54,13 +60,13 @@ class MW_WP_Form_Main_Controller {
|
|
54 |
* initialize
|
55 |
*/
|
56 |
public function initialize() {
|
57 |
-
add_filter( 'nocache_headers'
|
58 |
-
add_action( 'parse_request'
|
59 |
-
add_filter( 'template_include', array( $this, 'template_include' ), 10000 );
|
|
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
-
* remove_query_vars_from_post
|
64 |
* WordPressへのリクエストに含まれている、$_POSTの値を削除
|
65 |
*/
|
66 |
public function remove_query_vars_from_post( $wp_query ) {
|
@@ -80,8 +86,8 @@ class MW_WP_Form_Main_Controller {
|
|
80 |
}
|
81 |
|
82 |
/**
|
83 |
-
* template_include
|
84 |
* 表示画面でのプラグインの処理等
|
|
|
85 |
* @param string $template
|
86 |
* @return string $template
|
87 |
*/
|
@@ -118,7 +124,8 @@ class MW_WP_Form_Main_Controller {
|
|
118 |
clone $this->Data
|
119 |
);
|
120 |
|
121 |
-
$
|
|
|
122 |
$is_valid = $this->Validation->check();
|
123 |
$this->Redirected = new MW_WP_Form_Redirected(
|
124 |
$this->ExecShortcode->get( 'input_url' ),
|
@@ -138,7 +145,7 @@ class MW_WP_Form_Main_Controller {
|
|
138 |
}
|
139 |
// complete のとき
|
140 |
if ( $view_flg === 'complete' ) {
|
141 |
-
if ( !$this->
|
142 |
$this->send();
|
143 |
}
|
144 |
// 手動フォームの場合は完了画面に ExecShortcode が無く footer の clear_values が
|
@@ -157,14 +164,17 @@ class MW_WP_Form_Main_Controller {
|
|
157 |
}
|
158 |
|
159 |
// 画面表示用のショートコードを登録
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
168 |
|
169 |
add_action( 'wp_footer' , array( $this->Data, 'clear_values' ) );
|
170 |
add_action( 'wp_enqueue_scripts', array( $this , 'wp_enqueue_scripts' ) );
|
@@ -173,8 +183,8 @@ class MW_WP_Form_Main_Controller {
|
|
173 |
}
|
174 |
|
175 |
/**
|
176 |
-
* redirect
|
177 |
* 現在のURLと引数で渡されたリダイレクトURLが同じであればリダイレクトしない
|
|
|
178 |
* @param string リダイレクトURL
|
179 |
*/
|
180 |
private function redirect( $url ) {
|
@@ -225,8 +235,8 @@ class MW_WP_Form_Main_Controller {
|
|
225 |
}
|
226 |
|
227 |
/**
|
228 |
-
*
|
229 |
-
*
|
230 |
* @param array $headers
|
231 |
* @return array $headers
|
232 |
*/
|
@@ -236,7 +246,6 @@ class MW_WP_Form_Main_Controller {
|
|
236 |
}
|
237 |
|
238 |
/**
|
239 |
-
* send
|
240 |
* メール送信
|
241 |
*/
|
242 |
protected function send() {
|
@@ -252,7 +261,7 @@ class MW_WP_Form_Main_Controller {
|
|
252 |
// 自動返信メールの送信
|
253 |
$automatic_reply_email = $this->Setting->get( 'automatic_reply_email' );
|
254 |
if ( $automatic_reply_email ) {
|
255 |
-
$automatic_reply_email = $this->Data->
|
256 |
$is_invalid_mail_address = $this->validation_rules['mail']->rule(
|
257 |
$automatic_reply_email
|
258 |
);
|
@@ -267,16 +276,17 @@ class MW_WP_Form_Main_Controller {
|
|
267 |
}
|
268 |
|
269 |
/**
|
270 |
-
*
|
|
|
271 |
* @return array $attachments pathの配列
|
272 |
*/
|
273 |
protected function get_attachments() {
|
274 |
$attachments = array();
|
275 |
-
$upload_file_keys = $this->Data->
|
276 |
if ( $upload_file_keys !== null && is_array( $upload_file_keys ) ) {
|
277 |
$wp_upload_dir = wp_upload_dir();
|
278 |
foreach ( $upload_file_keys as $key ) {
|
279 |
-
$upload_file_url = $this->Data->
|
280 |
if ( !$upload_file_url ) {
|
281 |
continue;
|
282 |
}
|
@@ -293,13 +303,12 @@ class MW_WP_Form_Main_Controller {
|
|
293 |
}
|
294 |
|
295 |
/**
|
296 |
-
* file_upload
|
297 |
* ファイルアップロード処理。実際のアップロード状況に合わせてフォームデータも再生成する。
|
298 |
*/
|
299 |
protected function file_upload() {
|
300 |
$File = new MW_WP_Form_File();
|
301 |
$files = array();
|
302 |
-
$upload_files = $this->Data->
|
303 |
if ( !is_array( $upload_files ) ) {
|
304 |
$upload_files = array();
|
305 |
}
|
@@ -312,4 +321,50 @@ class MW_WP_Form_Main_Controller {
|
|
312 |
$this->Data->set_upload_file_keys();
|
313 |
$this->Data->push_uploaded_file_keys( $uploaded_files );
|
314 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
}
|
2 |
/**
|
3 |
* Name : MW WP Form Main Controller
|
4 |
* Description: フロントエンドにおいて、適切な画面にリダイレクトさせる
|
5 |
+
* Version : 1.0.4
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 23, 2014
|
9 |
+
* Modified : March 26, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Main_Controller {
|
14 |
|
15 |
/**
|
|
|
16 |
* @var MW_WP_Form_Data
|
17 |
*/
|
18 |
protected $Data;
|
19 |
|
20 |
/**
|
|
|
21 |
* @var MW_WP_Form_Exec_Shortcode
|
22 |
*/
|
23 |
protected $ExecShortcode;
|
24 |
|
25 |
/**
|
|
|
26 |
* @var MW_WP_Form_Redrected
|
27 |
*/
|
28 |
protected $Redirected;
|
29 |
|
30 |
/**
|
|
|
31 |
* @var MW_WP_Form_Setting
|
32 |
*/
|
33 |
protected $Setting;
|
34 |
|
35 |
/**
|
|
|
36 |
* @var array
|
37 |
*/
|
38 |
protected $validation_rules = array();
|
39 |
|
40 |
+
/**
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
protected $token_name = 'token';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* リダイレクトされてからの complete であれば true
|
47 |
+
* @var bool
|
48 |
+
*/
|
49 |
+
protected $complete_twice = false;
|
50 |
+
|
51 |
/**
|
52 |
* __construct
|
53 |
* @param array $validation_rules
|
60 |
* initialize
|
61 |
*/
|
62 |
public function initialize() {
|
63 |
+
add_filter( 'nocache_headers' , array( $this, 'nocache_headers' ) , 1 );
|
64 |
+
add_action( 'parse_request' , array( $this, 'remove_query_vars_from_post' ) );
|
65 |
+
add_filter( 'template_include' , array( $this, 'template_include' ), 10000 );
|
66 |
+
add_filter( 'mwform_form_end_html', array( $this, 'mwform_form_end_html' ) );
|
67 |
}
|
68 |
|
69 |
/**
|
|
|
70 |
* WordPressへのリクエストに含まれている、$_POSTの値を削除
|
71 |
*/
|
72 |
public function remove_query_vars_from_post( $wp_query ) {
|
86 |
}
|
87 |
|
88 |
/**
|
|
|
89 |
* 表示画面でのプラグインの処理等
|
90 |
+
*
|
91 |
* @param string $template
|
92 |
* @return string $template
|
93 |
*/
|
124 |
clone $this->Data
|
125 |
);
|
126 |
|
127 |
+
$token_check = $this->token_check();
|
128 |
+
$post_condition = $this->Data->get_post_condition( $token_check );
|
129 |
$is_valid = $this->Validation->check();
|
130 |
$this->Redirected = new MW_WP_Form_Redirected(
|
131 |
$this->ExecShortcode->get( 'input_url' ),
|
145 |
}
|
146 |
// complete のとき
|
147 |
if ( $view_flg === 'complete' ) {
|
148 |
+
if ( !$this->is_complete_twice() ) {
|
149 |
$this->send();
|
150 |
}
|
151 |
// 手動フォームの場合は完了画面に ExecShortcode が無く footer の clear_values が
|
164 |
}
|
165 |
|
166 |
// 画面表示用のショートコードを登録
|
167 |
+
do_action(
|
168 |
+
'mwform_add_shortcode',
|
169 |
+
new MW_WP_Form_Form(),
|
170 |
+
$view_flg,
|
171 |
+
$Error,
|
172 |
+
$form_key,
|
173 |
+
$this->Data
|
174 |
+
);
|
175 |
+
|
176 |
+
$Form = new MW_WP_Form_Form();
|
177 |
+
$this->ExecShortcode->add_shortcode( $view_flg, $this->Setting, $Form, $this->Data );
|
178 |
|
179 |
add_action( 'wp_footer' , array( $this->Data, 'clear_values' ) );
|
180 |
add_action( 'wp_enqueue_scripts', array( $this , 'wp_enqueue_scripts' ) );
|
183 |
}
|
184 |
|
185 |
/**
|
|
|
186 |
* 現在のURLと引数で渡されたリダイレクトURLが同じであればリダイレクトしない
|
187 |
+
*
|
188 |
* @param string リダイレクトURL
|
189 |
*/
|
190 |
private function redirect( $url ) {
|
235 |
}
|
236 |
|
237 |
/**
|
238 |
+
* Nginx Cache Controller 用に header をカスタマイズ
|
239 |
+
*
|
240 |
* @param array $headers
|
241 |
* @return array $headers
|
242 |
*/
|
246 |
}
|
247 |
|
248 |
/**
|
|
|
249 |
* メール送信
|
250 |
*/
|
251 |
protected function send() {
|
261 |
// 自動返信メールの送信
|
262 |
$automatic_reply_email = $this->Setting->get( 'automatic_reply_email' );
|
263 |
if ( $automatic_reply_email ) {
|
264 |
+
$automatic_reply_email = $this->Data->get_post_value_by_key( $automatic_reply_email );
|
265 |
$is_invalid_mail_address = $this->validation_rules['mail']->rule(
|
266 |
$automatic_reply_email
|
267 |
);
|
276 |
}
|
277 |
|
278 |
/**
|
279 |
+
* 送信されたデータをもとに添付ファイル用の配列を生成して返す
|
280 |
+
*
|
281 |
* @return array $attachments pathの配列
|
282 |
*/
|
283 |
protected function get_attachments() {
|
284 |
$attachments = array();
|
285 |
+
$upload_file_keys = $this->Data->get_post_value_by_key( MWF_Config::UPLOAD_FILE_KEYS );
|
286 |
if ( $upload_file_keys !== null && is_array( $upload_file_keys ) ) {
|
287 |
$wp_upload_dir = wp_upload_dir();
|
288 |
foreach ( $upload_file_keys as $key ) {
|
289 |
+
$upload_file_url = $this->Data->get_post_value_by_key( $key );
|
290 |
if ( !$upload_file_url ) {
|
291 |
continue;
|
292 |
}
|
303 |
}
|
304 |
|
305 |
/**
|
|
|
306 |
* ファイルアップロード処理。実際のアップロード状況に合わせてフォームデータも再生成する。
|
307 |
*/
|
308 |
protected function file_upload() {
|
309 |
$File = new MW_WP_Form_File();
|
310 |
$files = array();
|
311 |
+
$upload_files = $this->Data->get_post_value_by_key( MWF_Config::UPLOAD_FILES );
|
312 |
if ( !is_array( $upload_files ) ) {
|
313 |
$upload_files = array();
|
314 |
}
|
321 |
$this->Data->set_upload_file_keys();
|
322 |
$this->Data->push_uploaded_file_keys( $uploaded_files );
|
323 |
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* トークンチェック
|
327 |
+
*
|
328 |
+
* @return bool
|
329 |
+
*/
|
330 |
+
protected function token_check() {
|
331 |
+
if ( isset( $_POST[$this->token_name] ) ) {
|
332 |
+
$request_token = $_POST[$this->token_name];
|
333 |
+
}
|
334 |
+
$values = $this->Data->gets();
|
335 |
+
$form_key = $this->ExecShortcode->get( 'key' );
|
336 |
+
if ( isset( $request_token ) && wp_verify_nonce( $request_token, $form_key ) ) {
|
337 |
+
return true;
|
338 |
+
} elseif ( empty( $_POST ) && $values ) {
|
339 |
+
$this->complete_twice = true;
|
340 |
+
return true;
|
341 |
+
}
|
342 |
+
return false;
|
343 |
+
}
|
344 |
+
|
345 |
+
/**
|
346 |
+
* トークンを挿入
|
347 |
+
*
|
348 |
+
* @param string $html
|
349 |
+
* @return string
|
350 |
+
*/
|
351 |
+
public function mwform_form_end_html( $html ) {
|
352 |
+
if ( is_a( $this->ExecShortcode, 'MW_WP_Form_Exec_Shortcode' ) ) {
|
353 |
+
$form_key = $this->ExecShortcode->get( 'key' );
|
354 |
+
$html .= wp_nonce_field( $form_key, $this->token_name, true, false );
|
355 |
+
return $html;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* リダイレクト後の complete かチェック
|
361 |
+
*
|
362 |
+
* @return bool
|
363 |
+
*/
|
364 |
+
protected function is_complete_twice() {
|
365 |
+
if ( $this->complete_twice === true ) {
|
366 |
+
return true;
|
367 |
+
}
|
368 |
+
return false;
|
369 |
+
}
|
370 |
}
|
classes/controllers/class.stores-inquiry-data-form-list.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Name : MW WP Form Stores Inquiry Data Form List Controller
|
4 |
+
* Version : 1.0.0
|
5 |
+
* Author : Takashi Kitajima
|
6 |
+
* Author URI : http://2inc.org
|
7 |
+
* Created : March 27, 2015
|
8 |
+
* Modified :
|
9 |
+
* License : GPLv2
|
10 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
class MW_WP_Form_Stores_Inquiry_Data_Form_List_Controller extends MW_WP_Form_Controller {
|
13 |
+
|
14 |
+
public function index() {
|
15 |
+
$contact_data_post_types = MW_WP_Form_Contact_Data_Setting::get_posts();
|
16 |
+
$form_list = array();
|
17 |
+
foreach ( $contact_data_post_types as $post_type ) {
|
18 |
+
$post_type_object = get_post_type_object( $post_type );
|
19 |
+
$form_list[$post_type] = array(
|
20 |
+
'title' => $post_type_object->labels->singular_name,
|
21 |
+
'count' => $this->get_count( $post_type ),
|
22 |
+
'modified_datetime' => $this->get_modified_datetime( $post_type ),
|
23 |
+
'created_datetime' => $this->get_created_datetime( $post_type )
|
24 |
+
);
|
25 |
+
}
|
26 |
+
$this->assign( 'form_list', $form_list );
|
27 |
+
$this->render( 'stores-inquiry-data-form-list/index' );
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* データ件数を取得
|
32 |
+
*
|
33 |
+
* @param string $post_type 投稿タイプ名
|
34 |
+
* @return numeric 投稿数
|
35 |
+
*/
|
36 |
+
protected function get_count( $post_type ) {
|
37 |
+
$_args = apply_filters( 'mwform_get_inquiry_data_args-' . $post_type, array() );
|
38 |
+
$args = array(
|
39 |
+
'post_type' => $post_type,
|
40 |
+
'posts_per_page' => 1,
|
41 |
+
);
|
42 |
+
if ( !empty( $_args ) && is_array( $_args ) ) {
|
43 |
+
$args = array_merge( $_args, $args );
|
44 |
+
}
|
45 |
+
$query = new WP_Query( $args );
|
46 |
+
return $query->found_posts;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* フォームの作成日時を取得
|
51 |
+
*
|
52 |
+
* @param string $post_type 投稿タイプ名
|
53 |
+
* @return string 作成日
|
54 |
+
*/
|
55 |
+
protected function get_created_datetime( $post_type ) {
|
56 |
+
$post_id = preg_replace( '/^mwf_(.+?)$/', '$1', $post_type );
|
57 |
+
$post_date = get_the_date( get_option( 'date_format' ), $post_id );
|
58 |
+
return $post_date;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* 問い合わせデータの最新保存日を取得
|
63 |
+
*
|
64 |
+
* @param string $post_type 投稿タイプ名
|
65 |
+
* @return string 問い合わせデータの最新保存日
|
66 |
+
*/
|
67 |
+
protected function get_modified_datetime( $post_type ) {
|
68 |
+
global $post;
|
69 |
+
$inquiry_posts = get_posts( array(
|
70 |
+
'post_type' => $post_type,
|
71 |
+
'posts_per_page' => 1,
|
72 |
+
'orderby' => 'modified',
|
73 |
+
) );
|
74 |
+
|
75 |
+
$modified_datetime = '';
|
76 |
+
foreach ( $inquiry_posts as $post ) {
|
77 |
+
setup_postdata( $post );
|
78 |
+
$modified_datetime = get_the_modified_date();
|
79 |
+
break;
|
80 |
+
}
|
81 |
+
wp_reset_postdata();
|
82 |
+
return $modified_datetime;
|
83 |
+
}
|
84 |
+
}
|
classes/form-fields/class.checkbox.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Field Checkbox
|
4 |
* Description: チェックボックスを出力
|
5 |
-
* Version : 1.5.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -39,10 +39,10 @@ class MW_WP_Form_Field_Checkbox extends MW_WP_Form_Abstract_Form_Field {
|
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
-
'id' =>
|
43 |
'children' => '',
|
44 |
'value' => '',
|
45 |
-
'vertically' =>
|
46 |
'post_raw' => 'false',
|
47 |
'show_error' => 'true',
|
48 |
'separator' => ', ',
|
@@ -55,9 +55,13 @@ class MW_WP_Form_Field_Checkbox extends MW_WP_Form_Abstract_Form_Field {
|
|
55 |
* @return string HTML
|
56 |
*/
|
57 |
protected function input_page() {
|
|
|
|
|
|
|
|
|
58 |
$children = $this->get_children( $this->atts['children'] );
|
59 |
-
$value = explode( ',', $this->atts['value'] );
|
60 |
$separator = ( $this->atts['separator'] ) ? $this->atts['separator'] : $this->defaults['separator'];
|
|
|
61 |
$_ret = $this->Form->checkbox( $this->atts['name'], $children, array(
|
62 |
'id' => $this->atts['id'],
|
63 |
'value' => $value,
|
@@ -79,11 +83,12 @@ class MW_WP_Form_Field_Checkbox extends MW_WP_Form_Abstract_Form_Field {
|
|
79 |
*/
|
80 |
protected function confirm_page() {
|
81 |
$children = $this->get_children( $this->atts['children'] );
|
82 |
-
$value = $this->
|
83 |
-
$posted_value = $this->
|
|
|
84 |
$_ret = esc_html( $value );
|
85 |
$_ret .= $this->Form->hidden( $this->atts['name'] . '[data]', $posted_value );
|
86 |
-
$_ret .= $this->Form->separator( $this->atts['name'] );
|
87 |
if ( $this->atts['post_raw'] === 'false' ) {
|
88 |
$_ret .= $this->Form->children( $this->atts['name'], $children );
|
89 |
}
|
2 |
/**
|
3 |
* Name : MW WP Form Field Checkbox
|
4 |
* Description: チェックボックスを出力
|
5 |
+
* Version : 1.5.9
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
+
'id' => null,
|
43 |
'children' => '',
|
44 |
'value' => '',
|
45 |
+
'vertically' => null,
|
46 |
'post_raw' => 'false',
|
47 |
'show_error' => 'true',
|
48 |
'separator' => ', ',
|
55 |
* @return string HTML
|
56 |
*/
|
57 |
protected function input_page() {
|
58 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
59 |
+
if ( is_null( $value ) ) {
|
60 |
+
$value = $this->atts['value'];
|
61 |
+
}
|
62 |
$children = $this->get_children( $this->atts['children'] );
|
|
|
63 |
$separator = ( $this->atts['separator'] ) ? $this->atts['separator'] : $this->defaults['separator'];
|
64 |
+
|
65 |
$_ret = $this->Form->checkbox( $this->atts['name'], $children, array(
|
66 |
'id' => $this->atts['id'],
|
67 |
'value' => $value,
|
83 |
*/
|
84 |
protected function confirm_page() {
|
85 |
$children = $this->get_children( $this->atts['children'] );
|
86 |
+
$value = $this->Data->get( $this->atts['name'], $children );
|
87 |
+
$posted_value = $this->Data->get_raw( $this->atts['name'] );
|
88 |
+
$separator = $this->Data->get_separator_value( $this->atts['name'] );
|
89 |
$_ret = esc_html( $value );
|
90 |
$_ret .= $this->Form->hidden( $this->atts['name'] . '[data]', $posted_value );
|
91 |
+
$_ret .= $this->Form->separator( $this->atts['name'], $separator );
|
92 |
if ( $this->atts['post_raw'] === 'false' ) {
|
93 |
$_ret .= $this->Form->children( $this->atts['name'], $children );
|
94 |
}
|
classes/form-fields/class.datepicker.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Field Datepicker
|
4 |
* Description: datepickerを出力
|
5 |
-
* Version : 1.5.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -39,7 +39,7 @@ class MW_WP_Form_Field_Datepicker extends MW_WP_Form_Abstract_Form_Field {
|
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
-
'id' =>
|
43 |
'size' => 30,
|
44 |
'js' => '',
|
45 |
'value' => '',
|
@@ -76,12 +76,17 @@ class MW_WP_Form_Field_Datepicker extends MW_WP_Form_Abstract_Form_Field {
|
|
76 |
monthNamesShort: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]
|
77 |
';
|
78 |
}
|
|
|
|
|
|
|
|
|
|
|
79 |
$_ret = '';
|
80 |
$_ret .= $this->Form->datepicker( $this->atts['name'], array(
|
81 |
'id' => $this->atts['id'],
|
82 |
'size' => $this->atts['size'],
|
83 |
'js' => $this->atts['js'],
|
84 |
-
'value' => $
|
85 |
) );
|
86 |
if ( $this->atts['show_error'] !== 'false' ) {
|
87 |
$_ret .= $this->get_error( $this->atts['name'] );
|
@@ -95,7 +100,7 @@ class MW_WP_Form_Field_Datepicker extends MW_WP_Form_Abstract_Form_Field {
|
|
95 |
* @return string HTML
|
96 |
*/
|
97 |
protected function confirm_page() {
|
98 |
-
$value = $this->
|
99 |
$_ret = esc_html( $value );
|
100 |
$_ret .= $this->Form->hidden( $this->atts['name'], $value );
|
101 |
return $_ret;
|
2 |
/**
|
3 |
* Name : MW WP Form Field Datepicker
|
4 |
* Description: datepickerを出力
|
5 |
+
* Version : 1.5.2
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
+
'id' => null,
|
43 |
'size' => 30,
|
44 |
'js' => '',
|
45 |
'value' => '',
|
76 |
monthNamesShort: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]
|
77 |
';
|
78 |
}
|
79 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
80 |
+
if ( is_null( $value ) ) {
|
81 |
+
$value = $this->atts['value'];
|
82 |
+
}
|
83 |
+
|
84 |
$_ret = '';
|
85 |
$_ret .= $this->Form->datepicker( $this->atts['name'], array(
|
86 |
'id' => $this->atts['id'],
|
87 |
'size' => $this->atts['size'],
|
88 |
'js' => $this->atts['js'],
|
89 |
+
'value' => $value,
|
90 |
) );
|
91 |
if ( $this->atts['show_error'] !== 'false' ) {
|
92 |
$_ret .= $this->get_error( $this->atts['name'] );
|
100 |
* @return string HTML
|
101 |
*/
|
102 |
protected function confirm_page() {
|
103 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
104 |
$_ret = esc_html( $value );
|
105 |
$_ret .= $this->Form->hidden( $this->atts['name'], $value );
|
106 |
return $_ret;
|
classes/form-fields/class.file.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Field File
|
4 |
* Description: 画像アップロードフィールドを出力
|
5 |
-
* Version : 1.5.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : May 17, 2013
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -39,7 +39,7 @@ class MW_WP_Form_Field_File extends MW_WP_Form_Abstract_Form_Field {
|
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
-
'id' =>
|
43 |
'show_error' => 'true',
|
44 |
);
|
45 |
}
|
@@ -53,15 +53,21 @@ class MW_WP_Form_Field_File extends MW_WP_Form_Abstract_Form_Field {
|
|
53 |
$_ret = $this->Form->file( $this->atts['name'], array(
|
54 |
'id' => $this->atts['id'],
|
55 |
) );
|
56 |
-
$value = $this->
|
57 |
-
$upload_file_keys = $this->
|
58 |
if ( !empty( $value ) && is_array( $upload_file_keys ) && in_array( $this->atts['name'], $upload_file_keys ) ) {
|
59 |
$filepath = MWF_Functions::fileurl_to_path( $value );
|
60 |
if ( file_exists( $filepath ) ) {
|
61 |
-
$_ret .=
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
}
|
67 |
if ( $this->atts['show_error'] !== 'false' ) {
|
@@ -76,7 +82,7 @@ class MW_WP_Form_Field_File extends MW_WP_Form_Abstract_Form_Field {
|
|
76 |
* @return string HTML
|
77 |
*/
|
78 |
protected function confirm_page() {
|
79 |
-
$value = $this->
|
80 |
if ( $value ) {
|
81 |
$filepath = MWF_Functions::fileurl_to_path( $value );
|
82 |
if ( file_exists( $filepath ) ) {
|
2 |
/**
|
3 |
* Name : MW WP Form Field File
|
4 |
* Description: 画像アップロードフィールドを出力
|
5 |
+
* Version : 1.5.2
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : May 17, 2013
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
+
'id' => null,
|
43 |
'show_error' => 'true',
|
44 |
);
|
45 |
}
|
53 |
$_ret = $this->Form->file( $this->atts['name'], array(
|
54 |
'id' => $this->atts['id'],
|
55 |
) );
|
56 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
57 |
+
$upload_file_keys = $this->Data->get_post_value_by_key( MWF_Config::UPLOAD_FILE_KEYS );
|
58 |
if ( !empty( $value ) && is_array( $upload_file_keys ) && in_array( $this->atts['name'], $upload_file_keys ) ) {
|
59 |
$filepath = MWF_Functions::fileurl_to_path( $value );
|
60 |
if ( file_exists( $filepath ) ) {
|
61 |
+
$_ret .= sprintf(
|
62 |
+
'<div class="%s_file">
|
63 |
+
<a href="%s" target="_blank">%s</a>
|
64 |
+
%s
|
65 |
+
</div>',
|
66 |
+
esc_attr( MWF_Config::NAME ),
|
67 |
+
esc_attr( $value ),
|
68 |
+
esc_html__( 'Uploaded.', MWF_Config::DOMAIN ),
|
69 |
+
$this->Form->hidden( $this->atts['name'], $value )
|
70 |
+
);
|
71 |
}
|
72 |
}
|
73 |
if ( $this->atts['show_error'] !== 'false' ) {
|
82 |
* @return string HTML
|
83 |
*/
|
84 |
protected function confirm_page() {
|
85 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
86 |
if ( $value ) {
|
87 |
$filepath = MWF_Functions::fileurl_to_path( $value );
|
88 |
if ( file_exists( $filepath ) ) {
|
classes/form-fields/class.hidden.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Hidden
|
4 |
* Description: hiddenフィールドを出力
|
5 |
-
* Version : 1.6.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -43,11 +43,14 @@ class MW_WP_Form_Field_Hidden extends MW_WP_Form_Abstract_Form_Field {
|
|
43 |
* @return string HTML
|
44 |
*/
|
45 |
protected function input_page() {
|
46 |
-
$
|
47 |
if ( $this->atts['echo'] === 'true' ) {
|
48 |
-
$
|
|
|
|
|
|
|
49 |
}
|
50 |
-
return esc_html( $
|
51 |
}
|
52 |
|
53 |
/**
|
@@ -56,7 +59,7 @@ class MW_WP_Form_Field_Hidden extends MW_WP_Form_Abstract_Form_Field {
|
|
56 |
* @return string HTML
|
57 |
*/
|
58 |
protected function confirm_page() {
|
59 |
-
$value = $this->
|
60 |
$echo_value = '';
|
61 |
if ( $this->atts['echo'] === 'true' ) {
|
62 |
$echo_value = $value;
|
2 |
/**
|
3 |
* Name : MW WP Form Hidden
|
4 |
* Description: hiddenフィールドを出力
|
5 |
+
* Version : 1.6.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
+
* Modified : March 26, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
43 |
* @return string HTML
|
44 |
*/
|
45 |
protected function input_page() {
|
46 |
+
$value = '';
|
47 |
if ( $this->atts['echo'] === 'true' ) {
|
48 |
+
$value = $this->atts['value'];
|
49 |
+
}
|
50 |
+
if ( is_null( $value ) ) {
|
51 |
+
$value = $this->get_raw( $this->atts['name'] );
|
52 |
}
|
53 |
+
return esc_html( $value ) . $this->Form->hidden( $this->atts['name'], $value );
|
54 |
}
|
55 |
|
56 |
/**
|
59 |
* @return string HTML
|
60 |
*/
|
61 |
protected function confirm_page() {
|
62 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
63 |
$echo_value = '';
|
64 |
if ( $this->atts['echo'] === 'true' ) {
|
65 |
$echo_value = $value;
|
classes/form-fields/class.image.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Field Image
|
4 |
* Description: 画像アップロードフィールドを出力
|
5 |
-
* Version : 1.5.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : May 17, 2013
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -39,7 +39,7 @@ class MW_WP_Form_Field_Image extends MW_WP_Form_Abstract_Form_Field {
|
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
-
'id' =>
|
43 |
'show_error' => 'true',
|
44 |
);
|
45 |
}
|
@@ -53,16 +53,21 @@ class MW_WP_Form_Field_Image extends MW_WP_Form_Abstract_Form_Field {
|
|
53 |
$_ret = $this->Form->file( $this->atts['name'], array(
|
54 |
'id' => $this->atts['id'],
|
55 |
) );
|
56 |
-
$value = $this->
|
57 |
|
58 |
-
$upload_file_keys = $this->
|
59 |
if ( !empty( $value ) && is_array( $upload_file_keys ) && in_array( $this->atts['name'], $upload_file_keys ) ) {
|
60 |
$filepath = MWF_Functions::fileurl_to_path( $value );
|
61 |
if ( file_exists( $filepath ) ) {
|
62 |
-
$_ret .=
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
}
|
68 |
if ( $this->atts['show_error'] !== 'false' ) {
|
@@ -77,15 +82,19 @@ class MW_WP_Form_Field_Image extends MW_WP_Form_Abstract_Form_Field {
|
|
77 |
* @return string HTML
|
78 |
*/
|
79 |
protected function confirm_page() {
|
80 |
-
$value = $this->
|
81 |
if ( $value ) {
|
82 |
$filepath = MWF_Functions::fileurl_to_path( $value );
|
83 |
if ( file_exists( $filepath ) ) {
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
}
|
91 |
}
|
2 |
/**
|
3 |
* Name : MW WP Form Field Image
|
4 |
* Description: 画像アップロードフィールドを出力
|
5 |
+
* Version : 1.5.2
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : May 17, 2013
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
+
'id' => null,
|
43 |
'show_error' => 'true',
|
44 |
);
|
45 |
}
|
53 |
$_ret = $this->Form->file( $this->atts['name'], array(
|
54 |
'id' => $this->atts['id'],
|
55 |
) );
|
56 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
57 |
|
58 |
+
$upload_file_keys = $this->Data->get_post_value_by_key( MWF_Config::UPLOAD_FILE_KEYS );
|
59 |
if ( !empty( $value ) && is_array( $upload_file_keys ) && in_array( $this->atts['name'], $upload_file_keys ) ) {
|
60 |
$filepath = MWF_Functions::fileurl_to_path( $value );
|
61 |
if ( file_exists( $filepath ) ) {
|
62 |
+
$_ret .= sprintf(
|
63 |
+
'<div class="%s_image">
|
64 |
+
<img src="%s" alt="" />
|
65 |
+
%s
|
66 |
+
</div>',
|
67 |
+
esc_attr( MWF_Config::NAME ),
|
68 |
+
esc_attr( $value ),
|
69 |
+
$this->Form->hidden( $this->atts['name'], $value )
|
70 |
+
);
|
71 |
}
|
72 |
}
|
73 |
if ( $this->atts['show_error'] !== 'false' ) {
|
82 |
* @return string HTML
|
83 |
*/
|
84 |
protected function confirm_page() {
|
85 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
86 |
if ( $value ) {
|
87 |
$filepath = MWF_Functions::fileurl_to_path( $value );
|
88 |
if ( file_exists( $filepath ) ) {
|
89 |
+
return sprintf(
|
90 |
+
'<div class="%s_image">
|
91 |
+
<img src="%s" alt="" />
|
92 |
+
%s
|
93 |
+
</div>',
|
94 |
+
esc_attr( MWF_Config::NAME ),
|
95 |
+
esc_attr( $value ),
|
96 |
+
$this->Form->hidden( $this->atts['name'], $value )
|
97 |
+
);
|
98 |
}
|
99 |
}
|
100 |
}
|
classes/form-fields/class.password.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Password
|
4 |
* Description: パスワードフィールドを出力
|
5 |
-
* Version : 1.5.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -39,11 +39,11 @@ class MW_WP_Form_Field_Password extends MW_WP_Form_Abstract_Form_Field {
|
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
-
'id' =>
|
43 |
'size' => 60,
|
44 |
'maxlength' => 255,
|
45 |
'value' => '',
|
46 |
-
'placeholder' =>
|
47 |
'show_error' => 'true',
|
48 |
);
|
49 |
}
|
@@ -54,11 +54,16 @@ class MW_WP_Form_Field_Password extends MW_WP_Form_Abstract_Form_Field {
|
|
54 |
* @return string HTML
|
55 |
*/
|
56 |
protected function input_page() {
|
|
|
|
|
|
|
|
|
|
|
57 |
$_ret = $this->Form->password( $this->atts['name'], array(
|
58 |
'id' => $this->atts['id'],
|
59 |
'size' => $this->atts['size'],
|
60 |
'maxlength' => $this->atts['maxlength'],
|
61 |
-
'value' => $
|
62 |
'placeholder' => $this->atts['placeholder'],
|
63 |
) );
|
64 |
if ( $this->atts['show_error'] !== 'false' ) {
|
@@ -73,7 +78,7 @@ class MW_WP_Form_Field_Password extends MW_WP_Form_Abstract_Form_Field {
|
|
73 |
* @return string HTML
|
74 |
*/
|
75 |
protected function confirm_page() {
|
76 |
-
$value = $this->
|
77 |
return '*****' . $this->Form->hidden( $this->atts['name'], $value );
|
78 |
}
|
79 |
|
2 |
/**
|
3 |
* Name : MW WP Form Password
|
4 |
* Description: パスワードフィールドを出力
|
5 |
+
* Version : 1.5.2
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
+
'id' => null,
|
43 |
'size' => 60,
|
44 |
'maxlength' => 255,
|
45 |
'value' => '',
|
46 |
+
'placeholder' => null,
|
47 |
'show_error' => 'true',
|
48 |
);
|
49 |
}
|
54 |
* @return string HTML
|
55 |
*/
|
56 |
protected function input_page() {
|
57 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
58 |
+
if ( is_null( $value ) ) {
|
59 |
+
$value = $this->atts['value'];
|
60 |
+
}
|
61 |
+
|
62 |
$_ret = $this->Form->password( $this->atts['name'], array(
|
63 |
'id' => $this->atts['id'],
|
64 |
'size' => $this->atts['size'],
|
65 |
'maxlength' => $this->atts['maxlength'],
|
66 |
+
'value' => $value,
|
67 |
'placeholder' => $this->atts['placeholder'],
|
68 |
) );
|
69 |
if ( $this->atts['show_error'] !== 'false' ) {
|
78 |
* @return string HTML
|
79 |
*/
|
80 |
protected function confirm_page() {
|
81 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
82 |
return '*****' . $this->Form->hidden( $this->atts['name'], $value );
|
83 |
}
|
84 |
|
classes/form-fields/class.radio.php
CHANGED
@@ -39,10 +39,10 @@ class MW_WP_Form_Field_Radio extends MW_WP_Form_Abstract_Form_Field {
|
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
-
'id' =>
|
43 |
'children' => '',
|
44 |
'value' => '',
|
45 |
-
'vertically' =>
|
46 |
'post_raw' => 'false',
|
47 |
'show_error' => 'true',
|
48 |
);
|
@@ -54,10 +54,15 @@ class MW_WP_Form_Field_Radio extends MW_WP_Form_Abstract_Form_Field {
|
|
54 |
* @return string html
|
55 |
*/
|
56 |
protected function input_page() {
|
|
|
|
|
|
|
|
|
57 |
$children = $this->get_children( $this->atts['children'] );
|
|
|
58 |
$_ret = $this->Form->radio( $this->atts['name'], $children, array(
|
59 |
'id' => $this->atts['id'],
|
60 |
-
'value' => $
|
61 |
'vertically' => $this->atts['vertically'],
|
62 |
) );
|
63 |
if ( $this->atts['post_raw'] === 'false' ) {
|
@@ -76,8 +81,8 @@ class MW_WP_Form_Field_Radio extends MW_WP_Form_Abstract_Form_Field {
|
|
76 |
*/
|
77 |
protected function confirm_page() {
|
78 |
$children = $this->get_children( $this->atts['children'] );
|
79 |
-
$value = $this->
|
80 |
-
$posted_value = $this->
|
81 |
$_ret = esc_html( $value );
|
82 |
$_ret .= $this->Form->hidden( $this->atts['name'], $posted_value );
|
83 |
if ( $this->atts['post_raw'] === 'false' ) {
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
+
'id' => null,
|
43 |
'children' => '',
|
44 |
'value' => '',
|
45 |
+
'vertically' => null,
|
46 |
'post_raw' => 'false',
|
47 |
'show_error' => 'true',
|
48 |
);
|
54 |
* @return string html
|
55 |
*/
|
56 |
protected function input_page() {
|
57 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
58 |
+
if ( is_null( $value ) ) {
|
59 |
+
$value = $this->atts['value'];
|
60 |
+
}
|
61 |
$children = $this->get_children( $this->atts['children'] );
|
62 |
+
|
63 |
$_ret = $this->Form->radio( $this->atts['name'], $children, array(
|
64 |
'id' => $this->atts['id'],
|
65 |
+
'value' => $value,
|
66 |
'vertically' => $this->atts['vertically'],
|
67 |
) );
|
68 |
if ( $this->atts['post_raw'] === 'false' ) {
|
81 |
*/
|
82 |
protected function confirm_page() {
|
83 |
$children = $this->get_children( $this->atts['children'] );
|
84 |
+
$value = $this->Data->get( $this->atts['name'], $children );
|
85 |
+
$posted_value = $this->Data->get_raw( $this->atts['name'] );
|
86 |
$_ret = esc_html( $value );
|
87 |
$_ret .= $this->Form->hidden( $this->atts['name'], $posted_value );
|
88 |
if ( $this->atts['post_raw'] === 'false' ) {
|
classes/form-fields/class.select.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Field Select
|
4 |
* Description: セレクトボックスを出力
|
5 |
-
* Version : 1.5.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -39,7 +39,7 @@ class MW_WP_Form_Field_Select extends MW_WP_Form_Abstract_Form_Field {
|
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
-
'id' =>
|
43 |
'children' => '',
|
44 |
'value' => '',
|
45 |
'post_raw' => 'false',
|
@@ -53,10 +53,15 @@ class MW_WP_Form_Field_Select extends MW_WP_Form_Abstract_Form_Field {
|
|
53 |
* @return string html
|
54 |
*/
|
55 |
protected function input_page() {
|
|
|
|
|
|
|
|
|
56 |
$children = $this->get_children( $this->atts['children'] );
|
|
|
57 |
$_ret = $this->Form->select( $this->atts['name'], $children, array(
|
58 |
'id' => $this->atts['id'],
|
59 |
-
'value' => $
|
60 |
) );
|
61 |
if ( $this->atts['post_raw'] === 'false' ) {
|
62 |
$_ret .= $this->Form->children( $this->atts['name'], $children );
|
@@ -74,8 +79,8 @@ class MW_WP_Form_Field_Select extends MW_WP_Form_Abstract_Form_Field {
|
|
74 |
*/
|
75 |
protected function confirm_page() {
|
76 |
$children = $this->get_children( $this->atts['children'] );
|
77 |
-
$value = $this->
|
78 |
-
$posted_value = $this->
|
79 |
$_ret = esc_html( $value );
|
80 |
$_ret .= $this->Form->hidden( $this->atts['name'], $posted_value );
|
81 |
if ( $this->atts['post_raw'] === 'false' ) {
|
2 |
/**
|
3 |
* Name : MW WP Form Field Select
|
4 |
* Description: セレクトボックスを出力
|
5 |
+
* Version : 1.5.7
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
+
'id' => null,
|
43 |
'children' => '',
|
44 |
'value' => '',
|
45 |
'post_raw' => 'false',
|
53 |
* @return string html
|
54 |
*/
|
55 |
protected function input_page() {
|
56 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
57 |
+
if ( is_null( $value ) ) {
|
58 |
+
$value = $this->atts['value'];
|
59 |
+
}
|
60 |
$children = $this->get_children( $this->atts['children'] );
|
61 |
+
|
62 |
$_ret = $this->Form->select( $this->atts['name'], $children, array(
|
63 |
'id' => $this->atts['id'],
|
64 |
+
'value' => $value,
|
65 |
) );
|
66 |
if ( $this->atts['post_raw'] === 'false' ) {
|
67 |
$_ret .= $this->Form->children( $this->atts['name'], $children );
|
79 |
*/
|
80 |
protected function confirm_page() {
|
81 |
$children = $this->get_children( $this->atts['children'] );
|
82 |
+
$value = $this->Data->get( $this->atts['name'], $children );
|
83 |
+
$posted_value = $this->Data->get_raw( $this->atts['name'] );
|
84 |
$_ret = esc_html( $value );
|
85 |
$_ret .= $this->Form->hidden( $this->atts['name'], $posted_value );
|
86 |
if ( $this->atts['post_raw'] === 'false' ) {
|
classes/form-fields/class.tel.php
CHANGED
@@ -39,6 +39,7 @@ class MW_WP_Form_Field_Tel extends MW_WP_Form_Abstract_Form_Field {
|
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
|
|
42 |
'show_error' => 'true',
|
43 |
'conv_half_alphanumeric' => 'true',
|
44 |
);
|
@@ -50,11 +51,22 @@ class MW_WP_Form_Field_Tel extends MW_WP_Form_Abstract_Form_Field {
|
|
50 |
* @return string HTML
|
51 |
*/
|
52 |
protected function input_page() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
$conv_half_alphanumeric = false;
|
54 |
if ( $this->atts['conv_half_alphanumeric'] === 'true' ) {
|
55 |
$conv_half_alphanumeric = true;
|
56 |
}
|
57 |
-
|
|
|
|
|
|
|
|
|
58 |
if ( $this->atts['show_error'] !== 'false' ) {
|
59 |
$_ret .= $this->get_error( $this->atts['name'] );
|
60 |
}
|
@@ -67,10 +79,11 @@ class MW_WP_Form_Field_Tel extends MW_WP_Form_Abstract_Form_Field {
|
|
67 |
* @return string HTML
|
68 |
*/
|
69 |
protected function confirm_page() {
|
70 |
-
$value
|
|
|
71 |
$_ret = esc_html( $value );
|
72 |
-
$_ret .= $this->Form->hidden( $this->atts['name'].'[data]', $value );
|
73 |
-
$_ret .= $this->Form->separator( $this->atts['name'] );
|
74 |
return $_ret;
|
75 |
}
|
76 |
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
+
'value' => '',
|
43 |
'show_error' => 'true',
|
44 |
'conv_half_alphanumeric' => 'true',
|
45 |
);
|
51 |
* @return string HTML
|
52 |
*/
|
53 |
protected function input_page() {
|
54 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
55 |
+
if ( is_array( $value ) && isset( $value['data'] ) ) {
|
56 |
+
$value = $value['data'];
|
57 |
+
}
|
58 |
+
if ( is_null( $value ) ) {
|
59 |
+
$value = $this->atts['value'];
|
60 |
+
}
|
61 |
$conv_half_alphanumeric = false;
|
62 |
if ( $this->atts['conv_half_alphanumeric'] === 'true' ) {
|
63 |
$conv_half_alphanumeric = true;
|
64 |
}
|
65 |
+
|
66 |
+
$_ret = $this->Form->tel( $this->atts['name'], array(
|
67 |
+
'conv-half-alphanumeric' => $conv_half_alphanumeric,
|
68 |
+
'value' => $value,
|
69 |
+
) );
|
70 |
if ( $this->atts['show_error'] !== 'false' ) {
|
71 |
$_ret .= $this->get_error( $this->atts['name'] );
|
72 |
}
|
79 |
* @return string HTML
|
80 |
*/
|
81 |
protected function confirm_page() {
|
82 |
+
$value = $this->Data->get( $this->atts['name'] );
|
83 |
+
$separator = $this->Data->get_separator_value( $this->atts['name'] );
|
84 |
$_ret = esc_html( $value );
|
85 |
+
$_ret .= $this->Form->hidden( $this->atts['name'] . '[data]', $value );
|
86 |
+
$_ret .= $this->Form->separator( $this->atts['name'], $separator );
|
87 |
return $_ret;
|
88 |
}
|
89 |
|
classes/form-fields/class.text.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Field Text
|
4 |
* Description: テキストフィールドを出力
|
5 |
-
* Version : 1.5.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -39,13 +39,13 @@ class MW_WP_Form_Field_Text extends MW_WP_Form_Abstract_Form_Field {
|
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
-
'id' =>
|
43 |
'size' => 60,
|
44 |
'maxlength' => 255,
|
45 |
'value' => '',
|
46 |
-
'placeholder' =>
|
47 |
'show_error' => 'true',
|
48 |
-
'conv_half_alphanumeric' =>
|
49 |
);
|
50 |
}
|
51 |
|
@@ -55,15 +55,19 @@ class MW_WP_Form_Field_Text extends MW_WP_Form_Abstract_Form_Field {
|
|
55 |
* @return string html
|
56 |
*/
|
57 |
protected function input_page() {
|
58 |
-
$conv_half_alphanumeric
|
59 |
-
|
60 |
-
$conv_half_alphanumeric = true;
|
61 |
}
|
|
|
|
|
|
|
|
|
|
|
62 |
$_ret = $this->Form->text( $this->atts['name'], array(
|
63 |
'id' => $this->atts['id'],
|
64 |
'size' => $this->atts['size'],
|
65 |
'maxlength' => $this->atts['maxlength'],
|
66 |
-
'value' => $
|
67 |
'placeholder' => $this->atts['placeholder'],
|
68 |
'conv-half-alphanumeric' => $conv_half_alphanumeric,
|
69 |
) );
|
@@ -79,7 +83,7 @@ class MW_WP_Form_Field_Text extends MW_WP_Form_Abstract_Form_Field {
|
|
79 |
* @return string HTML
|
80 |
*/
|
81 |
protected function confirm_page() {
|
82 |
-
$value = $this->
|
83 |
$_ret = esc_html( $value );
|
84 |
$_ret .= $this->Form->hidden( $this->atts['name'], $value );
|
85 |
return $_ret;
|
2 |
/**
|
3 |
* Name : MW WP Form Field Text
|
4 |
* Description: テキストフィールドを出力
|
5 |
+
* Version : 1.5.2
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
+
'id' => null,
|
43 |
'size' => 60,
|
44 |
'maxlength' => 255,
|
45 |
'value' => '',
|
46 |
+
'placeholder' => null,
|
47 |
'show_error' => 'true',
|
48 |
+
'conv_half_alphanumeric' => null,
|
49 |
);
|
50 |
}
|
51 |
|
55 |
* @return string html
|
56 |
*/
|
57 |
protected function input_page() {
|
58 |
+
if ( $this->atts['conv_half_alphanumeric'] !== 'true' ) {
|
59 |
+
$conv_half_alphanumeric = null;
|
|
|
60 |
}
|
61 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
62 |
+
if ( is_null( $value ) ) {
|
63 |
+
$value = $this->atts['value'];
|
64 |
+
}
|
65 |
+
|
66 |
$_ret = $this->Form->text( $this->atts['name'], array(
|
67 |
'id' => $this->atts['id'],
|
68 |
'size' => $this->atts['size'],
|
69 |
'maxlength' => $this->atts['maxlength'],
|
70 |
+
'value' => $value,
|
71 |
'placeholder' => $this->atts['placeholder'],
|
72 |
'conv-half-alphanumeric' => $conv_half_alphanumeric,
|
73 |
) );
|
83 |
* @return string HTML
|
84 |
*/
|
85 |
protected function confirm_page() {
|
86 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
87 |
$_ret = esc_html( $value );
|
88 |
$_ret .= $this->Form->hidden( $this->atts['name'], $value );
|
89 |
return $_ret;
|
classes/form-fields/class.textarea.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Field TextArea
|
4 |
* Description: テキストエリアを出力
|
5 |
-
* Version : 1.5.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -39,11 +39,11 @@ class MW_WP_Form_Field_Textarea extends MW_WP_Form_Abstract_Form_Field {
|
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
-
'id' =>
|
43 |
'cols' => 50,
|
44 |
'rows' => 5,
|
45 |
'value' => '',
|
46 |
-
'placeholder' =>
|
47 |
'show_error' => 'true',
|
48 |
);
|
49 |
}
|
@@ -54,11 +54,16 @@ class MW_WP_Form_Field_Textarea extends MW_WP_Form_Abstract_Form_Field {
|
|
54 |
* @return string html
|
55 |
*/
|
56 |
protected function input_page() {
|
|
|
|
|
|
|
|
|
|
|
57 |
$_ret = $this->Form->textarea( $this->atts['name'], array(
|
58 |
-
'id'
|
59 |
-
'cols'
|
60 |
-
'rows'
|
61 |
-
'value'
|
62 |
'placeholder' => $this->atts['placeholder'],
|
63 |
) );
|
64 |
if ( $this->atts['show_error'] !== 'false' ) {
|
@@ -73,7 +78,7 @@ class MW_WP_Form_Field_Textarea extends MW_WP_Form_Abstract_Form_Field {
|
|
73 |
* @return string HTML
|
74 |
*/
|
75 |
protected function confirm_page() {
|
76 |
-
$value = $this->
|
77 |
$_ret = nl2br( esc_html( $value ) );
|
78 |
$_ret .= $this->Form->hidden( $this->atts['name'], $value );
|
79 |
return $_ret;
|
2 |
/**
|
3 |
* Name : MW WP Form Field TextArea
|
4 |
* Description: テキストエリアを出力
|
5 |
+
* Version : 1.5.2
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
+
'id' => null,
|
43 |
'cols' => 50,
|
44 |
'rows' => 5,
|
45 |
'value' => '',
|
46 |
+
'placeholder' => null,
|
47 |
'show_error' => 'true',
|
48 |
);
|
49 |
}
|
54 |
* @return string html
|
55 |
*/
|
56 |
protected function input_page() {
|
57 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
58 |
+
if ( is_null( $value ) ) {
|
59 |
+
$value = $this->atts['value'];
|
60 |
+
}
|
61 |
+
|
62 |
$_ret = $this->Form->textarea( $this->atts['name'], array(
|
63 |
+
'id' => $this->atts['id'],
|
64 |
+
'cols' => $this->atts['cols'],
|
65 |
+
'rows' => $this->atts['rows'],
|
66 |
+
'value' => $value,
|
67 |
'placeholder' => $this->atts['placeholder'],
|
68 |
) );
|
69 |
if ( $this->atts['show_error'] !== 'false' ) {
|
78 |
* @return string HTML
|
79 |
*/
|
80 |
protected function confirm_page() {
|
81 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
82 |
$_ret = nl2br( esc_html( $value ) );
|
83 |
$_ret .= $this->Form->hidden( $this->atts['name'], $value );
|
84 |
return $_ret;
|
classes/form-fields/class.zip.php
CHANGED
@@ -39,6 +39,7 @@ class MW_WP_Form_Field_Zip extends MW_WP_Form_Abstract_Form_Field {
|
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
|
|
42 |
'show_error' => 'true',
|
43 |
'conv_half_alphanumeric' => 'true',
|
44 |
);
|
@@ -50,11 +51,21 @@ class MW_WP_Form_Field_Zip extends MW_WP_Form_Abstract_Form_Field {
|
|
50 |
* @return string HTML
|
51 |
*/
|
52 |
protected function input_page() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
$conv_half_alphanumeric = false;
|
54 |
if ( $this->atts['conv_half_alphanumeric'] === 'true' ) {
|
55 |
$conv_half_alphanumeric = true;
|
56 |
}
|
57 |
-
$_ret = $this->Form->zip( $this->atts['name'], array(
|
|
|
|
|
|
|
58 |
if ( $this->atts['show_error'] !== 'false' ) {
|
59 |
$_ret .= $this->get_error( $this->atts['name'] );
|
60 |
}
|
@@ -67,10 +78,11 @@ class MW_WP_Form_Field_Zip extends MW_WP_Form_Abstract_Form_Field {
|
|
67 |
* @return string HTML
|
68 |
*/
|
69 |
protected function confirm_page() {
|
70 |
-
$value
|
|
|
71 |
$_ret = esc_html( $value );
|
72 |
-
$_ret .= $this->Form->hidden( $this->atts['name'].'[data]', $value );
|
73 |
-
$_ret .= $this->Form->separator( $this->atts['name'] );
|
74 |
return $_ret;
|
75 |
}
|
76 |
|
39 |
protected function set_defaults() {
|
40 |
return array(
|
41 |
'name' => '',
|
42 |
+
'value' => '',
|
43 |
'show_error' => 'true',
|
44 |
'conv_half_alphanumeric' => 'true',
|
45 |
);
|
51 |
* @return string HTML
|
52 |
*/
|
53 |
protected function input_page() {
|
54 |
+
$value = $this->Data->get_raw( $this->atts['name'] );
|
55 |
+
if ( is_array( $value ) && isset( $value['data'] ) ) {
|
56 |
+
$value = $value['data'];
|
57 |
+
}
|
58 |
+
if ( is_null( $value ) ) {
|
59 |
+
$value = $this->atts['value'];
|
60 |
+
}
|
61 |
$conv_half_alphanumeric = false;
|
62 |
if ( $this->atts['conv_half_alphanumeric'] === 'true' ) {
|
63 |
$conv_half_alphanumeric = true;
|
64 |
}
|
65 |
+
$_ret = $this->Form->zip( $this->atts['name'], array(
|
66 |
+
'conv-half-alphanumeric' => $conv_half_alphanumeric,
|
67 |
+
'value' => $value,
|
68 |
+
) );
|
69 |
if ( $this->atts['show_error'] !== 'false' ) {
|
70 |
$_ret .= $this->get_error( $this->atts['name'] );
|
71 |
}
|
78 |
* @return string HTML
|
79 |
*/
|
80 |
protected function confirm_page() {
|
81 |
+
$value = $this->Data->get( $this->atts['name'] );
|
82 |
+
$separator = $this->Data->get_separator_value( $this->atts['name'] );
|
83 |
$_ret = esc_html( $value );
|
84 |
+
$_ret .= $this->Form->hidden( $this->atts['name'] . '[data]', $value );
|
85 |
+
$_ret .= $this->Form->separator( $this->atts['name'], $separator );
|
86 |
return $_ret;
|
87 |
}
|
88 |
|
classes/functions.php
CHANGED
@@ -2,19 +2,19 @@
|
|
2 |
/**
|
3 |
* Name : MWF Functions
|
4 |
* Description: 関数
|
5 |
-
* Version : 1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : May 29, 2013
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MWF_Functions {
|
14 |
|
15 |
/**
|
16 |
-
* is_numeric
|
17 |
* 引数で渡された変数が存在し、かつ数値であるなら true
|
|
|
18 |
* @param string $value 参照渡し
|
19 |
* @return bool
|
20 |
*/
|
@@ -26,8 +26,8 @@ class MWF_Functions {
|
|
26 |
}
|
27 |
|
28 |
/**
|
29 |
-
* array_clean
|
30 |
* 配列の空要素を削除
|
|
|
31 |
* @param array $array
|
32 |
* @return array
|
33 |
*/
|
@@ -36,13 +36,13 @@ class MWF_Functions {
|
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
-
* is_empty
|
40 |
* 値が空(0は許可)
|
|
|
41 |
* @param mixed
|
42 |
* @return bool
|
43 |
*/
|
44 |
public static function is_empty( $value ) {
|
45 |
-
if ( $value === array() || $value === '' || $value === null ) {
|
46 |
return true;
|
47 |
} else {
|
48 |
return false;
|
@@ -50,8 +50,8 @@ class MWF_Functions {
|
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
-
* fileurl_to_path
|
54 |
* ファイルURLをファイルパスに変換
|
|
|
55 |
* @param string $fileurl
|
56 |
* @return string
|
57 |
*/
|
@@ -70,8 +70,8 @@ class MWF_Functions {
|
|
70 |
}
|
71 |
|
72 |
/**
|
73 |
-
* filepath_to_url
|
74 |
* ファイルパスをURLに変換
|
|
|
75 |
* @param string $filepath
|
76 |
* @return string
|
77 |
*/
|
@@ -89,8 +89,8 @@ class MWF_Functions {
|
|
89 |
}
|
90 |
|
91 |
/**
|
92 |
-
* convert_eol
|
93 |
* 改行コードを \n に統一
|
|
|
94 |
* @param sring $string
|
95 |
* @return string $string
|
96 |
*/
|
@@ -99,8 +99,8 @@ class MWF_Functions {
|
|
99 |
}
|
100 |
|
101 |
/**
|
102 |
-
* deprecated_message
|
103 |
* 古いメソッドを使った場合にエラーを出力
|
|
|
104 |
* @param string $function_name メソッド名
|
105 |
* @param string $new_function 代替のメソッド名
|
106 |
*/
|
@@ -151,8 +151,8 @@ class MWF_Functions {
|
|
151 |
}
|
152 |
|
153 |
/**
|
154 |
-
*
|
155 |
-
*
|
156 |
* @param string ファイルパス
|
157 |
* @return bool
|
158 |
*/
|
@@ -173,9 +173,9 @@ class MWF_Functions {
|
|
173 |
}
|
174 |
|
175 |
/**
|
176 |
-
* save_attachments_in_media
|
177 |
* 添付ファイルをメディアに保存、投稿データに添付ファイルのキー(配列)を保存
|
178 |
* $this->settings が確定した後でのみ利用可能
|
|
|
179 |
* @param int post_id
|
180 |
* @param array ( ファイルのname属性値 => ファイルパス, … )
|
181 |
* @param int 生成フォーム(usedb)の post_id
|
@@ -213,7 +213,8 @@ class MWF_Functions {
|
|
213 |
}
|
214 |
|
215 |
/**
|
216 |
-
*
|
|
|
217 |
* @param string $filepath アップロードされたファイルのパス
|
218 |
* @param string $filename ファイル名(未アップロード時の$_FILEの検査の場合、temp_nameは乱数になっているため)
|
219 |
* @return bool
|
@@ -281,7 +282,8 @@ class MWF_Functions {
|
|
281 |
}
|
282 |
|
283 |
/**
|
284 |
-
*
|
|
|
285 |
* @param string $post_type 問い合わせデータの投稿タイプ名
|
286 |
* @return string
|
287 |
*/
|
@@ -298,7 +300,8 @@ class MWF_Functions {
|
|
298 |
}
|
299 |
|
300 |
/**
|
301 |
-
*
|
|
|
302 |
* @param string $post_type 問い合わせデータの投稿タイプ名
|
303 |
* @return string|null フォーム識別子
|
304 |
*/
|
@@ -308,4 +311,37 @@ class MWF_Functions {
|
|
308 |
return $form_key;
|
309 |
}
|
310 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
}
|
2 |
/**
|
3 |
* Name : MWF Functions
|
4 |
* Description: 関数
|
5 |
+
* Version : 1.4.0
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : May 29, 2013
|
9 |
+
* Modified : March 30, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MWF_Functions {
|
14 |
|
15 |
/**
|
|
|
16 |
* 引数で渡された変数が存在し、かつ数値であるなら true
|
17 |
+
*
|
18 |
* @param string $value 参照渡し
|
19 |
* @return bool
|
20 |
*/
|
26 |
}
|
27 |
|
28 |
/**
|
|
|
29 |
* 配列の空要素を削除
|
30 |
+
*
|
31 |
* @param array $array
|
32 |
* @return array
|
33 |
*/
|
36 |
}
|
37 |
|
38 |
/**
|
|
|
39 |
* 値が空(0は許可)
|
40 |
+
*
|
41 |
* @param mixed
|
42 |
* @return bool
|
43 |
*/
|
44 |
public static function is_empty( $value ) {
|
45 |
+
if ( $value === array() || $value === '' || $value === null || $value === false ) {
|
46 |
return true;
|
47 |
} else {
|
48 |
return false;
|
50 |
}
|
51 |
|
52 |
/**
|
|
|
53 |
* ファイルURLをファイルパスに変換
|
54 |
+
*
|
55 |
* @param string $fileurl
|
56 |
* @return string
|
57 |
*/
|
70 |
}
|
71 |
|
72 |
/**
|
|
|
73 |
* ファイルパスをURLに変換
|
74 |
+
*
|
75 |
* @param string $filepath
|
76 |
* @return string
|
77 |
*/
|
89 |
}
|
90 |
|
91 |
/**
|
|
|
92 |
* 改行コードを \n に統一
|
93 |
+
*
|
94 |
* @param sring $string
|
95 |
* @return string $string
|
96 |
*/
|
99 |
}
|
100 |
|
101 |
/**
|
|
|
102 |
* 古いメソッドを使った場合にエラーを出力
|
103 |
+
*
|
104 |
* @param string $function_name メソッド名
|
105 |
* @param string $new_function 代替のメソッド名
|
106 |
*/
|
151 |
}
|
152 |
|
153 |
/**
|
154 |
+
* Tempディレクトリからuploadディレクトリにファイルを移動
|
155 |
+
*
|
156 |
* @param string ファイルパス
|
157 |
* @return bool
|
158 |
*/
|
173 |
}
|
174 |
|
175 |
/**
|
|
|
176 |
* 添付ファイルをメディアに保存、投稿データに添付ファイルのキー(配列)を保存
|
177 |
* $this->settings が確定した後でのみ利用可能
|
178 |
+
*
|
179 |
* @param int post_id
|
180 |
* @param array ( ファイルのname属性値 => ファイルパス, … )
|
181 |
* @param int 生成フォーム(usedb)の post_id
|
213 |
}
|
214 |
|
215 |
/**
|
216 |
+
* ファイルタイプのチェック
|
217 |
+
*
|
218 |
* @param string $filepath アップロードされたファイルのパス
|
219 |
* @param string $filename ファイル名(未アップロード時の$_FILEの検査の場合、temp_nameは乱数になっているため)
|
220 |
* @return bool
|
282 |
}
|
283 |
|
284 |
/**
|
285 |
+
* 問い合わせ番号の表示名を取得
|
286 |
+
*
|
287 |
* @param string $post_type 問い合わせデータの投稿タイプ名
|
288 |
* @return string
|
289 |
*/
|
300 |
}
|
301 |
|
302 |
/**
|
303 |
+
* 問い合わせデータの投稿タイプ名をフォーム識別子に変換
|
304 |
+
*
|
305 |
* @param string $post_type 問い合わせデータの投稿タイプ名
|
306 |
* @return string|null フォーム識別子
|
307 |
*/
|
311 |
return $form_key;
|
312 |
}
|
313 |
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* 添付データを適切なHTMLに変換して返す
|
317 |
+
*
|
318 |
+
* @param string $value
|
319 |
+
* @return string
|
320 |
+
*/
|
321 |
+
public static function get_multimedia_data( $value ) {
|
322 |
+
$mimetype = get_post_mime_type( $value );
|
323 |
+
if ( $mimetype ) {
|
324 |
+
// 画像だったら
|
325 |
+
if ( preg_match( '/^image\/.+?$/', $mimetype ) ) {
|
326 |
+
$src = wp_get_attachment_image_src( $value, 'thumbnail' );
|
327 |
+
return sprintf(
|
328 |
+
'<img src="%s" alt="" style="width:50px;height:50px" />',
|
329 |
+
esc_url( $src[0] )
|
330 |
+
);
|
331 |
+
}
|
332 |
+
// 画像以外
|
333 |
+
else {
|
334 |
+
$src = wp_get_attachment_image_src( $value, 'none', true );
|
335 |
+
return sprintf(
|
336 |
+
'<a href="%s" target="_blank"><img src="%s" alt="" style="height:50px" /></a>',
|
337 |
+
esc_url( wp_get_attachment_url( $value ) ),
|
338 |
+
esc_url( $src[0] )
|
339 |
+
);
|
340 |
+
}
|
341 |
+
}
|
342 |
+
// 添付されているけど、フック等でメタ情報が書き換えられて添付ファイルID以外になってしまった場合
|
343 |
+
else {
|
344 |
+
return esc_html( $value );
|
345 |
+
}
|
346 |
+
}
|
347 |
}
|
classes/models/class.abstract-form-field.php
CHANGED
@@ -2,17 +2,15 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Abstract Form Field
|
4 |
* Description: フォームフィールドの抽象クラス
|
5 |
-
* Version : 1.7.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
-
abstract class MW_WP_Form_Abstract_Form_Field
|
14 |
-
}
|
15 |
-
abstract class MW_Form_Field {
|
16 |
|
17 |
/**
|
18 |
* $shortcode_name
|
@@ -32,6 +30,11 @@ abstract class MW_Form_Field {
|
|
32 |
*/
|
33 |
protected $Form;
|
34 |
|
|
|
|
|
|
|
|
|
|
|
35 |
/**
|
36 |
* $defaults
|
37 |
* 属性値等初期値
|
@@ -83,27 +86,10 @@ abstract class MW_Form_Field {
|
|
83 |
* __construct
|
84 |
*/
|
85 |
public function __construct() {
|
86 |
-
$parent_class = get_parent_class( $this );
|
87 |
-
$class = get_class( $this );
|
88 |
-
if ( is_admin() && in_array( 'MW_Form_Field', array( $parent_class, $class ) ) ) {
|
89 |
-
MWF_Functions::deprecated_message(
|
90 |
-
'MW_Form_Field',
|
91 |
-
'MW_WP_Form_Abstract_Form_Field'
|
92 |
-
);
|
93 |
-
}
|
94 |
$this->_set_names();
|
95 |
-
|
96 |
-
if ( method_exists( $this, 'setDefaults' ) ) {
|
97 |
-
MWF_Functions::deprecated_message(
|
98 |
-
'MW_Form_Field::setDefaults()',
|
99 |
-
'MW_WP_Form_Abstract_Form_Field::set_defaults()'
|
100 |
-
);
|
101 |
-
$this->defaults = $this->setDefaults();
|
102 |
-
} else {
|
103 |
-
$this->defaults = $this->set_defaults();
|
104 |
-
}
|
105 |
$this->_add_mwform_tag_generator();
|
106 |
-
add_action( 'mwform_add_shortcode', array( $this, 'add_shortcode' ), 10,
|
107 |
add_filter( 'mwform_form_fields' , array( $this, 'mwform_form_fields' ) );
|
108 |
}
|
109 |
|
@@ -124,26 +110,6 @@ abstract class MW_Form_Field {
|
|
124 |
$this->display_name = $args['display_name'];
|
125 |
}
|
126 |
|
127 |
-
/**
|
128 |
-
* set_qtags
|
129 |
-
* @param string $id
|
130 |
-
* @param string $display
|
131 |
-
* @param string $arg1 開始タグ(ショートコード)
|
132 |
-
* @param string $arg2 終了タグ(ショートコード)
|
133 |
-
*/
|
134 |
-
protected function set_qtags( $id, $display, $arg1, $arg2 = '' ) {
|
135 |
-
MWF_Functions::deprecated_message(
|
136 |
-
'MW_Form_Field::set_qtags()',
|
137 |
-
'MW_WP_Form_Abstract_Form_Field::set_names()'
|
138 |
-
);
|
139 |
-
$this->qtags = array(
|
140 |
-
'id' => $id,
|
141 |
-
'display' => $display,
|
142 |
-
'arg1' => $arg1,
|
143 |
-
'arg2' => $arg2,
|
144 |
-
);
|
145 |
-
}
|
146 |
-
|
147 |
/**
|
148 |
* get_error
|
149 |
* @param string $key name属性
|
@@ -178,22 +144,13 @@ abstract class MW_Form_Field {
|
|
178 |
return apply_filters( 'mwform_error_message_wrapper', $_ret, $this->form_key );
|
179 |
}
|
180 |
}
|
181 |
-
protected function getError( $key ) {
|
182 |
-
MWF_Functions::deprecated_message(
|
183 |
-
'MW_Form_Field::getError()',
|
184 |
-
'MW_WP_Form_Abstract_Form_Field::get_error()'
|
185 |
-
);
|
186 |
-
return $this->get_error( $key );
|
187 |
-
}
|
188 |
|
189 |
/**
|
190 |
* set_defaults
|
191 |
* $this->defaultsを設定し返す
|
192 |
* @return array defaults
|
193 |
*/
|
194 |
-
protected function set_defaults()
|
195 |
-
// 本当は abstract。後方互換のためしてない。
|
196 |
-
}
|
197 |
|
198 |
/**
|
199 |
* input_page
|
@@ -201,9 +158,7 @@ abstract class MW_Form_Field {
|
|
201 |
* @param array $atts
|
202 |
* @return string HTML
|
203 |
*/
|
204 |
-
protected function input_page()
|
205 |
-
// 本当は abstract。後方互換のためしてない。
|
206 |
-
}
|
207 |
public function _input_page( $atts ) {
|
208 |
if ( isset( $this->defaults['value'], $atts['name'] ) && !isset( $atts['value'] ) ) {
|
209 |
$atts['value'] = apply_filters(
|
@@ -213,14 +168,6 @@ abstract class MW_Form_Field {
|
|
213 |
);
|
214 |
}
|
215 |
$this->atts = shortcode_atts( $this->defaults, $atts );
|
216 |
-
// 後方互換
|
217 |
-
if ( method_exists( $this, 'inputPage' ) ) {
|
218 |
-
MWF_Functions::deprecated_message(
|
219 |
-
'MW_Form_Field::inputPage()',
|
220 |
-
'MW_WP_Form_Abstract_Form_Field::input_page()'
|
221 |
-
);
|
222 |
-
return $this->inputPage();
|
223 |
-
}
|
224 |
return $this->input_page();
|
225 |
}
|
226 |
|
@@ -230,19 +177,9 @@ abstract class MW_Form_Field {
|
|
230 |
* @param array $atts
|
231 |
* @return string HTML
|
232 |
*/
|
233 |
-
protected function confirm_page()
|
234 |
-
// 本当は abstract。後方互換のためしてない。
|
235 |
-
}
|
236 |
public function _confirm_page( $atts ) {
|
237 |
$this->atts = shortcode_atts( $this->defaults, $atts );
|
238 |
-
// 後方互換
|
239 |
-
if ( method_exists( $this, 'confirmPage' ) ) {
|
240 |
-
MWF_Functions::deprecated_message(
|
241 |
-
'MW_Form_Field::confirmPage()',
|
242 |
-
'MW_WP_Form_Abstract_Form_Field::confirm_page()'
|
243 |
-
);
|
244 |
-
return $this->confirmPage();
|
245 |
-
}
|
246 |
return $this->confirm_page();
|
247 |
}
|
248 |
|
@@ -253,12 +190,14 @@ abstract class MW_Form_Field {
|
|
253 |
* @param string $view_flg
|
254 |
* @param MW_WP_Form_Error $Error
|
255 |
* @param string $form_key
|
|
|
256 |
*/
|
257 |
-
public function add_shortcode( MW_WP_Form_Form $Form, $view_flg, MW_WP_Form_Error $Error, $form_key ) {
|
258 |
if ( !empty( $this->shortcode_name ) ) {
|
259 |
$this->Form = $Form;
|
260 |
$this->Error = $Error;
|
261 |
$this->form_key = $form_key;
|
|
|
262 |
switch( $view_flg ) {
|
263 |
case 'input' :
|
264 |
add_shortcode( $this->shortcode_name, array( $this, '_input_page' ) );
|
@@ -310,13 +249,6 @@ abstract class MW_Form_Field {
|
|
310 |
}
|
311 |
return $children;
|
312 |
}
|
313 |
-
public function getChildren( $_children ) {
|
314 |
-
MWF_Functions::deprecated_message(
|
315 |
-
'MW_Form_Field::getChildren()',
|
316 |
-
'MW_WP_Form_Abstract_Form_Field::get_children()'
|
317 |
-
);
|
318 |
-
return $this->get_children( $_children );
|
319 |
-
}
|
320 |
|
321 |
/**
|
322 |
* _add_mwform_tag_generator
|
2 |
/**
|
3 |
* Name : MW WP Form Abstract Form Field
|
4 |
* Description: フォームフィールドの抽象クラス
|
5 |
+
* Version : 1.7.2
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
+
* Modified : March 26, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
+
abstract class MW_WP_Form_Abstract_Form_Field {
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* $shortcode_name
|
30 |
*/
|
31 |
protected $Form;
|
32 |
|
33 |
+
/**
|
34 |
+
* @var MW_WP_Form_Data
|
35 |
+
*/
|
36 |
+
protected $Data;
|
37 |
+
|
38 |
/**
|
39 |
* $defaults
|
40 |
* 属性値等初期値
|
86 |
* __construct
|
87 |
*/
|
88 |
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
$this->_set_names();
|
90 |
+
$this->defaults = $this->set_defaults();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
$this->_add_mwform_tag_generator();
|
92 |
+
add_action( 'mwform_add_shortcode', array( $this, 'add_shortcode' ), 10, 5 );
|
93 |
add_filter( 'mwform_form_fields' , array( $this, 'mwform_form_fields' ) );
|
94 |
}
|
95 |
|
110 |
$this->display_name = $args['display_name'];
|
111 |
}
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
/**
|
114 |
* get_error
|
115 |
* @param string $key name属性
|
144 |
return apply_filters( 'mwform_error_message_wrapper', $_ret, $this->form_key );
|
145 |
}
|
146 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
/**
|
149 |
* set_defaults
|
150 |
* $this->defaultsを設定し返す
|
151 |
* @return array defaults
|
152 |
*/
|
153 |
+
abstract protected function set_defaults();
|
|
|
|
|
154 |
|
155 |
/**
|
156 |
* input_page
|
158 |
* @param array $atts
|
159 |
* @return string HTML
|
160 |
*/
|
161 |
+
abstract protected function input_page();
|
|
|
|
|
162 |
public function _input_page( $atts ) {
|
163 |
if ( isset( $this->defaults['value'], $atts['name'] ) && !isset( $atts['value'] ) ) {
|
164 |
$atts['value'] = apply_filters(
|
168 |
);
|
169 |
}
|
170 |
$this->atts = shortcode_atts( $this->defaults, $atts );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
return $this->input_page();
|
172 |
}
|
173 |
|
177 |
* @param array $atts
|
178 |
* @return string HTML
|
179 |
*/
|
180 |
+
abstract protected function confirm_page();
|
|
|
|
|
181 |
public function _confirm_page( $atts ) {
|
182 |
$this->atts = shortcode_atts( $this->defaults, $atts );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
return $this->confirm_page();
|
184 |
}
|
185 |
|
190 |
* @param string $view_flg
|
191 |
* @param MW_WP_Form_Error $Error
|
192 |
* @param string $form_key
|
193 |
+
* @param MW_WP_Form_Data $Data
|
194 |
*/
|
195 |
+
public function add_shortcode( MW_WP_Form_Form $Form, $view_flg, MW_WP_Form_Error $Error, $form_key, MW_WP_Form_Data $Data ) {
|
196 |
if ( !empty( $this->shortcode_name ) ) {
|
197 |
$this->Form = $Form;
|
198 |
$this->Error = $Error;
|
199 |
$this->form_key = $form_key;
|
200 |
+
$this->Data = $Data;
|
201 |
switch( $view_flg ) {
|
202 |
case 'input' :
|
203 |
add_shortcode( $this->shortcode_name, array( $this, '_input_page' ) );
|
249 |
}
|
250 |
return $children;
|
251 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
|
253 |
/**
|
254 |
* _add_mwform_tag_generator
|
classes/models/class.abstract-validation-rule.php
CHANGED
@@ -2,27 +2,23 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Abstract Validation Rule
|
4 |
* Description: バリデーションルールの抽象クラス
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 19, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
-
abstract class MW_WP_Form_Abstract_Validation_Rule
|
14 |
-
}
|
15 |
-
abstract class MW_Validation_Rule {
|
16 |
|
17 |
/**
|
18 |
-
* $name
|
19 |
* バリデーションルール名を指定
|
20 |
* @var string
|
21 |
*/
|
22 |
protected $name;
|
23 |
|
24 |
/**
|
25 |
-
* $Data
|
26 |
* @var MW_WP_Form_Data
|
27 |
*/
|
28 |
protected $Data;
|
@@ -31,21 +27,14 @@ abstract class MW_Validation_Rule {
|
|
31 |
* __construct
|
32 |
*/
|
33 |
public function __construct() {
|
34 |
-
$parent_class = get_parent_class( $this );
|
35 |
-
$class = get_class( $this );
|
36 |
-
if ( is_admin() && in_array( 'MW_Validation_Rule', array( $parent_class, $class ) ) ) {
|
37 |
-
MWF_Functions::deprecated_message(
|
38 |
-
'MW_Validation_Rule',
|
39 |
-
'MW_WP_Form_Abstract_Validation_Rule'
|
40 |
-
);
|
41 |
-
}
|
42 |
if ( !$this->getName() ) {
|
43 |
exit( 'MW_WP_Form_Abstract_Validation_Rule::$name must override.' );
|
44 |
}
|
45 |
}
|
46 |
|
47 |
/**
|
48 |
-
*
|
|
|
49 |
* @param MW_WP_Form_Data $Data
|
50 |
*/
|
51 |
public function set_Data( MW_WP_Form_Data $Data ) {
|
@@ -53,8 +42,8 @@ abstract class MW_Validation_Rule {
|
|
53 |
}
|
54 |
|
55 |
/**
|
56 |
-
* getName
|
57 |
* バリデーションルール名を返す
|
|
|
58 |
* @return string $this->name バリデーションルール名
|
59 |
*/
|
60 |
public function getName() {
|
@@ -62,7 +51,8 @@ abstract class MW_Validation_Rule {
|
|
62 |
}
|
63 |
|
64 |
/**
|
65 |
-
*
|
|
|
66 |
* @param string $key name属性
|
67 |
* @param array $option
|
68 |
* @return string エラーメッセージ
|
@@ -70,7 +60,8 @@ abstract class MW_Validation_Rule {
|
|
70 |
abstract public function rule( $key, array $options = array() );
|
71 |
|
72 |
/**
|
73 |
-
*
|
|
|
74 |
* @param numeric $key バリデーションルールセットの識別番号
|
75 |
* @param array $value バリデーションルールセットの内容
|
76 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Abstract Validation Rule
|
4 |
* Description: バリデーションルールの抽象クラス
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 19, 2014
|
9 |
+
* Modified : March 26, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
+
abstract class MW_WP_Form_Abstract_Validation_Rule {
|
|
|
|
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name;
|
20 |
|
21 |
/**
|
|
|
22 |
* @var MW_WP_Form_Data
|
23 |
*/
|
24 |
protected $Data;
|
27 |
* __construct
|
28 |
*/
|
29 |
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
if ( !$this->getName() ) {
|
31 |
exit( 'MW_WP_Form_Abstract_Validation_Rule::$name must override.' );
|
32 |
}
|
33 |
}
|
34 |
|
35 |
/**
|
36 |
+
* MW_WP_Form_Data を注入
|
37 |
+
*
|
38 |
* @param MW_WP_Form_Data $Data
|
39 |
*/
|
40 |
public function set_Data( MW_WP_Form_Data $Data ) {
|
42 |
}
|
43 |
|
44 |
/**
|
|
|
45 |
* バリデーションルール名を返す
|
46 |
+
*
|
47 |
* @return string $this->name バリデーションルール名
|
48 |
*/
|
49 |
public function getName() {
|
51 |
}
|
52 |
|
53 |
/**
|
54 |
+
* バリデーションチェック
|
55 |
+
*
|
56 |
* @param string $key name属性
|
57 |
* @param array $option
|
58 |
* @return string エラーメッセージ
|
60 |
abstract public function rule( $key, array $options = array() );
|
61 |
|
62 |
/**
|
63 |
+
* 設定パネルに追加
|
64 |
+
*
|
65 |
* @param numeric $key バリデーションルールセットの識別番号
|
66 |
* @param array $value バリデーションルールセットの内容
|
67 |
*/
|
classes/models/class.akismet.php
CHANGED
@@ -44,20 +44,20 @@ class MW_WP_Form_Akismet {
|
|
44 |
$doAkismet = false;
|
45 |
|
46 |
$author = '';
|
47 |
-
if ( $Data->
|
48 |
-
$author = $Data->
|
49 |
$doAkismet = true;
|
50 |
}
|
51 |
|
52 |
$author_email = '';
|
53 |
-
if ( $Data->
|
54 |
-
$author_email = $Data->
|
55 |
$doAkismet = true;
|
56 |
}
|
57 |
|
58 |
$author_url = '';
|
59 |
-
if ( $Data->
|
60 |
-
$author_url = $Data->
|
61 |
$doAkismet = true;
|
62 |
}
|
63 |
|
44 |
$doAkismet = false;
|
45 |
|
46 |
$author = '';
|
47 |
+
if ( $Data->get_post_value_by_key( $akismet_author ) ) {
|
48 |
+
$author = $Data->get_post_value_by_key( $akismet_author );
|
49 |
$doAkismet = true;
|
50 |
}
|
51 |
|
52 |
$author_email = '';
|
53 |
+
if ( $Data->get_post_value_by_key( $akismet_author_email ) ) {
|
54 |
+
$author_email = $Data->get_post_value_by_key( $akismet_author_email );
|
55 |
$doAkismet = true;
|
56 |
}
|
57 |
|
58 |
$author_url = '';
|
59 |
+
if ( $Data->get_post_value_by_key( $akismet_author_url ) ) {
|
60 |
+
$author_url = $Data->get_post_value_by_key( $akismet_author_url );
|
61 |
$doAkismet = true;
|
62 |
}
|
63 |
|
classes/models/class.contact-data-setting.php
CHANGED
@@ -13,33 +13,36 @@
|
|
13 |
class MW_WP_Form_Contact_Data_Setting {
|
14 |
|
15 |
/**
|
16 |
-
*
|
|
|
|
|
|
|
|
|
|
|
17 |
* フォームのPost ID
|
18 |
* @var int
|
19 |
*/
|
20 |
protected $post_id;
|
21 |
|
22 |
/**
|
23 |
-
* $options
|
24 |
* 各フォーム項目から送信された値を格納
|
25 |
* @var array
|
26 |
*/
|
27 |
protected $options = array();
|
28 |
|
29 |
/**
|
30 |
-
*
|
31 |
* @var string not-supported|reservation|supported
|
32 |
*/
|
33 |
protected $response_status = 'not-supported';
|
34 |
|
35 |
/**
|
36 |
-
*
|
37 |
* @var string
|
38 |
*/
|
39 |
protected $memo = '';
|
40 |
|
41 |
/**
|
42 |
-
* $response_statuses
|
43 |
* 対応状況種別の一覧
|
44 |
* @var array
|
45 |
*/
|
@@ -47,6 +50,7 @@ class MW_WP_Form_Contact_Data_Setting {
|
|
47 |
|
48 |
/**
|
49 |
* __construct
|
|
|
50 |
* @param int $post_id
|
51 |
*/
|
52 |
public function __construct( $post_id ) {
|
@@ -80,7 +84,8 @@ class MW_WP_Form_Contact_Data_Setting {
|
|
80 |
}
|
81 |
|
82 |
/**
|
83 |
-
*
|
|
|
84 |
* @return array
|
85 |
*/
|
86 |
public function get_response_statuses() {
|
@@ -88,8 +93,8 @@ class MW_WP_Form_Contact_Data_Setting {
|
|
88 |
}
|
89 |
|
90 |
/**
|
91 |
-
* get_permit_keys
|
92 |
* 更新可能なキーを返す
|
|
|
93 |
* @return array
|
94 |
*/
|
95 |
public function get_permit_keys() {
|
@@ -97,7 +102,7 @@ class MW_WP_Form_Contact_Data_Setting {
|
|
97 |
}
|
98 |
|
99 |
/**
|
100 |
-
*
|
101 |
*/
|
102 |
public function gets() {
|
103 |
$options = $this->options;
|
@@ -109,8 +114,8 @@ class MW_WP_Form_Contact_Data_Setting {
|
|
109 |
}
|
110 |
|
111 |
/**
|
112 |
-
*
|
113 |
-
*
|
114 |
* @param string $key
|
115 |
* @return mixed|null
|
116 |
*/
|
@@ -131,8 +136,8 @@ class MW_WP_Form_Contact_Data_Setting {
|
|
131 |
}
|
132 |
|
133 |
/**
|
134 |
-
* set
|
135 |
* 属性をセット
|
|
|
136 |
* @param string $key
|
137 |
* @param mixed $value
|
138 |
*/
|
@@ -146,8 +151,8 @@ class MW_WP_Form_Contact_Data_Setting {
|
|
146 |
}
|
147 |
|
148 |
/**
|
149 |
-
* sets
|
150 |
* 属性をセット
|
|
|
151 |
* @param array $values
|
152 |
*/
|
153 |
public function sets( array $values ) {
|
@@ -157,7 +162,8 @@ class MW_WP_Form_Contact_Data_Setting {
|
|
157 |
}
|
158 |
|
159 |
/**
|
160 |
-
*
|
|
|
161 |
* @param bool $non_permit_keys_save_flg permit_keys以外のメタデータも更新する
|
162 |
*/
|
163 |
public function save( $non_permit_keys_save_flg = false ) {
|
@@ -178,10 +184,14 @@ class MW_WP_Form_Contact_Data_Setting {
|
|
178 |
}
|
179 |
|
180 |
/**
|
181 |
-
*
|
|
|
182 |
* @return array
|
183 |
*/
|
184 |
public static function get_posts() {
|
|
|
|
|
|
|
185 |
$contact_data_post_types = array();
|
186 |
$Admin = new MW_WP_Form_Admin();
|
187 |
$forms = $Admin->get_forms_using_database();
|
@@ -201,12 +211,13 @@ class MW_WP_Form_Contact_Data_Setting {
|
|
201 |
$new_post_types[] = $post_type;
|
202 |
}
|
203 |
}
|
204 |
-
|
|
|
205 |
}
|
206 |
|
207 |
/**
|
208 |
-
* is_upload_file_key
|
209 |
* $meta_key が $post の upload_file_key かどうか
|
|
|
210 |
* @param WP_Post $post
|
211 |
* @param string $meta_key
|
212 |
* @return bool
|
@@ -220,8 +231,8 @@ class MW_WP_Form_Contact_Data_Setting {
|
|
220 |
}
|
221 |
|
222 |
/**
|
223 |
-
* get_upload_file_keys
|
224 |
* その投稿がもつ upload_file_key を取得
|
|
|
225 |
* @param WP_Post $post
|
226 |
* @return array $upload_file_keys
|
227 |
*/
|
13 |
class MW_WP_Form_Contact_Data_Setting {
|
14 |
|
15 |
/**
|
16 |
+
* 問い合わせデータを保存しているフォームの投稿タイプの一覧
|
17 |
+
* @var array
|
18 |
+
*/
|
19 |
+
protected static $contact_data_post_types;
|
20 |
+
|
21 |
+
/**
|
22 |
* フォームのPost ID
|
23 |
* @var int
|
24 |
*/
|
25 |
protected $post_id;
|
26 |
|
27 |
/**
|
|
|
28 |
* 各フォーム項目から送信された値を格納
|
29 |
* @var array
|
30 |
*/
|
31 |
protected $options = array();
|
32 |
|
33 |
/**
|
34 |
+
* 問い合わせデータのステータス
|
35 |
* @var string not-supported|reservation|supported
|
36 |
*/
|
37 |
protected $response_status = 'not-supported';
|
38 |
|
39 |
/**
|
40 |
+
* メモ
|
41 |
* @var string
|
42 |
*/
|
43 |
protected $memo = '';
|
44 |
|
45 |
/**
|
|
|
46 |
* 対応状況種別の一覧
|
47 |
* @var array
|
48 |
*/
|
50 |
|
51 |
/**
|
52 |
* __construct
|
53 |
+
*
|
54 |
* @param int $post_id
|
55 |
*/
|
56 |
public function __construct( $post_id ) {
|
84 |
}
|
85 |
|
86 |
/**
|
87 |
+
* 問い合わせステータスの種類を取得
|
88 |
+
*
|
89 |
* @return array
|
90 |
*/
|
91 |
public function get_response_statuses() {
|
93 |
}
|
94 |
|
95 |
/**
|
|
|
96 |
* 更新可能なキーを返す
|
97 |
+
*
|
98 |
* @return array
|
99 |
*/
|
100 |
public function get_permit_keys() {
|
102 |
}
|
103 |
|
104 |
/**
|
105 |
+
* 全てのメタデータを取得
|
106 |
*/
|
107 |
public function gets() {
|
108 |
$options = $this->options;
|
114 |
}
|
115 |
|
116 |
/**
|
117 |
+
* メタデータの取得
|
118 |
+
*
|
119 |
* @param string $key
|
120 |
* @return mixed|null
|
121 |
*/
|
136 |
}
|
137 |
|
138 |
/**
|
|
|
139 |
* 属性をセット
|
140 |
+
*
|
141 |
* @param string $key
|
142 |
* @param mixed $value
|
143 |
*/
|
151 |
}
|
152 |
|
153 |
/**
|
|
|
154 |
* 属性をセット
|
155 |
+
*
|
156 |
* @param array $values
|
157 |
*/
|
158 |
public function sets( array $values ) {
|
162 |
}
|
163 |
|
164 |
/**
|
165 |
+
* 保存
|
166 |
+
*
|
167 |
* @param bool $non_permit_keys_save_flg permit_keys以外のメタデータも更新する
|
168 |
*/
|
169 |
public function save( $non_permit_keys_save_flg = false ) {
|
184 |
}
|
185 |
|
186 |
/**
|
187 |
+
* データベースに保存に設定されているフォーム(投稿)を取得
|
188 |
+
*
|
189 |
* @return array
|
190 |
*/
|
191 |
public static function get_posts() {
|
192 |
+
if ( self::$contact_data_post_types !== null ) {
|
193 |
+
return self::$contact_data_post_types;
|
194 |
+
}
|
195 |
$contact_data_post_types = array();
|
196 |
$Admin = new MW_WP_Form_Admin();
|
197 |
$forms = $Admin->get_forms_using_database();
|
211 |
$new_post_types[] = $post_type;
|
212 |
}
|
213 |
}
|
214 |
+
self::$contact_data_post_types = $new_post_types;
|
215 |
+
return self::$contact_data_post_types;
|
216 |
}
|
217 |
|
218 |
/**
|
|
|
219 |
* $meta_key が $post の upload_file_key かどうか
|
220 |
+
*
|
221 |
* @param WP_Post $post
|
222 |
* @param string $meta_key
|
223 |
* @return bool
|
231 |
}
|
232 |
|
233 |
/**
|
|
|
234 |
* その投稿がもつ upload_file_key を取得
|
235 |
+
*
|
236 |
* @param WP_Post $post
|
237 |
* @return array $upload_file_keys
|
238 |
*/
|
classes/models/class.contact-data.php
CHANGED
@@ -13,6 +13,7 @@ class MW_WP_Form_Contact_Data {
|
|
13 |
|
14 |
/**
|
15 |
* save_post
|
|
|
16 |
* @param int $post_id
|
17 |
*/
|
18 |
public function save_post( $post_id ) {
|
13 |
|
14 |
/**
|
15 |
* save_post
|
16 |
+
*
|
17 |
* @param int $post_id
|
18 |
*/
|
19 |
public function save_post( $post_id ) {
|
classes/models/class.csv.php
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Name : MW WP Form CSV
|
4 |
+
* Version : 1.0.0
|
5 |
+
* Author : Takashi Kitajima
|
6 |
+
* Author URI : http://2inc.org
|
7 |
+
* Created : April 3, 2015
|
8 |
+
* Modified :
|
9 |
+
* License : GPLv2
|
10 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
+
*/
|
12 |
+
class MW_WP_Form_CSV {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @var string
|
16 |
+
*/
|
17 |
+
protected $post_type;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* __construct
|
21 |
+
*/
|
22 |
+
public function __construct( $post_type ) {
|
23 |
+
$this->post_type = $post_type;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* CSVを生成、出力
|
28 |
+
*/
|
29 |
+
public function download() {
|
30 |
+
$key_of_csv_download = MWF_Config::NAME . '-csv-download';
|
31 |
+
|
32 |
+
if ( !isset( $_POST[$key_of_csv_download] ) || !check_admin_referer( MWF_Config::NAME ) ) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
|
36 |
+
$posts_per_page = $this->get_posts_per_page();
|
37 |
+
$paged = $this->get_paged();
|
38 |
+
|
39 |
+
$_args = apply_filters( 'mwform_get_inquiry_data_args-' . $this->post_type, array() );
|
40 |
+
$args = array(
|
41 |
+
'post_type' => $this->post_type,
|
42 |
+
'posts_per_page' => $posts_per_page,
|
43 |
+
'paged' => $paged,
|
44 |
+
'post_status' => 'any',
|
45 |
+
);
|
46 |
+
if ( !empty( $_args ) && is_array( $_args ) ) {
|
47 |
+
$args = array_merge( $_args, $args );
|
48 |
+
}
|
49 |
+
$posts_mwf = get_posts( $args );
|
50 |
+
|
51 |
+
// CSVの内容を貯める
|
52 |
+
$csv = '';
|
53 |
+
|
54 |
+
// 見出しを追加
|
55 |
+
$rows[0] = $this->get_csv_headings( $posts_mwf );
|
56 |
+
|
57 |
+
// 各データを追加
|
58 |
+
$rows = array_merge( $rows, $this->get_rows( $posts_mwf, $rows[0] ) );
|
59 |
+
|
60 |
+
// エンコード
|
61 |
+
foreach ( $rows as $key => $row ) {
|
62 |
+
foreach ( $row as $column_name => $column ) {
|
63 |
+
$row[$column_name] = $this->escape_double_quote( $column );
|
64 |
+
}
|
65 |
+
$csv .= implode( ',', $row ) . "\r\n";
|
66 |
+
}
|
67 |
+
$to_encoding = apply_filters( 'mwform_csv_encoding-' . $this->post_type, 'sjis-win' );
|
68 |
+
$csv = mb_convert_encoding( $csv, 'sjis-win', get_option( 'blog_charset' ) );
|
69 |
+
|
70 |
+
$file_name = 'mw_wp_form_' . date( 'YmdHis' ) . '.csv';
|
71 |
+
header( 'Content-Type: application/octet-stream' );
|
72 |
+
header( 'Content-Disposition: attachment; filename=' . $file_name );
|
73 |
+
echo $csv;
|
74 |
+
exit;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* CSVで出力する件数を取得
|
79 |
+
*
|
80 |
+
* @return int
|
81 |
+
*/
|
82 |
+
public function get_posts_per_page() {
|
83 |
+
$posts_per_page = -1;
|
84 |
+
if ( ( isset( $_POST['download-all'] ) && $_POST['download-all'] === 'true' ) === false ) {
|
85 |
+
$current_user = wp_get_current_user();
|
86 |
+
$_posts_per_page = get_user_meta( $current_user->ID, 'edit_' . $this->post_type . '_per_page', true );
|
87 |
+
if ( !empty( $_posts_per_page ) ) {
|
88 |
+
$posts_per_page = $_posts_per_page;
|
89 |
+
} else {
|
90 |
+
$posts_per_page = 20;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
return $posts_per_page;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* CSVで出力するページ番号を取得
|
98 |
+
*
|
99 |
+
* @return int
|
100 |
+
*/
|
101 |
+
public function get_paged() {
|
102 |
+
$posts_per_page = $this->get_posts_per_page();
|
103 |
+
$paged = 1;
|
104 |
+
if ( isset( $_GET['paged'] ) ) {
|
105 |
+
$_paged = $_GET['paged'];
|
106 |
+
if ( MWF_Functions::is_numeric( $_paged ) && $posts_per_page > 0 ) {
|
107 |
+
$paged = $_paged;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
return $paged;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* CSVの見出しを生成
|
115 |
+
*
|
116 |
+
* @param array $posts
|
117 |
+
* @return array
|
118 |
+
*/
|
119 |
+
protected function get_csv_headings( array $posts ) {
|
120 |
+
$default_headings = array(
|
121 |
+
'ID',
|
122 |
+
__( 'Response Status', MWF_Config::DOMAIN ),
|
123 |
+
'post_date',
|
124 |
+
'post_modified',
|
125 |
+
'post_title'
|
126 |
+
);
|
127 |
+
$rows[] = $default_headings;
|
128 |
+
$columns = array();
|
129 |
+
foreach ( $posts as $post ) {
|
130 |
+
$post_custom_keys = get_post_custom_keys( $post->ID );
|
131 |
+
if ( !is_array( $post_custom_keys ) ) {
|
132 |
+
continue;
|
133 |
+
}
|
134 |
+
foreach ( $post_custom_keys as $key ) {
|
135 |
+
if ( preg_match( '/^_/', $key ) ) {
|
136 |
+
continue;
|
137 |
+
}
|
138 |
+
if ( $key === MWF_Config::TRACKINGNUMBER ) {
|
139 |
+
$column = MWF_Functions::get_tracking_number_title( $this->post_type );
|
140 |
+
} else {
|
141 |
+
$column = $key;
|
142 |
+
}
|
143 |
+
$columns[$key] = $column;
|
144 |
+
}
|
145 |
+
}
|
146 |
+
ksort( $columns );
|
147 |
+
$rows[0] = array_merge( $rows[0], $columns );
|
148 |
+
$rows[0] = array_merge( $rows[0], array( __( 'Memo', MWF_Config::DOMAIN ) ) );
|
149 |
+
return $rows[0];
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* CSVの各行を生成
|
154 |
+
*
|
155 |
+
* @param array $posts
|
156 |
+
* @param array $headings
|
157 |
+
* @return array
|
158 |
+
*/
|
159 |
+
protected function get_rows( array $posts, array $headings ) {
|
160 |
+
global $post;
|
161 |
+
$rows = array();
|
162 |
+
foreach ( $posts as $post ) {
|
163 |
+
setup_postdata( $post );
|
164 |
+
$columns = array();
|
165 |
+
foreach ( $headings as $key => $value ) {
|
166 |
+
$Contact_Data_Setting = new MW_WP_Form_Contact_Data_Setting( $post->ID );
|
167 |
+
$response_statuses = $Contact_Data_Setting->get_response_statuses();
|
168 |
+
$column = '';
|
169 |
+
if ( $value === __( 'Response Status', MWF_Config::DOMAIN ) ) {
|
170 |
+
$response_status = $Contact_Data_Setting->get( 'response_status' );
|
171 |
+
$column = $response_statuses[$response_status];
|
172 |
+
} elseif ( $value === __( 'Memo', MWF_Config::DOMAIN ) ) {
|
173 |
+
$column = $Contact_Data_Setting->get( 'memo' );
|
174 |
+
} elseif ( $value === MWF_Functions::get_tracking_number_title( $this->post_type ) ) {
|
175 |
+
$column = get_post_meta( get_the_ID(), MWF_Config::TRACKINGNUMBER, true );
|
176 |
+
} elseif ( isset( $post->$value ) ) {
|
177 |
+
$post_meta = $post->$value;
|
178 |
+
if ( $Contact_Data_Setting->is_upload_file_key( $post, $value ) ) {
|
179 |
+
$column = wp_get_attachment_url( $post_meta );
|
180 |
+
} else {
|
181 |
+
$column = ( $post_meta ) ? $post_meta : '';
|
182 |
+
}
|
183 |
+
}
|
184 |
+
$columns[$key] = $column;
|
185 |
+
}
|
186 |
+
$rows[] = $columns;
|
187 |
+
}
|
188 |
+
wp_reset_postdata();
|
189 |
+
return $rows;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* CSVのダブルクオートのエスケープ
|
194 |
+
*
|
195 |
+
* @param string $value
|
196 |
+
* @return string
|
197 |
+
*/
|
198 |
+
protected function escape_double_quote( $value ) {
|
199 |
+
$value = str_replace( '"', '""', $value );
|
200 |
+
return '"' . $value . '"';
|
201 |
+
}
|
202 |
+
}
|
classes/models/class.data.php
CHANGED
@@ -2,69 +2,51 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Data
|
4 |
* Description: MW WP Form のデータ操作用
|
5 |
-
* Version : 1.3.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : October 10, 2013
|
9 |
-
* Modified : March
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Data {
|
14 |
|
15 |
/**
|
16 |
-
* $Instance
|
17 |
* @var MW_WP_Form_Data
|
18 |
*/
|
19 |
protected static $Instance;
|
20 |
|
21 |
/**
|
22 |
-
* $form_key
|
23 |
* フォーム識別子
|
24 |
* @var string
|
25 |
*/
|
26 |
protected $form_key;
|
27 |
|
28 |
/**
|
29 |
-
* $data
|
30 |
* フォームから送信された内容を保存した配列
|
31 |
* @var array
|
32 |
*/
|
33 |
protected $data = array();
|
34 |
|
35 |
/**
|
36 |
-
* $Session
|
37 |
* @var MW_WP_Form_Sesion
|
38 |
*/
|
39 |
protected $Session;
|
40 |
|
41 |
/**
|
42 |
-
* $token_name
|
43 |
-
* @var string
|
44 |
-
*/
|
45 |
-
protected $token_name = 'token';
|
46 |
-
|
47 |
-
/**
|
48 |
-
* $complete_twice
|
49 |
-
* リダイレクトされてからの complete であれば true
|
50 |
-
* @var bool
|
51 |
-
*/
|
52 |
-
protected $complete_twice = false;
|
53 |
-
|
54 |
-
/**
|
55 |
-
* $POST
|
56 |
* @var array
|
57 |
*/
|
58 |
protected $POST = array();
|
59 |
|
60 |
/**
|
61 |
-
* $FILES
|
62 |
* @var array
|
63 |
*/
|
64 |
protected $FILES = array();
|
65 |
|
66 |
/**
|
67 |
* __construct
|
|
|
68 |
* @param string $form_key フォーム識別子
|
69 |
* @param array $POST $_POSTを想定
|
70 |
* @param array $FILES $_FILESを想定
|
@@ -77,11 +59,11 @@ class MW_WP_Form_Data {
|
|
77 |
$this->data = $this->Session->gets();
|
78 |
$this->set_request_valiables( $this->POST );
|
79 |
$this->set_files_valiables( $this->POST, $this->FILES );
|
80 |
-
add_filter( 'mwform_form_end_html', array( $this, 'mwform_form_end_html' ) );
|
81 |
}
|
82 |
|
83 |
/**
|
84 |
* getInstance
|
|
|
85 |
* @param string $form_key フォーム識別子
|
86 |
* @param array $POST $_POSTを想定
|
87 |
* @param array $FILES $_FILESを想定
|
@@ -94,7 +76,8 @@ class MW_WP_Form_Data {
|
|
94 |
}
|
95 |
|
96 |
/**
|
97 |
-
*
|
|
|
98 |
* @param array $POST $_POSTを想定
|
99 |
*/
|
100 |
protected function set_request_valiables( array $POST ) {
|
@@ -104,7 +87,8 @@ class MW_WP_Form_Data {
|
|
104 |
}
|
105 |
|
106 |
/**
|
107 |
-
*
|
|
|
108 |
* @param array $POST $_POSTを想定
|
109 |
* @param array $FILES $_FILESを想定
|
110 |
*/
|
@@ -129,87 +113,29 @@ class MW_WP_Form_Data {
|
|
129 |
}
|
130 |
|
131 |
/**
|
132 |
-
* mwform_form_end_html
|
133 |
-
* @param string $html
|
134 |
-
* @return string $html
|
135 |
-
*/
|
136 |
-
public function mwform_form_end_html( $html ) {
|
137 |
-
$html .= wp_nonce_field( $this->form_key, $this->token_name, true, false );
|
138 |
-
return $html;
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* check
|
143 |
-
* トークンチェック
|
144 |
-
* @return bool
|
145 |
-
*/
|
146 |
-
protected function token_check() {
|
147 |
-
if ( isset( $_POST[$this->token_name] ) ) {
|
148 |
-
$request_token = $_POST[$this->token_name];
|
149 |
-
}
|
150 |
-
$values = $this->gets();
|
151 |
-
if ( isset( $request_token ) && wp_verify_nonce( $request_token, $this->form_key ) ) {
|
152 |
-
return true;
|
153 |
-
} elseif ( empty( $_POST ) && $values ) {
|
154 |
-
$this->complete_twice = true;
|
155 |
-
return true;
|
156 |
-
}
|
157 |
-
return false;
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* is_complete_twice
|
162 |
-
* リダイレクト後の complete かチェック
|
163 |
-
*/
|
164 |
-
public function is_complete_twice() {
|
165 |
-
if ( $this->complete_twice === true ) {
|
166 |
-
return true;
|
167 |
-
}
|
168 |
-
return false;
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* get_post_condition
|
173 |
* 送信データからどのページを表示すべきかの状態を判定して返す
|
174 |
* ただし実際に表示するページと同じとは限らない(バリデーション通らないとかあるので)
|
|
|
|
|
175 |
* @return string back|confirm|complete|input
|
176 |
*/
|
177 |
-
public function get_post_condition() {
|
178 |
-
$backButton = $this->
|
179 |
-
$confirmButton = $this->
|
180 |
if ( $backButton ) {
|
181 |
return 'back';
|
182 |
} elseif ( $confirmButton ) {
|
183 |
return 'confirm';
|
184 |
-
} elseif ( !$confirmButton && !$backButton && $
|
185 |
return 'complete';
|
186 |
}
|
187 |
return 'input';
|
188 |
}
|
189 |
|
190 |
/**
|
191 |
-
*
|
192 |
-
*
|
193 |
-
* @
|
194 |
-
* @return string データ
|
195 |
-
*/
|
196 |
-
public function get_raw( $key ) {
|
197 |
-
if ( isset( $this->data[$key] ) ) {
|
198 |
-
return $this->data[$key];
|
199 |
-
}
|
200 |
-
}
|
201 |
-
public function getValue( $key ) {
|
202 |
-
MWF_Functions::deprecated_message(
|
203 |
-
'MW_WP_Form_Data::getValue()',
|
204 |
-
'MW_WP_Form_Data::get_raw()'
|
205 |
-
);
|
206 |
-
return $this->get_raw( $key );
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* getValues
|
211 |
-
* 全てのデータを取得
|
212 |
-
* @return array データ
|
213 |
*/
|
214 |
public function gets() {
|
215 |
if ( $this->data === null ) {
|
@@ -217,17 +143,10 @@ class MW_WP_Form_Data {
|
|
217 |
}
|
218 |
return $this->data;
|
219 |
}
|
220 |
-
public function getValues() {
|
221 |
-
MWF_Functions::deprecated_message(
|
222 |
-
'MW_WP_Form_Data::getValues()',
|
223 |
-
'MW_WP_Form_Data::gets()'
|
224 |
-
);
|
225 |
-
return $this->gets();
|
226 |
-
}
|
227 |
|
228 |
/**
|
229 |
-
* set
|
230 |
* データを追加
|
|
|
231 |
* @param string $key データのキー
|
232 |
* @param string $value 値
|
233 |
*/
|
@@ -237,8 +156,8 @@ class MW_WP_Form_Data {
|
|
237 |
}
|
238 |
|
239 |
/**
|
240 |
-
* set
|
241 |
* 複数のデータを一括で追加
|
|
|
242 |
* @param array 値
|
243 |
*/
|
244 |
public function sets( array $array ) {
|
@@ -249,8 +168,8 @@ class MW_WP_Form_Data {
|
|
249 |
}
|
250 |
|
251 |
/**
|
252 |
-
* clear_value
|
253 |
* データを消す
|
|
|
254 |
* @param string $key データのキー
|
255 |
*/
|
256 |
public function clear_value( $key ) {
|
@@ -259,8 +178,8 @@ class MW_WP_Form_Data {
|
|
259 |
}
|
260 |
|
261 |
/**
|
262 |
-
*
|
263 |
-
*
|
264 |
* @param string $key データのキー
|
265 |
*/
|
266 |
public function clear_values() {
|
@@ -269,8 +188,8 @@ class MW_WP_Form_Data {
|
|
269 |
}
|
270 |
|
271 |
/**
|
272 |
-
* push
|
273 |
* 指定した $key をキーと配列にデータを追加
|
|
|
274 |
* @param string $key データのキー
|
275 |
* @param string $value 値
|
276 |
*/
|
@@ -280,185 +199,201 @@ class MW_WP_Form_Data {
|
|
280 |
}
|
281 |
|
282 |
/**
|
283 |
-
*
|
284 |
*
|
285 |
* @param string $key データのキー
|
286 |
-
* @
|
|
|
287 |
*/
|
288 |
-
public function get( $key ) {
|
289 |
-
if ( isset( $this->data[$key] ) ) {
|
|
|
|
|
290 |
|
291 |
-
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
}
|
|
|
|
|
|
|
295 |
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
|
|
|
|
|
|
|
|
319 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
}
|
321 |
}
|
322 |
|
323 |
/**
|
324 |
* $children の中に値が含まれているときだけ返す
|
|
|
325 |
*
|
326 |
* @param string $key name属性
|
327 |
* @param array $children
|
328 |
* @return string
|
329 |
*/
|
330 |
public function get_in_children( $key, array $children ) {
|
331 |
-
$value = $this->
|
332 |
if ( !is_null( $value ) && !is_array( $value ) ) {
|
333 |
if ( isset( $children[$value] ) ) {
|
334 |
return $children[$value];
|
|
|
|
|
335 |
}
|
336 |
}
|
337 |
}
|
338 |
|
339 |
/**
|
340 |
* $children の中に値が含まれているときだけ返す
|
|
|
341 |
*
|
342 |
* @param string $key name属性
|
343 |
* @param array $children
|
344 |
* @return string
|
345 |
*/
|
346 |
public function get_raw_in_children( $key, array $children ) {
|
347 |
-
$value = $this->
|
348 |
if ( !is_null( $value ) && !is_array( $value ) ) {
|
349 |
if ( isset( $children[$value] ) ) {
|
350 |
return $value;
|
|
|
|
|
351 |
}
|
352 |
}
|
353 |
-
return '';
|
354 |
}
|
355 |
|
356 |
/**
|
357 |
-
* get_separator_value
|
358 |
* 送られてきたseparatorを返す
|
|
|
359 |
* @param string $key name属性
|
360 |
* @return string
|
361 |
*/
|
362 |
public function get_separator_value( $key ) {
|
363 |
-
$value = $this->
|
364 |
if ( is_array( $value ) && isset( $value['separator'] ) ) {
|
365 |
return $value['separator'];
|
366 |
}
|
367 |
}
|
368 |
-
public function getSeparatorValue( $key ) {
|
369 |
-
MWF_Functions::deprecated_message(
|
370 |
-
'MW_WP_Form_Data::getSeparatorValue()',
|
371 |
-
'MW_WP_Form_Data::get_separator_value()'
|
372 |
-
);
|
373 |
-
return $this->get_separator_value( $key );
|
374 |
-
}
|
375 |
|
376 |
/**
|
377 |
-
*
|
|
|
378 |
*
|
379 |
* @param string $key name属性
|
380 |
* @param array $children 選択肢
|
381 |
-
* @return string
|
382 |
*/
|
383 |
-
public function get_separated_value( $key, array $children
|
384 |
$separator = $this->get_separator_value( $key );
|
385 |
-
$value = $this->
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
return $this->get_separated_value_not_children_set( $value['data'], $separator );
|
407 |
}
|
408 |
}
|
409 |
-
|
410 |
-
if ( $children ) {
|
411 |
-
return $this->get_in_children( $key, $children );
|
412 |
-
}
|
413 |
-
return $value;
|
414 |
}
|
415 |
}
|
416 |
-
public function getSeparatedValue( $key ) {
|
417 |
-
MWF_Functions::deprecated_message(
|
418 |
-
'MW_WP_Form_Data::getSeparatedValue()',
|
419 |
-
'MW_WP_Form_Data::get_separated_value()'
|
420 |
-
);
|
421 |
-
return $this->get_separated_value( $key );
|
422 |
-
}
|
423 |
|
424 |
/**
|
425 |
-
*
|
|
|
426 |
*
|
427 |
* @param string $key name属性
|
428 |
* @param array $children 選択肢
|
429 |
-
* @return string
|
430 |
*/
|
431 |
-
public function get_separated_raw_value( $key, array $children
|
432 |
$separator = $this->get_separator_value( $key );
|
433 |
-
$value = $this->
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
return $this->get_separated_value_not_children_set( $value['data'], $separator );
|
455 |
}
|
456 |
}
|
457 |
-
|
458 |
-
if ( $children ) {
|
459 |
-
return $this->get_raw_in_children( $key, $children );
|
460 |
-
}
|
461 |
-
return $value;
|
462 |
}
|
463 |
}
|
464 |
|
@@ -467,33 +402,50 @@ class MW_WP_Form_Data {
|
|
467 |
*
|
468 |
* @param array $data
|
469 |
* @param string $separator
|
470 |
-
* @return string
|
471 |
*/
|
472 |
-
protected function get_separated_value_not_children_set(
|
473 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
474 |
if ( $child !== '' && $child !== null ) {
|
475 |
-
return implode( $separator, $data );
|
476 |
}
|
477 |
}
|
478 |
return '';
|
479 |
}
|
480 |
|
481 |
/**
|
482 |
-
*
|
483 |
*/
|
484 |
public function set_upload_file_keys() {
|
485 |
-
$upload_file_keys = $this->
|
486 |
if ( !$upload_file_keys ) {
|
487 |
$upload_file_keys = array();
|
488 |
}
|
489 |
|
490 |
$wp_upload_dir = wp_upload_dir();
|
491 |
-
foreach ( $upload_file_keys as $upload_file_key ) {
|
492 |
-
$upload_file_url = $this->
|
493 |
if ( $upload_file_url ) {
|
494 |
$filepath = MWF_Functions::fileurl_to_path( $upload_file_url );
|
495 |
if ( !file_exists( $filepath ) ) {
|
496 |
-
unset( $upload_file_keys[$
|
497 |
}
|
498 |
}
|
499 |
}
|
@@ -501,15 +453,15 @@ class MW_WP_Form_Data {
|
|
501 |
}
|
502 |
|
503 |
/**
|
504 |
-
*
|
505 |
-
*
|
506 |
* @param array $uploaded_files アップロード済みファイルのパスの配列
|
507 |
*/
|
508 |
public function push_uploaded_file_keys( array $uploaded_files = array() ) {
|
509 |
-
$upload_file_keys = $this->
|
510 |
foreach ( $uploaded_files as $key => $upload_file ) {
|
511 |
$this->set( $key, $upload_file );
|
512 |
-
if ( !in_array( $key, $upload_file_keys ) ) {
|
513 |
$this->push( MWF_Config::UPLOAD_FILE_KEYS, $key );
|
514 |
}
|
515 |
}
|
2 |
/**
|
3 |
* Name : MW WP Form Data
|
4 |
* Description: MW WP Form のデータ操作用
|
5 |
+
* Version : 1.3.7
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : October 10, 2013
|
9 |
+
* Modified : March 26, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Data {
|
14 |
|
15 |
/**
|
|
|
16 |
* @var MW_WP_Form_Data
|
17 |
*/
|
18 |
protected static $Instance;
|
19 |
|
20 |
/**
|
|
|
21 |
* フォーム識別子
|
22 |
* @var string
|
23 |
*/
|
24 |
protected $form_key;
|
25 |
|
26 |
/**
|
|
|
27 |
* フォームから送信された内容を保存した配列
|
28 |
* @var array
|
29 |
*/
|
30 |
protected $data = array();
|
31 |
|
32 |
/**
|
|
|
33 |
* @var MW_WP_Form_Sesion
|
34 |
*/
|
35 |
protected $Session;
|
36 |
|
37 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
* @var array
|
39 |
*/
|
40 |
protected $POST = array();
|
41 |
|
42 |
/**
|
|
|
43 |
* @var array
|
44 |
*/
|
45 |
protected $FILES = array();
|
46 |
|
47 |
/**
|
48 |
* __construct
|
49 |
+
*
|
50 |
* @param string $form_key フォーム識別子
|
51 |
* @param array $POST $_POSTを想定
|
52 |
* @param array $FILES $_FILESを想定
|
59 |
$this->data = $this->Session->gets();
|
60 |
$this->set_request_valiables( $this->POST );
|
61 |
$this->set_files_valiables( $this->POST, $this->FILES );
|
|
|
62 |
}
|
63 |
|
64 |
/**
|
65 |
* getInstance
|
66 |
+
*
|
67 |
* @param string $form_key フォーム識別子
|
68 |
* @param array $POST $_POSTを想定
|
69 |
* @param array $FILES $_FILESを想定
|
76 |
}
|
77 |
|
78 |
/**
|
79 |
+
* $_POST をセット
|
80 |
+
*
|
81 |
* @param array $POST $_POSTを想定
|
82 |
*/
|
83 |
protected function set_request_valiables( array $POST ) {
|
87 |
}
|
88 |
|
89 |
/**
|
90 |
+
* $_FILES をセット
|
91 |
+
*
|
92 |
* @param array $POST $_POSTを想定
|
93 |
* @param array $FILES $_FILESを想定
|
94 |
*/
|
113 |
}
|
114 |
|
115 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
* 送信データからどのページを表示すべきかの状態を判定して返す
|
117 |
* ただし実際に表示するページと同じとは限らない(バリデーション通らないとかあるので)
|
118 |
+
*
|
119 |
+
* @param bool $token_check
|
120 |
* @return string back|confirm|complete|input
|
121 |
*/
|
122 |
+
public function get_post_condition( $token_check ) {
|
123 |
+
$backButton = $this->get_post_value_by_key( MWF_Config::BACK_BUTTON );
|
124 |
+
$confirmButton = $this->get_post_value_by_key( MWF_Config::CONFIRM_BUTTON );
|
125 |
if ( $backButton ) {
|
126 |
return 'back';
|
127 |
} elseif ( $confirmButton ) {
|
128 |
return 'confirm';
|
129 |
+
} elseif ( !$confirmButton && !$backButton && $token_check ) {
|
130 |
return 'complete';
|
131 |
}
|
132 |
return 'input';
|
133 |
}
|
134 |
|
135 |
/**
|
136 |
+
* 全ての送信データを取得
|
137 |
+
*
|
138 |
+
* @return array
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
*/
|
140 |
public function gets() {
|
141 |
if ( $this->data === null ) {
|
143 |
}
|
144 |
return $this->data;
|
145 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
/**
|
|
|
148 |
* データを追加
|
149 |
+
*
|
150 |
* @param string $key データのキー
|
151 |
* @param string $value 値
|
152 |
*/
|
156 |
}
|
157 |
|
158 |
/**
|
|
|
159 |
* 複数のデータを一括で追加
|
160 |
+
*
|
161 |
* @param array 値
|
162 |
*/
|
163 |
public function sets( array $array ) {
|
168 |
}
|
169 |
|
170 |
/**
|
|
|
171 |
* データを消す
|
172 |
+
*
|
173 |
* @param string $key データのキー
|
174 |
*/
|
175 |
public function clear_value( $key ) {
|
178 |
}
|
179 |
|
180 |
/**
|
181 |
+
* 全てのデータを消す
|
182 |
+
*
|
183 |
* @param string $key データのキー
|
184 |
*/
|
185 |
public function clear_values() {
|
188 |
}
|
189 |
|
190 |
/**
|
|
|
191 |
* 指定した $key をキーと配列にデータを追加
|
192 |
+
*
|
193 |
* @param string $key データのキー
|
194 |
* @param string $value 値
|
195 |
*/
|
199 |
}
|
200 |
|
201 |
/**
|
202 |
+
* 整形済み(メール送信可能な)データを取得。送信値、表示値を自動判別
|
203 |
*
|
204 |
* @param string $key データのキー
|
205 |
+
* @param array $children
|
206 |
+
* @return string|null
|
207 |
*/
|
208 |
+
public function get( $key, array $children = array() ) {
|
209 |
+
if ( !isset( $this->data[$key] ) ) {
|
210 |
+
return;
|
211 |
+
}
|
212 |
|
213 |
+
if ( empty( $children ) && isset( $this->data['__children'][$key] ) ) {
|
214 |
+
$children = json_decode( $this->data['__children'][$key], true );
|
215 |
+
}
|
216 |
+
|
217 |
+
if ( is_array( $this->data[$key] ) ) {
|
218 |
+
if ( !array_key_exists( 'data', $this->data[$key] ) ) {
|
219 |
+
return;
|
220 |
+
}
|
221 |
+
if ( $children ) {
|
222 |
+
return $this->get_separated_value( $key, $children );
|
223 |
+
}
|
224 |
+
return $this->get_separated_value_not_children_set( $key );
|
225 |
+
} else {
|
226 |
+
if ( $children ) {
|
227 |
+
return $this->get_in_children( $key, $children );
|
228 |
}
|
229 |
+
return $this->get_raw( $key );
|
230 |
+
}
|
231 |
+
}
|
232 |
|
233 |
+
/**
|
234 |
+
* 送信データを取得
|
235 |
+
*
|
236 |
+
* @param string $key データのキー
|
237 |
+
* @return string|null
|
238 |
+
*/
|
239 |
+
public function get_raw( $key ) {
|
240 |
+
if ( !isset( $this->data[$key] ) ) {
|
241 |
+
return;
|
242 |
+
}
|
243 |
+
if ( is_array( $this->data[$key] ) && !array_key_exists( 'data', $this->data[$key] ) ) {
|
244 |
+
return;
|
245 |
+
}
|
246 |
+
|
247 |
+
$children = array();
|
248 |
+
if ( isset( $this->data['__children'][$key] ) ) {
|
249 |
+
$children = json_decode( $this->data['__children'][$key], true );
|
250 |
+
}
|
251 |
+
|
252 |
+
if ( is_array( $this->data[$key] ) ) {
|
253 |
+
if ( $children ) {
|
254 |
+
return $this->get_separated_raw_value( $key, $children );
|
255 |
+
}
|
256 |
+
return $this->get_separated_value_not_children_set( $key );
|
257 |
+
} else {
|
258 |
+
if ( $children ) {
|
259 |
+
return $this->get_raw_in_children( $key, $children );
|
260 |
}
|
261 |
+
return $this->get_post_value_by_key( $key );
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* そのキーに紐づく送信データを取得(通常の value 以外に separator や data などが紐づく)
|
267 |
+
* todo: post されてないデータを取得するときも使うから名前変更する
|
268 |
+
*/
|
269 |
+
public function get_post_value_by_key( $key ) {
|
270 |
+
if ( isset( $this->data[$key] ) ) {
|
271 |
+
return $this->data[$key];
|
272 |
}
|
273 |
}
|
274 |
|
275 |
/**
|
276 |
* $children の中に値が含まれているときだけ返す
|
277 |
+
* 本当は protected 後方互換
|
278 |
*
|
279 |
* @param string $key name属性
|
280 |
* @param array $children
|
281 |
* @return string
|
282 |
*/
|
283 |
public function get_in_children( $key, array $children ) {
|
284 |
+
$value = $this->get_post_value_by_key( $key );
|
285 |
if ( !is_null( $value ) && !is_array( $value ) ) {
|
286 |
if ( isset( $children[$value] ) ) {
|
287 |
return $children[$value];
|
288 |
+
} else {
|
289 |
+
return '';
|
290 |
}
|
291 |
}
|
292 |
}
|
293 |
|
294 |
/**
|
295 |
* $children の中に値が含まれているときだけ返す
|
296 |
+
* 本当は protected 後方互換
|
297 |
*
|
298 |
* @param string $key name属性
|
299 |
* @param array $children
|
300 |
* @return string
|
301 |
*/
|
302 |
public function get_raw_in_children( $key, array $children ) {
|
303 |
+
$value = $this->get_post_value_by_key( $key );
|
304 |
if ( !is_null( $value ) && !is_array( $value ) ) {
|
305 |
if ( isset( $children[$value] ) ) {
|
306 |
return $value;
|
307 |
+
} else {
|
308 |
+
return '';
|
309 |
}
|
310 |
}
|
|
|
311 |
}
|
312 |
|
313 |
/**
|
|
|
314 |
* 送られてきたseparatorを返す
|
315 |
+
*
|
316 |
* @param string $key name属性
|
317 |
* @return string
|
318 |
*/
|
319 |
public function get_separator_value( $key ) {
|
320 |
+
$value = $this->get_post_value_by_key( $key );
|
321 |
if ( is_array( $value ) && isset( $value['separator'] ) ) {
|
322 |
return $value['separator'];
|
323 |
}
|
324 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
|
326 |
/**
|
327 |
+
* 配列データを整形して表示値を返す。separator が送信されていない場合は null
|
328 |
+
* 本当は protected 後方互換
|
329 |
*
|
330 |
* @param string $key name属性
|
331 |
* @param array $children 選択肢
|
332 |
+
* @return string|null
|
333 |
*/
|
334 |
+
public function get_separated_value( $key, array $children ) {
|
335 |
$separator = $this->get_separator_value( $key );
|
336 |
+
$value = $this->get_post_value_by_key( $key );
|
337 |
+
|
338 |
+
if ( !is_array( $value ) ) {
|
339 |
+
return;
|
340 |
+
}
|
341 |
+
if ( !isset( $value['data'] ) ) {
|
342 |
+
return;
|
343 |
+
}
|
344 |
+
if ( !$separator ) {
|
345 |
+
return;
|
346 |
+
}
|
347 |
+
|
348 |
+
// 入力 -> 確認のときは配列、確認 -> 入力のときは文字列
|
349 |
+
if ( !is_array( $value['data'] ) ) {
|
350 |
+
$value['data'] = explode( $separator, $value['data'] );
|
351 |
+
}
|
352 |
+
if ( $children ) {
|
353 |
+
$rightData = array();
|
354 |
+
foreach ( $value['data'] as $child ) {
|
355 |
+
if ( isset( $children[$child] ) && !in_array( $children[$child], $rightData ) ) {
|
356 |
+
$rightData[] = $children[$child];
|
|
|
357 |
}
|
358 |
}
|
359 |
+
return implode( $separator, $rightData );
|
|
|
|
|
|
|
|
|
360 |
}
|
361 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
|
363 |
/**
|
364 |
+
* 配列データを整形して送信値を返す。separator が送信されていない場合は null
|
365 |
+
* 本当は protected 後方互換
|
366 |
*
|
367 |
* @param string $key name属性
|
368 |
* @param array $children 選択肢
|
369 |
+
* @return string|null
|
370 |
*/
|
371 |
+
public function get_separated_raw_value( $key, array $children ) {
|
372 |
$separator = $this->get_separator_value( $key );
|
373 |
+
$value = $this->get_post_value_by_key( $key );
|
374 |
+
|
375 |
+
if ( !is_array( $value ) ) {
|
376 |
+
return;
|
377 |
+
}
|
378 |
+
if ( !isset( $value['data'] ) ) {
|
379 |
+
return;
|
380 |
+
}
|
381 |
+
if ( !$separator ) {
|
382 |
+
return;
|
383 |
+
}
|
384 |
+
|
385 |
+
// 入力 -> 確認のときは配列、確認 -> 入力のときは文字列
|
386 |
+
if ( !is_array( $value['data'] ) ) {
|
387 |
+
$value['data'] = explode( $separator, $value['data'] );
|
388 |
+
}
|
389 |
+
if ( $children ) {
|
390 |
+
$rightData = array();
|
391 |
+
foreach ( $value['data'] as $child ) {
|
392 |
+
if ( isset( $children[$child] ) && !in_array( $child, $rightData ) ) {
|
393 |
+
$rightData[] = $child;
|
|
|
394 |
}
|
395 |
}
|
396 |
+
return implode( $separator, $rightData );
|
|
|
|
|
|
|
|
|
397 |
}
|
398 |
}
|
399 |
|
402 |
*
|
403 |
* @param array $data
|
404 |
* @param string $separator
|
405 |
+
* @return string|null
|
406 |
*/
|
407 |
+
protected function get_separated_value_not_children_set( $key ) {
|
408 |
+
$separator = $this->get_separator_value( $key );
|
409 |
+
$value = $this->get_post_value_by_key( $key );
|
410 |
+
|
411 |
+
if ( !is_array( $value ) ) {
|
412 |
+
return;
|
413 |
+
}
|
414 |
+
if ( !isset( $value['data'] ) ) {
|
415 |
+
return;
|
416 |
+
}
|
417 |
+
if ( !$separator ) {
|
418 |
+
return;
|
419 |
+
}
|
420 |
+
|
421 |
+
if ( !is_array( $value['data'] ) ) {
|
422 |
+
$value['data'] = explode( $separator, $value['data'] );
|
423 |
+
}
|
424 |
+
|
425 |
+
foreach ( $value['data'] as $child ) {
|
426 |
if ( $child !== '' && $child !== null ) {
|
427 |
+
return implode( $separator, $value['data'] );
|
428 |
}
|
429 |
}
|
430 |
return '';
|
431 |
}
|
432 |
|
433 |
/**
|
434 |
+
* アップロードに失敗、もしくはファイルが削除されている key を UPLOAD_FILE_KEYS から削除
|
435 |
*/
|
436 |
public function set_upload_file_keys() {
|
437 |
+
$upload_file_keys = $this->get_post_value_by_key( MWF_Config::UPLOAD_FILE_KEYS );
|
438 |
if ( !$upload_file_keys ) {
|
439 |
$upload_file_keys = array();
|
440 |
}
|
441 |
|
442 |
$wp_upload_dir = wp_upload_dir();
|
443 |
+
foreach ( $upload_file_keys as $key => $upload_file_key ) {
|
444 |
+
$upload_file_url = $this->get_post_value_by_key( $upload_file_key );
|
445 |
if ( $upload_file_url ) {
|
446 |
$filepath = MWF_Functions::fileurl_to_path( $upload_file_url );
|
447 |
if ( !file_exists( $filepath ) ) {
|
448 |
+
unset( $upload_file_keys[$key] );
|
449 |
}
|
450 |
}
|
451 |
}
|
453 |
}
|
454 |
|
455 |
/**
|
456 |
+
* アップロードに成功したファイルを UPLOAD_FILE_KEYS に格納
|
457 |
+
*
|
458 |
* @param array $uploaded_files アップロード済みファイルのパスの配列
|
459 |
*/
|
460 |
public function push_uploaded_file_keys( array $uploaded_files = array() ) {
|
461 |
+
$upload_file_keys = $this->get_post_value_by_key( MWF_Config::UPLOAD_FILE_KEYS );
|
462 |
foreach ( $uploaded_files as $key => $upload_file ) {
|
463 |
$this->set( $key, $upload_file );
|
464 |
+
if ( is_array( $upload_file_keys ) && !in_array( $key, $upload_file_keys ) ) {
|
465 |
$this->push( MWF_Config::UPLOAD_FILE_KEYS, $key );
|
466 |
}
|
467 |
}
|
classes/models/class.error.php
CHANGED
@@ -12,15 +12,14 @@
|
|
12 |
class MW_WP_Form_Error {
|
13 |
|
14 |
/**
|
15 |
-
* $errors
|
16 |
* エラー格納用の配列
|
17 |
* @var array [key => rule = message]
|
18 |
*/
|
19 |
protected $errors = array();
|
20 |
|
21 |
/**
|
22 |
-
* set_error
|
23 |
* エラーメッセージをセット
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param string $rule
|
26 |
* @param string $message
|
@@ -31,8 +30,8 @@ class MW_WP_Form_Error {
|
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
-
* get_error
|
35 |
* エラーメッセージを返す
|
|
|
36 |
* @param string $key name属性
|
37 |
* @return array
|
38 |
*/
|
@@ -44,8 +43,8 @@ class MW_WP_Form_Error {
|
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
-
* get_errors
|
48 |
* 全てのエラーメッセージを返す
|
|
|
49 |
* @return array
|
50 |
*/
|
51 |
public function get_errors() {
|
12 |
class MW_WP_Form_Error {
|
13 |
|
14 |
/**
|
|
|
15 |
* エラー格納用の配列
|
16 |
* @var array [key => rule = message]
|
17 |
*/
|
18 |
protected $errors = array();
|
19 |
|
20 |
/**
|
|
|
21 |
* エラーメッセージをセット
|
22 |
+
*
|
23 |
* @param string $key name属性
|
24 |
* @param string $rule
|
25 |
* @param string $message
|
30 |
}
|
31 |
|
32 |
/**
|
|
|
33 |
* エラーメッセージを返す
|
34 |
+
*
|
35 |
* @param string $key name属性
|
36 |
* @return array
|
37 |
*/
|
43 |
}
|
44 |
|
45 |
/**
|
|
|
46 |
* 全てのエラーメッセージを返す
|
47 |
+
*
|
48 |
* @return array
|
49 |
*/
|
50 |
public function get_errors() {
|
classes/models/class.file.php
CHANGED
@@ -20,7 +20,8 @@ class MW_WP_Form_File {
|
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param array $t MIMEタイプの配列
|
25 |
*/
|
26 |
public function upload_mimes( $t ) {
|
@@ -31,8 +32,8 @@ class MW_WP_Form_File {
|
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
-
*
|
35 |
-
*
|
36 |
* @param array $files アップロードするファイルの配列
|
37 |
* @return array ( name属性値 => アップロードできたファイルのURL, … )
|
38 |
*/
|
@@ -48,12 +49,12 @@ class MW_WP_Form_File {
|
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
-
*
|
52 |
-
*
|
53 |
* @param string $key アップロードしたいファイルの name 属性
|
54 |
* @return string アップロードできたファイルのURL
|
55 |
*/
|
56 |
-
|
57 |
$this->create_temp_dir();
|
58 |
$this->clean_temp_dir();
|
59 |
|
@@ -65,8 +66,8 @@ class MW_WP_Form_File {
|
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
-
*
|
69 |
-
*
|
70 |
* @param arary $file $_FILES['hoge'] の配列
|
71 |
* @return string アップロードしたファイルの URL
|
72 |
*/
|
@@ -91,8 +92,8 @@ class MW_WP_Form_File {
|
|
91 |
}
|
92 |
|
93 |
/**
|
94 |
-
* set_upload_file_name
|
95 |
* 一時ファイル名を生成。Tempディレクトリの生成に失敗していた場合はUploadディレクトリを使用
|
|
|
96 |
* @param string 拡張子 ( ex: jpg )
|
97 |
* @return array ( file =>, url => )
|
98 |
*/
|
@@ -122,8 +123,8 @@ class MW_WP_Form_File {
|
|
122 |
}
|
123 |
|
124 |
/**
|
125 |
-
*
|
126 |
-
*
|
127 |
* @return array ( dir => Tempディレクトリのパス, url => Tempディレクトリのurl )
|
128 |
*/
|
129 |
public function get_temp_dir() {
|
@@ -135,8 +136,8 @@ class MW_WP_Form_File {
|
|
135 |
}
|
136 |
|
137 |
/**
|
138 |
-
*
|
139 |
-
*
|
140 |
* @return bool
|
141 |
*/
|
142 |
public function create_temp_dir() {
|
@@ -152,8 +153,8 @@ class MW_WP_Form_File {
|
|
152 |
}
|
153 |
|
154 |
/**
|
155 |
-
*
|
156 |
-
*
|
157 |
* @param string $sub_dir サブディレクトリ名
|
158 |
*/
|
159 |
public function remove_temp_dir( $sub_dir = '' ) {
|
@@ -185,7 +186,6 @@ class MW_WP_Form_File {
|
|
185 |
}
|
186 |
|
187 |
/**
|
188 |
-
* clean_temp_dir
|
189 |
* Tempディレクトリ内のファイルを削除
|
190 |
*/
|
191 |
protected function clean_temp_dir() {
|
@@ -211,7 +211,8 @@ class MW_WP_Form_File {
|
|
211 |
}
|
212 |
|
213 |
/**
|
214 |
-
*
|
|
|
215 |
* @param array $attachments 消去するファイルパスの配列
|
216 |
*/
|
217 |
public function delete_files( array $files ) {
|
@@ -221,4 +222,4 @@ class MW_WP_Form_File {
|
|
221 |
}
|
222 |
}
|
223 |
}
|
224 |
-
}
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
+
* 独自の mimes を追加
|
24 |
+
*
|
25 |
* @param array $t MIMEタイプの配列
|
26 |
*/
|
27 |
public function upload_mimes( $t ) {
|
32 |
}
|
33 |
|
34 |
/**
|
35 |
+
* 全てのファイルをアップロード
|
36 |
+
*
|
37 |
* @param array $files アップロードするファイルの配列
|
38 |
* @return array ( name属性値 => アップロードできたファイルのURL, … )
|
39 |
*/
|
49 |
}
|
50 |
|
51 |
/**
|
52 |
+
* 指定したファイルをアップロード
|
53 |
+
*
|
54 |
* @param string $key アップロードしたいファイルの name 属性
|
55 |
* @return string アップロードできたファイルのURL
|
56 |
*/
|
57 |
+
protected function single_file_upload( $key ) {
|
58 |
$this->create_temp_dir();
|
59 |
$this->clean_temp_dir();
|
60 |
|
66 |
}
|
67 |
|
68 |
/**
|
69 |
+
* ファイルアップロードの実処理
|
70 |
+
*
|
71 |
* @param arary $file $_FILES['hoge'] の配列
|
72 |
* @return string アップロードしたファイルの URL
|
73 |
*/
|
92 |
}
|
93 |
|
94 |
/**
|
|
|
95 |
* 一時ファイル名を生成。Tempディレクトリの生成に失敗していた場合はUploadディレクトリを使用
|
96 |
+
*
|
97 |
* @param string 拡張子 ( ex: jpg )
|
98 |
* @return array ( file =>, url => )
|
99 |
*/
|
123 |
}
|
124 |
|
125 |
/**
|
126 |
+
* Temp ディレクトリ名(パス、URL)を返す。ディレクトリの存在可否は関係なし
|
127 |
+
*
|
128 |
* @return array ( dir => Tempディレクトリのパス, url => Tempディレクトリのurl )
|
129 |
*/
|
130 |
public function get_temp_dir() {
|
136 |
}
|
137 |
|
138 |
/**
|
139 |
+
* Temp ディレクトリを作成
|
140 |
+
*
|
141 |
* @return bool
|
142 |
*/
|
143 |
public function create_temp_dir() {
|
153 |
}
|
154 |
|
155 |
/**
|
156 |
+
* Temp ディレクトリを削除
|
157 |
+
*
|
158 |
* @param string $sub_dir サブディレクトリ名
|
159 |
*/
|
160 |
public function remove_temp_dir( $sub_dir = '' ) {
|
186 |
}
|
187 |
|
188 |
/**
|
|
|
189 |
* Tempディレクトリ内のファイルを削除
|
190 |
*/
|
191 |
protected function clean_temp_dir() {
|
211 |
}
|
212 |
|
213 |
/**
|
214 |
+
* 指定したパスのファイルを削除
|
215 |
+
*
|
216 |
* @param array $attachments 消去するファイルパスの配列
|
217 |
*/
|
218 |
public function delete_files( array $files ) {
|
222 |
}
|
223 |
}
|
224 |
}
|
225 |
+
}
|
classes/models/class.form.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Form
|
4 |
* Description: フォームヘルパー
|
5 |
-
* Version : 1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : September 25, 2012
|
@@ -13,28 +13,18 @@
|
|
13 |
class MW_WP_Form_Form {
|
14 |
|
15 |
/**
|
16 |
-
* $Data
|
17 |
-
* @var MW_WP_Form_Data
|
18 |
-
*/
|
19 |
-
protected $Data;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* __construct
|
23 |
-
* 取得データを保存
|
24 |
-
* @param string $key 識別子
|
25 |
-
*/
|
26 |
-
public function __construct( MW_WP_Form_Data $Data ) {
|
27 |
-
$this->Data = $Data;
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* get_raw
|
32 |
* データを返す
|
|
|
33 |
* @param string $key name属性値
|
34 |
* @return mixed
|
35 |
*/
|
36 |
public function get_raw( $key ) {
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
|
40 |
/**
|
@@ -45,157 +35,150 @@ class MW_WP_Form_Form {
|
|
45 |
* @return string
|
46 |
*/
|
47 |
public function get_raw_in_children( $key, array $children ) {
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
/**
|
52 |
-
* get_zip_value
|
53 |
* データを返す ( 郵便番号用 )
|
|
|
54 |
* @param string $key name属性
|
55 |
* @return string データ
|
56 |
*/
|
57 |
public function get_zip_value( $key ) {
|
58 |
-
return $this->Data->get_separated_value( $key );
|
59 |
-
}
|
60 |
-
public function getZipValue( $key ) {
|
61 |
MWF_Functions::deprecated_message(
|
62 |
-
'
|
63 |
-
'
|
64 |
);
|
65 |
-
|
|
|
66 |
}
|
67 |
|
68 |
/**
|
69 |
-
* get_tel_value
|
70 |
* データを返す ( 電話番号用 )
|
|
|
71 |
* @param string $key name属性
|
72 |
* @return string データ
|
73 |
*/
|
74 |
public function get_tel_value( $key ) {
|
75 |
-
return $this->get_zip_value( $key );
|
76 |
-
}
|
77 |
-
public function getTelValue( $key ) {
|
78 |
MWF_Functions::deprecated_message(
|
79 |
-
'
|
80 |
-
'
|
81 |
);
|
82 |
-
|
|
|
83 |
}
|
84 |
|
85 |
/**
|
86 |
-
* get_checked_value
|
87 |
* データを返す( checkbox用 )。$dataに含まれる値のみ返す
|
|
|
88 |
* @param string $key name属性
|
89 |
* @param array $data
|
90 |
* @return string データ
|
91 |
*/
|
92 |
public function get_checked_value( $key, array $data ) {
|
93 |
-
return $this->Data->get_separated_value( $key, $data );
|
94 |
-
}
|
95 |
-
public function getCheckedValue() {
|
96 |
MWF_Functions::deprecated_message(
|
97 |
-
'
|
98 |
-
'
|
99 |
);
|
100 |
-
|
|
|
101 |
}
|
102 |
|
103 |
/**
|
104 |
-
* get_radio_value
|
105 |
* データを返す( radio用 )。$dataに含まれる値のみ返す
|
|
|
106 |
* @param string name属性値
|
107 |
* @param array $data データ
|
108 |
* @return string
|
109 |
*/
|
110 |
public function get_radio_value( $key, array $data ) {
|
111 |
-
return $this->Data->get_in_children( $key, $data );
|
112 |
-
}
|
113 |
-
public function getRadioValue( $key, array $data ) {
|
114 |
MWF_Functions::deprecated_message(
|
115 |
-
'
|
116 |
-
'
|
117 |
);
|
118 |
-
|
|
|
119 |
}
|
120 |
|
121 |
/**
|
122 |
-
* get_selected_value
|
123 |
* データを返す( selectbox用 )。$dataに含まれる値のみ返す
|
|
|
124 |
* @param string $key name属性
|
125 |
* @param array $data データ
|
126 |
* @return string データ
|
127 |
*/
|
128 |
public function get_selected_value( $key, array $data ) {
|
129 |
-
return $this->get_radio_value( $key, $data );
|
130 |
-
}
|
131 |
-
public function getSelectedValue( $key, array $data ) {
|
132 |
MWF_Functions::deprecated_message(
|
133 |
-
'
|
134 |
-
'
|
135 |
);
|
136 |
-
|
|
|
137 |
}
|
138 |
|
139 |
/**
|
140 |
-
* get_separated_raw_value
|
141 |
* 配列データを整形して返す ( チェックボックス等用 )。配列の場合はpost値を連結して返す
|
|
|
142 |
* @param string $key name属性
|
143 |
* @param array $children 選択肢
|
144 |
* @return string データ
|
145 |
*/
|
146 |
public function get_separated_raw_value( $key, array $children = array() ) {
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
149 |
|
150 |
/**
|
151 |
-
* separator
|
152 |
-
*
|
153 |
* @param string $key name属性
|
154 |
* @param string $separator 区切り文字
|
155 |
* @return string HTML
|
156 |
*/
|
157 |
-
public function separator( $key, $separator
|
158 |
-
$post_separator = $this->get_separator_value( $key );
|
159 |
-
if ( !$separator && $post_separator ) {
|
160 |
-
$separator = $post_separator;
|
161 |
-
}
|
162 |
if ( $separator ) {
|
163 |
return $this->hidden( $key . '[separator]', $separator );
|
164 |
}
|
165 |
}
|
166 |
|
167 |
/**
|
168 |
-
*
|
169 |
-
*
|
170 |
* @param string $key name属性
|
171 |
* @return string
|
172 |
*/
|
173 |
public function get_separator_value( $key ) {
|
174 |
-
return $this->Data->get_separator_value( $key );
|
175 |
-
}
|
176 |
-
public function getSeparatorValue() {
|
177 |
MWF_Functions::deprecated_message(
|
178 |
-
'
|
179 |
-
'
|
180 |
);
|
181 |
-
return $
|
182 |
}
|
183 |
|
184 |
/**
|
185 |
-
* children
|
186 |
-
*
|
187 |
* @param string $key name属性
|
188 |
* @param array $children 選択肢の配列(必ず MW_WP_Form_Abstract_Form_Field::get_children の値 )
|
189 |
* @return string HTML
|
190 |
*/
|
191 |
public function children( $key, array $children ) {
|
192 |
$name = sprintf( '__children[%s]', $key );
|
193 |
-
return $this->hidden( $name,
|
194 |
}
|
195 |
|
196 |
/**
|
197 |
-
* start
|
198 |
* フォームタグ生成
|
|
|
199 |
* @param array $options
|
200 |
* @return string form開始タグ
|
201 |
*/
|
@@ -213,8 +196,8 @@ class MW_WP_Form_Form {
|
|
213 |
}
|
214 |
|
215 |
/**
|
216 |
-
* end
|
217 |
* トークンタグ、閉じタグ生成
|
|
|
218 |
* @return string input[type=hidden]
|
219 |
*/
|
220 |
public function end() {
|
@@ -225,114 +208,92 @@ class MW_WP_Form_Form {
|
|
225 |
}
|
226 |
|
227 |
/**
|
228 |
-
* text
|
229 |
* input[type=text]タグ生成
|
|
|
230 |
* @param string $name name属性
|
231 |
* @param array
|
232 |
* @return string html
|
233 |
*/
|
234 |
public function text( $name, $options = array() ) {
|
235 |
$defaults = array(
|
236 |
-
'id' =>
|
237 |
'size' => 60,
|
238 |
'maxlength' => 255,
|
239 |
'value' => '',
|
240 |
-
'
|
241 |
-
'
|
242 |
);
|
243 |
$options = array_merge( $defaults, $options );
|
244 |
-
$
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
$placeholder = $this->get_attr_placeholder( $options['placeholder'] );
|
249 |
-
$dataConvHalfAlphanumeric = null;
|
250 |
-
if ( $options['conv-half-alphanumeric'] === true ) {
|
251 |
-
$dataConvHalfAlphanumeric = 'data-conv-half-alphanumeric="true"';
|
252 |
-
}
|
253 |
-
$id = $this->get_attr_id( $options['id'] );
|
254 |
-
return sprintf( '<input type="text" name="%s" value="%s" size="%d" maxlength="%d" %s %s %s />',
|
255 |
esc_attr( $name ),
|
256 |
-
|
257 |
-
esc_attr( $options['size'] ),
|
258 |
-
esc_attr( $options['maxlength'] ),
|
259 |
-
$placeholder,
|
260 |
-
$dataConvHalfAlphanumeric,
|
261 |
-
$id
|
262 |
);
|
263 |
}
|
264 |
|
265 |
/**
|
266 |
-
* hidden
|
267 |
* input[type=hidden]タグ生成
|
|
|
268 |
* @param string $name name属性
|
269 |
* @param string $value 値
|
270 |
* @return string HTML
|
271 |
*/
|
272 |
public function hidden( $name, $value ) {
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
}
|
279 |
-
return sprintf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $name ), esc_attr( $value ) );
|
280 |
}
|
281 |
|
282 |
/**
|
283 |
-
* password
|
284 |
* input[type=password]タグ生成
|
|
|
285 |
* @param string $name name属性
|
286 |
* @param array $options
|
287 |
* @return string HTML
|
288 |
*/
|
289 |
public function password( $name, $options = array() ) {
|
290 |
$defaults = array(
|
291 |
-
'id' =>
|
292 |
'size' => 60,
|
293 |
'maxlength' => 255,
|
294 |
'value' => '',
|
295 |
-
'placeholder' =>
|
296 |
);
|
297 |
$options = array_merge( $defaults, $options );
|
298 |
-
$
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
$placeholder = $this->get_attr_placeholder( $options['placeholder'] );
|
303 |
-
$id = $this->get_attr_id( $options['id'] );
|
304 |
-
return sprintf( '<input type="password" name="%s" value="%s" size="%d" maxlength="%d" %s %s />',
|
305 |
esc_attr( $name ),
|
306 |
-
|
307 |
-
esc_attr( $options['size'] ),
|
308 |
-
esc_attr( $options['maxlength'] ),
|
309 |
-
$placeholder,
|
310 |
-
$id
|
311 |
);
|
312 |
}
|
313 |
|
314 |
/**
|
315 |
-
* zip
|
316 |
* 郵便番号フィールド生成
|
|
|
317 |
* @param string $name name属性
|
318 |
* @param array $options
|
319 |
* @return string HTML
|
320 |
*/
|
321 |
public function zip( $name, $options = array() ) {
|
322 |
$defaults = array(
|
323 |
-
'conv-half-alphanumeric' =>
|
|
|
324 |
);
|
325 |
$options = array_merge( $defaults, $options );
|
326 |
|
327 |
-
$children
|
328 |
$separator = '-';
|
329 |
-
|
330 |
-
if (
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
$children = explode( $separator, $value['data'] );
|
335 |
-
}
|
336 |
}
|
337 |
|
338 |
$values = array( '', '' );
|
@@ -363,27 +324,26 @@ class MW_WP_Form_Form {
|
|
363 |
}
|
364 |
|
365 |
/**
|
366 |
-
* tel
|
367 |
* 電話番号フィールド生成
|
|
|
368 |
* @param string $name name属性
|
369 |
* @param array $options
|
370 |
* @return string HTML
|
371 |
*/
|
372 |
public function tel( $name, $options = array() ) {
|
373 |
$defaults = array(
|
374 |
-
'conv-half-alphanumeric' =>
|
|
|
375 |
);
|
376 |
$options = array_merge( $defaults, $options );
|
377 |
|
378 |
-
$children
|
379 |
$separator = '-';
|
380 |
-
|
381 |
-
if (
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
$children = explode( $separator, $value['data'] );
|
386 |
-
}
|
387 |
}
|
388 |
|
389 |
$values = array( '', '', '' );
|
@@ -420,40 +380,36 @@ class MW_WP_Form_Form {
|
|
420 |
}
|
421 |
|
422 |
/**
|
423 |
-
* textarea
|
424 |
* textareaタグ生成
|
|
|
425 |
* @param string $name name属性
|
426 |
* @param array $options
|
427 |
* @return string html
|
428 |
*/
|
429 |
public function textarea( $name, $options = array() ) {
|
430 |
$defaults = array(
|
431 |
-
'id' =>
|
432 |
'cols' => 50,
|
433 |
'rows' => 5,
|
434 |
'value' => '',
|
435 |
-
'placeholder' =>
|
436 |
);
|
437 |
$options = array_merge( $defaults, $options );
|
438 |
-
$
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
return sprintf( '<textarea name="%s" cols="%d" rows="%d" %s %s>%s</textarea>',
|
445 |
esc_attr( $name ),
|
446 |
-
|
447 |
-
|
448 |
-
$placeholder,
|
449 |
-
$id,
|
450 |
-
esc_html( $value )
|
451 |
);
|
452 |
}
|
453 |
|
454 |
/**
|
455 |
-
* select
|
456 |
* selectタグ生成
|
|
|
457 |
* @param string $name name属性
|
458 |
* @param array $children
|
459 |
* @param array $options
|
@@ -461,20 +417,26 @@ class MW_WP_Form_Form {
|
|
461 |
*/
|
462 |
public function select( $name, $children = array(), $options = array() ) {
|
463 |
$defaults = array(
|
464 |
-
'id' =>
|
465 |
-
'value' => ''
|
466 |
);
|
467 |
$options = array_merge( $defaults, $options );
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
$
|
473 |
-
|
|
|
|
|
|
|
|
|
474 |
foreach ( $children as $key => $_value ) {
|
475 |
-
$
|
476 |
-
|
477 |
-
esc_attr( $key ),
|
|
|
|
|
478 |
);
|
479 |
}
|
480 |
$_ret .= '</select>';
|
@@ -482,8 +444,8 @@ class MW_WP_Form_Form {
|
|
482 |
}
|
483 |
|
484 |
/**
|
485 |
-
* radio
|
486 |
* radioタグ生成
|
|
|
487 |
* @param string $name name属性
|
488 |
* @param array $children
|
489 |
* @param array $options
|
@@ -493,30 +455,29 @@ class MW_WP_Form_Form {
|
|
493 |
$defaults = array(
|
494 |
'id' => '',
|
495 |
'value' => '',
|
496 |
-
'vertically' =>
|
497 |
);
|
498 |
$options = array_merge( $defaults, $options );
|
499 |
-
$value = $this->get_raw( $name );
|
500 |
-
if ( is_null( $value ) ) {
|
501 |
-
$value = $options['value'];
|
502 |
-
}
|
503 |
|
504 |
-
$i
|
505 |
$_ret = '';
|
506 |
foreach ( $children as $key => $_value ) {
|
507 |
$i ++;
|
508 |
-
$id = $this->get_attr_id( $options['id'], $i );
|
509 |
-
$for = $this->get_attr_for( $options['id'], $i );
|
510 |
$vertically = ( $options['vertically'] === 'true' ) ? 'vertical-item' : '';
|
511 |
-
$
|
|
|
|
|
|
|
|
|
|
|
512 |
$_ret .= sprintf(
|
513 |
-
'<span class="%s"><label
|
514 |
$vertically,
|
515 |
-
$
|
516 |
esc_attr( $name ),
|
517 |
esc_attr( $key ),
|
518 |
-
$
|
519 |
-
$
|
520 |
esc_html( $_value )
|
521 |
);
|
522 |
}
|
@@ -524,8 +485,8 @@ class MW_WP_Form_Form {
|
|
524 |
}
|
525 |
|
526 |
/**
|
527 |
-
* checkbox
|
528 |
* checkboxタグ生成
|
|
|
529 |
* @param string $name name属性
|
530 |
* @param array $children
|
531 |
* @param array $options
|
@@ -535,41 +496,35 @@ class MW_WP_Form_Form {
|
|
535 |
public function checkbox( $name, $children = array(), $options = array(), $separator = ',' ) {
|
536 |
$defaults = array(
|
537 |
'id' => '',
|
538 |
-
'value' =>
|
539 |
-
'vertically' =>
|
540 |
);
|
541 |
$options = array_merge( $defaults, $options );
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
if ( !is_array( $value ) ) {
|
547 |
-
$value = explode( $separator, $value );
|
548 |
-
}
|
549 |
-
} else {
|
550 |
-
$value = $options['value'];
|
551 |
-
// 最初の画面(post無し)の場合は、管理画面上で children が,区切りとなっている
|
552 |
-
if ( !is_array( $value ) ) {
|
553 |
-
$value = explode( ',', $value );
|
554 |
-
}
|
555 |
}
|
556 |
|
557 |
-
$i
|
558 |
$_ret = '';
|
559 |
foreach ( $children as $key => $_value ) {
|
560 |
$i ++;
|
561 |
-
$id = $this->get_attr_id( $options['id'], $i );
|
562 |
-
$for = $this->get_attr_for( $options['id'], $i );
|
563 |
$vertically = ( $options['vertically'] === 'true' ) ? 'vertical-item' : '';
|
564 |
-
$
|
|
|
|
|
|
|
|
|
|
|
565 |
$_ret .= sprintf(
|
566 |
-
'<span class="%s"><label
|
567 |
$vertically,
|
568 |
-
$
|
569 |
esc_attr( $name . '[data][]' ),
|
570 |
esc_attr( $key ),
|
571 |
-
$
|
572 |
-
$
|
573 |
esc_html( $_value )
|
574 |
);
|
575 |
}
|
@@ -578,63 +533,70 @@ class MW_WP_Form_Form {
|
|
578 |
}
|
579 |
|
580 |
/**
|
581 |
-
* submit
|
582 |
* submitボタン生成
|
|
|
583 |
* @param string $name name属性
|
584 |
* @param string $value value属性
|
585 |
* @return string submitボタン
|
586 |
*/
|
587 |
public function submit( $name, $value ) {
|
588 |
-
return sprintf(
|
|
|
|
|
|
|
|
|
589 |
}
|
590 |
|
591 |
/**
|
592 |
-
* button
|
593 |
* ボタン生成
|
|
|
594 |
* @param string $name name属性
|
595 |
* @param string $value value属性
|
596 |
* @return string ボタン
|
597 |
*/
|
598 |
public function button( $name, $value ) {
|
599 |
-
return sprintf(
|
|
|
|
|
|
|
|
|
600 |
}
|
601 |
|
602 |
/**
|
603 |
-
* datepicker
|
604 |
* datepicker生成
|
|
|
605 |
* @param string $name name属性
|
606 |
* @param string $options
|
607 |
* @return string HTML
|
608 |
*/
|
609 |
public function datepicker( $name, $options = array() ) {
|
610 |
$defaults = array(
|
611 |
-
'id' =>
|
612 |
'size' => 30,
|
613 |
'js' => '',
|
614 |
'value' => '',
|
615 |
);
|
616 |
$options = array_merge( $defaults, $options );
|
617 |
-
$
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
$
|
622 |
-
|
623 |
-
esc_attr( $name ),
|
|
|
624 |
);
|
625 |
$_ret .= sprintf(
|
626 |
-
'<script type="text/javascript">
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
</script>'
|
631 |
-
, esc_html( $name ), $options['js'] );
|
632 |
return $_ret;
|
633 |
}
|
634 |
|
635 |
/**
|
636 |
-
* file
|
637 |
* input[type=file]タグ生成
|
|
|
638 |
* @param string $name name属性
|
639 |
* @param $options array
|
640 |
* @return string HTML
|
@@ -643,68 +605,48 @@ class MW_WP_Form_Form {
|
|
643 |
$defaults = array(
|
644 |
'id' => '',
|
645 |
);
|
646 |
-
$id = $this->get_attr_id( $options['id'] );
|
647 |
$options = array_merge( $defaults, $options );
|
648 |
-
|
649 |
-
|
|
|
|
|
|
|
|
|
650 |
);
|
651 |
}
|
652 |
|
653 |
/**
|
654 |
-
*
|
655 |
-
*
|
656 |
-
* @param
|
657 |
-
* @param string $suffix
|
658 |
-
* @return string id="hoge"
|
659 |
*/
|
660 |
-
protected function
|
661 |
-
|
662 |
-
|
663 |
-
|
|
|
664 |
}
|
665 |
-
|
|
|
|
|
|
|
|
|
666 |
}
|
667 |
}
|
668 |
|
669 |
/**
|
670 |
-
*
|
671 |
-
*
|
672 |
* @param string $id
|
673 |
* @param string $suffix
|
674 |
-
* @return string
|
675 |
*/
|
676 |
-
protected function
|
677 |
-
if ( !
|
678 |
if ( $suffix ) {
|
679 |
$id .= '-' . $suffix;
|
680 |
}
|
681 |
-
return
|
682 |
-
}
|
683 |
-
}
|
684 |
-
|
685 |
-
/**
|
686 |
-
* get_attr_placeholder
|
687 |
-
* placeholder属性を返す
|
688 |
-
* @param string $placeholder
|
689 |
-
* @return string placeholder="hoge"
|
690 |
-
*/
|
691 |
-
protected function get_attr_placeholder( $placeholder ) {
|
692 |
-
if ( !empty( $placeholder ) ) {
|
693 |
-
return 'placeholder="' . esc_attr( $placeholder ) . '"';
|
694 |
}
|
695 |
}
|
696 |
-
|
697 |
-
/**
|
698 |
-
* getValue
|
699 |
-
* データを返す
|
700 |
-
* @param string $key name属性値
|
701 |
-
* @return mixed
|
702 |
-
*/
|
703 |
-
public function getValue( $key ) {
|
704 |
-
MWF_Functions::deprecated_message(
|
705 |
-
'MW_Form::getValue()',
|
706 |
-
'MW_WP_Form_Form::get_raw()'
|
707 |
-
);
|
708 |
-
return $this->Data->get_raw( $key );
|
709 |
-
}
|
710 |
}
|
2 |
/**
|
3 |
* Name : MW WP Form Form
|
4 |
* Description: フォームヘルパー
|
5 |
+
* Version : 1.6.0
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : September 25, 2012
|
13 |
class MW_WP_Form_Form {
|
14 |
|
15 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
* データを返す
|
17 |
+
*
|
18 |
* @param string $key name属性値
|
19 |
* @return mixed
|
20 |
*/
|
21 |
public function get_raw( $key ) {
|
22 |
+
MWF_Functions::deprecated_message(
|
23 |
+
'MW_WP_Form_Form::get_raw()',
|
24 |
+
'MW_WP_Form_Data::get_raw()'
|
25 |
+
);
|
26 |
+
$Data = MW_WP_Form_Data::getInstance( null );
|
27 |
+
return $Data->get_raw( $key );
|
28 |
}
|
29 |
|
30 |
/**
|
35 |
* @return string
|
36 |
*/
|
37 |
public function get_raw_in_children( $key, array $children ) {
|
38 |
+
MWF_Functions::deprecated_message(
|
39 |
+
'MW_WP_Form_Form::get_raw_in_children()',
|
40 |
+
'MW_WP_Form_Data::get_raw_in_children()'
|
41 |
+
);
|
42 |
+
$Data = MW_WP_Form_Data::getInstance( null );
|
43 |
+
return $Data->get_raw_in_children( $key, $children );
|
44 |
}
|
45 |
|
46 |
/**
|
|
|
47 |
* データを返す ( 郵便番号用 )
|
48 |
+
*
|
49 |
* @param string $key name属性
|
50 |
* @return string データ
|
51 |
*/
|
52 |
public function get_zip_value( $key ) {
|
|
|
|
|
|
|
53 |
MWF_Functions::deprecated_message(
|
54 |
+
'MW_WP_Form_Form::get_zip_value()',
|
55 |
+
'MW_WP_Form_Data::get_separated_value()'
|
56 |
);
|
57 |
+
$Data = MW_WP_Form_Data::getInstance( null );
|
58 |
+
return $Data->get_separated_value( $key );
|
59 |
}
|
60 |
|
61 |
/**
|
|
|
62 |
* データを返す ( 電話番号用 )
|
63 |
+
*
|
64 |
* @param string $key name属性
|
65 |
* @return string データ
|
66 |
*/
|
67 |
public function get_tel_value( $key ) {
|
|
|
|
|
|
|
68 |
MWF_Functions::deprecated_message(
|
69 |
+
'MW_WP_Form_Form::get_tel_value()',
|
70 |
+
'MW_WP_Form_Data::get_separated_value()'
|
71 |
);
|
72 |
+
$Data = MW_WP_Form_Data::getInstance( null );
|
73 |
+
return $Data->get_separated_value( $key );
|
74 |
}
|
75 |
|
76 |
/**
|
|
|
77 |
* データを返す( checkbox用 )。$dataに含まれる値のみ返す
|
78 |
+
*
|
79 |
* @param string $key name属性
|
80 |
* @param array $data
|
81 |
* @return string データ
|
82 |
*/
|
83 |
public function get_checked_value( $key, array $data ) {
|
|
|
|
|
|
|
84 |
MWF_Functions::deprecated_message(
|
85 |
+
'MW_WP_Form_Form::get_checked_value()',
|
86 |
+
'MW_WP_Form_Data::get_separated_value()'
|
87 |
);
|
88 |
+
$Data = MW_WP_Form_Data::getInstance( null );
|
89 |
+
return $Data->get_separated_value( $key, $data );
|
90 |
}
|
91 |
|
92 |
/**
|
|
|
93 |
* データを返す( radio用 )。$dataに含まれる値のみ返す
|
94 |
+
*
|
95 |
* @param string name属性値
|
96 |
* @param array $data データ
|
97 |
* @return string
|
98 |
*/
|
99 |
public function get_radio_value( $key, array $data ) {
|
|
|
|
|
|
|
100 |
MWF_Functions::deprecated_message(
|
101 |
+
'MW_WP_Form_Form::get_radio_value()',
|
102 |
+
'MW_WP_Form_Data::get_in_children()'
|
103 |
);
|
104 |
+
$Data = MW_WP_Form_Data::getInstance( null );
|
105 |
+
return $Data->get_in_children( $key, $data );
|
106 |
}
|
107 |
|
108 |
/**
|
|
|
109 |
* データを返す( selectbox用 )。$dataに含まれる値のみ返す
|
110 |
+
*
|
111 |
* @param string $key name属性
|
112 |
* @param array $data データ
|
113 |
* @return string データ
|
114 |
*/
|
115 |
public function get_selected_value( $key, array $data ) {
|
|
|
|
|
|
|
116 |
MWF_Functions::deprecated_message(
|
117 |
+
'MW_WP_Form_Form::get_selected_value()',
|
118 |
+
'MW_WP_Form_Data::get_in_children()'
|
119 |
);
|
120 |
+
$Data = MW_WP_Form_Data::getInstance( null );
|
121 |
+
return $Data->get_in_children( $key, $data );
|
122 |
}
|
123 |
|
124 |
/**
|
|
|
125 |
* 配列データを整形して返す ( チェックボックス等用 )。配列の場合はpost値を連結して返す
|
126 |
+
*
|
127 |
* @param string $key name属性
|
128 |
* @param array $children 選択肢
|
129 |
* @return string データ
|
130 |
*/
|
131 |
public function get_separated_raw_value( $key, array $children = array() ) {
|
132 |
+
MWF_Functions::deprecated_message(
|
133 |
+
'MW_WP_Form_Form::get_separated_raw_value()',
|
134 |
+
'MW_WP_Form_Data::get_separated_raw_value()'
|
135 |
+
);
|
136 |
+
$Data = MW_WP_Form_Data::getInstance( null );
|
137 |
+
return $Data->get_separated_raw_value( $key, $children );
|
138 |
}
|
139 |
|
140 |
/**
|
141 |
+
* separator を設定するためのhiddenを返す
|
142 |
+
*
|
143 |
* @param string $key name属性
|
144 |
* @param string $separator 区切り文字
|
145 |
* @return string HTML
|
146 |
*/
|
147 |
+
public function separator( $key, $separator ) {
|
|
|
|
|
|
|
|
|
148 |
if ( $separator ) {
|
149 |
return $this->hidden( $key . '[separator]', $separator );
|
150 |
}
|
151 |
}
|
152 |
|
153 |
/**
|
154 |
+
* 送られてきた separator を返す
|
155 |
+
*
|
156 |
* @param string $key name属性
|
157 |
* @return string
|
158 |
*/
|
159 |
public function get_separator_value( $key ) {
|
|
|
|
|
|
|
160 |
MWF_Functions::deprecated_message(
|
161 |
+
'MW_WP_Form_Form::get_separator_value()',
|
162 |
+
'MW_WP_Form_Data::get_separator_value()'
|
163 |
);
|
164 |
+
return $Data->get_separator_value( $key );
|
165 |
}
|
166 |
|
167 |
/**
|
168 |
+
* children を設定するための hidden を返す
|
169 |
+
*
|
170 |
* @param string $key name属性
|
171 |
* @param array $children 選択肢の配列(必ず MW_WP_Form_Abstract_Form_Field::get_children の値 )
|
172 |
* @return string HTML
|
173 |
*/
|
174 |
public function children( $key, array $children ) {
|
175 |
$name = sprintf( '__children[%s]', $key );
|
176 |
+
return $this->hidden( $name, json_encode( $children ) );
|
177 |
}
|
178 |
|
179 |
/**
|
|
|
180 |
* フォームタグ生成
|
181 |
+
*
|
182 |
* @param array $options
|
183 |
* @return string form開始タグ
|
184 |
*/
|
196 |
}
|
197 |
|
198 |
/**
|
|
|
199 |
* トークンタグ、閉じタグ生成
|
200 |
+
*
|
201 |
* @return string input[type=hidden]
|
202 |
*/
|
203 |
public function end() {
|
208 |
}
|
209 |
|
210 |
/**
|
|
|
211 |
* input[type=text]タグ生成
|
212 |
+
*
|
213 |
* @param string $name name属性
|
214 |
* @param array
|
215 |
* @return string html
|
216 |
*/
|
217 |
public function text( $name, $options = array() ) {
|
218 |
$defaults = array(
|
219 |
+
'id' => null,
|
220 |
'size' => 60,
|
221 |
'maxlength' => 255,
|
222 |
'value' => '',
|
223 |
+
'placeholder' => null,
|
224 |
+
'conv-half-alphanumeric' => null,
|
225 |
);
|
226 |
$options = array_merge( $defaults, $options );
|
227 |
+
$attributes = $this->generate_attributes( $options );
|
228 |
+
|
229 |
+
return sprintf(
|
230 |
+
'<input type="text" name="%s"%s />',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
esc_attr( $name ),
|
232 |
+
$attributes
|
|
|
|
|
|
|
|
|
|
|
233 |
);
|
234 |
}
|
235 |
|
236 |
/**
|
|
|
237 |
* input[type=hidden]タグ生成
|
238 |
+
*
|
239 |
* @param string $name name属性
|
240 |
* @param string $value 値
|
241 |
* @return string HTML
|
242 |
*/
|
243 |
public function hidden( $name, $value ) {
|
244 |
+
return sprintf(
|
245 |
+
'<input type="hidden" name="%s" value="%s" />',
|
246 |
+
esc_attr( $name ),
|
247 |
+
esc_attr( $value )
|
248 |
+
);
|
|
|
|
|
249 |
}
|
250 |
|
251 |
/**
|
|
|
252 |
* input[type=password]タグ生成
|
253 |
+
*
|
254 |
* @param string $name name属性
|
255 |
* @param array $options
|
256 |
* @return string HTML
|
257 |
*/
|
258 |
public function password( $name, $options = array() ) {
|
259 |
$defaults = array(
|
260 |
+
'id' => null,
|
261 |
'size' => 60,
|
262 |
'maxlength' => 255,
|
263 |
'value' => '',
|
264 |
+
'placeholder' => null,
|
265 |
);
|
266 |
$options = array_merge( $defaults, $options );
|
267 |
+
$attributes = $this->generate_attributes( $options );
|
268 |
+
|
269 |
+
return sprintf(
|
270 |
+
'<input type="password" name="%s"%s />',
|
|
|
|
|
|
|
271 |
esc_attr( $name ),
|
272 |
+
$attributes
|
|
|
|
|
|
|
|
|
273 |
);
|
274 |
}
|
275 |
|
276 |
/**
|
|
|
277 |
* 郵便番号フィールド生成
|
278 |
+
*
|
279 |
* @param string $name name属性
|
280 |
* @param array $options
|
281 |
* @return string HTML
|
282 |
*/
|
283 |
public function zip( $name, $options = array() ) {
|
284 |
$defaults = array(
|
285 |
+
'conv-half-alphanumeric' => null,
|
286 |
+
'value' => '',
|
287 |
);
|
288 |
$options = array_merge( $defaults, $options );
|
289 |
|
290 |
+
$children = array();
|
291 |
$separator = '-';
|
292 |
+
|
293 |
+
if ( is_array( $options['value'] ) ) {
|
294 |
+
$children = $options['value'];
|
295 |
+
} else {
|
296 |
+
$children = explode( $separator, $options['value'] );
|
|
|
|
|
297 |
}
|
298 |
|
299 |
$values = array( '', '' );
|
324 |
}
|
325 |
|
326 |
/**
|
|
|
327 |
* 電話番号フィールド生成
|
328 |
+
*
|
329 |
* @param string $name name属性
|
330 |
* @param array $options
|
331 |
* @return string HTML
|
332 |
*/
|
333 |
public function tel( $name, $options = array() ) {
|
334 |
$defaults = array(
|
335 |
+
'conv-half-alphanumeric' => null,
|
336 |
+
'value' => '',
|
337 |
);
|
338 |
$options = array_merge( $defaults, $options );
|
339 |
|
340 |
+
$children = array();
|
341 |
$separator = '-';
|
342 |
+
|
343 |
+
if ( is_array( $options['value'] ) ) {
|
344 |
+
$children = $options['value'];
|
345 |
+
} else {
|
346 |
+
$children = explode( $separator, $options['value'] );
|
|
|
|
|
347 |
}
|
348 |
|
349 |
$values = array( '', '', '' );
|
380 |
}
|
381 |
|
382 |
/**
|
|
|
383 |
* textareaタグ生成
|
384 |
+
*
|
385 |
* @param string $name name属性
|
386 |
* @param array $options
|
387 |
* @return string html
|
388 |
*/
|
389 |
public function textarea( $name, $options = array() ) {
|
390 |
$defaults = array(
|
391 |
+
'id' => null,
|
392 |
'cols' => 50,
|
393 |
'rows' => 5,
|
394 |
'value' => '',
|
395 |
+
'placeholder' => null,
|
396 |
);
|
397 |
$options = array_merge( $defaults, $options );
|
398 |
+
$_options = $options;
|
399 |
+
unset( $_options['value'] );
|
400 |
+
$attributes = $this->generate_attributes( $_options );
|
401 |
+
|
402 |
+
return sprintf(
|
403 |
+
'<textarea name="%s"%s>%s</textarea>',
|
|
|
404 |
esc_attr( $name ),
|
405 |
+
$attributes,
|
406 |
+
esc_html( $options['value'] )
|
|
|
|
|
|
|
407 |
);
|
408 |
}
|
409 |
|
410 |
/**
|
|
|
411 |
* selectタグ生成
|
412 |
+
*
|
413 |
* @param string $name name属性
|
414 |
* @param array $children
|
415 |
* @param array $options
|
417 |
*/
|
418 |
public function select( $name, $children = array(), $options = array() ) {
|
419 |
$defaults = array(
|
420 |
+
'id' => null,
|
421 |
+
'value' => '',
|
422 |
);
|
423 |
$options = array_merge( $defaults, $options );
|
424 |
+
|
425 |
+
$attributes = $this->generate_attributes( array(
|
426 |
+
'id' => $options['id'],
|
427 |
+
) );
|
428 |
+
$_ret = sprintf(
|
429 |
+
'<select name="%s"%s>',
|
430 |
+
esc_attr( $name ),
|
431 |
+
$attributes
|
432 |
+
);
|
433 |
+
|
434 |
foreach ( $children as $key => $_value ) {
|
435 |
+
$_ret .= sprintf(
|
436 |
+
'<option value="%s" %s>%s</option>',
|
437 |
+
esc_attr( $key ),
|
438 |
+
selected( $key, $options['value'], false ),
|
439 |
+
esc_html( $_value )
|
440 |
);
|
441 |
}
|
442 |
$_ret .= '</select>';
|
444 |
}
|
445 |
|
446 |
/**
|
|
|
447 |
* radioタグ生成
|
448 |
+
*
|
449 |
* @param string $name name属性
|
450 |
* @param array $children
|
451 |
* @param array $options
|
455 |
$defaults = array(
|
456 |
'id' => '',
|
457 |
'value' => '',
|
458 |
+
'vertically' => null,
|
459 |
);
|
460 |
$options = array_merge( $defaults, $options );
|
|
|
|
|
|
|
|
|
461 |
|
462 |
+
$i = 0;
|
463 |
$_ret = '';
|
464 |
foreach ( $children as $key => $_value ) {
|
465 |
$i ++;
|
|
|
|
|
466 |
$vertically = ( $options['vertically'] === 'true' ) ? 'vertical-item' : '';
|
467 |
+
$attributes_for_label = $this->generate_attributes( array(
|
468 |
+
'for' => $this->get_attr_id( $options['id'], $i ),
|
469 |
+
) );
|
470 |
+
$attributes = $this->generate_attributes( array(
|
471 |
+
'id' => $this->get_attr_id( $options['id'], $i ),
|
472 |
+
) );
|
473 |
$_ret .= sprintf(
|
474 |
+
'<span class="%s"><label%s><input type="radio" name="%s" value="%s"%s %s />%s</label></span>',
|
475 |
$vertically,
|
476 |
+
$attributes_for_label,
|
477 |
esc_attr( $name ),
|
478 |
esc_attr( $key ),
|
479 |
+
checked( $key, $options['value'], false ),
|
480 |
+
$attributes,
|
481 |
esc_html( $_value )
|
482 |
);
|
483 |
}
|
485 |
}
|
486 |
|
487 |
/**
|
|
|
488 |
* checkboxタグ生成
|
489 |
+
*
|
490 |
* @param string $name name属性
|
491 |
* @param array $children
|
492 |
* @param array $options
|
496 |
public function checkbox( $name, $children = array(), $options = array(), $separator = ',' ) {
|
497 |
$defaults = array(
|
498 |
'id' => '',
|
499 |
+
'value' => '',
|
500 |
+
'vertically' => null,
|
501 |
);
|
502 |
$options = array_merge( $defaults, $options );
|
503 |
+
|
504 |
+
$value = $options['value'];
|
505 |
+
if ( !is_array( $options['value'] ) ) {
|
506 |
+
$value = explode( $separator, $options['value'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
}
|
508 |
|
509 |
+
$i = 0;
|
510 |
$_ret = '';
|
511 |
foreach ( $children as $key => $_value ) {
|
512 |
$i ++;
|
|
|
|
|
513 |
$vertically = ( $options['vertically'] === 'true' ) ? 'vertical-item' : '';
|
514 |
+
$attributes_for_label = $this->generate_attributes( array(
|
515 |
+
'for' => $this->get_attr_id( $options['id'], $i ),
|
516 |
+
) );
|
517 |
+
$attributes = $this->generate_attributes( array(
|
518 |
+
'id' => $this->get_attr_id( $options['id'], $i ),
|
519 |
+
) );
|
520 |
$_ret .= sprintf(
|
521 |
+
'<span class="%s"><label%s><input type="checkbox" name="%s" value="%s"%s %s />%s</label></span>',
|
522 |
$vertically,
|
523 |
+
$attributes_for_label,
|
524 |
esc_attr( $name . '[data][]' ),
|
525 |
esc_attr( $key ),
|
526 |
+
$attributes,
|
527 |
+
checked( ( is_array( $value ) && in_array( $key, $value ) ), true, false ),
|
528 |
esc_html( $_value )
|
529 |
);
|
530 |
}
|
533 |
}
|
534 |
|
535 |
/**
|
|
|
536 |
* submitボタン生成
|
537 |
+
*
|
538 |
* @param string $name name属性
|
539 |
* @param string $value value属性
|
540 |
* @return string submitボタン
|
541 |
*/
|
542 |
public function submit( $name, $value ) {
|
543 |
+
return sprintf(
|
544 |
+
'<input type="submit" name="%s" value="%s" />',
|
545 |
+
esc_attr( $name ),
|
546 |
+
esc_attr( $value )
|
547 |
+
);
|
548 |
}
|
549 |
|
550 |
/**
|
|
|
551 |
* ボタン生成
|
552 |
+
*
|
553 |
* @param string $name name属性
|
554 |
* @param string $value value属性
|
555 |
* @return string ボタン
|
556 |
*/
|
557 |
public function button( $name, $value ) {
|
558 |
+
return sprintf(
|
559 |
+
'<input type="button" name="%s" value="%s" />',
|
560 |
+
esc_attr( $name ),
|
561 |
+
esc_attr( $value )
|
562 |
+
);
|
563 |
}
|
564 |
|
565 |
/**
|
|
|
566 |
* datepicker生成
|
567 |
+
*
|
568 |
* @param string $name name属性
|
569 |
* @param string $options
|
570 |
* @return string HTML
|
571 |
*/
|
572 |
public function datepicker( $name, $options = array() ) {
|
573 |
$defaults = array(
|
574 |
+
'id' => null,
|
575 |
'size' => 30,
|
576 |
'js' => '',
|
577 |
'value' => '',
|
578 |
);
|
579 |
$options = array_merge( $defaults, $options );
|
580 |
+
$_options = $options;
|
581 |
+
unset( $_options['js'] );
|
582 |
+
$attributes = $this->generate_attributes( $_options );
|
583 |
+
|
584 |
+
$_ret = sprintf(
|
585 |
+
'<input type="text" name="%s"%s />',
|
586 |
+
esc_attr( $name ),
|
587 |
+
$attributes
|
588 |
);
|
589 |
$_ret .= sprintf(
|
590 |
+
'<script type="text/javascript">jQuery( function( $ ) { $("input[name=\'%s\']").datepicker( { %s } ); } );</script>',
|
591 |
+
esc_js( $name ),
|
592 |
+
$options['js']
|
593 |
+
);
|
|
|
|
|
594 |
return $_ret;
|
595 |
}
|
596 |
|
597 |
/**
|
|
|
598 |
* input[type=file]タグ生成
|
599 |
+
*
|
600 |
* @param string $name name属性
|
601 |
* @param $options array
|
602 |
* @return string HTML
|
605 |
$defaults = array(
|
606 |
'id' => '',
|
607 |
);
|
|
|
608 |
$options = array_merge( $defaults, $options );
|
609 |
+
$attributes = $this->generate_attributes( $options );
|
610 |
+
|
611 |
+
return sprintf(
|
612 |
+
'<input type="file" name="%s" /><span data-mwform-file-delete="%1$s" class="mwform-file-delete">×</span>',
|
613 |
+
esc_attr( $name ),
|
614 |
+
$attributes
|
615 |
);
|
616 |
}
|
617 |
|
618 |
/**
|
619 |
+
* タグの属性を最適化して生成する
|
620 |
+
*
|
621 |
+
* @param array $_attributes キーが属性名、要素が属性値の配列。要素が null のときは無視する
|
|
|
|
|
622 |
*/
|
623 |
+
protected function generate_attributes( array $_attributes ) {
|
624 |
+
$attributes = array();
|
625 |
+
foreach ( $_attributes as $key => $value ) {
|
626 |
+
if ( is_null( $value ) ) {
|
627 |
+
continue;
|
628 |
}
|
629 |
+
$attributes[] = sprintf( '%s="%s"', $key, esc_attr( $value ) );
|
630 |
+
}
|
631 |
+
$attributes = implode( ' ', $attributes );
|
632 |
+
if ( $attributes ) {
|
633 |
+
return ' ' . $attributes;
|
634 |
}
|
635 |
}
|
636 |
|
637 |
/**
|
638 |
+
* id属性を返す
|
639 |
+
*
|
640 |
* @param string $id
|
641 |
* @param string $suffix
|
642 |
+
* @return string
|
643 |
*/
|
644 |
+
protected function get_attr_id( $id, $suffix = '' ) {
|
645 |
+
if ( !MWF_Functions::is_empty( $id ) ) {
|
646 |
if ( $suffix ) {
|
647 |
$id .= '-' . $suffix;
|
648 |
}
|
649 |
+
return $id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
650 |
}
|
651 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
}
|
classes/models/class.mail.php
CHANGED
@@ -13,63 +13,54 @@
|
|
13 |
class MW_WP_Form_Mail {
|
14 |
|
15 |
/**
|
16 |
-
* $to
|
17 |
* 宛先
|
18 |
* @var string
|
19 |
*/
|
20 |
public $to;
|
21 |
|
22 |
/**
|
23 |
-
* $cc
|
24 |
* CC
|
25 |
* @var string
|
26 |
*/
|
27 |
public $cc;
|
28 |
|
29 |
/**
|
30 |
-
* $bcc
|
31 |
* BCC
|
32 |
* @var string
|
33 |
*/
|
34 |
public $bcc;
|
35 |
|
36 |
/**
|
37 |
-
* $from
|
38 |
* 送信元
|
39 |
* @var string
|
40 |
*/
|
41 |
public $from;
|
42 |
|
43 |
/**
|
44 |
-
* $sender
|
45 |
* 送信者
|
46 |
* @var string
|
47 |
*/
|
48 |
public $sender;
|
49 |
|
50 |
/**
|
51 |
-
* $subject
|
52 |
* 件名
|
53 |
* @var string
|
54 |
*/
|
55 |
public $subject;
|
56 |
|
57 |
/**
|
58 |
-
* $body
|
59 |
* 本文
|
60 |
* @var string
|
61 |
*/
|
62 |
public $body;
|
63 |
|
64 |
/**
|
65 |
-
* $attachments
|
66 |
* 添付
|
67 |
* @var array
|
68 |
*/
|
69 |
public $attachments = array();
|
70 |
|
71 |
/**
|
72 |
-
* send
|
73 |
* メール送信
|
74 |
*/
|
75 |
public function send() {
|
@@ -123,7 +114,8 @@ class MW_WP_Form_Mail {
|
|
123 |
}
|
124 |
|
125 |
/**
|
126 |
-
*
|
|
|
127 |
* @param string $email fromメールアドレス
|
128 |
* @return string
|
129 |
*/
|
@@ -132,7 +124,8 @@ class MW_WP_Form_Mail {
|
|
132 |
}
|
133 |
|
134 |
/**
|
135 |
-
*
|
|
|
136 |
* @param string $sender 送信者名
|
137 |
* @return string
|
138 |
*/
|
@@ -141,7 +134,8 @@ class MW_WP_Form_Mail {
|
|
141 |
}
|
142 |
|
143 |
/**
|
144 |
-
*
|
|
|
145 |
* @param phpmailer $phpmailer
|
146 |
*/
|
147 |
public function set_return_path( $phpmailer ) {
|
@@ -149,8 +143,8 @@ class MW_WP_Form_Mail {
|
|
149 |
}
|
150 |
|
151 |
/**
|
152 |
-
* createBody
|
153 |
* 配列からbodyを生成
|
|
|
154 |
* @param array ( 見出し => 内容, … )
|
155 |
* @param array ( 'exclude' => array( 除外したいキー1, … ) )
|
156 |
* @return string メール本文
|
13 |
class MW_WP_Form_Mail {
|
14 |
|
15 |
/**
|
|
|
16 |
* 宛先
|
17 |
* @var string
|
18 |
*/
|
19 |
public $to;
|
20 |
|
21 |
/**
|
|
|
22 |
* CC
|
23 |
* @var string
|
24 |
*/
|
25 |
public $cc;
|
26 |
|
27 |
/**
|
|
|
28 |
* BCC
|
29 |
* @var string
|
30 |
*/
|
31 |
public $bcc;
|
32 |
|
33 |
/**
|
|
|
34 |
* 送信元
|
35 |
* @var string
|
36 |
*/
|
37 |
public $from;
|
38 |
|
39 |
/**
|
|
|
40 |
* 送信者
|
41 |
* @var string
|
42 |
*/
|
43 |
public $sender;
|
44 |
|
45 |
/**
|
|
|
46 |
* 件名
|
47 |
* @var string
|
48 |
*/
|
49 |
public $subject;
|
50 |
|
51 |
/**
|
|
|
52 |
* 本文
|
53 |
* @var string
|
54 |
*/
|
55 |
public $body;
|
56 |
|
57 |
/**
|
|
|
58 |
* 添付
|
59 |
* @var array
|
60 |
*/
|
61 |
public $attachments = array();
|
62 |
|
63 |
/**
|
|
|
64 |
* メール送信
|
65 |
*/
|
66 |
public function send() {
|
114 |
}
|
115 |
|
116 |
/**
|
117 |
+
* 送信元を設定
|
118 |
+
*
|
119 |
* @param string $email fromメールアドレス
|
120 |
* @return string
|
121 |
*/
|
124 |
}
|
125 |
|
126 |
/**
|
127 |
+
* 送信者名を設定
|
128 |
+
*
|
129 |
* @param string $sender 送信者名
|
130 |
* @return string
|
131 |
*/
|
134 |
}
|
135 |
|
136 |
/**
|
137 |
+
* 返信先を設定
|
138 |
+
*
|
139 |
* @param phpmailer $phpmailer
|
140 |
*/
|
141 |
public function set_return_path( $phpmailer ) {
|
143 |
}
|
144 |
|
145 |
/**
|
|
|
146 |
* 配列からbodyを生成
|
147 |
+
*
|
148 |
* @param array ( 見出し => 内容, … )
|
149 |
* @param array ( 'exclude' => array( 除外したいキー1, … ) )
|
150 |
* @return string メール本文
|
classes/models/class.session.php
CHANGED
@@ -13,21 +13,17 @@
|
|
13 |
class MW_WP_Form_Session {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* セッション名
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name;
|
21 |
|
22 |
/**
|
23 |
-
* $session_id
|
24 |
-
* セッションID
|
25 |
* @var string
|
26 |
*/
|
27 |
protected $session_id;
|
28 |
|
29 |
/**
|
30 |
-
* $expiration
|
31 |
* Transient の生存時間
|
32 |
* @var int
|
33 |
*/
|
@@ -35,6 +31,7 @@ class MW_WP_Form_Session {
|
|
35 |
|
36 |
/**
|
37 |
* __construct
|
|
|
38 |
* @param string $name 識別子
|
39 |
*/
|
40 |
public function __construct( $name ) {
|
@@ -50,8 +47,8 @@ class MW_WP_Form_Session {
|
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
-
* save
|
54 |
* セッション変数にセット
|
|
|
55 |
* @param array $data
|
56 |
*/
|
57 |
public function save( array $data ) {
|
@@ -67,8 +64,8 @@ class MW_WP_Form_Session {
|
|
67 |
}
|
68 |
|
69 |
/**
|
70 |
-
* set
|
71 |
* セッション変数にセット
|
|
|
72 |
* @param string $key キー
|
73 |
* @param mixed $value 値
|
74 |
*/
|
@@ -83,8 +80,8 @@ class MW_WP_Form_Session {
|
|
83 |
}
|
84 |
|
85 |
/**
|
86 |
-
* push
|
87 |
* セッション変数にセット
|
|
|
88 |
* @param string $key キー
|
89 |
* @param mixed $value 値
|
90 |
*/
|
@@ -99,8 +96,8 @@ class MW_WP_Form_Session {
|
|
99 |
}
|
100 |
|
101 |
/**
|
102 |
-
* get
|
103 |
* セッション変数から取得
|
|
|
104 |
* @param string $key キー
|
105 |
* @return mixed セッション値
|
106 |
*/
|
@@ -113,8 +110,8 @@ class MW_WP_Form_Session {
|
|
113 |
}
|
114 |
|
115 |
/**
|
116 |
-
* getValues
|
117 |
* セッション変数から取得
|
|
|
118 |
* @return array セッション値
|
119 |
*/
|
120 |
public function gets() {
|
@@ -126,8 +123,8 @@ class MW_WP_Form_Session {
|
|
126 |
}
|
127 |
|
128 |
/**
|
129 |
-
* clear_value
|
130 |
* セッション変数を空に
|
|
|
131 |
* @param string $key キー
|
132 |
*/
|
133 |
public function clear_value( $key ) {
|
@@ -139,7 +136,6 @@ class MW_WP_Form_Session {
|
|
139 |
}
|
140 |
|
141 |
/**
|
142 |
-
* clear_values
|
143 |
* セッション変数を空に
|
144 |
*/
|
145 |
public function clear_values() {
|
@@ -147,7 +143,7 @@ class MW_WP_Form_Session {
|
|
147 |
}
|
148 |
|
149 |
/**
|
150 |
-
*
|
151 |
*/
|
152 |
protected function get_remote_addr() {
|
153 |
if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
|
@@ -155,4 +151,4 @@ class MW_WP_Form_Session {
|
|
155 |
}
|
156 |
return '127.0.0.1';
|
157 |
}
|
158 |
-
}
|
13 |
class MW_WP_Form_Session {
|
14 |
|
15 |
/**
|
|
|
16 |
* セッション名
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name;
|
20 |
|
21 |
/**
|
|
|
|
|
22 |
* @var string
|
23 |
*/
|
24 |
protected $session_id;
|
25 |
|
26 |
/**
|
|
|
27 |
* Transient の生存時間
|
28 |
* @var int
|
29 |
*/
|
31 |
|
32 |
/**
|
33 |
* __construct
|
34 |
+
*
|
35 |
* @param string $name 識別子
|
36 |
*/
|
37 |
public function __construct( $name ) {
|
47 |
}
|
48 |
|
49 |
/**
|
|
|
50 |
* セッション変数にセット
|
51 |
+
*
|
52 |
* @param array $data
|
53 |
*/
|
54 |
public function save( array $data ) {
|
64 |
}
|
65 |
|
66 |
/**
|
|
|
67 |
* セッション変数にセット
|
68 |
+
*
|
69 |
* @param string $key キー
|
70 |
* @param mixed $value 値
|
71 |
*/
|
80 |
}
|
81 |
|
82 |
/**
|
|
|
83 |
* セッション変数にセット
|
84 |
+
*
|
85 |
* @param string $key キー
|
86 |
* @param mixed $value 値
|
87 |
*/
|
96 |
}
|
97 |
|
98 |
/**
|
|
|
99 |
* セッション変数から取得
|
100 |
+
*
|
101 |
* @param string $key キー
|
102 |
* @return mixed セッション値
|
103 |
*/
|
110 |
}
|
111 |
|
112 |
/**
|
|
|
113 |
* セッション変数から取得
|
114 |
+
*
|
115 |
* @return array セッション値
|
116 |
*/
|
117 |
public function gets() {
|
123 |
}
|
124 |
|
125 |
/**
|
|
|
126 |
* セッション変数を空に
|
127 |
+
*
|
128 |
* @param string $key キー
|
129 |
*/
|
130 |
public function clear_value( $key ) {
|
136 |
}
|
137 |
|
138 |
/**
|
|
|
139 |
* セッション変数を空に
|
140 |
*/
|
141 |
public function clear_values() {
|
143 |
}
|
144 |
|
145 |
/**
|
146 |
+
* $_SERVER['REMOTE_ADDR'] を取得
|
147 |
*/
|
148 |
protected function get_remote_addr() {
|
149 |
if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
|
151 |
}
|
152 |
return '127.0.0.1';
|
153 |
}
|
154 |
+
}
|
classes/models/class.setting.php
CHANGED
@@ -12,182 +12,156 @@
|
|
12 |
class MW_WP_Form_Setting {
|
13 |
|
14 |
/**
|
15 |
-
* $post_id
|
16 |
* フォームの Post ID
|
17 |
* @var int
|
18 |
*/
|
19 |
protected $post_id;
|
20 |
|
21 |
/**
|
22 |
-
* $mail_subject
|
23 |
* 自動返信メールの題名
|
24 |
* @var string
|
25 |
*/
|
26 |
protected $mail_subject = '';
|
27 |
|
28 |
/**
|
29 |
-
* $mail_from
|
30 |
* 自動返信メールの送信元
|
31 |
* @var string
|
32 |
*/
|
33 |
protected $mail_from = '';
|
34 |
|
35 |
/**
|
36 |
-
* $mail_sender
|
37 |
* 自動返信メールの送信者
|
38 |
* @var string
|
39 |
*/
|
40 |
protected $mail_sender = '';
|
41 |
|
42 |
/**
|
43 |
-
* $mail_content
|
44 |
* 自動返信メールの本文
|
45 |
* @var string
|
46 |
*/
|
47 |
protected $mail_content = '';
|
48 |
|
49 |
/**
|
50 |
-
* $automatic_reply_email
|
51 |
* 自動返信メールの送信先を格納したフォームフィールドのname属性
|
52 |
* @var string
|
53 |
*/
|
54 |
protected $automatic_reply_email = '';
|
55 |
|
56 |
/**
|
57 |
-
* $mail_to
|
58 |
* 管理者メールの送信先
|
59 |
* @var string
|
60 |
*/
|
61 |
protected $mail_to = '';
|
62 |
|
63 |
/**
|
64 |
-
* $mail_cc
|
65 |
* 管理者メールのCC
|
66 |
* @var string
|
67 |
*/
|
68 |
protected $mail_cc = '';
|
69 |
|
70 |
/**
|
71 |
-
* $mail_bcc
|
72 |
* 管理者メールのBCC
|
73 |
* @var string
|
74 |
*/
|
75 |
protected $mail_bcc = '';
|
76 |
|
77 |
/**
|
78 |
-
* $admin_mail_subject
|
79 |
* 管理者メールの題名
|
80 |
* @var string
|
81 |
*/
|
82 |
protected $admin_mail_subject = '';
|
83 |
|
84 |
/**
|
85 |
-
* $admin_mail_from
|
86 |
* 管理者メールの送信元
|
87 |
* @var string
|
88 |
*/
|
89 |
protected $admin_mail_from = '';
|
90 |
|
91 |
/**
|
92 |
-
* $admin_mail_sender
|
93 |
* 管理者メールの送信者
|
94 |
* @var string
|
95 |
*/
|
96 |
protected $admin_mail_sender = '';
|
97 |
|
98 |
/**
|
99 |
-
* $admin_mail_content
|
100 |
* 管理者メールの本文
|
101 |
* @var string
|
102 |
*/
|
103 |
protected $admin_mail_content = '';
|
104 |
|
105 |
/**
|
106 |
-
* $querystring
|
107 |
* URL引数を有効にするかどうか
|
108 |
* @var false|1
|
109 |
*/
|
110 |
protected $querystring = false;
|
111 |
|
112 |
/**
|
113 |
-
* $usedb
|
114 |
* 問い合わせデータを保存するかどうか
|
115 |
* @var false|1
|
116 |
*/
|
117 |
protected $usedb = false;
|
118 |
|
119 |
/**
|
120 |
-
* $akismet_author
|
121 |
* akismet送信者の対象とするフォームフィールドのname属性
|
122 |
* @var string
|
123 |
*/
|
124 |
protected $akismet_author = '';
|
125 |
|
126 |
/**
|
127 |
-
* $akismet_author_email
|
128 |
* akismetメールアドレスの対象とするフォームフィールドのname属性
|
129 |
* @var string
|
130 |
*/
|
131 |
protected $akismet_author_email = '';
|
132 |
|
133 |
/**
|
134 |
-
* $akismet_author_url
|
135 |
* akismet url の対象とするフォームフィールドのname属性
|
136 |
* @var string
|
137 |
*/
|
138 |
protected $akismet_author_url = '';
|
139 |
|
140 |
/**
|
141 |
-
* $complete_message
|
142 |
* 完了画面メッセージ
|
143 |
* @var string
|
144 |
*/
|
145 |
protected $complete_message = '';
|
146 |
|
147 |
/**
|
148 |
-
* $input_url
|
149 |
* 入力画面URL
|
150 |
* @var string
|
151 |
*/
|
152 |
protected $input_url = '';
|
153 |
|
154 |
/**
|
155 |
-
* $confirmation_url
|
156 |
* 確認画面URL
|
157 |
* @var string
|
158 |
*/
|
159 |
protected $confirmation_url = '';
|
160 |
|
161 |
/**
|
162 |
-
* $complete_url
|
163 |
* 完了画面URL
|
164 |
* @var string
|
165 |
*/
|
166 |
protected $complete_url = '';
|
167 |
|
168 |
/**
|
169 |
-
* $validation_error_url
|
170 |
* バリデーションエラー画面URL
|
171 |
* @var string
|
172 |
*/
|
173 |
protected $validation_error_url = '';
|
174 |
|
175 |
/**
|
176 |
-
* $validation
|
177 |
* フォームに設定されたバリデーションルールの配列
|
178 |
* @var array
|
179 |
*/
|
180 |
protected $validation = array();
|
181 |
|
182 |
/**
|
183 |
-
* $style
|
184 |
* フォームに設定されたスタイル
|
185 |
* @var string
|
186 |
*/
|
187 |
protected $style = '';
|
188 |
|
189 |
/**
|
190 |
-
* $scroll
|
191 |
* 入力画面以外を表示したときにフォームの位置までスクロールするかどうか
|
192 |
* @var false|1
|
193 |
*/
|
@@ -195,6 +169,7 @@ class MW_WP_Form_Setting {
|
|
195 |
|
196 |
/**
|
197 |
* __construct
|
|
|
198 |
* @param int $post_id
|
199 |
*/
|
200 |
public function __construct( $post_id ) {
|
@@ -208,8 +183,8 @@ class MW_WP_Form_Setting {
|
|
208 |
}
|
209 |
|
210 |
/**
|
211 |
-
* get
|
212 |
* 属性の取得
|
|
|
213 |
* @param string $key
|
214 |
* @return mixed|null
|
215 |
*/
|
@@ -220,8 +195,8 @@ class MW_WP_Form_Setting {
|
|
220 |
}
|
221 |
|
222 |
/**
|
223 |
-
* set
|
224 |
* 属性をセット
|
|
|
225 |
* @param string $key
|
226 |
* @param mixed $value
|
227 |
*/
|
@@ -232,8 +207,8 @@ class MW_WP_Form_Setting {
|
|
232 |
}
|
233 |
|
234 |
/**
|
235 |
-
* sets
|
236 |
* 属性をセット
|
|
|
237 |
* @param array $values
|
238 |
*/
|
239 |
public function sets( array $values ) {
|
@@ -243,7 +218,6 @@ class MW_WP_Form_Setting {
|
|
243 |
}
|
244 |
|
245 |
/**
|
246 |
-
* save
|
247 |
* 保持しているデータでアップデート
|
248 |
*/
|
249 |
public function save() {
|
@@ -259,7 +233,8 @@ class MW_WP_Form_Setting {
|
|
259 |
}
|
260 |
|
261 |
/**
|
262 |
-
*
|
|
|
263 |
* @return array フォーム(WP_Post)の配列
|
264 |
*/
|
265 |
public function get_posts() {
|
@@ -274,7 +249,8 @@ class MW_WP_Form_Setting {
|
|
274 |
}
|
275 |
|
276 |
/**
|
277 |
-
*
|
|
|
278 |
* @return int $tracking_number
|
279 |
*/
|
280 |
public function get_tracking_number() {
|
@@ -286,7 +262,7 @@ class MW_WP_Form_Setting {
|
|
286 |
}
|
287 |
|
288 |
/**
|
289 |
-
*
|
290 |
*/
|
291 |
public function update_tracking_number() {
|
292 |
$tracking_number = $this->get_tracking_number();
|
12 |
class MW_WP_Form_Setting {
|
13 |
|
14 |
/**
|
|
|
15 |
* フォームの Post ID
|
16 |
* @var int
|
17 |
*/
|
18 |
protected $post_id;
|
19 |
|
20 |
/**
|
|
|
21 |
* 自動返信メールの題名
|
22 |
* @var string
|
23 |
*/
|
24 |
protected $mail_subject = '';
|
25 |
|
26 |
/**
|
|
|
27 |
* 自動返信メールの送信元
|
28 |
* @var string
|
29 |
*/
|
30 |
protected $mail_from = '';
|
31 |
|
32 |
/**
|
|
|
33 |
* 自動返信メールの送信者
|
34 |
* @var string
|
35 |
*/
|
36 |
protected $mail_sender = '';
|
37 |
|
38 |
/**
|
|
|
39 |
* 自動返信メールの本文
|
40 |
* @var string
|
41 |
*/
|
42 |
protected $mail_content = '';
|
43 |
|
44 |
/**
|
|
|
45 |
* 自動返信メールの送信先を格納したフォームフィールドのname属性
|
46 |
* @var string
|
47 |
*/
|
48 |
protected $automatic_reply_email = '';
|
49 |
|
50 |
/**
|
|
|
51 |
* 管理者メールの送信先
|
52 |
* @var string
|
53 |
*/
|
54 |
protected $mail_to = '';
|
55 |
|
56 |
/**
|
|
|
57 |
* 管理者メールのCC
|
58 |
* @var string
|
59 |
*/
|
60 |
protected $mail_cc = '';
|
61 |
|
62 |
/**
|
|
|
63 |
* 管理者メールのBCC
|
64 |
* @var string
|
65 |
*/
|
66 |
protected $mail_bcc = '';
|
67 |
|
68 |
/**
|
|
|
69 |
* 管理者メールの題名
|
70 |
* @var string
|
71 |
*/
|
72 |
protected $admin_mail_subject = '';
|
73 |
|
74 |
/**
|
|
|
75 |
* 管理者メールの送信元
|
76 |
* @var string
|
77 |
*/
|
78 |
protected $admin_mail_from = '';
|
79 |
|
80 |
/**
|
|
|
81 |
* 管理者メールの送信者
|
82 |
* @var string
|
83 |
*/
|
84 |
protected $admin_mail_sender = '';
|
85 |
|
86 |
/**
|
|
|
87 |
* 管理者メールの本文
|
88 |
* @var string
|
89 |
*/
|
90 |
protected $admin_mail_content = '';
|
91 |
|
92 |
/**
|
|
|
93 |
* URL引数を有効にするかどうか
|
94 |
* @var false|1
|
95 |
*/
|
96 |
protected $querystring = false;
|
97 |
|
98 |
/**
|
|
|
99 |
* 問い合わせデータを保存するかどうか
|
100 |
* @var false|1
|
101 |
*/
|
102 |
protected $usedb = false;
|
103 |
|
104 |
/**
|
|
|
105 |
* akismet送信者の対象とするフォームフィールドのname属性
|
106 |
* @var string
|
107 |
*/
|
108 |
protected $akismet_author = '';
|
109 |
|
110 |
/**
|
|
|
111 |
* akismetメールアドレスの対象とするフォームフィールドのname属性
|
112 |
* @var string
|
113 |
*/
|
114 |
protected $akismet_author_email = '';
|
115 |
|
116 |
/**
|
|
|
117 |
* akismet url の対象とするフォームフィールドのname属性
|
118 |
* @var string
|
119 |
*/
|
120 |
protected $akismet_author_url = '';
|
121 |
|
122 |
/**
|
|
|
123 |
* 完了画面メッセージ
|
124 |
* @var string
|
125 |
*/
|
126 |
protected $complete_message = '';
|
127 |
|
128 |
/**
|
|
|
129 |
* 入力画面URL
|
130 |
* @var string
|
131 |
*/
|
132 |
protected $input_url = '';
|
133 |
|
134 |
/**
|
|
|
135 |
* 確認画面URL
|
136 |
* @var string
|
137 |
*/
|
138 |
protected $confirmation_url = '';
|
139 |
|
140 |
/**
|
|
|
141 |
* 完了画面URL
|
142 |
* @var string
|
143 |
*/
|
144 |
protected $complete_url = '';
|
145 |
|
146 |
/**
|
|
|
147 |
* バリデーションエラー画面URL
|
148 |
* @var string
|
149 |
*/
|
150 |
protected $validation_error_url = '';
|
151 |
|
152 |
/**
|
|
|
153 |
* フォームに設定されたバリデーションルールの配列
|
154 |
* @var array
|
155 |
*/
|
156 |
protected $validation = array();
|
157 |
|
158 |
/**
|
|
|
159 |
* フォームに設定されたスタイル
|
160 |
* @var string
|
161 |
*/
|
162 |
protected $style = '';
|
163 |
|
164 |
/**
|
|
|
165 |
* 入力画面以外を表示したときにフォームの位置までスクロールするかどうか
|
166 |
* @var false|1
|
167 |
*/
|
169 |
|
170 |
/**
|
171 |
* __construct
|
172 |
+
*
|
173 |
* @param int $post_id
|
174 |
*/
|
175 |
public function __construct( $post_id ) {
|
183 |
}
|
184 |
|
185 |
/**
|
|
|
186 |
* 属性の取得
|
187 |
+
*
|
188 |
* @param string $key
|
189 |
* @return mixed|null
|
190 |
*/
|
195 |
}
|
196 |
|
197 |
/**
|
|
|
198 |
* 属性をセット
|
199 |
+
*
|
200 |
* @param string $key
|
201 |
* @param mixed $value
|
202 |
*/
|
207 |
}
|
208 |
|
209 |
/**
|
|
|
210 |
* 属性をセット
|
211 |
+
*
|
212 |
* @param array $values
|
213 |
*/
|
214 |
public function sets( array $values ) {
|
218 |
}
|
219 |
|
220 |
/**
|
|
|
221 |
* 保持しているデータでアップデート
|
222 |
*/
|
223 |
public function save() {
|
233 |
}
|
234 |
|
235 |
/**
|
236 |
+
* 全ての設定(投稿)を取得
|
237 |
+
*
|
238 |
* @return array フォーム(WP_Post)の配列
|
239 |
*/
|
240 |
public function get_posts() {
|
249 |
}
|
250 |
|
251 |
/**
|
252 |
+
* 問い合わせ番号を取得
|
253 |
+
*
|
254 |
* @return int $tracking_number
|
255 |
*/
|
256 |
public function get_tracking_number() {
|
262 |
}
|
263 |
|
264 |
/**
|
265 |
+
* 問い合わせ番号を更新
|
266 |
*/
|
267 |
public function update_tracking_number() {
|
268 |
$tracking_number = $this->get_tracking_number();
|
classes/models/class.validation.php
CHANGED
@@ -2,31 +2,28 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation
|
4 |
* Description: 与えられたデータに対してバリデーションエラーがあるかチェックする
|
5 |
-
* Version : 1.8.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 20, 2012
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation {
|
14 |
|
15 |
/**
|
16 |
-
* $Error
|
17 |
* @var MW_WP_Form_Error
|
18 |
*/
|
19 |
protected $Error;
|
20 |
|
21 |
/**
|
22 |
-
* $validate
|
23 |
* バリデートをかける項目(name属性)と、それにかけるバリデーションの配列
|
24 |
* @var array
|
25 |
*/
|
26 |
-
|
27 |
|
28 |
/**
|
29 |
-
* $validation_rules
|
30 |
* バリデーションルールの配列
|
31 |
* @var array
|
32 |
*/
|
@@ -34,6 +31,7 @@ class MW_WP_Form_Validation {
|
|
34 |
|
35 |
/**
|
36 |
* __construct
|
|
|
37 |
* @param MW_WP_Form_Error $Error
|
38 |
*/
|
39 |
public function __construct( MW_WP_Form_Error $Error ) {
|
@@ -41,8 +39,8 @@ class MW_WP_Form_Validation {
|
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
-
* set_validation_rules
|
45 |
* 各バリデーションルールクラスのインスタンスをセット
|
|
|
46 |
* @param array $validation_rules
|
47 |
*/
|
48 |
public function set_validation_rules( array $validation_rules ) {
|
@@ -54,8 +52,17 @@ class MW_WP_Form_Validation {
|
|
54 |
}
|
55 |
|
56 |
/**
|
57 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
* バリデートが通っているかチェック
|
|
|
59 |
* @return bool
|
60 |
*/
|
61 |
protected function is_valid() {
|
@@ -69,9 +76,9 @@ class MW_WP_Form_Validation {
|
|
69 |
|
70 |
/**
|
71 |
* set_rules
|
|
|
72 |
* @param MW_WP_Form_Setting $Setting
|
73 |
* @param MW_WP_Form_Data $Data
|
74 |
-
* @return array $rules
|
75 |
*/
|
76 |
public function set_rules( MW_WP_Form_Setting $Setting, MW_WP_Form_Data $Data ) {
|
77 |
$rules = array();
|
@@ -103,12 +110,13 @@ class MW_WP_Form_Validation {
|
|
103 |
|
104 |
/**
|
105 |
* set_rule
|
|
|
106 |
* @param string ターゲットのname属性
|
107 |
* @param string バリデーションルール名
|
108 |
* @param array オプション
|
109 |
-
* @return
|
110 |
*/
|
111 |
-
|
112 |
$rules = array(
|
113 |
'rule' => strtolower( $rule ),
|
114 |
'options' => $options
|
@@ -116,17 +124,10 @@ class MW_WP_Form_Validation {
|
|
116 |
$this->validate[$key][] = $rules;
|
117 |
return $this;
|
118 |
}
|
119 |
-
public function setRule( $key, $rule, array $options = array() ) {
|
120 |
-
MWF_Functions::deprecated_message(
|
121 |
-
'MW_Validations::setRule()',
|
122 |
-
'MW_WP_Form_Validation::set_rule()'
|
123 |
-
);
|
124 |
-
return $this->set_rule( $key, $rule, $options );
|
125 |
-
}
|
126 |
|
127 |
/**
|
128 |
-
* check
|
129 |
* validate実行
|
|
|
130 |
* @return bool エラーがなければ true
|
131 |
*/
|
132 |
public function check() {
|
@@ -137,8 +138,8 @@ class MW_WP_Form_Validation {
|
|
137 |
}
|
138 |
|
139 |
/**
|
140 |
-
* single_check
|
141 |
* 特定の項目のvalidate実行
|
|
|
142 |
* @param string $key
|
143 |
* @return bool エラーがなければ true
|
144 |
*/
|
@@ -155,8 +156,8 @@ class MW_WP_Form_Validation {
|
|
155 |
}
|
156 |
|
157 |
/**
|
158 |
-
* _check
|
159 |
* validate実行の実体
|
|
|
160 |
* @param string $key
|
161 |
* @param array $rules
|
162 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation
|
4 |
* Description: 与えられたデータに対してバリデーションエラーがあるかチェックする
|
5 |
+
* Version : 1.8.3
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 20, 2012
|
9 |
+
* Modified : March 26, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation {
|
14 |
|
15 |
/**
|
|
|
16 |
* @var MW_WP_Form_Error
|
17 |
*/
|
18 |
protected $Error;
|
19 |
|
20 |
/**
|
|
|
21 |
* バリデートをかける項目(name属性)と、それにかけるバリデーションの配列
|
22 |
* @var array
|
23 |
*/
|
24 |
+
protected $validate = array();
|
25 |
|
26 |
/**
|
|
|
27 |
* バリデーションルールの配列
|
28 |
* @var array
|
29 |
*/
|
31 |
|
32 |
/**
|
33 |
* __construct
|
34 |
+
*
|
35 |
* @param MW_WP_Form_Error $Error
|
36 |
*/
|
37 |
public function __construct( MW_WP_Form_Error $Error ) {
|
39 |
}
|
40 |
|
41 |
/**
|
|
|
42 |
* 各バリデーションルールクラスのインスタンスをセット
|
43 |
+
*
|
44 |
* @param array $validation_rules
|
45 |
*/
|
46 |
public function set_validation_rules( array $validation_rules ) {
|
52 |
}
|
53 |
|
54 |
/**
|
55 |
+
* セットされたバリデーションルールクラスを取得
|
56 |
+
*
|
57 |
+
* @return array
|
58 |
+
*/
|
59 |
+
public function get_validation_rules() {
|
60 |
+
return $this->validation_rules;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
* バリデートが通っているかチェック
|
65 |
+
*
|
66 |
* @return bool
|
67 |
*/
|
68 |
protected function is_valid() {
|
76 |
|
77 |
/**
|
78 |
* set_rules
|
79 |
+
*
|
80 |
* @param MW_WP_Form_Setting $Setting
|
81 |
* @param MW_WP_Form_Data $Data
|
|
|
82 |
*/
|
83 |
public function set_rules( MW_WP_Form_Setting $Setting, MW_WP_Form_Data $Data ) {
|
84 |
$rules = array();
|
110 |
|
111 |
/**
|
112 |
* set_rule
|
113 |
+
*
|
114 |
* @param string ターゲットのname属性
|
115 |
* @param string バリデーションルール名
|
116 |
* @param array オプション
|
117 |
+
* @return MW_WP_Form_Validation
|
118 |
*/
|
119 |
+
protected function set_rule( $key, $rule, array $options = array() ) {
|
120 |
$rules = array(
|
121 |
'rule' => strtolower( $rule ),
|
122 |
'options' => $options
|
124 |
$this->validate[$key][] = $rules;
|
125 |
return $this;
|
126 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
/**
|
|
|
129 |
* validate実行
|
130 |
+
*
|
131 |
* @return bool エラーがなければ true
|
132 |
*/
|
133 |
public function check() {
|
138 |
}
|
139 |
|
140 |
/**
|
|
|
141 |
* 特定の項目のvalidate実行
|
142 |
+
*
|
143 |
* @param string $key
|
144 |
* @return bool エラーがなければ true
|
145 |
*/
|
156 |
}
|
157 |
|
158 |
/**
|
|
|
159 |
* validate実行の実体
|
160 |
+
*
|
161 |
* @param string $key
|
162 |
* @param array $rules
|
163 |
*/
|
classes/services/class.exec-shortcode.php
CHANGED
@@ -1,39 +1,36 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Exec Shortcode
|
4 |
-
* Version : 1.0
|
5 |
* Description: ExecShortcode(mwform、mwform_formkey)の存在有無のチェックとそれらの抽象化レイヤー
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 31, 2014
|
9 |
-
* Modified : March
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Exec_Shortcode {
|
14 |
|
15 |
/**
|
16 |
-
* $post_id
|
17 |
* フォームの Post ID
|
18 |
* @var int
|
19 |
*/
|
20 |
protected $post_id;
|
21 |
|
22 |
/**
|
23 |
-
* $post
|
24 |
* ショートコードが埋め込まれた投稿のオブジェクト
|
25 |
* @var WP_Post|null
|
26 |
*/
|
27 |
protected $post;
|
28 |
|
29 |
/**
|
30 |
-
* $template
|
31 |
* @var string 表示中のテンプレート
|
32 |
*/
|
33 |
protected $template;
|
34 |
|
35 |
/**
|
36 |
-
*
|
37 |
* @var array
|
38 |
*/
|
39 |
protected $settings = array(
|
@@ -44,8 +41,30 @@ class MW_WP_Form_Exec_Shortcode {
|
|
44 |
'key' => null,
|
45 |
);
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
/**
|
48 |
* __construct
|
|
|
49 |
* @param WP_Post|null $post
|
50 |
* @param string $template 使用テンプレートのパス
|
51 |
*/
|
@@ -67,8 +86,8 @@ class MW_WP_Form_Exec_Shortcode {
|
|
67 |
}
|
68 |
|
69 |
/**
|
70 |
-
* has_shortcode
|
71 |
* 必要な設定が完了していたらtrue
|
|
|
72 |
* @return bool
|
73 |
*/
|
74 |
public function has_shortcode() {
|
@@ -79,7 +98,10 @@ class MW_WP_Form_Exec_Shortcode {
|
|
79 |
}
|
80 |
|
81 |
/**
|
82 |
-
*
|
|
|
|
|
|
|
83 |
*/
|
84 |
public function get( $key ) {
|
85 |
if ( isset( $this->settings[$key] ) ) {
|
@@ -88,8 +110,8 @@ class MW_WP_Form_Exec_Shortcode {
|
|
88 |
}
|
89 |
|
90 |
/**
|
91 |
-
* get_exec_shortcode
|
92 |
* ExecShortcode が含まれていればそのショートコードを返す
|
|
|
93 |
* @return string [hoge xxx="xxx"]
|
94 |
*/
|
95 |
protected function get_exec_shortcode() {
|
@@ -104,8 +126,8 @@ class MW_WP_Form_Exec_Shortcode {
|
|
104 |
}
|
105 |
|
106 |
/**
|
107 |
-
* get_in_template
|
108 |
* テンプレートファイル(絶対パス)に ExecShortcode が含まれていればそのショートコードを返す
|
|
|
109 |
* @return string [hoge xxx="xxx"]
|
110 |
*/
|
111 |
protected function get_in_template() {
|
@@ -119,8 +141,8 @@ class MW_WP_Form_Exec_Shortcode {
|
|
119 |
}
|
120 |
|
121 |
/**
|
122 |
-
* get_in_content
|
123 |
* ExecShortcode が含まれていればそのショートコードを返す
|
|
|
124 |
* @param string $content
|
125 |
* @return string [hoge xxx="xxx"]
|
126 |
*/
|
@@ -141,7 +163,8 @@ class MW_WP_Form_Exec_Shortcode {
|
|
141 |
}
|
142 |
|
143 |
/**
|
144 |
-
*
|
|
|
145 |
* @param array|'' $attributes
|
146 |
*/
|
147 |
public function set_settings_by_mwform( $attributes ) {
|
@@ -156,7 +179,8 @@ class MW_WP_Form_Exec_Shortcode {
|
|
156 |
}
|
157 |
|
158 |
/**
|
159 |
-
*
|
|
|
160 |
* @param array $attributes|''
|
161 |
*/
|
162 |
public function set_settings_by_mwform_formkey( $attributes ) {
|
@@ -174,7 +198,8 @@ class MW_WP_Form_Exec_Shortcode {
|
|
174 |
}
|
175 |
|
176 |
/**
|
177 |
-
*
|
|
|
178 |
* @param array|'' $attributes
|
179 |
* @return string|null Post ID
|
180 |
*/
|
@@ -189,7 +214,8 @@ class MW_WP_Form_Exec_Shortcode {
|
|
189 |
}
|
190 |
|
191 |
/**
|
192 |
-
*
|
|
|
193 |
* @param array $attributes
|
194 |
*/
|
195 |
protected function set_settings( array $attributes ) {
|
@@ -213,8 +239,8 @@ class MW_WP_Form_Exec_Shortcode {
|
|
213 |
}
|
214 |
|
215 |
/**
|
216 |
-
*
|
217 |
-
*
|
218 |
* @return bool
|
219 |
*/
|
220 |
public function is_generated_by_formkey() {
|
@@ -225,11 +251,327 @@ class MW_WP_Form_Exec_Shortcode {
|
|
225 |
}
|
226 |
|
227 |
/**
|
228 |
-
*
|
|
|
|
|
229 |
*/
|
230 |
public function get_form_id() {
|
231 |
if ( $this->post_id ) {
|
232 |
return $this->post_id;
|
233 |
}
|
234 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Exec Shortcode
|
4 |
+
* Version : 1.1.0
|
5 |
* Description: ExecShortcode(mwform、mwform_formkey)の存在有無のチェックとそれらの抽象化レイヤー
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 31, 2014
|
9 |
+
* Modified : March 30, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Exec_Shortcode {
|
14 |
|
15 |
/**
|
|
|
16 |
* フォームの Post ID
|
17 |
* @var int
|
18 |
*/
|
19 |
protected $post_id;
|
20 |
|
21 |
/**
|
|
|
22 |
* ショートコードが埋め込まれた投稿のオブジェクト
|
23 |
* @var WP_Post|null
|
24 |
*/
|
25 |
protected $post;
|
26 |
|
27 |
/**
|
|
|
28 |
* @var string 表示中のテンプレート
|
29 |
*/
|
30 |
protected $template;
|
31 |
|
32 |
/**
|
33 |
+
* フォームの実行に必須なデータの配列
|
34 |
* @var array
|
35 |
*/
|
36 |
protected $settings = array(
|
41 |
'key' => null,
|
42 |
);
|
43 |
|
44 |
+
/**
|
45 |
+
* 表示すべき画面を示すフラグ
|
46 |
+
* @var string
|
47 |
+
*/
|
48 |
+
protected $view_flg;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @var MW_WP_Form_Setting
|
52 |
+
*/
|
53 |
+
protected $Setting;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @var MW_WP_Form_Form
|
57 |
+
*/
|
58 |
+
protected $Form;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @var MW_WP_Form_Data
|
62 |
+
*/
|
63 |
+
protected $Data;
|
64 |
+
|
65 |
/**
|
66 |
* __construct
|
67 |
+
*
|
68 |
* @param WP_Post|null $post
|
69 |
* @param string $template 使用テンプレートのパス
|
70 |
*/
|
86 |
}
|
87 |
|
88 |
/**
|
|
|
89 |
* 必要な設定が完了していたらtrue
|
90 |
+
*
|
91 |
* @return bool
|
92 |
*/
|
93 |
public function has_shortcode() {
|
98 |
}
|
99 |
|
100 |
/**
|
101 |
+
* 設定データを取得
|
102 |
+
*
|
103 |
+
* @param string $key
|
104 |
+
* @return string
|
105 |
*/
|
106 |
public function get( $key ) {
|
107 |
if ( isset( $this->settings[$key] ) ) {
|
110 |
}
|
111 |
|
112 |
/**
|
|
|
113 |
* ExecShortcode が含まれていればそのショートコードを返す
|
114 |
+
*
|
115 |
* @return string [hoge xxx="xxx"]
|
116 |
*/
|
117 |
protected function get_exec_shortcode() {
|
126 |
}
|
127 |
|
128 |
/**
|
|
|
129 |
* テンプレートファイル(絶対パス)に ExecShortcode が含まれていればそのショートコードを返す
|
130 |
+
*
|
131 |
* @return string [hoge xxx="xxx"]
|
132 |
*/
|
133 |
protected function get_in_template() {
|
141 |
}
|
142 |
|
143 |
/**
|
|
|
144 |
* ExecShortcode が含まれていればそのショートコードを返す
|
145 |
+
*
|
146 |
* @param string $content
|
147 |
* @return string [hoge xxx="xxx"]
|
148 |
*/
|
163 |
}
|
164 |
|
165 |
/**
|
166 |
+
* ショートコード mwform をもとにフォームの実行に必須のデータを設定
|
167 |
+
*
|
168 |
* @param array|'' $attributes
|
169 |
*/
|
170 |
public function set_settings_by_mwform( $attributes ) {
|
179 |
}
|
180 |
|
181 |
/**
|
182 |
+
* ショートコード mwform_formkey をもとにフォームの実行に必須のデータを設定
|
183 |
+
*
|
184 |
* @param array $attributes|''
|
185 |
*/
|
186 |
public function set_settings_by_mwform_formkey( $attributes ) {
|
198 |
}
|
199 |
|
200 |
/**
|
201 |
+
* ショートコード mwform_formkey をもとにフォームの ID を取得
|
202 |
+
*
|
203 |
* @param array|'' $attributes
|
204 |
* @return string|null Post ID
|
205 |
*/
|
214 |
}
|
215 |
|
216 |
/**
|
217 |
+
* フォームの実行に必須のデータを設定
|
218 |
+
*
|
219 |
* @param array $attributes
|
220 |
*/
|
221 |
protected function set_settings( array $attributes ) {
|
239 |
}
|
240 |
|
241 |
/**
|
242 |
+
* 管理画面で作成されたフォームであれば true
|
243 |
+
*
|
244 |
* @return bool
|
245 |
*/
|
246 |
public function is_generated_by_formkey() {
|
251 |
}
|
252 |
|
253 |
/**
|
254 |
+
* フォームの ID を取得
|
255 |
+
*
|
256 |
+
* @return int
|
257 |
*/
|
258 |
public function get_form_id() {
|
259 |
if ( $this->post_id ) {
|
260 |
return $this->post_id;
|
261 |
}
|
262 |
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* フォームを表示するためのショートコードを登録
|
266 |
+
*
|
267 |
+
* @param string $view_flg
|
268 |
+
* @param MW_WP_Form_Setting $Setting
|
269 |
+
* @param MW_WP_Form_Form $Form
|
270 |
+
* @param MW_WP_Form_Data $Data
|
271 |
+
*/
|
272 |
+
public function add_shortcode( $view_flg, MW_WP_Form_Setting $Setting, MW_WP_Form_Form $Form, MW_WP_Form_Data $Data ) {
|
273 |
+
$this->view_flg = $view_flg;
|
274 |
+
$this->Setting = $Setting;
|
275 |
+
$this->Form = $Form;
|
276 |
+
$this->Data = $Data;
|
277 |
+
add_shortcode( 'mwform_formkey' , array( $this, 'mwform_formkey' ) );
|
278 |
+
add_shortcode( 'mwform' , array( $this, 'mwform' ) );
|
279 |
+
add_shortcode( 'mwform_complete_message', array( $this, 'mwform_complete_message' ) );
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* 管理画面で作成したフォームを出力(実際の出力は mwform )
|
284 |
+
*
|
285 |
+
* @param array $attributes
|
286 |
+
* @return string html
|
287 |
+
* @example [mwform_formkey key="post_id"]
|
288 |
+
*/
|
289 |
+
public function mwform_formkey( $attributes ) {
|
290 |
+
$view_flg = $this->view_flg;
|
291 |
+
$post_id = $this->get_form_id_by_mwform_formkey( $attributes );
|
292 |
+
|
293 |
+
// 入力画面
|
294 |
+
if ( $view_flg === 'input' ) {
|
295 |
+
$content = $this->get_input_page_content( $post_id );
|
296 |
+
}
|
297 |
+
// 確認画面
|
298 |
+
elseif ( $view_flg == 'confirm' ) {
|
299 |
+
$content = $this->get_confirm_page_content( $post_id );
|
300 |
+
}
|
301 |
+
// 完了画面
|
302 |
+
elseif ( $view_flg === 'complete' ) {
|
303 |
+
$content = $this->get_complete_page_content();
|
304 |
+
} else {
|
305 |
+
$content = '';
|
306 |
+
}
|
307 |
+
return do_shortcode( $content );
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* 入力画面を表示
|
312 |
+
*
|
313 |
+
* @param int $post_id
|
314 |
+
* @return string $content
|
315 |
+
*/
|
316 |
+
protected function get_input_page_content( $post_id ) {
|
317 |
+
global $post;
|
318 |
+
$form_key = $this->get( 'key' );
|
319 |
+
$post = get_post( $post_id );
|
320 |
+
setup_postdata( $post );
|
321 |
+
$content = apply_filters( 'mwform_post_content_raw_' . $form_key, get_the_content() );
|
322 |
+
if ( has_filter( 'the_content', 'wpautop' ) ) {
|
323 |
+
$content = wpautop( $content );
|
324 |
+
}
|
325 |
+
$content = sprintf(
|
326 |
+
'[mwform]%s[/mwform]',
|
327 |
+
apply_filters( 'mwform_post_content_' . $form_key, $content )
|
328 |
+
);
|
329 |
+
wp_reset_postdata();
|
330 |
+
return $content;
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* 確認画面を表示
|
335 |
+
*
|
336 |
+
* @param int $post_id
|
337 |
+
* @return string $content
|
338 |
+
*/
|
339 |
+
protected function get_confirm_page_content( $post_id ) {
|
340 |
+
return $this->get_input_page_content( $post_id );
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* 完了画面を表示
|
345 |
+
*
|
346 |
+
* @return string $content
|
347 |
+
*/
|
348 |
+
protected function get_complete_page_content() {
|
349 |
+
$Setting = $this->Setting;
|
350 |
+
$content = $Setting->get( 'complete_message' );
|
351 |
+
if ( has_filter( 'the_content', 'wpautop' ) ) {
|
352 |
+
$content = wpautop( $content );
|
353 |
+
}
|
354 |
+
$content = sprintf(
|
355 |
+
'[mwform_complete_message]%s[/mwform_complete_message]',
|
356 |
+
$content
|
357 |
+
);
|
358 |
+
return $content;
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* フォームを出力
|
363 |
+
*
|
364 |
+
* @param array $attributes
|
365 |
+
* @return string html
|
366 |
+
*/
|
367 |
+
public function mwform( $attributes, $content = '' ) {
|
368 |
+
$form_key = $this->get( 'key' );
|
369 |
+
$view_flg = $this->view_flg;
|
370 |
+
$Form = $this->Form;
|
371 |
+
$Data = $this->Data;
|
372 |
+
|
373 |
+
if ( in_array( $view_flg, array( 'input', 'confirm' ) ) ) {
|
374 |
+
$content = $this->get_the_content( $content );
|
375 |
+
$upload_file_keys = $Data->get_post_value_by_key( MWF_Config::UPLOAD_FILE_KEYS );
|
376 |
+
$upload_file_hidden = $this->get_upload_file_hidden( $upload_file_keys );
|
377 |
+
$old_confirm_class = $this->get_old_confirm_class();
|
378 |
+
$class_by_style = $this->get_class_by_style();
|
379 |
+
|
380 |
+
return sprintf(
|
381 |
+
'<div id="mw_wp_form_%s" class="mw_wp_form mw_wp_form_%s %s">
|
382 |
+
%s
|
383 |
+
<!-- end .mw_wp_form --></div>',
|
384 |
+
esc_attr( $form_key ),
|
385 |
+
esc_attr( $view_flg . ' ' . $old_confirm_class ),
|
386 |
+
$class_by_style,
|
387 |
+
$Form->start() . do_shortcode( $content ) . $upload_file_hidden . $Form->end()
|
388 |
+
);
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* フォームのコンテンツを整形して返す
|
394 |
+
*
|
395 |
+
* @param string $content
|
396 |
+
* @return string $content
|
397 |
+
*/
|
398 |
+
public function get_the_content( $content ) {
|
399 |
+
$content = $this->replace_user_property( $content );
|
400 |
+
$content = $this->replace_post_property( $content );
|
401 |
+
return $content;
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* ユーザーがログイン中の場合、{ユーザー情報のプロパティ}を置換する。
|
406 |
+
*
|
407 |
+
* @param string フォーム内容
|
408 |
+
* @return string フォーム内容
|
409 |
+
*/
|
410 |
+
protected function replace_user_property( $content ) {
|
411 |
+
$user = wp_get_current_user();
|
412 |
+
$search = array(
|
413 |
+
'{user_id}',
|
414 |
+
'{user_login}',
|
415 |
+
'{user_email}',
|
416 |
+
'{user_url}',
|
417 |
+
'{user_registered}',
|
418 |
+
'{display_name}',
|
419 |
+
);
|
420 |
+
if ( !empty( $user ) ) {
|
421 |
+
$content = str_replace( $search, array(
|
422 |
+
$user->get( 'ID' ),
|
423 |
+
$user->get( 'user_login' ),
|
424 |
+
$user->get( 'user_email' ),
|
425 |
+
$user->get( 'user_url' ),
|
426 |
+
$user->get( 'user_registered' ),
|
427 |
+
$user->get( 'display_name' ),
|
428 |
+
), $content );
|
429 |
+
} else {
|
430 |
+
$content = str_replace( $search, '', $content );
|
431 |
+
}
|
432 |
+
return $content;
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* {投稿情報($post->hoge)}を置換する。
|
437 |
+
*
|
438 |
+
* @param string フォーム内容
|
439 |
+
* @return string フォーム内容
|
440 |
+
*/
|
441 |
+
protected function replace_post_property( $content ) {
|
442 |
+
$Setting = $this->Setting;
|
443 |
+
if ( $Setting->get( 'querystring' ) ) {
|
444 |
+
$content = preg_replace_callback(
|
445 |
+
'/{(.+?)}/',
|
446 |
+
array( $this, 'get_post_property_from_querystring' ),
|
447 |
+
$content
|
448 |
+
);
|
449 |
+
} else {
|
450 |
+
$content = preg_replace_callback(
|
451 |
+
'/{(.+?)}/',
|
452 |
+
array( $this, 'get_post_property_from_this' ),
|
453 |
+
$content
|
454 |
+
);
|
455 |
+
}
|
456 |
+
return $content;
|
457 |
+
}
|
458 |
+
|
459 |
+
/**
|
460 |
+
* 引数 post_id が有効の場合、投稿情報を取得するために preg_replace_callback から呼び出される。
|
461 |
+
*
|
462 |
+
* @param array $matches
|
463 |
+
* @return string|null
|
464 |
+
*/
|
465 |
+
protected function get_post_property_from_querystring( $matches ) {
|
466 |
+
$Setting = $this->Setting;
|
467 |
+
if ( $Setting->get( 'querystring' ) &&
|
468 |
+
isset( $_GET['post_id'] ) &&
|
469 |
+
MWF_Functions::is_numeric( $_GET['post_id'] ) ) {
|
470 |
+
|
471 |
+
$post = get_post( $_GET['post_id'] );
|
472 |
+
if ( empty( $post->ID ) ) {
|
473 |
+
return;
|
474 |
+
}
|
475 |
+
return $this->get_post_property( $post, $matches[1] );
|
476 |
+
}
|
477 |
+
}
|
478 |
+
|
479 |
+
/**
|
480 |
+
* 引数 post_id が無効の場合、投稿情報を取得するために preg_replace_callback から呼び出される。
|
481 |
+
*
|
482 |
+
* @param array $matches
|
483 |
+
* @return string|null
|
484 |
+
*/
|
485 |
+
protected function get_post_property_from_this( $matches ) {
|
486 |
+
global $post;
|
487 |
+
if ( !is_singular() ) {
|
488 |
+
return;
|
489 |
+
}
|
490 |
+
if ( isset( $post->ID ) && MWF_Functions::is_numeric( $post->ID ) ) {
|
491 |
+
return $this->get_post_property( $post, $matches[1] );
|
492 |
+
}
|
493 |
+
}
|
494 |
+
|
495 |
+
/**
|
496 |
+
* 投稿のプロパティを取得
|
497 |
+
*
|
498 |
+
* @param WP_Post|null $post
|
499 |
+
* @param string $meta_key
|
500 |
+
* @return string|null
|
501 |
+
*/
|
502 |
+
protected function get_post_property( $post, $meta_key ) {
|
503 |
+
if ( !is_a( $post, 'WP_Post' ) ) {
|
504 |
+
return;
|
505 |
+
}
|
506 |
+
if ( isset( $post->$meta_key ) ) {
|
507 |
+
return $post->$meta_key;
|
508 |
+
}
|
509 |
+
$post_meta = get_post_meta( $post->ID, $meta_key, true );
|
510 |
+
if ( !is_array( $post_meta ) ) {
|
511 |
+
return $post_meta;
|
512 |
+
}
|
513 |
+
}
|
514 |
+
|
515 |
+
/**
|
516 |
+
* ファイルアップロードのname属性を hidden で出力
|
517 |
+
*
|
518 |
+
* @param array|string $upload_file_keys
|
519 |
+
*/
|
520 |
+
protected function get_upload_file_hidden( $upload_file_keys ) {
|
521 |
+
$Form = $this->Form;
|
522 |
+
$upload_file_hidden = '';
|
523 |
+
if ( !is_array( $upload_file_keys ) ) {
|
524 |
+
return $upload_file_hidden;
|
525 |
+
}
|
526 |
+
foreach ( $upload_file_keys as $value ) {
|
527 |
+
$upload_file_hidden .= $Form->hidden( MWF_Config::UPLOAD_FILE_KEYS . '[]', $value );
|
528 |
+
}
|
529 |
+
return $upload_file_hidden;
|
530 |
+
}
|
531 |
+
|
532 |
+
/**
|
533 |
+
* 下位互換性のための class を付与
|
534 |
+
*
|
535 |
+
* @return string mw_wp_form_preview
|
536 |
+
*/
|
537 |
+
protected function get_old_confirm_class() {
|
538 |
+
$old_confirm_class = '';
|
539 |
+
if ( $this->view_flg === 'confirm' ) {
|
540 |
+
$old_confirm_class = 'mw_wp_form_preview';
|
541 |
+
}
|
542 |
+
return $old_confirm_class;
|
543 |
+
}
|
544 |
+
|
545 |
+
/**
|
546 |
+
* スタイル機能用の class を付与
|
547 |
+
*
|
548 |
+
* @return string
|
549 |
+
*/
|
550 |
+
protected function get_class_by_style() {
|
551 |
+
$Setting = $this->Setting;
|
552 |
+
$style = $Setting->get( 'style' );
|
553 |
+
$class_by_style = '';
|
554 |
+
if ( $style ) {
|
555 |
+
$class_by_style = 'mw_wp_form_' . $style;
|
556 |
+
}
|
557 |
+
return $class_by_style;
|
558 |
+
}
|
559 |
+
|
560 |
+
/**
|
561 |
+
* 完了後のメッセージ
|
562 |
+
*
|
563 |
+
* @param array $attributes
|
564 |
+
* @return string html
|
565 |
+
*/
|
566 |
+
public function mwform_complete_message( $attributes, $content = '' ) {
|
567 |
+
$form_key = $this->get( 'key' );
|
568 |
+
return sprintf(
|
569 |
+
'<div id="mw_wp_form_%s" class="mw_wp_form mw_wp_form_%s">
|
570 |
+
%s
|
571 |
+
<!-- end .mw_wp_form --></div>',
|
572 |
+
esc_attr( $form_key ),
|
573 |
+
esc_attr( $this->view_flg ),
|
574 |
+
$content
|
575 |
+
);
|
576 |
+
}
|
577 |
}
|
classes/services/class.mail.php
CHANGED
@@ -1,74 +1,66 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Mail Service
|
4 |
-
* Version : 1.1.
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : January 1, 2015
|
8 |
-
* Modified :
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
class MW_WP_Form_Mail_Service {
|
13 |
|
14 |
/**
|
15 |
-
* $insert_contact_data_id
|
16 |
* 保存した問い合わせデータの Post ID
|
17 |
* @var int
|
18 |
*/
|
19 |
protected $insert_contact_data_id;
|
20 |
|
21 |
/**
|
22 |
-
* $Mail_raw
|
23 |
* @var MW_WP_Form_Mail
|
24 |
*/
|
25 |
protected $Mail_raw;
|
26 |
|
27 |
/**
|
28 |
-
* $Mail_admin_raw
|
29 |
* @var MW_WP_Form_Mail
|
30 |
*/
|
31 |
protected $Mail_admin_raw;
|
32 |
|
33 |
/**
|
34 |
-
* $Mail_auto_raw
|
35 |
* @var MW_WP_Form_Mail
|
36 |
*/
|
37 |
protected $Mail_auto_raw;
|
38 |
|
39 |
/**
|
40 |
-
* $Data
|
41 |
* @var MW_WP_Form_Data
|
42 |
*/
|
43 |
protected $Data;
|
44 |
|
45 |
/**
|
46 |
-
* $form_key
|
47 |
* フォーム識別子
|
48 |
* @var string
|
49 |
*/
|
50 |
protected $form_key;
|
51 |
|
52 |
/**
|
53 |
-
* $validation_rules
|
54 |
* @var array
|
55 |
*/
|
56 |
protected $validation_rules = array();
|
57 |
|
58 |
/**
|
59 |
-
* $attachments
|
60 |
* @var array
|
61 |
*/
|
62 |
protected $attachments = array();
|
63 |
|
64 |
/**
|
65 |
-
* $Setting
|
66 |
* @var MW_WP_Form_Setting
|
67 |
*/
|
68 |
protected $Setting;
|
69 |
|
70 |
/**
|
71 |
* __construct
|
|
|
72 |
* @param MW_WP_Form_Mail $Mail
|
73 |
* @param MW_WP_Form_Data $Data
|
74 |
* @param strign $form_key
|
@@ -99,7 +91,6 @@ class MW_WP_Form_Mail_Service {
|
|
99 |
}
|
100 |
|
101 |
/**
|
102 |
-
* send_admin_mail
|
103 |
* 管理者メールの送信とデータベースへの保存
|
104 |
*/
|
105 |
public function send_admin_mail() {
|
@@ -127,8 +118,8 @@ class MW_WP_Form_Mail_Service {
|
|
127 |
}
|
128 |
|
129 |
/**
|
130 |
-
* get_parsed_mail_object
|
131 |
* パースしたMailオブジェクトの取得とデータベースへの保存
|
|
|
132 |
* @param MW_WP_Form_Mail $_Mail
|
133 |
* @param bool $do_update
|
134 |
* @return MW_WP_Form_Mail
|
@@ -159,7 +150,8 @@ class MW_WP_Form_Mail_Service {
|
|
159 |
}
|
160 |
|
161 |
/**
|
162 |
-
*
|
|
|
163 |
* @param MW_WP_Form_Mail $_Mail
|
164 |
* @param bool $do_update
|
165 |
* @return MW_WP_Form_Mail $Mail
|
@@ -182,8 +174,8 @@ class MW_WP_Form_Mail_Service {
|
|
182 |
}
|
183 |
|
184 |
/**
|
185 |
-
* parse_mail_content
|
186 |
* メール本文用に {name属性} を置換
|
|
|
187 |
* @param string $value
|
188 |
* @param bool $do_update
|
189 |
* @return string
|
@@ -208,9 +200,9 @@ class MW_WP_Form_Mail_Service {
|
|
208 |
}
|
209 |
|
210 |
/**
|
211 |
-
* parse
|
212 |
* $this->_parse_mail_content(), $this->_save_mail_content の本体
|
213 |
* 第2引数でDB保存するか判定
|
|
|
214 |
* @param array $matches
|
215 |
* @param bool $do_update
|
216 |
* @return string $value
|
@@ -239,7 +231,6 @@ class MW_WP_Form_Mail_Service {
|
|
239 |
}
|
240 |
|
241 |
/**
|
242 |
-
* send_reply_mail
|
243 |
* 自動返信メールの送信
|
244 |
*/
|
245 |
public function send_reply_mail() {
|
@@ -250,7 +241,8 @@ class MW_WP_Form_Mail_Service {
|
|
250 |
}
|
251 |
|
252 |
/**
|
253 |
-
*
|
|
|
254 |
* @param MW_WP_Form_Mail $Mail
|
255 |
*/
|
256 |
protected function set_attachments( MW_WP_Form_Mail $Mail ) {
|
@@ -258,7 +250,6 @@ class MW_WP_Form_Mail_Service {
|
|
258 |
}
|
259 |
|
260 |
/**
|
261 |
-
* set_admin_mail_raw_params
|
262 |
* 管理者メールに項目を設定
|
263 |
*/
|
264 |
protected function set_admin_mail_raw_params() {
|
@@ -313,7 +304,6 @@ class MW_WP_Form_Mail_Service {
|
|
313 |
}
|
314 |
|
315 |
/**
|
316 |
-
* set_reply_mail_raw_params
|
317 |
* 自動返信メールに項目を設定
|
318 |
*/
|
319 |
private function set_reply_mail_raw_params() {
|
@@ -325,7 +315,7 @@ class MW_WP_Form_Mail_Service {
|
|
325 |
$form_id = $this->Setting->get( 'post_id' );
|
326 |
if ( $form_id ) {
|
327 |
$automatic_reply_email = $this->Setting->get( 'automatic_reply_email' );
|
328 |
-
$automatic_reply_email = $this->Data->
|
329 |
$is_invalid_mail_address = $this->validation_rules['mail']->rule(
|
330 |
$automatic_reply_email
|
331 |
);
|
@@ -358,8 +348,8 @@ class MW_WP_Form_Mail_Service {
|
|
358 |
}
|
359 |
|
360 |
/**
|
361 |
-
* set_admin_mail_reaquire_params
|
362 |
* 管理者メールに必須の項目を設定
|
|
|
363 |
* @param MW_WP_Form_Mail $Mail
|
364 |
* @return MW_WP_Form_Mail $Mail
|
365 |
*/
|
@@ -381,8 +371,8 @@ class MW_WP_Form_Mail_Service {
|
|
381 |
}
|
382 |
|
383 |
/**
|
384 |
-
* set_reply_mail_reaquire_params
|
385 |
* 自動返信メールに必須の項目を設定
|
|
|
386 |
* @param MW_WP_Form_Mail $Mail
|
387 |
* @return MW_WP_Form_Mail $Mail
|
388 |
*/
|
@@ -401,6 +391,7 @@ class MW_WP_Form_Mail_Service {
|
|
401 |
|
402 |
/**
|
403 |
* apply_filters_mwform_admin_mail_raw
|
|
|
404 |
* @param MW_WP_Form_Mail $Mail
|
405 |
* @return MW_WP_Form_Mail $Mail
|
406 |
*/
|
@@ -415,6 +406,7 @@ class MW_WP_Form_Mail_Service {
|
|
415 |
|
416 |
/**
|
417 |
* apply_filters_mwform_mail
|
|
|
418 |
* @param MW_WP_Form_Mail $Mail
|
419 |
* @return MW_WP_Form_Mail $Mail
|
420 |
*/
|
@@ -429,6 +421,7 @@ class MW_WP_Form_Mail_Service {
|
|
429 |
|
430 |
/**
|
431 |
* apply_filters_mwform_admin_mail
|
|
|
432 |
* @param MW_WP_Form_Mail $Mail
|
433 |
* @return MW_WP_Form_Mail $Mail
|
434 |
*/
|
@@ -443,6 +436,7 @@ class MW_WP_Form_Mail_Service {
|
|
443 |
|
444 |
/**
|
445 |
* apply_filters_mwform_auto_mail_raw
|
|
|
446 |
* @param MW_WP_Form_Mail $Mail
|
447 |
* @return MW_WP_Form_Mail $Mail
|
448 |
*/
|
@@ -457,6 +451,7 @@ class MW_WP_Form_Mail_Service {
|
|
457 |
|
458 |
/**
|
459 |
* apply_filters_mwform_auto_mail
|
|
|
460 |
* @param MW_WP_Form_Mail $Mail
|
461 |
* @return MW_WP_Form_Mail $Mail
|
462 |
*/
|
@@ -477,4 +472,4 @@ class MW_WP_Form_Mail_Service {
|
|
477 |
$this->Setting->update_tracking_number();
|
478 |
}
|
479 |
}
|
480 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Mail Service
|
4 |
+
* Version : 1.1.2
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : January 1, 2015
|
8 |
+
* Modified : April 2, 2015
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
class MW_WP_Form_Mail_Service {
|
13 |
|
14 |
/**
|
|
|
15 |
* 保存した問い合わせデータの Post ID
|
16 |
* @var int
|
17 |
*/
|
18 |
protected $insert_contact_data_id;
|
19 |
|
20 |
/**
|
|
|
21 |
* @var MW_WP_Form_Mail
|
22 |
*/
|
23 |
protected $Mail_raw;
|
24 |
|
25 |
/**
|
|
|
26 |
* @var MW_WP_Form_Mail
|
27 |
*/
|
28 |
protected $Mail_admin_raw;
|
29 |
|
30 |
/**
|
|
|
31 |
* @var MW_WP_Form_Mail
|
32 |
*/
|
33 |
protected $Mail_auto_raw;
|
34 |
|
35 |
/**
|
|
|
36 |
* @var MW_WP_Form_Data
|
37 |
*/
|
38 |
protected $Data;
|
39 |
|
40 |
/**
|
|
|
41 |
* フォーム識別子
|
42 |
* @var string
|
43 |
*/
|
44 |
protected $form_key;
|
45 |
|
46 |
/**
|
|
|
47 |
* @var array
|
48 |
*/
|
49 |
protected $validation_rules = array();
|
50 |
|
51 |
/**
|
|
|
52 |
* @var array
|
53 |
*/
|
54 |
protected $attachments = array();
|
55 |
|
56 |
/**
|
|
|
57 |
* @var MW_WP_Form_Setting
|
58 |
*/
|
59 |
protected $Setting;
|
60 |
|
61 |
/**
|
62 |
* __construct
|
63 |
+
*
|
64 |
* @param MW_WP_Form_Mail $Mail
|
65 |
* @param MW_WP_Form_Data $Data
|
66 |
* @param strign $form_key
|
91 |
}
|
92 |
|
93 |
/**
|
|
|
94 |
* 管理者メールの送信とデータベースへの保存
|
95 |
*/
|
96 |
public function send_admin_mail() {
|
118 |
}
|
119 |
|
120 |
/**
|
|
|
121 |
* パースしたMailオブジェクトの取得とデータベースへの保存
|
122 |
+
*
|
123 |
* @param MW_WP_Form_Mail $_Mail
|
124 |
* @param bool $do_update
|
125 |
* @return MW_WP_Form_Mail
|
150 |
}
|
151 |
|
152 |
/**
|
153 |
+
* メールオブジェクトの各プロパティを変換
|
154 |
+
*
|
155 |
* @param MW_WP_Form_Mail $_Mail
|
156 |
* @param bool $do_update
|
157 |
* @return MW_WP_Form_Mail $Mail
|
174 |
}
|
175 |
|
176 |
/**
|
|
|
177 |
* メール本文用に {name属性} を置換
|
178 |
+
*
|
179 |
* @param string $value
|
180 |
* @param bool $do_update
|
181 |
* @return string
|
200 |
}
|
201 |
|
202 |
/**
|
|
|
203 |
* $this->_parse_mail_content(), $this->_save_mail_content の本体
|
204 |
* 第2引数でDB保存するか判定
|
205 |
+
*
|
206 |
* @param array $matches
|
207 |
* @param bool $do_update
|
208 |
* @return string $value
|
231 |
}
|
232 |
|
233 |
/**
|
|
|
234 |
* 自動返信メールの送信
|
235 |
*/
|
236 |
public function send_reply_mail() {
|
241 |
}
|
242 |
|
243 |
/**
|
244 |
+
* メールオブジェクトに添付ファイルを添付
|
245 |
+
*
|
246 |
* @param MW_WP_Form_Mail $Mail
|
247 |
*/
|
248 |
protected function set_attachments( MW_WP_Form_Mail $Mail ) {
|
250 |
}
|
251 |
|
252 |
/**
|
|
|
253 |
* 管理者メールに項目を設定
|
254 |
*/
|
255 |
protected function set_admin_mail_raw_params() {
|
304 |
}
|
305 |
|
306 |
/**
|
|
|
307 |
* 自動返信メールに項目を設定
|
308 |
*/
|
309 |
private function set_reply_mail_raw_params() {
|
315 |
$form_id = $this->Setting->get( 'post_id' );
|
316 |
if ( $form_id ) {
|
317 |
$automatic_reply_email = $this->Setting->get( 'automatic_reply_email' );
|
318 |
+
$automatic_reply_email = $this->Data->get_post_value_by_key( $automatic_reply_email );
|
319 |
$is_invalid_mail_address = $this->validation_rules['mail']->rule(
|
320 |
$automatic_reply_email
|
321 |
);
|
348 |
}
|
349 |
|
350 |
/**
|
|
|
351 |
* 管理者メールに必須の項目を設定
|
352 |
+
*
|
353 |
* @param MW_WP_Form_Mail $Mail
|
354 |
* @return MW_WP_Form_Mail $Mail
|
355 |
*/
|
371 |
}
|
372 |
|
373 |
/**
|
|
|
374 |
* 自動返信メールに必須の項目を設定
|
375 |
+
*
|
376 |
* @param MW_WP_Form_Mail $Mail
|
377 |
* @return MW_WP_Form_Mail $Mail
|
378 |
*/
|
391 |
|
392 |
/**
|
393 |
* apply_filters_mwform_admin_mail_raw
|
394 |
+
*
|
395 |
* @param MW_WP_Form_Mail $Mail
|
396 |
* @return MW_WP_Form_Mail $Mail
|
397 |
*/
|
406 |
|
407 |
/**
|
408 |
* apply_filters_mwform_mail
|
409 |
+
*
|
410 |
* @param MW_WP_Form_Mail $Mail
|
411 |
* @return MW_WP_Form_Mail $Mail
|
412 |
*/
|
421 |
|
422 |
/**
|
423 |
* apply_filters_mwform_admin_mail
|
424 |
+
*
|
425 |
* @param MW_WP_Form_Mail $Mail
|
426 |
* @return MW_WP_Form_Mail $Mail
|
427 |
*/
|
436 |
|
437 |
/**
|
438 |
* apply_filters_mwform_auto_mail_raw
|
439 |
+
*
|
440 |
* @param MW_WP_Form_Mail $Mail
|
441 |
* @return MW_WP_Form_Mail $Mail
|
442 |
*/
|
451 |
|
452 |
/**
|
453 |
* apply_filters_mwform_auto_mail
|
454 |
+
*
|
455 |
* @param MW_WP_Form_Mail $Mail
|
456 |
* @return MW_WP_Form_Mail $Mail
|
457 |
*/
|
472 |
$this->Setting->update_tracking_number();
|
473 |
}
|
474 |
}
|
475 |
+
}
|
classes/services/class.redirected.php
CHANGED
@@ -1,43 +1,40 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Redirected
|
4 |
-
* Version : 1.0.
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : December 31, 2014
|
8 |
-
* Modified :
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
class MW_WP_Form_Redirected {
|
13 |
|
14 |
/**
|
15 |
-
* $mode_check
|
16 |
* 現在のモード
|
17 |
* @var string input|confirm|complete|back
|
18 |
*/
|
19 |
protected $mode_check = 'input';
|
20 |
|
21 |
/**
|
22 |
-
* $view_flg
|
23 |
* @var string input|confirm|complete
|
24 |
*/
|
25 |
protected $view_flg = 'input';
|
26 |
|
27 |
/**
|
28 |
-
* $url
|
29 |
* @var string
|
30 |
*/
|
31 |
protected $url;
|
32 |
|
33 |
/**
|
34 |
-
* $querystring
|
35 |
* @var bool
|
36 |
*/
|
37 |
protected $querystring;
|
38 |
|
39 |
/**
|
40 |
* __construct
|
|
|
41 |
* @param string $input
|
42 |
* @param string $confirm
|
43 |
* @param string $complete
|
@@ -53,7 +50,8 @@ class MW_WP_Form_Redirected {
|
|
53 |
}
|
54 |
|
55 |
/**
|
56 |
-
*
|
|
|
57 |
* @param string $input
|
58 |
* @param string $confirm
|
59 |
* @param string $complete
|
@@ -130,16 +128,17 @@ class MW_WP_Form_Redirected {
|
|
130 |
}
|
131 |
|
132 |
/**
|
133 |
-
* get_url
|
134 |
* リダイレクト先の URL を返す
|
|
|
|
|
135 |
*/
|
136 |
public function get_url() {
|
137 |
return $this->url;
|
138 |
}
|
139 |
|
140 |
/**
|
141 |
-
* get_view_flg
|
142 |
* 表示すべき画面を示すフラグを返す
|
|
|
143 |
* @return string $this->view_flg
|
144 |
*/
|
145 |
public function get_view_flg() {
|
@@ -147,8 +146,8 @@ class MW_WP_Form_Redirected {
|
|
147 |
}
|
148 |
|
149 |
/**
|
150 |
-
* get_request_uri
|
151 |
* $_SERVER['REQUEST_URI'] を http:// からはじまるURLに変換する
|
|
|
152 |
* @return string URL
|
153 |
*/
|
154 |
public function get_request_uri() {
|
@@ -170,8 +169,8 @@ class MW_WP_Form_Redirected {
|
|
170 |
}
|
171 |
|
172 |
/**
|
173 |
-
* parse_url
|
174 |
* http:// からはじまるURLに変換する
|
|
|
175 |
* @param string URL
|
176 |
* @return string URL
|
177 |
*/
|
@@ -206,4 +205,4 @@ class MW_WP_Form_Redirected {
|
|
206 |
}
|
207 |
return $url;
|
208 |
}
|
209 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Redirected
|
4 |
+
* Version : 1.0.1
|
5 |
* Author : Takashi Kitajima
|
6 |
* Author URI : http://2inc.org
|
7 |
* Created : December 31, 2014
|
8 |
+
* Modified : April 3, 2015
|
9 |
* License : GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
class MW_WP_Form_Redirected {
|
13 |
|
14 |
/**
|
|
|
15 |
* 現在のモード
|
16 |
* @var string input|confirm|complete|back
|
17 |
*/
|
18 |
protected $mode_check = 'input';
|
19 |
|
20 |
/**
|
|
|
21 |
* @var string input|confirm|complete
|
22 |
*/
|
23 |
protected $view_flg = 'input';
|
24 |
|
25 |
/**
|
|
|
26 |
* @var string
|
27 |
*/
|
28 |
protected $url;
|
29 |
|
30 |
/**
|
|
|
31 |
* @var bool
|
32 |
*/
|
33 |
protected $querystring;
|
34 |
|
35 |
/**
|
36 |
* __construct
|
37 |
+
*
|
38 |
* @param string $input
|
39 |
* @param string $confirm
|
40 |
* @param string $complete
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
+
* initialize
|
54 |
+
*
|
55 |
* @param string $input
|
56 |
* @param string $confirm
|
57 |
* @param string $complete
|
128 |
}
|
129 |
|
130 |
/**
|
|
|
131 |
* リダイレクト先の URL を返す
|
132 |
+
*
|
133 |
+
* @return string
|
134 |
*/
|
135 |
public function get_url() {
|
136 |
return $this->url;
|
137 |
}
|
138 |
|
139 |
/**
|
|
|
140 |
* 表示すべき画面を示すフラグを返す
|
141 |
+
*
|
142 |
* @return string $this->view_flg
|
143 |
*/
|
144 |
public function get_view_flg() {
|
146 |
}
|
147 |
|
148 |
/**
|
|
|
149 |
* $_SERVER['REQUEST_URI'] を http:// からはじまるURLに変換する
|
150 |
+
*
|
151 |
* @return string URL
|
152 |
*/
|
153 |
public function get_request_uri() {
|
169 |
}
|
170 |
|
171 |
/**
|
|
|
172 |
* http:// からはじまるURLに変換する
|
173 |
+
*
|
174 |
* @param string URL
|
175 |
* @return string URL
|
176 |
*/
|
205 |
}
|
206 |
return $url;
|
207 |
}
|
208 |
+
}
|
classes/validation-rules/class.akismet.php
CHANGED
@@ -2,25 +2,25 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Akismet
|
4 |
* Description: Akismetのエラー。常にtrue
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Akismet extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'akismet_check';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
@@ -34,7 +34,8 @@ class MW_WP_Form_Validation_Rule_Akismet extends MW_WP_Form_Abstract_Validation_
|
|
34 |
}
|
35 |
|
36 |
/**
|
37 |
-
*
|
|
|
38 |
* @param numeric $key バリデーションルールセットの識別番号
|
39 |
* @param array $value バリデーションルールセットの内容
|
40 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Akismet
|
4 |
* Description: Akismetのエラー。常にtrue
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 3, 2014
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Akismet extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'akismet_check';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
34 |
}
|
35 |
|
36 |
/**
|
37 |
+
* 設定パネルに追加
|
38 |
+
*
|
39 |
* @param numeric $key バリデーションルールセットの識別番号
|
40 |
* @param array $value バリデーションルールセットの内容
|
41 |
*/
|
classes/validation-rules/class.alpha.php
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Alpha
|
4 |
* Description: 値がアルファベット
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Alpha extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'alpha';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
if ( !preg_match( '/^[A-Za-z]+$/', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'Please enter with a half-width alphabetic character.', MWF_Config::DOMAIN )
|
@@ -39,7 +39,8 @@ class MW_WP_Form_Validation_Rule_Alpha extends MW_WP_Form_Abstract_Validation_Ru
|
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
*
|
|
|
43 |
* @param numeric $key バリデーションルールセットの識別番号
|
44 |
* @param array $value バリデーションルールセットの内容
|
45 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Alpha
|
4 |
* Description: 値がアルファベット
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Alpha extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'alpha';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
if ( !preg_match( '/^[A-Za-z]+$/', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'Please enter with a half-width alphabetic character.', MWF_Config::DOMAIN )
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* 設定パネルに追加
|
43 |
+
*
|
44 |
* @param numeric $key バリデーションルールセットの識別番号
|
45 |
* @param array $value バリデーションルールセットの内容
|
46 |
*/
|
classes/validation-rules/class.alphanumeric.php
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule AlphaNumeric
|
4 |
* Description: 値が英数字
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_AlphaNumeric extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'alphanumeric';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
if ( !preg_match( '/^[0-9A-Za-z]+$/', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'Please enter with a half-width alphanumeric character.', MWF_Config::DOMAIN )
|
@@ -39,7 +39,8 @@ class MW_WP_Form_Validation_Rule_AlphaNumeric extends MW_WP_Form_Abstract_Valida
|
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
*
|
|
|
43 |
* @param numeric $key バリデーションルールセットの識別番号
|
44 |
* @param array $value バリデーションルールセットの内容
|
45 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule AlphaNumeric
|
4 |
* Description: 値が英数字
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_AlphaNumeric extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'alphanumeric';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
if ( !preg_match( '/^[0-9A-Za-z]+$/', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'Please enter with a half-width alphanumeric character.', MWF_Config::DOMAIN )
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* 設定パネルに追加
|
43 |
+
*
|
44 |
* @param numeric $key バリデーションルールセットの識別番号
|
45 |
* @param array $value バリデーションルールセットの内容
|
46 |
*/
|
classes/validation-rules/class.between.php
CHANGED
@@ -2,25 +2,25 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Between
|
4 |
* Description: 値の文字数が範囲内
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Between extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'between';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
@@ -28,7 +28,7 @@ class MW_WP_Form_Validation_Rule_Between extends MW_WP_Form_Abstract_Validation_
|
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
$value = MWF_Functions::convert_eol( $value );
|
31 |
-
if ( !
|
32 |
$defaults = array(
|
33 |
'min' => 0,
|
34 |
'max' => 0,
|
@@ -55,7 +55,8 @@ class MW_WP_Form_Validation_Rule_Between extends MW_WP_Form_Abstract_Validation_
|
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
-
*
|
|
|
59 |
* @param numeric $key バリデーションルールセットの識別番号
|
60 |
* @param array $value バリデーションルールセットの内容
|
61 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Between
|
4 |
* Description: 値の文字数が範囲内
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Between extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'between';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
$value = MWF_Functions::convert_eol( $value );
|
31 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
32 |
$defaults = array(
|
33 |
'min' => 0,
|
34 |
'max' => 0,
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
+
* 設定パネルに追加
|
59 |
+
*
|
60 |
* @param numeric $key バリデーションルールセットの識別番号
|
61 |
* @param array $value バリデーションルールセットの内容
|
62 |
*/
|
classes/validation-rules/class.date.php
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Date
|
4 |
* Description: 日付が正しいかどうか
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Date extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'date';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
$defaults = array(
|
32 |
'message' => __( 'This is not the format of a date.', MWF_Config::DOMAIN )
|
33 |
);
|
@@ -50,7 +50,8 @@ class MW_WP_Form_Validation_Rule_Date extends MW_WP_Form_Abstract_Validation_Rul
|
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
-
*
|
|
|
54 |
* @param numeric $key バリデーションルールセットの識別番号
|
55 |
* @param array $value バリデーションルールセットの内容
|
56 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Date
|
4 |
* Description: 日付が正しいかどうか
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Date extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'date';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
$defaults = array(
|
32 |
'message' => __( 'This is not the format of a date.', MWF_Config::DOMAIN )
|
33 |
);
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
+
* 設定パネルに追加
|
54 |
+
*
|
55 |
* @param numeric $key バリデーションルールセットの識別番号
|
56 |
* @param array $value バリデーションルールセットの内容
|
57 |
*/
|
classes/validation-rules/class.eq.php
CHANGED
@@ -2,46 +2,47 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Eq
|
4 |
* Description: 値が一致している
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Eq extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'eq';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
$defaults = array(
|
32 |
'target' => null,
|
33 |
'message' => __( 'This is not in agreement.', MWF_Config::DOMAIN )
|
34 |
);
|
35 |
$options = array_merge( $defaults, $options );
|
36 |
$target_value = $this->Data->get( $options['target'] );
|
37 |
-
if ( $value !== $target_value ) {
|
38 |
return $options['message'];
|
39 |
}
|
40 |
}
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
-
*
|
|
|
45 |
* @param numeric $key バリデーションルールセットの識別番号
|
46 |
* @param array $value バリデーションルールセットの内容
|
47 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Eq
|
4 |
* Description: 値が一致している
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Eq extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'eq';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
$defaults = array(
|
32 |
'target' => null,
|
33 |
'message' => __( 'This is not in agreement.', MWF_Config::DOMAIN )
|
34 |
);
|
35 |
$options = array_merge( $defaults, $options );
|
36 |
$target_value = $this->Data->get( $options['target'] );
|
37 |
+
if ( ( string ) $value !== ( string ) $target_value ) {
|
38 |
return $options['message'];
|
39 |
}
|
40 |
}
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
+
* 設定パネルに追加
|
45 |
+
*
|
46 |
* @param numeric $key バリデーションルールセットの識別番号
|
47 |
* @param array $value バリデーションルールセットの内容
|
48 |
*/
|
classes/validation-rules/class.filesize.php
CHANGED
@@ -13,20 +13,20 @@
|
|
13 |
class MW_WP_Form_Validation_Rule_FileSize extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'filesize';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
-
$data = $this->Data->
|
30 |
if ( !is_null( $data ) && is_array( $data ) && array_key_exists( $key, $data ) ) {
|
31 |
$file = $data[$key];
|
32 |
if ( !empty( $file['size'] ) ) {
|
@@ -43,7 +43,8 @@ class MW_WP_Form_Validation_Rule_FileSize extends MW_WP_Form_Abstract_Validation
|
|
43 |
}
|
44 |
|
45 |
/**
|
46 |
-
*
|
|
|
47 |
* @param numeric $key バリデーションルールセットの識別番号
|
48 |
* @param array $value バリデーションルールセットの内容
|
49 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_FileSize extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'filesize';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
+
$data = $this->Data->get_post_value_by_key( MWF_Config::UPLOAD_FILES );
|
30 |
if ( !is_null( $data ) && is_array( $data ) && array_key_exists( $key, $data ) ) {
|
31 |
$file = $data[$key];
|
32 |
if ( !empty( $file['size'] ) ) {
|
43 |
}
|
44 |
|
45 |
/**
|
46 |
+
* 設定パネルに追加
|
47 |
+
*
|
48 |
* @param numeric $key バリデーションルールセットの識別番号
|
49 |
* @param array $value バリデーションルールセットの内容
|
50 |
*/
|
classes/validation-rules/class.filetype.php
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule FileType
|
4 |
* Description: ファイル名が指定した拡張子を含む。types は , 区切り
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_FileType extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'filetype';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
$defaults = array(
|
32 |
'types' => '',
|
33 |
'message' => __( 'This file is invalid.', MWF_Config::DOMAIN )
|
@@ -46,7 +46,8 @@ class MW_WP_Form_Validation_Rule_FileType extends MW_WP_Form_Abstract_Validation
|
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
-
*
|
|
|
50 |
* @param numeric $key バリデーションルールセットの識別番号
|
51 |
* @param array $value バリデーションルールセットの内容
|
52 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule FileType
|
4 |
* Description: ファイル名が指定した拡張子を含む。types は , 区切り
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_FileType extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'filetype';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
$defaults = array(
|
32 |
'types' => '',
|
33 |
'message' => __( 'This file is invalid.', MWF_Config::DOMAIN )
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
+
* 設定パネルに追加
|
50 |
+
*
|
51 |
* @param numeric $key バリデーションルールセットの識別番号
|
52 |
* @param array $value バリデーションルールセットの内容
|
53 |
*/
|
classes/validation-rules/class.hiragana.php
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Hiragana
|
4 |
* Description: 値がひらがな
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Hiragana extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'hiragana';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
if ( !preg_match( '/^[ぁ-ゞ ]*?[ぁ-ゞ]+?[ぁ-ゞ ]*?$/u', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'Please enter with a Japanese Hiragana.', MWF_Config::DOMAIN )
|
@@ -39,7 +39,8 @@ class MW_WP_Form_Validation_Rule_Hiragana extends MW_WP_Form_Abstract_Validation
|
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
*
|
|
|
43 |
* @param numeric $key バリデーションルールセットの識別番号
|
44 |
* @param array $value バリデーションルールセットの内容
|
45 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Hiragana
|
4 |
* Description: 値がひらがな
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Hiragana extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'hiragana';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
if ( !preg_match( '/^[ぁ-ゞ ]*?[ぁ-ゞ]+?[ぁ-ゞ ]*?$/u', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'Please enter with a Japanese Hiragana.', MWF_Config::DOMAIN )
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* 設定パネルに追加
|
43 |
+
*
|
44 |
* @param numeric $key バリデーションルールセットの識別番号
|
45 |
* @param array $value バリデーションルールセットの内容
|
46 |
*/
|
classes/validation-rules/class.in.php
CHANGED
@@ -2,25 +2,25 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule In
|
4 |
* Description: 値が、配列で指定された中に含まれている
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_In extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'in';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
@@ -28,7 +28,7 @@ class MW_WP_Form_Validation_Rule_In extends MW_WP_Form_Abstract_Validation_Rule
|
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
$value = ( string ) $value;
|
31 |
-
if ( !
|
32 |
$defaults = array(
|
33 |
'options' => array(),
|
34 |
'message' => __( 'This value is invalid.', MWF_Config::DOMAIN )
|
@@ -47,7 +47,8 @@ class MW_WP_Form_Validation_Rule_In extends MW_WP_Form_Abstract_Validation_Rule
|
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
-
*
|
|
|
51 |
* @param numeric $key バリデーションルールセットの識別番号
|
52 |
* @param array $value バリデーションルールセットの内容
|
53 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule In
|
4 |
* Description: 値が、配列で指定された中に含まれている
|
5 |
+
* Version : 1.1.2
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_In extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'in';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
$value = ( string ) $value;
|
31 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
32 |
$defaults = array(
|
33 |
'options' => array(),
|
34 |
'message' => __( 'This value is invalid.', MWF_Config::DOMAIN )
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
+
* 設定パネルに追加
|
51 |
+
*
|
52 |
* @param numeric $key バリデーションルールセットの識別番号
|
53 |
* @param array $value バリデーションルールセットの内容
|
54 |
*/
|
classes/validation-rules/class.katakana.php
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Katakana
|
4 |
* Description: 値がカタカナ
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Katakana extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'katakana';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
if ( !preg_match( '/^[ァ-ヾ ]*?[ァ-ヾ]+?[ァ-ヾ ]*?$/u', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'Please enter with a Japanese Katakana.', MWF_Config::DOMAIN )
|
@@ -39,7 +39,8 @@ class MW_WP_Form_Validation_Rule_Katakana extends MW_WP_Form_Abstract_Validation
|
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
*
|
|
|
43 |
* @param numeric $key バリデーションルールセットの識別番号
|
44 |
* @param array $value バリデーションルールセットの内容
|
45 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Katakana
|
4 |
* Description: 値がカタカナ
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Katakana extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'katakana';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
if ( !preg_match( '/^[ァ-ヾ ]*?[ァ-ヾ]+?[ァ-ヾ ]*?$/u', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'Please enter with a Japanese Katakana.', MWF_Config::DOMAIN )
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* 設定パネルに追加
|
43 |
+
*
|
44 |
* @param numeric $key バリデーションルールセットの識別番号
|
45 |
* @param array $value バリデーションルールセットの内容
|
46 |
*/
|
classes/validation-rules/class.mail.php
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Mail
|
4 |
* Description: 値がメールアドレス
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Mail extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'mail';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
if ( !preg_match( '/^[^@]+@([^@^\.]+\.)+[^@^\.]+$/', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'This is not the format of a mail address.', MWF_Config::DOMAIN )
|
@@ -39,7 +39,8 @@ class MW_WP_Form_Validation_Rule_Mail extends MW_WP_Form_Abstract_Validation_Rul
|
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
*
|
|
|
43 |
* @param numeric $key バリデーションルールセットの識別番号
|
44 |
* @param array $value バリデーションルールセットの内容
|
45 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Mail
|
4 |
* Description: 値がメールアドレス
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Mail extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'mail';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
if ( !preg_match( '/^[^@]+@([^@^\.]+\.)+[^@^\.]+$/', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'This is not the format of a mail address.', MWF_Config::DOMAIN )
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* 設定パネルに追加
|
43 |
+
*
|
44 |
* @param numeric $key バリデーションルールセットの識別番号
|
45 |
* @param array $value バリデーションルールセットの内容
|
46 |
*/
|
classes/validation-rules/class.minlength.php
CHANGED
@@ -2,25 +2,25 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule MinLength
|
4 |
* Description: 値の文字数が範囲内
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_MinLength extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'minlength';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
@@ -28,7 +28,7 @@ class MW_WP_Form_Validation_Rule_MinLength extends MW_WP_Form_Abstract_Validatio
|
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
$value = MWF_Functions::convert_eol( $value );
|
31 |
-
if ( !
|
32 |
$defaults = array(
|
33 |
'min' => 0,
|
34 |
'message' => __( 'The number of characters is a few.', MWF_Config::DOMAIN )
|
@@ -42,7 +42,8 @@ class MW_WP_Form_Validation_Rule_MinLength extends MW_WP_Form_Abstract_Validatio
|
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
-
*
|
|
|
46 |
* @param numeric $key バリデーションルールセットの識別番号
|
47 |
* @param array $value バリデーションルールセットの内容
|
48 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule MinLength
|
4 |
* Description: 値の文字数が範囲内
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_MinLength extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'minlength';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
$value = MWF_Functions::convert_eol( $value );
|
31 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
32 |
$defaults = array(
|
33 |
'min' => 0,
|
34 |
'message' => __( 'The number of characters is a few.', MWF_Config::DOMAIN )
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
+
* 設定パネルに追加
|
46 |
+
*
|
47 |
* @param numeric $key バリデーションルールセットの識別番号
|
48 |
* @param array $value バリデーションルールセットの内容
|
49 |
*/
|
classes/validation-rules/class.noempty.php
CHANGED
@@ -2,25 +2,25 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule noEmpty
|
4 |
* Description: 値が空ではない(0は許可)
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_noEmpty extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'noempty';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
@@ -37,7 +37,8 @@ class MW_WP_Form_Validation_Rule_noEmpty extends MW_WP_Form_Abstract_Validation_
|
|
37 |
}
|
38 |
|
39 |
/**
|
40 |
-
*
|
|
|
41 |
* @param numeric $key バリデーションルールセットの識別番号
|
42 |
* @param array $value バリデーションルールセットの内容
|
43 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule noEmpty
|
4 |
* Description: 値が空ではない(0は許可)
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_noEmpty extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'noempty';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
37 |
}
|
38 |
|
39 |
/**
|
40 |
+
* 設定パネルに追加
|
41 |
+
*
|
42 |
* @param numeric $key バリデーションルールセットの識別番号
|
43 |
* @param array $value バリデーションルールセットの内容
|
44 |
*/
|
classes/validation-rules/class.nofalse.php
CHANGED
@@ -2,25 +2,25 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule noFalse
|
4 |
* Description: 値が空ではない(0も不可)
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_noFalse extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'nofalse';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
@@ -37,7 +37,8 @@ class MW_WP_Form_Validation_Rule_noFalse extends MW_WP_Form_Abstract_Validation_
|
|
37 |
}
|
38 |
|
39 |
/**
|
40 |
-
*
|
|
|
41 |
* @param numeric $key バリデーションルールセットの識別番号
|
42 |
* @param array $value バリデーションルールセットの内容
|
43 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule noFalse
|
4 |
* Description: 値が空ではない(0も不可)
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_noFalse extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'nofalse';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
37 |
}
|
38 |
|
39 |
/**
|
40 |
+
* 設定パネルに追加
|
41 |
+
*
|
42 |
* @param numeric $key バリデーションルールセットの識別番号
|
43 |
* @param array $value バリデーションルールセットの内容
|
44 |
*/
|
classes/validation-rules/class.numeric.php
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Numeric
|
4 |
* Description: 値が数値
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Numeric extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'numeric';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
if ( !preg_match( '/^[0-9]+$/', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'Please enter with a half-width number.', MWF_Config::DOMAIN )
|
@@ -39,7 +39,8 @@ class MW_WP_Form_Validation_Rule_Numeric extends MW_WP_Form_Abstract_Validation_
|
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
*
|
|
|
43 |
* @param numeric $key バリデーションルールセットの識別番号
|
44 |
* @param array $value バリデーションルールセットの内容
|
45 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Numeric
|
4 |
* Description: 値が数値
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Numeric extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'numeric';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
if ( !preg_match( '/^[0-9]+$/', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'Please enter with a half-width number.', MWF_Config::DOMAIN )
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* 設定パネルに追加
|
43 |
+
*
|
44 |
* @param numeric $key バリデーションルールセットの識別番号
|
45 |
* @param array $value バリデーションルールセットの内容
|
46 |
*/
|
classes/validation-rules/class.required.php
CHANGED
@@ -13,14 +13,14 @@
|
|
13 |
class MW_WP_Form_Validation_Rule_Required extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'required';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
@@ -39,7 +39,8 @@ class MW_WP_Form_Validation_Rule_Required extends MW_WP_Form_Abstract_Validation
|
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
*
|
|
|
43 |
* @param numeric $key バリデーションルールセットの識別番号
|
44 |
* @param array $value バリデーションルールセットの内容
|
45 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Required extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'required';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* 設定パネルに追加
|
43 |
+
*
|
44 |
* @param numeric $key バリデーションルールセットの識別番号
|
45 |
* @param array $value バリデーションルールセットの内容
|
46 |
*/
|
classes/validation-rules/class.tel.php
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Tel
|
4 |
* Description: 値が電話番号
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Tel extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'tel';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
$defaults = array(
|
32 |
'message' => __( 'This is not the format of a tel number.', MWF_Config::DOMAIN )
|
33 |
);
|
@@ -37,7 +37,8 @@ class MW_WP_Form_Validation_Rule_Tel extends MW_WP_Form_Abstract_Validation_Rule
|
|
37 |
preg_match( '/^\d{3}-\d{3,4}-\d{4}$/', $value ) ||
|
38 |
preg_match( '/^\d{4}-\d{2}-\d{4}$/', $value ) ||
|
39 |
preg_match( '/^\d{4}-\d{3}-\d{3}$/', $value ) ||
|
40 |
-
preg_match( '/^\d{5}-\d{1}-\d{4}$/', $value )
|
|
|
41 |
) ) {
|
42 |
return $options['message'];
|
43 |
}
|
@@ -45,7 +46,8 @@ class MW_WP_Form_Validation_Rule_Tel extends MW_WP_Form_Abstract_Validation_Rule
|
|
45 |
}
|
46 |
|
47 |
/**
|
48 |
-
*
|
|
|
49 |
* @param numeric $key バリデーションルールセットの識別番号
|
50 |
* @param array $value バリデーションルールセットの内容
|
51 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Tel
|
4 |
* Description: 値が電話番号
|
5 |
+
* Version : 1.1.2
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Tel extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'tel';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
$defaults = array(
|
32 |
'message' => __( 'This is not the format of a tel number.', MWF_Config::DOMAIN )
|
33 |
);
|
37 |
preg_match( '/^\d{3}-\d{3,4}-\d{4}$/', $value ) ||
|
38 |
preg_match( '/^\d{4}-\d{2}-\d{4}$/', $value ) ||
|
39 |
preg_match( '/^\d{4}-\d{3}-\d{3}$/', $value ) ||
|
40 |
+
preg_match( '/^\d{5}-\d{1}-\d{4}$/', $value ) ||
|
41 |
+
preg_match( '/^\d{10,11}$/', $value )
|
42 |
) ) {
|
43 |
return $options['message'];
|
44 |
}
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
+
* 設定パネルに追加
|
50 |
+
*
|
51 |
* @param numeric $key バリデーションルールセットの識別番号
|
52 |
* @param array $value バリデーションルールセットの内容
|
53 |
*/
|
classes/validation-rules/class.url.php
CHANGED
@@ -2,33 +2,33 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Url
|
4 |
* Description: 値がURL
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Url extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'url';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
-
if ( !preg_match( '/^https{0,1}:\/\/[^\/]
|
32 |
$defaults = array(
|
33 |
'message' => __( 'This is not the format of a url.', MWF_Config::DOMAIN )
|
34 |
);
|
@@ -39,7 +39,8 @@ class MW_WP_Form_Validation_Rule_Url extends MW_WP_Form_Abstract_Validation_Rule
|
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
*
|
|
|
43 |
* @param numeric $key バリデーションルールセットの識別番号
|
44 |
* @param array $value バリデーションルールセットの内容
|
45 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Url
|
4 |
* Description: 値がURL
|
5 |
+
* Version : 1.1.1
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Url extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'url';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
+
if ( !preg_match( '/^https{0,1}:\/\/[^\/]+\.[^\.]+/', $value ) ) {
|
32 |
$defaults = array(
|
33 |
'message' => __( 'This is not the format of a url.', MWF_Config::DOMAIN )
|
34 |
);
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* 設定パネルに追加
|
43 |
+
*
|
44 |
* @param numeric $key バリデーションルールセットの識別番号
|
45 |
* @param array $value バリデーションルールセットの内容
|
46 |
*/
|
classes/validation-rules/class.zip.php
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Zip
|
4 |
* Description: 値が郵便番号
|
5 |
-
* Version : 1.1.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
-
* Modified :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Zip extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
16 |
-
* $name
|
17 |
* バリデーションルール名を指定
|
18 |
* @var string
|
19 |
*/
|
20 |
protected $name = 'zip';
|
21 |
|
22 |
/**
|
23 |
-
*
|
|
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
-
if ( !
|
31 |
$defaults = array(
|
32 |
'message' => __( 'This is not the format of a zip code.', MWF_Config::DOMAIN )
|
33 |
);
|
@@ -39,7 +39,8 @@ class MW_WP_Form_Validation_Rule_Zip extends MW_WP_Form_Abstract_Validation_Rule
|
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
*
|
|
|
43 |
* @param numeric $key バリデーションルールセットの識別番号
|
44 |
* @param array $value バリデーションルールセットの内容
|
45 |
*/
|
2 |
/**
|
3 |
* Name : MW WP Form Validation Rule Zip
|
4 |
* Description: 値が郵便番号
|
5 |
+
* Version : 1.1.2
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : July 21, 2014
|
9 |
+
* Modified : April 1, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
13 |
class MW_WP_Form_Validation_Rule_Zip extends MW_WP_Form_Abstract_Validation_Rule {
|
14 |
|
15 |
/**
|
|
|
16 |
* バリデーションルール名を指定
|
17 |
* @var string
|
18 |
*/
|
19 |
protected $name = 'zip';
|
20 |
|
21 |
/**
|
22 |
+
* バリデーションチェック
|
23 |
+
*
|
24 |
* @param string $key name属性
|
25 |
* @param array $option
|
26 |
* @return string エラーメッセージ
|
27 |
*/
|
28 |
public function rule( $key, array $options = array() ) {
|
29 |
$value = $this->Data->get( $key );
|
30 |
+
if ( !MWF_Functions::is_empty( $value ) ) {
|
31 |
$defaults = array(
|
32 |
'message' => __( 'This is not the format of a zip code.', MWF_Config::DOMAIN )
|
33 |
);
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
+
* 設定パネルに追加
|
43 |
+
*
|
44 |
* @param numeric $key バリデーションルールセットの識別番号
|
45 |
* @param array $value バリデーションルールセットの内容
|
46 |
*/
|
classes/views/class.admin-list.php
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Name : MW WP Form Admin List View
|
4 |
-
* Version : 1.0.1
|
5 |
-
* Author : Takashi Kitajima
|
6 |
-
* Author URI : http://2inc.org
|
7 |
-
* Created : January 2, 2015
|
8 |
-
* Modified : February 8, 2015
|
9 |
-
* License : GPLv2
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
class MW_WP_Form_Admin_List_View extends MW_WP_Form_View {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* form_key
|
16 |
-
*/
|
17 |
-
public function form_key() {
|
18 |
-
$post_id = $this->get( 'post_id' );
|
19 |
-
printf(
|
20 |
-
'<span id="formkey_field">[mwform_formkey key="%d"]</span>',
|
21 |
-
$post_id
|
22 |
-
);
|
23 |
-
}
|
24 |
-
|
25 |
-
/**
|
26 |
-
* donate_link
|
27 |
-
* @param array $views
|
28 |
-
* @return array
|
29 |
-
*/
|
30 |
-
public function donate_link( $views ) {
|
31 |
-
$donation = array( 'donation' => '<div class="donation"><p>' . __( 'Your contribution is needed for making this plugin better.', MWF_Config::DOMAIN ) . ' <a href="http://www.amazon.co.jp/registry/wishlist/39ANKRNSTNW40" class="button">' . __( 'Donate', MWF_Config::DOMAIN ) . '</a></p></div>' );
|
32 |
-
$views = array_merge( $donation, $views );
|
33 |
-
return $views;
|
34 |
-
}
|
35 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/views/class.admin.php
DELETED
@@ -1,363 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Name : MW WP Form Admin View
|
4 |
-
* Version : 1.0.2
|
5 |
-
* Author : Takashi Kitajima
|
6 |
-
* Author URI : http://2inc.org
|
7 |
-
* Created : January 2, 2015
|
8 |
-
* Modified : February 8, 2015
|
9 |
-
* License : GPLv2
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
class MW_WP_Form_Admin_View extends MW_WP_Form_View {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* complete_message
|
16 |
-
* 完了画面内容の入力画面を表示
|
17 |
-
*/
|
18 |
-
public function complete_message() {
|
19 |
-
$complete_message = $this->get( 'complete_message' );
|
20 |
-
wp_editor( $complete_message, MWF_Config::NAME . '_complete_message', array(
|
21 |
-
'textarea_name' => MWF_Config::NAME . '[complete_message]',
|
22 |
-
'textarea_rows' => 7,
|
23 |
-
) );
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* url
|
28 |
-
* URL設定フォームを表示
|
29 |
-
*/
|
30 |
-
public function url() {
|
31 |
-
$input_url = $this->get( 'input_url' );
|
32 |
-
$confirmation_url = $this->get( 'confirmation_url' );
|
33 |
-
$complete_url = $this->get( 'complete_url' );
|
34 |
-
$validation_error_url = $this->get( 'validation_error_url' );
|
35 |
-
?>
|
36 |
-
<input type="hidden" name="<?php echo esc_attr( MWF_Config::NAME ); ?>_nonce" value="<?php echo wp_create_nonce( MWF_Config::NAME ); ?>" />
|
37 |
-
<table border="0" cellpadding="0" cellspacing="4">
|
38 |
-
<tr>
|
39 |
-
<th><?php esc_html_e( 'Input Page URL', MWF_Config::DOMAIN ); ?></th>
|
40 |
-
<td>
|
41 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[input_url]" value="<?php echo esc_attr( $input_url ); ?>" />
|
42 |
-
</td>
|
43 |
-
</tr>
|
44 |
-
<tr>
|
45 |
-
<th><?php esc_html_e( 'Confirmation Page URL', MWF_Config::DOMAIN ); ?></th>
|
46 |
-
<td>
|
47 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[confirmation_url]" value="<?php echo esc_attr( $confirmation_url ); ?>" />
|
48 |
-
</td>
|
49 |
-
</tr>
|
50 |
-
<tr>
|
51 |
-
<th><?php esc_html_e( 'Complete Page URL', MWF_Config::DOMAIN ); ?></th>
|
52 |
-
<td>
|
53 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[complete_url]" value="<?php echo esc_attr( $complete_url ); ?>" />
|
54 |
-
</td>
|
55 |
-
</tr>
|
56 |
-
<tr>
|
57 |
-
<th><?php esc_html_e( 'Validation Error Page URL', MWF_Config::DOMAIN ); ?></th>
|
58 |
-
<td>
|
59 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[validation_error_url]" value="<?php echo esc_attr( $validation_error_url ); ?>" />
|
60 |
-
</td>
|
61 |
-
</tr>
|
62 |
-
</table>
|
63 |
-
<p class="description">
|
64 |
-
<?php esc_html_e( 'This urls are the redirection urls at the time of button press. When URL setting is empty, The page redirect on the same page.', MWF_Config::DOMAIN ); ?><br />
|
65 |
-
<?php printf( esc_html__( 'When a URL doesn\'t begin http or https, %s is complemented.', MWF_Config::DOMAIN ), '<b>' . home_url() . '</b>' ); ?>
|
66 |
-
</p>
|
67 |
-
<?php
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* validation_rule
|
72 |
-
* バリデーションルール設定フォームを表示
|
73 |
-
*/
|
74 |
-
public function validation_rule() {
|
75 |
-
$validation = $this->get( 'validation' );
|
76 |
-
$validation_rules = $this->get( 'validation_rules' );
|
77 |
-
|
78 |
-
if ( !$validation ) {
|
79 |
-
$validation = array();
|
80 |
-
}
|
81 |
-
$validation_keys = array(
|
82 |
-
'target' => '',
|
83 |
-
);
|
84 |
-
foreach ( $validation_rules as $validation_rule => $instance ) {
|
85 |
-
$validation_keys[$instance->getName()] = '';
|
86 |
-
}
|
87 |
-
// 空の隠れバリデーションフィールド(コピー元)を挿入
|
88 |
-
array_unshift( $validation, $validation_keys );
|
89 |
-
?>
|
90 |
-
<b class="add-btn"><?php esc_html_e( 'Add Validation rule', MWF_Config::DOMAIN ); ?></b>
|
91 |
-
<div class="repeatable-boxes">
|
92 |
-
<?php foreach ( $validation as $key => $value ) : $value = array_merge( $validation_keys, $value ); ?>
|
93 |
-
<div class="repeatable-box" <?php if ( $key === 0 ) : ?>style="display:none"<?php endif; ?>>
|
94 |
-
<div class="sortable-icon-handle"></div>
|
95 |
-
<div class="remove-btn"><b>×</b></div>
|
96 |
-
<div class="open-btn"><span><?php echo esc_attr( $value['target'] ); ?></span><b>▼</b></div>
|
97 |
-
<div class="repeatable-box-content">
|
98 |
-
<?php esc_html_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 esc_attr( $key ); ?>][target]" />
|
99 |
-
<table border="0" cellpadding="0" cellspacing="0">
|
100 |
-
<tr>
|
101 |
-
<td colspan="2">
|
102 |
-
<?php foreach ( $validation_rules as $validation_rule => $instance ) : ?>
|
103 |
-
<?php $instance->admin( $key, $value ); ?>
|
104 |
-
<?php endforeach; ?>
|
105 |
-
</td>
|
106 |
-
</tr>
|
107 |
-
</table>
|
108 |
-
<!-- end .repeatable-box-content --></div>
|
109 |
-
<!-- end .repeatable-box --></div>
|
110 |
-
<?php endforeach; ?>
|
111 |
-
<!-- end .repeatable-boxes --></div>
|
112 |
-
<?php
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* add_ons
|
117 |
-
* アドオン
|
118 |
-
*/
|
119 |
-
public function add_ons() {
|
120 |
-
?>
|
121 |
-
<p>
|
122 |
-
<?php esc_html_e( 'You can use more easy and useful to the MW WP Form in add-on!', MWF_Config::DOMAIN ); ?><br />
|
123 |
-
<a href="http://plugins.2inc.org/mw-wp-form/add-on/" target="_blank" class="button button-primary"><?php esc_html_e( 'View Add-ons', MWF_Config::DOMAIN ); ?></a>
|
124 |
-
</p>
|
125 |
-
<?php
|
126 |
-
}
|
127 |
-
|
128 |
-
/**
|
129 |
-
* form_key
|
130 |
-
* フォーム識別子のテキストフィールドを表示
|
131 |
-
*/
|
132 |
-
public function form_key() {
|
133 |
-
$post_id = $this->get( 'post_id' );
|
134 |
-
?>
|
135 |
-
<p>
|
136 |
-
<span id="formkey_field">[mwform_formkey key="<?php echo esc_html( $post_id ); ?>"]</span>
|
137 |
-
<span class="mwf_note">
|
138 |
-
<?php esc_html_e( 'Copy and Paste this shortcode.', MWF_Config::DOMAIN ); ?><br />
|
139 |
-
<?php esc_html_e( 'The key to use with hook is ', MWF_Config::DOMAIN ); ?><?php echo MWF_Config::NAME; ?>-<?php echo esc_html( $post_id ); ?>
|
140 |
-
</span>
|
141 |
-
</p>
|
142 |
-
<?php
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* mail_options
|
147 |
-
* 自動返信メール設定フォームを表示
|
148 |
-
*/
|
149 |
-
public function mail_options() {
|
150 |
-
$mail_subject = $this->get( 'mail_subject' );
|
151 |
-
$mail_sender = $this->get( 'mail_sender' );
|
152 |
-
$mail_from = $this->get( 'mail_from' );
|
153 |
-
$mail_content = $this->get( 'mail_content' );
|
154 |
-
$automatic_reply_email = $this->get( 'automatic_reply_email' );
|
155 |
-
?>
|
156 |
-
<p>
|
157 |
-
<?php esc_html_e( '{key} is converted form data.', MWF_Config::DOMAIN ); ?>
|
158 |
-
<?php echo sprintf(
|
159 |
-
esc_html__( 'It is automatically converted to Tracking number when you input {%s}.', MWF_Config::DOMAIN ),
|
160 |
-
MWF_Config::TRACKINGNUMBER
|
161 |
-
); ?>
|
162 |
-
</p>
|
163 |
-
<p>
|
164 |
-
<b><?php esc_html_e( 'Subject', MWF_Config::DOMAIN ); ?></b><br />
|
165 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_subject]" value="<?php echo esc_attr( $mail_subject ); ?>" />
|
166 |
-
</p>
|
167 |
-
<p>
|
168 |
-
<b><?php esc_html_e( 'Sender', MWF_Config::DOMAIN ); ?></b><br />
|
169 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_sender]" value="<?php echo esc_attr( $mail_sender ); ?>" /><br />
|
170 |
-
<span class="mwf_note"><?php esc_html_e( 'If empty:', MWF_Config::DOMAIN ); ?> <?php bloginfo( 'name' ); ?></span>
|
171 |
-
</p>
|
172 |
-
<p>
|
173 |
-
<b><?php esc_html_e( 'From ( E-mail address )', MWF_Config::DOMAIN ); ?></b><br />
|
174 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_from]" value="<?php echo esc_attr( $mail_from ); ?>" /><br />
|
175 |
-
<span class="mwf_note"><?php esc_html_e( 'If empty:', MWF_Config::DOMAIN ); ?> <?php bloginfo( 'admin_email' ); ?></span>
|
176 |
-
</p>
|
177 |
-
<p>
|
178 |
-
<b><?php esc_html_e( 'Content', MWF_Config::DOMAIN ); ?></b><br />
|
179 |
-
<textarea name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_content]" cols="30" rows="10"><?php echo esc_attr( $mail_content ); ?></textarea>
|
180 |
-
</p>
|
181 |
-
<p>
|
182 |
-
<b><?php esc_html_e( 'Automatic reply email', MWF_Config::DOMAIN ); ?></b><br />
|
183 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[automatic_reply_email]" value="<?php echo esc_attr( $automatic_reply_email ); ?>" /><br />
|
184 |
-
<span class="mwf_note"><?php esc_html_e( 'Input the key to use as transmission to automatic reply email. {} is unnecessary.', MWF_Config::DOMAIN ); ?></span>
|
185 |
-
</p>
|
186 |
-
<?php
|
187 |
-
}
|
188 |
-
|
189 |
-
/**
|
190 |
-
* admin_mail_options
|
191 |
-
* 管理者宛メール設定フォームを表示
|
192 |
-
*/
|
193 |
-
public function admin_mail_options() {
|
194 |
-
$mail_to = $this->get( 'mail_to' );
|
195 |
-
$mail_cc = $this->get( 'mail_cc' );
|
196 |
-
$mail_bcc = $this->get( 'mail_bcc' );
|
197 |
-
$admin_mail_subject = $this->get( 'admin_mail_subject' );
|
198 |
-
$admin_mail_sender = $this->get( 'admin_mail_sender' );
|
199 |
-
$admin_mail_from = $this->get( 'admin_mail_from' );
|
200 |
-
$admin_mail_content = $this->get( 'admin_mail_content' );
|
201 |
-
?>
|
202 |
-
<p>
|
203 |
-
<?php esc_html_e( '{key} is converted form data.', MWF_Config::DOMAIN ); ?>
|
204 |
-
<?php echo sprintf(
|
205 |
-
esc_html__( 'It is automatically converted to Tracking number when you input {%s}.', MWF_Config::DOMAIN ),
|
206 |
-
MWF_Config::TRACKINGNUMBER
|
207 |
-
); ?>
|
208 |
-
</p>
|
209 |
-
<p>
|
210 |
-
<?php esc_html_e( 'If Admin Email Options is a blank, Automatic Replay Email Options is used as Admin Email Options.', MWF_Config::DOMAIN ); ?>
|
211 |
-
</p>
|
212 |
-
<p>
|
213 |
-
<b><?php esc_html_e( 'To ( E-mail address )', MWF_Config::DOMAIN ); ?></b><br />
|
214 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_to]" value="<?php echo esc_attr( $mail_to ); ?>" /><br />
|
215 |
-
<span class="mwf_note"><?php esc_html_e( 'If empty:', MWF_Config::DOMAIN ); ?> <?php bloginfo( 'admin_email' ); ?></span>
|
216 |
-
</p>
|
217 |
-
<p>
|
218 |
-
<b><?php esc_html_e( 'CC ( E-mail address )', MWF_Config::DOMAIN ); ?></b><br />
|
219 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_cc]" value="<?php echo esc_attr( $mail_cc ); ?>" />
|
220 |
-
</p>
|
221 |
-
<p>
|
222 |
-
<b><?php esc_html_e( 'BCC ( E-mail address )', MWF_Config::DOMAIN ); ?></b><br />
|
223 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_bcc]" value="<?php echo esc_attr( $mail_bcc ); ?>" />
|
224 |
-
</p>
|
225 |
-
<p>
|
226 |
-
<b><?php esc_html_e( 'Subject', MWF_Config::DOMAIN ); ?></b><br />
|
227 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[admin_mail_subject]" value="<?php echo esc_attr( $admin_mail_subject ); ?>" />
|
228 |
-
</p>
|
229 |
-
<p>
|
230 |
-
<b><?php esc_html_e( 'Sender', MWF_Config::DOMAIN ); ?></b><br />
|
231 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[admin_mail_sender]" value="<?php echo esc_attr( $admin_mail_sender ); ?>" /><br />
|
232 |
-
<span class="mwf_note"><?php esc_html_e( 'If empty:', MWF_Config::DOMAIN ); ?> <?php bloginfo( 'name' ); ?></span>
|
233 |
-
</p>
|
234 |
-
<p>
|
235 |
-
<b><?php esc_html_e( 'From ( E-mail address )', MWF_Config::DOMAIN ); ?></b><br />
|
236 |
-
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[admin_mail_from]" value="<?php echo esc_attr( $admin_mail_from ); ?>" /><br />
|
237 |
-
<span class="mwf_note"><?php esc_html_e( 'If empty:', MWF_Config::DOMAIN ); ?> <?php bloginfo( 'admin_email' ); ?></span>
|
238 |
-
</p>
|
239 |
-
<p>
|
240 |
-
<b><?php esc_html_e( 'Content', MWF_Config::DOMAIN ); ?></b><br />
|
241 |
-
<textarea name="<?php echo esc_attr( MWF_Config::NAME ); ?>[admin_mail_content]" cols="30" rows="10"><?php echo esc_attr( $admin_mail_content ); ?></textarea>
|
242 |
-
</p>
|
243 |
-
<?php
|
244 |
-
}
|
245 |
-
|
246 |
-
/**
|
247 |
-
* settings
|
248 |
-
* $post を取得するための引数を有効にするフィールドを表示
|
249 |
-
*/
|
250 |
-
public function settings() {
|
251 |
-
$querystring = $this->get( 'querystring' );
|
252 |
-
$usedb = $this->get( 'usedb' );
|
253 |
-
$scroll = $this->get( 'scroll' );
|
254 |
-
$akismet_author = $this->get( 'akismet_author' );
|
255 |
-
$akismet_author_email = $this->get( 'akismet_author_email' );
|
256 |
-
$akismet_author_url = $this->get( 'akismet_author_url' );
|
257 |
-
?>
|
258 |
-
<p>
|
259 |
-
<label><input type="checkbox" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[querystring]" value="1" <?php checked( $querystring, 1 ); ?> /> <?php esc_html_e( 'Activate Query string of post', MWF_Config::DOMAIN ); ?></label><br />
|
260 |
-
<span class="mwf_note"><?php esc_html_e( 'If this field is active, MW WP Form get query string. And get post data from query string "post_id". You can use $post\'s property in editor.', MWF_Config::DOMAIN ); ?><br />
|
261 |
-
<?php esc_html_e( 'Example: {ID}, {post_title}, {post_meta} etc...', MWF_Config::DOMAIN ); ?></span>
|
262 |
-
</p>
|
263 |
-
<p>
|
264 |
-
<label><input type="checkbox" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[usedb]" value="1" <?php checked( $usedb, 1 ); ?> /> <?php esc_html_e( 'Saving inquiry data in database', MWF_Config::DOMAIN ); ?></label>
|
265 |
-
</p>
|
266 |
-
<p>
|
267 |
-
<label><input type="checkbox" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[scroll]" value="1" <?php checked( $scroll, 1 ); ?> /> <?php esc_html_e( 'Enable scrolling of screen transition.', MWF_Config::DOMAIN ); ?></label>
|
268 |
-
</p>
|
269 |
-
<table border="0" cellpadding="0" cellspacing="0" class="akismet">
|
270 |
-
<tr>
|
271 |
-
<th colspan="2"><?php esc_html_e( 'Akismet Setting', MWF_Config::DOMAIN ); ?></th>
|
272 |
-
</tr>
|
273 |
-
<tr>
|
274 |
-
<td>author</td>
|
275 |
-
<td><input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[akismet_author]" value="<?php echo esc_attr( $akismet_author ); ?>" /></td>
|
276 |
-
</tr>
|
277 |
-
<tr>
|
278 |
-
<td>email</td>
|
279 |
-
<td><input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[akismet_author_email]" value="<?php echo esc_attr( $akismet_author_email ); ?>" /></td>
|
280 |
-
</tr>
|
281 |
-
<tr>
|
282 |
-
<td>url</td>
|
283 |
-
<td><input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[akismet_author_url]" value="<?php echo esc_attr( $akismet_author_url ); ?>" /></td>
|
284 |
-
</tr>
|
285 |
-
</table>
|
286 |
-
<span class="mwf_note"><?php esc_html_e( 'Input the key to use Akismet.', MWF_Config::DOMAIN ); ?></span>
|
287 |
-
<?php
|
288 |
-
}
|
289 |
-
|
290 |
-
/**
|
291 |
-
* style
|
292 |
-
*/
|
293 |
-
public function style() {
|
294 |
-
$styles = $this->get( 'styles' );
|
295 |
-
$style = $this->get( 'style' );
|
296 |
-
?>
|
297 |
-
<p>
|
298 |
-
<select name="<?php echo MWF_Config::NAME; ?>[style]">
|
299 |
-
<option value=""><?php esc_html_e( 'Select Style', MWF_Config::DOMAIN ); ?></option>
|
300 |
-
<?php foreach ( $styles as $style_key => $css ) : ?>
|
301 |
-
<option value="<?php echo esc_attr( $style_key ); ?>" <?php selected( $style, $style_key ); ?>>
|
302 |
-
<?php echo esc_html( $style_key ); ?>
|
303 |
-
</option>
|
304 |
-
<?php endforeach; ?>
|
305 |
-
</select>
|
306 |
-
</p>
|
307 |
-
<?php
|
308 |
-
}
|
309 |
-
|
310 |
-
/**
|
311 |
-
* tag_generator
|
312 |
-
* タグジェネレータを出力
|
313 |
-
* @param string $editor_id
|
314 |
-
*/
|
315 |
-
public function tag_generator( $editor_id ) {
|
316 |
-
$post_type = get_post_type();
|
317 |
-
if ( $post_type !== MWF_Config::NAME ) {
|
318 |
-
return;
|
319 |
-
}
|
320 |
-
if ( $editor_id !== 'content' ) {
|
321 |
-
return;
|
322 |
-
}
|
323 |
-
do_action( 'mwform_tag_generator_dialog' );
|
324 |
-
?>
|
325 |
-
<div class="add-mwform-btn">
|
326 |
-
<select>
|
327 |
-
<option value=""><?php echo esc_html_e( 'Select this.', MWF_Config::DOMAIN ); ?></option>
|
328 |
-
<optgroup label="<?php echo esc_attr_e( 'Input fields', MWF_Config::DOMAIN ); ?>">
|
329 |
-
<?php do_action( 'mwform_tag_generator_input_option' ); ?>
|
330 |
-
</optgroup>
|
331 |
-
<optgroup label="<?php echo esc_attr_e( 'Select fields', MWF_Config::DOMAIN ); ?>">
|
332 |
-
<?php do_action( 'mwform_tag_generator_select_option' ); ?>
|
333 |
-
</optgroup>
|
334 |
-
<optgroup label="<?php echo esc_attr_e( 'Button fields', MWF_Config::DOMAIN ); ?>">
|
335 |
-
<?php do_action( 'mwform_tag_generator_button_option' ); ?>
|
336 |
-
</optgroup>
|
337 |
-
<optgroup label="<?php echo esc_attr_e( 'Error fields', MWF_Config::DOMAIN ); ?>">
|
338 |
-
<?php do_action( 'mwform_tag_generator_error_option' ); ?>
|
339 |
-
</optgroup>
|
340 |
-
<optgroup label="<?php echo esc_attr_e( 'Other fields', MWF_Config::DOMAIN ); ?>">
|
341 |
-
<?php do_action( 'mwform_tag_generator_option' ); ?>
|
342 |
-
</optgroup>
|
343 |
-
</select>
|
344 |
-
<span class="button"><?php esc_html_e( 'Add form tag', MWF_Config::DOMAIN ); ?></span>
|
345 |
-
</div>
|
346 |
-
<?php
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* quicktag
|
351 |
-
* HTMLエディタにクイックタグを追加
|
352 |
-
*/
|
353 |
-
public function quicktag() {
|
354 |
-
if ( MWF_Config::NAME == get_post_type() ) : ?>
|
355 |
-
<script type="text/javascript">
|
356 |
-
if ( typeof( QTags ) !== 'undefined' ) {
|
357 |
-
<?php do_action( 'mwform_add_qtags' ); ?>
|
358 |
-
}
|
359 |
-
</script>
|
360 |
-
<?php
|
361 |
-
endif;
|
362 |
-
}
|
363 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/views/class.contact-data-list.php
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Name : MW WP Form Contact Data List View
|
4 |
-
* Version : 1.0.1
|
5 |
-
* Author : Takashi Kitajima
|
6 |
-
* Author URI : http://2inc.org
|
7 |
-
* Created : January 2, 2015
|
8 |
-
* Modified : February 13, 2015
|
9 |
-
* License : GPLv2
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
class MW_WP_Form_Contact_Data_List_View extends MW_WP_Form_View {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* admin_print_styles_for_list
|
16 |
-
*/
|
17 |
-
public function admin_print_styles_for_list() {
|
18 |
-
?>
|
19 |
-
<style type="text/css">
|
20 |
-
#normal-sortables {
|
21 |
-
display: none;
|
22 |
-
}
|
23 |
-
</style>
|
24 |
-
<?php
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* csv_button
|
29 |
-
*/
|
30 |
-
public function csv_button() {
|
31 |
-
$action = $this->get( 'action' );
|
32 |
-
?>
|
33 |
-
<form id="mw-wp-form_csv" method="post" action="<?php echo esc_url( $action ); ?>">
|
34 |
-
<input type="submit" value="<?php esc_attr_e( 'CSV Download', MWF_Config::DOMAIN ); ?>" class="button-primary" />
|
35 |
-
|
36 |
-
|
37 |
-
<label><input type="checkbox" name="download-all" value="true" checked="checked" /> Download All</label>
|
38 |
-
<input type="hidden" name="<?php echo esc_attr( MWF_Config::NAME . '-csv-download' ); ?>" value="1" />
|
39 |
-
<?php wp_nonce_field( MWF_Config::NAME ); ?>
|
40 |
-
</form>
|
41 |
-
<?php
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* manage_posts_custom_column
|
46 |
-
*/
|
47 |
-
public function manage_posts_custom_column() {
|
48 |
-
$column = $this->get( 'column' );
|
49 |
-
$post_id = $this->get( 'post_id' );
|
50 |
-
$post = get_post( $post_id );
|
51 |
-
$post_custom_keys = $this->get( 'post_custom_keys' );
|
52 |
-
$Contact_Data_Setting = $this->get( 'Contact_Data_Setting' );
|
53 |
-
|
54 |
-
if ( $column === 'post_date' ) {
|
55 |
-
echo esc_html( $post->post_date );
|
56 |
-
}
|
57 |
-
elseif ( $column === 'response_status' ) {
|
58 |
-
$response_statuses = $Contact_Data_Setting->get_response_statuses();
|
59 |
-
$response_status = $Contact_Data_Setting->get( 'response_status' );
|
60 |
-
echo $response_statuses[$response_status];
|
61 |
-
}
|
62 |
-
elseif ( is_array( $post_custom_keys ) && in_array( $column, $post_custom_keys ) ) {
|
63 |
-
$post_meta = get_post_meta( $post_id, $column, true );
|
64 |
-
if ( $Contact_Data_Setting->is_upload_file_key( $post, $column ) ) {
|
65 |
-
echo $this->get_multimedia_data( $post_meta );
|
66 |
-
} elseif ( $post_meta ) {
|
67 |
-
echo esc_html( $post_meta );
|
68 |
-
} else {
|
69 |
-
echo ' ';
|
70 |
-
}
|
71 |
-
} else {
|
72 |
-
echo ' ';
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* get_multimedia_data
|
78 |
-
* @param string $value
|
79 |
-
* @return string
|
80 |
-
*/
|
81 |
-
protected function get_multimedia_data( $value ) {
|
82 |
-
$mimetype = get_post_mime_type( $value );
|
83 |
-
if ( $mimetype ) {
|
84 |
-
// 画像だったら
|
85 |
-
if ( preg_match( '/^image\/.+?$/', $mimetype ) ) {
|
86 |
-
$src = wp_get_attachment_image_src( $value, 'thumbnail' );
|
87 |
-
return sprintf(
|
88 |
-
'<img src="%s" alt="" style="width:50px;height:50px" />',
|
89 |
-
esc_url( $src[0] )
|
90 |
-
);
|
91 |
-
}
|
92 |
-
// 画像以外
|
93 |
-
else {
|
94 |
-
$src = wp_get_attachment_image_src( $value, 'none', true );
|
95 |
-
return sprintf(
|
96 |
-
'<a href="%s" target="_blank"><img src="%s" alt="" style="height:50px" /></a>',
|
97 |
-
esc_url( wp_get_attachment_url( $value ) ),
|
98 |
-
esc_url( $src[0] )
|
99 |
-
);
|
100 |
-
}
|
101 |
-
}
|
102 |
-
// 添付されているけど、フック等でメタ情報が書き換えられて添付ファイルID以外になってしまった場合
|
103 |
-
else {
|
104 |
-
echo esc_html( $value );
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/views/class.contact-data.php
DELETED
@@ -1,218 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Name : MW WP Form Contact Data View
|
4 |
-
* Version : 1.0.1
|
5 |
-
* Author : Takashi Kitajima
|
6 |
-
* Author URI : http://2inc.org
|
7 |
-
* Created : January 2, 2015
|
8 |
-
* Modified : February 13, 2015
|
9 |
-
* License : GPLv2
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
class MW_WP_Form_Contact_Data_View extends MW_WP_Form_View {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* admin_print_styles_for_detail
|
16 |
-
*/
|
17 |
-
public function admin_print_styles_for_detail() {
|
18 |
-
?>
|
19 |
-
<style type="text/css">
|
20 |
-
h2 a.add-new-h2 {
|
21 |
-
display: none;
|
22 |
-
}
|
23 |
-
</style>
|
24 |
-
<?php
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* index
|
29 |
-
*/
|
30 |
-
public function index() {
|
31 |
-
$contact_data_post_types = $this->get( 'contact_data_post_types' );
|
32 |
-
?>
|
33 |
-
<div class="wrap">
|
34 |
-
<h2><?php esc_html_e( 'Inquiry data', MWF_Config::DOMAIN ); ?></h2>
|
35 |
-
<p>
|
36 |
-
<?php esc_html_e( 'You can see the inquiry data that are saved in the database by clicking on the link below.', MWF_Config::DOMAIN ); ?>
|
37 |
-
</p>
|
38 |
-
<table class="wp-list-table widefat fixed" cellspacing="0">
|
39 |
-
<thead>
|
40 |
-
<th class="<?php echo MWF_Config::NAME; ?>-table-title"><?php esc_html_e( 'Form title', MWF_Config::DOMAIN ); ?></th>
|
41 |
-
<th class="<?php echo MWF_Config::NAME; ?>-table-chart"><?php esc_html_e( 'Display Chart', MWF_Config::DOMAIN ); ?></th>
|
42 |
-
<th class="<?php echo MWF_Config::NAME; ?>-table-count"><?php esc_html_e( 'The number of inquiries', MWF_Config::DOMAIN ); ?></th>
|
43 |
-
<th class="<?php echo MWF_Config::NAME; ?>-table-date"><?php esc_html_e( 'Updated date', MWF_Config::DOMAIN ); ?></th>
|
44 |
-
<th class="<?php echo MWF_Config::NAME; ?>-table-date"><?php esc_html_e( 'Created date', MWF_Config::DOMAIN ); ?></th>
|
45 |
-
</thead>
|
46 |
-
<tbody>
|
47 |
-
<?php $i = 0; foreach ( $contact_data_post_types as $post_type ) : $i ++; ?>
|
48 |
-
<?php $post_type_object = get_post_type_object( $post_type ); ?>
|
49 |
-
<tr <?php if ( $i % 2 == 1 ) echo 'class="alternate"'; ?>>
|
50 |
-
<td class="<?php echo MWF_Config::NAME; ?>-table-title"><?php echo esc_html( $post_type_object->labels->singular_name ) ; ?></td>
|
51 |
-
<td class="<?php echo MWF_Config::NAME; ?>-table-chart"><a href="<?php echo admin_url( 'edit.php?post_type=' . MWF_Config::NAME . '&page=' . MWF_Config::NAME . '-chart&formkey=' . $post_type ); ?>"><?php esc_html_e( 'Display Chart', MWF_Config::DOMAIN ); ?></td>
|
52 |
-
<td class="<?php echo MWF_Config::NAME; ?>-table-count"><a href="<?php echo admin_url( 'edit.php?post_type=' . $post_type ); ?>"><?php echo esc_html( $this->get_count( $post_type ) ) ?> <?php esc_html_e( 'cases', MWF_Config::DOMAIN ); ?></a></td>
|
53 |
-
<td class="<?php echo MWF_Config::NAME; ?>-table-date"><?php echo esc_html( $this->get_modified_datetime( $post_type ) ); ?></td>
|
54 |
-
<td class="<?php echo MWF_Config::NAME; ?>-table-date"><?php echo esc_html( $this->get_created_datetime( $post_type ) ); ?></td>
|
55 |
-
</tr>
|
56 |
-
<?php endforeach; ?>
|
57 |
-
</tbody>
|
58 |
-
</table>
|
59 |
-
<!-- end .wrap --></div>
|
60 |
-
<?php
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* detail
|
65 |
-
*/
|
66 |
-
public function detail() {
|
67 |
-
global $post;
|
68 |
-
$Contact_Data_Setting = $this->get( 'Contact_Data_Setting' );
|
69 |
-
$post_type = $this->get( 'post_type' );
|
70 |
-
?>
|
71 |
-
<input type="hidden" name="<?php echo esc_attr( MWF_Config::NAME ); ?>_nonce" value="<?php echo wp_create_nonce( MWF_Config::NAME ); ?>" />
|
72 |
-
<table border="0" cellpadding="0" cellspacing="0">
|
73 |
-
<?php
|
74 |
-
$values = $Contact_Data_Setting->gets();
|
75 |
-
foreach ( $values as $key => $value ) :
|
76 |
-
if ( in_array( $key, $Contact_Data_Setting->get_permit_keys() ) ) {
|
77 |
-
continue;
|
78 |
-
}
|
79 |
-
?>
|
80 |
-
<tr>
|
81 |
-
<th>
|
82 |
-
<?php
|
83 |
-
if ( $key === MWF_Config::TRACKINGNUMBER ) {
|
84 |
-
echo MWF_Functions::get_tracking_number_title( $post_type );
|
85 |
-
} else {
|
86 |
-
echo esc_html( $key );
|
87 |
-
}
|
88 |
-
?>
|
89 |
-
</th>
|
90 |
-
<td>
|
91 |
-
<?php
|
92 |
-
if ( $Contact_Data_Setting->is_upload_file_key( $post, $key ) ) {
|
93 |
-
echo $this->get_multimedia_data( $value );
|
94 |
-
} else {
|
95 |
-
echo nl2br( esc_html( $value ) );
|
96 |
-
}
|
97 |
-
?>
|
98 |
-
</td>
|
99 |
-
</tr>
|
100 |
-
<?php endforeach; ?>
|
101 |
-
<tr>
|
102 |
-
<th><?php esc_html_e( 'Response Status', MWF_Config::DOMAIN ); ?></th>
|
103 |
-
<td>
|
104 |
-
<select name="<?php echo esc_attr( MWF_Config::CONTACT_DATA_NAME ); ?>[response_status]">
|
105 |
-
<?php foreach ( $Contact_Data_Setting->get_response_statuses() as $key => $value ) : ?>
|
106 |
-
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $Contact_Data_Setting->get( 'response_status' ) ); ?>>
|
107 |
-
<?php echo esc_html( $value ); ?>
|
108 |
-
</option>
|
109 |
-
<?php endforeach; ?>
|
110 |
-
</select>
|
111 |
-
</td>
|
112 |
-
</tr>
|
113 |
-
<tr>
|
114 |
-
<th><?php esc_html_e( 'Memo', MWF_Config::DOMAIN ); ?></th>
|
115 |
-
<td><textarea name="<?php echo esc_attr( MWF_Config::CONTACT_DATA_NAME ); ?>[memo]" cols="50" rows="5"><?php echo $Contact_Data_Setting->get( 'memo' ); ?></textarea></td>
|
116 |
-
</tr>
|
117 |
-
</table>
|
118 |
-
<?php
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* returning_link
|
123 |
-
*/
|
124 |
-
public function returning_link() {
|
125 |
-
$link = $this->get( 'link' );
|
126 |
-
?>
|
127 |
-
<p>
|
128 |
-
<a href="<?php echo $link; ?>"><?php esc_html_e( '« Back to the list', MWF_Config::DOMAIN ); ?></a>
|
129 |
-
</p>
|
130 |
-
<?php
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* get_multimedia_data
|
135 |
-
* @param string $value
|
136 |
-
* @return string
|
137 |
-
*/
|
138 |
-
protected function get_multimedia_data( $value ) {
|
139 |
-
$mimetype = get_post_mime_type( $value );
|
140 |
-
if ( $mimetype ) {
|
141 |
-
// 画像だったら
|
142 |
-
if ( preg_match( '/^image\/.+?$/', $mimetype ) ) {
|
143 |
-
$src = wp_get_attachment_image_src( $value, 'medium' );
|
144 |
-
return sprintf(
|
145 |
-
'<img src="%s" alt="" />',
|
146 |
-
esc_url( $src[0] )
|
147 |
-
);
|
148 |
-
}
|
149 |
-
// 画像以外
|
150 |
-
else {
|
151 |
-
$src = wp_get_attachment_image_src( $value, 'none', true );
|
152 |
-
return sprintf(
|
153 |
-
'<a href="%s" target="_blank"><img src="%s" alt="" /></a>',
|
154 |
-
esc_url( wp_get_attachment_url( $value ) ),
|
155 |
-
esc_url( $src[0] )
|
156 |
-
);
|
157 |
-
}
|
158 |
-
}
|
159 |
-
// 添付されているけど、フック等でメタ情報が書き換えられて添付ファイルID以外になってしまった場合
|
160 |
-
else {
|
161 |
-
echo esc_html( $value );
|
162 |
-
}
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* get_count
|
167 |
-
* @param string $post_type 投稿タイプ名
|
168 |
-
* @return numeric 投稿数
|
169 |
-
*/
|
170 |
-
protected function get_count( $post_type ) {
|
171 |
-
$_args = apply_filters( 'mwform_get_inquiry_data_args-' . $post_type, array() );
|
172 |
-
$args = array(
|
173 |
-
'post_type' => $post_type,
|
174 |
-
'posts_per_page' => 1,
|
175 |
-
);
|
176 |
-
if ( !empty( $_args ) && is_array( $_args ) ) {
|
177 |
-
$args = array_merge( $_args, $args );
|
178 |
-
}
|
179 |
-
$query = new WP_Query( $args );
|
180 |
-
return $query->found_posts;
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
* get_created_datetime
|
185 |
-
* フォームの作成日時を取得
|
186 |
-
* @param string $post_type 投稿タイプ名
|
187 |
-
* @return string 作成日
|
188 |
-
*/
|
189 |
-
protected function get_created_datetime( $post_type ) {
|
190 |
-
$post_id = preg_replace( '/^mwf_(.+?)$/', '$1', $post_type );
|
191 |
-
$post_date = get_the_date( get_option( 'date_format' ), $post_id );
|
192 |
-
return $post_date;
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* get_modified_datetime
|
197 |
-
* 問い合わせデータの最新保存日を取得
|
198 |
-
* @param string $post_type 投稿タイプ名
|
199 |
-
* @return string 問い合わせデータの最新保存日
|
200 |
-
*/
|
201 |
-
protected function get_modified_datetime( $post_type ) {
|
202 |
-
global $post;
|
203 |
-
$inquiry_posts = get_posts( array(
|
204 |
-
'post_type' => $post_type,
|
205 |
-
'posts_per_page' => 1,
|
206 |
-
'orderby' => 'modified',
|
207 |
-
) );
|
208 |
-
|
209 |
-
$modified_datetime = '';
|
210 |
-
foreach ( $inquiry_posts as $post ) {
|
211 |
-
setup_postdata( $post );
|
212 |
-
$modified_datetime = get_the_modified_date();
|
213 |
-
break;
|
214 |
-
}
|
215 |
-
wp_reset_postdata();
|
216 |
-
return $modified_datetime;
|
217 |
-
}
|
218 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/views/class.main.php
DELETED
@@ -1,323 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Name : MW WP Form Main View
|
4 |
-
* Version : 1.0.1
|
5 |
-
* Author : Takashi Kitajima
|
6 |
-
* Author URI : http://2inc.org
|
7 |
-
* Created : December 31, 2014
|
8 |
-
* Modified : March 24, 2015
|
9 |
-
* License : GPLv2
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
class MW_WP_Form_Main_View extends MW_WP_Form_View {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* add_shortcode_that_display_content
|
16 |
-
*/
|
17 |
-
public function add_shortcode_that_display_content() {
|
18 |
-
add_shortcode( 'mwform_formkey' , array( $this, 'mwform_formkey' ) );
|
19 |
-
add_shortcode( 'mwform' , array( $this, 'mwform' ) );
|
20 |
-
add_shortcode( 'mwform_complete_message', array( $this, 'mwform_complete_message' ) );
|
21 |
-
|
22 |
-
do_action(
|
23 |
-
'mwform_add_shortcode',
|
24 |
-
$this->get( 'Form' ),
|
25 |
-
$this->get( 'view_flg' ),
|
26 |
-
$this->get( 'Error' ),
|
27 |
-
$this->get( 'form_key' )
|
28 |
-
);
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* mwform_formkey
|
33 |
-
* 管理画面で作成したフォームを出力(実際の出力は mwform )
|
34 |
-
* @param array $attributes
|
35 |
-
* @return string html
|
36 |
-
* @example [mwform_formkey key="post_id"]
|
37 |
-
*/
|
38 |
-
public function mwform_formkey( $attributes ) {
|
39 |
-
$view_flg = $this->get( 'view_flg' );
|
40 |
-
$post_id = $attributes['key'];
|
41 |
-
|
42 |
-
// 入力画面
|
43 |
-
if ( $view_flg === 'input' ) {
|
44 |
-
$content = $this->get_input_page_content( $post_id );
|
45 |
-
}
|
46 |
-
// 確認画面
|
47 |
-
elseif ( $view_flg == 'confirm' ) {
|
48 |
-
$content = $this->get_confirm_page_content( $post_id );
|
49 |
-
}
|
50 |
-
// 完了画面
|
51 |
-
elseif ( $view_flg === 'complete' ) {
|
52 |
-
$content = $this->get_complete_page_content();
|
53 |
-
}
|
54 |
-
return do_shortcode( $content );
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* get_input_page_content
|
59 |
-
* @param int $post_id
|
60 |
-
* @return string $content
|
61 |
-
*/
|
62 |
-
protected function get_input_page_content( $post_id ) {
|
63 |
-
global $post;
|
64 |
-
$form_key = $this->get( 'form_key' );
|
65 |
-
$post = get_post( $post_id );
|
66 |
-
setup_postdata( $post );
|
67 |
-
$content = apply_filters( 'mwform_post_content_raw_' . $form_key, get_the_content() );
|
68 |
-
if ( has_filter( 'the_content', 'wpautop' ) ) {
|
69 |
-
$content = wpautop( $content );
|
70 |
-
}
|
71 |
-
$content = sprintf(
|
72 |
-
'[mwform]%s[/mwform]',
|
73 |
-
apply_filters( 'mwform_post_content_' . $form_key, $content )
|
74 |
-
);
|
75 |
-
wp_reset_postdata();
|
76 |
-
return $content;
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* get_confirm_page_content
|
81 |
-
* @param int $post_id
|
82 |
-
* @return string $content
|
83 |
-
*/
|
84 |
-
protected function get_confirm_page_content( $post_id ) {
|
85 |
-
return $this->get_input_page_content( $post_id );
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* get_complete_page_content
|
90 |
-
* @return string $content
|
91 |
-
*/
|
92 |
-
protected function get_complete_page_content() {
|
93 |
-
$Setting = $this->get( 'Setting' );
|
94 |
-
$content = $Setting->get( 'complete_message' );
|
95 |
-
if ( has_filter( 'the_content', 'wpautop' ) ) {
|
96 |
-
$content = wpautop( $content );
|
97 |
-
}
|
98 |
-
$content = sprintf(
|
99 |
-
'[mwform_complete_message]%s[/mwform_complete_message]',
|
100 |
-
$content
|
101 |
-
);
|
102 |
-
return $content;
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* mwform
|
107 |
-
* フォームを出力
|
108 |
-
* @param array $attributes
|
109 |
-
* @return string html
|
110 |
-
*/
|
111 |
-
public function mwform( $attributes, $content = '' ) {
|
112 |
-
$view_flg = $this->get( 'view_flg' );
|
113 |
-
$Form = $this->get( 'Form' );
|
114 |
-
$form_key = $this->get( 'form_key' );
|
115 |
-
|
116 |
-
if ( in_array( $view_flg, array( 'input', 'confirm' ) ) ) {
|
117 |
-
$content = $this->get_the_content( $content );
|
118 |
-
$upload_file_keys = $Form->get_raw( MWF_Config::UPLOAD_FILE_KEYS );
|
119 |
-
$upload_file_hidden = $this->get_upload_file_hidden( $upload_file_keys );
|
120 |
-
$old_confirm_class = $this->get_old_confirm_class( $view_flg );
|
121 |
-
$class_by_style = $this->get_class_by_style();
|
122 |
-
|
123 |
-
return sprintf(
|
124 |
-
'<div id="mw_wp_form_%s" class="mw_wp_form mw_wp_form_%s %s">
|
125 |
-
%s
|
126 |
-
<!-- end .mw_wp_form --></div>',
|
127 |
-
esc_attr( $form_key ),
|
128 |
-
esc_attr( $view_flg . ' ' . $old_confirm_class ),
|
129 |
-
$class_by_style,
|
130 |
-
$Form->start() . do_shortcode( $content ) . $upload_file_hidden . $Form->end()
|
131 |
-
);
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* mwform_complete_message
|
137 |
-
* 完了後のメッセージ
|
138 |
-
* @param array $attributes
|
139 |
-
* @return string html
|
140 |
-
*/
|
141 |
-
public function mwform_complete_message( $attributes, $content = '' ) {
|
142 |
-
$view_flg = $this->get( 'view_flg' );
|
143 |
-
$form_key = $this->get( 'form_key' );
|
144 |
-
if ( $view_flg === 'complete' ) {
|
145 |
-
return sprintf(
|
146 |
-
'<div id="mw_wp_form_%s" class="mw_wp_form mw_wp_form_%s">
|
147 |
-
%s
|
148 |
-
<!-- end .mw_wp_form --></div>',
|
149 |
-
esc_attr( $form_key ),
|
150 |
-
esc_attr( $view_flg ),
|
151 |
-
$content
|
152 |
-
);
|
153 |
-
}
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* replace_user_property
|
158 |
-
* ユーザーがログイン中の場合、{ユーザー情報のプロパティ}を置換する。
|
159 |
-
* @param string フォーム内容
|
160 |
-
* @return string フォーム内容
|
161 |
-
*/
|
162 |
-
protected function replace_user_property( $content ) {
|
163 |
-
$user = wp_get_current_user();
|
164 |
-
$search = array(
|
165 |
-
'{user_id}',
|
166 |
-
'{user_login}',
|
167 |
-
'{user_email}',
|
168 |
-
'{user_url}',
|
169 |
-
'{user_registered}',
|
170 |
-
'{display_name}',
|
171 |
-
);
|
172 |
-
if ( !empty( $user ) ) {
|
173 |
-
$content = str_replace( $search, array(
|
174 |
-
$user->get( 'ID' ),
|
175 |
-
$user->get( 'user_login' ),
|
176 |
-
$user->get( 'user_email' ),
|
177 |
-
$user->get( 'user_url' ),
|
178 |
-
$user->get( 'user_registered' ),
|
179 |
-
$user->get( 'display_name' ),
|
180 |
-
), $content );
|
181 |
-
} else {
|
182 |
-
$content = str_replace( $search, '', $content );
|
183 |
-
}
|
184 |
-
return $content;
|
185 |
-
}
|
186 |
-
|
187 |
-
/**
|
188 |
-
* replace_post_content
|
189 |
-
* {投稿情報($post->hoge)}を置換する。
|
190 |
-
* @param string フォーム内容
|
191 |
-
* @return string フォーム内容
|
192 |
-
*/
|
193 |
-
protected function replace_post_property( $content ) {
|
194 |
-
$Setting = $this->get( 'Setting' );
|
195 |
-
if ( $Setting->get( 'querystring' ) ) {
|
196 |
-
$content = preg_replace_callback(
|
197 |
-
'/{(.+?)}/',
|
198 |
-
array( $this, 'get_post_property_from_querystring' ),
|
199 |
-
$content
|
200 |
-
);
|
201 |
-
} else {
|
202 |
-
$content = preg_replace_callback(
|
203 |
-
'/{(.+?)}/',
|
204 |
-
array( $this, 'get_post_property_from_this' ),
|
205 |
-
$content
|
206 |
-
);
|
207 |
-
}
|
208 |
-
return $content;
|
209 |
-
}
|
210 |
-
|
211 |
-
/**
|
212 |
-
* 引数 post_id が有効の場合、投稿情報を取得するために preg_replace_callback から呼び出される。
|
213 |
-
*
|
214 |
-
* @param array $matches
|
215 |
-
* @return string|null
|
216 |
-
*/
|
217 |
-
protected function get_post_property_from_querystring( $matches ) {
|
218 |
-
$Setting = $this->get( 'Setting' );
|
219 |
-
if ( $Setting->get( 'querystring' ) &&
|
220 |
-
isset( $_GET['post_id'] ) &&
|
221 |
-
MWF_Functions::is_numeric( $_GET['post_id'] ) ) {
|
222 |
-
|
223 |
-
$post = get_post( $_GET['post_id'] );
|
224 |
-
if ( empty( $post->ID ) ) {
|
225 |
-
return;
|
226 |
-
}
|
227 |
-
return $this->get_post_property( $post, $matches[1] );
|
228 |
-
}
|
229 |
-
}
|
230 |
-
|
231 |
-
/**
|
232 |
-
* 引数 post_id が無効の場合、投稿情報を取得するために preg_replace_callback から呼び出される。
|
233 |
-
*
|
234 |
-
* @param array $matches
|
235 |
-
* @return string|null
|
236 |
-
*/
|
237 |
-
protected function get_post_property_from_this( $matches ) {
|
238 |
-
global $post;
|
239 |
-
if ( !is_singular() ) {
|
240 |
-
return;
|
241 |
-
}
|
242 |
-
if ( isset( $post->ID ) && MWF_Functions::is_numeric( $post->ID ) ) {
|
243 |
-
return $this->get_post_property( $post, $matches[1] );
|
244 |
-
}
|
245 |
-
}
|
246 |
-
|
247 |
-
/**
|
248 |
-
* 投稿のプロパティを取得
|
249 |
-
*
|
250 |
-
* @param WP_Post|null $post
|
251 |
-
* @param string $meta_key
|
252 |
-
* @return string|null
|
253 |
-
*/
|
254 |
-
protected function get_post_property( $post, $meta_key ) {
|
255 |
-
if ( !is_a( $post, 'WP_Post' ) ) {
|
256 |
-
return;
|
257 |
-
}
|
258 |
-
if ( isset( $post->$meta_key ) ) {
|
259 |
-
return $post->$meta_key;
|
260 |
-
}
|
261 |
-
$post_meta = get_post_meta( $post->ID, $meta_key, true );
|
262 |
-
if ( !is_array( $post_meta ) ) {
|
263 |
-
return $post_meta;
|
264 |
-
}
|
265 |
-
}
|
266 |
-
|
267 |
-
/**
|
268 |
-
* get_the_content
|
269 |
-
* フォームのコンテンツを整形して返す
|
270 |
-
* @param string $content
|
271 |
-
* @return string $content
|
272 |
-
*/
|
273 |
-
protected function get_the_content( $content ) {
|
274 |
-
$content = $this->replace_user_property( $content );
|
275 |
-
$content = $this->replace_post_property( $content );
|
276 |
-
return $content;
|
277 |
-
}
|
278 |
-
|
279 |
-
/**
|
280 |
-
* get_upload_file_hidden
|
281 |
-
* @param array|'' $upload_file_keys
|
282 |
-
*/
|
283 |
-
protected function get_upload_file_hidden( $upload_file_keys ) {
|
284 |
-
$Form = $this->get( 'Form' );
|
285 |
-
$upload_file_hidden = '';
|
286 |
-
if ( !is_array( $upload_file_keys ) ) {
|
287 |
-
return $upload_file_hidden;
|
288 |
-
}
|
289 |
-
foreach ( $upload_file_keys as $value ) {
|
290 |
-
$upload_file_hidden .= $Form->hidden( MWF_Config::UPLOAD_FILE_KEYS . '[]', $value );
|
291 |
-
}
|
292 |
-
return $upload_file_hidden;
|
293 |
-
}
|
294 |
-
|
295 |
-
/**
|
296 |
-
* get_old_confirm_class
|
297 |
-
* 下位互換性のための class を付与
|
298 |
-
* @param string $view_flg
|
299 |
-
* @return string mw_wp_form_preview
|
300 |
-
*/
|
301 |
-
protected function get_old_confirm_class( $view_flg ) {
|
302 |
-
$old_confirm_class = '';
|
303 |
-
if ( $view_flg === 'confirm' ) {
|
304 |
-
$old_confirm_class = 'mw_wp_form_preview';
|
305 |
-
}
|
306 |
-
return $old_confirm_class;
|
307 |
-
}
|
308 |
-
|
309 |
-
/**
|
310 |
-
* get_class_by_style
|
311 |
-
* スタイル機能用の class を付与
|
312 |
-
* @return string
|
313 |
-
*/
|
314 |
-
protected function get_class_by_style() {
|
315 |
-
$Setting = $this->get( 'Setting' );
|
316 |
-
$style = $Setting->get( 'style' );
|
317 |
-
$class_by_style = '';
|
318 |
-
if ( $style ) {
|
319 |
-
$class_by_style = 'mw_wp_form_' . $style;
|
320 |
-
}
|
321 |
-
return $class_by_style;
|
322 |
-
}
|
323 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/views/class.view.php
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Name : MW WP Form View
|
4 |
-
* Version : 1.0.0
|
5 |
-
* Author : Takashi Kitajima
|
6 |
-
* Author URI : http://2inc.org
|
7 |
-
* Created : January 2, 2015
|
8 |
-
* Modified :
|
9 |
-
* License : GPLv2
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
class MW_WP_Form_View {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* $variables
|
16 |
-
* @var array
|
17 |
-
*/
|
18 |
-
protected $variables = array();
|
19 |
-
|
20 |
-
/**
|
21 |
-
* set
|
22 |
-
* @param string $key
|
23 |
-
* @param mixed $value
|
24 |
-
*/
|
25 |
-
public function set( $key, $value ) {
|
26 |
-
$this->variables[$key] = $value;
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* get
|
31 |
-
* @param string $key
|
32 |
-
* @return mixed
|
33 |
-
*/
|
34 |
-
public function get( $key ) {
|
35 |
-
if ( isset( $this->variables[$key] ) ) {
|
36 |
-
return $this->variables[$key];
|
37 |
-
}
|
38 |
-
}
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 2.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/mw-wp-form\n"
|
7 |
-
"POT-Creation-Date: 2015-
|
8 |
-
"PO-Revision-Date: 2015-
|
9 |
"Last-Translator: Takashi Kitajima <inc@2inc.org>\n"
|
10 |
"Language-Team: Takashi Kitajima <inc@2inc.org>\n"
|
11 |
"Language: ja\n"
|
@@ -15,76 +15,66 @@ msgstr ""
|
|
15 |
"Plural-Forms: nplurals=1; plural=0;\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
"X-Poedit-Basepath: .\n"
|
18 |
-
"X-Generator: Poedit 1.7.
|
19 |
"X-Poedit-KeywordsList: __;_e;_x;esc_html_e;esc_html__\n"
|
20 |
"X-Poedit-SearchPath-0: ..\n"
|
21 |
|
22 |
-
#: classes/controllers/class.admin-list.php:
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
msgid "Form Key"
|
25 |
msgstr "フォーム識別子"
|
26 |
|
27 |
-
#: classes/controllers/class.admin.php:
|
28 |
msgid "Complete Message"
|
29 |
msgstr "完了画面メッセージ"
|
30 |
|
31 |
-
#: classes/controllers/class.admin.php:
|
32 |
msgid "URL Options"
|
33 |
msgstr "URL設定"
|
34 |
|
35 |
-
#: classes/controllers/class.admin.php:
|
36 |
msgid "Validation Rule"
|
37 |
msgstr "バリデーションルール"
|
38 |
|
39 |
-
#: classes/controllers/class.admin.php:
|
40 |
msgid "Add-ons"
|
41 |
msgstr "アドオン"
|
42 |
|
43 |
-
#: classes/controllers/class.admin.php:
|
44 |
msgid "Automatic Reply Email Options"
|
45 |
msgstr "自動返信メール設定"
|
46 |
|
47 |
-
#: classes/controllers/class.admin.php:
|
48 |
msgid "Admin Email Options"
|
49 |
msgstr "管理者宛メール設定"
|
50 |
|
51 |
-
#: classes/controllers/class.admin.php:
|
52 |
msgid "settings"
|
53 |
msgstr "設定"
|
54 |
|
55 |
-
#: classes/controllers/class.admin.php:
|
56 |
msgid "Style setting"
|
57 |
msgstr "スタイル設定"
|
58 |
|
59 |
-
#: classes/controllers/class.
|
60 |
-
#: classes/controllers/class.chart.php:79 classes/views/class.chart.php:65
|
61 |
-
msgid "Chart"
|
62 |
-
msgstr "グラフ"
|
63 |
-
|
64 |
-
#: classes/controllers/class.contact-data-list.php:160
|
65 |
-
#: classes/controllers/class.contact-data-list.php:207
|
66 |
-
#: classes/controllers/class.contact-data-list.php:297
|
67 |
-
#: classes/views/class.contact-data.php:101
|
68 |
-
msgid "Response Status"
|
69 |
-
msgstr "対応状況"
|
70 |
-
|
71 |
-
#: classes/controllers/class.contact-data-list.php:187
|
72 |
-
#: classes/controllers/class.contact-data-list.php:210
|
73 |
-
#: classes/views/class.contact-data.php:113
|
74 |
-
msgid "Memo"
|
75 |
-
msgstr "メモ"
|
76 |
-
|
77 |
-
#: classes/controllers/class.contact-data-list.php:296
|
78 |
msgid "Registed Date"
|
79 |
msgstr "登録日時"
|
80 |
|
81 |
-
#: classes/controllers/class.contact-data.php:
|
82 |
-
#: classes/
|
83 |
-
#:
|
84 |
-
msgid "
|
85 |
-
msgstr "
|
86 |
|
87 |
-
#: classes/controllers/class.contact-data.php:
|
88 |
msgid "Custom Fields"
|
89 |
msgstr "カスタムフィールド"
|
90 |
|
@@ -112,102 +102,104 @@ msgstr "ボタン"
|
|
112 |
msgid "Checkbox"
|
113 |
msgstr "チェックボックス"
|
114 |
|
115 |
-
#: classes/form-fields/class.checkbox.php:
|
116 |
-
#: classes/form-fields/class.radio.php:
|
117 |
-
#: classes/form-fields/class.select.php:
|
118 |
msgid "Choices"
|
119 |
msgstr "選択肢"
|
120 |
|
121 |
-
#: classes/form-fields/class.checkbox.php:
|
122 |
#: classes/form-fields/class.error.php:78
|
123 |
-
#: classes/form-fields/class.radio.php:
|
124 |
-
#: classes/form-fields/class.select.php:
|
125 |
msgid "Input one line about one item."
|
126 |
msgstr "1項目につき1行で入力してください。"
|
127 |
|
128 |
-
#: classes/form-fields/class.checkbox.php:
|
129 |
-
#: classes/form-fields/class.radio.php:
|
130 |
-
#: classes/form-fields/class.select.php:
|
131 |
msgid "Example: value1↵value2 or key1:value1↵key2:value2"
|
132 |
msgstr "例:値1↵値2 もしくは キー1:値1↵キー2:値2"
|
133 |
|
134 |
-
#: classes/form-fields/class.checkbox.php:
|
135 |
-
#: classes/form-fields/class.radio.php:
|
136 |
-
#: classes/form-fields/class.select.php:
|
137 |
msgid ""
|
138 |
"You can split the post value and display value by \":\". But display value "
|
139 |
"is sent in e-mail."
|
140 |
msgstr ""
|
141 |
"送信値と表示値を「:」で分割できます。ただし、メールでは表示値が送信されます。"
|
142 |
|
143 |
-
#: classes/form-fields/class.checkbox.php:
|
144 |
-
#: classes/form-fields/class.radio.php:
|
145 |
-
#: classes/form-fields/class.select.php:
|
146 |
msgid "When you want to use \":\", please enter \"::\"."
|
147 |
msgstr "「:」を使いたいときは「::」と入力してください。"
|
148 |
|
149 |
-
#: classes/form-fields/class.checkbox.php:
|
150 |
-
#: classes/form-fields/class.radio.php:
|
151 |
-
#: classes/form-fields/class.select.php:
|
152 |
msgid "Send value by e-mail"
|
153 |
msgstr "メールで送信する値"
|
154 |
|
155 |
-
#: classes/form-fields/class.checkbox.php:
|
156 |
-
#: classes/form-fields/class.radio.php:
|
157 |
-
#: classes/form-fields/class.select.php:
|
158 |
msgid ""
|
159 |
"Send post value when you split the post value and display value by \":\" in "
|
160 |
"choices."
|
161 |
msgstr "選択肢を「:」で送信値と表示値に分割したとき、送信値をメールで送信"
|
162 |
|
163 |
-
#: classes/form-fields/class.checkbox.php:
|
164 |
-
#: classes/form-fields/class.datepicker.php:
|
165 |
-
#: classes/form-fields/class.hidden.php:
|
166 |
-
#: classes/form-fields/class.password.php:
|
167 |
-
#: classes/form-fields/class.radio.php:
|
168 |
-
#: classes/form-fields/class.select.php:
|
169 |
-
#: classes/form-fields/class.text.php:
|
170 |
-
#: classes/form-fields/class.textarea.php:
|
171 |
msgid "Default value"
|
172 |
msgstr "初期値"
|
173 |
|
174 |
-
#: classes/form-fields/class.checkbox.php:
|
175 |
msgid "Separator string"
|
176 |
msgstr "区切り文字"
|
177 |
|
178 |
-
#: classes/form-fields/class.checkbox.php:
|
179 |
-
#: classes/form-fields/class.radio.php:
|
180 |
msgid "Display method"
|
181 |
msgstr "表示方法"
|
182 |
|
183 |
-
#: classes/form-fields/class.checkbox.php:
|
184 |
-
#: classes/form-fields/class.radio.php:
|
185 |
msgid "Arranged vertically."
|
186 |
msgstr "垂直に配置する"
|
187 |
|
188 |
-
#: classes/form-fields/class.checkbox.php:
|
189 |
-
#: classes/form-fields/class.datepicker.php:
|
190 |
-
#: classes/form-fields/class.file.php:
|
191 |
-
#: classes/form-fields/class.image.php:
|
192 |
-
#: classes/form-fields/class.password.php:
|
193 |
-
#: classes/form-fields/class.radio.php:
|
194 |
-
#: classes/form-fields/class.select.php:
|
195 |
-
#: classes/form-fields/class.tel.php:
|
196 |
-
#: classes/form-fields/class.
|
197 |
-
#: classes/form-fields/class.
|
|
|
198 |
msgid "Dsiplay error"
|
199 |
msgstr "エラー表示"
|
200 |
|
201 |
-
#: classes/form-fields/class.checkbox.php:
|
202 |
-
#: classes/form-fields/class.datepicker.php:
|
203 |
-
#: classes/form-fields/class.file.php:
|
204 |
-
#: classes/form-fields/class.image.php:
|
205 |
-
#: classes/form-fields/class.password.php:
|
206 |
-
#: classes/form-fields/class.radio.php:
|
207 |
-
#: classes/form-fields/class.select.php:
|
208 |
-
#: classes/form-fields/class.tel.php:
|
209 |
-
#: classes/form-fields/class.
|
210 |
-
#: classes/form-fields/class.
|
|
|
211 |
msgid "Don't display error."
|
212 |
msgstr "エラーを表示しない"
|
213 |
|
@@ -236,7 +228,7 @@ msgstr "エラーを表示したい要素のname属性"
|
|
236 |
msgid "File"
|
237 |
msgstr "ファイルフィールド"
|
238 |
|
239 |
-
#: classes/form-fields/class.file.php:
|
240 |
msgid "Uploaded."
|
241 |
msgstr "アップロードしました。"
|
242 |
|
@@ -244,11 +236,11 @@ msgstr "アップロードしました。"
|
|
244 |
msgid "Hidden"
|
245 |
msgstr "hiddenフィールド"
|
246 |
|
247 |
-
#: classes/form-fields/class.hidden.php:
|
248 |
msgid "Display"
|
249 |
msgstr "表示する"
|
250 |
|
251 |
-
#: classes/form-fields/class.hidden.php:
|
252 |
msgid "Display hidden value."
|
253 |
msgstr "hiddenの値を表示"
|
254 |
|
@@ -290,16 +282,17 @@ msgid "Submit Button"
|
|
290 |
msgstr "送信ボタン"
|
291 |
|
292 |
#: classes/form-fields/class.tel.php:30
|
293 |
-
#: classes/validation-rules/class.tel.php:
|
294 |
msgid "Tel"
|
295 |
msgstr "電話番号"
|
296 |
|
297 |
-
#: classes/form-fields/class.tel.php:
|
298 |
-
#: classes/form-fields/class.
|
|
|
299 |
msgid "Convert half alphanumeric"
|
300 |
msgstr "半角英数字に変換"
|
301 |
|
302 |
-
#: classes/form-fields/class.tel.php:
|
303 |
msgid "Don't Convert."
|
304 |
msgstr "変換しない"
|
305 |
|
@@ -307,7 +300,7 @@ msgstr "変換しない"
|
|
307 |
msgid "Text"
|
308 |
msgstr "テキストフィールド"
|
309 |
|
310 |
-
#: classes/form-fields/class.text.php:
|
311 |
msgid "Convert."
|
312 |
msgstr "変換する"
|
313 |
|
@@ -316,7 +309,7 @@ msgid "Textarea"
|
|
316 |
msgstr "テキストエリア"
|
317 |
|
318 |
#: classes/form-fields/class.zip.php:30
|
319 |
-
#: classes/validation-rules/class.zip.php:
|
320 |
msgid "Zip Code"
|
321 |
msgstr "郵便番号"
|
322 |
|
@@ -324,22 +317,27 @@ msgstr "郵便番号"
|
|
324 |
msgid "Uploaded from "
|
325 |
msgstr "Uploaded from "
|
326 |
|
327 |
-
#: classes/functions.php:
|
328 |
msgid "Tracking Number"
|
329 |
msgstr "問い合わせ番号"
|
330 |
|
331 |
-
#: classes/models/class.contact-data-setting.php:
|
332 |
msgid "Not supported"
|
333 |
msgstr "未対応"
|
334 |
|
335 |
-
#: classes/models/class.contact-data-setting.php:
|
336 |
msgid "Reservation"
|
337 |
msgstr "保留"
|
338 |
|
339 |
-
#: classes/models/class.contact-data-setting.php:
|
340 |
msgid "Supported"
|
341 |
msgstr "対応済み"
|
342 |
|
|
|
|
|
|
|
|
|
|
|
343 |
#: classes/validation-rules/class.akismet.php:30
|
344 |
msgid "The contents which you input were judged with spam."
|
345 |
msgstr "あなたの入力した内容はスパムと判定されました。"
|
@@ -348,7 +346,7 @@ msgstr "あなたの入力した内容はスパムと判定されました。"
|
|
348 |
msgid "Please enter with a half-width alphabetic character."
|
349 |
msgstr "半角英字で入力してください。"
|
350 |
|
351 |
-
#: classes/validation-rules/class.alpha.php:
|
352 |
msgid "Alphabet"
|
353 |
msgstr "半角英字"
|
354 |
|
@@ -356,7 +354,7 @@ msgstr "半角英字"
|
|
356 |
msgid "Please enter with a half-width alphanumeric character."
|
357 |
msgstr "半角英数字で入力してください。"
|
358 |
|
359 |
-
#: classes/validation-rules/class.alphanumeric.php:
|
360 |
msgid "Alphabet and Numeric"
|
361 |
msgstr "半角英数字"
|
362 |
|
@@ -364,7 +362,7 @@ msgstr "半角英数字"
|
|
364 |
msgid "The number of characters is invalid."
|
365 |
msgstr "文字数が正しくありません。"
|
366 |
|
367 |
-
#: classes/validation-rules/class.between.php:
|
368 |
msgid "The range of the number of characters"
|
369 |
msgstr "文字数の範囲"
|
370 |
|
@@ -372,7 +370,7 @@ msgstr "文字数の範囲"
|
|
372 |
msgid "This is not the format of a date."
|
373 |
msgstr "日付の形式ではありません。"
|
374 |
|
375 |
-
#: classes/validation-rules/class.date.php:
|
376 |
msgid "Date"
|
377 |
msgstr "日付"
|
378 |
|
@@ -380,7 +378,7 @@ msgstr "日付"
|
|
380 |
msgid "This is not in agreement."
|
381 |
msgstr "一致しません。"
|
382 |
|
383 |
-
#: classes/validation-rules/class.eq.php:
|
384 |
msgid "The key at same value"
|
385 |
msgstr "一致する項目"
|
386 |
|
@@ -388,11 +386,11 @@ msgstr "一致する項目"
|
|
388 |
msgid "This file size is too big."
|
389 |
msgstr "ファイルサイズが大きすぎます。"
|
390 |
|
391 |
-
#: classes/validation-rules/class.filesize.php:
|
392 |
msgid "Permitted file size"
|
393 |
msgstr "サイズ制限"
|
394 |
|
395 |
-
#: classes/validation-rules/class.filesize.php:
|
396 |
msgid "bytes"
|
397 |
msgstr "バイト"
|
398 |
|
@@ -400,11 +398,11 @@ msgstr "バイト"
|
|
400 |
msgid "This file is invalid."
|
401 |
msgstr "許可されたファイルではありません。"
|
402 |
|
403 |
-
#: classes/validation-rules/class.filetype.php:
|
404 |
msgid "Permitted Extension"
|
405 |
msgstr "拡張子制限"
|
406 |
|
407 |
-
#: classes/validation-rules/class.filetype.php:
|
408 |
msgid "Example:jpg or jpg,txt,…"
|
409 |
msgstr "例:jpg もしくは jpg,txt…"
|
410 |
|
@@ -412,7 +410,7 @@ msgstr "例:jpg もしくは jpg,txt…"
|
|
412 |
msgid "Please enter with a Japanese Hiragana."
|
413 |
msgstr "ひらがなで入力してください。"
|
414 |
|
415 |
-
#: classes/validation-rules/class.hiragana.php:
|
416 |
msgid "Japanese Hiragana"
|
417 |
msgstr "ひらがな"
|
418 |
|
@@ -424,7 +422,7 @@ msgstr "値が不正です。"
|
|
424 |
msgid "Please enter with a Japanese Katakana."
|
425 |
msgstr "カタカナで入力してください。"
|
426 |
|
427 |
-
#: classes/validation-rules/class.katakana.php:
|
428 |
msgid "Japanese Katakana"
|
429 |
msgstr "カタカナ"
|
430 |
|
@@ -432,7 +430,7 @@ msgstr "カタカナ"
|
|
432 |
msgid "This is not the format of a mail address."
|
433 |
msgstr "メールアドレスの形式ではありません。"
|
434 |
|
435 |
-
#: classes/validation-rules/class.mail.php:
|
436 |
msgid "E-mail"
|
437 |
msgstr "メールアドレス"
|
438 |
|
@@ -440,7 +438,7 @@ msgstr "メールアドレス"
|
|
440 |
msgid "The number of characters is a few."
|
441 |
msgstr "文字数が足りません。"
|
442 |
|
443 |
-
#: classes/validation-rules/class.minlength.php:
|
444 |
msgid "The number of the minimum characters"
|
445 |
msgstr "最小文字数"
|
446 |
|
@@ -449,7 +447,7 @@ msgstr "最小文字数"
|
|
449 |
msgid "Please enter."
|
450 |
msgstr "未入力です。"
|
451 |
|
452 |
-
#: classes/validation-rules/class.noempty.php:
|
453 |
msgid "No empty"
|
454 |
msgstr "必須項目"
|
455 |
|
@@ -457,7 +455,7 @@ msgstr "必須項目"
|
|
457 |
msgid "Please enter with a half-width number."
|
458 |
msgstr "半角数字で入力してください。"
|
459 |
|
460 |
-
#: classes/validation-rules/class.numeric.php:
|
461 |
msgid "Numeric"
|
462 |
msgstr "半角数字"
|
463 |
|
@@ -465,7 +463,7 @@ msgstr "半角数字"
|
|
465 |
msgid "This is required."
|
466 |
msgstr "必須項目です。"
|
467 |
|
468 |
-
#: classes/validation-rules/class.required.php:
|
469 |
msgid "No empty( with checkbox )"
|
470 |
msgstr "必須項目(チェックボックス)"
|
471 |
|
@@ -477,7 +475,7 @@ msgstr "電話番号の形式ではありません。"
|
|
477 |
msgid "This is not the format of a url."
|
478 |
msgstr "URLの形式ではありません。"
|
479 |
|
480 |
-
#: classes/validation-rules/class.url.php:
|
481 |
msgid "URL"
|
482 |
msgstr "URL"
|
483 |
|
@@ -485,131 +483,149 @@ msgstr "URL"
|
|
485 |
msgid "This is not the format of a zip code."
|
486 |
msgstr "郵便番号の形式ではありません。"
|
487 |
|
488 |
-
#:
|
489 |
-
msgid "
|
490 |
-
msgstr "
|
491 |
|
492 |
-
#:
|
493 |
-
|
494 |
-
|
|
|
495 |
|
496 |
-
#:
|
497 |
-
msgid "
|
498 |
-
msgstr "
|
499 |
|
500 |
-
#:
|
501 |
-
msgid "
|
502 |
-
msgstr "
|
503 |
|
504 |
-
#:
|
505 |
-
msgid "
|
506 |
-
msgstr "
|
507 |
|
508 |
-
#:
|
509 |
-
msgid "
|
510 |
-
msgstr "
|
511 |
|
512 |
-
#:
|
513 |
-
msgid ""
|
514 |
-
|
515 |
-
"setting is empty, The page redirect on the same page."
|
516 |
-
msgstr ""
|
517 |
-
"上記URLはボタン押下時のリダイレクトURLです。URLの設定が空のときは、同一ページ"
|
518 |
-
"上でリダイレクトします。"
|
519 |
|
520 |
-
#:
|
521 |
-
msgid "
|
522 |
-
msgstr "
|
523 |
|
524 |
-
#:
|
525 |
-
msgid "
|
526 |
-
msgstr "
|
527 |
|
528 |
-
#:
|
529 |
-
msgid "
|
530 |
-
msgstr "
|
531 |
|
532 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
533 |
msgid "You can use more easy and useful to the MW WP Form in add-on!"
|
534 |
msgstr "アドオンで MW WP Form をもっと簡単・便利に使うことができます!"
|
535 |
|
536 |
-
#:
|
537 |
msgid "View Add-ons"
|
538 |
msgstr "アドオンを見る"
|
539 |
|
540 |
-
#:
|
541 |
-
msgid "Copy and Paste this shortcode."
|
542 |
-
msgstr "このショートコードをコピー&ペーストしてください。"
|
543 |
-
|
544 |
-
#: classes/views/class.admin.php:139
|
545 |
-
msgid "The key to use with hook is "
|
546 |
-
msgstr "各フックで使用する修飾子は"
|
547 |
-
|
548 |
-
#: classes/views/class.admin.php:157 classes/views/class.admin.php:203
|
549 |
msgid "{key} is converted form data."
|
550 |
msgstr "{キー}でそのフォーム項目に変換されます。"
|
551 |
|
552 |
-
#:
|
553 |
msgid "It is automatically converted to Tracking number when you input {%s}."
|
554 |
msgstr "{%s} と入力すると問い合わせ番号に自動的に変換されます。"
|
555 |
|
556 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
557 |
msgid "Subject"
|
558 |
msgstr "件名"
|
559 |
|
560 |
-
#:
|
|
|
561 |
msgid "Sender"
|
562 |
msgstr "送信者"
|
563 |
|
564 |
-
#:
|
565 |
-
#:
|
566 |
-
#: classes/views/class.admin.php:237
|
567 |
-
msgid "If empty:"
|
568 |
-
msgstr "未入力の場合:"
|
569 |
-
|
570 |
-
#: classes/views/class.admin.php:173 classes/views/class.admin.php:235
|
571 |
msgid "From ( E-mail address )"
|
572 |
msgstr "送信元(E-mailアドレス)"
|
573 |
|
574 |
-
#:
|
|
|
575 |
msgid "Content"
|
576 |
msgstr "本文"
|
577 |
|
578 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
579 |
msgid "Automatic reply email"
|
580 |
msgstr "自動返信メール"
|
581 |
|
582 |
-
#:
|
583 |
msgid ""
|
584 |
"Input the key to use as transmission to automatic reply email. {} is "
|
585 |
"unnecessary."
|
586 |
msgstr "自動返信メールに使用する項目のキーを入力してください。{ }は不要です。"
|
587 |
|
588 |
-
#:
|
589 |
-
msgid ""
|
590 |
-
"If Admin Email Options is a blank, Automatic Replay Email Options is used as "
|
591 |
-
"Admin Email Options."
|
592 |
-
msgstr ""
|
593 |
-
"管理者宛メール設定が空のときは自動返信メール設定に管理者宛メール設定が使用さ"
|
594 |
-
"れます。"
|
595 |
-
|
596 |
-
#: classes/views/class.admin.php:213
|
597 |
-
msgid "To ( E-mail address )"
|
598 |
-
msgstr "送信先(E-mailアドレス)"
|
599 |
-
|
600 |
-
#: classes/views/class.admin.php:218
|
601 |
-
msgid "CC ( E-mail address )"
|
602 |
-
msgstr "CC(E-mailアドレス)"
|
603 |
-
|
604 |
-
#: classes/views/class.admin.php:222
|
605 |
-
msgid "BCC ( E-mail address )"
|
606 |
-
msgstr "BCC(E-mailアドレス)"
|
607 |
-
|
608 |
-
#: classes/views/class.admin.php:259
|
609 |
msgid "Activate Query string of post"
|
610 |
msgstr "URL引数を有効にする"
|
611 |
|
612 |
-
#:
|
613 |
msgid ""
|
614 |
"If this field is active, MW WP Form get query string. And get post data from "
|
615 |
"query string \"post_id\". You can use $post's property in editor."
|
@@ -618,94 +634,135 @@ msgstr ""
|
|
618 |
"とに投稿を取得します。その投稿($post) のプロパティを使用できるようになりま"
|
619 |
"す。"
|
620 |
|
621 |
-
#:
|
622 |
msgid "Example: {ID}, {post_title}, {post_meta} etc..."
|
623 |
msgstr "例:{ID}、{post_title}、{post_meta}など…"
|
624 |
|
625 |
-
#:
|
626 |
msgid "Saving inquiry data in database"
|
627 |
msgstr "問い合わせデータをデータベースに保存"
|
628 |
|
629 |
-
#:
|
630 |
msgid "Enable scrolling of screen transition."
|
631 |
msgstr "画面変遷時のスクロールを有効にする"
|
632 |
|
633 |
-
#:
|
634 |
msgid "Akismet Setting"
|
635 |
msgstr "Akismet 設定"
|
636 |
|
637 |
-
#:
|
638 |
msgid "Input the key to use Akismet."
|
639 |
msgstr "Akismetを使用する項目のキーを入力してください。"
|
640 |
|
641 |
-
#:
|
642 |
msgid "Select Style"
|
643 |
msgstr "スタイルを選択"
|
644 |
|
645 |
-
#:
|
646 |
msgid "Select this."
|
647 |
msgstr "選択してください"
|
648 |
|
649 |
-
#:
|
650 |
msgid "Input fields"
|
651 |
msgstr "入力項目"
|
652 |
|
653 |
-
#:
|
654 |
msgid "Select fields"
|
655 |
msgstr "選択項目"
|
656 |
|
657 |
-
#:
|
658 |
msgid "Button fields"
|
659 |
msgstr "ボタン項目"
|
660 |
|
661 |
-
#:
|
662 |
msgid "Error fields"
|
663 |
msgstr "エラー項目"
|
664 |
|
665 |
-
#:
|
666 |
msgid "Other fields"
|
667 |
msgstr "その他の項目"
|
668 |
|
669 |
-
#:
|
670 |
msgid "Add form tag"
|
671 |
msgstr "フォームタグを追加"
|
672 |
|
673 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
674 |
msgid "Add Chart"
|
675 |
msgstr "グラフを追加"
|
676 |
|
677 |
-
#:
|
678 |
msgid "Item that create chart"
|
679 |
msgstr "グラフを作成する項目"
|
680 |
|
681 |
-
#:
|
682 |
msgid "Chart type"
|
683 |
msgstr "グラフの種類"
|
684 |
|
685 |
-
#:
|
686 |
msgid "Pie chart"
|
687 |
msgstr "円グラフ"
|
688 |
|
689 |
-
#:
|
690 |
msgid "Bar chart"
|
691 |
msgstr "棒グラフ"
|
692 |
|
693 |
-
#:
|
694 |
msgid ""
|
695 |
"Separator string (If the check box. If the separator attribute is not set to "
|
696 |
"\",\")"
|
697 |
msgstr ""
|
698 |
"区切り文字(チェックボックスの場合。separator 属性が未設定の場合は「,」)"
|
699 |
|
700 |
-
#:
|
|
|
701 |
msgid "The number of inquiries"
|
702 |
msgstr "問い合わせ件数"
|
703 |
|
704 |
-
#:
|
|
|
|
|
|
|
|
|
705 |
msgid "CSV Download"
|
706 |
msgstr "CSVダウンロード"
|
707 |
|
708 |
-
#:
|
709 |
msgid ""
|
710 |
"You can see the inquiry data that are saved in the database by clicking on "
|
711 |
"the link below."
|
@@ -713,79 +770,27 @@ msgstr ""
|
|
713 |
"リンクをクリックすることでデータベースに保存された問い合わせデータを見ること"
|
714 |
"ができます。"
|
715 |
|
716 |
-
#:
|
717 |
msgid "Form title"
|
718 |
msgstr "フォーム名"
|
719 |
|
720 |
-
#:
|
721 |
-
#:
|
722 |
msgid "Display Chart"
|
723 |
msgstr "グラフを表示"
|
724 |
|
725 |
-
#:
|
726 |
msgid "Updated date"
|
727 |
msgstr "更新日"
|
728 |
|
729 |
-
#:
|
730 |
msgid "Created date"
|
731 |
msgstr "作成日"
|
732 |
|
733 |
-
#:
|
734 |
msgid "cases"
|
735 |
msgstr "件"
|
736 |
|
737 |
-
#: classes/views/class.contact-data.php:127
|
738 |
-
msgid "« Back to the list"
|
739 |
-
msgstr "« 一覧に戻る"
|
740 |
-
|
741 |
-
#: mw-wp-form.php:185
|
742 |
-
msgid "Add New Form"
|
743 |
-
msgstr "フォームを追加"
|
744 |
-
|
745 |
-
#: mw-wp-form.php:186
|
746 |
-
msgid "Edit Form"
|
747 |
-
msgstr "フォームを編集"
|
748 |
-
|
749 |
-
#: mw-wp-form.php:187
|
750 |
-
msgid "New Form"
|
751 |
-
msgstr "新しいフォーム"
|
752 |
-
|
753 |
-
#: mw-wp-form.php:188
|
754 |
-
msgid "View Form"
|
755 |
-
msgstr "フォームを表示"
|
756 |
-
|
757 |
-
#: mw-wp-form.php:189
|
758 |
-
msgid "Search Forms"
|
759 |
-
msgstr "フォームを検索"
|
760 |
-
|
761 |
-
#: mw-wp-form.php:190
|
762 |
-
msgid "No Forms found"
|
763 |
-
msgstr "フォームがありません"
|
764 |
-
|
765 |
-
#: mw-wp-form.php:191
|
766 |
-
msgid "No Forms found in Trash"
|
767 |
-
msgstr "ゴミ箱にフォームはありません"
|
768 |
-
|
769 |
-
#: mw-wp-form.php:208
|
770 |
-
msgid "Edit "
|
771 |
-
msgstr "編集"
|
772 |
-
|
773 |
-
#: mw-wp-form.php:209
|
774 |
-
msgid "View"
|
775 |
-
msgstr "表示"
|
776 |
-
|
777 |
-
#: mw-wp-form.php:210
|
778 |
-
msgid "Search"
|
779 |
-
msgstr "検索"
|
780 |
-
|
781 |
-
#: mw-wp-form.php:211
|
782 |
-
msgid "No data found"
|
783 |
-
msgstr "データがありません"
|
784 |
-
|
785 |
-
#: mw-wp-form.php:212
|
786 |
-
msgid "No data found in Trash"
|
787 |
-
msgstr "ゴミ箱にデータはありません"
|
788 |
-
|
789 |
#. Plugin Name of the plugin/theme
|
790 |
msgid "MW WP Form"
|
791 |
msgstr "MW WP Form"
|
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 2.4.0\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/mw-wp-form\n"
|
7 |
+
"POT-Creation-Date: 2015-04-03 07:04:28+00:00\n"
|
8 |
+
"PO-Revision-Date: 2015-04-03 16:05+0900\n"
|
9 |
"Last-Translator: Takashi Kitajima <inc@2inc.org>\n"
|
10 |
"Language-Team: Takashi Kitajima <inc@2inc.org>\n"
|
11 |
"Language: ja\n"
|
15 |
"Plural-Forms: nplurals=1; plural=0;\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
"X-Poedit-Basepath: .\n"
|
18 |
+
"X-Generator: Poedit 1.7.5\n"
|
19 |
"X-Poedit-KeywordsList: __;_e;_x;esc_html_e;esc_html__\n"
|
20 |
"X-Poedit-SearchPath-0: ..\n"
|
21 |
|
22 |
+
#: classes/controllers/class.admin-list.php:34
|
23 |
+
msgid "Your contribution is needed for making this plugin better."
|
24 |
+
msgstr "あなたの貢献があればこのプラグインをもっと良くすることができます。"
|
25 |
+
|
26 |
+
#: classes/controllers/class.admin-list.php:36
|
27 |
+
msgid "Donate"
|
28 |
+
msgstr "寄付する"
|
29 |
+
|
30 |
+
#: classes/controllers/class.admin-list.php:66
|
31 |
+
#: classes/controllers/class.admin.php:89
|
32 |
msgid "Form Key"
|
33 |
msgstr "フォーム識別子"
|
34 |
|
35 |
+
#: classes/controllers/class.admin.php:57
|
36 |
msgid "Complete Message"
|
37 |
msgstr "完了画面メッセージ"
|
38 |
|
39 |
+
#: classes/controllers/class.admin.php:65
|
40 |
msgid "URL Options"
|
41 |
msgstr "URL設定"
|
42 |
|
43 |
+
#: classes/controllers/class.admin.php:73
|
44 |
msgid "Validation Rule"
|
45 |
msgstr "バリデーションルール"
|
46 |
|
47 |
+
#: classes/controllers/class.admin.php:81
|
48 |
msgid "Add-ons"
|
49 |
msgstr "アドオン"
|
50 |
|
51 |
+
#: classes/controllers/class.admin.php:97
|
52 |
msgid "Automatic Reply Email Options"
|
53 |
msgstr "自動返信メール設定"
|
54 |
|
55 |
+
#: classes/controllers/class.admin.php:105
|
56 |
msgid "Admin Email Options"
|
57 |
msgstr "管理者宛メール設定"
|
58 |
|
59 |
+
#: classes/controllers/class.admin.php:113
|
60 |
msgid "settings"
|
61 |
msgstr "設定"
|
62 |
|
63 |
+
#: classes/controllers/class.admin.php:122
|
64 |
msgid "Style setting"
|
65 |
msgstr "スタイル設定"
|
66 |
|
67 |
+
#: classes/controllers/class.contact-data-list.php:117
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
msgid "Registed Date"
|
69 |
msgstr "登録日時"
|
70 |
|
71 |
+
#: classes/controllers/class.contact-data-list.php:118
|
72 |
+
#: classes/models/class.csv.php:122 classes/models/class.csv.php:169
|
73 |
+
#: templates/contact-data/detail.php:32
|
74 |
+
msgid "Response Status"
|
75 |
+
msgstr "対応状況"
|
76 |
|
77 |
+
#: classes/controllers/class.contact-data.php:70
|
78 |
msgid "Custom Fields"
|
79 |
msgstr "カスタムフィールド"
|
80 |
|
102 |
msgid "Checkbox"
|
103 |
msgstr "チェックボックス"
|
104 |
|
105 |
+
#: classes/form-fields/class.checkbox.php:115
|
106 |
+
#: classes/form-fields/class.radio.php:111
|
107 |
+
#: classes/form-fields/class.select.php:109
|
108 |
msgid "Choices"
|
109 |
msgstr "選択肢"
|
110 |
|
111 |
+
#: classes/form-fields/class.checkbox.php:119
|
112 |
#: classes/form-fields/class.error.php:78
|
113 |
+
#: classes/form-fields/class.radio.php:115
|
114 |
+
#: classes/form-fields/class.select.php:113
|
115 |
msgid "Input one line about one item."
|
116 |
msgstr "1項目につき1行で入力してください。"
|
117 |
|
118 |
+
#: classes/form-fields/class.checkbox.php:120
|
119 |
+
#: classes/form-fields/class.radio.php:116
|
120 |
+
#: classes/form-fields/class.select.php:114
|
121 |
msgid "Example: value1↵value2 or key1:value1↵key2:value2"
|
122 |
msgstr "例:値1↵値2 もしくは キー1:値1↵キー2:値2"
|
123 |
|
124 |
+
#: classes/form-fields/class.checkbox.php:121
|
125 |
+
#: classes/form-fields/class.radio.php:117
|
126 |
+
#: classes/form-fields/class.select.php:115
|
127 |
msgid ""
|
128 |
"You can split the post value and display value by \":\". But display value "
|
129 |
"is sent in e-mail."
|
130 |
msgstr ""
|
131 |
"送信値と表示値を「:」で分割できます。ただし、メールでは表示値が送信されます。"
|
132 |
|
133 |
+
#: classes/form-fields/class.checkbox.php:122
|
134 |
+
#: classes/form-fields/class.radio.php:118
|
135 |
+
#: classes/form-fields/class.select.php:116
|
136 |
msgid "When you want to use \":\", please enter \"::\"."
|
137 |
msgstr "「:」を使いたいときは「::」と入力してください。"
|
138 |
|
139 |
+
#: classes/form-fields/class.checkbox.php:126
|
140 |
+
#: classes/form-fields/class.radio.php:122
|
141 |
+
#: classes/form-fields/class.select.php:120
|
142 |
msgid "Send value by e-mail"
|
143 |
msgstr "メールで送信する値"
|
144 |
|
145 |
+
#: classes/form-fields/class.checkbox.php:129
|
146 |
+
#: classes/form-fields/class.radio.php:125
|
147 |
+
#: classes/form-fields/class.select.php:123
|
148 |
msgid ""
|
149 |
"Send post value when you split the post value and display value by \":\" in "
|
150 |
"choices."
|
151 |
msgstr "選択肢を「:」で送信値と表示値に分割したとき、送信値をメールで送信"
|
152 |
|
153 |
+
#: classes/form-fields/class.checkbox.php:132
|
154 |
+
#: classes/form-fields/class.datepicker.php:136
|
155 |
+
#: classes/form-fields/class.hidden.php:82
|
156 |
+
#: classes/form-fields/class.password.php:112
|
157 |
+
#: classes/form-fields/class.radio.php:128
|
158 |
+
#: classes/form-fields/class.select.php:126
|
159 |
+
#: classes/form-fields/class.text.php:119
|
160 |
+
#: classes/form-fields/class.textarea.php:114
|
161 |
msgid "Default value"
|
162 |
msgstr "初期値"
|
163 |
|
164 |
+
#: classes/form-fields/class.checkbox.php:137
|
165 |
msgid "Separator string"
|
166 |
msgstr "区切り文字"
|
167 |
|
168 |
+
#: classes/form-fields/class.checkbox.php:142
|
169 |
+
#: classes/form-fields/class.radio.php:133
|
170 |
msgid "Display method"
|
171 |
msgstr "表示方法"
|
172 |
|
173 |
+
#: classes/form-fields/class.checkbox.php:144
|
174 |
+
#: classes/form-fields/class.radio.php:135
|
175 |
msgid "Arranged vertically."
|
176 |
msgstr "垂直に配置する"
|
177 |
|
178 |
+
#: classes/form-fields/class.checkbox.php:147
|
179 |
+
#: classes/form-fields/class.datepicker.php:141
|
180 |
+
#: classes/form-fields/class.file.php:115
|
181 |
+
#: classes/form-fields/class.image.php:119
|
182 |
+
#: classes/form-fields/class.password.php:122
|
183 |
+
#: classes/form-fields/class.radio.php:138
|
184 |
+
#: classes/form-fields/class.select.php:131
|
185 |
+
#: classes/form-fields/class.tel.php:102
|
186 |
+
#: classes/form-fields/class.text.php:129
|
187 |
+
#: classes/form-fields/class.textarea.php:124
|
188 |
+
#: classes/form-fields/class.zip.php:101
|
189 |
msgid "Dsiplay error"
|
190 |
msgstr "エラー表示"
|
191 |
|
192 |
+
#: classes/form-fields/class.checkbox.php:149
|
193 |
+
#: classes/form-fields/class.datepicker.php:143
|
194 |
+
#: classes/form-fields/class.file.php:117
|
195 |
+
#: classes/form-fields/class.image.php:121
|
196 |
+
#: classes/form-fields/class.password.php:124
|
197 |
+
#: classes/form-fields/class.radio.php:140
|
198 |
+
#: classes/form-fields/class.select.php:133
|
199 |
+
#: classes/form-fields/class.tel.php:104
|
200 |
+
#: classes/form-fields/class.text.php:131
|
201 |
+
#: classes/form-fields/class.textarea.php:126
|
202 |
+
#: classes/form-fields/class.zip.php:103
|
203 |
msgid "Don't display error."
|
204 |
msgstr "エラーを表示しない"
|
205 |
|
228 |
msgid "File"
|
229 |
msgstr "ファイルフィールド"
|
230 |
|
231 |
+
#: classes/form-fields/class.file.php:68 classes/form-fields/class.file.php:90
|
232 |
msgid "Uploaded."
|
233 |
msgstr "アップロードしました。"
|
234 |
|
236 |
msgid "Hidden"
|
237 |
msgstr "hiddenフィールド"
|
238 |
|
239 |
+
#: classes/form-fields/class.hidden.php:87
|
240 |
msgid "Display"
|
241 |
msgstr "表示する"
|
242 |
|
243 |
+
#: classes/form-fields/class.hidden.php:89
|
244 |
msgid "Display hidden value."
|
245 |
msgstr "hiddenの値を表示"
|
246 |
|
282 |
msgstr "送信ボタン"
|
283 |
|
284 |
#: classes/form-fields/class.tel.php:30
|
285 |
+
#: classes/validation-rules/class.tel.php:56
|
286 |
msgid "Tel"
|
287 |
msgstr "電話番号"
|
288 |
|
289 |
+
#: classes/form-fields/class.tel.php:107
|
290 |
+
#: classes/form-fields/class.text.php:134
|
291 |
+
#: classes/form-fields/class.zip.php:106
|
292 |
msgid "Convert half alphanumeric"
|
293 |
msgstr "半角英数字に変換"
|
294 |
|
295 |
+
#: classes/form-fields/class.tel.php:109 classes/form-fields/class.zip.php:108
|
296 |
msgid "Don't Convert."
|
297 |
msgstr "変換しない"
|
298 |
|
300 |
msgid "Text"
|
301 |
msgstr "テキストフィールド"
|
302 |
|
303 |
+
#: classes/form-fields/class.text.php:136
|
304 |
msgid "Convert."
|
305 |
msgstr "変換する"
|
306 |
|
309 |
msgstr "テキストエリア"
|
310 |
|
311 |
#: classes/form-fields/class.zip.php:30
|
312 |
+
#: classes/validation-rules/class.zip.php:49
|
313 |
msgid "Zip Code"
|
314 |
msgstr "郵便番号"
|
315 |
|
317 |
msgid "Uploaded from "
|
318 |
msgstr "Uploaded from "
|
319 |
|
320 |
+
#: classes/functions.php:291
|
321 |
msgid "Tracking Number"
|
322 |
msgstr "問い合わせ番号"
|
323 |
|
324 |
+
#: classes/models/class.contact-data-setting.php:60
|
325 |
msgid "Not supported"
|
326 |
msgstr "未対応"
|
327 |
|
328 |
+
#: classes/models/class.contact-data-setting.php:61
|
329 |
msgid "Reservation"
|
330 |
msgstr "保留"
|
331 |
|
332 |
+
#: classes/models/class.contact-data-setting.php:62
|
333 |
msgid "Supported"
|
334 |
msgstr "対応済み"
|
335 |
|
336 |
+
#: classes/models/class.csv.php:148 classes/models/class.csv.php:172
|
337 |
+
#: templates/contact-data/detail.php:44
|
338 |
+
msgid "Memo"
|
339 |
+
msgstr "メモ"
|
340 |
+
|
341 |
#: classes/validation-rules/class.akismet.php:30
|
342 |
msgid "The contents which you input were judged with spam."
|
343 |
msgstr "あなたの入力した内容はスパムと判定されました。"
|
346 |
msgid "Please enter with a half-width alphabetic character."
|
347 |
msgstr "半角英字で入力してください。"
|
348 |
|
349 |
+
#: classes/validation-rules/class.alpha.php:49
|
350 |
msgid "Alphabet"
|
351 |
msgstr "半角英字"
|
352 |
|
354 |
msgid "Please enter with a half-width alphanumeric character."
|
355 |
msgstr "半角英数字で入力してください。"
|
356 |
|
357 |
+
#: classes/validation-rules/class.alphanumeric.php:49
|
358 |
msgid "Alphabet and Numeric"
|
359 |
msgstr "半角英数字"
|
360 |
|
362 |
msgid "The number of characters is invalid."
|
363 |
msgstr "文字数が正しくありません。"
|
364 |
|
365 |
+
#: classes/validation-rules/class.between.php:77
|
366 |
msgid "The range of the number of characters"
|
367 |
msgstr "文字数の範囲"
|
368 |
|
370 |
msgid "This is not the format of a date."
|
371 |
msgstr "日付の形式ではありません。"
|
372 |
|
373 |
+
#: classes/validation-rules/class.date.php:60
|
374 |
msgid "Date"
|
375 |
msgstr "日付"
|
376 |
|
378 |
msgid "This is not in agreement."
|
379 |
msgstr "一致しません。"
|
380 |
|
381 |
+
#: classes/validation-rules/class.eq.php:57
|
382 |
msgid "The key at same value"
|
383 |
msgstr "一致する項目"
|
384 |
|
386 |
msgid "This file size is too big."
|
387 |
msgstr "ファイルサイズが大きすぎます。"
|
388 |
|
389 |
+
#: classes/validation-rules/class.filesize.php:59
|
390 |
msgid "Permitted file size"
|
391 |
msgstr "サイズ制限"
|
392 |
|
393 |
+
#: classes/validation-rules/class.filesize.php:60
|
394 |
msgid "bytes"
|
395 |
msgstr "バイト"
|
396 |
|
398 |
msgid "This file is invalid."
|
399 |
msgstr "許可されたファイルではありません。"
|
400 |
|
401 |
+
#: classes/validation-rules/class.filetype.php:62
|
402 |
msgid "Permitted Extension"
|
403 |
msgstr "拡張子制限"
|
404 |
|
405 |
+
#: classes/validation-rules/class.filetype.php:63
|
406 |
msgid "Example:jpg or jpg,txt,…"
|
407 |
msgstr "例:jpg もしくは jpg,txt…"
|
408 |
|
410 |
msgid "Please enter with a Japanese Hiragana."
|
411 |
msgstr "ひらがなで入力してください。"
|
412 |
|
413 |
+
#: classes/validation-rules/class.hiragana.php:49
|
414 |
msgid "Japanese Hiragana"
|
415 |
msgstr "ひらがな"
|
416 |
|
422 |
msgid "Please enter with a Japanese Katakana."
|
423 |
msgstr "カタカナで入力してください。"
|
424 |
|
425 |
+
#: classes/validation-rules/class.katakana.php:49
|
426 |
msgid "Japanese Katakana"
|
427 |
msgstr "カタカナ"
|
428 |
|
430 |
msgid "This is not the format of a mail address."
|
431 |
msgstr "メールアドレスの形式ではありません。"
|
432 |
|
433 |
+
#: classes/validation-rules/class.mail.php:49
|
434 |
msgid "E-mail"
|
435 |
msgstr "メールアドレス"
|
436 |
|
438 |
msgid "The number of characters is a few."
|
439 |
msgstr "文字数が足りません。"
|
440 |
|
441 |
+
#: classes/validation-rules/class.minlength.php:58
|
442 |
msgid "The number of the minimum characters"
|
443 |
msgstr "最小文字数"
|
444 |
|
447 |
msgid "Please enter."
|
448 |
msgstr "未入力です。"
|
449 |
|
450 |
+
#: classes/validation-rules/class.noempty.php:47
|
451 |
msgid "No empty"
|
452 |
msgstr "必須項目"
|
453 |
|
455 |
msgid "Please enter with a half-width number."
|
456 |
msgstr "半角数字で入力してください。"
|
457 |
|
458 |
+
#: classes/validation-rules/class.numeric.php:49
|
459 |
msgid "Numeric"
|
460 |
msgstr "半角数字"
|
461 |
|
463 |
msgid "This is required."
|
464 |
msgstr "必須項目です。"
|
465 |
|
466 |
+
#: classes/validation-rules/class.required.php:49
|
467 |
msgid "No empty( with checkbox )"
|
468 |
msgstr "必須項目(チェックボックス)"
|
469 |
|
475 |
msgid "This is not the format of a url."
|
476 |
msgstr "URLの形式ではありません。"
|
477 |
|
478 |
+
#: classes/validation-rules/class.url.php:49
|
479 |
msgid "URL"
|
480 |
msgstr "URL"
|
481 |
|
483 |
msgid "This is not the format of a zip code."
|
484 |
msgstr "郵便番号の形式ではありません。"
|
485 |
|
486 |
+
#: mw-wp-form.php:165 mw-wp-form.php:166 templates/chart/index.php:4
|
487 |
+
msgid "Chart"
|
488 |
+
msgstr "グラフ"
|
489 |
|
490 |
+
#: mw-wp-form.php:194 mw-wp-form.php:195
|
491 |
+
#: templates/stores-inquiry-data-form-list/index.php:2
|
492 |
+
msgid "Inquiry data"
|
493 |
+
msgstr "問い合わせデータ"
|
494 |
|
495 |
+
#: mw-wp-form.php:290
|
496 |
+
msgid "Add New Form"
|
497 |
+
msgstr "フォームを追加"
|
498 |
|
499 |
+
#: mw-wp-form.php:291
|
500 |
+
msgid "Edit Form"
|
501 |
+
msgstr "フォームを編集"
|
502 |
|
503 |
+
#: mw-wp-form.php:292
|
504 |
+
msgid "New Form"
|
505 |
+
msgstr "新しいフォーム"
|
506 |
|
507 |
+
#: mw-wp-form.php:293
|
508 |
+
msgid "View Form"
|
509 |
+
msgstr "フォームを表示"
|
510 |
|
511 |
+
#: mw-wp-form.php:294
|
512 |
+
msgid "Search Forms"
|
513 |
+
msgstr "フォームを検索"
|
|
|
|
|
|
|
|
|
514 |
|
515 |
+
#: mw-wp-form.php:295
|
516 |
+
msgid "No Forms found"
|
517 |
+
msgstr "フォームがありません"
|
518 |
|
519 |
+
#: mw-wp-form.php:296
|
520 |
+
msgid "No Forms found in Trash"
|
521 |
+
msgstr "ゴミ箱にフォームはありません"
|
522 |
|
523 |
+
#: mw-wp-form.php:313
|
524 |
+
msgid "Edit "
|
525 |
+
msgstr "編集"
|
526 |
|
527 |
+
#: mw-wp-form.php:314
|
528 |
+
msgid "View"
|
529 |
+
msgstr "表示"
|
530 |
+
|
531 |
+
#: mw-wp-form.php:315
|
532 |
+
msgid "Search"
|
533 |
+
msgstr "検索"
|
534 |
+
|
535 |
+
#: mw-wp-form.php:316
|
536 |
+
msgid "No data found"
|
537 |
+
msgstr "データがありません"
|
538 |
+
|
539 |
+
#: mw-wp-form.php:317
|
540 |
+
msgid "No data found in Trash"
|
541 |
+
msgstr "ゴミ箱にデータはありません"
|
542 |
+
|
543 |
+
#: templates/admin/add-ons.php:2
|
544 |
msgid "You can use more easy and useful to the MW WP Form in add-on!"
|
545 |
msgstr "アドオンで MW WP Form をもっと簡単・便利に使うことができます!"
|
546 |
|
547 |
+
#: templates/admin/add-ons.php:3
|
548 |
msgid "View Add-ons"
|
549 |
msgstr "アドオンを見る"
|
550 |
|
551 |
+
#: templates/admin/admin-mail-options.php:2 templates/admin/mail-options.php:2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
msgid "{key} is converted form data."
|
553 |
msgstr "{キー}でそのフォーム項目に変換されます。"
|
554 |
|
555 |
+
#: templates/admin/admin-mail-options.php:4 templates/admin/mail-options.php:4
|
556 |
msgid "It is automatically converted to Tracking number when you input {%s}."
|
557 |
msgstr "{%s} と入力すると問い合わせ番号に自動的に変換されます。"
|
558 |
|
559 |
+
#: templates/admin/admin-mail-options.php:9
|
560 |
+
msgid ""
|
561 |
+
"If Admin Email Options is a blank, Automatic Replay Email Options is used as "
|
562 |
+
"Admin Email Options."
|
563 |
+
msgstr ""
|
564 |
+
"管理者宛メール設定が空のときは自動返信メール設定に管理者宛メール設定が使用さ"
|
565 |
+
"れます。"
|
566 |
+
|
567 |
+
#: templates/admin/admin-mail-options.php:12
|
568 |
+
msgid "To ( E-mail address )"
|
569 |
+
msgstr "送信先(E-mailアドレス)"
|
570 |
+
|
571 |
+
#: templates/admin/admin-mail-options.php:14
|
572 |
+
#: templates/admin/admin-mail-options.php:31
|
573 |
+
#: templates/admin/admin-mail-options.php:36
|
574 |
+
#: templates/admin/mail-options.php:15 templates/admin/mail-options.php:20
|
575 |
+
msgid "If empty:"
|
576 |
+
msgstr "未入力の場合:"
|
577 |
+
|
578 |
+
#: templates/admin/admin-mail-options.php:17
|
579 |
+
msgid "CC ( E-mail address )"
|
580 |
+
msgstr "CC(E-mailアドレス)"
|
581 |
+
|
582 |
+
#: templates/admin/admin-mail-options.php:21
|
583 |
+
msgid "BCC ( E-mail address )"
|
584 |
+
msgstr "BCC(E-mailアドレス)"
|
585 |
+
|
586 |
+
#: templates/admin/admin-mail-options.php:25
|
587 |
+
#: templates/admin/mail-options.php:9
|
588 |
msgid "Subject"
|
589 |
msgstr "件名"
|
590 |
|
591 |
+
#: templates/admin/admin-mail-options.php:29
|
592 |
+
#: templates/admin/mail-options.php:13
|
593 |
msgid "Sender"
|
594 |
msgstr "送信者"
|
595 |
|
596 |
+
#: templates/admin/admin-mail-options.php:34
|
597 |
+
#: templates/admin/mail-options.php:18
|
|
|
|
|
|
|
|
|
|
|
598 |
msgid "From ( E-mail address )"
|
599 |
msgstr "送信元(E-mailアドレス)"
|
600 |
|
601 |
+
#: templates/admin/admin-mail-options.php:39
|
602 |
+
#: templates/admin/mail-options.php:23
|
603 |
msgid "Content"
|
604 |
msgstr "本文"
|
605 |
|
606 |
+
#: templates/admin/form-key.php:4
|
607 |
+
msgid "Copy and Paste this shortcode."
|
608 |
+
msgstr "このショートコードをコピー&ペーストしてください。"
|
609 |
+
|
610 |
+
#: templates/admin/form-key.php:5
|
611 |
+
msgid "The key to use with hook is "
|
612 |
+
msgstr "各フックで使用する修飾子は"
|
613 |
+
|
614 |
+
#: templates/admin/mail-options.php:27
|
615 |
msgid "Automatic reply email"
|
616 |
msgstr "自動返信メール"
|
617 |
|
618 |
+
#: templates/admin/mail-options.php:29
|
619 |
msgid ""
|
620 |
"Input the key to use as transmission to automatic reply email. {} is "
|
621 |
"unnecessary."
|
622 |
msgstr "自動返信メールに使用する項目のキーを入力してください。{ }は不要です。"
|
623 |
|
624 |
+
#: templates/admin/settings.php:2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
msgid "Activate Query string of post"
|
626 |
msgstr "URL引数を有効にする"
|
627 |
|
628 |
+
#: templates/admin/settings.php:3
|
629 |
msgid ""
|
630 |
"If this field is active, MW WP Form get query string. And get post data from "
|
631 |
"query string \"post_id\". You can use $post's property in editor."
|
634 |
"とに投稿を取得します。その投稿($post) のプロパティを使用できるようになりま"
|
635 |
"す。"
|
636 |
|
637 |
+
#: templates/admin/settings.php:4
|
638 |
msgid "Example: {ID}, {post_title}, {post_meta} etc..."
|
639 |
msgstr "例:{ID}、{post_title}、{post_meta}など…"
|
640 |
|
641 |
+
#: templates/admin/settings.php:7
|
642 |
msgid "Saving inquiry data in database"
|
643 |
msgstr "問い合わせデータをデータベースに保存"
|
644 |
|
645 |
+
#: templates/admin/settings.php:10
|
646 |
msgid "Enable scrolling of screen transition."
|
647 |
msgstr "画面変遷時のスクロールを有効にする"
|
648 |
|
649 |
+
#: templates/admin/settings.php:14
|
650 |
msgid "Akismet Setting"
|
651 |
msgstr "Akismet 設定"
|
652 |
|
653 |
+
#: templates/admin/settings.php:29
|
654 |
msgid "Input the key to use Akismet."
|
655 |
msgstr "Akismetを使用する項目のキーを入力してください。"
|
656 |
|
657 |
+
#: templates/admin/style.php:3
|
658 |
msgid "Select Style"
|
659 |
msgstr "スタイルを選択"
|
660 |
|
661 |
+
#: templates/admin/tag-generator.php:6 templates/chart/index.php:25
|
662 |
msgid "Select this."
|
663 |
msgstr "選択してください"
|
664 |
|
665 |
+
#: templates/admin/tag-generator.php:7
|
666 |
msgid "Input fields"
|
667 |
msgstr "入力項目"
|
668 |
|
669 |
+
#: templates/admin/tag-generator.php:10
|
670 |
msgid "Select fields"
|
671 |
msgstr "選択項目"
|
672 |
|
673 |
+
#: templates/admin/tag-generator.php:13
|
674 |
msgid "Button fields"
|
675 |
msgstr "ボタン項目"
|
676 |
|
677 |
+
#: templates/admin/tag-generator.php:16
|
678 |
msgid "Error fields"
|
679 |
msgstr "エラー項目"
|
680 |
|
681 |
+
#: templates/admin/tag-generator.php:19
|
682 |
msgid "Other fields"
|
683 |
msgstr "その他の項目"
|
684 |
|
685 |
+
#: templates/admin/tag-generator.php:23
|
686 |
msgid "Add form tag"
|
687 |
msgstr "フォームタグを追加"
|
688 |
|
689 |
+
#: templates/admin/url.php:4
|
690 |
+
msgid "Input Page URL"
|
691 |
+
msgstr "入力画面URL"
|
692 |
+
|
693 |
+
#: templates/admin/url.php:10
|
694 |
+
msgid "Confirmation Page URL"
|
695 |
+
msgstr "確認画面URL"
|
696 |
+
|
697 |
+
#: templates/admin/url.php:16
|
698 |
+
msgid "Complete Page URL"
|
699 |
+
msgstr "完了画面URL"
|
700 |
+
|
701 |
+
#: templates/admin/url.php:22
|
702 |
+
msgid "Validation Error Page URL"
|
703 |
+
msgstr "エラー画面URL"
|
704 |
+
|
705 |
+
#: templates/admin/url.php:29
|
706 |
+
msgid ""
|
707 |
+
"This urls are the redirection urls at the time of button press. When URL "
|
708 |
+
"setting is empty, The page redirect on the same page."
|
709 |
+
msgstr ""
|
710 |
+
"上記URLはボタン押下時のリダイレクトURLです。URLの設定が空のときは、同一ページ"
|
711 |
+
"上でリダイレクトします。"
|
712 |
+
|
713 |
+
#: templates/admin/url.php:30
|
714 |
+
msgid "When a URL doesn't begin http or https, %s is complemented."
|
715 |
+
msgstr "URLが http または https で始まっていない場合は %s が補完されます。"
|
716 |
+
|
717 |
+
#: templates/admin/validation-rule.php:1
|
718 |
+
msgid "Add Validation rule"
|
719 |
+
msgstr "バリデーションルールを追加"
|
720 |
+
|
721 |
+
#: templates/admin/validation-rule.php:9
|
722 |
+
msgid "The key which applies validation"
|
723 |
+
msgstr "バリデーションを適用する項目"
|
724 |
+
|
725 |
+
#: templates/chart/index.php:15
|
726 |
msgid "Add Chart"
|
727 |
msgstr "グラフを追加"
|
728 |
|
729 |
+
#: templates/chart/index.php:23
|
730 |
msgid "Item that create chart"
|
731 |
msgstr "グラフを作成する項目"
|
732 |
|
733 |
+
#: templates/chart/index.php:31
|
734 |
msgid "Chart type"
|
735 |
msgstr "グラフの種類"
|
736 |
|
737 |
+
#: templates/chart/index.php:35
|
738 |
msgid "Pie chart"
|
739 |
msgstr "円グラフ"
|
740 |
|
741 |
+
#: templates/chart/index.php:36
|
742 |
msgid "Bar chart"
|
743 |
msgstr "棒グラフ"
|
744 |
|
745 |
+
#: templates/chart/index.php:49
|
746 |
msgid ""
|
747 |
"Separator string (If the check box. If the separator attribute is not set to "
|
748 |
"\",\")"
|
749 |
msgstr ""
|
750 |
"区切り文字(チェックボックスの場合。separator 属性が未設定の場合は「,」)"
|
751 |
|
752 |
+
#: templates/chart/index.php:71
|
753 |
+
#: templates/stores-inquiry-data-form-list/index.php:10
|
754 |
msgid "The number of inquiries"
|
755 |
msgstr "問い合わせ件数"
|
756 |
|
757 |
+
#: templates/contact-data/returning-link.php:2
|
758 |
+
msgid "« Back to the list"
|
759 |
+
msgstr "« 一覧に戻る"
|
760 |
+
|
761 |
+
#: templates/contact-data-list/csv-button.php:2
|
762 |
msgid "CSV Download"
|
763 |
msgstr "CSVダウンロード"
|
764 |
|
765 |
+
#: templates/stores-inquiry-data-form-list/index.php:4
|
766 |
msgid ""
|
767 |
"You can see the inquiry data that are saved in the database by clicking on "
|
768 |
"the link below."
|
770 |
"リンクをクリックすることでデータベースに保存された問い合わせデータを見ること"
|
771 |
"ができます。"
|
772 |
|
773 |
+
#: templates/stores-inquiry-data-form-list/index.php:8
|
774 |
msgid "Form title"
|
775 |
msgstr "フォーム名"
|
776 |
|
777 |
+
#: templates/stores-inquiry-data-form-list/index.php:9
|
778 |
+
#: templates/stores-inquiry-data-form-list/index.php:18
|
779 |
msgid "Display Chart"
|
780 |
msgstr "グラフを表示"
|
781 |
|
782 |
+
#: templates/stores-inquiry-data-form-list/index.php:11
|
783 |
msgid "Updated date"
|
784 |
msgstr "更新日"
|
785 |
|
786 |
+
#: templates/stores-inquiry-data-form-list/index.php:12
|
787 |
msgid "Created date"
|
788 |
msgstr "作成日"
|
789 |
|
790 |
+
#: templates/stores-inquiry-data-form-list/index.php:19
|
791 |
msgid "cases"
|
792 |
msgstr "件"
|
793 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
794 |
#. Plugin Name of the plugin/theme
|
795 |
msgid "MW WP Form"
|
796 |
msgstr "MW WP Form"
|
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 2.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/mw-wp-form\n"
|
7 |
-
"POT-Creation-Date: 2015-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -14,76 +14,66 @@ msgstr ""
|
|
14 |
"Plural-Forms: nplurals=1; plural=0;\n"
|
15 |
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
"X-Poedit-Basepath: .\n"
|
17 |
-
"X-Generator: Poedit 1.7.
|
18 |
"X-Poedit-KeywordsList: __;_e\n"
|
19 |
"X-Poedit-SearchPath-0: ..\n"
|
20 |
|
21 |
-
#: classes/controllers/class.admin-list.php:
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
msgid "Form Key"
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: classes/controllers/class.admin.php:
|
27 |
msgid "Complete Message"
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: classes/controllers/class.admin.php:
|
31 |
msgid "URL Options"
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: classes/controllers/class.admin.php:
|
35 |
msgid "Validation Rule"
|
36 |
msgstr ""
|
37 |
|
38 |
-
#: classes/controllers/class.admin.php:
|
39 |
msgid "Add-ons"
|
40 |
msgstr ""
|
41 |
|
42 |
-
#: classes/controllers/class.admin.php:
|
43 |
msgid "Automatic Reply Email Options"
|
44 |
msgstr ""
|
45 |
|
46 |
-
#: classes/controllers/class.admin.php:
|
47 |
msgid "Admin Email Options"
|
48 |
msgstr ""
|
49 |
|
50 |
-
#: classes/controllers/class.admin.php:
|
51 |
msgid "settings"
|
52 |
msgstr ""
|
53 |
|
54 |
-
#: classes/controllers/class.admin.php:
|
55 |
msgid "Style setting"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: classes/controllers/class.
|
59 |
-
#: classes/controllers/class.chart.php:79 classes/views/class.chart.php:65
|
60 |
-
msgid "Chart"
|
61 |
-
msgstr ""
|
62 |
-
|
63 |
-
#: classes/controllers/class.contact-data-list.php:160
|
64 |
-
#: classes/controllers/class.contact-data-list.php:207
|
65 |
-
#: classes/controllers/class.contact-data-list.php:297
|
66 |
-
#: classes/views/class.contact-data.php:101
|
67 |
-
msgid "Response Status"
|
68 |
-
msgstr ""
|
69 |
-
|
70 |
-
#: classes/controllers/class.contact-data-list.php:187
|
71 |
-
#: classes/controllers/class.contact-data-list.php:210
|
72 |
-
#: classes/views/class.contact-data.php:113
|
73 |
-
msgid "Memo"
|
74 |
-
msgstr ""
|
75 |
-
|
76 |
-
#: classes/controllers/class.contact-data-list.php:296
|
77 |
msgid "Registed Date"
|
78 |
msgstr ""
|
79 |
|
80 |
-
#: classes/controllers/class.contact-data.php:
|
81 |
-
#: classes/
|
82 |
-
#:
|
83 |
-
msgid "
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: classes/controllers/class.contact-data.php:
|
87 |
msgid "Custom Fields"
|
88 |
msgstr ""
|
89 |
|
@@ -111,97 +101,97 @@ msgstr ""
|
|
111 |
msgid "Checkbox"
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: classes/form-fields/class.checkbox.php:
|
115 |
-
#: classes/form-fields/class.radio.php:
|
116 |
-
#: classes/form-fields/class.select.php:
|
117 |
msgid "Choices"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: classes/form-fields/class.checkbox.php:
|
121 |
#: classes/form-fields/class.error.php:78
|
122 |
-
#: classes/form-fields/class.radio.php:
|
123 |
-
#: classes/form-fields/class.select.php:
|
124 |
msgid "Input one line about one item."
|
125 |
msgstr ""
|
126 |
|
127 |
-
#: classes/form-fields/class.checkbox.php:
|
128 |
-
#: classes/form-fields/class.radio.php:
|
129 |
-
#: classes/form-fields/class.select.php:
|
130 |
msgid "Example: value1↵value2 or key1:value1↵key2:value2"
|
131 |
msgstr ""
|
132 |
|
133 |
-
#: classes/form-fields/class.checkbox.php:
|
134 |
-
#: classes/form-fields/class.radio.php:
|
135 |
-
#: classes/form-fields/class.select.php:
|
136 |
msgid "You can split the post value and display value by \":\". But display value is sent in e-mail."
|
137 |
msgstr ""
|
138 |
|
139 |
-
#: classes/form-fields/class.checkbox.php:
|
140 |
-
#: classes/form-fields/class.radio.php:
|
141 |
-
#: classes/form-fields/class.select.php:
|
142 |
msgid "When you want to use \":\", please enter \"::\"."
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: classes/form-fields/class.checkbox.php:
|
146 |
-
#: classes/form-fields/class.radio.php:
|
147 |
-
#: classes/form-fields/class.select.php:
|
148 |
msgid "Send value by e-mail"
|
149 |
msgstr ""
|
150 |
|
151 |
-
#: classes/form-fields/class.checkbox.php:
|
152 |
-
#: classes/form-fields/class.radio.php:
|
153 |
-
#: classes/form-fields/class.select.php:
|
154 |
msgid "Send post value when you split the post value and display value by \":\" in choices."
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: classes/form-fields/class.checkbox.php:
|
158 |
-
#: classes/form-fields/class.datepicker.php:
|
159 |
-
#: classes/form-fields/class.hidden.php:
|
160 |
-
#: classes/form-fields/class.password.php:
|
161 |
-
#: classes/form-fields/class.radio.php:
|
162 |
-
#: classes/form-fields/class.select.php:
|
163 |
-
#: classes/form-fields/class.text.php:
|
164 |
-
#: classes/form-fields/class.textarea.php:
|
165 |
msgid "Default value"
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: classes/form-fields/class.checkbox.php:
|
169 |
msgid "Separator string"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: classes/form-fields/class.checkbox.php:
|
173 |
-
#: classes/form-fields/class.radio.php:
|
174 |
msgid "Display method"
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: classes/form-fields/class.checkbox.php:
|
178 |
-
#: classes/form-fields/class.radio.php:
|
179 |
msgid "Arranged vertically."
|
180 |
msgstr ""
|
181 |
|
182 |
-
#: classes/form-fields/class.checkbox.php:
|
183 |
-
#: classes/form-fields/class.datepicker.php:
|
184 |
-
#: classes/form-fields/class.file.php:
|
185 |
-
#: classes/form-fields/class.image.php:
|
186 |
-
#: classes/form-fields/class.password.php:
|
187 |
-
#: classes/form-fields/class.radio.php:
|
188 |
-
#: classes/form-fields/class.select.php:
|
189 |
-
#: classes/form-fields/class.tel.php:
|
190 |
-
#: classes/form-fields/class.textarea.php:
|
191 |
-
#: classes/form-fields/class.zip.php:
|
192 |
msgid "Dsiplay error"
|
193 |
msgstr ""
|
194 |
|
195 |
-
#: classes/form-fields/class.checkbox.php:
|
196 |
-
#: classes/form-fields/class.datepicker.php:
|
197 |
-
#: classes/form-fields/class.file.php:
|
198 |
-
#: classes/form-fields/class.image.php:
|
199 |
-
#: classes/form-fields/class.password.php:
|
200 |
-
#: classes/form-fields/class.radio.php:
|
201 |
-
#: classes/form-fields/class.select.php:
|
202 |
-
#: classes/form-fields/class.tel.php:
|
203 |
-
#: classes/form-fields/class.textarea.php:
|
204 |
-
#: classes/form-fields/class.zip.php:
|
205 |
msgid "Don't display error."
|
206 |
msgstr ""
|
207 |
|
@@ -230,7 +220,7 @@ msgstr ""
|
|
230 |
msgid "File"
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: classes/form-fields/class.file.php:
|
234 |
msgid "Uploaded."
|
235 |
msgstr ""
|
236 |
|
@@ -238,11 +228,11 @@ msgstr ""
|
|
238 |
msgid "Hidden"
|
239 |
msgstr ""
|
240 |
|
241 |
-
#: classes/form-fields/class.hidden.php:
|
242 |
msgid "Display"
|
243 |
msgstr ""
|
244 |
|
245 |
-
#: classes/form-fields/class.hidden.php:
|
246 |
msgid "Display hidden value."
|
247 |
msgstr ""
|
248 |
|
@@ -284,16 +274,16 @@ msgid "Submit Button"
|
|
284 |
msgstr ""
|
285 |
|
286 |
#: classes/form-fields/class.tel.php:30
|
287 |
-
#: classes/validation-rules/class.tel.php:
|
288 |
msgid "Tel"
|
289 |
msgstr ""
|
290 |
|
291 |
-
#: classes/form-fields/class.tel.php:
|
292 |
-
#: classes/form-fields/class.zip.php:
|
293 |
msgid "Convert half alphanumeric"
|
294 |
msgstr ""
|
295 |
|
296 |
-
#: classes/form-fields/class.tel.php:
|
297 |
msgid "Don't Convert."
|
298 |
msgstr ""
|
299 |
|
@@ -301,7 +291,7 @@ msgstr ""
|
|
301 |
msgid "Text"
|
302 |
msgstr ""
|
303 |
|
304 |
-
#: classes/form-fields/class.text.php:
|
305 |
msgid "Convert."
|
306 |
msgstr ""
|
307 |
|
@@ -310,7 +300,7 @@ msgid "Textarea"
|
|
310 |
msgstr ""
|
311 |
|
312 |
#: classes/form-fields/class.zip.php:30
|
313 |
-
#: classes/validation-rules/class.zip.php:
|
314 |
msgid "Zip Code"
|
315 |
msgstr ""
|
316 |
|
@@ -318,22 +308,27 @@ msgstr ""
|
|
318 |
msgid "Uploaded from "
|
319 |
msgstr ""
|
320 |
|
321 |
-
#: classes/functions.php:
|
322 |
msgid "Tracking Number"
|
323 |
msgstr ""
|
324 |
|
325 |
-
#: classes/models/class.contact-data-setting.php:
|
326 |
msgid "Not supported"
|
327 |
msgstr ""
|
328 |
|
329 |
-
#: classes/models/class.contact-data-setting.php:
|
330 |
msgid "Reservation"
|
331 |
msgstr ""
|
332 |
|
333 |
-
#: classes/models/class.contact-data-setting.php:
|
334 |
msgid "Supported"
|
335 |
msgstr ""
|
336 |
|
|
|
|
|
|
|
|
|
|
|
337 |
#: classes/validation-rules/class.akismet.php:30
|
338 |
msgid "The contents which you input were judged with spam."
|
339 |
msgstr ""
|
@@ -342,7 +337,7 @@ msgstr ""
|
|
342 |
msgid "Please enter with a half-width alphabetic character."
|
343 |
msgstr ""
|
344 |
|
345 |
-
#: classes/validation-rules/class.alpha.php:
|
346 |
msgid "Alphabet"
|
347 |
msgstr ""
|
348 |
|
@@ -350,7 +345,7 @@ msgstr ""
|
|
350 |
msgid "Please enter with a half-width alphanumeric character."
|
351 |
msgstr ""
|
352 |
|
353 |
-
#: classes/validation-rules/class.alphanumeric.php:
|
354 |
msgid "Alphabet and Numeric"
|
355 |
msgstr ""
|
356 |
|
@@ -358,7 +353,7 @@ msgstr ""
|
|
358 |
msgid "The number of characters is invalid."
|
359 |
msgstr ""
|
360 |
|
361 |
-
#: classes/validation-rules/class.between.php:
|
362 |
msgid "The range of the number of characters"
|
363 |
msgstr ""
|
364 |
|
@@ -366,7 +361,7 @@ msgstr ""
|
|
366 |
msgid "This is not the format of a date."
|
367 |
msgstr ""
|
368 |
|
369 |
-
#: classes/validation-rules/class.date.php:
|
370 |
msgid "Date"
|
371 |
msgstr ""
|
372 |
|
@@ -374,7 +369,7 @@ msgstr ""
|
|
374 |
msgid "This is not in agreement."
|
375 |
msgstr ""
|
376 |
|
377 |
-
#: classes/validation-rules/class.eq.php:
|
378 |
msgid "The key at same value"
|
379 |
msgstr ""
|
380 |
|
@@ -382,11 +377,11 @@ msgstr ""
|
|
382 |
msgid "This file size is too big."
|
383 |
msgstr ""
|
384 |
|
385 |
-
#: classes/validation-rules/class.filesize.php:
|
386 |
msgid "Permitted file size"
|
387 |
msgstr ""
|
388 |
|
389 |
-
#: classes/validation-rules/class.filesize.php:
|
390 |
msgid "bytes"
|
391 |
msgstr ""
|
392 |
|
@@ -394,11 +389,11 @@ msgstr ""
|
|
394 |
msgid "This file is invalid."
|
395 |
msgstr ""
|
396 |
|
397 |
-
#: classes/validation-rules/class.filetype.php:
|
398 |
msgid "Permitted Extension"
|
399 |
msgstr ""
|
400 |
|
401 |
-
#: classes/validation-rules/class.filetype.php:
|
402 |
msgid "Example:jpg or jpg,txt,…"
|
403 |
msgstr ""
|
404 |
|
@@ -406,7 +401,7 @@ msgstr ""
|
|
406 |
msgid "Please enter with a Japanese Hiragana."
|
407 |
msgstr ""
|
408 |
|
409 |
-
#: classes/validation-rules/class.hiragana.php:
|
410 |
msgid "Japanese Hiragana"
|
411 |
msgstr ""
|
412 |
|
@@ -418,7 +413,7 @@ msgstr ""
|
|
418 |
msgid "Please enter with a Japanese Katakana."
|
419 |
msgstr ""
|
420 |
|
421 |
-
#: classes/validation-rules/class.katakana.php:
|
422 |
msgid "Japanese Katakana"
|
423 |
msgstr ""
|
424 |
|
@@ -426,7 +421,7 @@ msgstr ""
|
|
426 |
msgid "This is not the format of a mail address."
|
427 |
msgstr ""
|
428 |
|
429 |
-
#: classes/validation-rules/class.mail.php:
|
430 |
msgid "E-mail"
|
431 |
msgstr ""
|
432 |
|
@@ -434,7 +429,7 @@ msgstr ""
|
|
434 |
msgid "The number of characters is a few."
|
435 |
msgstr ""
|
436 |
|
437 |
-
#: classes/validation-rules/class.minlength.php:
|
438 |
msgid "The number of the minimum characters"
|
439 |
msgstr ""
|
440 |
|
@@ -443,7 +438,7 @@ msgstr ""
|
|
443 |
msgid "Please enter."
|
444 |
msgstr ""
|
445 |
|
446 |
-
#: classes/validation-rules/class.noempty.php:
|
447 |
msgid "No empty"
|
448 |
msgstr ""
|
449 |
|
@@ -451,7 +446,7 @@ msgstr ""
|
|
451 |
msgid "Please enter with a half-width number."
|
452 |
msgstr ""
|
453 |
|
454 |
-
#: classes/validation-rules/class.numeric.php:
|
455 |
msgid "Numeric"
|
456 |
msgstr ""
|
457 |
|
@@ -459,7 +454,7 @@ msgstr ""
|
|
459 |
msgid "This is required."
|
460 |
msgstr ""
|
461 |
|
462 |
-
#: classes/validation-rules/class.required.php:
|
463 |
msgid "No empty( with checkbox )"
|
464 |
msgstr ""
|
465 |
|
@@ -471,7 +466,7 @@ msgstr ""
|
|
471 |
msgid "This is not the format of a url."
|
472 |
msgstr ""
|
473 |
|
474 |
-
#: classes/validation-rules/class.url.php:
|
475 |
msgid "URL"
|
476 |
msgstr ""
|
477 |
|
@@ -479,283 +474,289 @@ msgstr ""
|
|
479 |
msgid "This is not the format of a zip code."
|
480 |
msgstr ""
|
481 |
|
482 |
-
#:
|
483 |
-
msgid "
|
484 |
msgstr ""
|
485 |
|
486 |
-
#:
|
487 |
-
|
|
|
488 |
msgstr ""
|
489 |
|
490 |
-
#:
|
491 |
-
msgid "
|
492 |
msgstr ""
|
493 |
|
494 |
-
#:
|
495 |
-
msgid "
|
496 |
msgstr ""
|
497 |
|
498 |
-
#:
|
499 |
-
msgid "
|
500 |
msgstr ""
|
501 |
|
502 |
-
#:
|
503 |
-
msgid "
|
504 |
msgstr ""
|
505 |
|
506 |
-
#:
|
507 |
-
msgid "
|
508 |
msgstr ""
|
509 |
|
510 |
-
#:
|
511 |
-
msgid "
|
512 |
msgstr ""
|
513 |
|
514 |
-
#:
|
515 |
-
msgid "
|
516 |
msgstr ""
|
517 |
|
518 |
-
#:
|
519 |
-
msgid "
|
520 |
msgstr ""
|
521 |
|
522 |
-
#:
|
523 |
-
msgid "
|
524 |
msgstr ""
|
525 |
|
526 |
-
#:
|
527 |
-
msgid "
|
528 |
msgstr ""
|
529 |
|
530 |
-
#:
|
531 |
-
msgid "
|
532 |
msgstr ""
|
533 |
|
534 |
-
#:
|
535 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
msgstr ""
|
537 |
|
538 |
-
#:
|
539 |
msgid "{key} is converted form data."
|
540 |
msgstr ""
|
541 |
|
542 |
-
#:
|
543 |
msgid "It is automatically converted to Tracking number when you input {%s}."
|
544 |
msgstr ""
|
545 |
|
546 |
-
#:
|
547 |
-
msgid "
|
548 |
msgstr ""
|
549 |
|
550 |
-
#:
|
551 |
-
msgid "
|
552 |
msgstr ""
|
553 |
|
554 |
-
#:
|
555 |
-
#:
|
556 |
-
#:
|
|
|
557 |
msgid "If empty:"
|
558 |
msgstr ""
|
559 |
|
560 |
-
#:
|
561 |
-
msgid "
|
562 |
msgstr ""
|
563 |
|
564 |
-
#:
|
565 |
-
msgid "
|
566 |
msgstr ""
|
567 |
|
568 |
-
#:
|
569 |
-
msgid "
|
570 |
msgstr ""
|
571 |
|
572 |
-
#:
|
573 |
-
|
|
|
574 |
msgstr ""
|
575 |
|
576 |
-
#:
|
577 |
-
|
|
|
578 |
msgstr ""
|
579 |
|
580 |
-
#:
|
581 |
-
|
|
|
582 |
msgstr ""
|
583 |
|
584 |
-
#:
|
585 |
-
msgid "
|
586 |
msgstr ""
|
587 |
|
588 |
-
#:
|
589 |
-
msgid "
|
|
|
|
|
|
|
|
|
590 |
msgstr ""
|
591 |
|
592 |
-
#:
|
|
|
|
|
|
|
|
|
593 |
msgid "Activate Query string of post"
|
594 |
msgstr ""
|
595 |
|
596 |
-
#:
|
597 |
msgid "If this field is active, MW WP Form get query string. And get post data from query string \"post_id\". You can use $post's property in editor."
|
598 |
msgstr ""
|
599 |
|
600 |
-
#:
|
601 |
msgid "Example: {ID}, {post_title}, {post_meta} etc..."
|
602 |
msgstr ""
|
603 |
|
604 |
-
#:
|
605 |
msgid "Saving inquiry data in database"
|
606 |
msgstr ""
|
607 |
|
608 |
-
#:
|
609 |
msgid "Enable scrolling of screen transition."
|
610 |
msgstr ""
|
611 |
|
612 |
-
#:
|
613 |
msgid "Akismet Setting"
|
614 |
msgstr ""
|
615 |
|
616 |
-
#:
|
617 |
msgid "Input the key to use Akismet."
|
618 |
msgstr ""
|
619 |
|
620 |
-
#:
|
621 |
msgid "Select Style"
|
622 |
msgstr ""
|
623 |
|
624 |
-
#:
|
625 |
msgid "Select this."
|
626 |
msgstr ""
|
627 |
|
628 |
-
#:
|
629 |
msgid "Input fields"
|
630 |
msgstr ""
|
631 |
|
632 |
-
#:
|
633 |
msgid "Select fields"
|
634 |
msgstr ""
|
635 |
|
636 |
-
#:
|
637 |
msgid "Button fields"
|
638 |
msgstr ""
|
639 |
|
640 |
-
#:
|
641 |
msgid "Error fields"
|
642 |
msgstr ""
|
643 |
|
644 |
-
#:
|
645 |
msgid "Other fields"
|
646 |
msgstr ""
|
647 |
|
648 |
-
#:
|
649 |
msgid "Add form tag"
|
650 |
msgstr ""
|
651 |
|
652 |
-
#:
|
653 |
-
msgid "
|
654 |
-
msgstr ""
|
655 |
-
|
656 |
-
#: classes/views/class.chart.php:84
|
657 |
-
msgid "Item that create chart"
|
658 |
-
msgstr ""
|
659 |
-
|
660 |
-
#: classes/views/class.chart.php:92
|
661 |
-
msgid "Chart type"
|
662 |
-
msgstr ""
|
663 |
-
|
664 |
-
#: classes/views/class.chart.php:96
|
665 |
-
msgid "Pie chart"
|
666 |
-
msgstr ""
|
667 |
-
|
668 |
-
#: classes/views/class.chart.php:97
|
669 |
-
msgid "Bar chart"
|
670 |
msgstr ""
|
671 |
|
672 |
-
#:
|
673 |
-
msgid "
|
674 |
msgstr ""
|
675 |
|
676 |
-
#:
|
677 |
-
msgid "
|
678 |
msgstr ""
|
679 |
|
680 |
-
#:
|
681 |
-
msgid "
|
682 |
msgstr ""
|
683 |
|
684 |
-
#:
|
685 |
-
msgid "
|
686 |
msgstr ""
|
687 |
|
688 |
-
#:
|
689 |
-
msgid "
|
690 |
msgstr ""
|
691 |
|
692 |
-
#:
|
693 |
-
|
694 |
-
msgid "Display Chart"
|
695 |
msgstr ""
|
696 |
|
697 |
-
#:
|
698 |
-
msgid "
|
699 |
msgstr ""
|
700 |
|
701 |
-
#:
|
702 |
-
msgid "
|
703 |
msgstr ""
|
704 |
|
705 |
-
#:
|
706 |
-
msgid "
|
707 |
msgstr ""
|
708 |
|
709 |
-
#:
|
710 |
-
msgid "
|
711 |
msgstr ""
|
712 |
|
713 |
-
#:
|
714 |
-
msgid "
|
715 |
msgstr ""
|
716 |
|
717 |
-
#:
|
718 |
-
msgid "
|
719 |
msgstr ""
|
720 |
|
721 |
-
#:
|
722 |
-
msgid "
|
723 |
msgstr ""
|
724 |
|
725 |
-
#:
|
726 |
-
|
|
|
727 |
msgstr ""
|
728 |
|
729 |
-
#:
|
730 |
-
msgid "
|
731 |
msgstr ""
|
732 |
|
733 |
-
#:
|
734 |
-
msgid "
|
735 |
msgstr ""
|
736 |
|
737 |
-
#:
|
738 |
-
msgid "
|
739 |
msgstr ""
|
740 |
|
741 |
-
#:
|
742 |
-
msgid "
|
743 |
msgstr ""
|
744 |
|
745 |
-
#:
|
746 |
-
|
|
|
747 |
msgstr ""
|
748 |
|
749 |
-
#:
|
750 |
-
msgid "
|
751 |
msgstr ""
|
752 |
|
753 |
-
#:
|
754 |
-
msgid "
|
755 |
msgstr ""
|
756 |
|
757 |
-
#:
|
758 |
-
msgid "
|
759 |
msgstr ""
|
760 |
#. Plugin Name of the plugin/theme
|
761 |
msgid "MW WP Form"
|
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 2.4.0\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/mw-wp-form\n"
|
7 |
+
"POT-Creation-Date: 2015-04-03 07:04:28+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
14 |
"Plural-Forms: nplurals=1; plural=0;\n"
|
15 |
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
"X-Poedit-Basepath: .\n"
|
17 |
+
"X-Generator: Poedit 1.7.5\n"
|
18 |
"X-Poedit-KeywordsList: __;_e\n"
|
19 |
"X-Poedit-SearchPath-0: ..\n"
|
20 |
|
21 |
+
#: classes/controllers/class.admin-list.php:34
|
22 |
+
msgid "Your contribution is needed for making this plugin better."
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#: classes/controllers/class.admin-list.php:36
|
26 |
+
msgid "Donate"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: classes/controllers/class.admin-list.php:66
|
30 |
+
#: classes/controllers/class.admin.php:89
|
31 |
msgid "Form Key"
|
32 |
msgstr ""
|
33 |
|
34 |
+
#: classes/controllers/class.admin.php:57
|
35 |
msgid "Complete Message"
|
36 |
msgstr ""
|
37 |
|
38 |
+
#: classes/controllers/class.admin.php:65
|
39 |
msgid "URL Options"
|
40 |
msgstr ""
|
41 |
|
42 |
+
#: classes/controllers/class.admin.php:73
|
43 |
msgid "Validation Rule"
|
44 |
msgstr ""
|
45 |
|
46 |
+
#: classes/controllers/class.admin.php:81
|
47 |
msgid "Add-ons"
|
48 |
msgstr ""
|
49 |
|
50 |
+
#: classes/controllers/class.admin.php:97
|
51 |
msgid "Automatic Reply Email Options"
|
52 |
msgstr ""
|
53 |
|
54 |
+
#: classes/controllers/class.admin.php:105
|
55 |
msgid "Admin Email Options"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: classes/controllers/class.admin.php:113
|
59 |
msgid "settings"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: classes/controllers/class.admin.php:122
|
63 |
msgid "Style setting"
|
64 |
msgstr ""
|
65 |
|
66 |
+
#: classes/controllers/class.contact-data-list.php:117
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
msgid "Registed Date"
|
68 |
msgstr ""
|
69 |
|
70 |
+
#: classes/controllers/class.contact-data-list.php:118
|
71 |
+
#: classes/models/class.csv.php:122 classes/models/class.csv.php:169
|
72 |
+
#: templates/contact-data/detail.php:32
|
73 |
+
msgid "Response Status"
|
74 |
msgstr ""
|
75 |
|
76 |
+
#: classes/controllers/class.contact-data.php:70
|
77 |
msgid "Custom Fields"
|
78 |
msgstr ""
|
79 |
|
101 |
msgid "Checkbox"
|
102 |
msgstr ""
|
103 |
|
104 |
+
#: classes/form-fields/class.checkbox.php:115
|
105 |
+
#: classes/form-fields/class.radio.php:111
|
106 |
+
#: classes/form-fields/class.select.php:109
|
107 |
msgid "Choices"
|
108 |
msgstr ""
|
109 |
|
110 |
+
#: classes/form-fields/class.checkbox.php:119
|
111 |
#: classes/form-fields/class.error.php:78
|
112 |
+
#: classes/form-fields/class.radio.php:115
|
113 |
+
#: classes/form-fields/class.select.php:113
|
114 |
msgid "Input one line about one item."
|
115 |
msgstr ""
|
116 |
|
117 |
+
#: classes/form-fields/class.checkbox.php:120
|
118 |
+
#: classes/form-fields/class.radio.php:116
|
119 |
+
#: classes/form-fields/class.select.php:114
|
120 |
msgid "Example: value1↵value2 or key1:value1↵key2:value2"
|
121 |
msgstr ""
|
122 |
|
123 |
+
#: classes/form-fields/class.checkbox.php:121
|
124 |
+
#: classes/form-fields/class.radio.php:117
|
125 |
+
#: classes/form-fields/class.select.php:115
|
126 |
msgid "You can split the post value and display value by \":\". But display value is sent in e-mail."
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: classes/form-fields/class.checkbox.php:122
|
130 |
+
#: classes/form-fields/class.radio.php:118
|
131 |
+
#: classes/form-fields/class.select.php:116
|
132 |
msgid "When you want to use \":\", please enter \"::\"."
|
133 |
msgstr ""
|
134 |
|
135 |
+
#: classes/form-fields/class.checkbox.php:126
|
136 |
+
#: classes/form-fields/class.radio.php:122
|
137 |
+
#: classes/form-fields/class.select.php:120
|
138 |
msgid "Send value by e-mail"
|
139 |
msgstr ""
|
140 |
|
141 |
+
#: classes/form-fields/class.checkbox.php:129
|
142 |
+
#: classes/form-fields/class.radio.php:125
|
143 |
+
#: classes/form-fields/class.select.php:123
|
144 |
msgid "Send post value when you split the post value and display value by \":\" in choices."
|
145 |
msgstr ""
|
146 |
|
147 |
+
#: classes/form-fields/class.checkbox.php:132
|
148 |
+
#: classes/form-fields/class.datepicker.php:136
|
149 |
+
#: classes/form-fields/class.hidden.php:82
|
150 |
+
#: classes/form-fields/class.password.php:112
|
151 |
+
#: classes/form-fields/class.radio.php:128
|
152 |
+
#: classes/form-fields/class.select.php:126
|
153 |
+
#: classes/form-fields/class.text.php:119
|
154 |
+
#: classes/form-fields/class.textarea.php:114
|
155 |
msgid "Default value"
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: classes/form-fields/class.checkbox.php:137
|
159 |
msgid "Separator string"
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: classes/form-fields/class.checkbox.php:142
|
163 |
+
#: classes/form-fields/class.radio.php:133
|
164 |
msgid "Display method"
|
165 |
msgstr ""
|
166 |
|
167 |
+
#: classes/form-fields/class.checkbox.php:144
|
168 |
+
#: classes/form-fields/class.radio.php:135
|
169 |
msgid "Arranged vertically."
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: classes/form-fields/class.checkbox.php:147
|
173 |
+
#: classes/form-fields/class.datepicker.php:141
|
174 |
+
#: classes/form-fields/class.file.php:115
|
175 |
+
#: classes/form-fields/class.image.php:119
|
176 |
+
#: classes/form-fields/class.password.php:122
|
177 |
+
#: classes/form-fields/class.radio.php:138
|
178 |
+
#: classes/form-fields/class.select.php:131
|
179 |
+
#: classes/form-fields/class.tel.php:102 classes/form-fields/class.text.php:129
|
180 |
+
#: classes/form-fields/class.textarea.php:124
|
181 |
+
#: classes/form-fields/class.zip.php:101
|
182 |
msgid "Dsiplay error"
|
183 |
msgstr ""
|
184 |
|
185 |
+
#: classes/form-fields/class.checkbox.php:149
|
186 |
+
#: classes/form-fields/class.datepicker.php:143
|
187 |
+
#: classes/form-fields/class.file.php:117
|
188 |
+
#: classes/form-fields/class.image.php:121
|
189 |
+
#: classes/form-fields/class.password.php:124
|
190 |
+
#: classes/form-fields/class.radio.php:140
|
191 |
+
#: classes/form-fields/class.select.php:133
|
192 |
+
#: classes/form-fields/class.tel.php:104 classes/form-fields/class.text.php:131
|
193 |
+
#: classes/form-fields/class.textarea.php:126
|
194 |
+
#: classes/form-fields/class.zip.php:103
|
195 |
msgid "Don't display error."
|
196 |
msgstr ""
|
197 |
|
220 |
msgid "File"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: classes/form-fields/class.file.php:68 classes/form-fields/class.file.php:90
|
224 |
msgid "Uploaded."
|
225 |
msgstr ""
|
226 |
|
228 |
msgid "Hidden"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: classes/form-fields/class.hidden.php:87
|
232 |
msgid "Display"
|
233 |
msgstr ""
|
234 |
|
235 |
+
#: classes/form-fields/class.hidden.php:89
|
236 |
msgid "Display hidden value."
|
237 |
msgstr ""
|
238 |
|
274 |
msgstr ""
|
275 |
|
276 |
#: classes/form-fields/class.tel.php:30
|
277 |
+
#: classes/validation-rules/class.tel.php:56
|
278 |
msgid "Tel"
|
279 |
msgstr ""
|
280 |
|
281 |
+
#: classes/form-fields/class.tel.php:107 classes/form-fields/class.text.php:134
|
282 |
+
#: classes/form-fields/class.zip.php:106
|
283 |
msgid "Convert half alphanumeric"
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: classes/form-fields/class.tel.php:109 classes/form-fields/class.zip.php:108
|
287 |
msgid "Don't Convert."
|
288 |
msgstr ""
|
289 |
|
291 |
msgid "Text"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: classes/form-fields/class.text.php:136
|
295 |
msgid "Convert."
|
296 |
msgstr ""
|
297 |
|
300 |
msgstr ""
|
301 |
|
302 |
#: classes/form-fields/class.zip.php:30
|
303 |
+
#: classes/validation-rules/class.zip.php:49
|
304 |
msgid "Zip Code"
|
305 |
msgstr ""
|
306 |
|
308 |
msgid "Uploaded from "
|
309 |
msgstr ""
|
310 |
|
311 |
+
#: classes/functions.php:291
|
312 |
msgid "Tracking Number"
|
313 |
msgstr ""
|
314 |
|
315 |
+
#: classes/models/class.contact-data-setting.php:60
|
316 |
msgid "Not supported"
|
317 |
msgstr ""
|
318 |
|
319 |
+
#: classes/models/class.contact-data-setting.php:61
|
320 |
msgid "Reservation"
|
321 |
msgstr ""
|
322 |
|
323 |
+
#: classes/models/class.contact-data-setting.php:62
|
324 |
msgid "Supported"
|
325 |
msgstr ""
|
326 |
|
327 |
+
#: classes/models/class.csv.php:148 classes/models/class.csv.php:172
|
328 |
+
#: templates/contact-data/detail.php:44
|
329 |
+
msgid "Memo"
|
330 |
+
msgstr ""
|
331 |
+
|
332 |
#: classes/validation-rules/class.akismet.php:30
|
333 |
msgid "The contents which you input were judged with spam."
|
334 |
msgstr ""
|
337 |
msgid "Please enter with a half-width alphabetic character."
|
338 |
msgstr ""
|
339 |
|
340 |
+
#: classes/validation-rules/class.alpha.php:49
|
341 |
msgid "Alphabet"
|
342 |
msgstr ""
|
343 |
|
345 |
msgid "Please enter with a half-width alphanumeric character."
|
346 |
msgstr ""
|
347 |
|
348 |
+
#: classes/validation-rules/class.alphanumeric.php:49
|
349 |
msgid "Alphabet and Numeric"
|
350 |
msgstr ""
|
351 |
|
353 |
msgid "The number of characters is invalid."
|
354 |
msgstr ""
|
355 |
|
356 |
+
#: classes/validation-rules/class.between.php:77
|
357 |
msgid "The range of the number of characters"
|
358 |
msgstr ""
|
359 |
|
361 |
msgid "This is not the format of a date."
|
362 |
msgstr ""
|
363 |
|
364 |
+
#: classes/validation-rules/class.date.php:60
|
365 |
msgid "Date"
|
366 |
msgstr ""
|
367 |
|
369 |
msgid "This is not in agreement."
|
370 |
msgstr ""
|
371 |
|
372 |
+
#: classes/validation-rules/class.eq.php:57
|
373 |
msgid "The key at same value"
|
374 |
msgstr ""
|
375 |
|
377 |
msgid "This file size is too big."
|
378 |
msgstr ""
|
379 |
|
380 |
+
#: classes/validation-rules/class.filesize.php:59
|
381 |
msgid "Permitted file size"
|
382 |
msgstr ""
|
383 |
|
384 |
+
#: classes/validation-rules/class.filesize.php:60
|
385 |
msgid "bytes"
|
386 |
msgstr ""
|
387 |
|
389 |
msgid "This file is invalid."
|
390 |
msgstr ""
|
391 |
|
392 |
+
#: classes/validation-rules/class.filetype.php:62
|
393 |
msgid "Permitted Extension"
|
394 |
msgstr ""
|
395 |
|
396 |
+
#: classes/validation-rules/class.filetype.php:63
|
397 |
msgid "Example:jpg or jpg,txt,…"
|
398 |
msgstr ""
|
399 |
|
401 |
msgid "Please enter with a Japanese Hiragana."
|
402 |
msgstr ""
|
403 |
|
404 |
+
#: classes/validation-rules/class.hiragana.php:49
|
405 |
msgid "Japanese Hiragana"
|
406 |
msgstr ""
|
407 |
|
413 |
msgid "Please enter with a Japanese Katakana."
|
414 |
msgstr ""
|
415 |
|
416 |
+
#: classes/validation-rules/class.katakana.php:49
|
417 |
msgid "Japanese Katakana"
|
418 |
msgstr ""
|
419 |
|
421 |
msgid "This is not the format of a mail address."
|
422 |
msgstr ""
|
423 |
|
424 |
+
#: classes/validation-rules/class.mail.php:49
|
425 |
msgid "E-mail"
|
426 |
msgstr ""
|
427 |
|
429 |
msgid "The number of characters is a few."
|
430 |
msgstr ""
|
431 |
|
432 |
+
#: classes/validation-rules/class.minlength.php:58
|
433 |
msgid "The number of the minimum characters"
|
434 |
msgstr ""
|
435 |
|
438 |
msgid "Please enter."
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: classes/validation-rules/class.noempty.php:47
|
442 |
msgid "No empty"
|
443 |
msgstr ""
|
444 |
|
446 |
msgid "Please enter with a half-width number."
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: classes/validation-rules/class.numeric.php:49
|
450 |
msgid "Numeric"
|
451 |
msgstr ""
|
452 |
|
454 |
msgid "This is required."
|
455 |
msgstr ""
|
456 |
|
457 |
+
#: classes/validation-rules/class.required.php:49
|
458 |
msgid "No empty( with checkbox )"
|
459 |
msgstr ""
|
460 |
|
466 |
msgid "This is not the format of a url."
|
467 |
msgstr ""
|
468 |
|
469 |
+
#: classes/validation-rules/class.url.php:49
|
470 |
msgid "URL"
|
471 |
msgstr ""
|
472 |
|
474 |
msgid "This is not the format of a zip code."
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: mw-wp-form.php:165 mw-wp-form.php:166 templates/chart/index.php:4
|
478 |
+
msgid "Chart"
|
479 |
msgstr ""
|
480 |
|
481 |
+
#: mw-wp-form.php:194 mw-wp-form.php:195
|
482 |
+
#: templates/stores-inquiry-data-form-list/index.php:2
|
483 |
+
msgid "Inquiry data"
|
484 |
msgstr ""
|
485 |
|
486 |
+
#: mw-wp-form.php:290
|
487 |
+
msgid "Add New Form"
|
488 |
msgstr ""
|
489 |
|
490 |
+
#: mw-wp-form.php:291
|
491 |
+
msgid "Edit Form"
|
492 |
msgstr ""
|
493 |
|
494 |
+
#: mw-wp-form.php:292
|
495 |
+
msgid "New Form"
|
496 |
msgstr ""
|
497 |
|
498 |
+
#: mw-wp-form.php:293
|
499 |
+
msgid "View Form"
|
500 |
msgstr ""
|
501 |
|
502 |
+
#: mw-wp-form.php:294
|
503 |
+
msgid "Search Forms"
|
504 |
msgstr ""
|
505 |
|
506 |
+
#: mw-wp-form.php:295
|
507 |
+
msgid "No Forms found"
|
508 |
msgstr ""
|
509 |
|
510 |
+
#: mw-wp-form.php:296
|
511 |
+
msgid "No Forms found in Trash"
|
512 |
msgstr ""
|
513 |
|
514 |
+
#: mw-wp-form.php:313
|
515 |
+
msgid "Edit "
|
516 |
msgstr ""
|
517 |
|
518 |
+
#: mw-wp-form.php:314
|
519 |
+
msgid "View"
|
520 |
msgstr ""
|
521 |
|
522 |
+
#: mw-wp-form.php:315
|
523 |
+
msgid "Search"
|
524 |
msgstr ""
|
525 |
|
526 |
+
#: mw-wp-form.php:316
|
527 |
+
msgid "No data found"
|
528 |
msgstr ""
|
529 |
|
530 |
+
#: mw-wp-form.php:317
|
531 |
+
msgid "No data found in Trash"
|
532 |
+
msgstr ""
|
533 |
+
|
534 |
+
#: templates/admin/add-ons.php:2
|
535 |
+
msgid "You can use more easy and useful to the MW WP Form in add-on!"
|
536 |
+
msgstr ""
|
537 |
+
|
538 |
+
#: templates/admin/add-ons.php:3
|
539 |
+
msgid "View Add-ons"
|
540 |
msgstr ""
|
541 |
|
542 |
+
#: templates/admin/admin-mail-options.php:2 templates/admin/mail-options.php:2
|
543 |
msgid "{key} is converted form data."
|
544 |
msgstr ""
|
545 |
|
546 |
+
#: templates/admin/admin-mail-options.php:4 templates/admin/mail-options.php:4
|
547 |
msgid "It is automatically converted to Tracking number when you input {%s}."
|
548 |
msgstr ""
|
549 |
|
550 |
+
#: templates/admin/admin-mail-options.php:9
|
551 |
+
msgid "If Admin Email Options is a blank, Automatic Replay Email Options is used as Admin Email Options."
|
552 |
msgstr ""
|
553 |
|
554 |
+
#: templates/admin/admin-mail-options.php:12
|
555 |
+
msgid "To ( E-mail address )"
|
556 |
msgstr ""
|
557 |
|
558 |
+
#: templates/admin/admin-mail-options.php:14
|
559 |
+
#: templates/admin/admin-mail-options.php:31
|
560 |
+
#: templates/admin/admin-mail-options.php:36
|
561 |
+
#: templates/admin/mail-options.php:15 templates/admin/mail-options.php:20
|
562 |
msgid "If empty:"
|
563 |
msgstr ""
|
564 |
|
565 |
+
#: templates/admin/admin-mail-options.php:17
|
566 |
+
msgid "CC ( E-mail address )"
|
567 |
msgstr ""
|
568 |
|
569 |
+
#: templates/admin/admin-mail-options.php:21
|
570 |
+
msgid "BCC ( E-mail address )"
|
571 |
msgstr ""
|
572 |
|
573 |
+
#: templates/admin/admin-mail-options.php:25 templates/admin/mail-options.php:9
|
574 |
+
msgid "Subject"
|
575 |
msgstr ""
|
576 |
|
577 |
+
#: templates/admin/admin-mail-options.php:29
|
578 |
+
#: templates/admin/mail-options.php:13
|
579 |
+
msgid "Sender"
|
580 |
msgstr ""
|
581 |
|
582 |
+
#: templates/admin/admin-mail-options.php:34
|
583 |
+
#: templates/admin/mail-options.php:18
|
584 |
+
msgid "From ( E-mail address )"
|
585 |
msgstr ""
|
586 |
|
587 |
+
#: templates/admin/admin-mail-options.php:39
|
588 |
+
#: templates/admin/mail-options.php:23
|
589 |
+
msgid "Content"
|
590 |
msgstr ""
|
591 |
|
592 |
+
#: templates/admin/form-key.php:4
|
593 |
+
msgid "Copy and Paste this shortcode."
|
594 |
msgstr ""
|
595 |
|
596 |
+
#: templates/admin/form-key.php:5
|
597 |
+
msgid "The key to use with hook is "
|
598 |
+
msgstr ""
|
599 |
+
|
600 |
+
#: templates/admin/mail-options.php:27
|
601 |
+
msgid "Automatic reply email"
|
602 |
msgstr ""
|
603 |
|
604 |
+
#: templates/admin/mail-options.php:29
|
605 |
+
msgid "Input the key to use as transmission to automatic reply email. {} is unnecessary."
|
606 |
+
msgstr ""
|
607 |
+
|
608 |
+
#: templates/admin/settings.php:2
|
609 |
msgid "Activate Query string of post"
|
610 |
msgstr ""
|
611 |
|
612 |
+
#: templates/admin/settings.php:3
|
613 |
msgid "If this field is active, MW WP Form get query string. And get post data from query string \"post_id\". You can use $post's property in editor."
|
614 |
msgstr ""
|
615 |
|
616 |
+
#: templates/admin/settings.php:4
|
617 |
msgid "Example: {ID}, {post_title}, {post_meta} etc..."
|
618 |
msgstr ""
|
619 |
|
620 |
+
#: templates/admin/settings.php:7
|
621 |
msgid "Saving inquiry data in database"
|
622 |
msgstr ""
|
623 |
|
624 |
+
#: templates/admin/settings.php:10
|
625 |
msgid "Enable scrolling of screen transition."
|
626 |
msgstr ""
|
627 |
|
628 |
+
#: templates/admin/settings.php:14
|
629 |
msgid "Akismet Setting"
|
630 |
msgstr ""
|
631 |
|
632 |
+
#: templates/admin/settings.php:29
|
633 |
msgid "Input the key to use Akismet."
|
634 |
msgstr ""
|
635 |
|
636 |
+
#: templates/admin/style.php:3
|
637 |
msgid "Select Style"
|
638 |
msgstr ""
|
639 |
|
640 |
+
#: templates/admin/tag-generator.php:6 templates/chart/index.php:25
|
641 |
msgid "Select this."
|
642 |
msgstr ""
|
643 |
|
644 |
+
#: templates/admin/tag-generator.php:7
|
645 |
msgid "Input fields"
|
646 |
msgstr ""
|
647 |
|
648 |
+
#: templates/admin/tag-generator.php:10
|
649 |
msgid "Select fields"
|
650 |
msgstr ""
|
651 |
|
652 |
+
#: templates/admin/tag-generator.php:13
|
653 |
msgid "Button fields"
|
654 |
msgstr ""
|
655 |
|
656 |
+
#: templates/admin/tag-generator.php:16
|
657 |
msgid "Error fields"
|
658 |
msgstr ""
|
659 |
|
660 |
+
#: templates/admin/tag-generator.php:19
|
661 |
msgid "Other fields"
|
662 |
msgstr ""
|
663 |
|
664 |
+
#: templates/admin/tag-generator.php:23
|
665 |
msgid "Add form tag"
|
666 |
msgstr ""
|
667 |
|
668 |
+
#: templates/admin/url.php:4
|
669 |
+
msgid "Input Page URL"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
670 |
msgstr ""
|
671 |
|
672 |
+
#: templates/admin/url.php:10
|
673 |
+
msgid "Confirmation Page URL"
|
674 |
msgstr ""
|
675 |
|
676 |
+
#: templates/admin/url.php:16
|
677 |
+
msgid "Complete Page URL"
|
678 |
msgstr ""
|
679 |
|
680 |
+
#: templates/admin/url.php:22
|
681 |
+
msgid "Validation Error Page URL"
|
682 |
msgstr ""
|
683 |
|
684 |
+
#: templates/admin/url.php:29
|
685 |
+
msgid "This urls are the redirection urls at the time of button press. When URL setting is empty, The page redirect on the same page."
|
686 |
msgstr ""
|
687 |
|
688 |
+
#: templates/admin/url.php:30
|
689 |
+
msgid "When a URL doesn't begin http or https, %s is complemented."
|
690 |
msgstr ""
|
691 |
|
692 |
+
#: templates/admin/validation-rule.php:1
|
693 |
+
msgid "Add Validation rule"
|
|
|
694 |
msgstr ""
|
695 |
|
696 |
+
#: templates/admin/validation-rule.php:9
|
697 |
+
msgid "The key which applies validation"
|
698 |
msgstr ""
|
699 |
|
700 |
+
#: templates/chart/index.php:15
|
701 |
+
msgid "Add Chart"
|
702 |
msgstr ""
|
703 |
|
704 |
+
#: templates/chart/index.php:23
|
705 |
+
msgid "Item that create chart"
|
706 |
msgstr ""
|
707 |
|
708 |
+
#: templates/chart/index.php:31
|
709 |
+
msgid "Chart type"
|
710 |
msgstr ""
|
711 |
|
712 |
+
#: templates/chart/index.php:35
|
713 |
+
msgid "Pie chart"
|
714 |
msgstr ""
|
715 |
|
716 |
+
#: templates/chart/index.php:36
|
717 |
+
msgid "Bar chart"
|
718 |
msgstr ""
|
719 |
|
720 |
+
#: templates/chart/index.php:49
|
721 |
+
msgid "Separator string (If the check box. If the separator attribute is not set to \",\")"
|
722 |
msgstr ""
|
723 |
|
724 |
+
#: templates/chart/index.php:71
|
725 |
+
#: templates/stores-inquiry-data-form-list/index.php:10
|
726 |
+
msgid "The number of inquiries"
|
727 |
msgstr ""
|
728 |
|
729 |
+
#: templates/contact-data/returning-link.php:2
|
730 |
+
msgid "« Back to the list"
|
731 |
msgstr ""
|
732 |
|
733 |
+
#: templates/contact-data-list/csv-button.php:2
|
734 |
+
msgid "CSV Download"
|
735 |
msgstr ""
|
736 |
|
737 |
+
#: templates/stores-inquiry-data-form-list/index.php:4
|
738 |
+
msgid "You can see the inquiry data that are saved in the database by clicking on the link below."
|
739 |
msgstr ""
|
740 |
|
741 |
+
#: templates/stores-inquiry-data-form-list/index.php:8
|
742 |
+
msgid "Form title"
|
743 |
msgstr ""
|
744 |
|
745 |
+
#: templates/stores-inquiry-data-form-list/index.php:9
|
746 |
+
#: templates/stores-inquiry-data-form-list/index.php:18
|
747 |
+
msgid "Display Chart"
|
748 |
msgstr ""
|
749 |
|
750 |
+
#: templates/stores-inquiry-data-form-list/index.php:11
|
751 |
+
msgid "Updated date"
|
752 |
msgstr ""
|
753 |
|
754 |
+
#: templates/stores-inquiry-data-form-list/index.php:12
|
755 |
+
msgid "Created date"
|
756 |
msgstr ""
|
757 |
|
758 |
+
#: templates/stores-inquiry-data-form-list/index.php:19
|
759 |
+
msgid "cases"
|
760 |
msgstr ""
|
761 |
#. Plugin Name of the plugin/theme
|
762 |
msgid "MW WP Form"
|
mw-wp-form.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Plugin Name: MW WP Form
|
4 |
* Plugin URI: http://plugins.2inc.org/mw-wp-form/
|
5 |
* Description: MW WP Form is shortcode base contact form plugin. This plugin have many feature. For example you can use many validation rules, contact data saving, and chart aggregation using saved contact data.
|
6 |
-
* Version: 2.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created : September 25, 2012
|
10 |
-
* Modified:
|
11 |
* Text Domain: mw-wp-form
|
12 |
* Domain Path: /languages/
|
13 |
* License: GPLv2
|
@@ -19,14 +19,12 @@ include_once( plugin_dir_path( __FILE__ ) . 'classes/config.php' );
|
|
19 |
class MW_WP_Form {
|
20 |
|
21 |
/**
|
22 |
-
* form_fields
|
23 |
* フォームフィールドの配列
|
24 |
* @var array
|
25 |
*/
|
26 |
protected $form_fields = array();
|
27 |
|
28 |
/**
|
29 |
-
* $validation_rules
|
30 |
* バリデーションルールの配列。順番を固定するために定義が必要
|
31 |
* @var array
|
32 |
*/
|
@@ -52,7 +50,6 @@ class MW_WP_Form {
|
|
52 |
);
|
53 |
|
54 |
/**
|
55 |
-
* $validation_rules_only_jp
|
56 |
* 日本語の時のみ使用できるバリデーションルール
|
57 |
* @var array
|
58 |
*/
|
@@ -62,7 +59,6 @@ class MW_WP_Form {
|
|
62 |
);
|
63 |
|
64 |
/**
|
65 |
-
* $form_fields_only_jp
|
66 |
* 日本語の時のみ使用できるフォーム項目
|
67 |
* @var array
|
68 |
*/
|
@@ -84,18 +80,20 @@ class MW_WP_Form {
|
|
84 |
}
|
85 |
|
86 |
/**
|
87 |
-
* load_initialize_files
|
88 |
* initialize に必要なファイルをロード
|
89 |
*/
|
90 |
public function load_initialize_files() {
|
91 |
$plugin_dir_path = plugin_dir_path( __FILE__ );
|
|
|
92 |
include_once( $plugin_dir_path . 'classes/controllers/class.admin.php' );
|
93 |
include_once( $plugin_dir_path . 'classes/controllers/class.admin-list.php' );
|
|
|
94 |
include_once( $plugin_dir_path . 'classes/controllers/class.contact-data.php' );
|
95 |
include_once( $plugin_dir_path . 'classes/controllers/class.contact-data-list.php' );
|
96 |
include_once( $plugin_dir_path . 'classes/controllers/class.chart.php' );
|
97 |
include_once( $plugin_dir_path . 'classes/controllers/class.main.php' );
|
98 |
include_once( $plugin_dir_path . 'classes/models/class.abstract-validation-rule.php' );
|
|
|
99 |
include_once( $plugin_dir_path . 'classes/models/class.admin.php' );
|
100 |
include_once( $plugin_dir_path . 'classes/models/class.akismet.php' );
|
101 |
include_once( $plugin_dir_path . 'classes/models/class.contact-data.php' );
|
@@ -112,13 +110,6 @@ class MW_WP_Form {
|
|
112 |
include_once( $plugin_dir_path . 'classes/services/class.exec-shortcode.php' );
|
113 |
include_once( $plugin_dir_path . 'classes/services/class.mail.php' );
|
114 |
include_once( $plugin_dir_path . 'classes/services/class.redirected.php' );
|
115 |
-
include_once( $plugin_dir_path . 'classes/views/class.view.php' );
|
116 |
-
include_once( $plugin_dir_path . 'classes/views/class.admin.php' );
|
117 |
-
include_once( $plugin_dir_path . 'classes/views/class.admin-list.php' );
|
118 |
-
include_once( $plugin_dir_path . 'classes/views/class.chart.php' );
|
119 |
-
include_once( $plugin_dir_path . 'classes/views/class.main.php' );
|
120 |
-
include_once( $plugin_dir_path . 'classes/views/class.contact-data.php' );
|
121 |
-
include_once( $plugin_dir_path . 'classes/views/class.contact-data-list.php' );
|
122 |
}
|
123 |
|
124 |
/**
|
@@ -132,47 +123,157 @@ class MW_WP_Form {
|
|
132 |
}
|
133 |
|
134 |
/**
|
135 |
-
* after_setup_theme
|
136 |
* 各管理画面の初期化、もしくはフロント画面の初期化
|
137 |
*/
|
138 |
public function after_setup_theme() {
|
139 |
// フォームフィールドの読み込み、インスタンス化
|
140 |
$this->instantiate_form_fields();
|
141 |
|
142 |
-
// バリデーションルールの読み込み、インスタンス化
|
143 |
-
$validation_rules = $this->get_validation_rules();
|
144 |
-
|
145 |
$plugin_dir_path = plugin_dir_path( __FILE__ );
|
146 |
-
if ( is_admin() ) {
|
147 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
$Controller = new MW_WP_Form_Admin_Controller( $validation_rules );
|
150 |
$Controller->initialize();
|
151 |
-
|
|
|
152 |
$Controller = new MW_WP_Form_Admin_List_Controller();
|
153 |
$Controller->initialize();
|
154 |
-
|
|
|
155 |
$Controller = new MW_WP_Form_Contact_Data_Controller();
|
156 |
$Controller->initialize();
|
157 |
-
|
|
|
158 |
$Controller = new MW_WP_Form_Contact_Data_List_Controller();
|
159 |
$Controller->initialize();
|
160 |
-
|
|
|
161 |
$Controller = new MW_WP_Form_Chart_Controller();
|
162 |
$Controller->initialize();
|
163 |
-
} else {
|
164 |
-
$Controller = new MW_WP_Form_Main_Controller( $validation_rules );
|
165 |
-
$Controller->initialize();
|
166 |
}
|
167 |
}
|
168 |
|
169 |
-
public function admin_enqueue_scripts() {
|
170 |
-
$url = plugins_url( MWF_Config::NAME );
|
171 |
-
wp_enqueue_style( MWF_Config::NAME . '-admin-common', $url . '/css/admin-common.css' );
|
172 |
-
}
|
173 |
-
|
174 |
/**
|
175 |
-
* register_post_type
|
176 |
* 管理画面(カスタム投稿タイプ)の設定
|
177 |
*/
|
178 |
public function register_post_type() {
|
@@ -225,14 +326,12 @@ class MW_WP_Form {
|
|
225 |
}
|
226 |
|
227 |
/**
|
228 |
-
* activation
|
229 |
* 有効化した時の処理
|
230 |
*/
|
231 |
public static function activation() {
|
232 |
}
|
233 |
|
234 |
/**
|
235 |
-
* uninstall
|
236 |
* アンインストールした時の処理
|
237 |
*/
|
238 |
public static function uninstall() {
|
@@ -267,7 +366,6 @@ class MW_WP_Form {
|
|
267 |
}
|
268 |
|
269 |
/**
|
270 |
-
* instantiate_form_fields
|
271 |
* フォームフィールドのインスタンス化。配列にはフックを通して格納する。
|
272 |
*/
|
273 |
protected function instantiate_form_fields() {
|
@@ -289,7 +387,8 @@ class MW_WP_Form {
|
|
289 |
}
|
290 |
|
291 |
/**
|
292 |
-
*
|
|
|
293 |
* @param string $filename ファイル名
|
294 |
* @return string クラス名
|
295 |
*/
|
@@ -301,8 +400,8 @@ class MW_WP_Form {
|
|
301 |
}
|
302 |
|
303 |
/**
|
304 |
-
* get_validation_rules
|
305 |
* バリデーションルールのインスタンス化。配列にはフックを通して格納する。
|
|
|
306 |
* @param string $key フォーム識別子
|
307 |
* @return $validation_rules バリデーションルールオブジェクトの配列
|
308 |
*/
|
@@ -332,7 +431,8 @@ class MW_WP_Form {
|
|
332 |
}
|
333 |
|
334 |
/**
|
335 |
-
*
|
|
|
336 |
* @param string $filename ファイル名
|
337 |
* @return string クラス名
|
338 |
*/
|
3 |
* Plugin Name: MW WP Form
|
4 |
* Plugin URI: http://plugins.2inc.org/mw-wp-form/
|
5 |
* Description: MW WP Form is shortcode base contact form plugin. This plugin have many feature. For example you can use many validation rules, contact data saving, and chart aggregation using saved contact data.
|
6 |
+
* Version: 2.4.0
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created : September 25, 2012
|
10 |
+
* Modified: April 3, 2015
|
11 |
* Text Domain: mw-wp-form
|
12 |
* Domain Path: /languages/
|
13 |
* License: GPLv2
|
19 |
class MW_WP_Form {
|
20 |
|
21 |
/**
|
|
|
22 |
* フォームフィールドの配列
|
23 |
* @var array
|
24 |
*/
|
25 |
protected $form_fields = array();
|
26 |
|
27 |
/**
|
|
|
28 |
* バリデーションルールの配列。順番を固定するために定義が必要
|
29 |
* @var array
|
30 |
*/
|
50 |
);
|
51 |
|
52 |
/**
|
|
|
53 |
* 日本語の時のみ使用できるバリデーションルール
|
54 |
* @var array
|
55 |
*/
|
59 |
);
|
60 |
|
61 |
/**
|
|
|
62 |
* 日本語の時のみ使用できるフォーム項目
|
63 |
* @var array
|
64 |
*/
|
80 |
}
|
81 |
|
82 |
/**
|
|
|
83 |
* initialize に必要なファイルをロード
|
84 |
*/
|
85 |
public function load_initialize_files() {
|
86 |
$plugin_dir_path = plugin_dir_path( __FILE__ );
|
87 |
+
include_once( $plugin_dir_path . 'classes/controllers/class.controller.php' );
|
88 |
include_once( $plugin_dir_path . 'classes/controllers/class.admin.php' );
|
89 |
include_once( $plugin_dir_path . 'classes/controllers/class.admin-list.php' );
|
90 |
+
include_once( $plugin_dir_path . 'classes/controllers/class.stores-inquiry-data-form-list.php' );
|
91 |
include_once( $plugin_dir_path . 'classes/controllers/class.contact-data.php' );
|
92 |
include_once( $plugin_dir_path . 'classes/controllers/class.contact-data-list.php' );
|
93 |
include_once( $plugin_dir_path . 'classes/controllers/class.chart.php' );
|
94 |
include_once( $plugin_dir_path . 'classes/controllers/class.main.php' );
|
95 |
include_once( $plugin_dir_path . 'classes/models/class.abstract-validation-rule.php' );
|
96 |
+
include_once( $plugin_dir_path . 'classes/models/class.csv.php' );
|
97 |
include_once( $plugin_dir_path . 'classes/models/class.admin.php' );
|
98 |
include_once( $plugin_dir_path . 'classes/models/class.akismet.php' );
|
99 |
include_once( $plugin_dir_path . 'classes/models/class.contact-data.php' );
|
110 |
include_once( $plugin_dir_path . 'classes/services/class.exec-shortcode.php' );
|
111 |
include_once( $plugin_dir_path . 'classes/services/class.mail.php' );
|
112 |
include_once( $plugin_dir_path . 'classes/services/class.redirected.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
|
115 |
/**
|
123 |
}
|
124 |
|
125 |
/**
|
|
|
126 |
* 各管理画面の初期化、もしくはフロント画面の初期化
|
127 |
*/
|
128 |
public function after_setup_theme() {
|
129 |
// フォームフィールドの読み込み、インスタンス化
|
130 |
$this->instantiate_form_fields();
|
131 |
|
|
|
|
|
|
|
132 |
$plugin_dir_path = plugin_dir_path( __FILE__ );
|
133 |
+
if ( current_user_can( MWF_Config::CAPABILITY ) && is_admin() ) {
|
134 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
135 |
+
add_action( 'admin_menu' , array( $this, 'admin_menu_for_chart' ) );
|
136 |
+
add_action( 'admin_menu' , array( $this, 'admin_menu_for_contact_data_list' ) );
|
137 |
+
add_action( 'admin_init' , array( $this, 'register_setting' ) );
|
138 |
+
add_action( 'current_screen' , array( $this, 'current_screen' ) );
|
139 |
+
} elseif ( !is_admin() ) {
|
140 |
+
$validation_rules = $this->get_validation_rules();
|
141 |
+
$Controller = new MW_WP_Form_Main_Controller( $validation_rules );
|
142 |
+
$Controller->initialize();
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* 共通CSSの読み込み
|
148 |
+
*/
|
149 |
+
public function admin_enqueue_scripts() {
|
150 |
+
$url = plugins_url( MWF_Config::NAME );
|
151 |
+
wp_enqueue_style( MWF_Config::NAME . '-admin-common', $url . '/css/admin-common.css' );
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* グラフページのメニューを追加
|
156 |
+
*/
|
157 |
+
public function admin_menu_for_chart() {
|
158 |
+
$contact_data_post_types = MW_WP_Form_Contact_Data_Setting::get_posts();
|
159 |
+
if ( empty( $contact_data_post_types ) ) {
|
160 |
+
return;
|
161 |
+
}
|
162 |
+
|
163 |
+
add_submenu_page(
|
164 |
+
'edit.php?post_type=' . MWF_Config::NAME,
|
165 |
+
esc_html__( 'Chart', MWF_Config::DOMAIN ),
|
166 |
+
esc_html__( 'Chart', MWF_Config::DOMAIN ),
|
167 |
+
MWF_Config::CAPABILITY,
|
168 |
+
MWF_Config::NAME . '-chart',
|
169 |
+
array( $this, 'display_chart' )
|
170 |
+
);
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* グラフページを表示
|
175 |
+
*/
|
176 |
+
public function display_chart() {
|
177 |
+
// ここでは画面の呼び出しだけ。
|
178 |
+
// JSの読み込みや画面の表示可否判定は current_screen() で行う(ここでは遅い)。
|
179 |
+
$Controller = new MW_WP_Form_Chart_Controller();
|
180 |
+
$Controller->index();
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* 問い合わせデータ閲覧ページのメニューを追加
|
185 |
+
*/
|
186 |
+
public function admin_menu_for_contact_data_list() {
|
187 |
+
$contact_data_post_types = MW_WP_Form_Contact_Data_Setting::get_posts();
|
188 |
+
if ( empty( $contact_data_post_types ) ) {
|
189 |
+
return;
|
190 |
+
}
|
191 |
+
|
192 |
+
add_submenu_page(
|
193 |
+
'edit.php?post_type=' . MWF_Config::NAME,
|
194 |
+
__( 'Inquiry data', MWF_Config::DOMAIN ),
|
195 |
+
__( 'Inquiry data', MWF_Config::DOMAIN ),
|
196 |
+
MWF_Config::CAPABILITY,
|
197 |
+
MWF_Config::NAME . '-save-data',
|
198 |
+
array( $this, 'display_stores_inquiry_data_form_list' )
|
199 |
+
);
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* 問い合わせデータ閲覧ページを表示
|
204 |
+
*/
|
205 |
+
public function display_stores_inquiry_data_form_list() {
|
206 |
+
$Controller = new MW_WP_Form_Stores_Inquiry_Data_Form_List_Controller();
|
207 |
+
$Controller->index();
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* グラフページ用の register_setting
|
212 |
+
*/
|
213 |
+
public function register_setting() {
|
214 |
+
$formkey = ( !empty( $_GET['formkey'] ) ) ? $_GET['formkey'] : '';
|
215 |
+
if ( !empty( $_POST[MWF_Config::NAME . '-formkey'] ) ) {
|
216 |
+
$formkey = $_POST[MWF_Config::NAME . '-formkey'];
|
217 |
+
}
|
218 |
+
if ( !empty( $formkey ) ) {
|
219 |
+
$option_group = MWF_Config::NAME . '-' . 'chart-group';
|
220 |
+
register_setting(
|
221 |
+
$option_group,
|
222 |
+
MWF_Config::NAME . '-chart-' . $formkey,
|
223 |
+
array( $this, 'sanitize' )
|
224 |
+
);
|
225 |
+
}
|
226 |
+
}
|
227 |
|
228 |
+
/**
|
229 |
+
* グラフページ設定データのサニタイズ
|
230 |
+
*
|
231 |
+
* @param array $input フォームから送信されたデータ
|
232 |
+
* @return array
|
233 |
+
*/
|
234 |
+
public function sanitize( $input ) {
|
235 |
+
$new_input = array();
|
236 |
+
if ( is_array( $input ) && isset( $input['chart'] ) && is_array( $input['chart'] ) ) {
|
237 |
+
foreach ( $input['chart'] as $key => $value ) {
|
238 |
+
if ( !empty( $value['target'] ) ) {
|
239 |
+
$new_input['chart'][$key] = $value;
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
return $new_input;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* 各画面のコントローラーの呼び出し
|
248 |
+
*
|
249 |
+
* @param WP_Screen $screen
|
250 |
+
*/
|
251 |
+
public function current_screen( $screen ) {
|
252 |
+
$contact_data_post_types = MW_WP_Form_Contact_Data_Setting::get_posts();
|
253 |
+
if ( $screen->id === MWF_Config::NAME ) {
|
254 |
+
$validation_rules = $this->get_validation_rules();
|
255 |
$Controller = new MW_WP_Form_Admin_Controller( $validation_rules );
|
256 |
$Controller->initialize();
|
257 |
+
}
|
258 |
+
elseif ( $screen->id === 'edit-' . MWF_Config::NAME ) {
|
259 |
$Controller = new MW_WP_Form_Admin_List_Controller();
|
260 |
$Controller->initialize();
|
261 |
+
}
|
262 |
+
elseif ( preg_match( '/^' . MWF_Config::DBDATA . '\d+$/', $screen->id ) ) {
|
263 |
$Controller = new MW_WP_Form_Contact_Data_Controller();
|
264 |
$Controller->initialize();
|
265 |
+
}
|
266 |
+
elseif ( preg_match( '/^edit-' . MWF_Config::DBDATA . '\d+$/', $screen->id ) ) {
|
267 |
$Controller = new MW_WP_Form_Contact_Data_List_Controller();
|
268 |
$Controller->initialize();
|
269 |
+
}
|
270 |
+
elseif ( $screen->id === MWF_Config::NAME . '_page_' . MWF_Config::NAME . '-chart' ) {
|
271 |
$Controller = new MW_WP_Form_Chart_Controller();
|
272 |
$Controller->initialize();
|
|
|
|
|
|
|
273 |
}
|
274 |
}
|
275 |
|
|
|
|
|
|
|
|
|
|
|
276 |
/**
|
|
|
277 |
* 管理画面(カスタム投稿タイプ)の設定
|
278 |
*/
|
279 |
public function register_post_type() {
|
326 |
}
|
327 |
|
328 |
/**
|
|
|
329 |
* 有効化した時の処理
|
330 |
*/
|
331 |
public static function activation() {
|
332 |
}
|
333 |
|
334 |
/**
|
|
|
335 |
* アンインストールした時の処理
|
336 |
*/
|
337 |
public static function uninstall() {
|
366 |
}
|
367 |
|
368 |
/**
|
|
|
369 |
* フォームフィールドのインスタンス化。配列にはフックを通して格納する。
|
370 |
*/
|
371 |
protected function instantiate_form_fields() {
|
387 |
}
|
388 |
|
389 |
/**
|
390 |
+
* フォーム項目クラスのファイル名からクラス名を取得
|
391 |
+
*
|
392 |
* @param string $filename ファイル名
|
393 |
* @return string クラス名
|
394 |
*/
|
400 |
}
|
401 |
|
402 |
/**
|
|
|
403 |
* バリデーションルールのインスタンス化。配列にはフックを通して格納する。
|
404 |
+
*
|
405 |
* @param string $key フォーム識別子
|
406 |
* @return $validation_rules バリデーションルールオブジェクトの配列
|
407 |
*/
|
431 |
}
|
432 |
|
433 |
/**
|
434 |
+
* バリデーションルールクラスのファイル名からクラス名を取得
|
435 |
+
*
|
436 |
* @param string $filename ファイル名
|
437 |
* @return string クラス名
|
438 |
*/
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.amazon.co.jp/registry/wishlist/39ANKRNSTNW40
|
|
4 |
Tags: plugin, form, confirm, preview, shortcode, mail, chart, graph, html, contact form, form creation, form creator, form manager, form builder, custom form
|
5 |
Requires at least: 3.7
|
6 |
Tested up to: 4.1.1
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -71,6 +71,21 @@ Do you have questions or issues with MW WP Form? Use these support channels appr
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
= 2.3.5 =
|
75 |
* Bugfix : Fixed a post_raw bug at select and radio.
|
76 |
|
4 |
Tags: plugin, form, confirm, preview, shortcode, mail, chart, graph, html, contact form, form creation, form creator, form manager, form builder, custom form
|
5 |
Requires at least: 3.7
|
6 |
Tested up to: 4.1.1
|
7 |
+
Stable tag: 2.4.0
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 2.4.0 =
|
75 |
+
* Refactoring
|
76 |
+
* Added : Add filter hook mwform_csv_encoding-mwf_xxx.
|
77 |
+
* Deleted : Delete some Deprecated hooks, methods.
|
78 |
+
* Bugfix : Fixed a csv bug.
|
79 |
+
* Deprecated: MW_WP_Form_Form::get_raw()
|
80 |
+
* Deprecated: MW_WP_Form_Form::get_raw_in_children()
|
81 |
+
* Deprecated: MW_WP_Form_Form::get_zip_value()
|
82 |
+
* Deprecated: MW_WP_Form_Form::get_tel_value()
|
83 |
+
* Deprecated: MW_WP_Form_Form::get_checked_value()
|
84 |
+
* Deprecated: MW_WP_Form_Form::get_radio_value()
|
85 |
+
* Deprecated: MW_WP_Form_Form::get_selected_value()
|
86 |
+
* Deprecated: MW_WP_Form_Form::get_separated_raw_value()
|
87 |
+
* Deprecated: MW_WP_Form_Form::get_separator_value()
|
88 |
+
|
89 |
= 2.3.5 =
|
90 |
* Bugfix : Fixed a post_raw bug at select and radio.
|
91 |
|
templates/admin-list/form-key.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<span id="formkey_field">[mwform_formkey key="<?php echo esc_html( $post_id ); ?>"]</span>
|
templates/admin/add-ons.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<p>
|
2 |
+
<?php esc_html_e( 'You can use more easy and useful to the MW WP Form in add-on!', MWF_Config::DOMAIN ); ?><br />
|
3 |
+
<a href="http://plugins.2inc.org/mw-wp-form/add-on/" target="_blank" class="button button-primary"><?php esc_html_e( 'View Add-ons', MWF_Config::DOMAIN ); ?></a>
|
4 |
+
</p>
|
templates/admin/admin-mail-options.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p>
|
2 |
+
<?php esc_html_e( '{key} is converted form data.', MWF_Config::DOMAIN ); ?>
|
3 |
+
<?php echo sprintf(
|
4 |
+
esc_html__( 'It is automatically converted to Tracking number when you input {%s}.', MWF_Config::DOMAIN ),
|
5 |
+
MWF_Config::TRACKINGNUMBER
|
6 |
+
); ?>
|
7 |
+
</p>
|
8 |
+
<p>
|
9 |
+
<?php esc_html_e( 'If Admin Email Options is a blank, Automatic Replay Email Options is used as Admin Email Options.', MWF_Config::DOMAIN ); ?>
|
10 |
+
</p>
|
11 |
+
<p>
|
12 |
+
<b><?php esc_html_e( 'To ( E-mail address )', MWF_Config::DOMAIN ); ?></b><br />
|
13 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_to]" value="<?php echo esc_attr( $mail_to ); ?>" /><br />
|
14 |
+
<span class="mwf_note"><?php esc_html_e( 'If empty:', MWF_Config::DOMAIN ); ?> <?php bloginfo( 'admin_email' ); ?></span>
|
15 |
+
</p>
|
16 |
+
<p>
|
17 |
+
<b><?php esc_html_e( 'CC ( E-mail address )', MWF_Config::DOMAIN ); ?></b><br />
|
18 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_cc]" value="<?php echo esc_attr( $mail_cc ); ?>" />
|
19 |
+
</p>
|
20 |
+
<p>
|
21 |
+
<b><?php esc_html_e( 'BCC ( E-mail address )', MWF_Config::DOMAIN ); ?></b><br />
|
22 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_bcc]" value="<?php echo esc_attr( $mail_bcc ); ?>" />
|
23 |
+
</p>
|
24 |
+
<p>
|
25 |
+
<b><?php esc_html_e( 'Subject', MWF_Config::DOMAIN ); ?></b><br />
|
26 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[admin_mail_subject]" value="<?php echo esc_attr( $admin_mail_subject ); ?>" />
|
27 |
+
</p>
|
28 |
+
<p>
|
29 |
+
<b><?php esc_html_e( 'Sender', MWF_Config::DOMAIN ); ?></b><br />
|
30 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[admin_mail_sender]" value="<?php echo esc_attr( $admin_mail_sender ); ?>" /><br />
|
31 |
+
<span class="mwf_note"><?php esc_html_e( 'If empty:', MWF_Config::DOMAIN ); ?> <?php bloginfo( 'name' ); ?></span>
|
32 |
+
</p>
|
33 |
+
<p>
|
34 |
+
<b><?php esc_html_e( 'From ( E-mail address )', MWF_Config::DOMAIN ); ?></b><br />
|
35 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[admin_mail_from]" value="<?php echo esc_attr( $admin_mail_from ); ?>" /><br />
|
36 |
+
<span class="mwf_note"><?php esc_html_e( 'If empty:', MWF_Config::DOMAIN ); ?> <?php bloginfo( 'admin_email' ); ?></span>
|
37 |
+
</p>
|
38 |
+
<p>
|
39 |
+
<b><?php esc_html_e( 'Content', MWF_Config::DOMAIN ); ?></b><br />
|
40 |
+
<textarea name="<?php echo esc_attr( MWF_Config::NAME ); ?>[admin_mail_content]" cols="30" rows="10"><?php echo esc_attr( $admin_mail_content ); ?></textarea>
|
41 |
+
</p>
|
templates/admin/form-key.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p>
|
2 |
+
<span id="formkey_field">[mwform_formkey key="<?php echo esc_html( $post_id ); ?>"]</span>
|
3 |
+
<span class="mwf_note">
|
4 |
+
<?php esc_html_e( 'Copy and Paste this shortcode.', MWF_Config::DOMAIN ); ?><br />
|
5 |
+
<?php esc_html_e( 'The key to use with hook is ', MWF_Config::DOMAIN ); ?><?php echo MWF_Config::NAME; ?>-<?php echo esc_html( $post_id ); ?>
|
6 |
+
</span>
|
7 |
+
</p>
|
templates/admin/mail-options.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p>
|
2 |
+
<?php esc_html_e( '{key} is converted form data.', MWF_Config::DOMAIN ); ?>
|
3 |
+
<?php echo sprintf(
|
4 |
+
esc_html__( 'It is automatically converted to Tracking number when you input {%s}.', MWF_Config::DOMAIN ),
|
5 |
+
MWF_Config::TRACKINGNUMBER
|
6 |
+
); ?>
|
7 |
+
</p>
|
8 |
+
<p>
|
9 |
+
<b><?php esc_html_e( 'Subject', MWF_Config::DOMAIN ); ?></b><br />
|
10 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_subject]" value="<?php echo esc_attr( $mail_subject ); ?>" />
|
11 |
+
</p>
|
12 |
+
<p>
|
13 |
+
<b><?php esc_html_e( 'Sender', MWF_Config::DOMAIN ); ?></b><br />
|
14 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_sender]" value="<?php echo esc_attr( $mail_sender ); ?>" /><br />
|
15 |
+
<span class="mwf_note"><?php esc_html_e( 'If empty:', MWF_Config::DOMAIN ); ?> <?php bloginfo( 'name' ); ?></span>
|
16 |
+
</p>
|
17 |
+
<p>
|
18 |
+
<b><?php esc_html_e( 'From ( E-mail address )', MWF_Config::DOMAIN ); ?></b><br />
|
19 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_from]" value="<?php echo esc_attr( $mail_from ); ?>" /><br />
|
20 |
+
<span class="mwf_note"><?php esc_html_e( 'If empty:', MWF_Config::DOMAIN ); ?> <?php bloginfo( 'admin_email' ); ?></span>
|
21 |
+
</p>
|
22 |
+
<p>
|
23 |
+
<b><?php esc_html_e( 'Content', MWF_Config::DOMAIN ); ?></b><br />
|
24 |
+
<textarea name="<?php echo esc_attr( MWF_Config::NAME ); ?>[mail_content]" cols="30" rows="10"><?php echo esc_attr( $mail_content ); ?></textarea>
|
25 |
+
</p>
|
26 |
+
<p>
|
27 |
+
<b><?php esc_html_e( 'Automatic reply email', MWF_Config::DOMAIN ); ?></b><br />
|
28 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[automatic_reply_email]" value="<?php echo esc_attr( $automatic_reply_email ); ?>" /><br />
|
29 |
+
<span class="mwf_note"><?php esc_html_e( 'Input the key to use as transmission to automatic reply email. {} is unnecessary.', MWF_Config::DOMAIN ); ?></span>
|
30 |
+
</p>
|
templates/admin/settings.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p>
|
2 |
+
<label><input type="checkbox" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[querystring]" value="1" <?php checked( $querystring, 1 ); ?> /> <?php esc_html_e( 'Activate Query string of post', MWF_Config::DOMAIN ); ?></label><br />
|
3 |
+
<span class="mwf_note"><?php esc_html_e( 'If this field is active, MW WP Form get query string. And get post data from query string "post_id". You can use $post\'s property in editor.', MWF_Config::DOMAIN ); ?><br />
|
4 |
+
<?php esc_html_e( 'Example: {ID}, {post_title}, {post_meta} etc...', MWF_Config::DOMAIN ); ?></span>
|
5 |
+
</p>
|
6 |
+
<p>
|
7 |
+
<label><input type="checkbox" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[usedb]" value="1" <?php checked( $usedb, 1 ); ?> /> <?php esc_html_e( 'Saving inquiry data in database', MWF_Config::DOMAIN ); ?></label>
|
8 |
+
</p>
|
9 |
+
<p>
|
10 |
+
<label><input type="checkbox" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[scroll]" value="1" <?php checked( $scroll, 1 ); ?> /> <?php esc_html_e( 'Enable scrolling of screen transition.', MWF_Config::DOMAIN ); ?></label>
|
11 |
+
</p>
|
12 |
+
<table border="0" cellpadding="0" cellspacing="0" class="akismet">
|
13 |
+
<tr>
|
14 |
+
<th colspan="2"><?php esc_html_e( 'Akismet Setting', MWF_Config::DOMAIN ); ?></th>
|
15 |
+
</tr>
|
16 |
+
<tr>
|
17 |
+
<td>author</td>
|
18 |
+
<td><input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[akismet_author]" value="<?php echo esc_attr( $akismet_author ); ?>" /></td>
|
19 |
+
</tr>
|
20 |
+
<tr>
|
21 |
+
<td>email</td>
|
22 |
+
<td><input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[akismet_author_email]" value="<?php echo esc_attr( $akismet_author_email ); ?>" /></td>
|
23 |
+
</tr>
|
24 |
+
<tr>
|
25 |
+
<td>url</td>
|
26 |
+
<td><input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[akismet_author_url]" value="<?php echo esc_attr( $akismet_author_url ); ?>" /></td>
|
27 |
+
</tr>
|
28 |
+
</table>
|
29 |
+
<span class="mwf_note"><?php esc_html_e( 'Input the key to use Akismet.', MWF_Config::DOMAIN ); ?></span>
|
templates/admin/style.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p>
|
2 |
+
<select name="<?php echo MWF_Config::NAME; ?>[style]">
|
3 |
+
<option value=""><?php esc_html_e( 'Select Style', MWF_Config::DOMAIN ); ?></option>
|
4 |
+
<?php foreach ( $styles as $style_key => $css ) : ?>
|
5 |
+
<option value="<?php echo esc_attr( $style_key ); ?>" <?php selected( $style, $style_key ); ?>>
|
6 |
+
<?php echo esc_html( $style_key ); ?>
|
7 |
+
</option>
|
8 |
+
<?php endforeach; ?>
|
9 |
+
</select>
|
10 |
+
</p>
|
templates/admin/tag-generator.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
do_action( 'mwform_tag_generator_dialog' );
|
3 |
+
?>
|
4 |
+
<div class="add-mwform-btn">
|
5 |
+
<select>
|
6 |
+
<option value=""><?php echo esc_html_e( 'Select this.', MWF_Config::DOMAIN ); ?></option>
|
7 |
+
<optgroup label="<?php echo esc_attr_e( 'Input fields', MWF_Config::DOMAIN ); ?>">
|
8 |
+
<?php do_action( 'mwform_tag_generator_input_option' ); ?>
|
9 |
+
</optgroup>
|
10 |
+
<optgroup label="<?php echo esc_attr_e( 'Select fields', MWF_Config::DOMAIN ); ?>">
|
11 |
+
<?php do_action( 'mwform_tag_generator_select_option' ); ?>
|
12 |
+
</optgroup>
|
13 |
+
<optgroup label="<?php echo esc_attr_e( 'Button fields', MWF_Config::DOMAIN ); ?>">
|
14 |
+
<?php do_action( 'mwform_tag_generator_button_option' ); ?>
|
15 |
+
</optgroup>
|
16 |
+
<optgroup label="<?php echo esc_attr_e( 'Error fields', MWF_Config::DOMAIN ); ?>">
|
17 |
+
<?php do_action( 'mwform_tag_generator_error_option' ); ?>
|
18 |
+
</optgroup>
|
19 |
+
<optgroup label="<?php echo esc_attr_e( 'Other fields', MWF_Config::DOMAIN ); ?>">
|
20 |
+
<?php do_action( 'mwform_tag_generator_option' ); ?>
|
21 |
+
</optgroup>
|
22 |
+
</select>
|
23 |
+
<span class="button"><?php esc_html_e( 'Add form tag', MWF_Config::DOMAIN ); ?></span>
|
24 |
+
</div>
|
templates/admin/url.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<input type="hidden" name="<?php echo esc_attr( MWF_Config::NAME ); ?>_nonce" value="<?php echo wp_create_nonce( MWF_Config::NAME ); ?>" />
|
2 |
+
<table border="0" cellpadding="0" cellspacing="4">
|
3 |
+
<tr>
|
4 |
+
<th><?php esc_html_e( 'Input Page URL', MWF_Config::DOMAIN ); ?></th>
|
5 |
+
<td>
|
6 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[input_url]" value="<?php echo esc_attr( $input_url ); ?>" />
|
7 |
+
</td>
|
8 |
+
</tr>
|
9 |
+
<tr>
|
10 |
+
<th><?php esc_html_e( 'Confirmation Page URL', MWF_Config::DOMAIN ); ?></th>
|
11 |
+
<td>
|
12 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[confirmation_url]" value="<?php echo esc_attr( $confirmation_url ); ?>" />
|
13 |
+
</td>
|
14 |
+
</tr>
|
15 |
+
<tr>
|
16 |
+
<th><?php esc_html_e( 'Complete Page URL', MWF_Config::DOMAIN ); ?></th>
|
17 |
+
<td>
|
18 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[complete_url]" value="<?php echo esc_attr( $complete_url ); ?>" />
|
19 |
+
</td>
|
20 |
+
</tr>
|
21 |
+
<tr>
|
22 |
+
<th><?php esc_html_e( 'Validation Error Page URL', MWF_Config::DOMAIN ); ?></th>
|
23 |
+
<td>
|
24 |
+
<input type="text" name="<?php echo esc_attr( MWF_Config::NAME ); ?>[validation_error_url]" value="<?php echo esc_attr( $validation_error_url ); ?>" />
|
25 |
+
</td>
|
26 |
+
</tr>
|
27 |
+
</table>
|
28 |
+
<p class="description">
|
29 |
+
<?php esc_html_e( 'This urls are the redirection urls at the time of button press. When URL setting is empty, The page redirect on the same page.', MWF_Config::DOMAIN ); ?><br />
|
30 |
+
<?php printf( esc_html__( 'When a URL doesn\'t begin http or https, %s is complemented.', MWF_Config::DOMAIN ), '<b>' . home_url() . '</b>' ); ?>
|
31 |
+
</p>
|
templates/admin/validation-rule.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<b class="add-btn"><?php esc_html_e( 'Add Validation rule', MWF_Config::DOMAIN ); ?></b>
|
2 |
+
<div class="repeatable-boxes">
|
3 |
+
<?php foreach ( $validation as $key => $value ) : $value = array_merge( $validation_keys, $value ); ?>
|
4 |
+
<div class="repeatable-box" <?php if ( $key === 0 ) : ?>style="display:none"<?php endif; ?>>
|
5 |
+
<div class="sortable-icon-handle"></div>
|
6 |
+
<div class="remove-btn"><b>×</b></div>
|
7 |
+
<div class="open-btn"><span><?php echo esc_attr( $value['target'] ); ?></span><b>▼</b></div>
|
8 |
+
<div class="repeatable-box-content">
|
9 |
+
<?php esc_html_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 esc_attr( $key ); ?>][target]" />
|
10 |
+
<table border="0" cellpadding="0" cellspacing="0">
|
11 |
+
<tr>
|
12 |
+
<td colspan="2">
|
13 |
+
<?php foreach ( $validation_rules as $validation_rule => $instance ) : ?>
|
14 |
+
<?php $instance->admin( $key, $value ); ?>
|
15 |
+
<?php endforeach; ?>
|
16 |
+
</td>
|
17 |
+
</tr>
|
18 |
+
</table>
|
19 |
+
<!-- end .repeatable-box-content --></div>
|
20 |
+
<!-- end .repeatable-box --></div>
|
21 |
+
<?php endforeach; ?>
|
22 |
+
<!-- end .repeatable-boxes --></div>
|
classes/views/class.chart.php → templates/chart/index.php
RENAMED
@@ -1,64 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Name : MW WP Form Chart View
|
4 |
-
* Version : 1.0.3
|
5 |
-
* Author : Takashi Kitajima
|
6 |
-
* Author URI : http://2inc.org
|
7 |
-
* Created : January 2, 2015
|
8 |
-
* Modified : February 14, 2015
|
9 |
-
* License : GPLv2
|
10 |
-
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
class MW_WP_Form_Chart_View extends MW_WP_Form_View {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* index
|
16 |
-
*/
|
17 |
-
public function index() {
|
18 |
-
$post_type = $this->get( 'post_type' );
|
19 |
-
$option_group = $this->get( 'option_group' );
|
20 |
-
$default_args = array(
|
21 |
-
'posts_per_page' => -1,
|
22 |
-
);
|
23 |
-
$_args = apply_filters( 'mwform_get_inquiry_data_args-' . $post_type, $default_args );
|
24 |
-
$args = array(
|
25 |
-
'post_type' => $post_type,
|
26 |
-
);
|
27 |
-
if ( !empty( $_args ) && is_array( $_args ) ) {
|
28 |
-
$args = array_merge( $_args, $args );
|
29 |
-
} else {
|
30 |
-
$args = array_merge( $_args, $default_args );
|
31 |
-
}
|
32 |
-
$form_posts = get_posts( $args );
|
33 |
-
|
34 |
-
$custom_keys = array();
|
35 |
-
foreach ( $form_posts as $post ) {
|
36 |
-
$post_custom_keys = get_post_custom_keys( $post->ID );
|
37 |
-
if ( is_array( $post_custom_keys ) ) {
|
38 |
-
foreach ( $post_custom_keys as $post_custom_key ) {
|
39 |
-
if ( preg_match( '/^_/', $post_custom_key ) ) {
|
40 |
-
continue;
|
41 |
-
}
|
42 |
-
$post_meta = get_post_meta( $post->ID, $post_custom_key, true );
|
43 |
-
$custom_keys[$post_custom_key][$post_meta][] = $post->ID;
|
44 |
-
}
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
$postdata = array();
|
49 |
-
$option = get_option( MWF_Config::NAME . '-chart-' . $post_type );
|
50 |
-
if ( is_array( $option ) && isset( $option['chart'] ) && is_array( $option['chart'] ) ) {
|
51 |
-
$postdata = $option['chart'];
|
52 |
-
}
|
53 |
-
|
54 |
-
$default_keys = array(
|
55 |
-
'target' => '',
|
56 |
-
'separator' => '',
|
57 |
-
'chart' => '',
|
58 |
-
);
|
59 |
-
// 空の隠れフィールド(コピー元)を挿入
|
60 |
-
array_unshift( $postdata, $default_keys );
|
61 |
-
?>
|
62 |
<div class="wrap">
|
63 |
<?php $post_id = preg_replace( '/^(.+_)(\d+)$/', '$2', $post_type ); ?>
|
64 |
<h2>
|
@@ -199,6 +138,3 @@ class MW_WP_Form_Chart_View extends MW_WP_Form_View {
|
|
199 |
}
|
200 |
</script>
|
201 |
<!-- end .wrap --></div>
|
202 |
-
<?php
|
203 |
-
}
|
204 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div class="wrap">
|
2 |
<?php $post_id = preg_replace( '/^(.+_)(\d+)$/', '$2', $post_type ); ?>
|
3 |
<h2>
|
138 |
}
|
139 |
</script>
|
140 |
<!-- end .wrap --></div>
|
|
|
|
|
|
templates/contact-data-list/admin-print-styles.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<style type="text/css">
|
2 |
+
#normal-sortables {
|
3 |
+
display: none;
|
4 |
+
}
|
5 |
+
</style>
|
templates/contact-data-list/column.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php echo $column; ?>
|
templates/contact-data-list/csv-button.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form id="mw-wp-form_csv" method="post" action="<?php echo esc_url( $action ); ?>">
|
2 |
+
<input type="submit" value="<?php esc_attr_e( 'CSV Download', MWF_Config::DOMAIN ); ?>" class="button-primary" />
|
3 |
+
|
4 |
+
|
5 |
+
<label><input type="checkbox" name="download-all" value="true" checked="checked" /> Download All</label>
|
6 |
+
<input type="hidden" name="<?php echo esc_attr( MWF_Config::NAME . '-csv-download' ); ?>" value="1" />
|
7 |
+
<?php wp_nonce_field( MWF_Config::NAME ); ?>
|
8 |
+
</form>
|
templates/contact-data/admin-print-styles.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<style type="text/css">
|
2 |
+
h2 a.add-new-h2 {
|
3 |
+
display: none;
|
4 |
+
}
|
5 |
+
</style>
|
templates/contact-data/detail.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<input type="hidden" name="<?php echo esc_attr( MWF_Config::NAME ); ?>_nonce" value="<?php echo wp_create_nonce( MWF_Config::NAME ); ?>" />
|
2 |
+
<table border="0" cellpadding="0" cellspacing="0">
|
3 |
+
<?php
|
4 |
+
$values = $Contact_Data_Setting->gets();
|
5 |
+
foreach ( $values as $key => $value ) :
|
6 |
+
if ( in_array( $key, $Contact_Data_Setting->get_permit_keys() ) ) {
|
7 |
+
continue;
|
8 |
+
}
|
9 |
+
?>
|
10 |
+
<tr>
|
11 |
+
<th>
|
12 |
+
<?php
|
13 |
+
if ( $key === MWF_Config::TRACKINGNUMBER ) {
|
14 |
+
echo MWF_Functions::get_tracking_number_title( $post_type );
|
15 |
+
} else {
|
16 |
+
echo esc_html( $key );
|
17 |
+
}
|
18 |
+
?>
|
19 |
+
</th>
|
20 |
+
<td>
|
21 |
+
<?php
|
22 |
+
if ( $Contact_Data_Setting->is_upload_file_key( $post, $key ) ) {
|
23 |
+
echo MWF_Functions::get_multimedia_data( $value );
|
24 |
+
} else {
|
25 |
+
echo nl2br( esc_html( $value ) );
|
26 |
+
}
|
27 |
+
?>
|
28 |
+
</td>
|
29 |
+
</tr>
|
30 |
+
<?php endforeach; ?>
|
31 |
+
<tr>
|
32 |
+
<th><?php esc_html_e( 'Response Status', MWF_Config::DOMAIN ); ?></th>
|
33 |
+
<td>
|
34 |
+
<select name="<?php echo esc_attr( MWF_Config::CONTACT_DATA_NAME ); ?>[response_status]">
|
35 |
+
<?php foreach ( $Contact_Data_Setting->get_response_statuses() as $key => $value ) : ?>
|
36 |
+
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $Contact_Data_Setting->get( 'response_status' ) ); ?>>
|
37 |
+
<?php echo esc_html( $value ); ?>
|
38 |
+
</option>
|
39 |
+
<?php endforeach; ?>
|
40 |
+
</select>
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
<tr>
|
44 |
+
<th><?php esc_html_e( 'Memo', MWF_Config::DOMAIN ); ?></th>
|
45 |
+
<td><textarea name="<?php echo esc_attr( MWF_Config::CONTACT_DATA_NAME ); ?>[memo]" cols="50" rows="5"><?php echo $Contact_Data_Setting->get( 'memo' ); ?></textarea></td>
|
46 |
+
</tr>
|
47 |
+
</table>
|
templates/contact-data/returning-link.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<p>
|
2 |
+
<a href="<?php echo $link; ?>"><?php esc_html_e( '« Back to the list', MWF_Config::DOMAIN ); ?></a>
|
3 |
+
</p>
|
templates/stores-inquiry-data-form-list/index.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h2><?php esc_html_e( 'Inquiry data', MWF_Config::DOMAIN ); ?></h2>
|
3 |
+
<p>
|
4 |
+
<?php esc_html_e( 'You can see the inquiry data that are saved in the database by clicking on the link below.', MWF_Config::DOMAIN ); ?>
|
5 |
+
</p>
|
6 |
+
<table class="wp-list-table widefat fixed" cellspacing="0">
|
7 |
+
<thead>
|
8 |
+
<th class="<?php echo MWF_Config::NAME; ?>-table-title"><?php esc_html_e( 'Form title', MWF_Config::DOMAIN ); ?></th>
|
9 |
+
<th class="<?php echo MWF_Config::NAME; ?>-table-chart"><?php esc_html_e( 'Display Chart', MWF_Config::DOMAIN ); ?></th>
|
10 |
+
<th class="<?php echo MWF_Config::NAME; ?>-table-count"><?php esc_html_e( 'The number of inquiries', MWF_Config::DOMAIN ); ?></th>
|
11 |
+
<th class="<?php echo MWF_Config::NAME; ?>-table-date"><?php esc_html_e( 'Updated date', MWF_Config::DOMAIN ); ?></th>
|
12 |
+
<th class="<?php echo MWF_Config::NAME; ?>-table-date"><?php esc_html_e( 'Created date', MWF_Config::DOMAIN ); ?></th>
|
13 |
+
</thead>
|
14 |
+
<tbody>
|
15 |
+
<?php $i = 0; foreach ( $form_list as $post_type => $values ) : $i ++; ?>
|
16 |
+
<tr <?php if ( $i % 2 == 1 ) echo 'class="alternate"'; ?>>
|
17 |
+
<td class="<?php echo MWF_Config::NAME; ?>-table-title"><?php echo esc_html( $values['title'] ) ; ?></td>
|
18 |
+
<td class="<?php echo MWF_Config::NAME; ?>-table-chart"><a href="<?php echo admin_url( 'edit.php?post_type=' . MWF_Config::NAME . '&page=' . MWF_Config::NAME . '-chart&formkey=' . $post_type ); ?>"><?php esc_html_e( 'Display Chart', MWF_Config::DOMAIN ); ?></td>
|
19 |
+
<td class="<?php echo MWF_Config::NAME; ?>-table-count"><a href="<?php echo admin_url( 'edit.php?post_type=' . $post_type ); ?>"><?php echo esc_html( $values['count'] ) ?> <?php esc_html_e( 'cases', MWF_Config::DOMAIN ); ?></a></td>
|
20 |
+
<td class="<?php echo MWF_Config::NAME; ?>-table-date"><?php echo esc_html( $values['modified_datetime'] ); ?></td>
|
21 |
+
<td class="<?php echo MWF_Config::NAME; ?>-table-date"><?php echo esc_html( $values['created_datetime'] ); ?></td>
|
22 |
+
</tr>
|
23 |
+
<?php endforeach; ?>
|
24 |
+
</tbody>
|
25 |
+
</table>
|
26 |
+
<!-- end .wrap --></div>
|