21,7 → 21,7 |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: more_recherche.class.php,v 1.10 2006-12-12 13:54:41 jp_milcent Exp $ |
// CVS : $Id: more_recherche.class.php,v 1.11 2007-01-02 18:49:22 jp_milcent Exp $ |
/** |
* Classe permettant d'effectuer des recherches sur les métas informations des menus. |
* |
34,7 → 34,7 |
//Autres auteurs : |
*@author aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.10 $ $Date: 2006-12-12 13:54:41 $ |
*@version $Revision: 1.11 $ $Date: 2007-01-02 18:49:22 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
129,18 → 129,31 |
{ |
$nbre_correspondance = 0; |
$nbre_correspondance_total = 0; |
if ($mode == 1) { |
$motif = $this->traiterMotif($motif, 'simple'); |
// Si demande de recherche d'expression complète |
if (preg_match('/^".+"$/', $motif)) { |
$mode = 2; |
|
} |
$motif = $this->traiterMotif($motif, 'recherche'); |
switch ($mode) { |
case '1' : |
// Découpage en mot |
$tab_motif = explode(' ', trim($motif)); |
} else { |
$tab_motif = explode(' ', $motif); |
break; |
case '2' : |
// La chaine saisie par l'utilisateur est recherchée tel quel |
$tab_motif[] = trim($motif); |
$tab_motif[] = $motif; |
break; |
default: |
$e = 'Mode pour le moteur de recherche inconnu : '.$mode. |
trigger_error($e, E_USER_ERROR); |
} |
// Nous recherchons chaque mot |
$compteur_mot = 0; |
foreach ($tab_motif as $mot) { |
//$nbre_correspondance += preg_match_all('/'.$mot.'/i', $texte, $tab_morceaux); |
$nbre_correspondance = substr_count(strtolower($texte), strtolower(stripslashes($mot))); |
$nbre_correspondance = substr_count(strtolower($texte), strtolower($mot)); |
if ($nbre_correspondance > 0) { |
$compteur_mot++; |
} |
154,6 → 167,30 |
} |
} |
|
function traiterMotif($motif, $type = 0) |
{ |
switch ($type) { |
case 'simple' : |
return trim(stripslashes($motif)); |
break; |
case 'recherche' : |
if (preg_match('/^"(.+)"$/', $motif, $match)) { |
$motif = $match[1]; |
} |
return $motif; |
break; |
case 'url' : |
$motif = trim(stripslashes($motif)); |
if (preg_match('/^"(.+)"$/', $motif, $match)) { |
$motif = $match[1]; |
} |
return urlencode($motif); |
break; |
default: |
return $motif; |
} |
} |
|
function traduireMois($mois_numerique) |
{ |
switch ($mois_numerique) { |
190,6 → 227,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.10 2006/12/12 13:54:41 jp_milcent |
* Correction bogue : variable non initialisée. |
* |
* Revision 1.9 2006/10/17 09:21:40 jp_milcent |
* Mise en commun des spécifications de la recherche. |
* |