本文整理汇总了PHP中WPSC_Countries::_save_country_data方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSC_Countries::_save_country_data方法的具体用法?PHP WPSC_Countries::_save_country_data怎么用?PHP WPSC_Countries::_save_country_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSC_Countries
的用法示例。
在下文中一共展示了WPSC_Countries::_save_country_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* a country's constructor
*
* @access public
*
* @since 3.8.14
*
* @param int|string|array required $country_identifier the country identifier, can be the string ISO code,
* or the integer country id, or an array of data used
* to create a new country
*
* @return object WPSC_Country
*/
public function __construct($country, $deprecated = null)
{
if ($country) {
if (is_array($country)) {
// if we get an array as an argument we are making a new country
$country_id_or_isocode = WPSC_Countries::_save_country_data($country);
} else {
// we are constructing a country using a numeric id or ISO code
$country_id_or_isocode = $country;
}
// make sure we have a valid country id
$country_id = WPSC_Countries::get_country_id($country_id_or_isocode);
if ($country_id) {
$wpsc_country = WPSC_Countries::get_country($country_id);
foreach ($wpsc_country as $property => $value) {
// copy the properties in this copy of the country
$this->{$property} = $value;
}
}
}
// if the regions maps has not been initialized we should create an empty map now
if (empty($this->_regions)) {
$this->_regions = new WPSC_Data_Map();
}
if (empty($this->_region_id_by_region_code)) {
$this->_region_id_by_region_code = new WPSC_Data_Map();
}
if (empty($this->_region_id_by_region_name)) {
$this->_region_id_by_region_name = new WPSC_Data_Map();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// As a result of merging the legacy WPSC_Country class we no longer need the "col" constructor parameter
// that was in the prior version of this class.
//
// if deprecated processing is enabled we will give a message, just as if we were allowed to put class
// methods in the deprecated file, if deprecated processing is not enabled we exit with the method, much
// like would happen with an undefined function call.
//
// TODO: This processing is added at version 3.8.14 and intended to be removed after a reasonable number
// of interim releases. See GitHub Issue https://github.com/wp-e-commerce/WP-e-Commerce/issues/1016
/////////////////////////////////////////////////////////////////////////////////////////////////////////
if (!empty($deprecated)) {
if (defined('WPSC_LOAD_DEPRECATED') && WPSC_LOAD_DEPRECATED) {
_wpsc_deprecated_argument(__FUNCTION__, '3.8.14', $this->_parameter_no_longer_used_message('col', __FUNCTION__));
}
}
// setup default properties filter
add_filter('wpsc_country_get_property', array(__CLASS__, '_wpsc_country_default_properties'), 10, 2);
}