You are here

function _country_import_include in Ubercart 6.2

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

Includes 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.admin.inc
Submit handler for uc_country_remove_form().
uc_country_update in uc_store/uc_store.admin.inc
Updates a country to its latest version.

File

uc_store/uc_store.module, line 1617
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;
}