You are here

public static function EncryptFAPITest::decrypt in Encrypt Form API 7.2

Decrypts a variable.

1 call to EncryptFAPITest::decrypt()
EncryptFAPITest::testEncryption in ./encryptfapi.test
Tests #encrypt property on all supported form element types.

File

./encryptfapi.test, line 60
Tests for encrypt.module

Class

EncryptFAPITest
Test basic encryption and decryption.

Code

public static function decrypt($variable) {
  $decrypted = decrypt($variable);

  // If the decrypted text is serialized, unserialize it.
  $unserialized = @unserialize($decrypted);
  if ($unserialized !== FALSE) {
    foreach ($unserialized as $key => $value) {
      if ($value) {
        $decrypted = $unserialized[$key];
        break;
      }
    }
  }
  return $decrypted;
}