Skip to content
Snippets Groups Projects
Commit d784fc4e authored by Kevin Abel's avatar Kevin Abel
Browse files

Simplify local site content region populate logic

parent 5d7d8dc0
No related branches found
No related tags found
1 merge request!2Local site search and Directory CSS updates
......@@ -76,17 +76,23 @@ if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) {
$purifier = new HTMLPurifier($config);
$page->head .= '<link rel="home" href="'.htmlentities($_GET['u'], ENT_QUOTES).'" />';
$page->breadcrumbs = $purifier->purify(UNL_Search::removeRelativePaths($scanned->breadcrumbs, $_GET['u']));
$page->titlegraphic = $purifier->purify(str_replace(array('<h1>', '</h1>'), '',$scanned->titlegraphic));
$page->navlinks = $purifier->purify(UNL_Search::removeRelativePaths($scanned->navlinks, $_GET['u']));
if (!empty($scanned->leftcollinks)) {
$page->leftcollinks = $purifier->purify($scanned->leftcollinks);
}
if (!empty($scanned->contactinfo)) {
$page->contactinfo = $purifier->purify(preg_replace('#<h3>.*</h3>#', '', $scanned->contactinfo));
}
if (!empty($scanned->footercontent)) {
$page->footercontent = $purifier->purify($scanned->footercontent);
$page->titlegraphic = $purifier->purify(str_replace(array('<h1>', '</h1>'), '', $scanned->titlegraphic));
foreach (array('breadcrumbs', 'navlinks', 'leftcollinks', 'contactinfo', 'footercontent') as $region) {
if (isset($scanned->{$region}) && !empty($scanned->{$region})) {
$scannedContent = $scanned->{$region};
switch ($region) {
case 'breadcrumbs':
case 'navlinks':
$scannedContent = UNL_Search::removeRelativePaths($scannedContent, $_GET['u']);
break;
case 'contactinfo':
$scannedContent = preg_replace('#<h3>.*</h3>#', '', $scannedContent);
break;
}
$page->{$region} = $purifier->purify($scannedContent);
}
}
} else {
loadDefaultSections($page);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment