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


PHP WPSC_Country::get_name方法代码示例

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


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

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

示例2:

 function test_get_name()
 {
     $country = new WPSC_Country(self::COUNTRY_ID_WITHOUT_REGIONS);
     $this->assertEquals(self::COUNTRY_NAME_WITHOUT_REGIONS, $country->get_name());
 }
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:5,代码来源:test-wpsc-country.class.php

示例3: wpsc_get_country

function wpsc_get_country($country_code)
{
    $wpsc_country = new WPSC_Country($country_code);
    return $wpsc_country->get_name();
}
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:5,代码来源:misc.functions.php

示例4: wpsc_submit_checkout

/**
 * submit checkout function, used through ajax and in normal page loading.
 * No parameters, returns nothing
 */
function wpsc_submit_checkout($collected_data = true)
{
    global $wpdb, $wpsc_cart, $user_ID, $nzshpcrt_gateways, $wpsc_shipping_modules, $wpsc_gateways;
    if ($collected_data && isset($_POST['collected_data']) && is_array($_POST['collected_data'])) {
        _wpsc_checkout_customer_meta_update($_POST['collected_data']);
    }
    // initialize our checkout status variab;e, we start be assuming
    // checkout is falid, until we find a reason otherwise
    $is_valid = true;
    $num_items = 0;
    $use_shipping = 0;
    $disregard_shipping = 0;
    do_action('wpsc_before_submit_checkout');
    $error_messages = wpsc_get_customer_meta('checkout_misc_error_messages');
    if (!is_array($error_messages)) {
        $error_messages = array();
    }
    $wpsc_checkout = new wpsc_checkout();
    $selected_gateways = get_option('custom_gateway_options');
    $submitted_gateway = isset($_POST['custom_gateway']) ? $_POST['custom_gateway'] : '';
    if ($collected_data) {
        $form_validity = $wpsc_checkout->validate_forms();
        extract($form_validity);
        // extracts $is_valid and $error_messages
        if (wpsc_has_tnc() && (!isset($_POST['agree']) || $_POST['agree'] != 'yes')) {
            $error_messages[] = __('Please agree to the terms and conditions, otherwise we cannot process your order.', 'wpsc');
            $is_valid = false;
        }
    } else {
        $is_valid = true;
        $error_messages = array();
    }
    $wpsc_country = new WPSC_Country(wpsc_get_customer_meta('shippingcountry'));
    $country_id = $wpsc_country->get_id();
    $country_name = $wpsc_country->get_name();
    foreach ($wpsc_cart->cart_items as $cartitem) {
        if (!empty($cartitem->meta[0]['no_shipping'])) {
            continue;
        }
        $categoriesIDs = $cartitem->category_id_list;
        foreach ((array) $categoriesIDs as $catid) {
            if (is_array($catid)) {
                $countries = wpsc_get_meta($catid[0], 'target_market', 'wpsc_category');
            } else {
                $countries = wpsc_get_meta($catid, 'target_market', 'wpsc_category');
            }
            if (!empty($countries) && !in_array($country_id, (array) $countries)) {
                $errormessage = sprintf(__('%s cannot be shipped to %s. To continue with your transaction please remove this product from the list below.', 'wpsc'), $cartitem->get_title(), $country_name);
                wpsc_update_customer_meta('category_shipping_conflict', $errormessage);
                $is_valid = false;
            }
        }
        //count number of items, and number of items using shipping
        $num_items++;
        if ($cartitem->uses_shipping != 1) {
            $disregard_shipping++;
        } else {
            $use_shipping++;
        }
    }
    // check to see if the current gateway is in the list of available gateways
    if (array_search($submitted_gateway, $selected_gateways) !== false) {
        wpsc_update_customer_meta('selected_gateway', $submitted_gateway);
    } else {
        $is_valid = false;
    }
    if ($collected_data) {
        // Test for required shipping information
        if (wpsc_core_shipping_enabled() && $num_items != $disregard_shipping) {
            // for shipping to work we need a method, option and a quote
            if (!$wpsc_cart->shipping_method_selected() || !$wpsc_cart->shipping_quote_selected()) {
                $error_messages[] = __('Please select one of the available shipping options, then we can process your order.', 'wpsc');
                $is_valid = false;
            }
            // if we don't have a valid zip code ( the function also checks if we need it ) we have an error
            if (!wpsc_have_valid_shipping_zipcode()) {
                wpsc_update_customer_meta('category_shipping_conflict', __('Please enter a Zipcode and click calculate to proceed', 'wpsc'));
                $is_valid = false;
            }
        }
    }
    wpsc_update_customer_meta('checkout_misc_error_messages', $error_messages);
    if ($is_valid == true) {
        wpsc_delete_customer_meta('category_shipping_conflict');
        // check that the submitted gateway is in the list of selected ones
        $sessionid = mt_rand(100, 999) . time();
        wpsc_update_customer_meta('checkout_session_id', $sessionid);
        $subtotal = $wpsc_cart->calculate_subtotal();
        if ($wpsc_cart->has_total_shipping_discount() == false) {
            $base_shipping = $wpsc_cart->calculate_base_shipping();
        } else {
            $base_shipping = 0;
        }
        $delivery_country = $wpsc_cart->delivery_country;
        $delivery_region = $wpsc_cart->delivery_region;
        if (wpsc_uses_shipping()) {
//.........这里部分代码省略.........
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:101,代码来源:ajax.php

示例5: _wpsc_filter_validation_rule_state_of

function _wpsc_filter_validation_rule_state_of($error, $value, $field, $props, $matched_field, $matched_value, $matched_props)
{
    global $wpdb;
    if ($value == '') {
        return $error;
    }
    $country_code = $_POST['wpsc_checkout_details'][$matched_field];
    $country = new WPSC_Country($country_code);
    if (!$country->has_regions()) {
        return $error;
    }
    // state should have been converted into a numeric value already
    // if not, it's an invalid state
    if (!is_numeric($value)) {
        $message = apply_filters('wpsc_validation_rule_invalid_state_message', __('%1$s is not a valid state or province in %2$s', 'wpsc'));
        $message = sprintf($message, $value, $country->get_name());
        $error->add($field, $message, array('value' => $value, 'props' => $props));
        return $error;
    }
    $sql = $wpdb->prepare('SELECT COUNT(id) FROM ' . WPSC_TABLE_REGION_TAX . ' WHERE id = %d', $value);
    $count = $wpdb->get_var($sql);
    if ($count == 0) {
        $message = apply_filters('wpsc_validation_rule_invalid_state_id_message', __('You specified or were assigned an invalid state or province. Please contact administrator for assistance', 'wpsc'));
        $error->add($field, $message, array('value' => $value, 'props' => $props));
    }
    return $error;
}
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:27,代码来源:form-validation.php

示例6:

 /**
  * Given an ISO country code, it will return the full country name
  *
  * @since 0.0.1
  * @param string $short_country
  * @return string
  */
 function get_full_country($short_country)
 {
     $country = new WPSC_Country($short_country);
     return $country->get_name();
 }
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:12,代码来源:shipping.helper.php


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