function encrypt_get_methods in Encrypt 7
Same name and namespace in other branches
- 6 includes/encrypt.crypt.inc \encrypt_get_methods()
Get Encryption Methods
Parameters
$format: String of format to return. Can be the following:
- "simple": A simple key/balue pair for selects
- "full": An array of all method data
$reset: Boolean of whether to invoke modules again
Return value
Formatted array
3 calls to encrypt_get_methods()
- encrypt_admin_settings in includes/
encrypt.admin.inc - Menu callback; displays the encrypt module settings page.
- encrypt_check_method in includes/
encrypt.crypt.inc - Check Method
- _encrypt_decrypt in includes/
encrypt.crypt.inc - Private Encrypt and Decrypt
File
- includes/
encrypt.crypt.inc, line 22 - This file holds the ffunctions necessary to encrypt and decrypt
Code
function encrypt_get_methods($format = 'simple', $reset = FALSE) {
static $methods = array();
static $simple = array();
static $full = array();
// Check format
if (empty($methods) || $reset == TRUE) {
// Invoke the encrypt_method_info hook
$methods = module_invoke_all('encrypt_method_info');
}
// Check if format variable has data
if (empty(${$format}) || $reset == TRUE) {
$return = array();
// Go through results
foreach ($methods as $name => $method) {
// Determine how to format data
switch ($format) {
case 'simple':
$return[$name] = $method['title'];
break;
case 'full':
$return[$name] = $method;
break;
}
}
// Set it for our static cache.
${$format} = $return;
return $return;
}
else {
return ${$format};
}
}