You are here

function _cas_roles_recursive_str_replace in CAS roles 7.2

Same name and namespace in other branches
  1. 8 cas_roles.module \_cas_roles_recursive_str_replace()
  2. 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_candidates in ./cas_roles.module
Translate attributes to role candidates.

File

./cas_roles.module, line 227
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);
    }
  }
}