Esempio n. 1
0
        <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
                <title>Wikidata HTML Validation</title>
        </head>
        <body>
                <a href="http://meta.wikimedia.org/wiki/Wikidata"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Wikidata-logo-en.svg/160px-Wikidata-logo-en.svg.png" /></a> <h2>Wikidata HTML Validation</h2>
                <p>
                This page lists all HTML validation errors in Wikidata found by the <a href="http://validator.w3.org">W3C Markup Validation Service</a>.</p>
';
$validation_page_content = '';
$validation_page_footer = '
        </body>
</html>';
$errorsPerPage = array();
foreach ($urls as $url) {
    $r = $v->validate($domain . $url);
    if ($r->isValid()) {
        echo $domain . $url . ' is valid.' . PHP_EOL;
    } else {
        if (sizeof($r->errors) > 0) {
            foreach ($r->errors as $nr => $error) {
                if (!checkArrayValues(trim($error->message))) {
                    if (!array_key_exists($domain . $url, $errorsPerPage)) {
                        $errorsPerPage[$domain . $url] = 1;
                    } else {
                        $errorsPerPage[$domain . $url] = $errorsPerPage[$domain . $url] + 1;
                    }
                    if ($errorsPerPage[$domain . $url] == 1) {
                        echo $domain . $url . ' is not valid:' . PHP_EOL;
                        $validation_page_content .= '<p><a href="' . $domain . $url . '">' . $domain . $url . '</a>:
									<ul>';
Esempio n. 2
0
 private function initW3c()
 {
     if (!$this->w3cCalled) {
         $this->w3cCalled = true;
         $v = new Services_W3C_HTMLValidator();
         $r = $v->validate($this->url);
         if ($r !== false) {
             $this->lastW3Cerrors = $r->errors;
             $this->lastW3Cwarnings = $r->warnings;
             $this->w3cValid = $r->isValid();
         } else {
             throw new Exception("Request to W3C failed.");
         }
     }
 }