Version Description
- Bugfix : Fixed a post_raw bug at select and radio.
Download this release
Release Info
Developer | inc2734 |
Plugin | MW WP Form |
Version | 2.3.5 |
Comparing to | |
See all releases |
Code changes from version 2.3.4 to 2.3.5
- classes/form-fields/class.checkbox.php +3 -3
- classes/form-fields/class.radio.php +3 -3
- classes/form-fields/class.select.php +3 -3
- classes/models/class.contact-data.php +2 -0
- classes/models/class.data.php +94 -44
- classes/models/class.form.php +13 -2
- classes/views/class.contact-data.php +1 -0
- classes/views/class.main.php +28 -24
- mw-wp-form.php +6 -2
- readme.txt +4 -1
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 : March
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -56,7 +56,7 @@ class MW_WP_Form_Field_Checkbox extends MW_WP_Form_Abstract_Form_Field {
|
|
56 |
*/
|
57 |
protected function input_page() {
|
58 |
$children = $this->get_children( $this->atts['children'] );
|
59 |
-
$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'],
|
2 |
/**
|
3 |
* Name : MW WP Form Field Checkbox
|
4 |
* Description: チェックボックスを出力
|
5 |
+
* Version : 1.5.8
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : December 14, 2012
|
9 |
+
* Modified : March 25, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
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'],
|
classes/form-fields/class.radio.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Field Radio
|
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 |
*/
|
@@ -77,7 +77,7 @@ class MW_WP_Form_Field_Radio extends MW_WP_Form_Abstract_Form_Field {
|
|
77 |
protected function confirm_page() {
|
78 |
$children = $this->get_children( $this->atts['children'] );
|
79 |
$value = $this->Form->get_radio_value( $this->atts['name'], $children );
|
80 |
-
$posted_value = $this->Form->
|
81 |
$_ret = esc_html( $value );
|
82 |
$_ret .= $this->Form->hidden( $this->atts['name'], $posted_value );
|
83 |
if ( $this->atts['post_raw'] === 'false' ) {
|
2 |
/**
|
3 |
* Name : MW WP Form Field Radio
|
4 |
* Description: ラジオボタンを出力
|
5 |
+
* Version : 1.5.6
|
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 |
*/
|
77 |
protected function confirm_page() {
|
78 |
$children = $this->get_children( $this->atts['children'] );
|
79 |
$value = $this->Form->get_radio_value( $this->atts['name'], $children );
|
80 |
+
$posted_value = $this->Form->get_raw_in_children( $this->atts['name'], $children );
|
81 |
$_ret = esc_html( $value );
|
82 |
$_ret .= $this->Form->hidden( $this->atts['name'], $posted_value );
|
83 |
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 |
*/
|
@@ -75,7 +75,7 @@ class MW_WP_Form_Field_Select extends MW_WP_Form_Abstract_Form_Field {
|
|
75 |
protected function confirm_page() {
|
76 |
$children = $this->get_children( $this->atts['children'] );
|
77 |
$value = $this->Form->get_selected_value( $this->atts['name'], $children );
|
78 |
-
$posted_value = $this->Form->
|
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.6
|
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 |
*/
|
75 |
protected function confirm_page() {
|
76 |
$children = $this->get_children( $this->atts['children'] );
|
77 |
$value = $this->Form->get_selected_value( $this->atts['name'], $children );
|
78 |
+
$posted_value = $this->Form->get_raw_in_children( $this->atts['name'], $children );
|
79 |
$_ret = esc_html( $value );
|
80 |
$_ret .= $this->Form->hidden( $this->atts['name'], $posted_value );
|
81 |
if ( $this->atts['post_raw'] === 'false' ) {
|
classes/models/class.contact-data.php
CHANGED
@@ -23,6 +23,8 @@ class MW_WP_Form_Contact_Data {
|
|
23 |
return $post_id;
|
24 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
25 |
return $post_id;
|
|
|
|
|
26 |
if ( !current_user_can( MWF_Config::CAPABILITY ) )
|
27 |
return $post_id;
|
28 |
|
23 |
return $post_id;
|
24 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
25 |
return $post_id;
|
26 |
+
if ( !wp_verify_nonce( $_POST[MWF_Config::NAME . '_nonce'], MWF_Config::NAME ) )
|
27 |
+
return $post_id;
|
28 |
if ( !current_user_can( MWF_Config::CAPABILITY ) )
|
29 |
return $post_id;
|
30 |
|
classes/models/class.data.php
CHANGED
@@ -2,11 +2,11 @@
|
|
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 :
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -280,48 +280,49 @@ class MW_WP_Form_Data {
|
|
280 |
}
|
281 |
|
282 |
/**
|
283 |
-
* get
|
284 |
* 整形済み(メール送信可能な)データを取得
|
|
|
285 |
* @param string $key データのキー
|
286 |
-
* @return string
|
287 |
*/
|
288 |
public function get( $key ) {
|
289 |
if ( isset( $this->data[$key] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
if ( is_array( $this->data[$key] ) ) {
|
291 |
if ( !array_key_exists( 'data', $this->data[$key] ) ) {
|
292 |
return;
|
293 |
}
|
|
|
|
|
294 |
if ( is_array( $this->data[$key]['data'] ) ) {
|
295 |
-
if (
|
296 |
-
$children = json_decode( $this->data['__children'][$key], true );
|
297 |
return $this->get_separated_value( $key, $children );
|
298 |
}
|
299 |
-
return $this->
|
300 |
} else {
|
301 |
$value = $this->data[$key]['data'];
|
302 |
-
if (
|
303 |
-
|
304 |
-
$separator = $this->get_separator_value( $key );
|
305 |
-
$array_value = explode( $separator, $value );
|
306 |
-
$right_value = array();
|
307 |
-
foreach ( $array_value as $v ) {
|
308 |
-
if ( isset( $children[$v] ) ) {
|
309 |
-
$right_value[] = $children[$v];
|
310 |
-
}
|
311 |
-
}
|
312 |
-
return implode( $separator, $right_value );
|
313 |
}
|
314 |
-
return $
|
315 |
}
|
316 |
} else {
|
|
|
|
|
|
|
317 |
return $this->get_raw( $key );
|
318 |
}
|
319 |
}
|
320 |
}
|
321 |
|
322 |
/**
|
323 |
-
* get_in_children
|
324 |
* $children の中に値が含まれているときだけ返す
|
|
|
325 |
* @param string $key name属性
|
326 |
* @param array $children
|
327 |
* @return string
|
@@ -335,6 +336,23 @@ class MW_WP_Form_Data {
|
|
335 |
}
|
336 |
}
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
/**
|
339 |
* get_separator_value
|
340 |
* 送られてきたseparatorを返す
|
@@ -356,27 +374,43 @@ class MW_WP_Form_Data {
|
|
356 |
}
|
357 |
|
358 |
/**
|
359 |
-
* get_separated_value
|
360 |
* 配列データを整形して返す ( 郵便番号等用 )。配列の場合は表示値を連結して返す
|
|
|
361 |
* @param string $key name属性
|
362 |
* @param array $children 選択肢
|
363 |
-
* @return string
|
364 |
*/
|
365 |
public function get_separated_value( $key, array $children = array() ) {
|
366 |
$separator = $this->get_separator_value( $key );
|
367 |
$value = $this->get_raw( $key );
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
}
|
|
|
375 |
}
|
376 |
-
return implode( $separator, $rightData );
|
377 |
-
} else {
|
378 |
-
return $this->get_separated_value_not_children_set( $value['data'], $separator );
|
379 |
}
|
|
|
|
|
|
|
|
|
|
|
380 |
}
|
381 |
}
|
382 |
public function getSeparatedValue( $key ) {
|
@@ -388,33 +422,49 @@ class MW_WP_Form_Data {
|
|
388 |
}
|
389 |
|
390 |
/**
|
391 |
-
* get_separated_raw_value
|
392 |
* 配列データを整形して返す ( チェックボックス等用 )。配列の場合はpost値を連結して返す
|
|
|
393 |
* @param string $key name属性
|
394 |
* @param array $children 選択肢
|
395 |
-
* @return string
|
396 |
*/
|
397 |
public function get_separated_raw_value( $key, array $children = array() ) {
|
398 |
$separator = $this->get_separator_value( $key );
|
399 |
$value = $this->get_raw( $key );
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
}
|
|
|
407 |
}
|
408 |
-
return implode( $separator, $rightData );
|
409 |
-
} else {
|
410 |
-
return $this->get_separated_value_not_children_set( $value['data'], $separator );
|
411 |
}
|
|
|
|
|
|
|
|
|
|
|
412 |
}
|
413 |
}
|
414 |
|
415 |
/**
|
416 |
-
*
|
417 |
-
*
|
418 |
* @param array $data
|
419 |
* @param string $separator
|
420 |
* @return string
|
2 |
/**
|
3 |
* Name : MW WP Form Data
|
4 |
* Description: MW WP Form のデータ操作用
|
5 |
+
* Version : 1.3.6
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : October 10, 2013
|
9 |
+
* Modified : March 25, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
280 |
}
|
281 |
|
282 |
/**
|
|
|
283 |
* 整形済み(メール送信可能な)データを取得
|
284 |
+
*
|
285 |
* @param string $key データのキー
|
286 |
+
* @return string
|
287 |
*/
|
288 |
public function get( $key ) {
|
289 |
if ( isset( $this->data[$key] ) ) {
|
290 |
+
|
291 |
+
$children = array();
|
292 |
+
if ( isset( $this->data['__children'][$key] ) ) {
|
293 |
+
$children = json_decode( $this->data['__children'][$key], true );
|
294 |
+
}
|
295 |
+
|
296 |
if ( is_array( $this->data[$key] ) ) {
|
297 |
if ( !array_key_exists( 'data', $this->data[$key] ) ) {
|
298 |
return;
|
299 |
}
|
300 |
+
// チェックボックス、電話番号など data を持つ項目は入力画面では配列でくるけど
|
301 |
+
// 確認画面では文字列でくる
|
302 |
if ( is_array( $this->data[$key]['data'] ) ) {
|
303 |
+
if ( $children ) {
|
|
|
304 |
return $this->get_separated_value( $key, $children );
|
305 |
}
|
306 |
+
return $this->get_separated_raw_value( $key );
|
307 |
} else {
|
308 |
$value = $this->data[$key]['data'];
|
309 |
+
if ( $children ) {
|
310 |
+
return $this->get_separated_value( $key, $children );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
}
|
312 |
+
return $this->get_separated_raw_value( $key );
|
313 |
}
|
314 |
} else {
|
315 |
+
if ( $children ) {
|
316 |
+
return $this->get_in_children( $key, $children );
|
317 |
+
}
|
318 |
return $this->get_raw( $key );
|
319 |
}
|
320 |
}
|
321 |
}
|
322 |
|
323 |
/**
|
|
|
324 |
* $children の中に値が含まれているときだけ返す
|
325 |
+
*
|
326 |
* @param string $key name属性
|
327 |
* @param array $children
|
328 |
* @return string
|
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->get_raw( $key );
|
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を返す
|
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 = array() ) {
|
384 |
$separator = $this->get_separator_value( $key );
|
385 |
$value = $this->get_raw( $key );
|
386 |
+
|
387 |
+
// チェックボックス、電話番号、郵便番号は配列
|
388 |
+
// ラジオボタン、セレクトボックスは文字列
|
389 |
+
if ( is_array( $value ) ) {
|
390 |
+
// $value が配列の場合、[data] が無いものは不正
|
391 |
+
if ( isset( $value['data'] ) ) {
|
392 |
+
// 入力 -> 確認のときは配列、確認 -> 入力のときは文字列
|
393 |
+
if ( !is_array( $value['data'] ) && $separator ) {
|
394 |
+
$value['data'] = explode( $separator, $value['data'] );
|
395 |
+
}
|
396 |
+
if ( $separator ) {
|
397 |
+
if ( $children ) {
|
398 |
+
$rightData = array();
|
399 |
+
foreach ( $value['data'] as $child ) {
|
400 |
+
if ( isset( $children[$child] ) && !in_array( $children[$child], $rightData ) ) {
|
401 |
+
$rightData[] = $children[$child];
|
402 |
+
}
|
403 |
+
}
|
404 |
+
return implode( $separator, $rightData );
|
405 |
}
|
406 |
+
return $this->get_separated_value_not_children_set( $value['data'], $separator );
|
407 |
}
|
|
|
|
|
|
|
408 |
}
|
409 |
+
} else {
|
410 |
+
if ( $children ) {
|
411 |
+
return $this->get_in_children( $key, $children );
|
412 |
+
}
|
413 |
+
return $value;
|
414 |
}
|
415 |
}
|
416 |
public function getSeparatedValue( $key ) {
|
422 |
}
|
423 |
|
424 |
/**
|
|
|
425 |
* 配列データを整形して返す ( チェックボックス等用 )。配列の場合はpost値を連結して返す
|
426 |
+
*
|
427 |
* @param string $key name属性
|
428 |
* @param array $children 選択肢
|
429 |
+
* @return string
|
430 |
*/
|
431 |
public function get_separated_raw_value( $key, array $children = array() ) {
|
432 |
$separator = $this->get_separator_value( $key );
|
433 |
$value = $this->get_raw( $key );
|
434 |
+
|
435 |
+
// チェックボックス、電話番号、郵便番号は配列
|
436 |
+
// ラジオボタン、セレクトボックスは文字列
|
437 |
+
if ( is_array( $value ) ) {
|
438 |
+
// $value が配列の場合、[data] が無いものは不正
|
439 |
+
if ( isset( $value['data'] ) ) {
|
440 |
+
// 入力 -> 確認のときは配列、確認 -> 入力のときは文字列
|
441 |
+
if ( !is_array( $value['data'] ) && $separator ) {
|
442 |
+
$value['data'] = explode( $separator, $value['data'] );
|
443 |
+
}
|
444 |
+
if ( $separator ) {
|
445 |
+
if ( $children ) {
|
446 |
+
$rightData = array();
|
447 |
+
foreach ( $value['data'] as $child ) {
|
448 |
+
if ( isset( $children[$child] ) && !in_array( $child, $rightData ) ) {
|
449 |
+
$rightData[] = $child;
|
450 |
+
}
|
451 |
+
}
|
452 |
+
return implode( $separator, $rightData );
|
453 |
}
|
454 |
+
return $this->get_separated_value_not_children_set( $value['data'], $separator );
|
455 |
}
|
|
|
|
|
|
|
456 |
}
|
457 |
+
} else {
|
458 |
+
if ( $children ) {
|
459 |
+
return $this->get_raw_in_children( $key, $children );
|
460 |
+
}
|
461 |
+
return $value;
|
462 |
}
|
463 |
}
|
464 |
|
465 |
/**
|
466 |
+
* すべて空のからのときはimplodeしないように(---がいってしまうため)= 一個でも値ありがあれば返す
|
467 |
+
*
|
468 |
* @param array $data
|
469 |
* @param string $separator
|
470 |
* @return string
|
classes/models/class.form.php
CHANGED
@@ -2,11 +2,11 @@
|
|
2 |
/**
|
3 |
* Name : MW WP Form Form
|
4 |
* Description: フォームヘルパー
|
5 |
-
* Version : 1.5.
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : September 25, 2012
|
9 |
-
* Modified : March
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
@@ -37,6 +37,17 @@ class MW_WP_Form_Form {
|
|
37 |
return $this->Data->get_raw( $key );
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
/**
|
41 |
* get_zip_value
|
42 |
* データを返す ( 郵便番号用 )
|
2 |
/**
|
3 |
* Name : MW WP Form Form
|
4 |
* Description: フォームヘルパー
|
5 |
+
* Version : 1.5.4
|
6 |
* Author : Takashi Kitajima
|
7 |
* Author URI : http://2inc.org
|
8 |
* Created : September 25, 2012
|
9 |
+
* Modified : March 26, 2015
|
10 |
* License : GPLv2
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
*/
|
37 |
return $this->Data->get_raw( $key );
|
38 |
}
|
39 |
|
40 |
+
/**
|
41 |
+
* $children の中に値が含まれているときだけ返す
|
42 |
+
*
|
43 |
+
* @param string $key name属性
|
44 |
+
* @param array $children
|
45 |
+
* @return string
|
46 |
+
*/
|
47 |
+
public function get_raw_in_children( $key, array $children ) {
|
48 |
+
return $this->Data->get_raw_in_children( $key, $children );
|
49 |
+
}
|
50 |
+
|
51 |
/**
|
52 |
* get_zip_value
|
53 |
* データを返す ( 郵便番号用 )
|
classes/views/class.contact-data.php
CHANGED
@@ -68,6 +68,7 @@ class MW_WP_Form_Contact_Data_View extends MW_WP_Form_View {
|
|
68 |
$Contact_Data_Setting = $this->get( 'Contact_Data_Setting' );
|
69 |
$post_type = $this->get( 'post_type' );
|
70 |
?>
|
|
|
71 |
<table border="0" cellpadding="0" cellspacing="0">
|
72 |
<?php
|
73 |
$values = $Contact_Data_Setting->gets();
|
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();
|
classes/views/class.main.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Name : MW WP Form Main View
|
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 |
*/
|
@@ -209,10 +209,10 @@ class MW_WP_Form_Main_View extends MW_WP_Form_View {
|
|
209 |
}
|
210 |
|
211 |
/**
|
212 |
-
* get_post_property_from_querystring
|
213 |
* 引数 post_id が有効の場合、投稿情報を取得するために preg_replace_callback から呼び出される。
|
|
|
214 |
* @param array $matches
|
215 |
-
* @return string
|
216 |
*/
|
217 |
protected function get_post_property_from_querystring( $matches ) {
|
218 |
$Setting = $this->get( 'Setting' );
|
@@ -224,23 +224,15 @@ class MW_WP_Form_Main_View extends MW_WP_Form_View {
|
|
224 |
if ( empty( $post->ID ) ) {
|
225 |
return;
|
226 |
}
|
227 |
-
|
228 |
-
return $post->$matches[1];
|
229 |
-
} else {
|
230 |
-
// post_meta の処理
|
231 |
-
$pm = get_post_meta( $post->ID, $matches[1], true );
|
232 |
-
if ( !empty( $pm ) ) {
|
233 |
-
return $pm;
|
234 |
-
}
|
235 |
-
}
|
236 |
}
|
237 |
}
|
238 |
|
239 |
/**
|
240 |
-
* get_post_property_from_this
|
241 |
* 引数 post_id が無効の場合、投稿情報を取得するために preg_replace_callback から呼び出される。
|
|
|
242 |
* @param array $matches
|
243 |
-
* @return string
|
244 |
*/
|
245 |
protected function get_post_property_from_this( $matches ) {
|
246 |
global $post;
|
@@ -248,15 +240,27 @@ class MW_WP_Form_Main_View extends MW_WP_Form_View {
|
|
248 |
return;
|
249 |
}
|
250 |
if ( isset( $post->ID ) && MWF_Functions::is_numeric( $post->ID ) ) {
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
}
|
261 |
}
|
262 |
|
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 |
*/
|
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' );
|
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;
|
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 |
|
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.3.
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created : September 25, 2012
|
10 |
-
* Modified: March
|
11 |
* Text Domain: mw-wp-form
|
12 |
* Domain Path: /languages/
|
13 |
* License: GPLv2
|
@@ -176,6 +176,10 @@ class MW_WP_Form {
|
|
176 |
* 管理画面(カスタム投稿タイプ)の設定
|
177 |
*/
|
178 |
public function register_post_type() {
|
|
|
|
|
|
|
|
|
179 |
// MW WP Form のフォーム設定を管理する投稿タイプ
|
180 |
register_post_type( MWF_Config::NAME, array(
|
181 |
'label' => 'MW WP Form',
|
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.3.5
|
7 |
* Author: Takashi Kitajima
|
8 |
* Author URI: http://2inc.org
|
9 |
* Created : September 25, 2012
|
10 |
+
* Modified: March 26, 2015
|
11 |
* Text Domain: mw-wp-form
|
12 |
* Domain Path: /languages/
|
13 |
* License: GPLv2
|
176 |
* 管理画面(カスタム投稿タイプ)の設定
|
177 |
*/
|
178 |
public function register_post_type() {
|
179 |
+
if ( !current_user_can( MWF_Config::CAPABILITY ) && is_admin() ) {
|
180 |
+
return;
|
181 |
+
}
|
182 |
+
|
183 |
// MW WP Form のフォーム設定を管理する投稿タイプ
|
184 |
register_post_type( MWF_Config::NAME, array(
|
185 |
'label' => 'MW WP Form',
|
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.3.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -71,6 +71,9 @@ Do you have questions or issues with MW WP Form? Use these support channels appr
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
74 |
= 2.3.4 =
|
75 |
* Bugfix : Fixed a bug that checkboxes are checked when children are added by hook.
|
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.3.5
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 2.3.5 =
|
75 |
+
* Bugfix : Fixed a post_raw bug at select and radio.
|
76 |
+
|
77 |
= 2.3.4 =
|
78 |
* Bugfix : Fixed a bug that checkboxes are checked when children are added by hook.
|
79 |
|