You are here

function uc_country_import in Ubercart 7.3

Same name and namespace in other branches
  1. 6.2 uc_store/uc_store.module \uc_country_import()

Imports an Ubercart country file by filename.

Parameters

$file: The filename of the country to import.

Return value

TRUE or FALSE indicating whether or not the country was imported.

1 call to uc_country_import()
uc_country_import_form_submit in uc_store/uc_store.countries.inc
Form submission handler for uc_country_import_form().

File

uc_store/uc_store.countries.inc, line 369
Store administration forms for country and address handling.

Code

function uc_country_import($file) {
  require_once drupal_get_path('module', 'uc_store') . '/countries/' . $file;
  $pieces = explode('_', substr($file, 0, strlen($file) - 4));
  $country_id = $pieces[count($pieces) - 2];
  $version = $pieces[count($pieces) - 1];
  $country = substr($file, 0, strlen($file) - strlen($country_id) - strlen($version) - 6);
  $func = $country . '_install';
  if (function_exists($func)) {
    $func();
    return TRUE;
  }
  return FALSE;
}