Index: uc_taxes.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ubercart/uc_taxes/uc_taxes.admin.inc,v
retrieving revision 1.1.2.11
diff -u -p -r1.1.2.11 uc_taxes.admin.inc
--- uc_taxes.admin.inc	18 Mar 2010 03:09:42 -0000	1.1.2.11
+++ uc_taxes.admin.inc	12 Jul 2010 15:25:06 -0000
@@ -24,6 +24,12 @@ function uc_taxes_admin_settings() {
        l(t('delete'), 'admin/store/settings/taxes/'. $rate_id .'/delete'),
     );
 
+    if (module_exists('exportables') && module_exists('ctools')) {
+      if (exportables_api() >= 2) {
+        $ops[] = l(t('export'), 'admin/store/settings/taxes/'. $rate_id .'/export');
+      }
+    }    
+
     // Add the row to the table.
     $rows[] = array(
       check_plain($rate->name),
Index: uc_taxes.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ubercart/uc_taxes/uc_taxes.install,v
retrieving revision 1.10.2.9
diff -u -p -r1.10.2.9 uc_taxes.install
--- uc_taxes.install	19 Mar 2010 21:27:18 -0000	1.10.2.9
+++ uc_taxes.install	12 Jul 2010 15:25:06 -0000
@@ -14,6 +14,29 @@ function uc_taxes_schema() {
 
   $schema['uc_taxes'] = array(
     'description' => 'Stores tax information.',
+    'join' => array(
+      'exportables' => array(
+        'table' => 'exportables',
+        'left_key' => 'id',
+        'right_key' => 'id',
+        'extra' => "AND t__1.type = 'uc_taxes'",
+        'load' => array(
+          'machine',
+        ),
+      ),
+    ),
+    'export' => array(
+      'key' => 'machine',
+      'key in table' => 'exportables',
+      'identifier' => 'rate',
+      'export module' => 'uc_taxes',
+      'primary key' => 'id',
+      'api' => array(
+        'owner' => 'uc_taxes',
+        'minimum_version' => 2,
+        'current_version' => 2,
+      ),
+    ),
     'fields' => array(
       'id' => array(
         'description' => 'Primary key: Unique tax rate id.',
Index: uc_taxes.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ubercart/uc_taxes/uc_taxes.module,v
retrieving revision 1.12.2.20
diff -u -p -r1.12.2.20 uc_taxes.module
--- uc_taxes.module	27 Jan 2010 22:23:32 -0000	1.12.2.20
+++ uc_taxes.module	12 Jul 2010 15:25:07 -0000
@@ -92,6 +92,27 @@ function uc_taxes_menu() {
     'type' => MENU_CALLBACK,
   );
 
+  if (module_exists('exportables') && module_exists('ctools')) {
+    if (exportables_api() >= 2) {
+      $items['admin/store/settings/taxes/%/export'] = array(
+        'page callback' => 'drupal_get_form',
+        'page arguments' => array('uc_taxes_export_rates', 4),
+        'access arguments' => array('configure taxes'),
+        'type' => MENU_CALLBACK,
+        'file' => 'uc_taxes.export.inc',
+      );
+      $items['admin/store/settings/taxes/import'] = array(
+        'title' => 'Import tax rate',
+        'page callback' => 'drupal_get_form',
+        'page arguments' => array('uc_taxes_import_rates'),
+        'access arguments' => array('configure taxes'),
+        'weight' => 6,
+        'type' => MENU_LOCAL_TASK,
+        'file' => 'uc_taxes.export.inc',
+      );
+    }
+  }
+
   return $items;
 }
 
@@ -306,7 +327,7 @@ function uc_taxes_rate_save($rate) {
   else {
     drupal_write_record('uc_taxes', $rate, array('id'));
   }
-
+  cache_clear_all('uc_taxes:rates', 'cache');
   return $rate;
 }
 
@@ -319,32 +340,42 @@ function uc_taxes_rate_save($rate) {
  *   An object representing the requested tax rate or an array of all tax rates
  *     keyed by rate ID.
  */
-function uc_taxes_rate_load($rate_id = NULL) {
-  static $rates = array();
-
-  // If the rates have not been cached yet...
-  if (empty($rates)) {
-    // Get all the rate data from the database.
+function uc_taxes_rate_load($rate_id = NULL, $reset = FALSE) {
+  static $rates;
+  if ($reset || !isset($rates)) {
+    $rates = array();
+    if (!$reset && ($cache = cache_get('uc_taxes:rates', 'cache')) && is_array($cache->data)) {
+      $rates = $cache->data;
+      // Return a rate as specified.
+      if ($rate_id) {
+        return $rates[$rate_id];
+      }
+      return $rates;
+    }
+    if (module_exists('exportables') && module_exists('ctools')) {
+      if (exportables_api() >= 2) {
+        ctools_include('export');
+        $schema = ctools_export_get_schema('uc_taxes');
+        $default_rates = _ctools_export_get_defaults('uc_taxes', $schema['export']);
+        foreach ($default_rates as $machine_name => $default_rate) {
+          $rates[$default_rate->id] = $default_rate;
+        }
+      }  
+    }
     $result = db_query("SELECT * FROM {uc_taxes} ORDER BY weight");
-
-    // Loop through each returned row.
     while ($rate = db_fetch_object($result)) {
       // Unserialize some arrays and cache the rate in a static array.
       $rate->taxed_product_types = unserialize($rate->taxed_product_types);
       $rate->taxed_line_items = unserialize($rate->taxed_line_items);
-
       $rates[$rate->id] = $rate;
     }
   }
-
   // Return a rate as specified.
   if ($rate_id) {
     return $rates[$rate_id];
   }
-  // Or return the whole shebang.
-  else {
-    return $rates;
-  }
+  cache_set('uc_taxes:rates', $rates);
+  return $rates;
 }
 
 /**
@@ -359,6 +390,7 @@ function uc_taxes_rate_delete($rate_id) 
 
   // Delete the associated predicated if it has been saved to the database.
   ca_delete_predicate('uc_taxes_'. $rate_id);
+  cache_clear_all('uc_taxes:rates', 'cache');  
 }
 
 /**
@@ -555,3 +587,85 @@ function uc_taxes_apply_tax($order, $tax
     return $line_item;
   }
 }
+
+/**
+ * Implementation of hook_features_export_options().
+ */
+function uc_taxes_features_export_options() {
+  ctools_include('export');
+  $rates = ctools_export_load_object('uc_taxes', 'all');
+  if (is_array($rates)) {
+    foreach ($rates as $id => $rate) {
+      $rates_export[$id] = t('@tax tax', array('@tax' => $rate->name));
+    }
+  }
+  return $rates_export;
+}
+
+/**
+ * Implementation of hook_features_export().
+ */
+function uc_taxes_features_export($data, &$export, $module_name = '') {
+  $return = ctools_component_features_export('uc_taxes', $data, $export, $module_name);
+  $export['dependencies']['exportables'] = 'exportables';
+  return $return;
+}
+
+/**
+ * Implementation of hook_FORM_ID_alter().
+ *
+ * Sync names every time admin/build/modules is rendered.
+ */
+function uc_taxes_form_system_modules_alter(&$form, $form_state) {
+  uc_taxes_exportables_sync_names();
+}
+
+/**
+ * Implementation of hook_FORM_ID_alter().
+ *
+ * Sync names every time admin/build/features is rendered.
+ */
+function uc_taxes_form_features_admin_form_alter(&$form, $form_state) {
+  uc_taxes_exportables_sync_names();
+}
+
+/**
+ * Implementation of hook_FORM_ID_alter().
+ */
+function uc_taxes_form_exportables_submit(&$form, $form_state) {
+  uc_taxes_exportables_sync_names();
+}
+
+/**
+ * Implementation of hook_FORM_ID_alter().
+ *
+ * Includes a machine name into the admin/settings/filter/ID form.
+ */
+function uc_taxes_form_uc_taxes_form_alter(&$form, $form_state) {
+  $form['#submit'][] = 'uc_taxes_form_exportables_submit';
+}
+
+/**
+ * Implementation of hook_exportables().
+ */
+function uc_taxes_exportables() {
+  $exportables = array();
+  $exportables['uc_taxes'] = array(
+    'load all function' => 'uc_taxes_rate_load',
+    'id property' => 'id',
+    'title property' => 'name',
+    'machine name property' => 'machine',
+  );
+  return $exportables;
+}
+
+/**
+ * Exportable Sync.
+ */
+function uc_taxes_exportables_sync_names() {
+  if (module_exists('exportables') && module_exists('ctools')) {
+    if (exportables_api() >= 2) {
+      exportables_sync_names('uc_taxes');
+    }
+  }
+}
\ No newline at end of file
