Count.php in Site Audit 7
Same filename in this branch
Same filename and directory in other branches
Contains \SiteAudit\Check\Views\Count.
File
Check/Views/Count.phpView source
<?php
/**
* @file
* Contains \SiteAudit\Check\Views\Count.
*/
/**
* Class SiteAuditCheckViewsCount.
*/
class SiteAuditCheckViewsCount extends SiteAuditCheckAbstract {
/**
* Implements \SiteAudit\Check\Abstract\getLabel().
*/
public function getLabel() {
return dt('Count');
}
/**
* Implements \SiteAudit\Check\Abstract\getDescription().
*/
public function getDescription() {
return dt('Number of enabled Views.');
}
/**
* Implements \SiteAudit\Check\Abstract\getResultFail().
*/
public function getResultFail() {
}
/**
* Implements \SiteAudit\Check\Abstract\getResultInfo().
*/
public function getResultInfo() {
}
/**
* Implements \SiteAudit\Check\Abstract\getResultPass().
*/
public function getResultPass() {
$views_count = count($this->registry['views']);
if (!$views_count) {
return dt('There are no enabled views.');
}
return dt('There are @count_views enabled views.', array(
'@count_views' => count($this->registry['views']),
));
}
/**
* Implements \SiteAudit\Check\Abstract\getResultWarn().
*/
public function getResultWarn() {
return $this
->getResultPass();
}
/**
* Implements \SiteAudit\Check\Abstract\getAction().
*/
public function getAction() {
if ($this->score == SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN) {
return dt('Consider disabling the views module if you don\'t need it.');
}
}
/**
* Implements \SiteAudit\Check\Abstract\calculateScore().
*/
public function calculateScore() {
$this->registry['views'] = array();
foreach (views_get_all_views() as $view) {
if ($view->disabled) {
continue;
}
$this->registry['views'][] = $view;
}
if (empty($this->registry['views'])) {
$this->abort = TRUE;
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN;
}
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
}
}
Classes
Name | Description |
---|---|
SiteAuditCheckViewsCount | Class SiteAuditCheckViewsCount. |