Пример #1
0
/**
 * 3.8.14 supports country meta and a feature that let's a countries regions be called by the
 * proper name.  Here we initialize the values.
 *
 * @access private
 * @since 3.8.14
 *
 */
function _wpsc_add_region_name_meta()
{
    $wpsc_country = new WPSC_Country('US');
    $wpsc_country->set('region_label', __('State', 'wp-e-commerce'));
    $wpsc_country = new WPSC_Country('CA');
    $wpsc_country->set('region_label', __('Province', 'wp-e-commerce'));
}
Пример #2
0
function _wpsc_maybe_create_UK()
{
    $country = new WPSC_Country('GB', 'isocode');
    if (!$country->exists()) {
        $country->set(array('id' => 138, 'country' => __('United Kingdom', 'wpsc'), 'currency' => __('Pound Sterling', 'wpsc'), 'symbol' => __('£', 'wpsc'), 'symbol_html' => __('£', 'wpsc'), 'code' => __('GBP', 'wpsc'), 'continent' => 'europe'));
        $country->save();
    }
}
Пример #3
0
/**
 * Reset United Kingdom country data to default, hide ISO code 'UK'
 *
 * @access private
 * @since 3.8.14
 */
function _wpsc_fix_united_kingdom()
{
    if ($wpsc_country = WPSC_Countries::get_country('UK')) {
        $legacy_ok_country_was_visible = $wpsc_country->is_visible();
        $wpsc_country = new WPSC_Country(array('visible' => '0', 'isocode' => 'UK'));
        $wpsc_country->set('_is_country_legacy', true);
    }
    $wpsc_country = new WPSC_Country(array('country' => __('United Kingdom', 'wpsc'), 'isocode' => 'GB', 'currency' => __('Pound Sterling', 'wpsc'), 'symbol' => __('£', 'wpsc'), 'symbol_html' => __('£', 'wpsc'), 'code' => __('GBP', 'wpsc'), 'continent' => 'europe', 'visible' => $legacy_ok_country_was_visible ? '0' : '1', 'has_regions' => '0', 'tax' => '0'));
    //make sure base country is ok after the UK/GB fix
    $base_country = get_option('base_country', '');
    if (!empty($base_country) && is_numeric($base_country)) {
        $wpsc_country = new WPSC_Country($base_country);
        if ('UK' == $wpsc_country->get_isocode()) {
            $wpsc_country = new WPSC_Country('GB');
            update_option('base_country', $wpsc_country->get_id());
        }
    }
}
 function test_set()
 {
     $country = new WPSC_Country(self::COUNTRY_ID_WITHOUT_REGIONS);
     $country->set('name', 'XXX');
     // This should not set the property.
     $name = $country->get('name');
     $this->assertEquals(self::COUNTRY_NAME_WITHOUT_REGIONS, $name);
     $country->set('isocode', 'XX');
     // This should not set the property.
     $isocode = $country->get('isocode');
     $this->assertEquals(self::COUNTRY_ISOCODE_WITHOUT_REGIONS, $isocode);
     $country->set('omgwtfbbq_new', 'OMG');
     // This SHOULD set the property.
     $omg = $country->get('omgwtfbbq_new');
     $this->assertEquals('OMG', $omg);
     $country->set('omgwtfbbq_new', '');
     // Clear it out.
     $omg = $country->get('omgwtfbbq_new');
     $this->assertEquals('', $omg);
 }
Пример #5
0
/**
 * Add the county region label to the uk
 *
 * @access private
 * @since 3.8.14.1
 */
function _wpsc_add_region_label_to_uk()
{
    $wpsc_country = new WPSC_Country('GB');
    $wpsc_country->set('region_label', __('County', 'wpsc'));
}
Пример #6
0
function _wpsc_fix_sudan_currency()
{
    $country = new WPSC_Country('SD', 'isocode');
    $country->set(array('currency' => __('Sudanese Pound', 'wpsc'), 'code' => __('SDG', 'wpsc')));
    $country->save();
}
Пример #7
0
function _wpsc_fix_zimbabwe_currency()
{
    $country = new WPSC_Country('ZW', 'isocode');
    $country->set(array('currency' => __('US Dollar', 'wpsc'), 'symbol' => __('$', 'wpsc'), 'symbol_html' => __('&#036', 'wpsc'), 'code' => 'USD', 'continent' => 'asiapacific'));
    $country->save();
}