本文整理汇总了PHP中WPSC_Countries::get_country方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSC_Countries::get_country方法的具体用法?PHP WPSC_Countries::get_country怎么用?PHP WPSC_Countries::get_country使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSC_Countries
的用法示例。
在下文中一共展示了WPSC_Countries::get_country方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _wpsc_set_legacy_country_meta
/**
* Sets meta for countries that no longer exist in their former notation to be considered legacy.
*
* @access private
* @since 3.8.14
*/
function _wpsc_set_legacy_country_meta()
{
if ($wpsc_country = WPSC_Countries::get_country('YU')) {
$wpsc_country->set('_is_country_legacy', true);
}
if ($wpsc_country = WPSC_Countries::get_country('AN')) {
$wpsc_country->set('_is_country_legacy', true);
}
if ($wpsc_country = WPSC_Countries::get_country('TP')) {
$wpsc_country->set('_is_country_legacy', true);
}
}
示例2: get_tax_rate
/**
* get_tax_rate method, gets the tax rate as a percentage, based on the selected country and region
* * EDIT: Replaced with WPEC Taxes - this function should probably be deprecated
* Note: to refresh cart items use wpsc_refresh_cart_items
*
* @access public
*/
function get_tax_rate()
{
$country = new WPSC_Country(get_option('base_country'));
$country_data = WPSC_Countries::get_country(get_option('base_country'), true);
$add_tax = false;
if ($this->selected_country == get_option('base_country')) {
// Tax rules for various countries go here, if your countries tax rules
// deviate from this, please supply code to add your region
switch ($this->selected_country) {
case 'US':
// USA!
$tax_region = get_option('base_region');
if ($this->selected_region == get_option('base_region') && get_option('lock_tax_to_shipping') != '1') {
// if they in the state, they pay tax
$add_tax = true;
} else {
if ($this->delivery_region == get_option('base_region')) {
// if they live outside the state, but are delivering to within the state, they pay tax also
$add_tax = true;
}
}
break;
case 'CA':
// Canada! apparently in canada, the region that you are in is used for tax purposes
if ($this->selected_region != null) {
$tax_region = $this->selected_region;
} else {
$tax_region = get_option('base_region');
}
$add_tax = true;
break;
default:
// Everywhere else!
$tax_region = get_option('base_region');
if ($country->has_regions()) {
if (get_option('base_region') == $region) {
$add_tax = true;
}
} else {
$add_tax = true;
}
break;
}
}
if ($add_tax == true) {
if ($country->has_regions()) {
$region = $country->get_region($tax_region);
$tax_percentage = $region->get_tax();
} else {
$tax_percentage = $country->get_tax();
}
} else {
// no tax charged = tax equal to 0%
$tax_percentage = 0;
}
if ($this->tax_percentage != $tax_percentage) {
$this->clear_cache();
$this->tax_percentage = $tax_percentage;
$this->wpsc_refresh_cart_items();
}
}
示例3: get_cache
public static function get_cache($value = null, $col = 'id')
{
$function = __CLASS__ . '::' . __FUNCTION__ . '()';
$replacement = 'WPSC_Countries::get_country()';
_wpsc_deprecated_function($function, '3.8.14', $replacement);
if (defined('WPSC_LOAD_DEPRECATED') && WPSC_LOAD_DEPRECATED) {
if (is_null($value) && $col == 'id') {
$value = get_option('currency_type');
}
// note that we can't store cache by currency code, the code is used by various countries
// TODO: remove duplicate entry for Germany (Deutschland)
if (!in_array($col, array('id', 'isocode'))) {
return false;
}
return WPSC_Countries::get_country($value, WPSC_Countries::RETURN_AN_ARRAY);
}
}
示例4: wpsc_country_has_state
function wpsc_country_has_state($country_code)
{
$country_data = WPSC_Countries::get_country($country_code, true);
// TODO this function does not seem to do what it's name indicates? What's up with that.
return $country_data;
}