本文整理汇总了PHP中WPSC_Countries::_dirty方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSC_Countries::_dirty方法的具体用法?PHP WPSC_Countries::_dirty怎么用?PHP WPSC_Countries::_dirty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSC_Countries
的用法示例。
在下文中一共展示了WPSC_Countries::_dirty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _create_active_countries_map
/**
* callback that creates / re-creates the data map mapping all active country ids to all active countries
*
* @access private
* @since 3.8.14
*
* @param WPSC_Data_Map $data_map Data map object being intitilized
*/
public static function _create_active_countries_map($data_map)
{
global $wpdb;
// there are also invisible countries
$sql = 'SELECT ' . ' id, country, isocode, currency, symbol, symbol_html, code, has_regions, tax, continent, visible ' . ' FROM `' . WPSC_TABLE_CURRENCY_LIST . '` WHERE `visible`= "1" ' . ' ORDER BY id ASC';
$countries_array = $wpdb->get_results($sql, OBJECT_K);
// build an array to map from iso code to country, while we do this get any region data for the country
foreach ($countries_array as $country_id => $country) {
// create a new empty country object, add the properties we know about, then we add our region info
$wpsc_country = new WPSC_Country(null);
$wpsc_country->_copy_properties_from_stdclass($country);
if ($country->has_regions) {
$sql = 'SELECT id, code, country_id, name, tax ' . ' FROM `' . WPSC_TABLE_REGION_TAX . '` ' . ' WHERE `country_id` = %d ' . ' ORDER BY code ASC ';
// put the regions list into our country object
$regions = $wpdb->get_results($wpdb->prepare($sql, $country_id), OBJECT_K);
/*
* any properties that came in as text that should be numbers or boolean
* get adjusted here, we also build an array to map from region code to region id
*/
foreach ($regions as $region_id => $region) {
$region->id = intval($region_id);
$region->country_id = intval($region->country_id);
$region->tax = floatval($region->tax);
// create a new empty region object, then copy our region data into it.
$wpsc_region = new WPSC_Region(null, null);
$wpsc_region->_copy_properties_from_stdclass($region);
$wpsc_country->_regions->map($region->id, $wpsc_region);
$wpsc_country->_region_id_by_region_code->map($region->code, $region->id);
$wpsc_country->_region_id_by_region_name->map(strtolower($region->name), $region->id);
}
}
$data_map->map($country_id, $wpsc_country);
}
self::$_dirty = true;
}