function encrypt_check_method in Encrypt 6
Same name and namespace in other branches
- 7 includes/encrypt.crypt.inc \encrypt_check_method()
Check Method
Check if a method is valid for encryption
Parameters
$method: Method to check for
Return value
Method name or FALSE
1 call to encrypt_check_method()
- _encrypt_decrypt in includes/
encrypt.crypt.inc - Private Encrypt and Decrypt
File
- includes/
encrypt.crypt.inc, line 153 - This file holds the functions necessary to encrypt and decrypt
Code
function encrypt_check_method($method = NULL) {
$methods = encrypt_get_methods('full');
$method = (string) $method;
// Determine method
if ($method == NULL) {
$method = variable_get('encrypt_default_method', ENCRYPT_DEFAULT_METHOD);
}
// Make sure its a valid method
if (!is_array($methods[$method])) {
watchdog('encrypt', 'Encrypt call with invalid method: %method', array(
'%method' => $method,
));
return FALSE;
}
// Make sure theres a valid callback
if (empty($methods[$method]['callback']) || !function_exists($methods[$method]['callback'])) {
watchdog('encrypt', 'Encrypt function call is not valid: %function , for method: %method', array(
'%method' => $method,
'%function' => $methods[$method]['callback'],
));
return FALSE;
}
return $method;
}