Esempio n. 1
0
 /><?php 
_e('Membership points', 'wc2');
?>
</label>&nbsp;
					<label for="chk_mem[registered]"><input type="checkbox" class="check_member" id="chk_mem[registered]" value="registered"<?php 
wc2_checked_e($chk_mem, 'registered');
?>
 /><?php 
_e('Started date', 'wc2');
?>
</label>&nbsp;
<?php 
$oth_keys = WC2_Funcs::get_custom_field_keys(WC2_CSMB, 'other');
if (!empty($oth_keys)) {
    foreach ($oth_keys as $key => $csmb_key) {
        $checked = WC2_Funcs::get_checked($chk_mem, $csmb_key);
        $name = $wc2_options[$csmb_key]['name'];
        echo '<label for="chk_mem[' . $csmb_key . ']"><input type="checkbox" class="check_member" id="chk_mem[' . esc_attr($csmb_key) . ']" value="' . esc_attr($csmb_key) . '"' . $checked . ' />' . esc_html($name) . '</label>' . "\n";
    }
}
?>
					<?php 
//do_action( 'wc2_action_chk_mem', $chk_mem );
?>
				</fieldset>

			</div><!--dialog-->

		</div><!--member_list-->
	</div><!--wc2_admin-->
</div><!--wrap-->
 function update_delivery_days()
 {
     $data = wc2_stripslashes_deep_post($_POST);
     $delivery_days = wc2_get_option('delivery_days');
     $system_ops = wc2_get_option('system');
     $name = trim($data['name']);
     $id = (int) $data['id'];
     for ($i = 0; $i < count($delivery_days); $i++) {
         if ($delivery_days[$i]['id'] === $id) {
             $index = $i;
         }
     }
     $delivery_days[$index]['name'] = $name;
     $target_market = isset($system_ops['target_market']) && !empty($system_ops['target_market']) ? $system_ops['target_market'] : WC2_Funcs::get_local_target_market();
     $query = explode('&', $data['query']);
     foreach ((array) $query as $query_val) {
         list($key, $val) = explode('=', $query_val);
         $data[$key][] = $val;
     }
     foreach ((array) $target_market as $tm) {
         $prefs = $system_ops['province'][$tm];
         $value = $data['value_' . $tm];
         for ($i = 0; $i < count($prefs); $i++) {
             $delivery_days[$index][$tm][$prefs[$i]] = (int) $value[$i];
         }
     }
     $res = wc2_update_option('delivery_days', $delivery_days);
     if ($res !== NULL) {
         //success
         $new_delivery_days = wc2_get_option('delivery_days');
         $data_val = $new_delivery_days[$index];
         $data = array('message' => __('Updated!'), 'value' => $data_val);
         wp_send_json_success($data);
     } else {
         //error
         $data = array('message' => __('Update Failed'));
         wp_send_json_error($data);
     }
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
				<?php 
    }
}
?>
					<label for="chk-order-note"><input type="checkbox" class="check-order" id="chk-order-note" value="note"<?php 
wc2_checked_e($chk_order, 'note');
?>
 /><?php 
_e('Notes', 'wc2');
?>
</label>
				<?php 
$oth_keys = WC2_Funcs::get_custom_field_keys(WC2_CSOD, 'other');
if (!empty($oth_keys)) {
    foreach ($oth_keys as $key => $cs_key) {
        $checked = WC2_Funcs::get_checked($chk_order, $cs_key);
        $entry = wc2_get_option($cs_key);
        $name = $entry['name'];
        ?>
					<label for="chk-order-<?php 
        esc_attr_e($cs_key);
        ?>
"><input type="checkbox" class="check-order" id="chk-order-<?php 
        esc_attr_e($cs_key);
        ?>
" value="<?php 
        esc_attr_e($cs_key);
        ?>
"<?php 
        echo $checked;
        ?>
Esempio n. 5
0
function wc2_get_target_market_form($type, $selected){
	$res = WC2_Funcs::get_target_market_form( $type, $selected );
	return $res;
}
 public function custom_field_ajax()
 {
     $err = new WP_Error();
     if (!check_ajax_referer('wc2_custom_field', 'wc2_nonce', false) || !isset($_REQUEST['directive']) || !isset($_REQUEST['prefix'])) {
         $err->add('error', '不正なパラメータです');
     } else {
         $action = $_REQUEST['directive'];
         $prefix = $_REQUEST['prefix'];
         $value = NULL;
         switch ($action) {
             //case 'add_member':
             case 'add':
                 $args = array('key' => $_REQUEST['newkey'], 'name' => $_REQUEST['newname'], 'value' => rtrim($_REQUEST['newvalue'], "\n"), 'capa' => $_REQUEST['newcapa'], 'means' => $_REQUEST['newmeans'], 'essential' => $_REQUEST['newessential'], 'position' => $_REQUEST['newposition']);
                 $new_key = $this->add_custom_field($prefix, $args);
                 if (0 === $new_key) {
                     $err->add($action, '同じフィールドキーが存在します。');
                 } elseif (!$new_key) {
                     $err->add($action, '新規カスタムフィールドを登録できませんでした。');
                 }
                 $csmb_field_keys = WC2_Funcs::get_custom_field_keys($prefix);
                 if (is_array($csmb_field_keys)) {
                     foreach ($csmb_field_keys as $custom_field_key) {
                         $value .= $this->get_custom_field($custom_field_key);
                     }
                 }
                 break;
             case 'update':
                 $args = array('key' => $_REQUEST['key'], 'name' => $_REQUEST['name'], 'value' => rtrim($_REQUEST['value'], "\n"), 'capa' => $_REQUEST['capa'], 'means' => $_REQUEST['means'], 'essential' => $_REQUEST['essential'], 'position' => $_REQUEST['position']);
                 $res = $this->update_custom_field($prefix, $args);
                 if (!$res && 0 !== $res) {
                     $err->add($action, 'カスタムフィールドを更新できませんでした。');
                 }
                 $csmb_field_keys = WC2_Funcs::get_custom_field_keys($prefix);
                 if (is_array($csmb_field_keys)) {
                     foreach ($csmb_field_keys as $custom_field_key) {
                         $value .= $this->get_custom_field($custom_field_key);
                     }
                 }
                 break;
             case 'remove':
                 $args = array('key' => $_REQUEST['key']);
                 $res = $this->remove_custom_field($prefix, $args);
                 if (!$res) {
                     $err->add($action, 'カスタムフィールドを削除できませんでした。');
                 }
                 $csmb_field_keys = WC2_Funcs::get_custom_field_keys($prefix);
                 if (is_array($csmb_field_keys)) {
                     foreach ($csmb_field_keys as $custom_field_key) {
                         $value .= $this->get_custom_field($custom_field_key);
                     }
                 }
                 break;
             default:
                 $err->add('error', '不正なパラメータです');
                 break;
         }
     }
     if ($err->get_error_code()) {
         $data = array('message' => $err->get_error_messages(), 'value' => $value);
         wp_send_json_error($data);
     } else {
         $data = array('message' => 'OK', 'value' => $value);
         wp_send_json_success($data);
     }
 }
Esempio n. 7
0
 static function get_pref_select($type, $values)
 {
     $system_options = wc2_get_option('system');
     $country = empty($values['country']) ? wc2_get_base_country() : $values['country'];
     if (!in_array($country, $system_options['target_market'])) {
         $country = $system_options['target_market'][0];
     }
     $prefs = WC2_Funcs::get_states($country);
     $html = '<select name="' . esc_attr($type . '[pref]') . '" id="' . esc_attr($type) . '_pref" class="pref">';
     $prefs_count = count($prefs);
     if ($prefs_count > 0) {
         $select = __('-- 選択 --', 'wc2');
         $html .= '<option value="' . esc_attr(WC2_UNSELECTED) . '">' . esc_html($select) . "</option>\n";
         for ($i = 0; $i < $prefs_count; $i++) {
             $html .= '<option value="' . esc_attr($prefs[$i]) . '"' . ($prefs[$i] == $values['pref'] ? ' selected="selected"' : '') . '>' . esc_html($prefs[$i]) . "</option>\n";
         }
     }
     $html .= "</select>\n";
     return $html;
 }