Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 2103 → Rev 2104

/trunk/papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_spip_article.class.php
96,7 → 96,7
if ($aso_resultat['poids'] > 0) {
// Création de l'url
$aso_resultat['url_simple'] = $url_base.'article'.$article_id.'.html';
$aso_resultat['url'] = $aso_resultat['url_simple'].'?var_recherche='.$this->traiterMotif($motif, 'url');
$aso_resultat['url'] = $aso_resultat['url_simple'].'?var_recherche='.More_Recherche::traiterMotif($motif, 'url');
// Récupération du titre de la page
if (trim($Article->titre) != '') {
108,7 → 108,7
}
$aso_resultat['hreflang'] = htmlentities($Article->lang);
$aso_resultat['description'] = $this->couperTexte($Article->texte, MORE_RESULTAT_TAILLE_DESCRIPTION);
$aso_resultat['description'] = More_Recherche::couperTexte($Article->texte, MORE_RESULTAT_TAILLE_DESCRIPTION);
if (($jour = date('d', strtotime($Article->date)) ) != 0 ) {
$aso_resultat['date_creation'] .= '<span class="page_modification_jour"> '.$jour.'</span>'."\n";
/trunk/papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_bazar.class.php
90,7 → 90,7
$aso_ligne['url'] = sprintf($bazar['url'],$ligne['bf_id_fiche']);
$aso_ligne['url_simple'] = $aso_ligne['url'] ;
$aso_ligne['titre'] = htmlentities($ligne['bf_titre']);
$aso_ligne['description'] = htmlentities($this->couperTexte($ligne['bf_description'], MORE_RESULTAT_TAILLE_DESCRIPTION));
$aso_ligne['description'] = htmlentities(More_Recherche::couperTexte($ligne['bf_description'], MORE_RESULTAT_TAILLE_DESCRIPTION));
$aso_resultat[] = $aso_ligne;
}
}
/trunk/papyrus/applettes/moteur_recherche/bibliotheque/more_recherche.class.php
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
/trunk/papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_papyrus_menu.class.php
106,7 → 106,7
$une_url =& new Pap_URL(PAP_URL);
$une_url->setId($menu_id);
$aso_resultat['url_simple'] = $une_url->getURL();
$une_url->addQueryString('var_recherche', $this->traiterMotif($motif, 'url'), true);
$une_url->addQueryString('var_recherche', More_Recherche::traiterMotif($motif, 'url'), true);
$aso_resultat['url'] = $une_url->getURL();
$une_url->removeQueryString('var_recherche');