functions.phpでusces_filter_apply_addressformフックの処理できない

フォーラム 使い方全般 functions.phpでusces_filter_apply_addressformフックの処理できない

  • このトピックには14件の返信、2人の参加者があり、最後にJimmysにより9年、 11ヶ月前に更新されました。
15件の投稿を表示中 - 1 - 15件目 (全15件中)
  • 投稿者
    投稿
  • #69534
    Jimmys
    参加者

    お世話になります。
    お客様情報の入力ページでリアルタイムにエラー表示をさせるべく、下記のURLを参考にtemplate_func.phpにあるuesces_addressform処理部分をテーマファイルのfunctions.phpに追記しましたが、ローカル開発環境では「Fatal error: Allowed memory size of **** bytes exhausted …」のエラーになってしまい、本番環境(さくら共用サーバ)では何も表示されなくなってしまいます。

    もし記述方法に原因があるようでしたらご指摘いただけないでしょうか?

    ■参考URL
    http://welcustom.net/jquery-validation-engine/

    ■functions.phpに追加した処理
    add_filter( ‘usces_filter_apply_addressform’, ‘my_filter_apply_addressform’, 10, 3 );
    function my_filter_apply_addressform( $formtag, $type, $data ) { …以下省略(template_func.phpにあるuesces_addressformと同様)

    ■環境
    ——————————————-
    WordPress のバージョン:3.8.1
    Welcart のバージョン:1.3.13
    ご利用のテーマ:オリジナルテーマ
    症状を確認したブラウザ:Firefox
    サーバー(会社名、サービス名):さくらインターネット共用サーバ
    SSLの利用:なし
    WordPress のパーマリンク設定:/%category%/%post_id%/
    ——————————————–

    宜しくお願いいたします。

    #69536
    kitamuuu
    参加者

    「Fatal error: Allowed memory size of **** bytes exhausted …」のエラーが
    メモリーに関するエラーのようなので、管理画面の[Welcart Shop] > [ホーム]の中の
    「ご利用の環境」の中に書かれている内容を教えて頂けますか。

    記述は以下省略までの部分に関しては問題ないですよ。

    #69537
    Jimmys
    参加者

    kitamuu様

    お返事ありがとうございます。
    メモリエラーが表示されるローカル環境のソフトウェアの環境となります。

    サーバー:Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1
    MySQL:5.1.44
    PHP:5.3.1 memoly[global]:128M [locale]:256M [usage]:36M
    simplexml, curl, gd, json, mbstring, mysql, openssl

    メモリはwp-config.phpで512MBまで上げましたが、同様のエラーが表示されました。

    #69560
    kitamuuu
    参加者

    wp-config.phpのWP_DEBUGをfalseからtrueにし、本番環境でどのようなエラーがでるかおしえてください

    #69565
    Jimmys
    参加者

    kitamuuu様

    ご連絡ありがとうございます。
    wp-config.phpのWP_DEBUGをtrueにして本番環境で調べてみましたが、他のプラグインやテーマに関するエラーはありましたが、Welcartに関するエラーはありませんでした。

    しかしfunctions.phpでusces_filter_apply_addressformフックを有効にするとお客様情報入力の部分だけが表示されず、それ以降のHTML(フッター部分など)も表示されません。

    上記以外で考えられる原因はありそうでしょうか?

    宜しくお願いいたします。

    #69568
    kitamuuu
    参加者

    他のプラグインやテーマのエラーが起きているならば、そのエラーが原因で処理が
    中断している可能性もあるのでまずそのエラーを取り除かなければなりません。
    他のプラグインというのを停止してテーマのどんなエラーがでているかわかりますか?

    #69573
    Jimmys
    参加者

    kitamuuu様

    お世話になります。
    エラーの出ているプラグインを除いた上で表示されているエラーは以下の通りです。

    functions.phpの「add_filter( ‘usces_filter_apply_addressform’, ‘my_filter_apply_addressform’, 10, 3 );」をコメントアウトすると通常通り動作するので、以下のエラーは影響がないと思われるのですが、いかがでしょうか?

    ■エラー内容
    Notice: register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead. in /home/hoge/www/hoge/wp-includes/functions.php on line 2908
    Notice: register_widget_control is deprecated since version 2.8! Use wp_register_widget_control() instead. in /home/hoge/www/hoge/wp-includes/functions.php on line 2908

    Notice: Use of undefined constant outlet_custom_layout_background – assumed ‘outlet_custom_layout_background’ in /home/hoge/www/hoge/wp-content/themes/theme_name/includes/theme_customize.php on line 1095
    Notice: Undefined variable: custom_css in /home/hoge/www/hoge/wp-content/themes/theme_name/includes/theme_customize.php on line 1098

    #69605
    kitamuuu
    参加者

    フックした記述が原因でエラーがでているのか判断できないので、
    とりあえずフックを有効にした状態でエラーがでている箇所を修正することはできませんか?

    #69623
    Jimmys
    参加者

    kitamuuu様

    お世話になります。
    エラーを取り除きましたが、やはり状況は変わりません。
    フックの処理部分に間違いがあるかもしれません。
    フックの処理をこちらに記載した方が良いでしょうか?

    #69625
    kitamuuu
    参加者

    その前にお聞きしたいのですが、エラーを取り除いたあとには何かエラーはでていないのでしょうか?画面は表示されていますか?

    #69627
    Jimmys
    参加者

    kitamuuu様

    お世話になります。
    何もエラーが出ず、またフックから呼び出している部分から下は表示されず、HTMLのソースを見るとフックの呼び出し辺りからHTMLがない状態になっております。

    #69628
    kitamuuu
    参加者

    何か記述ミスがありそうなのでフックの内容を記述できますか?
    上にあるcodeタグで記述を挟んで投稿してみて下さい。

    #69629
    Jimmys
    参加者

    kitamuuu様

    お世話になります。
    フックのコードは以下になります。

    元々は以下のURLにある入力項目のリアルタイムチェックを行うために行いました。
    http://welcustom.net/jquery-validation-engine/

    add_filter( 'usces_filter_apply_addressform', 'my_filter_apply_addressform', 10, 3 );
    function my_filter_apply_addressform( $formtag, $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);
    	if( 'confirm' == $type ){
    	
    		switch ($applyform){
    		
    		case 'JP':
    			$formtag .= usces_custom_field_info($data, 'customer', 'name_pre', 'return');
    			$formtag .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html($values['customer']['name1']) . ' ' . esc_html($values['customer']['name2']) . '</td></tr>';
    			$furigana_customer = '<tr><th>'.__('furigana', 'usces').'</th><td>' . esc_html($values['customer']['name3']) . ' ' . esc_html($values['customer']['name4']) . '</td></tr>';
    			$formtag .= apply_filters( 'usces_filter_furigana_confirm_customer', $furigana_customer, $type, $values );
    			$formtag .= usces_custom_field_info($data, 'customer', 'name_after', 'return');
    			$customer_country = (!empty($usces_settings['country'][$values['customer']['country']])) ? $usces_settings['country'][$values['customer']['country']] : '';
    			$formtag .= '<tr><th>'.__('Zip/Postal Code', 'usces').'</th><td>' . esc_html($values['customer']['zipcode']) . '</td></tr>';
    //20131213_kitamura_start
    			if( count( $options['system']['target_market'] ) != 1 ){
    				$formtag .= '<tr><th>'.__('Country', 'usces').'</th><td>' . esc_html($customer_country) . '</td></tr>';
    			}
    //20131213_kitamura_end
    			$formtag .= '
    			<tr><th>'.__('Province', 'usces').'</th><td>' . esc_html($values['customer']['pref']) . '</td></tr>
    			<tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['customer']['address1']) . '</td></tr>
    			<tr><th>'.__('numbers', 'usces').'</th><td>' . esc_html($values['customer']['address2']) . '</td></tr>
    			<tr><th>'.__('building name', 'usces').'</th><td>' . esc_html($values['customer']['address3']) . '</td></tr>
    			<tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['customer']['tel']) . '</td></tr>
    			<tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['customer']['fax']) . '</td></tr>';
    			$formtag .= usces_custom_field_info($data, 'customer', 'fax_after', 'return');
    			
    			$shipping_address_info = '<tr class="ttl"><td colspan="2"><h3>'.__('Shipping address information', 'usces').'</h3></td></tr>';
    			$shipping_address_info .= usces_custom_field_info($data, 'delivery', 'name_pre', 'return');
    			$shipping_address_info .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html($values['delivery']['name1']) . ' ' . esc_html($values['delivery']['name2']) . '</td></tr>';
    			$furigana_delivery = '<tr><th>'.__('furigana', 'usces').'</th><td>' . esc_html($values['delivery']['name3']) . ' ' . esc_html($values['delivery']['name4']) . '</td></tr>';
    			$shipping_address_info .= apply_filters( 'usces_filter_furigana_confirm_delivery', $furigana_delivery, $type, $values );
    			$shipping_address_info .= usces_custom_field_info($values, 'delivery', 'name_after', 'return');
    			$shipping_country = (!empty($usces_settings['country'][$values['delivery']['country']])) ? $usces_settings['country'][$values['delivery']['country']] : '';
    			$shipping_address_info .= '<tr><th>'.__('Zip/Postal Code', 'usces').'</th><td>' . esc_html($values['delivery']['zipcode']) . '</td></tr>';
    //20131213_kitamura_start
    			if( count( $options['system']['target_market'] ) != 1 ){
    				$shipping_address_info .= '<tr><th>'.__('Country', 'usces').'</th><td>' .  esc_html($shipping_country) . '</td></tr>';
    			}
    //20131213_kitamura_end
    			$shipping_address_info .= '
    			<tr><th>'.__('Province', 'usces').'</th><td>' . esc_html($values['delivery']['pref']) . '</td></tr>
    			<tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['delivery']['address1']) . '</td></tr>
    			<tr><th>'.__('numbers', 'usces').'</th><td>' . esc_html($values['delivery']['address2']) . '</td></tr>
    			<tr><th>'.__('building name', 'usces').'</th><td>' . esc_html($values['delivery']['address3']) . '</td></tr>
    			<tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['delivery']['tel']) . '</td></tr>
    			<tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['delivery']['fax']) . '</td></tr>';
    			$shipping_address_info .= usces_custom_field_info($data, 'delivery', 'fax_after', 'return');
    			$formtag .= apply_filters('usces_filter_shipping_address_info', $shipping_address_info);
    			break;
    			
    		case 'CN':
    			$formtag .= usces_custom_field_info($data, 'customer', 'name_pre', 'return');
    			$formtag .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html(usces_localized_name( $values['customer']['name1'], $values['customer']['name2'], 'return' )) . '</td></tr>';
    			$formtag .= usces_custom_field_info($data, 'customer', 'name_after', 'return');
    //20131213_kitamura_start
    			if( count( $options['system']['target_market'] ) != 1 ){
    				$formtag .= '<tr><th>'.__('Country', 'usces').'</th><td>' . esc_html($usces_settings['country'][$values['customer']['country']]) . '</td></tr>';
    			}
    //20131213_kitamura_end
    			$formtag .= '
    			<tr><th>'.__('State', 'usces').'</th><td>' . esc_html($values['customer']['pref']) . '</td></tr>
    			<tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['customer']['address1']) . '</td></tr>
    			<tr><th>'.__('Address Line1', 'usces').'</th><td>' . esc_html($values['customer']['address2']) . '</td></tr>
    			<tr><th>'.__('Address Line2', 'usces').'</th><td>' . esc_html($values['customer']['address3']) . '</td></tr>
    			<tr><th>'.__('Zip', 'usces').'</th><td>' . esc_html($values['customer']['zipcode']) . '</td></tr>
    			<tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['customer']['tel']) . '</td></tr>
    			<tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['customer']['fax']) . '</td></tr>';
    			$formtag .= usces_custom_field_info($data, 'customer', 'fax_after', 'return');
    			
    			$shipping_address_info = '<tr class="ttl"><td colspan="2"><h3>'.__('Shipping address information', 'usces').'</h3></td></tr>';
    			$shipping_address_info .= usces_custom_field_info($data, 'delivery', 'name_pre', 'return');
    			$shipping_address_info .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html(usces_localized_name( $values['delivery']['name1'], $values['delivery']['name2'], 'return' )) . '</td></tr>';
    			$shipping_address_info .= usces_custom_field_info($data, 'delivery', 'name_after', 'return');
    //20131213_kitamura_start
    			if( count( $options['system']['target_market'] ) != 1 ){
    				$shipping_address_info .= '<tr><th>'.__('Country', 'usces').'</th><td>' . esc_html($usces_settings['country'][$values['delivery']['country']]) . '</td></tr>';
    			}
    //20131213_kitamura_end
    			$shipping_address_info .= '
    			<tr><th>'.__('State', 'usces').'</th><td>' . esc_html($values['delivery']['pref']) . '</td></tr>
    			<tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['delivery']['address1']) . '</td></tr>
    			<tr><th>'.__('Address Line1', 'usces').'</th><td>' . esc_html($values['delivery']['address2']) . '</td></tr>
    			<tr><th>'.__('Address Line2', 'usces').'</th><td>' . esc_html($values['delivery']['address3']) . '</td></tr>
    			<tr><th>'.__('Zip', 'usces').'</th><td>' . esc_html($values['delivery']['zipcode']) . '</td></tr>
    			<tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['delivery']['tel']) . '</td></tr>
    			<tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['delivery']['fax']) . '</td></tr>';
    			$shipping_address_info .= usces_custom_field_info($data, 'delivery', 'fax_after', 'return');
    			$formtag .= apply_filters('usces_filter_shipping_address_info', $shipping_address_info);
    			break;
    			
    		case 'US':
    		default :
    			$formtag .= usces_custom_field_info($data, 'customer', 'name_pre', 'return');
    			$formtag .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html($values['customer']['name2']) . ' ' . esc_html($values['customer']['name1']) . '</td></tr>';
    			$formtag .= usces_custom_field_info($data, 'customer', 'name_after', 'return');
    			$customer_country = (!empty($usces_settings['country'][$values['customer']['country']])) ? $usces_settings['country'][$values['customer']['country']] : '';
    			$formtag .= '
    			<tr><th>'.__('Address Line1', 'usces').'</th><td>' . esc_html($values['customer']['address2']) . '</td></tr>
    			<tr><th>'.__('Address Line2', 'usces').'</th><td>' . esc_html($values['customer']['address3']) . '</td></tr>
    			<tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['customer']['address1']) . '</td></tr>
    			<tr><th>'.__('State', 'usces').'</th><td>' . esc_html($values['customer']['pref']) . '</td></tr>';
    
    //20131213_kitamura_start
    			if( count( $options['system']['target_market'] ) != 1 ){
    				$formtag .= '<tr><th>'.__('Country', 'usces').'</th><td>' . esc_html($customer_country) . '</td></tr>';
    			}
    //20131213_kitamura_end
    			$formtag .= '
    			<tr><th>'.__('Zip', 'usces').'</th><td>' . esc_html($values['customer']['zipcode']) . '</td></tr>
    			<tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['customer']['tel']) . '</td></tr>
    			<tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['customer']['fax']) . '</td></tr>';
    			$formtag .= usces_custom_field_info($data, 'customer', 'fax_after', 'return');
    			
    			$shipping_address_info = '<tr class="ttl"><td colspan="2"><h3>'.__('Shipping address information', 'usces').'</h3></td></tr>';
    			$shipping_address_info .= usces_custom_field_info($data, 'delivery', 'name_pre', 'return');
    			$shipping_address_info .= '<tr><th>'.__('Full name', 'usces').'</th><td>' . esc_html($values['delivery']['name2']) . ' ' . esc_html($values['delivery']['name1']) . '</td></tr>';
    			$shipping_address_info .= usces_custom_field_info($data, 'delivery', 'name_after', 'return');
    			$shipping_country = (!empty($usces_settings['country'][$values['delivery']['country']])) ? $usces_settings['country'][$values['delivery']['country']] : '';
    			$shipping_address_info .= '
    			<tr><th>'.__('Address Line1', 'usces').'</th><td>' . esc_html($values['delivery']['address2']) . '</td></tr>
    			<tr><th>'.__('Address Line2', 'usces').'</th><td>' . esc_html($values['delivery']['address3']) . '</td></tr>
    			<tr><th>'.__('city', 'usces').'</th><td>' . esc_html($values['delivery']['address1']) . '</td></tr>
    			<tr><th>'.__('State', 'usces').'</th><td>' . esc_html($values['delivery']['pref']) . '</td></tr>';
    //20131213_kitamura_start
    			if( count( $options['system']['target_market'] ) != 1 ){
    				$shipping_address_info .= '<tr><th>'.__('Country', 'usces').'</th><td>' . esc_html($shipping_country) . '</td></tr>';
    			}
    //20131213_kitamura_end
    			$shipping_address_info .= '
    			<tr><th>'.__('Zip', 'usces').'</th><td>' . esc_html($values['delivery']['zipcode']) . '</td></tr>
    			<tr><th>'.__('Phone number', 'usces').'</th><td>' . esc_html($values['delivery']['tel']) . '</td></tr>
    			<tr><th>'.__('FAX number', 'usces').'</th><td>' . esc_html($values['delivery']['fax']) . '</td></tr>';
    			$shipping_address_info .= usces_custom_field_info($data, 'delivery', 'fax_after', 'return');
    			$formtag .= apply_filters('usces_filter_shipping_address_info', $shipping_address_info);
    			break;
    			
    		}
    		$res = apply_filters('usces_filter_apply_addressform_confirm', $formtag, $type, $data);
    	
    	}else{
    	
    		switch ($applyform){
    		
    		case 'JP':
    			$formtag .= usces_custom_field_input($data, $type, 'name_pre', 'return');
    			$formtag .= '<tr class="inp1">
    			<th width="127" scope="row">' . usces_get_essential_mark('name1', $data) . __('Full name', 'usces').'</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 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>';
    			$formtag .= apply_filters( 'usces_filter_furigana_form', $furigana, $type, $values );
    			$formtag .= usces_custom_field_input($data, $type, 'name_after', 'return');
    			$formtag .= '<tr>
    			<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" />'.apply_filters('usces_filter_addressform_zipcode', NULL, $type) . apply_filters( 'usces_filter_after_zipcode', '100-1000', $applyform ) . '</td>
    			</tr>';
    //20131213_kitamura_start
    			if( count( $options['system']['target_market'] ) == 1 ){
    				$formtag .= '<input type="hidden" name="' .$type. '[country]" id="' .$type. '_country" value="' .$options['system']['target_market'][0]. '">';
    			}else{
    				$formtag .= '<tr>
    				<th scope="row">' . usces_get_essential_mark('country', $data) . __('Country', 'usces') . '</th>
    				<td colspan="2">' . uesces_get_target_market_form( $type, $values['country'] ) . apply_filters( 'usces_filter_after_country', NULL, $applyform ) . '</td>
    				</tr>';
    			}
    //20131213_kitamura_end
    			$formtag .= '<tr>
    			<th scope="row">' . usces_get_essential_mark('states', $data).__('Province', 'usces').'</th>
    			<td colspan="2">' . usces_pref_select( $type, $values ) . apply_filters( 'usces_filter_after_states', NULL, $applyform ) . '</td>
    			</tr>
    			<tr 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" />' . apply_filters( 'usces_filter_after_address1', __('Kitakami Yokohama', 'usces'), $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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" />' . apply_filters( 'usces_filter_after_address2', '3-24-555', $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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" />' . apply_filters( 'usces_filter_after_address3', __('tuhanbuild 4F', 'usces'), $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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" />' . apply_filters( 'usces_filter_after_tel', '1000-10-1000', $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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" />' . apply_filters( 'usces_filter_after_fax', '1000-10-1000', $applyform ) . '</td>
    			</tr>';
    			$formtag .= usces_custom_field_input($data, $type, 'fax_after', 'return');
    			break;
    			
    		case 'CN':
    			$formtag .= usces_custom_field_input($data, $type, 'name_pre', 'return');
    			$formtag .= '<tr class="inp1">
    			<th scope="row">' . usces_get_essential_mark('name1', $data) . __('Full name', 'usces') . '</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>';
    			$formtag .= usces_custom_field_input($data, $type, 'name_after', 'return');
    //20131213_kitamura_start
    			if( count( $options['system']['target_market'] ) == 1 ){
    				$formtag .= '<input type="hidden" name="' .$type. '[country]" id="' .$type. '_country" value="' .$options['system']['target_market'][0]. '">';
    			}else{
    				$formtag .= '<tr>
    				<th scope="row">' . usces_get_essential_mark('country', $data) . __('Country', 'usces') . '</th>
    				<td colspan="2">' . uesces_get_target_market_form( $type, $values['country'] ) . apply_filters( 'usces_filter_after_country', NULL, $applyform ) . '</td>
    				</tr>';
    			}
    //20131213_kitamura_end
    			$formtag .= '<tr>
    			<th scope="row">' . usces_get_essential_mark('states', $data) . __('State', 'usces') . '</th>
    			<td colspan="2">' . usces_pref_select( $type, $values ) . apply_filters( 'usces_filter_after_states', NULL, $applyform ) . '</td>
    			</tr>
    			<tr 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;}" />' . apply_filters( 'usces_filter_after_address1', NULL, $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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;}" />' . apply_filters( 'usces_filter_after_address2', NULL, $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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;}" />' . apply_filters( 'usces_filter_after_address3', NULL, $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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;}" />' . apply_filters( 'usces_filter_after_zipcode', NULL, $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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;}" />' . apply_filters( 'usces_filter_after_tel', NULL, $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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;}" />' . apply_filters( 'usces_filter_after_fax', NULL, $applyform ) . '</td>
    			</tr>';
    			$formtag .= usces_custom_field_input($data, $type, 'fax_after', 'return');
    			break;
    			
    		case 'US':
    		default :
    			$formtag .= usces_custom_field_input($data, $type, 'name_pre', 'return');
    			$formtag .= '<tr class="inp1">
    			<th scope="row">' . usces_get_essential_mark('name1', $data) . __('Full name', 'usces') . '</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>';
    			$formtag .= usces_custom_field_input($data, $type, 'name_after', 'return');
    			$formtag .= '
    			<tr>
    			<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;}" />' . apply_filters( 'usces_filter_after_address2', NULL, $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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;}" />' . apply_filters( 'usces_filter_after_address3', NULL, $applyform ) . '</td>
    			</tr>
    			<tr 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;}" />' . apply_filters( 'usces_filter_after_address1', NULL, $applyform ) . '</td>
    			</tr>
    			<tr>
    			<th scope="row">' . usces_get_essential_mark('states', $data) . __('State', 'usces') . '</th>
    			<td colspan="2">' . usces_pref_select( $type, $values ) . apply_filters( 'usces_filter_after_states', NULL, $applyform ) . '</td>
    			</tr>';
    //20131213_kitamura_start
    			if( count( $options['system']['target_market'] ) == 1 ){
    				$formtag .= '<input type="hidden" name="' .$type. '[country]" id="' .$type. '_country" value="' .$options['system']['target_market'][0]. '">';
    			}else{
    				$formtag .= '<tr>
    				<th scope="row">' . usces_get_essential_mark('country', $data) . __('Country', 'usces') . '</th>
    				<td colspan="2">' . uesces_get_target_market_form( $type, $values['country'] ) . apply_filters( 'usces_filter_after_country', NULL, $applyform ) . '</td>
    				</tr>';
    			}
    //20131213_kitamura_end
    			$formtag .= '<tr>
    			<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;}"  />' . apply_filters( 'usces_filter_after_zipcode', NULL, $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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;}" />' . apply_filters( 'usces_filter_after_tel', NULL, $applyform ) . '</td>
    			</tr>
    			<tr>
    			<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;}" />' . apply_filters( 'usces_filter_after_fax', NULL, $applyform ) . '</td>
    			</tr>';
    			$formtag .= usces_custom_field_input($data, $type, 'fax_after', 'return');
    			break;
    		}
    		$res = apply_filters('usces_filter_apply_addressform', $formtag, $type, $data);
    	
    	}
    
    	if($out == 'return') {
    		return $res;
    	} else {
    		echo $res;
    	}
    }
    
    #69631
    kitamuuu
    参加者

    フックした記述の中でフックしているフィルター名と同じ名前のものを作成(apply_filters)してしまっているので無限にループしていました。

    一番最後の

    
    $res = apply_filters('usces_filter_apply_addressform', $formtag, $type, $data);
    	
    	}
    
    	if($out == 'return') {
    		return $res;
    	} else {
    		echo $res;
    	}
    }
    

    という記述を以下の記述で上書きしてみて下さい

    
        }
    	return $formtag;
    }
    

    これでとりあえずエラーは消えるはずです。

    • この返信は9年、 11ヶ月前にkitamuuuが編集しました。
    • この返信は9年、 11ヶ月前にkitamuuuが編集しました。
    #69636
    Jimmys
    参加者

    kitamuuu様

    お陰様で無事表示されました。
    こちらのミスで巻き込んでしまい申し訳ありませんでした。
    また、最後までお付き合いいただき本当に助かりました。

    改めてお礼申し上げます。

    ありがとうございました。

15件の投稿を表示中 - 1 - 15件目 (全15件中)
  • このトピックに返信するにはログインが必要です。