diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-02-10 11:42:17 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-02-10 11:42:17 +0100 |
commit | 4f9a0544218341204bee98d41bcc097dc61f1799 (patch) | |
tree | e04614acb636d2f73013a31b078df3907b061730 /app | |
parent | cb6f0e8c3f2abe2bf895320a58a466c7a766dbf9 (diff) | |
download | wcms-4f9a0544218341204bee98d41bcc097dc61f1799.tar.gz wcms-4f9a0544218341204bee98d41bcc097dc61f1799.zip |
add case sensitivity option in dsb
*deep search bar
Diffstat (limited to 'app')
-rw-r--r-- | app/class/Controllerhome.php | 3 | ||||
-rw-r--r-- | app/class/Modelhome.php | 7 | ||||
-rw-r--r-- | app/view/templates/home.php | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/app/class/Controllerhome.php b/app/class/Controllerhome.php index 2fa06fb..5a9110a 100644 --- a/app/class/Controllerhome.php +++ b/app/class/Controllerhome.php @@ -32,12 +32,13 @@ class Controllerhome extends Controllerpage $vars['colors'] = new Colors($this->opt->taglist()); if (!isset($_GET['search'])) { - $searchopt = ['title' => 1, 'description' => 1, 'content' => 1, 'other' => 0]; + $searchopt = ['title' => 1, 'description' => 1, 'content' => 1, 'other' => 0, 'casesensitive' => 0]; } else { $searchopt['title'] = $_GET['title'] ?? 0; $searchopt['description'] = $_GET['description'] ?? 0; $searchopt['content'] = $_GET['content'] ?? 0; $searchopt['other'] = $_GET['other'] ?? 0; + $searchopt['casesensitive'] = $_GET['case'] ?? 0; } $regex = $_GET['search'] ?? ''; diff --git a/app/class/Modelhome.php b/app/class/Modelhome.php index 541eb07..e3d60a3 100644 --- a/app/class/Modelhome.php +++ b/app/class/Modelhome.php @@ -96,7 +96,12 @@ class Modelhome extends Modelpage */ public function deepsearch(string $regex, array $options, array $pagelist) : array { - $regex = '/' . $regex . '/'; + if($options['casesensitive']) { + $case = ''; + } else { + $case = 'i'; + } + $regex = '/' . $regex . '/' . $case; $pageselected = []; foreach ($pagelist as $page) { $count = 0; diff --git a/app/view/templates/home.php b/app/view/templates/home.php index 404e96d..68cf965 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -30,6 +30,8 @@ <label for="deepcontent" title="Markdown content : MAIN, HEADER, NAV, ASIDE, FOOTER">content</label> <input type="checkbox" name="other" id="deepother" value="1" <?= $searchopt['other'] ? 'checked' : '' ?>> <label for="deepother" title="Structure content : BODY, CSS, Javascript">other</label> + <input type="checkbox" name="case" id="deepcase" value="1" <?= $searchopt['casesensitive'] ? 'checked' : '' ?>> + <label for="deepcase" title="Case sensitive or not">case sensitive</label> <input type="submit" value="search"> </form> </div> |