Subversion Repositories Applications.papyrus

Rev

Rev 846 | Rev 1034 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 846 Rev 851
Line 19... Line 19...
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: more_recherche.class.php,v 1.7 2006-05-19 10:04:55 jp_milcent Exp $
24
// CVS : $Id: more_recherche.class.php,v 1.8 2006-05-23 14:18:19 jp_milcent Exp $
25
/**
25
/**
26
* Classe permettant d'effectuer des recherches sur les métas informations des menus.
26
* Classe permettant d'effectuer des recherches sur les métas informations des menus.
27
*
27
*
28
* Permet de rechercher et classer les menus en fonction d'une chaine.
28
* Permet de rechercher et classer les menus en fonction d'une chaine.
29
*
29
*
Line 32... Line 32...
32
//Auteur original :
32
//Auteur original :
33
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
34
//Autres auteurs :
34
//Autres auteurs :
35
*@author        aucun
35
*@author        aucun
36
*@copyright     Tela-Botanica 2000-2004
36
*@copyright     Tela-Botanica 2000-2004
37
*@version       $Revision: 1.7 $ $Date: 2006-05-19 10:04:55 $
37
*@version       $Revision: 1.8 $ $Date: 2006-05-23 14:18:19 $
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
*/
39
*/
Line 40... Line 40...
40
 
40
 
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
Line 123... Line 123...
123
	*
123
	*
124
	* @param  string	le motif à rechercher.
124
	* @param  string	le motif à rechercher.
125
	* @param  string	le texte dans lequel effectuer la recherche. 
125
	* @param  string	le texte dans lequel effectuer la recherche. 
126
	* @return integer	le nombre de fois où les mots sont trouvés.
126
	* @return integer	le nombre de fois où les mots sont trouvés.
127
	*/
127
	*/
128
	function retournerOccurenceMotif($motif, &$texte)
128
	function retournerOccurenceMotif($motif, &$texte, $mode = MORE_MODE)
129
	{
129
	{
130
		$nbre_correspondance = 0;
130
		$nbre_correspondance = 0;
-
 
131
		if ($mode == 1) {
131
		// Découpage en mot
132
			// Découpage en mot
132
		$tab_motif = explode(' ', trim($motif));
133
			$tab_motif = explode(' ', trim($motif));
-
 
134
		} else {
-
 
135
			// La chaine saisie par l'utilisateur est recherchée tel quel
-
 
136
			$tab_motif[] = trim($motif);
-
 
137
		}
133
		// Nous recherchons chaque mot
138
		// Nous recherchons chaque mot
134
		foreach ($tab_motif as $mot) {
139
		foreach ($tab_motif as $mot) {
135
			$nbre_correspondance += substr_count(strtolower($texte), ' '.strtolower(stripslashes($mot)).' ');
140
			$nbre_correspondance += substr_count(strtolower($texte), strtolower(stripslashes($mot)));
136
			//$nbre_correspondance += preg_match_all('/'.$mot.'/i', $texte, $tab_morceaux);
141
			//$nbre_correspondance += preg_match_all('/'.$mot.'/i', $texte, $tab_morceaux);
137
		}
142
		}
138
		return $nbre_correspondance;
143
		return $nbre_correspondance;
139
	}
144
	}
Line 172... Line 177...
172
}
177
}
Line 173... Line 178...
173
 
178
 
174
/* +--Fin du code ----------------------------------------------------------------------------------------+
179
/* +--Fin du code ----------------------------------------------------------------------------------------+
175
*
180
*
-
 
181
* $Log: not supported by cvs2svn $
-
 
182
* Revision 1.7  2006/05/19 10:04:55  jp_milcent
-
 
183
* Ajout d'un moteur de recherche analysant les articles des sites sous Spip.
176
* $Log: not supported by cvs2svn $
184
*
177
* Revision 1.6  2006/04/28 12:41:49  florian
185
* Revision 1.6  2006/04/28 12:41:49  florian
178
* corrections erreurs chemin
186
* corrections erreurs chemin
179
*
187
*
180
* Revision 1.5  2005/09/20 17:01:22  ddelon
188
* Revision 1.5  2005/09/20 17:01:22  ddelon