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


PHP WPSC_Countries::_dirty方法代码示例

本文整理汇总了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;
 }
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:43,代码来源:wpsc-countries.class.php


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