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


PHP WPSC_Countries类代码示例

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


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

 function get_local_currency_code()
 {
     if (empty($this->local_currency_code)) {
         $this->local_currency_code = WPSC_Countries::get_currency_code(get_option('currency_type'));
     }
     return $this->local_currency_code;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:7,代码来源:paypal-standard.merchant.php

示例3: _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

示例4: _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

示例5: __construct

 /**
  * Create a WPSC_Currency object
  *
  * @access public
  *
  * @since 3.8.14
  *
  * @param 	string	$code			this currency's code, like "USD" for a U.S.A dollar, or "EUR" for a euro
  * @param 	string	$symbol			the text symbol for this currency, like "$"
  * @param 	string	$symbol_html    the HTML representation of the symbol, like "&#036;"
  * @param 	string	$name           the currency name, like "US Dollar" or "Euro"
  *
  * @return void
  */
 public function __construct($code, $symbol = null, $symbol_html = null, $name = null)
 {
     // if all parameters are specified we are trying to make a new currency object
     if (!empty($code) && ($symbol != null || $symbol_html != null || $name != null)) {
         // Create a new currency object
         $this->code = $code;
         $this->symbol = $symbol;
         $this->symbol_html = $symbol_html;
         $this->name = $name;
     } else {
         // if only code is specified the constructor is typing to get the information about an existing currency
         $wpsc_currency = WPSC_Countries::get_currency($code);
         $this->code = $wpsc_currency->code;
         $this->symbol = $wpsc_currency->symbol;
         $this->symbol_html = $wpsc_currency->symbol_html;
         $this->name = $wpsc_currency->name;
     }
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:32,代码来源:wpsc-currency.class.php

示例6: nzshpcrt_region_list

function nzshpcrt_region_list($selected_country = null, $selected_region = null)
{
    global $wpdb;
    if ($selected_region == null) {
        $selected_region = get_option('base_region');
    }
    $output = "";
    $region_list = WPSC_Countries::get_regions($selected_country, true);
    if ($region_list != null) {
        foreach ($region_list as $region) {
            if ($selected_region == $region['id']) {
                $selected = "selected='selected'";
            } else {
                $selected = "";
            }
            $output .= "<option value='" . $region['id'] . "' {$selected}>" . $region['name'] . "</option>\r\n";
        }
    } else {
        $output .= "<option value=''>" . esc_html__('None', 'wpsc') . "</option>\r\n";
    }
    return $output;
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:22,代码来源:form.php

示例7: wpsc_get_region

function wpsc_get_region($region_id)
{
    $country_id = WPSC_Countries::get_country_id_by_region_id($region_id);
    $wpsc_region = new WPSC_Region($country_id, $region_id);
    return $wpsc_region->get_name();
}
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:6,代码来源:misc.functions.php

示例8: save_options

 /**
  * Save submitted options to the database.
  * @since 3.8.8
  * @uses check_admin_referer() Prevents CSRF.
  * @uses update_option() Saves options to the database.
  * @uses wpdb::query() Queries the database.
  * @uses wpdb::get_col() Queries the database.
  * @access public
  */
 private function save_options($selected = '')
 {
     global $wpdb, $wpsc_gateways;
     $updated = 0;
     //This is to change the Overall target market selection
     check_admin_referer('update-options', 'wpsc-update-options');
     //Should be refactored along with the Marketing tab
     if (isset($_POST['change-settings'])) {
         if (isset($_POST['wpsc_also_bought']) && $_POST['wpsc_also_bought'] == 'on') {
             update_option('wpsc_also_bought', 1);
         } else {
             update_option('wpsc_also_bought', 0);
         }
         if (isset($_POST['display_find_us']) && $_POST['display_find_us'] == 'on') {
             update_option('display_find_us', 1);
         } else {
             update_option('display_find_us', 0);
         }
         if (isset($_POST['wpsc_share_this']) && $_POST['wpsc_share_this'] == 'on') {
             update_option('wpsc_share_this', 1);
         } else {
             update_option('wpsc_share_this', 0);
         }
         if (isset($_POST['wpsc_ga_disable_tracking']) && $_POST['wpsc_ga_disable_tracking'] == '1') {
             update_option('wpsc_ga_disable_tracking', 1);
         } else {
             update_option('wpsc_ga_disable_tracking', 0);
         }
         if (isset($_POST['wpsc_ga_currently_tracking']) && $_POST['wpsc_ga_currently_tracking'] == '1') {
             update_option('wpsc_ga_currently_tracking', 1);
         } else {
             update_option('wpsc_ga_currently_tracking', 0);
         }
         if (isset($_POST['wpsc_ga_advanced']) && $_POST['wpsc_ga_advanced'] == '1') {
             update_option('wpsc_ga_advanced', 1);
             update_option('wpsc_ga_currently_tracking', 1);
         } else {
             update_option('wpsc_ga_advanced', 0);
         }
         if (isset($_POST['wpsc_ga_tracking_id']) && !empty($_POST['wpsc_ga_tracking_id'])) {
             update_option('wpsc_ga_tracking_id', esc_attr($_POST['wpsc_ga_tracking_id']));
         } else {
             update_option('wpsc_ga_tracking_id', '');
         }
     }
     if (empty($_POST['countrylist2']) && !empty($_POST['wpsc_options']['currency_sign_location'])) {
         $selected = 'none';
     }
     if (!isset($_POST['countrylist2'])) {
         $_POST['countrylist2'] = '';
     }
     if (!isset($_POST['country_id'])) {
         $_POST['country_id'] = '';
     }
     if (!isset($_POST['country_tax'])) {
         $_POST['country_tax'] = '';
     }
     if ($_POST['countrylist2'] != null || !empty($selected)) {
         $AllSelected = false;
         if ($selected == 'all') {
             $wpdb->query("UPDATE `" . WPSC_TABLE_CURRENCY_LIST . "` SET visible = '1'");
             $AllSelected = true;
         }
         if ($selected == 'none') {
             $wpdb->query("UPDATE `" . WPSC_TABLE_CURRENCY_LIST . "` SET visible = '0'");
             $AllSelected = true;
         }
         if ($AllSelected != true) {
             $countrylist = $wpdb->get_col("SELECT id FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY country ASC ");
             //find the countries not selected
             $unselectedCountries = array_diff($countrylist, $_POST['countrylist2']);
             foreach ($unselectedCountries as $unselected) {
                 $wpdb->update(WPSC_TABLE_CURRENCY_LIST, array('visible' => 0), array('id' => $unselected), '%d', '%d');
             }
             //find the countries that are selected
             $selectedCountries = array_intersect($countrylist, $_POST['countrylist2']);
             foreach ($selectedCountries as $selected) {
                 $wpdb->update(WPSC_TABLE_CURRENCY_LIST, array('visible' => 1), array('id' => $selected), '%d', '%d');
             }
         }
         WPSC_Countries::clear_cache();
         wpsc_core_flush_temporary_data();
     }
     $previous_currency = get_option('currency_type');
     //To update options
     if (isset($_POST['wpsc_options'])) {
         $_POST['wpsc_options'] = stripslashes_deep($_POST['wpsc_options']);
         // make sure stock keeping time is a number
         if (isset($_POST['wpsc_options']['wpsc_stock_keeping_time'])) {
             $skt = $_POST['wpsc_options']['wpsc_stock_keeping_time'];
             // I hate repeating myself
//.........这里部分代码省略.........
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:101,代码来源:settings-page.php

示例9: wpsc_get_currency_code

/**
 *	wpsc_get_currency_code
 *
 *	@param does not receive anything
 *  @return returns the currency code used for the shop
*/
function wpsc_get_currency_code()
{
    return WPSC_Countries::get_currency_code(get_option('currency_type'));
}
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:10,代码来源:processing.functions.php

示例10: _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

示例11: 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

示例12: 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

示例13: 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

示例14: wpsc_donations

function wpsc_donations($args = null)
{
    global $wpdb;
    // Args not used yet but this is ready for when it is
    $args = wp_parse_args((array) $args, array());
    $products = $wpdb->get_results("SELECT DISTINCT `p` . * , `m`.`meta_value` AS `special_price`\n\t\tFROM `" . $wpdb->postmeta . "` AS `m`\n\t\tJOIN `" . $wpdb->posts . "` AS `p` ON `m`.`post_id` = `p`.`ID`\n\t\tWHERE `p`.`post_parent` IN ('0')\n\t\t\tAND `m`.`meta_key` IN ('_wpsc_is_donation')\n\t\t\tAND `m`.`meta_value` IN( '1' )\n\t\tORDER BY RAND( )\n\t\tLIMIT 1", ARRAY_A);
    $output = '';
    if ($products != null) {
        foreach ($products as $product) {
            $attached_images = (array) get_posts(array('post_type' => 'attachment', 'numberposts' => 1, 'post_status' => null, 'post_parent' => $product['ID'], 'orderby' => 'menu_order', 'order' => 'ASC'));
            $attached_image = $attached_images[0];
            $output .= "<div class='wpsc_product_donation'>";
            if ($attached_image->ID > 0) {
                $output .= "<img src='" . wpsc_product_image($attached_image->ID, get_option('product_image_width'), get_option('product_image_height')) . "' title='" . $product['post_title'] . "' alt='" . esc_attr($product['post_title']) . "' /><br />";
            }
            // Get currency options
            $currency_sign_location = get_option('currency_sign_location');
            $currency_type = get_option('currency_type');
            WPSC_Countries::get_currency_symbol($currency_type);
            $price = get_post_meta($product['ID'], '_wpsc_price', true);
            // Output
            $output .= "<strong>" . $product['post_title'] . "</strong><br />";
            $output .= $product['post_content'] . "<br />";
            $output .= "<form class='product_form'  name='donation_widget_" . $product['ID'] . "' method='post' action='' id='donation_widget_" . $product['ID'] . "'>";
            $output .= "<input type='hidden' name='product_id' value='" . $product['ID'] . "'/>";
            $output .= "<input type='hidden' name='item' value='" . $product['ID'] . "' />";
            $output .= "<input type='hidden' name='wpsc_ajax_action' value='add_to_cart' />";
            $output .= "<label for='donation_widget_price_" . $product['ID'] . "'>" . __('Donation', 'wp-e-commerce') . ":</label> {$currency_symbol}<input type='text' id='donation_widget_price_" . $product['ID'] . "' name='donation_price' value='" . esc_attr(number_format($price, 2)) . "' size='6' /><br />";
            $output .= "<input type='submit' id='donation_widget_" . $product['ID'] . "_submit_button' name='Buy' class='wpsc_buy_button' value='" . __('Add To Cart', 'wp-e-commerce') . "' />";
            $output .= "</form>";
            $output .= "</div>";
        }
    } else {
        $output = '';
    }
    echo $output;
}
开发者ID:ashik968,项目名称:digiplot,代码行数:37,代码来源:donations_widget.php

示例15: set_customer_details

 public function set_customer_details()
 {
     $_POST['wpsc_checkout_details'] = array();
     $_GET['amazon_reference_id'] = sanitize_text_field($_POST['amazon_reference_id']);
     try {
         if (!$this->reference_id) {
             throw new Exception(__('An Amazon payment method was not chosen.', 'wpsc'));
         }
         if (is_null($this->purchase_log)) {
             $log = _wpsc_get_current_controller()->get_purchase_log();
             wpsc_update_customer_meta('current_purchase_log_id', $log->get('id'));
             $this->set_purchase_log($log);
         }
         global $wpsc_cart;
         // Update order reference with amounts
         $response = $this->api_request(array('Action' => 'SetOrderReferenceDetails', 'AmazonOrderReferenceId' => $this->reference_id, 'OrderReferenceAttributes.OrderTotal.Amount' => $wpsc_cart->calculate_total_price(), 'OrderReferenceAttributes.OrderTotal.CurrencyCode' => strtoupper($this->get_currency_code()), 'OrderReferenceAttributes.SellerNote' => sprintf(__('Order %s from %s.', 'wpsc'), $this->purchase_log->get('id'), urlencode(remove_accents(wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)))), 'OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId' => $this->purchase_log->get('id'), 'OrderReferenceAttributes.SellerOrderAttributes.StoreName' => remove_accents(wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)), 'OrderReferenceAttributes.PlatformId' => 'A2Z8DY3R4G08IM'));
         if (is_wp_error($response)) {
             throw new Exception($response->get_error_message());
         }
         if (isset($response['Error']['Message'])) {
             throw new Exception($response['Error']['Message']);
         }
         $response = $this->api_request(array('Action' => 'GetOrderReferenceDetails', 'AmazonOrderReferenceId' => $this->reference_id));
         if (is_wp_error($response)) {
             throw new Exception($response->get_error_message());
         }
         if (!isset($response['GetOrderReferenceDetailsResult']['OrderReferenceDetails']['Destination']['PhysicalDestination'])) {
             return;
         }
         $address = $response['GetOrderReferenceDetailsResult']['OrderReferenceDetails']['Destination']['PhysicalDestination'];
         remove_action('wpsc_checkout_get_fields', '__return_empty_array');
         add_filter('wpsc_validate_form', '__return_true');
         $form = WPSC_Checkout_Form::get();
         $fields = $form->get_fields();
         foreach ($fields as $field) {
             switch ($field->unique_name) {
                 case 'shippingstate':
                     $_POST['wpsc_checkout_details'][$field->id] = WPSC_Countries::get_region_id($address['CountryCode'], $address['StateOrRegion']);
                     break;
                 case 'shippingcountry':
                     $_POST['wpsc_checkout_details'][$field->id] = $address['CountryCode'];
                     break;
                 case 'shippingpostcode':
                     $_POST['wpsc_checkout_details'][$field->id] = $address['PostalCode'];
                     break;
                 case 'shippingcity':
                     $_POST['wpsc_checkout_details'][$field->id] = $address['City'];
                     break;
             }
         }
     } catch (Exception $e) {
         WPSC_Message_Collection::get_instance()->add($e->getMessage(), 'error', 'main', 'flash');
         return;
     }
 }
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:55,代码来源:amazon-payments.php


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