139,13 → 139,13 |
{ |
$nbre_correspondance = 0; |
$nbre_correspondance_total = 0; |
$motif = $this->traiterMotif($motif, 'simple'); |
$motif = self::traiterMotif($motif, 'simple'); |
// Si demande de recherche d'expression complète |
if (preg_match('/^".+"$/', $motif)) { |
$mode = 2; |
|
} |
$motif = $this->traiterMotif($motif, 'recherche'); |
$motif = self::traiterMotif($motif, 'recherche'); |
switch ($mode) { |
case '1' : |
// Découpage en mot |
177,7 → 177,7 |
} |
} |
|
function traiterMotif($motif, $type = 0) |
static function traiterMotif($motif, $type = 0) |
{ |
switch ($type) { |
case 'simple' : |
200,7 → 200,7 |
return $motif; |
} |
} |
|
|
function traduireMois($mois_numerique) |
{ |
switch ($mois_numerique) { |
239,7 → 239,7 |
* @param String texte à couper |
* @param int taille maximum du texte |
*/ |
function couperTexte($texte, $taille = 50) |
static function couperTexte($texte, $taille = 50) |
{ |
$texte = substr($texte, 0, 400 + 2*$taille); /* eviter de travailler sur 10ko pour extraire 150 caracteres */ |
|
255,7 → 255,7 |
$texte = ereg_replace("(^|\r|\n)(-[-#\*]*|_ )", "\r", $texte); |
|
// supprimer les tags |
$texte = $this->supprimerTags($texte); |
$texte = self::supprimerTags($texte); |
$texte = trim(str_replace("\n"," ", $texte)); |
$texte .= "\n"; // marquer la fin |
|
277,7 → 277,7 |
$texte = ereg_replace("(^|\r)\|.*\|\r", "\r", $texte); |
|
// couper au mot precedent |
$long = $this->gererSubstr($texte, 0, max($taille-4,1)); |
$long = self::gererSubstr($texte, 0, max($taille-4,1)); |
$court = ereg_replace("([^[:space:]][[:space:]]+)[^[:space:]]*\n?$", "\\1", $long); |
$points = MORE_LG_RESULTAT_ETC; |
|
284,7 → 284,7 |
// trop court ? ne pas faire de (...) |
if (strlen($court) < max(0.75 * $taille,2)) { |
$points = ''; |
$long = $this->gererSubstr($texte, 0, $taille); |
$long = self::gererSubstr($texte, 0, $taille); |
$texte = ereg_replace("([^[:space:]][[:space:]]+)[^[:space:]]*$", "\\1", $long); |
// encore trop court ? couper au caractere |
if (strlen($texte) < 0.75 * $taille) |
306,7 → 306,7 |
|
// Gerer les outils mb_string |
// Fichier : inc_texte.php3 |
function gererSubstr($c, $start=0, $end='') |
static function gererSubstr($c, $start=0, $end='') |
{ |
// methode substr normale |
if ($end) { |
318,7 → 318,7 |
|
// Suppression basique et brutale de tous les <...> |
// Fichier : inc_filtres.php3 |
function supprimerTags($texte, $rempl = "") |
static function supprimerTags($texte, $rempl = "") |
{ |
$texte = preg_replace(",<[^>]*>,U", $rempl, $texte); |
// ne pas oublier un < final non ferme |