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


PHP WPSC_Countries::get_country方法代码示例

本文整理汇总了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);
    }
}
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:18,代码来源:11.php

示例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();
     }
 }
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:68,代码来源:cart.class.php

示例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);
     }
 }
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:17,代码来源:wpsc-country.class.php

示例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;
}
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:6,代码来源:misc.functions.php


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