Re: Désactiver le filtre liens_nofollow

eric <[email protected]>
Newsgroups gmane.comp.web.spip.devel
Message-ID <[email protected]>
Bonjour,

En modifiant le filtre liens_nofollow dans /ecrire/inc/filtres.php
ainsi :

--
function liens_nofollow($texte) {
	- if (stripos($texte, "<a") === false) {

	+if (stripos($texte, "<a") === false) ||
$GLOBALS['no_nofollow'] === true) {
		return $texte;
	}

	if (preg_match_all(",<a\b[^>]*>,UimsS", $texte, $regs,
PREG_PATTERN_ORDER)) {
		foreach ($regs[0] as $a) {
			$rel = extraire_attribut($a, "rel");
			if (strpos($rel, "nofollow") === false) {
				$rel = "nofollow" . ($rel ? " $rel" :
"");
				$anofollow = inserer_attribut($a,
"rel", $rel);
				$texte = str_replace($a, $anofollow,
$texte);
			}
		}
	}

	return $texte;
}

et en ajoutant la ligne :

//ne pas ajouter de nofollow sur les liens sortants
$GLOBALS['no_nofollow'] = true;

à  mes_options.php

le filtre est désactivé.

Sauf pour le descriptif auteur.

1 - Y a t-il une meilleure méthode ?
2 - Une idée pour la présence de nofollow sur les liens inclus dans le
descriptif auteur ? (je cherche)
3 - cela peut-il être ajouté au core SPIP ?

Cordialement,

Eric


Le vendredi 26 mai 2017 à 14:19 +0200, eric a écrit :
> Bonjour,
> 
> depuis https://core.spip.net/projects/spip/repository/revisions/20640
>  ,
> les liens sortants sont systématiquement en nofollow.
> 
> Comment désactiver ce filtre sans modifier le code SPIP ?
> 
> Cordialement,
> 
> Eric
> _______________________________________________
> liste: http://listes.rezo.net/mailman/listinfo/spip-dev
> doc: http://www.spip.net/
> dev: http://trac.rezo.net/trac/spip/
> irc://irc.freenode.net/spip
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.