function quail_api_get_standards in Quail API 7
Returns an array of standards that are supported.
Parameters
string|null $standard: (optional) Providing a valid standard name will cause the return value to only contain the standard that matches this string.
string $target: (optional) Target allows for selecting standards based on some category or purpose. The target, in general, represents the scope in which the standards will be applied. The following targets are directly supported: 'snippet', 'page'.
Return value
array An array of standards that are supported by this module or extending modules. The array keys are the machine names for each standard.
1 call to quail_api_get_standards()
- quail_api_get_standards_list in ./
quail_api.module - Returns a list of standards.
1 string reference to 'quail_api_get_standards'
- quail_api_reset_cache in ./
quail_api.module - Resets all static caches provided by this module.
File
- ./
quail_api.module, line 224 - Module file for the quail api.
Code
function quail_api_get_standards($standard = NULL, $target = 'snippet') {
$standards =& drupal_static(__FUNCTION__, NULL);
if (!isset($standards)) {
if ($cache = cache_get('quail_api_standards')) {
$standards = $cache->data;
}
}
if (isset($standards)) {
if (!is_null($standard)) {
if (isset($standards[$standard])) {
return $standards[$standard];
}
return array();
}
return $standards;
}
$standards = array();
if ($target == 'snippet' || $target == 'page') {
$reporter = 'quail_api';
$module = 'quail_api';
$standards['all'] = array(
'human_name' => t("All Tests"),
'module' => $module,
'description' => t("Validate using all known tests. This is more efficient than validating against each individual standard because identical tests are not run multiple times."),
'guideline' => $target == 'snippet' ? 'quail_api_all' : 'all',
'reporter' => $reporter,
'target' => $target,
);
$standards['section_508'] = array(
'human_name' => t("Section 508"),
'module' => $module,
'description' => t("Validate using the <a href='@section_508'>Section 508</a> standard.", array(
'@section_508' => 'http://www.section508.gov/index.cfm?fuseAction=stdsdoc#Web',
)),
'guideline' => $target == 'snippet' ? 'quail_api_section508' : 'section508',
'reporter' => $reporter,
'target' => $target,
);
$standards['wcag_1_0_a'] = array(
'human_name' => t("WCAG 1.0 a"),
'module' => $module,
'description' => t("Validate using the <a href='@wcag_1_0'>WCAG 1.0</a> (<a href='@wcag_1_0_a'>A</a>) standard.", array(
'@wcag_1_0' => 'http://www.w3.org/TR/WCAG10/',
'@wcag_1_0_a' => 'http://www.w3.org/WAI/WCAG1A-Conformance',
)),
'guideline' => $target == 'snippet' ? 'quail_api_wcag1a' : 'wcag1a',
'reporter' => $reporter,
'target' => $target,
);
$standards['wcag_1_0_aa'] = array(
'human_name' => t("WCAG 1.0 aa"),
'module' => $module,
'description' => t("Validate using the <a href='@wcag_1_0'>WCAG 1.0</a> (<a href='@wcag_1_0_aa'>AA</a>) standard.", array(
'@wcag_1_0' => 'http://www.w3.org/TR/WCAG10/',
'@wcag_1_0_a' => 'http://www.w3.org/WAI/WCAG1AA-Conformance',
)),
'guideline' => $target == 'snippet' ? 'quail_api_wcag1aa' : 'wcag1aa',
'reporter' => $reporter,
'target' => $target,
);
$standards['wcag_1_0_aaa'] = array(
'human_name' => t("WCAG 1.0 aaa"),
'module' => $module,
'description' => t("Validate using the <a href='@wcag_1_0'>WCAG 1.0</a> (<a href='@wcag_1_0_aaa'>AAA</a>) standard.", array(
'@wcag_1_0' => 'http://www.w3.org/TR/WCAG10/',
'@wcag_1_0_a' => 'http://www.w3.org/WAI/WCAG1AAA-Conformance',
)),
'guideline' => $target == 'snippet' ? 'quail_api_wcag1aaa' : 'wcag1aaa',
'reporter' => $reporter,
'target' => $target,
);
$standards['wcag_2_0_a'] = array(
'human_name' => t("WCAG 2.0 a"),
'module' => $module,
'description' => t("Validate using the <a href='@wcag_2_0'>WCAG 2.0</a> (<a href='@wcag_2_0_a'>A</a>) standard.", array(
'@wcag_2_0' => 'http://www.w3.org/TR/WCAG20/',
'@wcag_1_0_a' => 'http://www.w3.org/WAI/WCAG2A-Conformance',
)),
'guideline' => $target == 'snippet' ? 'quail_api_wcag2a' : 'wcag2a',
'reporter' => $reporter,
'target' => $target,
);
$standards['wcag_2_0_aa'] = array(
'human_name' => t("WCAG 2.0 aa"),
'module' => $module,
'description' => t("Validate using the <a href='@wcag_2_0'>WCAG 2.0</a> (<a href='@wcag_2_0_aa'>AA</a>) standard.", array(
'@wcag_2_0' => 'http://www.w3.org/TR/WCAG20/',
'@wcag_1_0_a' => 'http://www.w3.org/WAI/WCAG2AA-Conformance',
)),
'guideline' => $target == 'snippet' ? 'quail_api_wcag2aa' : 'wcag2aa',
'reporter' => $reporter,
'target' => $target,
);
$standards['wcag_2_0_aaa'] = array(
'human_name' => t("WCAG 2.0 aaa"),
'module' => $module,
'description' => t("Validate using the <a href='@wcag_2_0'>WCAG 2.0</a> (<a href='@wcag_2_0_aaa'>AAA</a>) standard.", array(
'@wcag_2_0' => 'http://www.w3.org/TR/WCAG20/',
'@wcag_1_0_a' => 'http://www.w3.org/WAI/WCAG2AAA-Conformance',
)),
'guideline' => $target == 'snippet' ? 'quail_api_wcag2aaa' : 'wcag2aaa',
'reporter' => $reporter,
'target' => $target,
);
}
$other_arguments = array();
$other_arguments['target'] = $target;
drupal_alter('quail_api_get_standards', $standards, $standard, $other_arguments);
cache_set('quail_api_standards', $standards, 'cache');
if (!is_null($standard)) {
if (isset($standards[$standard])) {
return $standards[$standard];
}
return array();
}
return $standards;
}