private function SecurityReviewSiteAuditCheckAbstract::generateUl in Security Review 7
Generates an unordered list or flattened text version of a nested array.
Parameters
array $array: Security Review results.
bool $html: TRUE if the result should be rendered as HTML.
int $indentation: The number of spaces; defaults to 6.
Return value
string Formatted result.
1 call to SecurityReviewSiteAuditCheckAbstract::generateUl()
- SecurityReviewSiteAuditCheckAbstract::getResultFail in ./
security_review.site_audit.inc - Implements \SiteAudit\Check\Abstract\getResultFail().
File
- ./
security_review.site_audit.inc, line 70 - Contains \SiteAudit\Check\Security security_review checks.
Class
- SecurityReviewSiteAuditCheckAbstract
- Class SecurityReviewSiteAuditCheckAbstract
Code
private function generateUl($array, $html = TRUE, $indentation = 6) {
$result = $html ? '<ul>' : '';
foreach ($array as $key => $value) {
$result .= $html ? '<li>' : PHP_EOL . str_repeat(' ', $indentation);
$result .= $key . ': ';
if (is_array($value)) {
$result .= $this
->generateUl($value, $html, $indentation + 2);
}
elseif (isset($value->name) && $value->name) {
$result .= $value->name;
}
elseif ($value) {
$result .= $value;
}
$result .= $html ? '</li>' : '';
}
$result .= $html ? '</ul>' : '';
return $result;
}