function uc_encryption_class::applyFudgeFactor in Ubercart 6.2
Returns an adjustment value based on the contents of $fudgefactor.
2 calls to uc_encryption_class::applyFudgeFactor()
- uc_encryption_class::decrypt in uc_store/
uc_store.module - Decrypts cyphertext.
- uc_encryption_class::encrypt in uc_store/
uc_store.module - Encrypts plaintext.
File
- uc_store/
uc_store.module, line 2005 - Contains global Ubercart functions and store administration functionality.
Class
- uc_encryption_class
- Handle encryption of credit-card information.
Code
function applyFudgeFactor(&$fudgefactor) {
static $alerted = FALSE;
if (!is_array($fudgefactor)) {
$fudge = 0;
if (!$alerted) {
// Throw an error that makes sense so this stops getting reported.
$this->errors[] = t('No encryption key was found.');
drupal_set_message(t('Ubercart cannot find a necessary encryption key. Refer to the store admin <a href="!url">dashboard</a> to isolate which one.', array(
'!url' => url('admin/store'),
)), 'error');
$alerted = TRUE;
}
}
else {
$fudge = array_shift($fudgefactor);
}
$fudge = $fudge + $this->adj;
$fudgefactor[] = $fudge;
if (!empty($this->mod)) {
if ($fudge % $this->mod == 0) {
$fudge = $fudge * -1;
}
}
return $fudge;
}