exclude ns in pagelook ups

Enables excluding namespaces in the quick search of the searchform
https://github.com/Klap-in/dokuwiki-plugin-searchform/issues/7
This commit is contained in:
Gerrit Uitslag 2021-04-01 23:48:01 +02:00
parent ccd2e0d647
commit 248d652bb4
1 changed files with 11 additions and 0 deletions

View File

@ -268,6 +268,10 @@ function _ft_pageLookup(&$data){
$ns = cleanID($parsedQuery['ns'][0]) . ':';
$id = implode(' ', $parsedQuery['highlight']);
}
if (count($parsedQuery['notns']) > 0) {
$notns = cleanID($parsedQuery['notns'][0]) . ':';
$id = implode(' ', $parsedQuery['highlight']);
}
$in_ns = $data['in_ns'];
$in_title = $data['in_title'];
@ -299,6 +303,13 @@ function _ft_pageLookup(&$data){
}
}
}
if (isset($notns)) {
foreach (array_keys($pages) as $p_id) {
if (strpos($p_id, $notns) === 0) {
unset($pages[$p_id]);
}
}
}
// discard hidden pages
// discard nonexistent pages