abstract class SecurityReviewSiteAuditCheckAbstract in Security Review 7
Class SecurityReviewSiteAuditCheckAbstract
Hierarchy
Expanded class hierarchy of SecurityReviewSiteAuditCheckAbstract
File
- ./
security_review.site_audit.inc, line 10 - Contains \SiteAudit\Check\Security security_review checks.
View source
abstract class SecurityReviewSiteAuditCheckAbstract extends SiteAuditCheckAbstract {
/**
* The implementing module.
* @var string
*/
protected $module = 'security_review';
/**
* The check in question.
* @var string
*/
protected $check;
/**
* Implements \SiteAudit\Check\Abstract\getLabel().
*/
public function getLabel() {
$checks = security_review_get_checklist();
return $checks[$this->module][$this->check]['title'];
}
/**
* Implements \SiteAudit\Check\Abstract\getDescription().
*/
public function getDescription() {
$checks = security_review_get_checklist();
return dt('Security Check of @title', array(
'@title' => $checks[$this->module][$this->check]['title'],
));
}
/**
* Implements \SiteAudit\Check\Abstract\getResultFail().
*/
public function getResultFail() {
$ret_val = $this->registry[$this->module][$this->check]['failure'];
if (isset($this->registry[$this->module][$this->check]['value'])) {
if (is_array($this->registry[$this->module][$this->check]['value'])) {
$ret_val .= $this
->generateUl($this->registry[$this->module][$this->check]['value'], drush_get_option('html'));
}
elseif ($this->registry[$this->module][$this->check]['value']) {
$ret_val .= ' Additional: "' . $this->registry[$this->module][$this->check]['value'] . '"';
}
}
return $ret_val;
}
/**
* Generates an unordered list or flattened text version of a nested array.
*
* @param array $array
* Security Review results.
* @param bool $html
* TRUE if the result should be rendered as HTML.
* @param int $indentation
* The number of spaces; defaults to 6.
*
* @return string
* Formatted result.
*/
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;
}
/**
* Implements \SiteAudit\Check\Abstract\getResultInfo().
*/
public function getResultInfo() {
}
/**
* Implements \SiteAudit\Check\Abstract\getResultPass().
*/
public function getResultPass() {
return $this->registry[$this->module][$this->check]['success'];
}
/**
* Implements \SiteAudit\Check\Abstract\getResultWarn().
*/
public function getResultWarn() {
}
/**
* Implements \SiteAudit\Check\Abstract\getAction().
*/
public function getAction() {
}
/**
* Implements \SiteAudit\Check\Abstract\calculateScore().
*/
public function calculateScore() {
$checks = security_review_get_checklist();
$checklist_results = security_review_run(array(
$this->module => array(
$checks[$this->module][$this->check],
),
));
$this->registry[$this->module][$this->check] = $checklist_results['security_review'][0];
if (!$this->registry[$this->module][$this->check]['result']) {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL;
}
else {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SecurityReviewSiteAuditCheckAbstract:: |
protected | property | The check in question. | 10 |
SecurityReviewSiteAuditCheckAbstract:: |
protected | property | The implementing module. | |
SecurityReviewSiteAuditCheckAbstract:: |
public | function |
Implements \SiteAudit\Check\Abstract\calculateScore(). Overrides SiteAuditCheckAbstract:: |
|
SecurityReviewSiteAuditCheckAbstract:: |
private | function | Generates an unordered list or flattened text version of a nested array. | |
SecurityReviewSiteAuditCheckAbstract:: |
public | function |
Implements \SiteAudit\Check\Abstract\getAction(). Overrides SiteAuditCheckAbstract:: |
|
SecurityReviewSiteAuditCheckAbstract:: |
public | function |
Implements \SiteAudit\Check\Abstract\getDescription(). Overrides SiteAuditCheckAbstract:: |
|
SecurityReviewSiteAuditCheckAbstract:: |
public | function |
Implements \SiteAudit\Check\Abstract\getLabel(). Overrides SiteAuditCheckAbstract:: |
|
SecurityReviewSiteAuditCheckAbstract:: |
public | function |
Implements \SiteAudit\Check\Abstract\getResultFail(). Overrides SiteAuditCheckAbstract:: |
1 |
SecurityReviewSiteAuditCheckAbstract:: |
public | function |
Implements \SiteAudit\Check\Abstract\getResultInfo(). Overrides SiteAuditCheckAbstract:: |
|
SecurityReviewSiteAuditCheckAbstract:: |
public | function |
Implements \SiteAudit\Check\Abstract\getResultPass(). Overrides SiteAuditCheckAbstract:: |
|
SecurityReviewSiteAuditCheckAbstract:: |
public | function |
Implements \SiteAudit\Check\Abstract\getResultWarn(). Overrides SiteAuditCheckAbstract:: |
|
SiteAuditCheckAbstract:: |
protected | property | Indicate that no other checks should be run after this check. | |
SiteAuditCheckAbstract:: |
protected | property | User has opted out of this check in configuration. | |
SiteAuditCheckAbstract:: |
protected | property | If set, will override the Report's percentage. | |
SiteAuditCheckAbstract:: |
protected | property | Use for passing data between checks within a report. | |
SiteAuditCheckAbstract:: |
protected | property | Quantifiable number associated with result on a scale of 0 to 2. | |
SiteAuditCheckAbstract:: |
constant | |||
SiteAuditCheckAbstract:: |
constant | |||
SiteAuditCheckAbstract:: |
constant | |||
SiteAuditCheckAbstract:: |
constant | |||
SiteAuditCheckAbstract:: |
public | function | Get the report percent override, if any. | |
SiteAuditCheckAbstract:: |
public | function | Get the check registry. | |
SiteAuditCheckAbstract:: |
public | function | Gives path relative to DRUPAL_ROOT of the path is inside Drupal. | |
SiteAuditCheckAbstract:: |
public | function | Determine the result message based on the score. | |
SiteAuditCheckAbstract:: |
public | function | Get a quantifiable number representing a check result; lazy initialization. | |
SiteAuditCheckAbstract:: |
public | function | Get the CSS class associated with a score. | |
SiteAuditCheckAbstract:: |
public | function | Get the Drush message level associated with a score. | |
SiteAuditCheckAbstract:: |
public | function | Get a human readable label for a score. | |
SiteAuditCheckAbstract:: |
public | function | Display action items for a user to perform. | |
SiteAuditCheckAbstract:: |
public | function | Determine whether the check failed so badly that the report must stop. | |
SiteAuditCheckAbstract:: |
public | function | Constructor. |