You are here

function _country_import_include in Ubercart 5

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

Include the appropriate country file and return the base for hooks.

2 calls to _country_import_include()
uc_country_remove_form_submit in uc_store/uc_store.module
uc_country_update in uc_store/uc_store.module
Update a country to its latest version.

File

uc_store/uc_store.module, line 2458
Contains global Ubercart functions and store administration functionality.

Code

function _country_import_include($country_id, $version) {
  $dir = drupal_get_path('module', 'uc_store') . '/countries/';
  $match = '_' . $country_id . '_' . $version . '.cif';
  $matchlen = strlen($match);
  $countries = array();
  if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
      while (($file = readdir($dh)) !== false) {
        switch (filetype($dir . $file)) {
          case 'file':
            if (substr($file, -$matchlen) == $match) {
              require_once $dir . $file;
              return substr($file, 0, strlen($file) - $matchlen);
            }
            break;
        }
      }
      closedir($dh);
    }
  }
  return FALSE;
}