関数
GiftForm::customerAddressForm( string $type, array $data )
ギフト発送のための顧客住所入力フォームを出力する
パラメータ パラメータ
- $type
(文字列) (必須)
- $data
(配列) (必須)
ファイル: src/Components/GiftForm/GiftForm.php
public function customerAddressForm($type, $data) { global $usces, $usces_settings; $options = get_option('usces'); $form = $options['system']['addressform']; $nameform = $usces_settings['nameform'][$form]; $applyform = usces_get_apply_addressform($form); $formtag = ''; switch ($type) { case 'confirm': case 'member': $values = $data; break; case 'customer': case 'delivery': $values = $data[$type]; break; } $data['type'] = $type; $values['country'] = !empty($values['country']) ? $values['country'] : usces_get_local_addressform(); $values = $usces->stripslashes_deep_post($values); $target_market_count = (isset($options['system']['target_market']) && is_array($options['system']['target_market'])) ? count($options['system']['target_market']) : 1; /** * Mirrored Welcart filter * * @ignore */ $addressnlabel = apply_filters('usces_filters_addressform_name_label', __('Full name', 'usces'), $type, $values, $applyform); /** * Mirrored Welcart filter * * @ignore */ $aftercountry = apply_filters('usces_filter_after_country', null, $applyform); /** * Mirrored Welcart filter * * @ignore */ $afterstates = apply_filters('usces_filter_after_states', null, $applyform); switch ($applyform) { case 'JP': $formtag .= '<tr id="name_row" class="inp1"> <th width="127" scope="row">' . usces_get_essential_mark('name1', $data) . $addressnlabel . '</th>'; if ($nameform) { $formtag .= '<td class="name_td">' . __('Given name', 'usces') . '<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>'; $formtag .= '<td class="name_td">' . __('Familly name', 'usces') . '<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>'; } else { $formtag .= '<td class="name_td">' . __('Familly name', 'usces') . '<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>'; $formtag .= '<td class="name_td">' . __('Given name', 'usces') . '<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>'; } $formtag .= '</tr>'; $furigana = '<tr id="furikana_row" class="inp1"> <th scope="row">' . usces_get_essential_mark('name3', $data) . __('furigana', 'usces') . '</th>'; if ($nameform) { $furigana .= '<td>' . __('Given name', 'usces') . '<input name="' . $type . '[name4]" id="name4" type="text" value="' . esc_attr($values['name4']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>'; $furigana .= '<td>' . __('Familly name', 'usces') . '<input name="' . $type . '[name3]" id="name3" type="text" value="' . esc_attr($values['name3']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>'; } else { $furigana .= '<td>' . __('Familly name', 'usces') . '<input name="' . $type . '[name3]" id="name3" type="text" value="' . esc_attr($values['name3']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>'; $furigana .= '<td>' . __('Given name', 'usces') . '<input name="' . $type . '[name4]" id="name4" type="text" value="' . esc_attr($values['name4']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" /></td>'; } $furigana .= '</tr>'; /** * Mirrored Welcart filter * * @ignore */ $formtag .= apply_filters('usces_filter_furigana_form', $furigana, $type, $values); /** * Mirrored Welcart filter * * @ignore */ $addressformzip = apply_filters('usces_filter_addressform_zipcode', null, $type); /** * Mirrored Welcart filter * * @ignore */ $afterzip = apply_filters('usces_filter_after_zipcode', '100-1000', $applyform); $formtag .= '<tr id="zipcode_row"> <th scope="row">' . usces_get_essential_mark('zipcode', $data) . __('Zip/Postal Code', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[zipcode]" id="zipcode" type="text" value="' . esc_attr($values['zipcode']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: inactive" />' . usces_postal_code_address_search($type) . $addressformzip . $afterzip . '</td> </tr>'; if (1 < $target_market_count) { $formtag .= '<tr id="country_row"> <th scope="row">' . usces_get_essential_mark('country', $data) . __('Country', 'usces') . '</th> <td colspan="2">' . uesces_get_target_market_form($type, $values['country']) . $aftercountry . '</td> </tr>'; } else { $formtag .= '<input type="hidden" name="' . $type . '[country]" id="' . $type . '_country" value="' . $options['system']['target_market'][0] . '">'; } /** * Mirrored Welcart filter * * @ignore */ $afteraddress1 = apply_filters('usces_filter_after_address1', __('Kitakami Yokohama', 'usces'), $applyform); /** * Mirrored Welcart filter * * @ignore */ $afteraddress2 = apply_filters('usces_filter_after_address2', '3-24-555', $applyform); /** * Mirrored Welcart filter * * @ignore */ $afteraddress3 = apply_filters('usces_filter_after_address3', __('tuhanbuild 4F', 'usces'), $applyform); /** * Mirrored Welcart filter * * @ignore */ $aftertel = apply_filters('usces_filter_after_tel', '1000-10-1000', $applyform); /** * Mirrored Welcart filter * * @ignore */ $afterfax = apply_filters('usces_filter_after_fax', '1000-10-1000', $applyform); $formtag .= '<tr id="states_row"> <th scope="row">' . usces_get_essential_mark('states', $data) . __('Province', 'usces') . '</th> <td colspan="2">' . usces_pref_select($type, $values) . $afterstates . '</td> </tr> <tr id="address1_row" class="inp2"> <th scope="row">' . usces_get_essential_mark('address1', $data) . __('city', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[address1]" id="address1" type="text" value="' . esc_attr($values['address1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" />' . $afteraddress1 . '</td> </tr> <tr id="address2_row"> <th scope="row">' . usces_get_essential_mark('address2', $data) . __('numbers', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[address2]" id="address2" type="text" value="' . esc_attr($values['address2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" />' . $afteraddress2 . '</td> </tr> <tr id="address3_row"> <th scope="row">' . usces_get_essential_mark('address3', $data) . __('building name', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[address3]" id="address3" type="text" value="' . esc_attr($values['address3']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: active" />' . $afteraddress3 . '</td> </tr> <tr id="tel_row"> <th scope="row">' . usces_get_essential_mark('tel', $data) . __('Phone number', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[tel]" id="tel" type="text" value="' . esc_attr($values['tel']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: inactive" />' . $aftertel . '</td> </tr> <tr id="fax_row"> <th scope="row">' . usces_get_essential_mark('fax', $data) . __('FAX number', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[fax]" id="fax" type="text" value="' . esc_attr($values['fax']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" style="ime-mode: inactive" />' . $afterfax . '</td> </tr>'; break; case 'CN': $formtag .= '<tr id="name_row" class="inp1"> <th scope="row">' . usces_get_essential_mark('name1', $data) . $addressnlabel . '</th>'; if ($nameform) { $formtag .= '<td>' . __('Given name', 'usces') . '<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>'; $formtag .= '<td>' . __('Familly name', 'usces') . '<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>'; } else { $formtag .= '<td>' . __('Familly name', 'usces') . '<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>'; $formtag .= '<td>' . __('Given name', 'usces') . '<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>'; } $formtag .= '</tr>'; if (1 < $target_market_count) { $formtag .= '<tr id="country_row"> <th scope="row">' . usces_get_essential_mark('country', $data) . __('Country', 'usces') . '</th> <td colspan="2">' . uesces_get_target_market_form($type, $values['country']) . $aftercountry . '</td> </tr>'; } else { $formtag .= '<input type="hidden" name="' . $type . '[country]" id="' . $type . '_country" value="' . $options['system']['target_market'][0] . '">'; } /** * Mirrored Welcart filter * * @ignore */ $cnafteraddress1 = apply_filters('usces_filter_after_address1', null, $applyform); /** * Mirrored Welcart filter * * @ignore */ $cnafteraddress2 = apply_filters('usces_filter_after_address2', null, $applyform); /** * Mirrored Welcart filter * * @ignore */ $cnafteraddress3 = apply_filters('usces_filter_after_address3', null, $applyform); /** * Mirrored Welcart filter * * @ignore */ $cnafterzip = apply_filters('usces_filter_after_zipcode', null, $applyform); /** * Mirrored Welcart filter * * @ignore */ $cnaftertel = apply_filters('usces_filter_after_tel', null, $applyform); /** * Mirrored Welcart filter * * @ignore */ $cnafterfax = apply_filters('usces_filter_after_fax', null, $applyform); $formtag .= '<tr id="states_row"> <th scope="row">' . usces_get_essential_mark('states', $data) . __('State', 'usces') . '</th> <td colspan="2">' . usces_pref_select($type, $values) . $afterstates . '</td> </tr> <tr id="address1_row" class="inp2"> <th scope="row">' . usces_get_essential_mark('address1', $data) . __('city', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[address1]" id="address1" type="text" value="' . esc_attr($values['address1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $cnafteraddress1 . '</td> </tr> <tr id="address2_row"> <th scope="row">' . usces_get_essential_mark('address2', $data) . __('Address Line1', 'usces') . '</th> <td colspan="2">' . __('Street address', 'usces') . '<br /><input name="' . $type . '[address2]" id="address2" type="text" value="' . esc_attr($values['address2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $cnafteraddress2 . '</td> </tr> <tr id="address3_row"> <th scope="row">' . usces_get_essential_mark('address3', $data) . __('Address Line2', 'usces') . '</th> <td colspan="2">' . __('Apartment, building, etc.', 'usces') . '<br /><input name="' . $type . '[address3]" id="address3" type="text" value="' . esc_attr($values['address3']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $cnafteraddress3 . '</td> </tr> <tr id="zipcode_row"> <th scope="row">' . usces_get_essential_mark('zipcode', $data) . __('Zip', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[zipcode]" id="zipcode" type="text" value="' . esc_attr($values['zipcode']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $cnafterzip . '</td> </tr> <tr id="tel_row"> <th scope="row">' . usces_get_essential_mark('tel', $data) . __('Phone number', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[tel]" id="tel" type="text" value="' . esc_attr($values['tel']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $cnaftertel . '</td> </tr> <tr id="fax_row"> <th scope="row">' . usces_get_essential_mark('fax', $data) . __('FAX number', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[fax]" id="fax" type="text" value="' . esc_attr($values['fax']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $cnafterfax . '</td> </tr>'; break; case 'US': default: $formtag .= '<tr id="name_row" class="inp1"> <th scope="row">' . usces_get_essential_mark('name1', $data) . $addressnlabel . '</th>'; if ($nameform) { $formtag .= '<td>' . __('Given name', 'usces') . '<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>'; $formtag .= '<td>' . __('Familly name', 'usces') . '<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>'; } else { $formtag .= '<td>' . __('Familly name', 'usces') . '<input name="' . $type . '[name1]" id="name1" type="text" value="' . esc_attr($values['name1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>'; $formtag .= '<td>' . __('Given name', 'usces') . '<input name="' . $type . '[name2]" id="name2" type="text" value="' . esc_attr($values['name2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" /></td>'; } /** * Mirrored Welcart filter * * @ignore */ $usafteraddress1 = apply_filters('usces_filter_after_address1', null, $applyform); /** * Mirrored Welcart filter * * @ignore */ $usafteraddress2 = apply_filters('usces_filter_after_address2', null, $applyform); /** * Mirrored Welcart filter * * @ignore */ $usafteraddress3 = apply_filters('usces_filter_after_address3', null, $applyform); /** * Mirrored Welcart filter * * @ignore */ $usafterzip = apply_filters('usces_filter_after_zipcode', null, $applyform); /** * Mirrored Welcart filter * * @ignore */ $usaftertel = apply_filters('usces_filter_after_tel', null, $applyform); /** * Mirrored Welcart filter * * @ignore */ $usafterfax = apply_filters('usces_filter_after_fax', null, $applyform); $formtag .= '</tr>'; $formtag .= ' <tr id="address2_row"> <th scope="row">' . usces_get_essential_mark('address2', $data) . __('Address Line1', 'usces') . '</th> <td colspan="2">' . __('Street address', 'usces') . '<br /><input name="' . $type . '[address2]" id="address2" type="text" value="' . esc_attr($values['address2']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $usafteraddress2 . '</td> </tr> <tr id="address3_row"> <th scope="row">' . usces_get_essential_mark('address3', $data) . __('Address Line2', 'usces') . '</th> <td colspan="2">' . __('Apartment, building, etc.', 'usces') . '<br /><input name="' . $type . '[address3]" id="address3" type="text" value="' . esc_attr($values['address3']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $usafteraddress3 . '</td> </tr> <tr id="address1_row" class="inp2"> <th scope="row">' . usces_get_essential_mark('address1', $data) . __('city', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[address1]" id="address1" type="text" value="' . esc_attr($values['address1']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $usafteraddress1 . '</td> </tr> <tr id="states_row"> <th scope="row">' . usces_get_essential_mark('states', $data) . __('State', 'usces') . '</th> <td colspan="2">' . usces_pref_select($type, $values) . $afterstates . '</td> </tr>'; if (1 < $target_market_count) { $formtag .= '<tr id="country_row"> <th scope="row">' . usces_get_essential_mark('country', $data) . __('Country', 'usces') . '</th> <td colspan="2">' . uesces_get_target_market_form($type, $values['country']) . $aftercountry . '</td> </tr>'; } else { $formtag .= '<input type="hidden" name="' . $type . '[country]" id="' . $type . '_country" value="' . esc_attr($options['system']['target_market'][0]) . '">'; } $formtag .= '<tr id="zipcode_row"> <th scope="row">' . usces_get_essential_mark('zipcode', $data) . __('Zip', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[zipcode]" id="zipcode" type="text" value="' . esc_attr($values['zipcode']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $usafterzip . '</td> </tr> <tr id="tel_row"> <th scope="row">' . usces_get_essential_mark('tel', $data) . __('Phone number', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[tel]" id="tel" type="text" value="' . esc_attr($values['tel']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $usaftertel . '</td> </tr> <tr id="fax_row"> <th scope="row">' . usces_get_essential_mark('fax', $data) . __('FAX number', 'usces') . '</th> <td colspan="2"><input name="' . $type . '[fax]" id="fax" type="text" value="' . esc_attr($values['fax']) . '" onKeyDown="if (event.keyCode == 13) {return false;}" />' . $usafterfax . '</td> </tr>'; break; } echo $formtag; }