You are here

function uc_length_conversion in Ubercart 5

Same name and namespace in other branches
  1. 8.4 uc_store/uc_store.module \uc_length_conversion()
  2. 6.2 uc_store/uc_store.module \uc_length_conversion()
  3. 7.3 uc_store/uc_store.module \uc_length_conversion()
1 call to uc_length_conversion()
_uc_usps_package_products in shipping/uc_usps/uc_usps.module

File

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

Code

function uc_length_conversion($from_units, $to_units = NULL) {
  if (is_null($to_units)) {
    $to_units = variable_get('uc_length_unit', 'in');
  }
  $constant = strtoupper($from_units) . '_TO_' . strtoupper($to_units);
  if (defined($constant) && ($conversion = constant($constant)) > 0) {
    return $conversion;
  }
  else {
    return 1;
  }
}