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


PHP WPSC_Country::get_isocode方法代码示例

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


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

示例1: _wpsc_fix_united_kingdom

/**
 * 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());
        }
    }
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:24,代码来源:11.php

示例2: _wpsc_acceptable_shipping_countries_into_checkout_page

/**
 * On the checkout page create a hidden element holding the acceptable shipping countries
 *
 * This let's the wp-e-commerce javascript process any dependency rules even if the store has configured
 * the checkout forms so that some fields are hidden.  The most important of these fields are the
 * country, region and state fields. But it's just as easy to include all of them and not worry about
 * what various parts of WPeC, themes or plugs may be doing.
 *
 * @since 3.8.14
 *
 * @access private
 */
function _wpsc_acceptable_shipping_countries_into_checkout_page()
{
    $acceptable_countries = wpsc_get_acceptable_countries();
    // if the acceptable countries is true all available countries can be shipped to,
    // otherwise we are going to restrict the countries list
    if ($acceptable_countries !== true) {
        $country_code_list = array();
        foreach ($acceptable_countries as $key => $country_id) {
            $wpsc_country = new WPSC_Country($country_id);
            $country_code_list[$wpsc_country->get_isocode()] = $wpsc_country->get_name();
        }
        ?>
		<script type="text/javascript">
		/* <![CDATA[ */
			var wpsc_acceptable_shipping_countries = <?php 
        echo json_encode($country_code_list);
        ?>
;
		/* ]]> */
		</script>
		<?php 
    }
}
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:35,代码来源:checkout-localization.php

示例3:

 function test_get_isocode()
 {
     $country = new WPSC_Country(self::COUNTRY_ID_WITHOUT_REGIONS);
     $this->assertEquals(self::COUNTRY_ISOCODE_WITHOUT_REGIONS, $country->get_isocode());
 }
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:5,代码来源:test-wpsc-country.class.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_shipping_method_js_vars

 private function get_shipping_method_js_vars()
 {
     global $wpsc_cart;
     $js_var = array('subtotal' => (double) $wpsc_cart->calculate_subtotal(), 'shipping' => array(), 'tax' => wpsc_is_tax_enabled() && !wpsc_is_tax_included() ? (double) wpsc_cart_tax(false) : 0, 'discount' => wpsc_coupon_amount(false) > 0 ? wpsc_coupon_amount(false) : 0);
     foreach ($this->shipping_calculator->sorted_quotes as $module_name => $quotes) {
         foreach ($quotes as $option => $cost) {
             $id = $this->shipping_calculator->ids[$module_name][$option];
             $js_var['shipping'][$id] = $cost;
         }
     }
     $currency = new WPSC_Country(get_option('currency_type'));
     $currency_code = $currency->get_currency_code();
     $isocode = $currency->get_isocode();
     $without_fractions = in_array($currency_code, WPSC_Payment_Gateways::currencies_without_fractions());
     $decimals = $without_fractions ? 0 : 2;
     $decimals = apply_filters('wpsc_modify_decimals', $decimals, $isocode);
     $decimal_separator = apply_filters('wpsc_format_currency_decimal_separator', wpsc_get_option('decimal_separator'), $isocode);
     $thousands_separator = apply_filters('wpsc_format_currency_thousands_separator', wpsc_get_option('thousands_separator'), $isocode);
     $symbol = apply_filters('wpsc_format_currency_currency_symbol', $currency->get_currency_symbol());
     $sign_location = get_option('currency_sign_location');
     $js_var['formatter'] = array('currency_code' => $currency_code, 'without_fractions' => $without_fractions, 'decimals' => $decimals, 'decimal_separator' => $decimal_separator, 'thousands_separator' => $thousands_separator, 'symbol' => $symbol, 'sign_location' => $sign_location);
     return $js_var;
 }
开发者ID:androidprojectwork,项目名称:WP-e-Commerce,代码行数:23,代码来源:checkout.php

示例7: refund_payment

 /**
  * Refund a payment
  *
  * @param  string $capture_id
  * @param  float  $amount
  * @param  string $note
  */
 public function refund_payment($capture_id, $amount, $note)
 {
     if ($this->log->get('gateway') == 'amazon-payments') {
         if ($this->doing_ipn) {
             return;
         }
         $base_country = new WPSC_Country(wpsc_get_base_country());
         if ('US' == $base_country->get_isocode() && $amount > $this->log->get('totalprice')) {
             $this->log->set('amazon-status', __('Unable to refund funds via amazon:', 'wpsc') . ' ' . __('Refund amount is greater than order total.', 'wpsc'))->save();
             return;
         } elseif ($amount > min($this->log->get('totalprice') * 1.15, $this->log->get('totalprice') + 75)) {
             $this->log->set('amazon-status', __('Unable to refund funds via amazon:', 'wpsc') . ' ' . __('Refund amount is greater than the max refund amount.', 'wpsc'))->save();
             return;
         }
         $response = $this->gateway->api_request(array('Action' => 'Refund', 'AmazonCaptureId' => $capture_id, 'RefundReferenceId' => $this->log->get('id') . '-' . current_time('timestamp', true), 'RefundAmount.Amount' => $amount, 'RefundAmount.CurrencyCode' => strtoupper($this->gateway->get_currency_code()), 'SellerRefundNote' => $note));
         if (is_wp_error($response)) {
             $this->log->set('amazon-status', __('Unable to refund funds via amazon:', 'wpsc') . ' ' . $response->get_error_message())->save();
         } elseif (isset($response['Error']['Message'])) {
             $this->log->set('amazon-status', $response['Error']['Message'])->save();
         } else {
             $refund_id = $response['RefundResult']['RefundDetails']['AmazonRefundId'];
             $this->log->set('amazon-status', sprintf(__('Refunded %s (%s)', 'wpsc'), wpsc_currency_display($amount), $note))->save();
             $this->log->set('processed', WPSC_Purchase_Log::REFUNDED)->save();
             wpsc_add_purchase_meta($this->log->get('id'), 'amazon_refund_id', $refund_id);
         }
     }
 }
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:34,代码来源:amazon-payments.php

示例8: wpsc_update_location

/**
 * update location function, used through ajax and in normal page loading.
 * No parameters, returns nothing
 */
function wpsc_update_location()
{
    global $wpsc_cart;
    /*
     * Checkout page shipping calculator MAY provide a zip code using the identifier from prior
     * releases.  Let's check for that.
     */
    if (isset($_POST['zipcode'])) {
        wpsc_update_customer_meta('shippingpostcode', $_POST['zipcode']);
    }
    /*
     * Checkout page shipping calculator MAY provide a country code using the identifier from prior
     * releases.  Let's check for that.
     */
    if (isset($_POST['country'])) {
        $wpsc_country = new WPSC_Country($_POST['country']);
        wpsc_update_customer_meta('shippingcountry', $wpsc_country->get_isocode());
    }
    /*
     * WPeC's totally awesome checkout page shipping calculator has a submit button that will send
     * some of the shipping data to us in an AJAX request.  The format of the data as of version
     * 3.8.14.1 uses the 'collected_data' array format just like in checkout. We should process
     * this array in case it has some updates to the user meta (checkout information) that haven't been
     * recorded at the time the calculate button was clicked.  If the country or zip code is set using the
     * legacy 'country' or 'zip' code $_POST values they will be overwritten if they are also included
     * in the collected_data $_POST value.
     */
    if (isset($_POST['collected_data']) && is_array($_POST['collected_data'])) {
        _wpsc_checkout_customer_meta_update($_POST['collected_data']);
    }
    $wpsc_cart->update_location();
    $wpsc_cart->get_shipping_method();
    $wpsc_cart->get_shipping_option();
    if ($wpsc_cart->selected_shipping_method != '') {
        $wpsc_cart->update_shipping($wpsc_cart->selected_shipping_method, $wpsc_cart->selected_shipping_option);
    }
    if (defined('DOING_AJAX') && DOING_AJAX && isset($_REQUEST['action']) && 'update_location' == $_REQUEST['action']) {
        exit;
    }
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:44,代码来源:ajax.php


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