From e9293cda71761c5f8e6b2a59794dd35ca904dade Mon Sep 17 00:00:00 2001
From: James <james@rezo.net>
Date: Tue, 4 Sep 2007 23:01:33 +0000
Subject: [PATCH] =?UTF-8?q?uniformiser=20la=20surcharge=20de=20certains=20?=
 =?UTF-8?q?filtres=20(introduction,=20pagination=20...)=20normalement,=20?=
 =?UTF-8?q?=C3=A7a=20ne=20casse=20rien=20:)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 dist/modeles/pagination.html                  |  4 ++--
 dist/modeles/pagination_page.html             |  2 +-
 .../pagination_page_precedent_suivant.html    |  2 +-
 .../modeles/pagination_precedent_suivant.html |  2 +-
 ecrire/inc/filtres.php                        | 19 +++----------------
 ecrire/public/balises.php                     |  9 ++++++---
 ecrire/public/composer.php                    |  6 +-----
 7 files changed, 15 insertions(+), 29 deletions(-)

diff --git a/dist/modeles/pagination.html b/dist/modeles/pagination.html
index 1b283be6c1..c96500a237 100644
--- a/dist/modeles/pagination.html
+++ b/dist/modeles/pagination.html
@@ -1,5 +1,5 @@
-#ENV*{bloc_ancre}
-#SET{bornes,#ENV{page_courante}|calcul_bornes_pagination{#ENV{nombre_pages},10}}
+#ENV*{bloc_ancrebornes_pagination}
+#SET{bornes,#ENV{page_courante}|bornes_pagination{#ENV{nombre_pages},10}}
 #SET{premiere, #GET{bornes}|reset}
 #SET{derniere, #GET{bornes}|end}
 #SET{separateur,'|'}
diff --git a/dist/modeles/pagination_page.html b/dist/modeles/pagination_page.html
index 44e8f00b44..09a43e449f 100644
--- a/dist/modeles/pagination_page.html
+++ b/dist/modeles/pagination_page.html
@@ -1,5 +1,5 @@
 #ENV*{bloc_ancre}
-#SET{bornes,#ENV{page_courante}|calcul_bornes_pagination{#ENV{nombre_pages},10}}
+#SET{bornes,#ENV{page_courante}|bornes_pagination{#ENV{nombre_pages},10}}
 #SET{premiere, #GET{bornes}|reset}
 #SET{derniere, #GET{bornes}|end}
 #SET{separateur,'|'}
diff --git a/dist/modeles/pagination_page_precedent_suivant.html b/dist/modeles/pagination_page_precedent_suivant.html
index b72124d7f4..be7e3260e5 100644
--- a/dist/modeles/pagination_page_precedent_suivant.html
+++ b/dist/modeles/pagination_page_precedent_suivant.html
@@ -1,5 +1,5 @@
 #ENV*{bloc_ancre}
-#SET{bornes,#ENV{page_courante}|calcul_bornes_pagination{#ENV{nombre_pages},10}}
+#SET{bornes,#ENV{page_courante}|bornes_pagination{#ENV{nombre_pages},10}}
 #SET{premiere, #GET{bornes}|reset}
 #SET{derniere, #GET{bornes}|end}
 #SET{separateur,'|'}
diff --git a/dist/modeles/pagination_precedent_suivant.html b/dist/modeles/pagination_precedent_suivant.html
index d2a76beea4..6a2f5a6bfa 100644
--- a/dist/modeles/pagination_precedent_suivant.html
+++ b/dist/modeles/pagination_precedent_suivant.html
@@ -1,5 +1,5 @@
 #ENV*{bloc_ancre}
-#SET{bornes,#ENV{page_courante}|calcul_bornes_pagination{#ENV{nombre_pages},10}}
+#SET{bornes,#ENV{page_courante}|bornes_pagination{#ENV{nombre_pages},10}}
 #SET{premiere, #GET{bornes}|reset}
 #SET{derniere, #GET{bornes}|end}
 #SET{separateur,'|'}
diff --git a/ecrire/inc/filtres.php b/ecrire/inc/filtres.php
index 8153facc57..9dd13ea6da 100644
--- a/ecrire/inc/filtres.php
+++ b/ecrire/inc/filtres.php
@@ -1665,11 +1665,7 @@ function form_hidden($action) {
 	return $hidden;
 }
 
-// http://doc.spip.org/@calcul_bornes_pagination
-function calcul_bornes_pagination($courante, $nombre, $max = 10) {
-	if (function_exists("bornes_pagination"))
-		return bornes_pagination($max, $nombre, $courante);
-
+function filtre_bornes_pagination_dist($courante, $nombre, $max = 10) {
 	if($max<=0 OR $max>=$nombre)
 		return array(1, $nombre);
 
@@ -1716,8 +1712,7 @@ function filtre_find($array, $val) {
 // function pagination($total, $nom, $pas, $liste) {...}
 //
 
-// http://doc.spip.org/@calcul_pagination
-function calcul_pagination($total, $nom, $position, $pas, $liste = true, $modele='', $connect='') {
+function filtre_pagination_dist($total, $nom, $position, $pas, $liste = true, $modele='', $connect='') {
 	static $ancres = array();
 	$bloc_ancre = "";
 	
@@ -1733,9 +1728,6 @@ function calcul_pagination($total, $nom, $position, $pas, $liste = true, $modele
 	if ($position === NULL)
 		$position = _request($debut);
 
-	if (function_exists("pagination"))
-		return pagination($total, $nom, $position, $pas, $liste);
-
 	// n'afficher l'ancre qu'une fois
 	if (!isset($ancres[$ancre]))
 		$bloc_ancre = $ancres[$ancre] = "<a name='$ancre' id='$ancre'></a>";
@@ -2174,12 +2166,7 @@ function filtre_foreach_dist($balise_deserializee, $modele = 'foreach') {
 // la valeur du second parametre si celui-ci renvoie a une information connue
 // cf liste_plugin_actifs() pour connaitre les informations affichables
 // appelee par la balise #PLUGIN
-// http://doc.spip.org/@calcul_info_plugin
-function calcul_info_plugin($plugin, $type_info) {
-	//surcharge possible pour afficher des donnees plus complexes
-	if(function_exists('info_plugin'))
-		return info_plugin($plugin, $type_info);
-
+function filtre_info_plugin_dist($plugin, $type_info) {
 	include_spip('inc/plugin');
 	$plugin = strtoupper($plugin);
 	$plugins_actifs = liste_plugin_actifs();
diff --git a/ecrire/public/balises.php b/ecrire/public/balises.php
index 2bad7d9b32..d42991db34 100644
--- a/ecrire/public/balises.php
+++ b/ecrire/public/balises.php
@@ -472,7 +472,8 @@ function balise_INTRODUCTION_dist ($p) {
 	  $_chapo = "''";
 	  $_descriptif =  "''";
 	}
-	$p->code = "calcul_introduction('$type', $_texte, $_chapo, $_descriptif)";
+	$f = chercher_filtre('introduction');
+	$p->code = $f."('$type', $_texte, $_chapo, $_descriptif)";
 
 	#$p->interdire_scripts = true;
 	return $p;
@@ -605,7 +606,8 @@ function balise_PAGINATION_dist($p, $liste='true') {
 
 	$p->boucles[$b]->numrows = true;
 	$connect = $p->boucles[$b]->sql_serveur;
-	$p->code = "calcul_pagination(
+	$f_pagination = chercher_filtre('pagination');
+	$p->code = $f_pagination."(
 	(isset(\$Numrows['$b']['grand_total']) ?
 		\$Numrows['$b']['grand_total'] : \$Numrows['$b']['total']
 	), ".$p->boucles[$b]->modificateur['debut_nom'].",
@@ -1433,7 +1435,8 @@ function balise_PLUGIN_dist($p) {
 	$type_info = interprete_argument_balise(2,$p);
 	$type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"';
 
-	$p->code = 'calcul_info_plugin('.$plugin.', '.$type_info.')';
+	$f = chercher_filtre('info_plugin');
+	$p->code = $f.'('.$plugin.', '.$type_info.')';
 	return $p;
 }
 
diff --git a/ecrire/public/composer.php b/ecrire/public/composer.php
index 86986cf630..efce56381a 100644
--- a/ecrire/public/composer.php
+++ b/ecrire/public/composer.php
@@ -180,11 +180,7 @@ function calcule_logo($type, $onoff, $id, $id_rubrique, $flag_fichier) {
 // on peut la surcharger en definissant dans mes_fonctions :
 // function introduction($type,$texte,$chapo,$descriptif) {...}
 //
-// http://doc.spip.org/@calcul_introduction
-function calcul_introduction ($type, $texte, $chapo='', $descriptif='') {
-	if (function_exists("introduction"))
-		return introduction ($type, $texte, $chapo, $descriptif);
-
+function filtre_introduction_dist($type, $texte, $chapo='', $descriptif='') {
 	define('_INTRODUCTION_SUITE', '&nbsp;(...)');
 
 	switch ($type) {
-- 
GitLab