From 71a1f63de1094a281a7219f8d54a7a9a85fcb34d Mon Sep 17 00:00:00 2001
From: "Committo,Ergo:sum" <esj@rezo.net>
Date: Sat, 15 May 2010 06:36:47 +0000
Subject: [PATCH] =?UTF-8?q?Fin=20de=20l'abstraction=20de=20l'appel=20?=
 =?UTF-8?q?=C3=A0=20CFG:=20la=20balise=20{{{config}}}=20de=20{{{plugin.xml?=
 =?UTF-8?q?}}}=20donne=20finalement=20une=20fonction=20retournant=20un=20g?=
 =?UTF-8?q?roupe=20de=20liens=20(un=20seul=20en=20g=C3=A9n=C3=A9ral)=20qui?=
 =?UTF-8?q?=20renvoie=20sur=20les=20scripts=20d'installation.=20Cette=20fo?=
 =?UTF-8?q?nction=20doit=20=C3=AAtre=20pr=C3=A9sente=20dans=20les=20fichie?=
 =?UTF-8?q?rs=20indiqu=C3=A9s=20par=20la=20balise=20{{{install}}}.=20Par?=
 =?UTF-8?q?=20d=C3=A9faut=20cette=20fonction=20est=20celle=20chargeant=20C?=
 =?UTF-8?q?FG=20et=20utilise=20{{{icone=5Flien=5Fcfg}}}.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitattributes                     |   1 +
 ecrire/inc/plugin.php              |  16 ++++++++--------
 ecrire/plugins/afficher_plugin.php |   7 ++++---
 prive/images/cfg-16.png            | Bin 0 -> 611 bytes
 4 files changed, 13 insertions(+), 11 deletions(-)
 create mode 100755 prive/images/cfg-16.png

diff --git a/.gitattributes b/.gitattributes
index e73c527b5e..078f3d6f21 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -510,6 +510,7 @@ prive/images/cal-semaine.gif -text
 prive/images/cal-suivi.png -text
 prive/images/cal-today.gif -text
 prive/images/calendrier-24.gif -text
+prive/images/cfg-16.png -text
 prive/images/chemin-fond-left.gif -text
 prive/images/chemin-fond-right.gif -text
 prive/images/choix-layout.gif -text
diff --git a/ecrire/inc/plugin.php b/ecrire/inc/plugin.php
index 92b14676f5..19ffdb080f 100644
--- a/ecrire/inc/plugin.php
+++ b/ecrire/inc/plugin.php
@@ -606,12 +606,7 @@ function spip_plugin_install($action, $infos){
 // http://doc.spip.org/@desinstalle_un_plugin
 function desinstalle_un_plugin($plug,$infos){
 	// faire les include qui vont bien
-	foreach($infos['install'] as $file){
-		$file = trim($file);
-		if (file_exists($f = _ROOT_PLUGINS."$plug/$file")){
-			include_once($f);
-		}
-	}
+	charge_instal_plugin($plug, $infos, $dir_plugins);
 	$version_cible = isset($infos['version_base'])?$infos['version_base']:'';
 	$prefix_install = $infos['prefix']."_install";
 	if (function_exists($prefix_install)){
@@ -628,8 +623,7 @@ function desinstalle_un_plugin($plug,$infos){
 	return false;
 }
 
-// http://doc.spip.org/@installe_un_plugin
-function installe_un_plugin($plug,$infos,$dir_plugins = '_DIR_PLUGINS'){
+function charge_instal_plugin($plug,$infos,$dir_plugins = '_DIR_PLUGINS'){
 	// passer en chemin absolu si possible
 	$dir = str_replace('_DIR_','_ROOT_',$dir_plugins);
 	if (!defined($dir))
@@ -642,6 +636,12 @@ function installe_un_plugin($plug,$infos,$dir_plugins = '_DIR_PLUGINS'){
 			include_once($f);
 		}
 	}
+}
+
+function installe_un_plugin($plug,$infos,$dir_plugins = '_DIR_PLUGINS'){
+
+	charge_instal_plugin($plug, $infos, $dir_plugins);
+
 	$version_cible = isset($infos['version_base'])?$infos['version_base']:'';
 	$prefix_install = $infos['prefix']."_install";
 	// cas de la fonction install fournie par le plugin
diff --git a/ecrire/plugins/afficher_plugin.php b/ecrire/plugins/afficher_plugin.php
index a2831fcbb0..68ae4b1132 100644
--- a/ecrire/plugins/afficher_plugin.php
+++ b/ecrire/plugins/afficher_plugin.php
@@ -13,6 +13,7 @@
 if (!defined("_ECRIRE_INC_VERSION")) return;
 include_spip('inc/charsets');
 include_spip('inc/texte');
+include_spip('inc/plugin'); // pour charge_instal_plugin
 
 // http://doc.spip.org/@ligne_plug
 function plugins_afficher_plugin_dist($url_page, $plug_file, $actif, $expose=false, $class_li="item", $dir_plugins=_DIR_PLUGINS) {
@@ -24,11 +25,11 @@ function plugins_afficher_plugin_dist($url_page, $plug_file, $actif, $expose=fal
 	$get_infos = charger_fonction('get_infos','plugins');
 	$info = $get_infos($plug_file, $force_reload, $dir_plugins);
 	$prefix = $info['prefix'];
-	$config = !empty($info['config']) ? $info['config'] : 'cfg';
+	$config = !empty($info['config']) ? $info['config'] : 'plugin_bouton_cfg';
 	$erreur = (!isset($info['erreur']) ? ''
 	: ("<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>"));
 
-	$cfg = !$actif ? '' : plugin_bouton_cfg($dir_plugins.$plug_file, $config);
+	$cfg = !$actif ? '' : $config($dir_plugins.$plug_file);
 
 	// numerotons les occurrences d'un meme prefix
 	$versions[$prefix] = $id = isset($versions[$prefix]) ? $versions[$prefix] + 1 : '';
@@ -49,7 +50,7 @@ function plugins_afficher_plugin_dist($url_page, $plug_file, $actif, $expose=fal
 	."</li>";
 }
 
-function plugin_bouton_cfg($file, $cfg)
+function plugin_bouton_cfg($file, $cfg='cfg')
 {
 	if  (defined('_DIR_PLUGIN_CFG')) {
 		if (include_spip('inc/cfg')) // test CFG version >= 1.0.5
diff --git a/prive/images/cfg-16.png b/prive/images/cfg-16.png
new file mode 100755
index 0000000000000000000000000000000000000000..9460dfc746be14e4b2a6a94f91d002fa4a56318f
GIT binary patch
literal 611
zcmV-p0-XJcP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00006VoOIv0RI60
z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru)d?C56FG}x!bkuB0q{vg
zK~y-)rIJf%6JZpEznS<<icJ&>f=aN=#)Y=sMXW9~6k=xULU18eq^Pwm5>f&c14BZf
zYe95nK#JnRiH*==SAx<uiAfg~f>mkLmxdrjL^?BWW`;2x>%z19x#ygF@3}wxCj{ps
zol&BI3dr$TBKH?fG@Vgwj@VLE`>*x`sHT~#`1-X0&1|$C>5O7D8g(O`Q4IH5!>UCA
z#B@f9T4bxM*W2c190hpr@ILWaLI!dGBA^c595S9hn=k<N_N@^%*Vm9bCF=FB_gb@w
z-5C`uF@RtdZww3?nzkkAx^C#YMqz$VD7-HM$U6lqv~;i$>AOg|QenCF1t1xZCGP(7
zj844Dzcfmf65S_zD3%MD6HEfSt3fc5It<jT_mz-N*9nQEM~=~KHhDMq7PmD#PVx9~
zn7&Xa9RV-dnN5zje@iZXUOLx(s)v9-z)EfT@`dpE`RS?GRloocgOOAhP<u2cGh1F{
zw!BEkK_39--f}Mg0!flMd%D;9WOg1RP#hl)Gxes#mZl@_^RrQJ+9R4H%h@N7IneIs
zOsE%N%xM6??p+@C_zv;&$1k$^1%Pm?NiMHa{aF1YY!P5(<2(C(0owL@cs}z1ApB`^
xblOQYO_FQts|!HVzCtjPx&%x(xZA`#;Wszp)%NPVRJ;HH002ovPDHLkV1mE{2~q$6

literal 0
HcmV?d00001

-- 
GitLab