function delete_delivery_days()
 {
     $delivery_days = wc2_get_option('delivery_days');
     $id = (int) $_POST['id'];
     for ($i = 0; $i < count($delivery_days); $i++) {
         if ($delivery_days[$i]['id'] === $id) {
             $index = $i;
         }
     }
     array_splice($delivery_days, $index, 1);
     $res = wc2_update_option('delivery_days', $delivery_days);
     if ($res !== NULL) {
         $data_val = array('id' => $id);
         $data = array('message' => __('Updated!'), 'value' => $data_val);
         wp_send_json_success($data);
     } else {
         //error
         $data = array('message' => __('Update Failed'));
         wp_send_json_error($data);
     }
 }
Example #2
0
 private function check_display_mode()
 {
     $general_options = wc2_get_option('general');
     if (isset($general_options['display_mode']) && $general_options['display_mode'] == 'Maintenancemode') {
         return;
     }
     $start['hour'] = empty($general_options['campaign_schedule']['start']['hour']) ? 0 : $general_options['campaign_schedule']['start']['hour'];
     $start['min'] = empty($general_options['campaign_schedule']['start']['min']) ? 0 : $general_options['campaign_schedule']['start']['min'];
     $start['month'] = empty($general_options['campaign_schedule']['start']['month']) ? 0 : $general_options['campaign_schedule']['start']['month'];
     $start['day'] = empty($general_options['campaign_schedule']['start']['day']) ? 0 : $general_options['campaign_schedule']['start']['day'];
     $start['year'] = empty($general_options['campaign_schedule']['start']['year']) ? 0 : $general_options['campaign_schedule']['start']['year'];
     $end['hour'] = empty($general_options['campaign_schedule']['end']['hour']) ? 0 : $general_options['campaign_schedule']['end']['hour'];
     $end['min'] = empty($general_options['campaign_schedule']['end']['min']) ? 0 : $general_options['campaign_schedule']['end']['min'];
     $end['month'] = empty($general_options['campaign_schedule']['end']['month']) ? 0 : $general_options['campaign_schedule']['end']['month'];
     $end['day'] = empty($general_options['campaign_schedule']['end']['day']) ? 0 : $general_options['campaign_schedule']['end']['day'];
     $end['year'] = empty($general_options['campaign_schedule']['end']['year']) ? 0 : $general_options['campaign_schedule']['end']['year'];
     $starttime = mktime($start['hour'], $start['min'], 0, $start['month'], $start['day'], $start['year']);
     $endtime = mktime($end['hour'], $end['min'], 0, $end['month'], $end['day'], $end['year']);
     $current_time = current_time('timestamp');
     if ($current_time >= $starttime && $current_time <= $endtime) {
         $general_options['display_mode'] = 'Promotionsale';
     } else {
         $general_options['display_mode'] = 'Usualsale';
     }
     wc2_update_option('general', $general_options);
 }
Example #3
0
function wc2_initial_setting()
{
    //Member rank
    $rank_type = wc2_get_option('rank_type');
    //if( empty($rank_type) ) {
    $rank_type = array('0' => __('Normal member', 'wc2'), '1' => __('Excellent member', 'wc2'), '2' => __('VIP member', 'wc2'), '99' => __('Bad member', 'wc2'));
    //}
    $rank_type = apply_filters('wc2_filter_rank_type', $rank_type);
    wc2_update_option('rank_type', $rank_type);
    //Admin screen label
    $admin_screen_label = wc2_get_option('admin_screen_label');
    //if( empty($admin_screen_label) ) {
    $admin_screen_label = array('order' => __('Order', 'wc2'), 'member' => __('Member', 'wc2'), 'general' => __('General', 'wc2'), 'phrase' => __('Phrase', 'wc2'), 'payment' => __('Payment', 'wc2'), 'delivery' => __('Delivery', 'wc2'), 'system' => __('System', 'wc2'), 'customfield' => __('Custom field', 'wc2'));
    //}
    $admin_screen_label = apply_filters('wc2_filter_admin_screen_label', $admin_screen_label);
    wc2_update_option('admin_screen_label', $admin_screen_label);
    //Stock status
    $stock_status = wc2_get_option('stock_status');
    //if( empty($stock_status) ) {
    $stock_status = array('0' => __('In stock', 'wc2'), '10' => __('Little stock', 'wc2'), '20' => __('Sold Out', 'wc2'), '30' => __('Out Of Stock', 'wc2'), '90' => __('Discontinued', 'wc2'));
    //}
    $stock_status = apply_filters('wc2_filter_stock_status', $stock_status);
    wc2_update_option('stock_status', $stock_status);
    //Management status
    $management_status = wc2_get_option('management_status');
    //if( empty($management_status) ) {
    $management_status = array('new' => __('New order', 'wc2'), 'backordered' => __('Backordered', 'wc2'), 'cancel' => __('Cancel', 'wc2'), 'completion' => __('Shipped', 'wc2'));
    //}
    $management_status = apply_filters('wc2_filter_management_status', $management_status);
    wc2_update_option('management_status', $management_status);
    $receipt_status = wc2_get_option('receipt_status');
    //if( empty($receipt_status) ) {
    $receipt_status = array('unpaid' => __('Unpaid', 'wc2'), 'paid' => __('Payment confirmed', 'wc2'), 'pending' => __('Pending', 'wc2'));
    //}
    $receipt_status = apply_filters('wc2_filter_receipt_status', $receipt_status);
    wc2_update_option('receipt_status', $receipt_status);
    $order_type = wc2_get_option('order_type');
    //if( empty($order_type) ) {
    $order_type = array('' => __('Normal order', 'wc2'), 'estimate' => __('Estimates', 'wc2'), 'adminorder' => __('Management order', 'wc2'));
    //}
    $order_type = apply_filters('wc2_filter_order_type', $order_type);
    wc2_update_option('order_type', $order_type);
    //Display mode
    $display_mode_label = wc2_get_option('display_mode_label');
    //if( empty($display_mode_label) ) {
    $display_mode_label = array('Usualsale' => __('Open', 'wc2'), 'Promotionsale' => __('Campaign Sale', 'wc2'), 'Maintenancemode' => __('Maintenance Mode', 'wc2'));
    //}
    $display_mode_label = apply_filters('wc2_filter_display_mode_label', $display_mode_label);
    wc2_update_option('display_mode_label', $display_mode_label);
    //Shipping rule
    $shipping_rule = wc2_get_option('shipping_rule');
    //if( empty($shipping_rule) ) {
    $shipping_rule['preparations'] = array('0' => __('-- Select --', 'wc2'), '1' => __('Same day', 'wc2'), '2' => __('1-2 days', 'wc2'), '3' => __('2-3 days', 'wc2'), '4' => __('3-5 days', 'wc2'), '5' => __('4-6 days', 'wc2'), '6' => __('About 1 week later', 'wc2'), '7' => __('About 2 weeks later', 'wc2'), '8' => __('About 3 weeks later', 'wc2'), '9' => __('Stock after', 'wc2'));
    $shipping_rule['indication'] = array(0, 0, 2, 3, 5, 6, 7, 14, 21, 0);
    //}
    $shipping_rule = apply_filters('wc2_filter_shipping_rule', $shipping_rule);
    wc2_update_option('shipping_rule', $shipping_rule);
    //Locale default value
    $locale = wc2_get_option('locale_options');
    //if( empty($locale) ) {
    $locale['language'] = array();
    $languages = wc2_get_languages();
    foreach ($languages as $l) {
        $locale['language'][$l] = $l;
    }
    $locale['language']['others'] = __('Follow config.php', 'wc2');
    $locale['currency'] = array('AR' => array('ARS', 2, '.', ',', '$'), 'AU' => array('AUD', 2, '.', ',', '$'), 'AT' => array('EUR', 2, '.', ',', '&#x20AC;'), 'BE' => array('EUR', 2, '.', ',', '&#x20AC;'), 'BR' => array('BRL', 2, '.', ',', '$'), 'CA' => array('CAD', 2, '.', ',', '$'), 'CL' => array('CLP', 2, '.', ',', '$'), 'CN' => array('CNY', 2, '.', ',', '&yen;'), 'CR' => array('CRC', 2, '.', ',', '₡'), 'CZ' => array('CZK', 2, '.', ',', 'Kč'), 'DK' => array('DKK', 2, '.', ',', 'kr'), 'DO' => array('DOP', 2, '.', ',', 'RD$'), 'FI' => array('EUR', 2, '.', ',', '&#x20AC;'), 'FR' => array('EUR', 2, '.', ',', '&#x20AC;'), 'DE' => array('EUR', 2, '.', ',', '&#x20AC;'), 'GR' => array('EUR', 2, '.', ',', '&#x20AC;'), 'GT' => array('GTQ', 2, '.', ',', ''), 'HK' => array('HKD', 2, '.', ',', '$'), 'HU' => array('HUF', 2, '.', ',', ''), 'IN' => array('INR', 2, '.', ',', '&#x20A8;'), 'ID' => array('IDR', 2, '.', ',', 'Rp'), 'IE' => array('EUR', 2, '.', ',', '&#x20AC;'), 'IL' => array('ILS', 2, '.', ',', '&#x20AA;'), 'IT' => array('EUR', 2, '.', ',', '&#x20AC;'), 'JP' => array('JPY', 0, '.', ',', '&yen;'), 'MO' => array('MOP', 2, '.', ',', '$'), 'MY' => array('MYR', 2, '.', ',', 'RM'), 'MX' => array('MXN', 2, '.', ',', '$'), 'NL' => array('EUR', 2, '.', ',', '&#x20AC;'), 'NZ' => array('NZD', 2, '.', ',', '$'), 'NO' => array('NOK', 2, '.', ',', ''), 'PA' => array('PAB', 2, '.', ',', ''), 'PH' => array('PHP', 2, '.', ',', 'P'), 'PL' => array('PLN', 2, '.', ',', ''), 'PT' => array('EUR', 2, '.', ',', '&#x20AC;'), 'PR' => array('USD', 2, '.', ',', '$'), 'RO' => array('ROL', 2, '.', ',', 'L'), 'RU' => array('RUR', 2, '.', ',', ''), 'SG' => array('SGD', 2, '.', ',', '$'), 'KR' => array('KRW', 0, '.', ',', '&#x20A9;'), 'ES' => array('EUR', 2, '.', ',', '&#x20AC;'), 'SW' => array('SEK', 2, '.', ',', ''), 'CH' => array('CHF', 2, '.', ',', 'Fr.'), 'TW' => array('NT$', 0, '.', ',', '元'), 'TH' => array('THB', 2, '.', ',', '฿'), 'TR' => array('TRL', 2, '.', ',', '₤'), 'GB' => array('GBP', 2, '.', ',', '£'), 'US' => array('USD', 2, '.', ',', '$'), 'VN' => array('VND', 2, '.', ',', '₫'), 'OO' => array('USD', 2, '.', ',', '$'));
    $locale['nameform'] = array('AR' => 1, 'AU' => 1, 'AT' => 1, 'BE' => 1, 'BR' => 1, 'CA' => 1, 'CL' => 1, 'CN' => 0, 'CR' => 1, 'CZ' => 1, 'DK' => 1, 'DO' => 1, 'FI' => 1, 'FR' => 1, 'DE' => 1, 'GR' => 1, 'GT' => 1, 'HK' => 1, 'HU' => 1, 'IN' => 1, 'ID' => 1, 'IE' => 1, 'IL' => 1, 'IT' => 1, 'JP' => 0, 'MO' => 1, 'MY' => 1, 'MX' => 1, 'NL' => 1, 'NZ' => 1, 'NO' => 1, 'PA' => 1, 'PH' => 1, 'PL' => 1, 'PT' => 1, 'PR' => 1, 'RO' => 1, 'RU' => 1, 'SG' => 1, 'KR' => 1, 'ES' => 1, 'SW' => 1, 'CH' => 1, 'TW' => 0, 'TH' => 1, 'TR' => 1, 'GB' => 1, 'US' => 1, 'VN' => 1, 'OO' => 1);
    $locale['addressform'] = array('AR' => 'US', 'AU' => 'US', 'AT' => 'US', 'BE' => 'US', 'BR' => 'US', 'CA' => 'US', 'CL' => 'US', 'CN' => 'CN', 'CR' => 'US', 'CZ' => 'US', 'DK' => 'US', 'DO' => 'US', 'FI' => 'US', 'FR' => 'US', 'DE' => 'US', 'GR' => 'US', 'GT' => 'US', 'HK' => 'US', 'HU' => 'US', 'IN' => 'US', 'ID' => 'US', 'IE' => 'US', 'IL' => 'US', 'IT' => 'US', 'JP' => 'JP', 'MO' => 'US', 'MY' => 'US', 'MX' => 'US', 'NL' => 'US', 'NZ' => 'US', 'NO' => 'US', 'PA' => 'US', 'PH' => 'US', 'PL' => 'US', 'PT' => 'US', 'PR' => 'US', 'RO' => 'US', 'RU' => 'US', 'SG' => 'US', 'KR' => 'US', 'ES' => 'US', 'SW' => 'US', 'CH' => 'US', 'TW' => 'JP', 'TH' => 'US', 'TR' => 'US', 'GB' => 'US', 'US' => 'US', 'VN' => 'US', 'OO' => 'US');
    $locale['country'] = array('AR' => __('Argentina', 'wc2'), 'AU' => __('Australia', 'wc2'), 'AT' => __('Austria', 'wc2'), 'BE' => __('Belgium', 'wc2'), 'BR' => __('Brazil', 'wc2'), 'CA' => __('Canada', 'wc2'), 'CL' => __('Chile', 'wc2'), 'CN' => __('China', 'wc2'), 'CR' => __('Costa Rica', 'wc2'), 'CZ' => __('Czech Republic', 'wc2'), 'DK' => __('Denmark', 'wc2'), 'DO' => __('Dominican Republic', 'wc2'), 'FI' => __('Finland', 'wc2'), 'FR' => __('France', 'wc2'), 'DE' => __('Germany', 'wc2'), 'GR' => __('Greece', 'wc2'), 'GT' => __('Guatemala', 'wc2'), 'HK' => __('Hong Kong', 'wc2'), 'HU' => __('Hungary', 'wc2'), 'IN' => __('India', 'wc2'), 'ID' => __('Indonesia', 'wc2'), 'IE' => __('Ireland', 'wc2'), 'IL' => __('Israel', 'wc2'), 'IT' => __('Italy', 'wc2'), 'JP' => __('日本', 'wc2'), 'MO' => __('Macau', 'wc2'), 'MY' => __('Malaysia', 'wc2'), 'MX' => __('Mexico', 'wc2'), 'NL' => __('Netherlands', 'wc2'), 'NZ' => __('New Zealand', 'wc2'), 'NO' => __('Norway', 'wc2'), 'PA' => __('Panama', 'wc2'), 'PH' => __('Philippines', 'wc2'), 'PL' => __('Poland', 'wc2'), 'PT' => __('Portugal', 'wc2'), 'PR' => __('Puerto Rico', 'wc2'), 'RO' => __('Romania', 'wc2'), 'RU' => __('Russia', 'wc2'), 'SG' => __('Singapore', 'wc2'), 'KR' => __('South Korea', 'wc2'), 'ES' => __('Spain', 'wc2'), 'SW' => __('Sweden', 'wc2'), 'CH' => __('Switzerland', 'wc2'), 'TW' => __('Taiwan', 'wc2'), 'TH' => __('Thailand', 'wc2'), 'TR' => __('Turkey', 'wc2'), 'GB' => __('United Kingdom', 'wc2'), 'US' => __('United States', 'wc2'), 'VN' => __('Vietnam', 'wc2'), 'OO' => __('Other', 'wc2'));
    $locale['country_num'] = array('AR' => '54', 'AR' => '61', 'AT' => '43', 'BE' => '32', 'BR' => '55', 'CA' => '1', 'CL' => '56', 'CN' => '86', 'CR' => '506', 'CZ' => '420', 'DK' => '45', 'DO' => '1-809', 'FI' => '358', 'FR' => '33', 'DE' => '49', 'GR' => '30', 'GT' => '502', 'HK' => '852', 'HU' => '36', 'IN' => '91', 'ID' => '62', 'IE' => '353', 'IL' => '972', 'IT' => '39', 'JP' => '81', 'MO' => '853', 'MY' => '60', 'MX' => '52', 'NL' => '31', 'NZ' => '64', 'NO' => '47', 'PA' => '507', 'PH' => '63', 'PL' => '48', 'PT' => '351', 'PR' => '1-787', 'RO' => '40', 'RU' => '7', 'SG' => '65', 'KR' => '82', 'ES' => '34', 'SW' => '46', 'CH' => '41', 'TW' => '886', 'TH' => '66', 'TR' => '90', 'GB' => '44', 'US' => '1', 'VN' => '84', 'OO' => '1');
    $locale['lungage2country'] = array('es_AR' => 'AR', 'en_AU' => 'AU', 'de_AT' => 'AT', 'nl_BE' => 'BE', 'fr_BE' => 'BE', 'pt_BR' => 'BR', 'en_CA' => 'CA', 'fr_CA' => 'CA', 'es_CL' => 'CL', 'zh_CN' => 'CN', 'zh' => 'CN', 'es_CR' => 'CR', 'cs_CZ' => 'CZ', 'cs' => 'CZ', 'da' => 'DK', 'da_DK' => 'DK', 'es_DO' => 'DO', 'fi_FI' => 'FI', 'fi' => 'FI', 'sv_FI' => 'FI', 'fr' => 'FR', 'fr_FR' => 'FR', 'de' => 'DE', 'de_DE' => 'DE', 'el' => 'GR', 'el_GR' => 'GR', 'es_GT' => 'GT', 'zh_HK' => 'HK', 'en_HK' => 'HK', 'hu_HU' => 'HU', 'hu' => 'HU', 'hi' => 'IN', 'hi_IN' => 'IN', 'id' => 'ID', 'id_ID' => 'ID', 'ga' => 'IE', 'ga_IE' => 'IE', 'en_IE' => 'IE', 'he_IL' => 'IL', 'ar_IL' => 'IL', 'it' => 'IT', 'it_IT' => 'IT', 'ja' => 'JP', 'ja_JP' => 'JP', 'zh_MO' => 'MO', 'pt_MO' => 'MO', 'ms' => 'MY', 'ms_MY' => 'MY', 'es_MX' => 'MX', 'nl' => 'NL', 'nl_NL' => 'NL', 'en_NZ' => 'NZ', 'mi_NZ' => 'NZ', 'mi' => 'NZ', 'no' => 'NO', 'no_NO' => 'NO', 'es_PA' => 'PA', 'tl' => 'PH', 'tl_PH' => 'PH', 'en_PH' => 'PH', 'pl' => 'PL', 'pl_PL' => 'PL', 'pt' => 'PT', 'pt_PT' => 'PT', 'es_PR' => 'PR', 'en_PR' => 'PR', 'ro' => 'RO', 'ro_RO' => 'RO', 'ru' => 'RU', 'ru_RU' => 'RU', 'en_SG' => 'SG', 'ms_SG' => 'SG', 'zh_SG' => 'SG', 'ko' => 'KR', 'ko_KR' => 'KR', 'es' => 'ES', 'es_ES' => 'ES', 'sv' => 'SW', 'sv_SW' => 'SW', 'de_CH' => 'CH', 'fr_CH' => 'CH', 'it_CH' => 'CH', 'rm_CH' => 'CH', 'rm' => 'CH', 'zh_TW' => 'TW', 'th' => 'TH', 'th_TH' => 'TH', 'tr' => 'TR', 'tr_TR' => 'TR', 'en' => 'GB', 'en_GB' => 'GB', '' => 'US', 'en_US' => 'US', 'vi' => 'VN', 'vi_VN' => 'VN', 'zh_TW' => 'TW');
    //}
    $locale = apply_filters('wc2_filter_locale', $locale);
    wc2_update_option('locale_options', $locale);
    //American state and prefectures of Japan
    $states = wc2_get_option('states_options');
    //if( empty($states) ) {
    $states['JP'] = array("北海道", "青森県", "岩手県", "宮城県", "秋田県", "山形県", "福島県", "茨城県", "栃木県", "群馬県", "埼玉県", "千葉県", "東京都", "神奈川県", "新潟県", "富山県", "石川県", "福井県", "山梨県", "長野県", "岐阜県", "静岡県", "愛知県", "三重県", "滋賀県", "京都府", "大阪府", "兵庫県", "奈良県", "和歌山県", "鳥取県", "島根県", "岡山県", "広島県", "山口県", "徳島県", "香川県", "愛媛県", "高知県", "福岡県", "佐賀県", "長崎県", "熊本県", "大分県", "宮崎県", "鹿児島県", "沖縄県");
    $states['US'] = array("Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming");
    //}
    wc2_update_option('states_options', $states);
    //Option types
    $item_option_select = wc2_get_option('item_option_select');
    //if( empty($item_option_select) ) {
    $item_option_select = array('0' => __('シングルセレクト', 'wc2'), '1' => __('マルチセレクト', 'wc2'), '2' => __('テキスト', 'wc2'), '3' => __('ラジオボタン', 'wc2'), '4' => __('チェックボックス', 'wc2'), '5' => __('テキストエリア', 'wc2'));
    //}
    wc2_update_option('item_option_select', $item_option_select);
    //Fixed phrase
    $phrase_default = wc2_get_option('phrase_default');
    if (empty($phrase_default)) {
        $blogname = get_option('blogname');
        $home_url = get_option('home');
        $phrase_default['smtp_hostname'] = '';
        $phrase_default['newmem_admin_mail'] = 1;
        $phrase_default['delmem_admin_mail'] = 1;
        $phrase_default['delmem_customer_mail'] = 1;
        $phrase_default['editmem_customer_mail'] = 1;
        $phrase_default['title']['thankyou'] = __('ご注文内容の確認', 'wc2');
        $phrase_default['title']['order'] = __('受注報告', 'wc2');
        $phrase_default['title']['inquiry'] = __('お問い合わせを承りました', 'wc2');
        $phrase_default['title']['membercomp'] = __('ご入会完了のご連絡', 'wc2');
        $phrase_default['title']['completionmail'] = __('商品発送のご連絡', 'wc2');
        $phrase_default['title']['ordermail'] = __('ご注文内容の確認', 'wc2');
        $phrase_default['title']['changemail'] = __('ご注文内容変更の確認', 'wc2');
        $phrase_default['title']['receiptmail'] = __('ご入金確認のご連絡', 'wc2');
        $phrase_default['title']['estimatemail'] = __('お見積の件', 'wc2');
        $phrase_default['title']['cancelmail'] = __('ご注文キャンセルの確認', 'wc2');
        $phrase_default['title']['othermail'] = '';
        $phrase_default['header']['thankyou'] = sprintf(__("この度は%sをご利用くださいまして、誠にありがとうございます。", 'wc2'), $blogname) . "\r\n" . __("下記の通りご注文をお受けいたしましたのでご確認をお願いいたします。", 'wc2') . "\r\n\r\n" . __("商品の準備ができ次第、メールにて発送のご案内をさせていただきます。よろしくお願いいたします。", 'wc2') . "\r\n\r\n";
        $phrase_default['header']['order'] = sprintf(__("%sの注文が入りました。", 'wc2'), $blogname) . "\r\n";
        $phrase_default['header']['inquiry'] = sprintf(__("この度は%sをご利用くださいまして、誠にありがとうございます。", 'wc2'), $blogname) . "\r\n" . __("下記の通りお問い合わせをお受けいたしました。", 'wc2') . "\r\n\r\n" . __("準備ができ次第、メールにてご返答させていただきます。", 'wc2') . "\r\n\r\n";
        $phrase_default['header']['membercomp'] = sprintf(__("この度は%sの会員にご登録くださいまして、誠にありがとうございます。", 'wc2'), $blogname) . "\r\n\r\n" . __("「会員情報」にてご購入商品の履歴が確認できます。", 'wc2') . "\r\n\r\n";
        $phrase_default['header']['completionmail'] = __("本日、ご注文の商品を発送いたしました。", 'wc2') . "\r\n\r\n" . __("配送業者は○○運輸となっております。", 'wc2') . "\r\n\r\n" . __("万が一商品が届かない場合はご連絡ください。よろしくお願いいたします。", 'wc2') . "\r\n\r\n";
        $phrase_default['header']['ordermail'] = sprintf(__("この度は%sをご利用くださいまして、誠にありがとうございます。", 'wc2'), $blogname) . "\r\n" . __("下記の通りご注文内容を変更いたしましたので、ご確認をお願いいたします。", 'wc2') . "\r\n\r\n" . __("商品の準備ができ次第、メールにて発送のご案内をさせていただきます。よろしくお願いいたします。", 'wc2') . "\r\n\r\n";
        $phrase_default['header']['changemail'] = sprintf(__("この度は%sをご利用くださいまして、誠にありがとうございます。", 'wc2'), $blogname) . "\r\n" . __("下記の通りご注文内容を変更いたしましたので、ご確認をお願いいたします。", 'wc2') . "\r\n\r\n" . __("商品の準備ができ次第、メールにて発送のご案内をさせていただきます。よろしくお願いいたします。", 'wc2') . "\r\n\r\n";
        $phrase_default['header']['receiptmail'] = sprintf(__("この度は%sをご利用くださいまして、誠にありがとうございます。", 'wc2'), $blogname) . "\r\n" . __("ご入金の確認ができましたので、ご連絡いたします。", 'wc2') . "\r\n\r\n" . __("商品の準備ができ次第、メールにて発送のご案内をさせていただきます。よろしくお願いいたします。", 'wc2') . "\r\n\r\n";
        $phrase_default['header']['estimatemail'] = sprintf(__("この度は%sをご利用くださいまして、誠にありがとうございます。", 'wc2'), $blogname) . "\r\n" . __("下記の通りお見積いたしましたので、ご確認をお願いいたします。", 'wc2') . "\r\n\r\n" . __("お見積の有効期限は一週間となっております。よろしくお願いいたします。", 'wc2') . "\r\n\r\n";
        $phrase_default['header']['cancelmail'] = sprintf(__("この度は%sをご利用くださいまして、誠にありがとうございます。", 'wc2'), $blogname) . "\r\n" . __("ご注文のキャンセルを承りました。今後ともよろしくお願いいたします。", 'wc2') . "\r\n\r\n";
        $phrase_default['header']['othermail'] = sprintf(__("この度は%sをご利用くださいまして、誠にありがとうございます。", 'wc2'), $blogname) . "\r\n\r\n";
        $general_options = wc2_get_option('wc2_general');
        $company_name = isset($general_options['company_name']) ? $general_options['company_name'] : '';
        $zip_code = isset($general_options['zip_code']) ? $general_options['zip_code'] : '';
        $address1 = isset($general_options['address1']) ? $general_options['address1'] : '';
        $address2 = isset($general_options['address2']) ? $general_options['address2'] : '';
        $tel_number = isset($general_options['tel_number']) ? $general_options['tel_number'] : '';
        $fax_number = isset($general_options['fax_number']) ? $general_options['fax_number'] : '';
        $inquiry_mail = isset($general_options['inquiry_mail']) ? $general_options['inquiry_mail'] : '';
        $footer = "=============================================\r\n" . $blogname . "\r\n" . $company_name . "\r\n" . $zip_code . "\r\n" . $address1 . "\r\n" . $address2 . "\r\n" . "TEL " . $tel_number . "\r\n" . "FAX " . $fax_number . "\r\n" . __('contact', 'wc2') . " " . $inquiry_mail . "\r\n" . $home_url . "\r\n" . "=============================================\r\n";
        $phrase_default['footer']['thankyou'] = $footer;
        $phrase_default['footer']['order'] = $footer;
        $phrase_default['footer']['inquiry'] = $footer;
        $phrase_default['footer']['membercomp'] = $footer;
        $phrase_default['footer']['completionmail'] = $footer;
        $phrase_default['footer']['ordermail'] = $footer;
        $phrase_default['footer']['changemail'] = $footer;
        $phrase_default['footer']['receiptmail'] = $footer;
        $phrase_default['footer']['estimatemail'] = $footer;
        $phrase_default['footer']['cancelmail'] = $footer;
        $phrase_default['footer']['othermail'] = $footer;
    }
    wc2_update_option('phrase_default', $phrase_default);
    //Essential mark
    $essential_mark = wc2_get_option('essential_mark');
    //if( empty($essential_mark) ) {
    $essential_mark = array('email' => '<span class="required">' . __('*', 'wc2') . '</span>', 'name1' => '<span class="required">' . __('*', 'wc2') . '</span>', 'name2' => '', 'name3' => '', 'name4' => '', 'zipcode' => '<span class="required">' . __('*', 'wc2') . '</span>', 'country' => '<span class="required">' . __('*', 'wc2') . '</span>', 'pref' => '<span class="required">' . __('*', 'wc2') . '</span>', 'address1' => '<span class="required">' . __('*', 'wc2') . '</span>', 'address2' => '', 'tel' => '<span class="required">' . __('*', 'wc2') . '</span>', 'fax' => '');
    //}
    $essential_mark = apply_filters('wc2_filter_essential_mark', $essential_mark);
    wc2_update_option('essential_mark', $essential_mark);
    $noreceipt_status = array('BT');
    $noreceipt_status = apply_filters('wc2_filter_noreceipt_status', $noreceipt_status);
    wc2_update_option('noreceipt_status', $noreceipt_status);
    $custom_field_option = array('capa' => array('admin' => '管理パネルのみ', 'public' => 'フロントにも表示'), 'means' => array('select' => 'シングルセレクト', 'radio' => 'ラジオボタン', 'check' => 'チェックボックス', 'text' => 'テキスト', 'textarea' => 'テキストエリア'), 'essential' => true, 'position' => array('head' => '先頭', 'beforename' => '名前の前', 'aftername' => '名前の後', 'bottom' => '最後尾', 'other' => 'その他'));
    wc2_update_option('custom_field_option', $custom_field_option);
    //Orderlist refine period
    $order_refine_period = wc2_get_option('order_refine_period');
    //if( empty($order_refine_period) ) {
    $order_refine_period = array('0' => __('This month', 'wc2'), '1' => __('Last month', 'wc2'), '2' => __('The past one week', 'wc2'), '3' => __('Last 30 days', 'wc2'), '4' => __('Last 90days', 'wc2'), '5' => __('Period specified', 'wc2'), '6' => __('All', 'wc2'));
    //}
    $order_refine_period = apply_filters('wc2_filter_order_refine_period', $order_refine_period);
    wc2_update_option('order_refine_period', $order_refine_period);
    do_action('wc2_action_initial_setting');
}
 public function general_setting_page()
 {
     global $allowedposttags;
     if (!isset($this->plugin_screen_hook_suffix)) {
         return;
     }
     $screen = get_current_screen();
     if ($this->plugin_screen_hook_suffix != $screen->id) {
         return;
     }
     $general = wc2_get_option('general');
     $cart_description = wc2_get_option('cart_description');
     $member_description = wc2_get_option('member_description');
     if (array_key_exists('wc2_option_update', $_POST)) {
         check_admin_referer('wc2_setting_general', 'wc2_nonce');
         //			$this->error_message = $this->setting_delivery_check();
         $_POST = WC2_Utils::stripslashes_deep_post($_POST);
         //ショップ設定
         $general['company_name'] = isset($_POST['company_name']) ? trim($_POST['company_name']) : '';
         $general['zip_code'] = isset($_POST['zip_code']) ? trim($_POST['zip_code']) : '';
         $general['address1'] = isset($_POST['address1']) ? trim($_POST['address1']) : '';
         $general['address2'] = isset($_POST['address2']) ? trim($_POST['address2']) : '';
         $general['tel_number'] = isset($_POST['tel_number']) ? trim($_POST['tel_number']) : '';
         $general['fax_number'] = isset($_POST['fax_number']) ? trim($_POST['fax_number']) : '';
         $general['order_mail'] = isset($_POST['order_mail']) ? trim($_POST['order_mail']) : '';
         $general['inquiry_mail'] = isset($_POST['inquiry_mail']) ? trim($_POST['inquiry_mail']) : '';
         $general['sender_mail'] = isset($_POST['sender_mail']) ? trim($_POST['sender_mail']) : '';
         $general['error_mail'] = isset($_POST['error_mail']) ? trim($_POST['error_mail']) : '';
         $general['postage_privilege'] = isset($_POST['postage_privilege']) ? trim($_POST['postage_privilege']) : '';
         $general['purchase_limit'] = isset($_POST['purchase_limit']) ? trim($_POST['purchase_limit']) : '';
         $general['shipping_rule'] = isset($_POST['shipping_rule']) ? trim($_POST['shipping_rule']) : '';
         $general['tax_mode'] = isset($_POST['tax_mode']) ? trim($_POST['tax_mode']) : 'include';
         $general['tax_target'] = isset($_POST['tax_target']) ? trim($_POST['tax_target']) : 'products';
         $general['tax_rate'] = isset($_POST['tax_rate']) ? (int) $_POST['tax_rate'] : '';
         $general['tax_method'] = isset($_POST['tax_method']) ? trim($_POST['tax_method']) : '';
         $general['copyright'] = isset($_POST['copyright']) ? trim($_POST['copyright']) : '';
         $general['add2cart'] = isset($_POST['add2cart']) ? trim($_POST['add2cart']) : '0';
         //営業設定
         $general['display_mode'] = isset($_POST['display_mode']) ? trim($_POST['display_mode']) : '';
         $general['campaign_category'] = empty($_POST['cat']) ? '0' : $_POST['cat'];
         $general['campaign_privilege'] = isset($_POST['cat_privilege']) ? trim($_POST['cat_privilege']) : '';
         $general['privilege_point'] = isset($_POST['point_num']) ? (int) $_POST['point_num'] : '';
         $general['privilege_discount'] = isset($_POST['discount_num']) ? (int) $_POST['discount_num'] : '';
         $general['campaign_schedule'] = isset($_POST['campaign_schedule']) ? $_POST['campaign_schedule'] : '0';
         if (isset($_POST['business_days'])) {
             $general['business_days'] = $_POST['business_days'];
         }
         //会員システム
         $general['membersystem_state'] = isset($_POST['membersystem_state']) ? trim($_POST['membersystem_state']) : '';
         $general['membersystem_point'] = isset($_POST['membersystem_point']) ? trim($_POST['membersystem_point']) : '';
         $general['point_rate'] = isset($_POST['point_rate']) ? (int) $_POST['point_rate'] : 1;
         $general['start_point'] = isset($_POST['start_point']) ? (int) $_POST['start_point'] : '';
         $general['point_coverage'] = isset($_POST['point_coverage']) ? (int) $_POST['point_coverage'] : 0;
         $general['point_assign'] = isset($_POST['point_assign']) ? (int) $_POST['point_assign'] : 1;
         $general['member_pass_rule_min'] = isset($_POST['member_pass_rule_min']) ? (int) $_POST['member_pass_rule_min'] : 6;
         $general['member_pass_rule_max'] = isset($_POST['member_pass_rule_max']) && !empty($_POST['member_pass_rule_max']) ? (int) $_POST['member_pass_rule_max'] : '';
         //カートページ設定
         foreach ($general['indi_item_name'] as $key => $val) {
             $general['indi_item_name'][$key] = isset($_POST['indication'][$key]) ? 1 : 0;
         }
         foreach ($_POST['position'] as $key => $value) {
             $general['position'][$key] = $value;
         }
         //カート関連ページに挿入する説明書き
         foreach ($_POST['cart_header'] as $key => $value) {
             $cart_description['cart_header'][$key] = isset($_POST['cart_header'][$key]) ? addslashes(wp_kses($value, $allowedposttags)) : '';
         }
         foreach ($_POST['cart_footer'] as $key => $value) {
             $cart_description['cart_footer'][$key] = isset($_POST['cart_footer'][$key]) ? addslashes(wp_kses($value, $allowedposttags)) : '';
         }
         //会員関連ページに挿入する説明書き
         foreach ($_POST['member_header'] as $key => $value) {
             $member_description['member_header'][$key] = isset($_POST['member_header'][$key]) ? addslashes(wp_kses($value, $allowedposttags)) : '';
         }
         foreach ($_POST['member_footer'] as $key => $value) {
             $member_description['member_footer'][$key] = isset($_POST['member_footer'][$key]) ? addslashes(wp_kses($value, $allowedposttags)) : '';
         }
         if (!isset($general['indi_item_name'])) {
             $general['indi_item_name']['item_name'] = 1;
             $general['indi_item_name']['item_code'] = 1;
             $general['indi_item_name']['sku_name'] = 1;
             $general['indi_item_name']['sku_code'] = 1;
             $general['pos_item_name']['item_name'] = 1;
             $general['pos_item_name']['item_code'] = 2;
             $general['pos_item_name']['sku_name'] = 3;
             $general['pos_item_name']['sku_code'] = 4;
         }
         $general = apply_filters('wc2_filter_admin_setup_options', $general);
         wc2_update_option('general', $general);
         wc2_update_option('cart_description', $cart_description);
         wc2_update_option('member_description', $member_description);
         do_action('wc2_action_general_option_update');
         $this->action_status = 'success';
         $this->action_message = __('Updated!');
     } else {
         $this->action_status = 'none';
         $this->action_message = '';
     }
     $status = $this->action_status;
     $message = $this->action_message;
     //today
     list($todayyy, $todaymm, $todaydd) = wc2_get_today();
     for ($i = 0; $i < 12; $i++) {
         if (0 == $i) {
             $this->cal[$i] = new Calendar_Data();
             $this->cal[$i]->setToday($todayyy, $todaymm, $todaydd);
             $this->cal[$i]->setCalendarData();
         }
         list($month_yy[$i], $month_mm[$i], $month_dd[$i]) = wc2_get_aftermonth($todayyy, $todaymm, 1, $i);
         $this->cal[$i] = new Calendar_Data();
         $this->cal[$i]->setToday($month_yy[$i], $month_mm[$i], $month_dd[$i]);
         $this->cal[$i]->setCalendarData();
     }
     $yearstr = substr(get_date_from_gmt(gmdate('Y-m-d H:i:s', time())), 0, 4);
     $campaign_schedule_start_year = isset($general['campaign_schedule']['start']['year']) ? $general['campaign_schedule']['start']['year'] : 0;
     $campaign_schedule_start_month = isset($general['campaign_schedule']['start']['month']) ? $general['campaign_schedule']['start']['month'] : 0;
     $campaign_schedule_start_day = isset($general['campaign_schedule']['start']['day']) ? $general['campaign_schedule']['start']['day'] : 0;
     $campaign_schedule_start_hour = isset($general['campaign_schedule']['start']['hour']) ? $general['campaign_schedule']['start']['hour'] : 0;
     $campaign_schedule_start_min = isset($general['campaign_schedule']['start']['min']) ? $general['campaign_schedule']['start']['min'] : 0;
     $campaign_schedule_end_year = isset($general['campaign_schedule']['end']['year']) ? $general['campaign_schedule']['end']['year'] : 0;
     $campaign_schedule_end_month = isset($general['campaign_schedule']['end']['month']) ? $general['campaign_schedule']['end']['month'] : 0;
     $campaign_schedule_end_day = isset($general['campaign_schedule']['end']['day']) ? $general['campaign_schedule']['end']['day'] : 0;
     $campaign_schedule_end_hour = isset($general['campaign_schedule']['end']['hour']) ? $general['campaign_schedule']['end']['hour'] : 0;
     $campaign_schedule_end_min = isset($general['campaign_schedule']['end']['min']) ? $general['campaign_schedule']['end']['min'] : 0;
     $common_opts = isset($general['_iopt_']) ? $general['_iopt_'] : '';
     $display_mode_label = wc2_get_option('display_mode_label');
     $indi_item_name = $general['indi_item_name'];
     $pos_item_name = $general['pos_item_name'];
     foreach ((array) $indi_item_name as $key => $value) {
         $checked_item_name[$key] = $indi_item_name[$key] == 1 ? ' checked="checked"' : '';
     }
     if (!empty($cart_description)) {
         $cart_page_data = stripslashes_deep($cart_description);
     } else {
         $cart_page_data['cart_header'] = array();
         $cart_page_data['cart_footer'] = array();
     }
     if (!empty($member_description)) {
         $member_page_data = stripslashes_deep($member_description);
     } else {
         $member_page_data['member_header'] = array();
         $member_page_data['member_footer'] = array();
     }
     require_once WC2_PLUGIN_DIR . '/admin/views/setting-general.php';
 }
 public function phrase_ajax()
 {
     //if( !check_ajax_referer( 'wc2_setting_phrase', 'wc2_nonce', false ) ) die();
     if (!isset($_POST['action']) or !isset($_POST['mode'])) {
         die;
     }
     if ($_POST['action'] != 'phrase_ajax') {
         die;
     }
     $res = '';
     switch ($_POST['mode']) {
         case 'select':
             $phrase = $_POST['phrase'];
             $phrase_options = wc2_get_option('phrase');
             $phrase_default = wc2_get_option('phrase_default');
             $title = WC2_Utils::is_blank($phrase_options['title'][$phrase]) ? $phrase_default['title'][$phrase] : $phrase_options['title'][$phrase];
             $header = WC2_Utils::is_blank($phrase_options['header'][$phrase]) ? $phrase_default['header'][$phrase] : $phrase_options['header'][$phrase];
             $footer = WC2_Utils::is_blank($phrase_options['footer'][$phrase]) ? $phrase_default['footer'][$phrase] : $phrase_options['footer'][$phrase];
             $res = 'OK' . WC2_SPLIT . $title . WC2_SPLIT . $header . WC2_SPLIT . $footer;
             break;
         case 'update':
             if (!check_ajax_referer('wc2_setting_phrase', 'wc2_nonce', false)) {
                 $res = 'NG' . WC2_SPLIT . __('Security error.');
             } else {
                 $_POST = wc2_stripslashes_deep_post($_POST);
                 $phrase = $_POST['phrase'];
                 $phrase_options = wc2_get_option('phrase');
                 $phrase_options['title'][$phrase] = urldecode(trim($_POST['title']));
                 $phrase_options['header'][$phrase] = urldecode(trim($_POST['header']));
                 $phrase_options['footer'][$phrase] = urldecode(trim($_POST['footer']));
                 $phrase_options = apply_filters('wc2_filter_admin_phrase_update', $phrase_options, $phrase);
                 wc2_update_option('phrase', $phrase_options);
                 $res = 'OK' . WC2_SPLIT . $phrase_options['footer'][$phrase];
             }
             break;
     }
     $res = apply_filters('wc2_filter_admin_phrase_ajax', $res);
     die($res);
 }
 public function wc2_download_member_list()
 {
     global $wpdb;
     $wc2_options = wc2_get_option();
     $locale_options = wc2_get_option('locale_options');
     $applyform = WC2_Funcs::get_apply_addressform($wc2_options['system']['addressform']);
     $target_market = $wc2_options['system']['target_market'];
     $MLT = new Member_List_Table();
     //1ぺーじあたりのテーブルの行数
     $per_page = $MLT->get_items_per_page(self::$per_page_slug);
     //ソート
     $args = $MLT->sort_culum_order_by($per_page);
     //データ
     $rows = $MLT->get_list_data($args);
     $ext = $_REQUEST['ftype'];
     if ($ext == 'csv') {
         //CSV
         $table_h = "";
         $table_f = "";
         $tr_h = "";
         $tr_f = "";
         $th_h1 = '"';
         $th_h = ',"';
         $th_f = '"';
         $td_h1 = '"';
         $td_h = ',"';
         $td_f = '"';
         $nb = " ";
         $lf = "\n";
     } else {
         exit;
     }
     $wc2_opt_member = wc2_get_option('wc2_opt_member');
     if (!is_array($wc2_opt_member)) {
         $wc2_opt_member = array();
     }
     $wc2_opt_member['ftype_mem'] = $ext;
     //---------------------- checkbox Check -----------------------//
     $chk_mem = array();
     $chk_mem['ID'] = 1;
     //$chk_mem['code'] = 1;
     $chk_mem['account'] = 1;
     //head
     $hd_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'head');
     if (!empty($hd_keys)) {
         foreach ($hd_keys as $csmb_key) {
             $chk_mem[$csmb_key] = isset($_REQUEST['check'][$csmb_key]) ? 1 : 0;
         }
     }
     $chk_mem['email'] = isset($_REQUEST['check']['email']) ? 1 : 0;
     //beforename
     $bn_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'beforename');
     if (!empty($bn_keys)) {
         foreach ($bn_keys as $csmb_key) {
             $chk_mem[$csmb_key] = isset($_REQUEST['check'][$csmb_key]) ? 1 : 0;
         }
     }
     $chk_mem['name'] = 1;
     $chk_mem['kana'] = isset($_REQUEST['check']['kana']) ? 1 : 0;
     //aftername
     $an_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'aftername');
     if (!empty($an_keys)) {
         foreach ($an_keys as $csmb_key) {
             $chk_mem[$csmb_key] = isset($_REQUEST['check'][$csmb_key]) ? 1 : 0;
         }
     }
     $chk_mem['country'] = isset($_REQUEST['check']['country']) ? 1 : 0;
     $chk_mem['zipcode'] = isset($_REQUEST['check']['zipcode']) ? 1 : 0;
     $chk_mem['pref'] = 1;
     $chk_mem['address1'] = 1;
     $chk_mem['address2'] = 1;
     $chk_mem['tel'] = isset($_REQUEST['check']['tel']) ? 1 : 0;
     $chk_mem['fax'] = isset($_REQUEST['check']['fax']) ? 1 : 0;
     //bottom
     $btm_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'bottom');
     if (!empty($btm_keys)) {
         foreach ($btm_keys as $csmb_key) {
             $chk_mem[$csmb_key] = isset($_REQUEST['check'][$csmb_key]) ? 1 : 0;
         }
     }
     $chk_mem['registered'] = isset($_REQUEST['check']['registered']) ? 1 : 0;
     $chk_mem['point'] = isset($_REQUEST['check']['point']) ? 1 : 0;
     $chk_mem['rank'] = isset($_REQUEST['check']['rank']) ? 1 : 0;
     //other
     $oth_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'other');
     if (!empty($oth_keys)) {
         foreach ($oth_keys as $csmb_key) {
             $chk_mem[$csmb_key] = isset($_REQUEST['check'][$csmb_key]) ? 1 : 0;
         }
     }
     $wc2_opt_member['chk_mem'] = apply_filters('wc2_filter_chk_mem', $chk_mem);
     //		update_option('wc2_opt_member', $wc2_opt_member);
     wc2_update_option('wc2_opt_member', $wc2_opt_member);
     //---------------------- TITLE -----------------------//
     $line = $table_h;
     $line .= $tr_h;
     $line .= $th_h1 . __('Membership ID', 'wc2') . $th_f;
     $line .= $th_h . __('Login account', 'wc2') . $th_f;
     //csmb head
     $hd_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'head');
     if (!empty($hd_keys)) {
         foreach ($hd_keys as $csmb_key) {
             if (isset($_REQUEST['check'][$csmb_key])) {
                 $line .= $th_h . wc2_entity_decode($wc2_options[$csmb_key]['name'], $ext) . $th_f;
             }
         }
     }
     if (isset($_REQUEST['check']['email'])) {
         $line .= $th_h . __('E-mail', 'wc2') . $th_f;
     }
     //csmb beforename
     $bn_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'beforename');
     if (!empty($bn_keys)) {
         foreach ($bn_keys as $csmb_key) {
             if (isset($_REQUEST['check'][$csmb_key])) {
                 $line .= $th_h . wc2_entity_decode($wc2_options[$csmb_key]['name'], $ext) . $th_f;
             }
         }
     }
     $line .= $th_h . __('Name', 'wc2') . $th_f;
     if ('JP' == $applyform) {
         if (isset($_REQUEST['check']['kana'])) {
             $line .= $th_h . __('Kana', 'wc2') . $th_f;
         }
     }
     //csmb aftername
     $an_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'aftername');
     if (!empty($an_keys)) {
         foreach ($an_keys as $csmb_key) {
             if (isset($_REQUEST['check'][$csmb_key])) {
                 $line .= $th_h . wc2_entity_decode($wc2_options[$csmb_key]['name'], $ext) . $th_f;
             }
         }
     }
     switch ($applyform) {
         case 'JP':
             if (isset($_REQUEST['check']['country'])) {
                 $line .= $th_h . __('Country', 'wc2') . $th_f;
             }
             if (isset($_REQUEST['check']['zipcode'])) {
                 $line .= $th_h . __('Postal Code', 'wc2') . $th_f;
             }
             $line .= $th_h . __('Prefecture', 'wc2') . $th_f;
             $line .= $th_h . __('City', 'wc2') . $th_f;
             $line .= $th_h . __('Building name, floor, room number', 'wc2') . $th_f;
             if (isset($_REQUEST['check']['tel'])) {
                 $line .= $th_h . __('Phone number', 'wc2') . $th_f;
             }
             if (isset($_REQUEST['check']['fax'])) {
                 $line .= $th_h . __('FAX number', 'wc2') . $th_f;
             }
             break;
         case 'US':
         default:
             $line .= $th_h . __('Building name, floor, room number', 'wc2') . $th_f;
             $line .= $th_h . __('City', 'wc2') . $th_f;
             $line .= $th_h . __('Prefecture', 'wc2') . $th_f;
             $line .= $th_h . __('Postal Code', 'wc2') . $th_f;
             if (isset($_REQUEST['check']['country'])) {
                 $line .= $th_h . __('Country', 'wc2') . $th_f;
             }
             if (isset($_REQUEST['check']['tel'])) {
                 $line .= $th_h . __('Phone number', 'wc2') . $th_f;
             }
             if (isset($_REQUEST['check']['fax'])) {
                 $line .= $th_h . __('FAX number', 'wc2') . $th_f;
             }
             break;
     }
     //csmb bottom
     $btm_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'bottom');
     if (!empty($btm_keys)) {
         foreach ($btm_keys as $csmb_key) {
             if (isset($_REQUEST['check'][$csmb_key])) {
                 $line .= $th_h . wc2_entity_decode($wc2_options[$csmb_key]['name'], $ext) . $th_f;
             }
         }
     }
     if (isset($_REQUEST['check']['rank'])) {
         $line .= $th_h . __('ランク', 'wc2') . $th_f;
     }
     if (isset($_REQUEST['check']['point'])) {
         $line .= $th_h . __('保有ポイント', 'wc2') . $th_f;
     }
     if (isset($_REQUEST['check']['registered'])) {
         $line .= $th_h . __('Started date', 'wc2') . $th_f;
     }
     //csmb other
     $oth_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'other');
     if (!empty($oth_keys)) {
         foreach ($oth_keys as $csmb_key) {
             if (isset($_REQUEST['check'][$csmb_key])) {
                 $line .= $th_h . wc2_entity_decode($wc2_options[$csmb_key]['name'], $ext) . $th_f;
             }
         }
     }
     $line .= apply_filters('wc2_filter_chk_mem_label', NULL, $wc2_opt_member, $rows);
     $line .= $tr_f . $lf;
     //---------------------- DATA -----------------------//
     foreach ((array) $rows as $array) {
         $member_id = $array['ID'];
         $data = wc2_get_member_data($member_id);
         //$meta_data = wc2_get_member_data($member_id);
         $line .= $tr_h;
         $line .= $td_h1 . $member_id . $td_f;
         $line .= $td_h . wc2_entity_decode($data['account'], $ext) . $td_f;
         //csmb head
         $hd_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'head');
         if (!empty($hd_keys)) {
             foreach ($hd_keys as $csmb_key) {
                 if (isset($_REQUEST['check'][$csmb_key])) {
                     $meta_value = isset($data[WC2_CUSTOM_MEMBER][$csmb_key]) ? $data[WC2_CUSTOM_MEMBER][$csmb_key] : '';
                     $line .= $td_h . wc2_entity_decode($meta_value, $ext) . $td_f;
                 }
             }
         }
         if (isset($_REQUEST['check']['email'])) {
             $line .= $td_h . wc2_entity_decode($data['email'], $ext) . $td_f;
         }
         //csmb beforename
         $bn_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'beforename');
         if (!empty($bn_keys)) {
             foreach ($bn_keys as $csmb_key) {
                 if (isset($_REQUEST['check'][$csmb_key])) {
                     $meta_value = isset($data[WC2_CUSTOM_MEMBER][$csmb_key]) ? $data[WC2_CUSTOM_MEMBER][$csmb_key] : '';
                     $line .= $td_h . wc2_entity_decode($meta_value, $ext) . $td_f;
                 }
             }
         }
         switch ($applyform) {
             case 'JP':
                 $line .= $td_h . wc2_entity_decode($data['name1'] . ' ' . $data['name2'], $ext) . $td_f;
                 if (isset($_REQUEST['check']['kana'])) {
                     $line .= $td_h . wc2_entity_decode($data['name3'] . ' ' . $data['name4'], $ext) . $td_f;
                 }
                 break;
             default:
                 $line .= $td_h . wc2_entity_decode($data['name2'] . ' ' . $data['name1'], $ext) . $td_f;
                 break;
         }
         //csmb aftername
         $an_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'aftername');
         if (!empty($an_keys)) {
             foreach ($an_keys as $csmb_key) {
                 if (isset($_REQUEST['check'][$csmb_key])) {
                     $meta_value = isset($data[WC2_CUSTOM_MEMBER][$csmb_key]) ? $data[WC2_CUSTOM_MEMBER][$csmb_key] : '';
                     $line .= $td_h . wc2_entity_decode($meta_value, $ext) . $td_f;
                 }
             }
         }
         $address_info = '';
         switch ($applyform) {
             case 'JP':
                 if (isset($_REQUEST['check']['country'])) {
                     $country_code = $data['country'];
                     $member_country = !empty($country_code) ? $locale_options['country'][$country_code] : '';
                     $address_info .= $td_h . $member_country . $td_f;
                 }
                 if (isset($_REQUEST['check']['zipcode'])) {
                     $address_info .= $td_h . wc2_entity_decode($data['zipcode'], $ext) . $td_f;
                 }
                 $address_info .= $td_h . wc2_entity_decode($data['pref'], $ext) . $td_f;
                 $address_info .= $td_h . wc2_entity_decode($data['address1'], $ext) . $td_f;
                 $address_info .= $td_h . wc2_entity_decode($data['address2'], $ext) . $td_f;
                 if (isset($_REQUEST['check']['tel'])) {
                     $address_info .= $td_h . wc2_entity_decode($data['tel'], $ext) . $td_f;
                 }
                 if (isset($_REQUEST['check']['fax'])) {
                     $address_info .= $td_h . wc2_entity_decode($data['fax'], $ext) . $td_f;
                 }
                 break;
             case 'US':
             default:
                 $address_info .= $td_h . wc2_entity_decode($data['address2'], $ext) . $td_f;
                 $address_info .= $td_h . wc2_entity_decode($data['address1'], $ext) . $td_f;
                 $address_info .= $td_h . wc2_entity_decode($data['pref'], $ext) . $td_f;
                 if (isset($_REQUEST['check']['zipcode'])) {
                     $address_info .= $td_h . wc2_entity_decode($data['zipcode'], $ext) . $td_f;
                 }
                 if (isset($_REQUEST['check']['country'])) {
                     $country_code = $data['country'];
                     $member_country = !empty($country_code) ? $locale_options['country'][$country_code] : '';
                     $address_info .= $td_h . $member_country . $td_f;
                 }
                 if (isset($_REQUEST['check']['tel'])) {
                     $address_info .= $td_h . wc2_entity_decode($data['tel'], $ext) . $td_f;
                 }
                 if (isset($_REQUEST['check']['fax'])) {
                     $address_info .= $td_h . wc2_entity_decode($data['fax'], $ext) . $td_f;
                 }
                 break;
         }
         $address_info_args = compact('td_h', 'td_f', 'ext', 'member_id', 'applyform');
         $line .= apply_filters('wc2_filter_mem_csv_address_info', $address_info, $data, $address_info_args);
         //csmb bottom
         $btm_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'bottom');
         if (!empty($btm_keys)) {
             foreach ($btm_keys as $csmb_key) {
                 if (isset($_REQUEST['check'][$csmb_key])) {
                     $meta_value = isset($data[WC2_CUSTOM_MEMBER][$csmb_key]) ? $data[WC2_CUSTOM_MEMBER][$csmb_key] : '';
                     $line .= $td_h . wc2_entity_decode($meta_value, $ext) . $td_f;
                 }
             }
         }
         if (isset($_REQUEST['check']['rank'])) {
             $rank_num = $data['rank'];
             $line .= $td_h . $wc2_options['rank_type'][$rank_num] . $td_f;
         }
         if (isset($_REQUEST['check']['point'])) {
             $line .= $td_h . $data['point'] . $td_f;
         }
         if (isset($_REQUEST['check']['registered'])) {
             $line .= $td_h . $data['registered'] . $td_f;
         }
         //csmb other
         $oth_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'other');
         if (!empty($oth_keys)) {
             foreach ($oth_keys as $csmb_key) {
                 if (isset($_REQUEST['check'][$csmb_key])) {
                     $meta_value = isset($data[WC2_CUSTOM_MEMBER][$csmb_key]) ? $data[WC2_CUSTOM_MEMBER][$csmb_key] : '';
                     $line .= $td_h . wc2_entity_decode($meta_value, $ext) . $td_f;
                 }
             }
         }
         $line .= apply_filters('wc2_filter_chk_mem_data', NULL, $wc2_opt_member, $member_id, $data);
         $line .= $tr_f . $lf;
     }
     $line .= $table_f . $lf;
     if ($ext == 'xls') {
         header("Content-Type: application/vnd.ms-excel; charset=Shift-JIS");
     } elseif ($ext == 'csv') {
         header("Content-Type: application/octet-stream");
     }
     header("Content-Disposition: attachment; filename=wc2_member_list." . $ext);
     mb_http_output('pass');
     print mb_convert_encoding($line, "SJIS-win", "UTF-8");
     exit;
 }
 public function update_custom_field($prefix, $args)
 {
     $key = $prefix . '_' . $args['key'];
     return wc2_update_option($key, $args);
 }
Example #8
0
function wc2_sort_admin_option($option_name, $idstr)
{
    $option_value = wc2_get_option($option_name);
    if (!empty($option_value)) {
        $ids = explode(',', $idstr);
        $c = 0;
        foreach ((array) $ids as $id) {
            $option_value[$id]['sort'] = $c;
            $c++;
        }
        $key_id = array();
        foreach ((array) $option_value as $key => $value) {
            $key_id[$key] = $value['sort'];
        }
        array_multisort($key_id, SORT_ASC, $option_value);
        wc2_update_option($option_name, $option_value);
    }
    return count($option_value);
}
 public function bank_ajax()
 {
     if (!check_ajax_referer('wc2_setting_payment', 'wc2_nonce', false)) {
         die;
     }
     if (!isset($_POST['action']) or !isset($_POST['mode'])) {
         die;
     }
     if ($_POST['action'] != 'bank_ajax') {
         die;
     }
     $res = '';
     switch ($_POST['mode']) {
         case 'update':
             $_POST = wc2_stripslashes_deep_post($_POST);
             $transferee = urldecode(trim($_POST['transferee']));
             wc2_update_option('transferee_info', $transferee);
             $res = 'OK';
             break;
     }
     $res = apply_filters('wc2_filter_admin_bank_ajax', $res);
     die($res);
 }
Example #10
0
 public function system_setting_page()
 {
     if (!isset($this->plugin_screen_hook_suffix)) {
         return;
     }
     $screen = get_current_screen();
     if ($this->plugin_screen_hook_suffix != $screen->id) {
         return;
     }
     $system_options = wc2_get_option('system');
     $states = wc2_get_option('states_options');
     $locale = wc2_get_option('locale_options');
     if (array_key_exists('wc2_option_update', $_POST)) {
         $this->action_status = 'success';
         $_POST = WC2_Utils::stripslashes_deep_post($_POST);
         $system_options['divide_item'] = isset($_POST['divide_item']) ? 1 : 0;
         $system_options['itemimg_anchor_rel'] = isset($_POST['itemimg_anchor_rel']) ? trim($_POST['itemimg_anchor_rel']) : '';
         $system_options['composite_category_orderby'] = isset($_POST['composite_category_orderby']) ? $_POST['composite_category_orderby'] : '';
         $system_options['composite_category_order'] = isset($_POST['composite_category_order']) ? $_POST['composite_category_order'] : '';
         $system_options['settlement_path'] = isset($_POST['settlement_path']) ? $_POST['settlement_path'] : '';
         if (WC2_Utils::is_blank($system_options['settlement_path'])) {
             $system_options['settlement_path'] = WC2_PLUGIN_DIR . '/settlement/';
         }
         $sl = substr($system_options['settlement_path'], -1);
         if ($sl != '/' && $sl != '\\') {
             $system_options['settlement_path'] .= '/';
         }
         $system_options['logs_path'] = isset($_POST['logs_path']) ? $_POST['logs_path'] : '';
         if (!WC2_Utils::is_blank($system_options['logs_path'])) {
             $sl = substr($system_options['logs_path'], -1);
             if ($sl == '/' || $sl == '\\') {
                 $system_options['logs_path'] = substr($system_options['logs_path'], 0, -1);
             }
         }
         $system_options['use_ssl'] = isset($_POST['use_ssl']) ? 1 : 0;
         $system_options['ssl_url'] = isset($_POST['ssl_url']) ? rtrim($_POST['ssl_url'], '/') : '';
         $system_options['ssl_url_admin'] = isset($_POST['ssl_url_admin']) ? rtrim($_POST['ssl_url_admin'], '/') : '';
         if (WC2_Utils::is_blank($system_options['ssl_url']) || WC2_Utils::is_blank($system_options['ssl_url_admin'])) {
             $system_options['use_ssl'] = 0;
         }
         $system_options['inquiry_id'] = isset($_POST['inquiry_id']) ? esc_html(rtrim($_POST['inquiry_id'])) : '';
         $system_options['use_javascript'] = isset($_POST['use_javascript']) ? (int) $_POST['use_javascript'] : 1;
         $system_options['front_lang'] = isset($_POST['front_lang']) && 'others' != $_POST['front_lang'] ? $_POST['front_lang'] : wc2_get_local_language();
         $system_options['currency'] = isset($_POST['currency']) && 'others' != $_POST['currency'] ? $_POST['currency'] : wc2_get_base_country();
         $system_options['addressform'] = isset($_POST['addressform']) ? $_POST['addressform'] : wc2_get_local_addressform();
         $system_options['target_market'] = isset($_POST['target_market']) ? $_POST['target_market'] : wc2_get_local_target_market();
         $system_options['no_cart_css'] = isset($_POST['no_cart_css']) ? 1 : 0;
         $system_options['dec_orderID_flag'] = isset($_POST['dec_orderID_flag']) ? (int) $_POST['dec_orderID_flag'] : 0;
         $system_options['dec_orderID_prefix'] = isset($_POST['dec_orderID_prefix']) ? esc_html(rtrim($_POST['dec_orderID_prefix'])) : '';
         $system_options['pdf_delivery'] = isset($_POST['pdf_delivery']) ? (int) $_POST['pdf_delivery'] : 0;
         $system_options['csv_encode_type'] = isset($_POST['csv_encode_type']) ? (int) $_POST['csv_encode_type'] : 0;
         if (isset($_POST['dec_orderID_digit'])) {
             $dec_orderID_digit = (int) rtrim($_POST['dec_orderID_digit']);
             if (6 > $dec_orderID_digit) {
                 $system_options['dec_orderID_digit'] = 6;
             } else {
                 $system_options['dec_orderID_digit'] = $dec_orderID_digit;
             }
         } else {
             $system_options['dec_orderID_digit'] = 6;
         }
         $system_options['subimage_rule'] = isset($_POST['subimage_rule']) ? (int) $_POST['subimage_rule'] : 0;
         unset($system_options['province']);
         foreach ((array) $system_options['target_market'] as $target_market) {
             $province = array();
             if (!empty($_POST['province_' . $target_market])) {
                 $temp_pref = explode("\n", $_POST['province_' . $target_market]);
                 foreach ($temp_pref as $pref) {
                     if (!WC2_Utils::is_blank($pref)) {
                         $province[] = trim($pref);
                     }
                 }
                 if (1 == count($province)) {
                     $this->action_status = 'error';
                 }
             } else {
                 if (isset($states[$target_market]) && is_array($states[$target_market])) {
                     $province = $states[$target_market];
                 } else {
                     $this->action_status = 'error';
                 }
             }
             $system_options['province'][$target_market] = $province;
         }
         if ($this->action_status != 'success') {
             $this->action_message = __('データに不備があります', 'wc2');
         } else {
             wc2_update_option('system', $system_options);
             $this->action_message = __('Updated!');
         }
     } else {
         if (!isset($system_options['province']) || empty($system_options['province'])) {
             $system_options['province'][$system_options['base_country']] = $states[$system_options['base_country']];
         }
         $this->action_status = 'none';
         $this->action_message = '';
     }
     $status = $this->action_status;
     $message = $this->action_message;
     $divide_item = $system_options['divide_item'];
     $itemimg_anchor_rel = $system_options['itemimg_anchor_rel'];
     $composite_category_orderby = $system_options['composite_category_orderby'];
     $composite_category_order = $system_options['composite_category_order'];
     $logs_path = isset($system_options['logs_path']) ? $system_options['logs_path'] : '';
     $use_ssl = $system_options['use_ssl'];
     $ssl_url = $system_options['ssl_url'];
     $ssl_url_admin = $system_options['ssl_url_admin'];
     $inquiry_id = $system_options['inquiry_id'];
     $orderby_itemsku = isset($system_options['orderby_itemsku']) ? $system_options['orderby_itemsku'] : 0;
     $orderby_itemopt = isset($system_options['orderby_itemopt']) ? $system_options['orderby_itemopt'] : 0;
     $system_front_lang = isset($system_options['front_lang']) && !empty($system_options['front_lang']) ? $system_options['front_lang'] : wc2_get_local_language();
     $system_currency = isset($system_options['currency']) && !empty($system_options['currency']) ? $system_options['currency'] : wc2_get_base_country();
     $system_addressform = isset($system_options['addressform']) && !empty($system_options['addressform']) ? $system_options['addressform'] : wc2_get_local_addressform();
     $system_target_markets = isset($system_options['target_market']) && !empty($system_options['target_market']) ? $system_options['target_market'] : wc2_get_local_target_market();
     $no_cart_css = isset($system_options['no_cart_css']) ? $system_options['no_cart_css'] : 0;
     $dec_orderID_flag = isset($system_options['dec_orderID_flag']) ? $system_options['dec_orderID_flag'] : 0;
     $dec_orderID_prefix = isset($system_options['dec_orderID_prefix']) ? $system_options['dec_orderID_prefix'] : '';
     $dec_orderID_digit = isset($system_options['dec_orderID_digit']) ? $system_options['dec_orderID_digit'] : '';
     $subimage_rule = isset($system_options['subimage_rule']) ? $system_options['subimage_rule'] : 0;
     $pdf_delivery = isset($system_options['pdf_delivery']) ? $system_options['pdf_delivery'] : 0;
     $csv_encode_type = isset($system_options['csv_encode_type']) ? $system_options['csv_encode_type'] : 0;
     require_once WC2_PLUGIN_DIR . '/admin/views/setting-system.php';
 }
Example #11
0
 public function download_order_list()
 {
     $order_list = new WC2_Order_List_Table();
     //1ページあたりのテーブルの行数
     $per_page = $order_list->get_items_per_page(self::$per_page_slug);
     //ソート
     $args = $order_list->sort_culum_order_by($per_page);
     //データ
     $list_data = $order_list->get_list_data($args);
     $wc2_order = WC2_DB_Order::get_instance();
     $system_options = wc2_get_option('system');
     $applyform = wc2_get_apply_addressform($system_options['addressform']);
     $management_status = wc2_get_option('management_status');
     $receipt_status = wc2_get_option('receipt_status');
     $order_type = wc2_get_option('order_type');
     $locale_options = wc2_get_option('locale_options');
     $list = '';
     $opt_order = wc2_get_option('opt_order');
     $chk_order = !empty($opt_order['chk_order']) ? $opt_order['chk_order'] : array();
     //--------------------- checkbox Check ---------------------//
     //-------- Customer -------//
     $chk_order['ID'] = 1;
     $chk_order['deco_id'] = 1;
     $chk_order['order_date'] = 1;
     $chk_order['member_id'] = isset($_REQUEST['check']['member_id']) ? 1 : 0;
     $cscs_head = wc2_get_custom_field_keys(WC2_CSCS, 'head');
     if (!empty($cscs_head)) {
         foreach ($cscs_head as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     $chk_order['email'] = isset($_REQUEST['check']['email']) ? 1 : 0;
     $cscs_beforename = wc2_get_custom_field_keys(WC2_CSCS, 'beforename');
     if (!empty($cscs_beforename)) {
         foreach ($cscs_beforename as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     $chk_order['name'] = 1;
     $chk_order['kana'] = isset($_REQUEST['check']['kana']) ? 1 : 0;
     $cscs_aftername = wc2_get_custom_field_keys(WC2_CSCS, 'aftername');
     if (!empty($cscs_aftername)) {
         foreach ($cscs_aftername as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     $chk_order['country'] = isset($_REQUEST['check']['country']) ? 1 : 0;
     $chk_order['zipcode'] = isset($_REQUEST['check']['zipcode']) ? 1 : 0;
     $chk_order['pref'] = 1;
     $chk_order['address1'] = 1;
     $chk_order['address2'] = 1;
     $chk_order['tel'] = isset($_REQUEST['check']['tel']) ? 1 : 0;
     $chk_order['fax'] = isset($_REQUEST['check']['fax']) ? 1 : 0;
     $cscs_bottom = wc2_get_custom_field_keys(WC2_CSCS, 'bottom');
     if (!empty($cscs_bottom)) {
         foreach ($cscs_bottom as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     $cscs_other = wc2_get_custom_field_keys(WC2_CSCS, 'other');
     if (!empty($cscs_other)) {
         foreach ($cscs_other as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     //-------- Delivery -------//
     $csde_head = wc2_get_custom_field_keys(WC2_CSDE, 'head');
     if (!empty($csde_head)) {
         foreach ($csde_head as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     $csde_beforename = wc2_get_custom_field_keys(WC2_CSDE, 'beforename');
     if (!empty($csde_beforename)) {
         foreach ($csde_beforename as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     $chk_order['delivery_name'] = 1;
     $chk_order['delivery_kana'] = isset($_REQUEST['check']['delivery_kana']) ? 1 : 0;
     $csde_aftername = wc2_get_custom_field_keys(WC2_CSDE, 'aftername');
     if (!empty($csde_aftername)) {
         foreach ($csde_aftername as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     $chk_order['delivery_country'] = isset($_REQUEST['check']['delivery_country']) ? 1 : 0;
     $chk_order['delivery_zipcode'] = isset($_REQUEST['check']['delivery_zipcode']) ? 1 : 0;
     $chk_order['delivery_pref'] = 1;
     $chk_order['delivery_address1'] = 1;
     $chk_order['delivery_address2'] = 1;
     $chk_order['delivery_tel'] = isset($_REQUEST['check']['delivery_tel']) ? 1 : 0;
     $chk_order['delivery_fax'] = isset($_REQUEST['check']['delivery_fax']) ? 1 : 0;
     $csde_bottom = wc2_get_custom_field_keys(WC2_CSDE, 'bottom');
     if (!empty($csde_bottom)) {
         foreach ($csde_bottom as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     $csde_other = wc2_get_custom_field_keys(WC2_CSDE, 'other');
     if (!empty($csde_other)) {
         foreach ($csde_other as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     //--------- Order --------//
     $chk_order['shipping_date'] = isset($_REQUEST['check']['shipping_date']) ? 1 : 0;
     $chk_order['payment_method'] = isset($_REQUEST['check']['payment_method']) ? 1 : 0;
     $chk_order['delivery_method'] = isset($_REQUEST['check']['delivery_method']) ? 1 : 0;
     $chk_order['delivery_date'] = isset($_REQUEST['check']['delivery_date']) ? 1 : 0;
     $chk_order['delivery_time'] = isset($_REQUEST['check']['delivery_time']) ? 1 : 0;
     $chk_order['delidue_date'] = isset($_REQUEST['check']['delidue_date']) ? 1 : 0;
     $chk_order['order_status'] = isset($_REQUEST['check']['order_status']) ? 1 : 0;
     $chk_order['receipt_status'] = isset($_REQUEST['check']['receipt_status']) ? 1 : 0;
     $chk_order['receipted_date'] = isset($_REQUEST['check']['receipted_date']) ? 1 : 0;
     $chk_order['order_type'] = isset($_REQUEST['check']['order_type']) ? 1 : 0;
     $chk_order['total_amount'] = isset($_REQUEST['check']['total_amount']) ? 1 : 0;
     $chk_order['getpoint'] = isset($_REQUEST['check']['getpoint']) ? 1 : 0;
     $chk_order['usedpoint'] = isset($_REQUEST['check']['usedpoint']) ? 1 : 0;
     $chk_order['discount'] = isset($_REQUEST['check']['discount']) ? 1 : 0;
     $chk_order['shipping_charge'] = isset($_REQUEST['check']['shipping_charge']) ? 1 : 0;
     $chk_order['cod_fee'] = isset($_REQUEST['check']['cod_fee']) ? 1 : 0;
     $chk_order['tax'] = isset($_REQUEST['check']['tax']) ? 1 : 0;
     $csod_beforeremarks = wc2_get_custom_field_keys(WC2_CSOD, 'beforeremarks');
     if (!empty($csod_beforeremarks)) {
         foreach ($csod_beforeremarks as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     $chk_order['note'] = isset($_REQUEST['check']['note']) ? 1 : 0;
     $csod_other = wc2_get_custom_field_keys(WC2_CSOD, 'other');
     if (!empty($csod_other)) {
         foreach ($csod_other as $val) {
             $chk_order[$val] = isset($_REQUEST['check'][$val]) ? 1 : 0;
         }
     }
     $opt_order['chk_order'] = apply_filters('wc2_filter_admin_order_list_chk_order', $chk_order);
     wc2_update_option('opt_order', $opt_order);
     //---------------------------- TITLE -----------------------------//
     $title = '';
     //-------- Customer --------//
     $title .= '"' . __('ID', 'wc2') . '"';
     if (1 == $chk_order['deco_id']) {
         $title .= ',"' . __('Order number', 'wc2') . '"';
     }
     if (1 == $chk_order['order_date']) {
         $title .= ',"' . __('Order date', 'wc2') . '"';
     }
     if (1 == $chk_order['member_id']) {
         $title .= ',"' . __('Membership ID', 'wc2') . '"';
     }
     //cscs_head
     if (!empty($cscs_head)) {
         foreach ($cscs_head as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     if (1 == $chk_order['email']) {
         $title .= ',"' . __('E-mail', 'wc2') . '"';
     }
     //cscs_beforename
     if (!empty($cscs_beforename)) {
         foreach ($cscs_beforename as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     if (1 == $chk_order['name']) {
         $title .= ',"' . __('Name', 'wc2') . '"';
     }
     if (1 == $chk_order['kana']) {
         $title .= ',"' . __('Kana', 'wc2') . '"';
     }
     //cscs_aftername
     if (!empty($cscs_aftername)) {
         foreach ($cscs_aftername as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     if ('JP' == $applyform) {
         if (1 == $chk_order['country']) {
             $title .= ',"' . __('Country', 'wc2') . '"';
         }
         if (1 == $chk_order['zipcode']) {
             $title .= ',"' . __('Postal Code', 'wc2') . '"';
         }
         if (1 == $chk_order['pref']) {
             $title .= ',"' . __('Prefecture', 'wc2') . '"';
         }
         if (1 == $chk_order['address1']) {
             $title .= ',"' . __('City', 'wc2') . '"';
         }
         if (1 == $chk_order['address2']) {
             $title .= ',"' . __('Building name, floor, room number', 'wc2') . '"';
         }
         if (1 == $chk_order['tel']) {
             $title .= ',"' . __('Phone number', 'wc2') . '"';
         }
         if (1 == $chk_order['fax']) {
             $title .= ',"' . __('FAX number', 'wc2') . '"';
         }
     } else {
         if (1 == $chk_order['address2']) {
             $title .= ',"' . __('Building name, floor, room number', 'wc2') . '"';
         }
         if (1 == $chk_order['address1']) {
             $title .= ',"' . __('City', 'wc2') . '"';
         }
         if (1 == $chk_order['pref']) {
             $title .= ',"' . __('Prefecture', 'wc2') . '"';
         }
         if (1 == $chk_order['zipcode']) {
             $title .= ',"' . __('Postal Code', 'wc2') . '"';
         }
         if (1 == $chk_order['country']) {
             $title .= ',"' . __('Country', 'wc2') . '"';
         }
         if (1 == $chk_order['tel']) {
             $title .= ',"' . __('Phone number', 'wc2') . '"';
         }
         if (1 == $chk_order['fax']) {
             $title .= ',"' . __('FAX number', 'wc2') . '"';
         }
     }
     //cscs_bottom
     if (!empty($cscs_bottom)) {
         foreach ($cscs_bottom as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     //cscs_other
     if (!empty($cscs_other)) {
         foreach ($cscs_other as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     //-------- Delivery -------//
     //csde_head
     if (!empty($csde_head)) {
         foreach ($csde_head as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     //csde_beforename
     if (!empty($csde_beforename)) {
         foreach ($csde_beforename as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     if (1 == $chk_order['delivery_name']) {
         $title .= ',"' . __('Name', 'wc2') . '"';
     }
     if (1 == $chk_order['delivery_kana']) {
         $title .= ',"' . __('Kana', 'wc2') . '"';
     }
     //csde_aftername
     if (!empty($csde_aftername)) {
         foreach ($csde_aftername as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     if ('JP' == $applyform) {
         if (1 == $chk_order['delivery_country']) {
             $title .= ',"' . __('Shipping country', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_zipcode']) {
             $title .= ',"' . __('Shipping postal code', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_pref']) {
             $title .= ',"' . __('Shipping prefecture', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_address1']) {
             $title .= ',"' . __('Shipping city', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_address2']) {
             $title .= ',"' . __('Shipping building name, floor, room number', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_tel']) {
             $title .= ',"' . __('Shipping phone number', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_fax']) {
             $title .= ',"' . __('Shipping FAX number', 'wc2') . '"';
         }
     } else {
         if (1 == $chk_order['delivery_address2']) {
             $title .= ',"' . __('Shipping building name, floor, room number', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_address1']) {
             $title .= ',"' . __('Shipping city', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_pref']) {
             $title .= ',"' . __('Shipping prefecture', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_zipcode']) {
             $title .= ',"' . __('Shipping postal code', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_country']) {
             $title .= ',"' . __('Shipping country', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_tel']) {
             $title .= ',"' . __('Shipping phone number', 'wc2') . '"';
         }
         if (1 == $chk_order['delivery_fax']) {
             $title .= ',"' . __('Shipping FAX number', 'wc2') . '"';
         }
     }
     //csde_bottom
     if (!empty($csde_bottom)) {
         foreach ($csde_bottom as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     //csde_other
     if (!empty($csde_other)) {
         foreach ($csde_other as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     //--------- Order ---------//
     if (1 == $chk_order['shipping_date']) {
         $title .= ',"' . __('Shipping date', 'wc2') . '"';
     }
     if (1 == $chk_order['payment_method']) {
         $title .= ',"' . __('Payment method', 'wc2') . '"';
     }
     if (1 == $chk_order['delivery_method']) {
         $title .= ',"' . __('Delivery method', 'wc2') . '"';
     }
     if (1 == $chk_order['delivery_date']) {
         $title .= ',"' . __('Delivery date', 'wc2') . '"';
     }
     if (1 == $chk_order['delivery_time']) {
         $title .= ',"' . __('Delivery time', 'wc2') . '"';
     }
     if (1 == $chk_order['delidue_date']) {
         $title .= ',"' . __('Shipping schedule date', 'wc2') . '"';
     }
     if (1 == $chk_order['order_status']) {
         $title .= ',"' . __('Order status', 'wc2') . '"';
     }
     if (1 == $chk_order['receipt_status']) {
         $title .= ',"' . __('Receipt status', 'wc2') . '"';
     }
     if (1 == $chk_order['receipted_date']) {
         $title .= ',"' . __('Receipted date', 'wc2') . '"';
     }
     if (1 == $chk_order['order_type']) {
         $title .= ',"' . __('Order type', 'wc2') . '"';
     }
     if (1 == $chk_order['total_amount']) {
         $title .= ',"' . __('Total Amount', 'wc2') . '"';
     }
     if (1 == $chk_order['getpoint']) {
         $title .= ',"' . __('Granted points', 'wc2') . '"';
     }
     if (1 == $chk_order['usedpoint']) {
         $title .= ',"' . __('Used points', 'wc2') . '"';
     }
     if (1 == $chk_order['discount']) {
         $title .= ',"' . __('Discount', 'wc2') . '"';
     }
     if (1 == $chk_order['shipping_charge']) {
         $title .= ',"' . __('Shipping charges', 'wc2') . '"';
     }
     if (1 == $chk_order['cod_fee']) {
         $title .= ',"' . __('COD fee', 'wc2') . '"';
     }
     if (1 == $chk_order['tax']) {
         $title .= ',"' . __('Consumption tax', 'wc2') . '"';
     }
     //csod_beforeremarks
     if (!empty($csod_beforeremarks)) {
         foreach ($csod_beforeremarks as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     if (1 == $chk_order['note']) {
         $title .= ',"' . __('Notes', 'wc2') . '"';
     }
     //csod_other
     if (!empty($csod_other)) {
         foreach ($csod_other as $val) {
             if (1 == $chk_order[$val]) {
                 $name = wc2_get_custom_field_value($val, 'name');
                 $title .= ',"' . wc2_entity_decode($name) . '"';
             }
         }
     }
     $list .= apply_filters('wc2_filter_admin_order_list_dl_order_title', $title, $chk_order);
     $list .= "\n";
     //----------------------------- DATA ----------------------------//
     foreach ((array) $list_data as $row) {
         $order_id = $row['ID'];
         $data = $wc2_order->get_order_data($order_id);
         $delivery_data = $data['delivery'][0];
         //-------- Customer -------//
         $line = '"' . $order_id . '"';
         if (1 == $chk_order['deco_id']) {
             $line .= ',"' . $data['dec_order_id'] . '"';
         }
         if (1 == $chk_order['order_date']) {
             $line .= ',"' . $data['order_date'] . '"';
         }
         if (1 == $chk_order['member_id']) {
             $line .= ',"' . $data['member_id'] . '"';
         }
         //cscs_head
         if (!empty($cscs_head)) {
             foreach ($cscs_head as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_CUSTOMER][$cskey]) ? $data[WC2_CUSTOM_CUSTOMER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         if (1 == $chk_order['email']) {
             $line .= ',"' . wc2_entity_decode($data['email']) . '"';
         }
         //cscs_beforename
         if (!empty($cscs_beforename)) {
             foreach ($cscs_beforename as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_CUSTOMER][$cskey]) ? $data[WC2_CUSTOM_CUSTOMER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         if (1 == $chk_order['name']) {
             $line .= ',"' . wc2_entity_decode($data['name1'] . ' ' . $data['name2']) . '"';
         }
         if (1 == $chk_order['kana']) {
             $line .= ',"' . wc2_entity_decode($data['name3'] . ' ' . $data['name4']) . '"';
         }
         //cscs_aftername
         if (!empty($cscs_aftername)) {
             foreach ($cscs_aftername as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_CUSTOMER][$cskey]) ? $data[WC2_CUSTOM_CUSTOMER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         if ('JP' == $applyform) {
             if (1 == $chk_order['country']) {
                 $line .= ',"' . $locale_options['country'][$data['country']] . '"';
             }
             if (1 == $chk_order['zipcode']) {
                 $line .= ',"' . $data['zipcode'] . '"';
             }
             if (1 == $chk_order['pref']) {
                 $line .= ',"' . wc2_entity_decode($data['pref']) . '"';
             }
             if (1 == $chk_order['address1']) {
                 $line .= ',"' . wc2_entity_decode($data['address1']) . '"';
             }
             if (1 == $chk_order['address2']) {
                 $line .= ',"' . wc2_entity_decode($data['address2']) . '"';
             }
             if (1 == $chk_order['tel']) {
                 $line .= ',"' . $data['tel'] . '"';
             }
             if (1 == $chk_order['fax']) {
                 $line .= ',"' . $data['fax'] . '"';
             }
         } else {
             if (1 == $chk_order['address2']) {
                 $line .= ',"' . wc2_entity_decode($data['address2']) . '"';
             }
             if (1 == $chk_order['address1']) {
                 $line .= ',"' . wc2_entity_decode($data['address1']) . '"';
             }
             if (1 == $chk_order['pref']) {
                 $line .= ',"' . wc2_entity_decode($data['pref']) . '"';
             }
             if (1 == $chk_order['zipcode']) {
                 $line .= ',"' . $data['zipcode'] . '"';
             }
             if (1 == $chk_order['country']) {
                 $line .= ',"' . $locale_options['country'][$data['country']] . '"';
             }
             if (1 == $chk_order['tel']) {
                 $line .= ',"' . $data['tel'] . '"';
             }
             if (1 == $chk_order['fax']) {
                 $line .= ',"' . $data['fax'] . '"';
             }
         }
         //cscs_bottom
         if (!empty($cscs_bottom)) {
             foreach ($cscs_bottom as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_CUSTOMER][$cskey]) ? $data[WC2_CUSTOM_CUSTOMER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         //cscs_other
         if (!empty($cscs_other)) {
             foreach ($cscs_other as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_CUSTOMER][$cskey]) ? $data[WC2_CUSTOM_CUSTOMER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         //-------- Delivery -------//
         //csde_head
         if (!empty($csde_head)) {
             foreach ($csde_head as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_CUSTOMER][$cskey]) ? $data[WC2_CUSTOM_CUSTOMER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         //csde_beforename
         if (!empty($csde_beforename)) {
             foreach ($csde_beforename as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_CUSTOMER][$cskey]) ? $data[WC2_CUSTOM_CUSTOMER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         if (1 == $chk_order['delivery_name']) {
             $line .= ',"' . wc2_entity_decode($delivery_data['name1'] . ' ' . $delivery_data['name2']) . '"';
         }
         if (1 == $chk_order['delivery_kana']) {
             $line .= ',"' . wc2_entity_decode($delivery_data['name3'] . ' ' . $delivery_data['name4']) . '"';
         }
         //csde_aftername
         if (!empty($csde_aftername)) {
             foreach ($csde_aftername as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_CUSTOMER][$cskey]) ? $data[WC2_CUSTOM_CUSTOMER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         if ('JP' == $applyform) {
             if (1 == $chk_order['delivery_country']) {
                 $line .= ',"' . $locale_options['country'][$delivery_data['country']] . '"';
             }
             if (1 == $chk_order['delivery_zipcode']) {
                 $line .= ',"' . $delivery_data['zipcode'] . '"';
             }
             if (1 == $chk_order['delivery_pref']) {
                 $line .= ',"' . $delivery_data['pref'] . '"';
             }
             if (1 == $chk_order['delivery_address1']) {
                 $line .= ',"' . $delivery_data['address1'] . '"';
             }
             if (1 == $chk_order['delivery_address2']) {
                 $line .= ',"' . $delivery_data['address2'] . '"';
             }
             if (1 == $chk_order['delivery_tel']) {
                 $line .= ',"' . $delivery_data['tel'] . '"';
             }
             if (1 == $chk_order['delivery_fax']) {
                 $line .= ',"' . $delivery_data['fax'] . '"';
             }
         } else {
             if (1 == $chk_order['delivery_address2']) {
                 $line .= ',"' . $delivery_data['address2'] . '"';
             }
             if (1 == $chk_order['delivery_address1']) {
                 $line .= ',"' . $delivery_data['address1'] . '"';
             }
             if (1 == $chk_order['delivery_pref']) {
                 $line .= ',"' . $delivery_data['pref'] . '"';
             }
             if (1 == $chk_order['delivery_zipcode']) {
                 $line .= ',"' . $delivery_data['zipcode'] . '"';
             }
             if (1 == $chk_order['delivery_country']) {
                 $line .= ',"' . $locale_options['country'][$delivery_data['country']] . '"';
             }
             if (1 == $chk_order['delivery_tel']) {
                 $line .= ',"' . $delivery_data['tel'] . '"';
             }
             if (1 == $chk_order['delivery_fax']) {
                 $line .= ',"' . $delivery_data['fax'] . '"';
             }
         }
         //csde_bottom
         if (!empty($csde_bottom)) {
             foreach ($csde_bottom as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_CUSTOMER][$cskey]) ? $data[WC2_CUSTOM_CUSTOMER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         //csde_other
         if (!empty($csde_other)) {
             foreach ($csde_other as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_CUSTOMER][$cskey]) ? $data[WC2_CUSTOM_CUSTOMER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         //--------- Order ---------//
         if (1 == $chk_order['shipping_date']) {
             $line .= ',"' . $data['order_modified'] . '"';
         }
         if (1 == $chk_order['payment_method']) {
             $line .= ',"' . wc2_entity_decode($data['payment_name']) . '"';
         }
         if (1 == $chk_order['delivery_method']) {
             $line .= ',"' . wc2_entity_decode($data['delivery_name']) . '"';
         }
         if (1 == $chk_order['delivery_date']) {
             $line .= ',"' . $data['delivery_date'] . '"';
         }
         if (1 == $chk_order['delivery_time']) {
             $line .= ',"' . $data['delivery_time'] . '"';
         }
         if (1 == $chk_order['delidue_date']) {
             $line .= ',"' . $data['delidue_date'] . '"';
         }
         if (1 == $chk_order['order_status']) {
             $management_status_name = array_key_exists($data['order_status'], $management_status) ? $management_status[$data['order_status']] : '';
             $line .= ',"' . wc2_entity_decode($management_status_name) . '"';
         }
         if (1 == $chk_order['receipt_status']) {
             $receipt_status_name = array_key_exists($data['receipt_status'], $receipt_status) ? $receipt_status[$data['receipt_status']] : '';
             $line .= ',"' . wc2_entity_decode($receipt_status_name) . '"';
         }
         if (1 == $chk_order['receipted_date']) {
             $line .= ',"' . $data['receipted_date'] . '"';
         }
         if (1 == $chk_order['order_type']) {
             $order_type_name = array_key_exists($data['order_type'], $order_type) ? $order_type[$data['order_type']] : '';
             $line .= ',"' . wc2_entity_decode($order_type_name) . '"';
         }
         if (1 == $chk_order['total_amount']) {
             $total_price = $data['item_total_price'] - $data['usedpoint'] + $data['discount'] + $data['shipping_charge'] + $data['cod_fee'] + $data['tax'];
             $line .= ',"' . $total_price . '"';
         }
         if (1 == $chk_order['getpoint']) {
             $line .= ',"' . $data['getpoint'] . '"';
         }
         if (1 == $chk_order['usedpoint']) {
             $line .= ',"' . $data['usedpoint'] . '"';
         }
         if (1 == $chk_order['discount']) {
             $line .= ',"' . $data['discount'] . '"';
         }
         if (1 == $chk_order['shipping_charge']) {
             $line .= ',"' . $data['shipping_charge'] . '"';
         }
         if (1 == $chk_order['cod_fee']) {
             $line .= ',"' . $data['cod_fee'] . '"';
         }
         if (1 == $chk_order['tax']) {
             $line .= ',"' . $data['tax'] . '"';
         }
         //csod_beforeremarks
         if (!empty($csod_beforeremarks)) {
             foreach ($csod_beforeremarks as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_ORDER][$cskey]) ? $data[WC2_CUSTOM_ORDER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         if (1 == $chk_order['note']) {
             $line .= ',"' . wc2_entity_decode($data['note']) . '"';
         }
         //csod_other
         if (!empty($csod_other)) {
             foreach ($csod_other as $val) {
                 if (1 == $chk_order[$val]) {
                     list($pfx, $cskey) = explode('_', $val, 2);
                     $value = isset($data[WC2_CUSTOM_ORDER][$cskey]) ? $data[WC2_CUSTOM_ORDER][$cskey] : '';
                     $line .= ',"' . wc2_entity_decode($value) . '"';
                 }
             }
         }
         $list .= apply_filters('wc2_filter_admin_order_list_dl_order', $line, $chk_order, $data);
         $list .= "\n";
     }
     header("Content-Type: application/octet-stream");
     header("Content-Disposition: attachment; filename=wc2_order_list.csv");
     mb_http_output("pass");
     print mb_convert_encoding($list, "SJIS-win", "UTF-8");
     exit;
 }