예제 #1
0
 /**
  * @description: wpec_taxes_get_regions - given a isocode, such as CA, this function
  *               will return an array of regions within that country.
  * @param: country - string variable containing isocode
  * @return: array or false
  * */
 function wpec_taxes_get_regions($country)
 {
     $wpsc_country = new WPSC_Country($country);
     $regions = $wpsc_country->get_regions_array();
     // backwards compatability at version 3.8.14, the rest of the module needs region to be called 'region_code'.
     // TODO: update taxes module to use WPSC_Region objects
     foreach ($regions as $index => $region) {
         $region['region_code'] = $region['code'];
         unset($region['region']);
         $regions[$index] = $region;
     }
     if (isset($country) && 'all-markets' == $country) {
         return;
     }
     //add the all markets option to the list
     if (!empty($regions)) {
         array_unshift($regions, array('region_code' => 'all-markets', 'name' => __('All Markets', 'wpsc')));
     }
     return $regions;
 }