diff --git a/www/index.php b/www/index.php index 6d942214f6d4bd91e345c79bdb5de3f51f58a9e3..448c46317f37fe6dd1add4be3575f0fea8a6b9d5 100644 --- a/www/index.php +++ b/www/index.php @@ -63,6 +63,15 @@ if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) { //require_once 'HTMLPurifier.auto.php'; $config = HTMLPurifier_Config::createDefault(); $config->set('Cache.SerializerPath', '/tmp'); + + //Trick the purifier into accepting HTML5 elements/attributes + $config->set('HTML.DefinitionID', 'html5-definitions'); // unqiue id + $config->set('HTML.DefinitionRev', 1); + if ($def = $config->maybeGetRawHTMLDefinition()) { + //Allow everything to have a role + $def->addAttribute('*', 'role', 'Text'); + } + $purifier = new HTMLPurifier($config); $page->head .= '<link rel="home" href="'.htmlentities($_GET['u'], ENT_QUOTES).'" />'; @@ -78,6 +87,7 @@ if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) { $scannedContent = UNL_Search::removeRelativePaths($scannedContent, $_GET['u']); break; case 'contactinfo': + //print_r($scannedContent);exit(); $scannedContent = preg_replace('#<h3>.*</h3>#', '', $scannedContent); break; }