| 1 |
<?php |
| 2 |
/** |
| 3 |
* Multi Line Text |
| 4 |
* |
| 5 |
* @package kintone-form |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* KintoneFormMultiLineText |
| 10 |
*/ |
| 11 |
class KintoneFormMultiLineText { |
| 12 |
|
| 13 |
/** |
| 14 |
* Get instance |
| 15 |
*/ |
| 16 |
public static function get_instance() { |
| 17 |
/** |
| 18 |
* A variable that keeps the sole instance. |
| 19 |
*/ |
| 20 |
static $instance; |
| 21 |
|
| 22 |
if ( ! isset( $instance ) ) { |
| 23 |
$instance = new KintoneFormMultiLineText(); |
| 24 |
} |
| 25 |
|
| 26 |
return $instance; |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Format for kintone data. |
| 31 |
* |
| 32 |
* @param array $kintone_form_data . |
| 33 |
* @param array $cf7_send_data . |
| 34 |
* @param string $cf7_mail_tag . |
| 35 |
* @param WP_Error $e . |
| 36 |
* |
| 37 |
* @return array An array of image URLs. |
| 38 |
*/ |
| 39 |
public static function format_to_kintone_data( $kintone_form_data, $cf7_send_data, $cf7_mail_tag, $e ) { |
| 40 |
|
| 41 |
$return_data = array(); |
| 42 |
|
| 43 |
$value = ''; |
| 44 |
if ( in_array( $cf7_mail_tag, Kintone_Form::get_cf7_special_tags(), true ) ) { |
| 45 |
|
| 46 |
$mail_tag = new WPCF7_MailTag( |
| 47 |
sprintf( '[%s]', $cf7_mail_tag ), $cf7_mail_tag, '' |
| 48 |
); |
| 49 |
|
| 50 |
$value = apply_filters( 'wpcf7_special_mail_tags', null, $cf7_mail_tag, false, $mail_tag ); |
| 51 |
|
| 52 |
} else { |
| 53 |
if ( isset( $cf7_send_data[ $cf7_mail_tag ] ) ) { |
| 54 |
$value = $cf7_send_data[ $cf7_mail_tag ]; |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
// |
| 59 |
// Check Acceptance. |
| 60 |
// |
| 61 |
$value = kintone_form_check_acceptance( $value, $cf7_mail_tag ); |
| 62 |
|
| 63 |
if ( is_array( $value ) ) { |
| 64 |
$value = implode( "\n", $value ); |
| 65 |
} |
| 66 |
|
| 67 |
$return_data['value'] = $value; |
| 68 |
|
| 69 |
return $return_data; |
| 70 |
|
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
|