Example #1
0
function wc2_get_states($country) {
	$res = WC2_Funcs::get_states($country);

	echo $res;
}
Example #2
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;
 }