本文整理汇总了PHP中WPSC_Countries::country_id_by_country_name方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSC_Countries::country_id_by_country_name方法的具体用法?PHP WPSC_Countries::country_id_by_country_name怎么用?PHP WPSC_Countries::country_id_by_country_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSC_Countries
的用法示例。
在下文中一共展示了WPSC_Countries::country_id_by_country_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _clean_data_maps
/**
* Create the empty maps used by this class to do it's work.
*
* This functions contributes greatly to the performance of the class. Data maps that are named
* can store and retrieve themselves at the time of the first request. That means they don't need to
* be rebuilt every time, nor does all of the data have to be loaded and waiting for a request that
* may never come.
*
* Because the geographic data managed by this class can be accessed hundreds or even
* thousands of times when creating WPeC pages, moderate gains here can translate into
* substantial gains in end user perfroamnce. For this reason this class will try to keep
* the smaller frequently references data sets (data maps) intact and always available.
* Potentially large data sets, such as the global list of all countires with all regions,
* are only loaded when they are accessed. The WPSC_Data_Map provides the transpernet
* loading and creating functions for these data sets.
*
*
* @access private
*
* @static
*
* @since 3.8.14
*
*/
private static function _clean_data_maps()
{
/*
* maps without names will be loaded with the core class, we maintain
* a list as they are created
*/
self::$_maps_to_save_with_core_class = array();
// at 3.8.14 checked and this is about 1 KB of data
if (is_a(self::$region_by_region_id, 'WPSC_Data_Map')) {
self::$region_by_region_id->clear();
} else {
self::$region_by_region_id = new WPSC_Data_Map(null, array(__CLASS__, '_create_region_by_region_id_map'));
}
self::$_maps_to_save_with_core_class['region_by_region_id'] = true;
// at 3.14 checked and this is about 1 KB of data
if (is_a(self::$region_code_by_region_id, 'WPSC_Data_Map')) {
self::$region_code_by_region_id->clear();
} else {
self::$region_code_by_region_id = new WPSC_Data_Map(null, array(__CLASS__, '_create_region_code_by_region_id_map'));
}
self::$_maps_to_save_with_core_class['region_code_by_region_id'] = true;
// at 3.8.14 checked and this is about 1 KB of data
if (is_a(self::$country_id_by_region_id, 'WPSC_Data_Map')) {
self::$country_id_by_region_id->clear();
} else {
self::$country_id_by_region_id = new WPSC_Data_Map(null, array(__CLASS__, '_create_country_id_by_region_id_map'));
}
self::$_maps_to_save_with_core_class['country_id_by_region_id'] = true;
// at 3.8.14 checked and this is about 1 KB of data
if (is_a(self::$country_id_by_iso_code, 'WPSC_Data_Map')) {
self::$country_id_by_iso_code->clear();
} else {
self::$country_id_by_iso_code = new WPSC_Data_Map(null, array(__CLASS__, '_create_country_id_by_iso_code_map'));
}
self::$_maps_to_save_with_core_class['country_id_by_iso_code'] = true;
// at 3.8.14 checked and this is about 1 KB of data
if (is_a(self::$country_code_by_country_id, 'WPSC_Data_Map')) {
self::$country_code_by_country_id->clear();
} else {
self::$country_code_by_country_id = new WPSC_Data_Map(null, array(__CLASS__, '_create_country_code_by_country_id'));
}
self::$_maps_to_save_with_core_class['country_code_by_country_id'] = true;
// at 3.8.14 checked and this is about 2KB of data with 7 countries active, including US and CA
if (is_a(self::$active_wpsc_country_by_country_id, 'WPSC_Data_Map')) {
self::$active_wpsc_country_by_country_id->clear();
} else {
self::$active_wpsc_country_by_country_id = new WPSC_Data_Map(null, array(__CLASS__, '_create_active_countries_map'));
}
self::$_maps_to_save_with_core_class['active_wpsc_country_by_country_id'] = true;
// at 3.8.14 checked and this is about 1 KB of data
if (is_a(self::$currencies, 'WPSC_Data_Map')) {
self::$currencies->clear();
} else {
self::$currencies = new WPSC_Data_Map(null, array(__CLASS__, '_create_currency_by_currency_code_map'));
}
self::$_maps_to_save_with_core_class['currencies'] = true;
/*
* maps with names can optionally reload thier data themselves when the first request
* is processed, this class does not need to load/ re-load them because the WPSC_Data_Map
* class takes care of that transparently. This goes a long way towards keeping the size of
* of the transient used to cache this classes data small, making WPeC intitialization faster.
*/
// at 3.14 checked and this is about 3KB of data, this map isn't as frequently used so we will load it if it
// needed
if (is_a(self::$country_id_by_country_name, 'WPSC_Data_Map')) {
self::$country_id_by_country_name->clear();
} else {
self::$country_id_by_country_name = new WPSC_Data_Map('$country_id_by_country_name', array(__CLASS__, '_create_country_id_by_country_name_map'));
}
self::$_maps_to_save_with_core_class['country_id_by_country_name'] = false;
// at 3.14 checked and this is about 23KB of data, not a big hit if there is a memory based object cache
// but impacts perfomance on lower end (default) configurations that use the database to store transients
if (is_a(self::$all_wpsc_country_by_country_id, 'WPSC_Data_Map')) {
self::$all_wpsc_country_by_country_id->clear();
} else {
self::$all_wpsc_country_by_country_id = new WPSC_Data_Map('$all_wpsc_country_by_country_id', array(__CLASS__, '_create_all_countries_map'));
//.........这里部分代码省略.........