function _cas_roles_recursive_str_replace in CAS roles 8
Same name and namespace in other branches
- 7.2 cas_roles.module \_cas_roles_recursive_str_replace()
- 7 cas_roles.module \_cas_roles_recursive_str_replace()
Recursive function to cater for nested arrays.
1 call to _cas_roles_recursive_str_replace()
- cas_roles_cas_user_presave in ./
cas_roles.module - Implements hook_cas_user_presave().
File
- ./
cas_roles.module, line 171 - Allows user account and profile attributes to be automatically populated using tokens. Provides basic tokens for attributes returned by the CAS server.
Code
function _cas_roles_recursive_str_replace(&$pattern_array, $token, $elements, $pattern) {
if (!is_array($elements)) {
$pattern_array[] = str_replace($token, $elements, $pattern);
}
else {
foreach ($elements as $element) {
_cas_roles_recursive_str_replace($pattern_array, $token, $element, $pattern);
}
}
}