From f105d8945781f59808416600fcf21e46a8fda92b Mon Sep 17 00:00:00 2001 From: Michael Fairchild <mfairchild365@gmail.com> Date: Wed, 13 Jan 2016 10:08:01 -0600 Subject: [PATCH] Fix footer headings Allow the role attribute --- www/index.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/www/index.php b/www/index.php index 6d94221..448c463 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; } -- GitLab