function theme_cas_service_validate_attributes in CAS 7
Same name and namespace in other branches
- 6.3 cas_server.response.inc \theme_cas_service_validate_attributes()
Returns CAS attributes as part of a CAS 2.0 service response.
Parameters
$variables: An associative array containing the keys 'attributes' and 'style', where the value of 'style' must be one of:
- 'jasig' (default)
- 'rubycas'
- 'name-value'
1 theme call to theme_cas_service_validate_attributes()
- theme_cas_service_validate_success in ./
cas_server.response.inc - Returns a CAS 2.0 service response for a validation success.
File
- ./
cas_server.response.inc, line 38 - Response callbacks for the CAS Server module.
Code
function theme_cas_service_validate_attributes($variables) {
$attributes = $variables['attributes'];
$style = $variables['style'];
$output = '';
switch ($style) {
case 'jasig':
default:
$output .= "<cas:attributes>\n";
$output .= "<cas:attraStyle>Jasig</cas:attraStyle>\n";
foreach ($attributes as $name => $values) {
foreach ((array) $values as $value) {
$output .= strtr("<cas:!name>!value</cas:!name>\n", array(
'!name' => $name,
'!value' => $value,
));
}
}
$output .= "</cas:attributes>\n";
break;
case 'rubycas':
$output .= "<cas:attraStyle>RubyCAS</cas:attraStyle>\n";
foreach ($attributes as $name => $values) {
foreach ((array) $values as $value) {
$output .= strtr("<cas:!name>!value</cas:!name>\n", array(
'!name' => $name,
'!value' => $value,
));
}
}
break;
case 'name-value':
$output .= "<cas:attribute name='attraStyle' value='Name-Value' />\n";
foreach ($attributes as $name => $values) {
foreach ((array) $values as $value) {
$output .= strtr("<cas:attribute name='!name' value='!value' />\n", array(
'!name' => $name,
'!value' => $value,
));
}
}
break;
}
return $output;
}