function getTest($file, $test) { $name = explode('-', $file); $filename = 'testfiles/quail/' . $file; $quail = new quail($filename, 'wcag1a', 'file'); $quail->runCheck(); return $quail->getTest($test); }
} } } closedir($dh); } } return $file_info; } $ignore = array('Imported_Resources'); $test = find_directory("../example/Webcourses/", $ignore); $fullReport = array(); require_once '../quail/quail.php'; foreach ($test as $html) { $error = 0; $report = array(); $quail = new quail($html['text'], 'section508', 'string', 'static'); $quail->runCheck(); $result = $quail->getReport(); $report = $result['report']; $severe = array(); $warning = array(); $suggestion = array(); foreach ($report as $value) { if ($value['severity_num'] == 1) { array_push($severe, $value); } else { if ($value['severity_num'] == 2) { array_push($warning, $value); } else { if ($value['severity_num'] == 3) { array_push($suggestion, $value);
/** * Calls the Quail library to generate a UDOIT report * @param array $scanned_content - The items from whatever type of Canvas content was scanned * @return array - The report results */ private function generateReport($scanned_content) { $content_report = []; /* Runs each item in the test array through the Quail accessibility checker */ foreach ($scanned_content as $html) { if (strlen($html['content']) == 0) { continue; } $error = 0; $report = []; $quail = new quail($html['content'], 'wcag2aaa', 'string', 'static'); $quail->runCheck(); $result = $quail->getReport(); $report = $result['report']; $severe = []; $warning = []; $suggestion = []; foreach ($report as $value) { // Some don't have a severity num if (!array_key_exists('severity_num', $value)) { continue; } if ($value['severity_num'] == 1) { array_push($severe, $value); } elseif ($value['severity_num'] == 2) { array_push($warning, $value); } elseif ($value['severity_num'] == 3) { array_push($suggestion, $value); } if (count($value) > 0) { $error++; } } $final['id'] = $html['id']; $final['name'] = $html['title']; $final['url'] = $html['url']; $final['amount'] = $error; $final['error'] = $severe; $final['warning'] = $warning; $final['suggestion'] = $suggestion; array_push($content_report, $final); } return $content_report; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <style type="text/css"> .quail_severe { background:red; } </style> <body> <?php require_once '../quail/quail.php'; $quail = new quail('http://tux.cdl.ucf.edu/~kbaugh/test/quail.html', 'section508', 'uri', 'codeHighlight'); $quail->runCheck(); print_r($quail->getReport()); ?> </body> </html>
/** * Loads a CSS file from a URI * @param string $rel The URI of the CSS file */ private function loadUri($rel) { if ($this->type == 'file') { $uri = substr($this->uri, 0, strrpos($this->uri, '/')) . '/' . $rel; } else { $uri = quail::getAbsolutePath($this->uri, $rel); } $this->css_string .= @file_get_contents($uri); }