当前位置: 首页>>代码示例>>PHP>>正文


PHP WPSC_Countries::get_countries方法代码示例

本文整理汇总了PHP中WPSC_Countries::get_countries方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSC_Countries::get_countries方法的具体用法?PHP WPSC_Countries::get_countries怎么用?PHP WPSC_Countries::get_countries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WPSC_Countries的用法示例。


在下文中一共展示了WPSC_Countries::get_countries方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _wpsc_country_dropdown_options

/**
 * Get the country dropdown options, presumably for the checkout or customer profile pages
 *
 * @param 	string|array  	$args
 *
 * @return 	string			HTML representation of the dropdown
 */
function _wpsc_country_dropdown_options($args = '')
{
    $defaults = array('acceptable' => null, 'acceptable_ids' => null, 'selected' => '', 'disabled' => null, 'disabled_ids' => null, 'placeholder' => __('Please select a country', 'wpsc'), 'include_invisible' => false);
    $args = wp_parse_args($args, $defaults);
    $output = '';
    $countries = WPSC_Countries::get_countries($args['include_invisible']);
    // if the user has a choice of countries the
    if (count($countries) > 1 && !empty($args['placeholder'])) {
        $output .= "<option value=''>" . esc_html($args['placeholder']) . "</option>\n\r";
    }
    foreach ($countries as $country) {
        $isocode = $country->get_isocode();
        $name = $country->get_name();
        // if there is only one country in the list select it
        if (count($countries) == 1) {
            $args['selected'] = $isocode;
        }
        // if we're in admin area, and the legacy country code "UK" or "TP" is selected as the
        // base country, we should display both this and the more proper "GB" or "TL" options
        // and distinguish these choices somehow
        if (is_admin() && 11 > wpsc_core_get_db_version()) {
            if (in_array($isocode, array('TP', 'UK'))) {
                /* translators: This string will mark the legacy isocode "UK" and "TP" in the country selection dropdown as "legacy" */
                $name = sprintf(__('%s (legacy)', 'wpsc'), $name);
            } elseif (in_array($isocode, array('GB', 'TL'))) {
                /* translators: This string will mark the legacy isocode "GB" and "TL" in the country selection dropdown as "ISO 3166" */
                $name = sprintf(__('%s (ISO 3166)', 'wpsc'), $name);
            }
        }
        $output .= sprintf('<option value="%1$s" %2$s %3$s>%4$s</option>' . "\n\r", esc_attr($isocode), selected($args['selected'], $isocode, false), disabled(_wpsc_is_country_disabled($country, $args), true, false), esc_html($name));
    }
    return $output;
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:40,代码来源:country-region-tax-util.php

示例2: _wpsc_countries_localizations

/**
 * add countries data to the wpec javascript localizations
 *
 * @access private
 * @since 3.8.14
 *
 * @param array 	localizations  other localizations that can be added to
 *
 * @return array	localizations array with countries information added
 */
function _wpsc_countries_localizations($localizations_array)
{
    $localizations_array['no_country_selected'] = __('Please select a country', 'wpsc');
    $localizations_array['no_region_selected_format'] = __('Please select a %s', 'wpsc');
    $localizations_array['no_region_label'] = __('State/Province', 'wpsc');
    $localizations_array['base_country'] = get_option('base_country');
    $country_list = array();
    foreach (WPSC_Countries::get_countries() as $country_id => $wpsc_country) {
        if ($wpsc_country->is_visible()) {
            $country_list[$wpsc_country->get_isocode()] = $wpsc_country->get_name();
            if ($wpsc_country->has_regions()) {
                $regions = $wpsc_country->get_regions();
                $region_list = array();
                foreach ($regions as $region_id => $wpsc_region) {
                    $region_list[$region_id] = $wpsc_region->get_name();
                }
                if (!empty($region_list)) {
                    $localizations_array['wpsc_country_' . $wpsc_country->get_isocode() . '_regions'] = $region_list;
                }
            }
            $region_label = $wpsc_country->get('region_label');
            if (!empty($region_label)) {
                $localizations_array['wpsc_country_' . $wpsc_country->get_isocode() . '_region_label'] = $region_label;
            }
        }
    }
    if (!empty($country_list)) {
        $localizations_array['wpsc_countries'] = $country_list;
    }
    return $localizations_array;
}
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:41,代码来源:checkout-localization.php

示例3: no_target_markets

    public function no_target_markets()
    {
        $countries = WPSC_Countries::get_countries();
        if (empty($countries)) {
            ?>
			<div class="notice error is-dismissible below-h2">
				<p><?php 
            _e('<strong>You have not enabled any target markets.</strong> To sell tangible goods, you will need to set at least one target market.', 'wpsc');
            ?>
</p>
			</div>
			<?php 
        }
    }
开发者ID:parkesma,项目名称:WP-e-Commerce,代码行数:14,代码来源:general.php

示例4: wpsc_country_list

/**
 * get a country list for checkout
 *
 * @param string|null $form_id
 * @param deprecated|null $ajax
 * @param string|null $selected_country
 * @param deprecated|null $selected_region
 * @param string|null $supplied_form_id
 * @param boolean $shippingfields
 * @return string
 */
function wpsc_country_list($form_id = null, $ajax = null, $selected_country = null, $selected_region = null, $supplied_form_id = null, $shippingfields = false)
{
    global $wpdb;
    $output = '';
    if ($form_id != null) {
        $html_form_id = "region_country_form_{$form_id}";
    } else {
        $html_form_id = 'region_country_form';
    }
    if ($shippingfields) {
        $js = '';
        $title = 'shippingcountry';
        $id = 'shippingcountry';
    } else {
        $js = '';
        $title = 'billingcountry';
        $id = 'billingcountry';
    }
    if (empty($supplied_form_id)) {
        $supplied_form_id = $id;
    }
    // if there is only one country to choose from we are going to set that as the shipping country,
    // later in the UI generation the same thing will happen to make the single country the current
    // selection
    $countries = WPSC_Countries::get_countries(false);
    if (count($countries) == 1) {
        reset($countries);
        $id_of_only_country_available = key($countries);
        $wpsc_country = new WPSC_Country($id_of_only_country_available);
        wpsc_update_customer_meta($id, $wpsc_country->get_isocode());
    }
    $additional_attributes = 'data-wpsc-meta-key="' . $title . '" title="' . $title . '" ' . $js;
    $output .= "<div id='{$html_form_id}'>\n\r";
    $output .= wpsc_get_country_dropdown(array('id' => $supplied_form_id, 'name' => "collected_data[{$form_id}][0]", 'class' => 'current_country wpsc-visitor-meta', 'selected' => $selected_country, 'additional_attributes' => $additional_attributes, 'placeholder' => __('Please select a country', 'wp-e-commerce')));
    $output .= "</div>\n\r";
    return $output;
}
开发者ID:ashik968,项目名称:digiplot,代码行数:48,代码来源:shopping_cart_functions.php

示例5: wpsc_shipping_country_list

function wpsc_shipping_country_list($shippingdetails = false)
{
    global $wpsc_shipping_modules;
    $wpsc_checkout = new wpsc_checkout();
    $wpsc_checkout->checkout_item = $shipping_country_checkout_item = $wpsc_checkout->get_checkout_item('shippingcountry');
    $output = '';
    if ($shipping_country_checkout_item && $shipping_country_checkout_item->active) {
        if (!$shippingdetails) {
            $output = "<input type='hidden' name='wpsc_ajax_action' value='update_location' />";
        }
        $acceptable_countries = wpsc_get_acceptable_countries();
        // if there is only one country to choose from we are going to set that as the shipping country,
        // later in the UI generation the same thing will happen to make the single country the current
        // selection
        $countries = WPSC_Countries::get_countries(false);
        if (count($countries) == 1) {
            reset($countries);
            $id_of_only_country_available = key($countries);
            $wpsc_country = new WPSC_Country($id_of_only_country_available);
            wpsc_update_customer_meta('shippingcountry', $wpsc_country->get_isocode());
        }
        $selected_country = wpsc_get_customer_meta('shippingcountry');
        $additional_attributes = 'data-wpsc-meta-key="shippingcountry" ';
        $output .= wpsc_get_country_dropdown(array('id' => 'current_country', 'name' => 'country', 'class' => 'current_country wpsc-visitor-meta', 'acceptable_ids' => $acceptable_countries, 'selected' => $selected_country, 'additional_attributes' => $additional_attributes, 'placeholder' => __('Please select a country', 'wp-e-commerce')));
    }
    $output .= wpsc_checkout_shipping_state_and_region();
    $zipvalue = (string) wpsc_get_customer_meta('shippingpostcode');
    $zip_code_text = __('Your Zipcode', 'wp-e-commerce');
    if ($zipvalue != '' && $zipvalue != $zip_code_text) {
        $color = '#000';
        wpsc_update_customer_meta('shipping_zip', $zipvalue);
    } else {
        $zipvalue = $zip_code_text;
        $color = '#999';
    }
    $uses_zipcode = false;
    $custom_shipping = get_option('custom_shipping_options');
    foreach ((array) $custom_shipping as $shipping) {
        if (isset($wpsc_shipping_modules[$shipping]->needs_zipcode) && $wpsc_shipping_modules[$shipping]->needs_zipcode == true) {
            $uses_zipcode = true;
        }
    }
    if ($uses_zipcode) {
        $output .= " <input data-wpsc-meta-key='shippingpostcode' class='wpsc-visitor-meta' type='text' style='color:" . $color . ";' onclick='if (this.value==\"" . esc_js($zip_code_text) . "\") {this.value=\"\";this.style.color=\"#000\";}' onblur='if (this.value==\"\") {this.style.color=\"#999\"; this.value=\"" . esc_js($zip_code_text) . "\"; }' value='" . esc_attr($zipvalue) . "' size='10' name='zipcode' id='zipcode'>";
    }
    return $output;
}
开发者ID:ashik968,项目名称:digiplot,代码行数:47,代码来源:checkout.php

示例6: get_all

 public static function get_all($include_invisible = false)
 {
     $function = __CLASS__ . '::' . __FUNCTION__ . '()';
     $replacement = 'WPSC_Countries::get_country()';
     _wpsc_deprecated_function($function, '3.8.14', $replacement);
     if (defined('WPSC_LOAD_DEPRECATED') && WPSC_LOAD_DEPRECATED) {
         $list = WPSC_Countries::get_countries($include_invisible);
         return apply_filters('wpsc_country_get_all_countries', $list);
     }
 }
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:10,代码来源:wpsc-country.class.php

示例7: _wpsc_filter_control_select_country

function _wpsc_filter_control_select_country($output, $field, $args)
{
    extract($field);
    $country_data = WPSC_Countries::get_countries();
    $options = array();
    foreach ($country_data as $country) {
        $isocode = $country->get_isocode();
        $alternatives = array($country->get_isocode());
        switch ($isocode) {
            case 'US':
                $alternatives[] = __('United States of America', 'wp-e-commerce');
                break;
            case 'GB':
                $alternatives[] = __('Great Britain', 'wp-e-commerce');
                $alternatives[] = __('England', 'wp-e-commerce');
                $alternatives[] = __('Wales', 'wp-e-commerce');
                $alternatives[] = __('UK', 'wp-e-commerce');
                $alternatives[] = __('Scotland', 'wp-e-commerce');
                $alternatives[] = __('Northern Ireland', 'wp-e-commerce');
                break;
        }
        $alternatives = apply_filters('wpsc_country_alternative_spellings', $alternatives, $isocode, $country);
        $options[$country->get_isocode()] = array('title' => $country->get_name(), 'attributes' => array('data-alternative-spellings' => implode(' ', $alternatives)));
    }
    $output .= wpsc_form_select($name, $value, $options, array('id' => $id . '-control', 'class' => 'wpsc-form-select-country'), false);
    return $output;
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:27,代码来源:form.php


注:本文中的WPSC_Countries::get_countries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。