function _country_import_list in Ubercart 6.2
Same name and namespace in other branches
- 5 uc_store/uc_store.module \_country_import_list()
Returns an array of country files in ubercart/uc_store/countries that can be installed or updated.
2 calls to _country_import_list()
- uc_country_import_form in uc_store/
uc_store.admin.inc - Import settings from a country file.
- uc_store_store_status in uc_store/
uc_store.admin.inc - Implements hook_store_status().
File
- uc_store/
uc_store.module, line 1551 - Contains global Ubercart functions and store administration functionality.
Code
function _country_import_list() {
$dir = drupal_get_path('module', 'uc_store') . '/countries/';
$countries = array();
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== FALSE) {
switch (filetype($dir . $file)) {
case 'file':
if (substr($file, -4, 4) == '.cif') {
$pieces = explode('_', substr($file, 0, strlen($file) - 4));
$country_id = intval($pieces[count($pieces) - 2]);
$version = $pieces[count($pieces) - 1];
if (!isset($countries[$country_id])) {
$countries[$country_id]['version'] = $version;
$countries[$country_id]['file'] = $file;
}
else {
if ($version > $countries[$country_id]['version']) {
$countries[$country_id]['version'] = $version;
$countries[$country_id]['file'] = $file;
}
}
}
break;
}
}
closedir($dh);
}
}
return $countries;
}