From 36a2c0fcde4d3a7960e8a74223e631f6bacb559f Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 26 Aug 2020 19:54:17 +0200 Subject: [PATCH] Rechercher de phrase exacte entre guillemets --- module/search/search.php | 8 +++++++- module/search/view/index/index.php | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/module/search/search.php b/module/search/search.php index 74acfcfa..e63509c8 100755 --- a/module/search/search.php +++ b/module/search/search.php @@ -38,6 +38,10 @@ class search extends common { 400 => '400 caractères', ]; + // Message par défaut + public static $messagePlaceHolder = 'Un ou plusieurs mots-clés entre des espaces ou des guillemets'; + public static $messageButtontext = 'Rechercher'; + const SEARCH_VERSION = '1.1'; // Configuration vide @@ -212,9 +216,11 @@ class search extends common { // Accentuation $contenu = html_entity_decode($contenu); + // Découper le chaîne en tenant compte des quillemets + $a = str_getcsv(html_entity_decode($motclef), ' '); + // Construire la clé de recherche selon options de recherche $keywords = '/('; - $a = explode(' ',$motclef); foreach ($a as $key => $value) { $keywords .= $motentier === true ? $value . '|' : '\b' . $value . '\b|' ; } diff --git a/module/search/view/index/index.php b/module/search/view/index/index.php index dd4faa52..4399c591 100755 --- a/module/search/view/index/index.php +++ b/module/search/view/index/index.php @@ -4,19 +4,19 @@
$this->getData(['module', $this->getUrl(0), 'placeHolder']) ? $this->getData(['module', $this->getUrl(0), 'placeHolder']) : 'Un plusieurs mots-clés séparés par un espace ou par +', + 'placeholder' => $this->getData(['module', $this->getUrl(0), 'placeHolder']) ? $this->getData(['module', $this->getUrl(0), 'placeHolder']) : $module::$messagePlaceHolder, 'value' => $module::$motclef ]); ?>
$this->getData(['module', $this->getUrl(0), 'submitText']) ? $this->getData(['module', $this->getUrl(0), 'submitText']) : 'Rechercher' + 'value' => $this->getData(['module', $this->getUrl(0), 'submitText']) ? $this->getData(['module', $this->getUrl(0), 'submitText']) : $module::$messageButtontext ]); ?>
- $module::$motentier, ]); ?>