private function ValidateHTML($html)
 {
     $Validator = new XhtmlValidator();
     $result = $Validator->validate($html);
     if ($Validator->validate($html) === false) {
         error_log('**Error**' . 'There are errors in the XHTML of page ' . $this->GetURL() . "\n", 3, '/home/tim/weberp' . date('Ymd') . '.log');
         $Validator->logErrors();
     }
     return $result;
 }
예제 #2
0
파일: App_test.php 프로젝트: hutchike/YAWF
 /**
  * Validate some HTML as XHTML and return any errors
  *
  * @param String $html the HTML to validate as XHTML
  * @return Array an array of validation errors, or NULL
  */
 public function xhtml_errors($html)
 {
     // Create an XHTML validator
     load_plugin('Validators/XhtmlValidator');
     $xhtml_validator = new XhtmlValidator();
     // Validate the HTML as XHTML
     $is_valid = $xhtml_validator->validate($html);
     if ($is_valid) {
         return NULL;
     }
     // Filter out unhelpful errors
     $errors = $xhtml_validator->getErrors();
     $filtered = array();
     foreach ($errors as $error) {
         $error = strip_tags($error);
         if (preg_match('/^Tag script may not contain raw character data/', $error)) {
             continue;
         }
         $filtered[] = $error;
     }
     // Return the filtered errors
     return count($filtered) ? $filtered : NULL;
 }