Completed
Push — master ( da491f...cb557d )
by cam
05:25
created
ecrire/inc/bandeau.php 1 patch
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 include_spip('inc/boutons');
@@ -37,33 +37,33 @@  discard block
 block discarded – undo
37 37
  *     Contexte
38 38
  **/
39 39
 function definir_barre_contexte($contexte = null) {
40
-	if (is_null($contexte)) {
41
-		$contexte = $_GET;
42
-	} elseif (is_string($contexte)) {
43
-		$contexte = unserialize($contexte);
44
-	}
45
-	if (!isset($contexte['id_rubrique']) and isset($contexte['exec'])) {
46
-		if (!function_exists('trouver_objet_exec')) {
47
-			include_spip('inc/pipelines_ecrire');
48
-		}
49
-		if ($e = trouver_objet_exec($contexte['exec'])) {
50
-			$_id = $e['id_table_objet'];
51
-			if (isset($contexte[$_id]) and $id = intval($contexte[$_id])) {
52
-				$table = $e['table_objet_sql'];
53
-				$row = sql_fetsel('*', $table, "$_id=" . intval($id));
54
-				if (isset($row['id_rubrique'])) {
55
-					$contexte['id_rubrique'] = $row['id_rubrique'];
56
-					if (isset($row['id_secteur'])) {
57
-						$contexte['id_secteur'] = $row['id_secteur'];
58
-					}
59
-				} elseif (isset($row['id_groupe'])) {
60
-					// TODO supprimer ce bloc quand https://core.spip.net/issues/3844 sera réalisé
61
-					$contexte['id_groupe'] = $row['id_groupe'];
62
-				}
63
-			}
64
-		}
65
-	}
66
-	return $contexte;
40
+    if (is_null($contexte)) {
41
+        $contexte = $_GET;
42
+    } elseif (is_string($contexte)) {
43
+        $contexte = unserialize($contexte);
44
+    }
45
+    if (!isset($contexte['id_rubrique']) and isset($contexte['exec'])) {
46
+        if (!function_exists('trouver_objet_exec')) {
47
+            include_spip('inc/pipelines_ecrire');
48
+        }
49
+        if ($e = trouver_objet_exec($contexte['exec'])) {
50
+            $_id = $e['id_table_objet'];
51
+            if (isset($contexte[$_id]) and $id = intval($contexte[$_id])) {
52
+                $table = $e['table_objet_sql'];
53
+                $row = sql_fetsel('*', $table, "$_id=" . intval($id));
54
+                if (isset($row['id_rubrique'])) {
55
+                    $contexte['id_rubrique'] = $row['id_rubrique'];
56
+                    if (isset($row['id_secteur'])) {
57
+                        $contexte['id_secteur'] = $row['id_secteur'];
58
+                    }
59
+                } elseif (isset($row['id_groupe'])) {
60
+                    // TODO supprimer ce bloc quand https://core.spip.net/issues/3844 sera réalisé
61
+                    $contexte['id_groupe'] = $row['id_groupe'];
62
+                }
63
+            }
64
+        }
65
+    }
66
+    return $contexte;
67 67
 }
68 68
 
69 69
 /**
@@ -79,88 +79,88 @@  discard block
 block discarded – undo
79 79
  * @return array
80 80
  */
81 81
 function definir_barre_boutons($contexte = array(), $icones = true, $autorise = true) {
82
-	include_spip('inc/autoriser');
83
-	$boutons_admin = array();
82
+    include_spip('inc/autoriser');
83
+    $boutons_admin = array();
84 84
 
85
-	// les boutons du core, issus de ecrire/paquet.xml
86
-	$liste_boutons = array();
85
+    // les boutons du core, issus de ecrire/paquet.xml
86
+    $liste_boutons = array();
87 87
 
88
-	// ajouter les boutons issus des plugin via paquet.xml
89
-	if (function_exists('boutons_plugins')
90
-		and is_array($liste_boutons_plugins = boutons_plugins())
91
-	) {
92
-		$liste_boutons = &$liste_boutons_plugins;
93
-	}
88
+    // ajouter les boutons issus des plugin via paquet.xml
89
+    if (function_exists('boutons_plugins')
90
+        and is_array($liste_boutons_plugins = boutons_plugins())
91
+    ) {
92
+        $liste_boutons = &$liste_boutons_plugins;
93
+    }
94 94
 
95
-	foreach ($liste_boutons as $id => $infos) {
96
-		$parent = '';
97
-		// les boutons principaux ne sont pas soumis a autorisation
98
-		if (!isset($infos['parent'])
99
-			or !($parent = $infos['parent'])
100
-			or !$autorise
101
-			or autoriser('menu', "_$id", 0, null, array('contexte' => $contexte))
102
-		) {
103
-			if ($parent
104
-				and $parent = preg_replace(',^bando_,', 'menu_', $parent)
105
-				and isset($boutons_admin[$parent])
106
-			) {
107
-				if (!is_array($boutons_admin[$parent]->sousmenu)) {
108
-					$boutons_admin[$parent]->sousmenu = array();
109
-				}
110
-				$position = (isset($infos['position']) and strlen($infos['position'])) ? intval($infos['position']) : count($boutons_admin[$parent]->sousmenu);
111
-				if ($position < 0) {
112
-					$position = count($boutons_admin[$parent]->sousmenu) + 1 + $position;
113
-				}
114
-				$boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position)
115
-					+ array(
116
-						$id => new Bouton(
117
-							($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '',  // icone
118
-							$infos['titre'],  // titre
119
-							(isset($infos['action']) and $infos['action']) ? $infos['action'] : null,
120
-							(isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null
121
-						)
122
-					)
123
-					+ array_slice($boutons_admin[$parent]->sousmenu, $position, 100);
124
-			}
125
-			if (!$parent
126
-				// provisoire, eviter les vieux boutons
127
-				and (!in_array($id, array('forum', 'statistiques_visites')))
128
-				and (!$autorise or autoriser('menugrandeentree', "_$id", 0, null, array('contexte' => $contexte)))
129
-			) {
130
-				$position = (isset($infos['position']) and $infos['position']) ? $infos['position'] : count($boutons_admin);
131
-				$boutons_admin = array_slice($boutons_admin, 0, $position)
132
-					+ array(
133
-						$id => new Bouton(
134
-							($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '',  // icone
135
-							$infos['titre'],  // titre
136
-							(isset($infos['action']) and $infos['action']) ? $infos['action'] : null,
137
-							(isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null
138
-						)
139
-					)
140
-					+ array_slice($boutons_admin, $position, 100);
141
-			}
142
-		}
143
-	}
144
-	$boutons_admin = pipeline('ajouter_menus', $boutons_admin);
95
+    foreach ($liste_boutons as $id => $infos) {
96
+        $parent = '';
97
+        // les boutons principaux ne sont pas soumis a autorisation
98
+        if (!isset($infos['parent'])
99
+            or !($parent = $infos['parent'])
100
+            or !$autorise
101
+            or autoriser('menu', "_$id", 0, null, array('contexte' => $contexte))
102
+        ) {
103
+            if ($parent
104
+                and $parent = preg_replace(',^bando_,', 'menu_', $parent)
105
+                and isset($boutons_admin[$parent])
106
+            ) {
107
+                if (!is_array($boutons_admin[$parent]->sousmenu)) {
108
+                    $boutons_admin[$parent]->sousmenu = array();
109
+                }
110
+                $position = (isset($infos['position']) and strlen($infos['position'])) ? intval($infos['position']) : count($boutons_admin[$parent]->sousmenu);
111
+                if ($position < 0) {
112
+                    $position = count($boutons_admin[$parent]->sousmenu) + 1 + $position;
113
+                }
114
+                $boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position)
115
+                    + array(
116
+                        $id => new Bouton(
117
+                            ($icones and !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '',  // icone
118
+                            $infos['titre'],  // titre
119
+                            (isset($infos['action']) and $infos['action']) ? $infos['action'] : null,
120
+                            (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null
121
+                        )
122
+                    )
123
+                    + array_slice($boutons_admin[$parent]->sousmenu, $position, 100);
124
+            }
125
+            if (!$parent
126
+                // provisoire, eviter les vieux boutons
127
+                and (!in_array($id, array('forum', 'statistiques_visites')))
128
+                and (!$autorise or autoriser('menugrandeentree', "_$id", 0, null, array('contexte' => $contexte)))
129
+            ) {
130
+                $position = (isset($infos['position']) and $infos['position']) ? $infos['position'] : count($boutons_admin);
131
+                $boutons_admin = array_slice($boutons_admin, 0, $position)
132
+                    + array(
133
+                        $id => new Bouton(
134
+                            ($icones and isset($infos['icone']) and $infos['icone']) ? find_in_theme($infos['icone']) : '',  // icone
135
+                            $infos['titre'],  // titre
136
+                            (isset($infos['action']) and $infos['action']) ? $infos['action'] : null,
137
+                            (isset($infos['parametres']) and $infos['parametres']) ? $infos['parametres'] : null
138
+                        )
139
+                    )
140
+                    + array_slice($boutons_admin, $position, 100);
141
+            }
142
+        }
143
+    }
144
+    $boutons_admin = pipeline('ajouter_menus', $boutons_admin);
145 145
 
146
-	// définir les favoris et positions d’origine
147
-	if ($boutons_admin) {
148
-		$menus_favoris = obtenir_menus_favoris();
149
-		$i = 1;
150
-		foreach ($boutons_admin as $key => $menu) {
151
-			$menu->favori = table_valeur($menus_favoris, $key, false);
152
-			$menu->position = $i++;
153
-			if ($menu->sousmenu) {
154
-				$j = 1;
155
-				foreach ($menu->sousmenu as $key => $bouton) {
156
-					$bouton->favori = table_valeur($menus_favoris, $key, false);
157
-					$bouton->position = $j++;
158
-				}
159
-			}
160
-		}
161
-	}
146
+    // définir les favoris et positions d’origine
147
+    if ($boutons_admin) {
148
+        $menus_favoris = obtenir_menus_favoris();
149
+        $i = 1;
150
+        foreach ($boutons_admin as $key => $menu) {
151
+            $menu->favori = table_valeur($menus_favoris, $key, false);
152
+            $menu->position = $i++;
153
+            if ($menu->sousmenu) {
154
+                $j = 1;
155
+                foreach ($menu->sousmenu as $key => $bouton) {
156
+                    $bouton->favori = table_valeur($menus_favoris, $key, false);
157
+                    $bouton->position = $j++;
158
+                }
159
+            }
160
+        }
161
+    }
162 162
 
163
-	return $boutons_admin;
163
+    return $boutons_admin;
164 164
 }
165 165
 
166 166
 /**
@@ -172,22 +172,22 @@  discard block
 block discarded – undo
172 172
  * @return Bouton[]
173 173
  */
174 174
 function trier_boutons_enfants_par_alpha($menus, $avec_favoris = false) {
175
-	foreach ($menus as $menu) {
176
-		if ($menu->sousmenu) {
177
-			$libelles = $isfavoris = $favoris = array();
178
-			foreach ($menu->sousmenu as $key => $item) {
179
-				$libelles[$key] = strtolower(translitteration(_T($item->libelle)));
180
-				$isfavoris[$key] = (bool)$item->favori;
181
-				$favoris[$key] = $item->favori;
182
-			}
183
-			if ($avec_favoris) {
184
-				array_multisort($isfavoris, SORT_DESC, $favoris, SORT_ASC, $libelles, SORT_ASC, $menu->sousmenu);
185
-			} else {
186
-				array_multisort($libelles, SORT_ASC, $menu->sousmenu);
187
-			}
188
-		}
189
-	}
190
-	return $menus;
175
+    foreach ($menus as $menu) {
176
+        if ($menu->sousmenu) {
177
+            $libelles = $isfavoris = $favoris = array();
178
+            foreach ($menu->sousmenu as $key => $item) {
179
+                $libelles[$key] = strtolower(translitteration(_T($item->libelle)));
180
+                $isfavoris[$key] = (bool)$item->favori;
181
+                $favoris[$key] = $item->favori;
182
+            }
183
+            if ($avec_favoris) {
184
+                array_multisort($isfavoris, SORT_DESC, $favoris, SORT_ASC, $libelles, SORT_ASC, $menu->sousmenu);
185
+            } else {
186
+                array_multisort($libelles, SORT_ASC, $menu->sousmenu);
187
+            }
188
+        }
189
+    }
190
+    return $menus;
191 191
 }
192 192
 
193 193
 /**
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
  * @return Bouton[]
199 199
  */
200 200
 function trier_boutons_enfants_par_favoris_alpha($menus) {
201
-	return trier_boutons_enfants_par_alpha($menus, true);
201
+    return trier_boutons_enfants_par_alpha($menus, true);
202 202
 }
203 203
 
204 204
 
@@ -211,23 +211,23 @@  discard block
 block discarded – undo
211 211
  * @return string
212 212
  */
213 213
 function bandeau_creer_url($url, $args = '', $contexte = null) {
214
-	if (!preg_match(',[\/\?],', $url)) {
215
-		$url = generer_url_ecrire($url, $args, true);
216
-		// recuperer les parametres du contexte demande par l'url sous la forme
217
-		// &truc=@machin@
218
-		// @machin@ etant remplace par _request('machin')
219
-		$url = str_replace('&amp;', '&', $url);
220
-		while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) {
221
-			if ($matches[2] == 'id_secteur' and !isset($contexte['id_secteur']) and isset($contexte['id_rubrique'])) {
222
-				$contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($contexte['id_rubrique']));
223
-			}
224
-			$val = _request($matches[2], $contexte);
225
-			$url = parametre_url($url, $matches[1], $val ? $val : '', '&');
226
-		}
227
-		$url = str_replace('&', '&amp;', $url);
228
-	}
214
+    if (!preg_match(',[\/\?],', $url)) {
215
+        $url = generer_url_ecrire($url, $args, true);
216
+        // recuperer les parametres du contexte demande par l'url sous la forme
217
+        // &truc=@machin@
218
+        // @machin@ etant remplace par _request('machin')
219
+        $url = str_replace('&amp;', '&', $url);
220
+        while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) {
221
+            if ($matches[2] == 'id_secteur' and !isset($contexte['id_secteur']) and isset($contexte['id_rubrique'])) {
222
+                $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($contexte['id_rubrique']));
223
+            }
224
+            $val = _request($matches[2], $contexte);
225
+            $url = parametre_url($url, $matches[1], $val ? $val : '', '&');
226
+        }
227
+        $url = str_replace('&', '&amp;', $url);
228
+    }
229 229
 
230
-	return $url;
230
+    return $url;
231 231
 }
232 232
 
233 233
 /**
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
  *     Code HTML du bandeau
238 238
  */
239 239
 function inc_bandeau_dist() {
240
-	return recuperer_fond('prive/squelettes/inclure/barre-nav', $_GET);
240
+    return recuperer_fond('prive/squelettes/inclure/barre-nav', $_GET);
241 241
 }
242 242
 
243 243
 
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
  * @return array
247 247
  */
248 248
 function obtenir_menus_favoris() {
249
-	if (
250
-		isset($GLOBALS['visiteur_session']['prefs']['menus_favoris'])
251
-		and is_array($GLOBALS['visiteur_session']['prefs']['menus_favoris'])
252
-		and $GLOBALS['visiteur_session']['prefs']['menus_favoris']
253
-	) {
254
-		return $GLOBALS['visiteur_session']['prefs']['menus_favoris'];
255
-	}
256
-	$definir_menus_favoris = charger_fonction('definir_menus_favoris', 'inc');
257
-	return $definir_menus_favoris();
249
+    if (
250
+        isset($GLOBALS['visiteur_session']['prefs']['menus_favoris'])
251
+        and is_array($GLOBALS['visiteur_session']['prefs']['menus_favoris'])
252
+        and $GLOBALS['visiteur_session']['prefs']['menus_favoris']
253
+    ) {
254
+        return $GLOBALS['visiteur_session']['prefs']['menus_favoris'];
255
+    }
256
+    $definir_menus_favoris = charger_fonction('definir_menus_favoris', 'inc');
257
+    return $definir_menus_favoris();
258 258
 }
259 259
\ No newline at end of file
Please login to merge, or discard this patch.
ecrire/inc/plugin.php 1 patch
Indentation   +913 added lines, -913 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /** l'adresse du repertoire de telechargement et de decompactage des plugins */
24 24
 if (!defined('_DIR_PLUGINS_AUTO')) {
25
-	define('_DIR_PLUGINS_AUTO', _DIR_PLUGINS . 'auto/');
25
+    define('_DIR_PLUGINS_AUTO', _DIR_PLUGINS . 'auto/');
26 26
 }
27 27
 
28 28
 #include_spip('inc/texte'); // ????? Appelle public/parametrer trop tot avant la reconstruction du chemin des plugins.
@@ -47,26 +47,26 @@  discard block
 block discarded – undo
47 47
  * @return array
48 48
 **/
49 49
 function liste_plugin_files($dir_plugins = null) {
50
-	static $plugin_files = array();
51
-	if (is_null($dir_plugins)) {
52
-		$dir_plugins = _DIR_PLUGINS;
53
-	}
54
-	if (!isset($plugin_files[$dir_plugins])
55
-		or count($plugin_files[$dir_plugins]) == 0
56
-	) {
57
-		$plugin_files[$dir_plugins] = array();
58
-		foreach (fast_find_plugin_dirs($dir_plugins) as $plugin) {
59
-			$plugin_files[$dir_plugins][] = substr($plugin, strlen($dir_plugins));
60
-		}
61
-
62
-		sort($plugin_files[$dir_plugins]);
63
-		// et on lit le XML de tous les plugins pour le mettre en cache
64
-		// et en profiter pour nettoyer ceux qui n'existent plus du cache
65
-		$get_infos = charger_fonction('get_infos', 'plugins');
66
-		$get_infos($plugin_files[$dir_plugins], false, $dir_plugins, true);
67
-	}
68
-
69
-	return $plugin_files[$dir_plugins];
50
+    static $plugin_files = array();
51
+    if (is_null($dir_plugins)) {
52
+        $dir_plugins = _DIR_PLUGINS;
53
+    }
54
+    if (!isset($plugin_files[$dir_plugins])
55
+        or count($plugin_files[$dir_plugins]) == 0
56
+    ) {
57
+        $plugin_files[$dir_plugins] = array();
58
+        foreach (fast_find_plugin_dirs($dir_plugins) as $plugin) {
59
+            $plugin_files[$dir_plugins][] = substr($plugin, strlen($dir_plugins));
60
+        }
61
+
62
+        sort($plugin_files[$dir_plugins]);
63
+        // et on lit le XML de tous les plugins pour le mettre en cache
64
+        // et en profiter pour nettoyer ceux qui n'existent plus du cache
65
+        $get_infos = charger_fonction('get_infos', 'plugins');
66
+        $get_infos($plugin_files[$dir_plugins], false, $dir_plugins, true);
67
+    }
68
+
69
+    return $plugin_files[$dir_plugins];
70 70
 }
71 71
 
72 72
 /**
@@ -82,44 +82,44 @@  discard block
 block discarded – undo
82 82
  *     Liste complète des répeertoires
83 83
 **/
84 84
 function fast_find_plugin_dirs($dir, $max_prof = 100) {
85
-	$fichiers = array();
86
-	// revenir au repertoire racine si on a recu dossier/truc
87
-	// pour regarder dossier/truc/ ne pas oublier le / final
88
-	$dir = preg_replace(',/[^/]*$,', '', $dir);
89
-	if ($dir == '') {
90
-		$dir = '.';
91
-	}
92
-
93
-	if (!is_dir($dir)) {
94
-		return $fichiers;
95
-	}
96
-	if (is_plugin_dir($dir, '')) {
97
-		$fichiers[] = $dir;
98
-
99
-		return $fichiers;
100
-	}
101
-	if ($max_prof <= 0) {
102
-		return $fichiers;
103
-	}
104
-
105
-	$subdirs = array();
106
-	if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
107
-		while (($f = readdir($d)) !== false) {
108
-			if ($f[0] != '.' # ignorer . .. .svn etc
109
-				and $f != 'CVS'
110
-				and is_dir($f = "$dir/$f")
111
-			) {
112
-				$subdirs[] = $f;
113
-			}
114
-		}
115
-		closedir($d);
116
-	}
117
-
118
-	foreach ($subdirs as $d) {
119
-		$fichiers = array_merge($fichiers, fast_find_plugin_dirs("$d/", $max_prof - 1));
120
-	}
121
-
122
-	return $fichiers;
85
+    $fichiers = array();
86
+    // revenir au repertoire racine si on a recu dossier/truc
87
+    // pour regarder dossier/truc/ ne pas oublier le / final
88
+    $dir = preg_replace(',/[^/]*$,', '', $dir);
89
+    if ($dir == '') {
90
+        $dir = '.';
91
+    }
92
+
93
+    if (!is_dir($dir)) {
94
+        return $fichiers;
95
+    }
96
+    if (is_plugin_dir($dir, '')) {
97
+        $fichiers[] = $dir;
98
+
99
+        return $fichiers;
100
+    }
101
+    if ($max_prof <= 0) {
102
+        return $fichiers;
103
+    }
104
+
105
+    $subdirs = array();
106
+    if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
107
+        while (($f = readdir($d)) !== false) {
108
+            if ($f[0] != '.' # ignorer . .. .svn etc
109
+                and $f != 'CVS'
110
+                and is_dir($f = "$dir/$f")
111
+            ) {
112
+                $subdirs[] = $f;
113
+            }
114
+        }
115
+        closedir($d);
116
+    }
117
+
118
+    foreach ($subdirs as $d) {
119
+        $fichiers = array_merge($fichiers, fast_find_plugin_dirs("$d/", $max_prof - 1));
120
+    }
121
+
122
+    return $fichiers;
123 123
 }
124 124
 
125 125
 /**
@@ -140,27 +140,27 @@  discard block
 block discarded – undo
140 140
 **/
141 141
 function is_plugin_dir($dir, $dir_plugins = null) {
142 142
 
143
-	if (is_array($dir)) {
144
-		foreach ($dir as $k => $d) {
145
-			if (!is_plugin_dir($d, $dir_plugins)) {
146
-				unset($dir[$k]);
147
-			}
148
-		}
149
-
150
-		return $dir;
151
-	}
152
-	if (is_null($dir_plugins)) {
153
-		$dir_plugins = _DIR_PLUGINS;
154
-	}
155
-	$search = array("$dir_plugins$dir/paquet.xml");
156
-
157
-	foreach ($search as $s) {
158
-		if (file_exists($s)) {
159
-			return $dir;
160
-		}
161
-	}
162
-
163
-	return '';
143
+    if (is_array($dir)) {
144
+        foreach ($dir as $k => $d) {
145
+            if (!is_plugin_dir($d, $dir_plugins)) {
146
+                unset($dir[$k]);
147
+            }
148
+        }
149
+
150
+        return $dir;
151
+    }
152
+    if (is_null($dir_plugins)) {
153
+        $dir_plugins = _DIR_PLUGINS;
154
+    }
155
+    $search = array("$dir_plugins$dir/paquet.xml");
156
+
157
+    foreach ($search as $s) {
158
+        if (file_exists($s)) {
159
+            return $dir;
160
+        }
161
+    }
162
+
163
+    return '';
164 164
 }
165 165
 
166 166
 /** Regexp d'extraction des informations d'un intervalle de compatibilité */
@@ -187,51 +187,51 @@  discard block
 block discarded – undo
187 187
  **/
188 188
 function plugin_version_compatible($intervalle, $version, $avec_quoi = '') {
189 189
 
190
-	if (!strlen($intervalle)) {
191
-		return true;
192
-	}
193
-	if (!preg_match(_EXTRAIRE_INTERVALLE, $intervalle, $regs)) {
194
-		return false;
195
-	}
196
-	// Extraction des bornes et traitement de * pour la borne sup :
197
-	// -- on autorise uniquement les ecritures 3.0.*, 3.*
198
-	$minimum = $regs[1];
199
-	$maximum = $regs[2];
200
-
201
-	//  si une version SPIP de compatibilité a été définie (dans
202
-	//  mes_options.php, sous la forme : define('_DEV_VERSION_SPIP_COMPAT', '3.1.0');
203
-	//  on l'utilise (phase de dev, de test...) mais *que* en cas de comparaison
204
-	//  avec la version de SPIP (ne nuit donc pas aux tests de necessite
205
-	//  entre plugins)
206
-	if (defined('_DEV_VERSION_SPIP_COMPAT') and $avec_quoi == 'spip' and $version !== _DEV_VERSION_SPIP_COMPAT) {
207
-		if (plugin_version_compatible($intervalle, _DEV_VERSION_SPIP_COMPAT, $avec_quoi)) {
208
-			return true;
209
-		}
210
-		// si pas de compatibilite avec _DEV_VERSION_SPIP_COMPAT, on essaye quand meme avec la vrai version
211
-		// cas du plugin qui n'est compatible qu'avec cette nouvelle version
212
-	}
213
-
214
-	$minimum_inc = $intervalle{0} == "[";
215
-	$maximum_inc = substr($intervalle, -1) == "]";
216
-
217
-	if (strlen($minimum)) {
218
-		if ($minimum_inc and spip_version_compare($version, $minimum, '<')) {
219
-			return false;
220
-		}
221
-		if (!$minimum_inc and spip_version_compare($version, $minimum, '<=')) {
222
-			return false;
223
-		}
224
-	}
225
-	if (strlen($maximum)) {
226
-		if ($maximum_inc and spip_version_compare($version, $maximum, '>')) {
227
-			return false;
228
-		}
229
-		if (!$maximum_inc and spip_version_compare($version, $maximum, '>=')) {
230
-			return false;
231
-		}
232
-	}
233
-
234
-	return true;
190
+    if (!strlen($intervalle)) {
191
+        return true;
192
+    }
193
+    if (!preg_match(_EXTRAIRE_INTERVALLE, $intervalle, $regs)) {
194
+        return false;
195
+    }
196
+    // Extraction des bornes et traitement de * pour la borne sup :
197
+    // -- on autorise uniquement les ecritures 3.0.*, 3.*
198
+    $minimum = $regs[1];
199
+    $maximum = $regs[2];
200
+
201
+    //  si une version SPIP de compatibilité a été définie (dans
202
+    //  mes_options.php, sous la forme : define('_DEV_VERSION_SPIP_COMPAT', '3.1.0');
203
+    //  on l'utilise (phase de dev, de test...) mais *que* en cas de comparaison
204
+    //  avec la version de SPIP (ne nuit donc pas aux tests de necessite
205
+    //  entre plugins)
206
+    if (defined('_DEV_VERSION_SPIP_COMPAT') and $avec_quoi == 'spip' and $version !== _DEV_VERSION_SPIP_COMPAT) {
207
+        if (plugin_version_compatible($intervalle, _DEV_VERSION_SPIP_COMPAT, $avec_quoi)) {
208
+            return true;
209
+        }
210
+        // si pas de compatibilite avec _DEV_VERSION_SPIP_COMPAT, on essaye quand meme avec la vrai version
211
+        // cas du plugin qui n'est compatible qu'avec cette nouvelle version
212
+    }
213
+
214
+    $minimum_inc = $intervalle{0} == "[";
215
+    $maximum_inc = substr($intervalle, -1) == "]";
216
+
217
+    if (strlen($minimum)) {
218
+        if ($minimum_inc and spip_version_compare($version, $minimum, '<')) {
219
+            return false;
220
+        }
221
+        if (!$minimum_inc and spip_version_compare($version, $minimum, '<=')) {
222
+            return false;
223
+        }
224
+    }
225
+    if (strlen($maximum)) {
226
+        if ($maximum_inc and spip_version_compare($version, $maximum, '>')) {
227
+            return false;
228
+        }
229
+        if (!$maximum_inc and spip_version_compare($version, $maximum, '>=')) {
230
+            return false;
231
+        }
232
+    }
233
+
234
+    return true;
235 235
 }
236 236
 
237 237
 /**
@@ -248,62 +248,62 @@  discard block
 block discarded – undo
248 248
  * @return array
249 249
  */
250 250
 function liste_plugin_valides($liste_plug, $force = false) {
251
-	$liste_ext = liste_plugin_files(_DIR_PLUGINS_DIST);
252
-	$get_infos = charger_fonction('get_infos', 'plugins');
253
-	$infos = array(
254
-		// lister les extensions qui sont automatiquement actives
255
-		'_DIR_PLUGINS_DIST' => $get_infos($liste_ext, $force, _DIR_PLUGINS_DIST),
256
-		'_DIR_PLUGINS' => $get_infos($liste_plug, $force, _DIR_PLUGINS)
257
-	);
258
-
259
-	// creer une premiere liste non ordonnee mais qui ne retient
260
-	// que les plugins valides, et dans leur derniere version en cas de doublon
261
-	$infos['_DIR_RESTREINT'][''] = $get_infos('./', $force, _DIR_RESTREINT);
262
-	$infos['_DIR_RESTREINT']['SPIP']['version'] = $GLOBALS['spip_version_branche'];
263
-	$infos['_DIR_RESTREINT']['SPIP']['chemin'] = array();
264
-	$liste_non_classee = array(
265
-		'SPIP' => array(
266
-			'nom' => 'SPIP',
267
-			'etat' => 'stable',
268
-			'version' => $GLOBALS['spip_version_branche'],
269
-			'dir_type' => '_DIR_RESTREINT',
270
-			'dir' => '',
271
-		)
272
-	);
273
-
274
-	$invalides = array();
275
-	foreach ($liste_ext as $plug) {
276
-		if (isset($infos['_DIR_PLUGINS_DIST'][$plug])) {
277
-			plugin_valide_resume($liste_non_classee, $plug, $infos, '_DIR_PLUGINS_DIST');
278
-		}
279
-	}
280
-	foreach ($liste_plug as $plug) {
281
-		if (isset($infos['_DIR_PLUGINS'][$plug])) {
282
-			$r = plugin_valide_resume($liste_non_classee, $plug, $infos, '_DIR_PLUGINS');
283
-			if (is_array($r)) {
284
-				$invalides = array_merge($invalides, $r);
285
-			}
286
-		}
287
-	}
288
-
289
-	if (defined('_DIR_PLUGINS_SUPPL') and _DIR_PLUGINS_SUPPL) {
290
-		$infos['_DIR_PLUGINS_SUPPL'] = $get_infos($liste_plug, false, _DIR_PLUGINS_SUPPL);
291
-		foreach ($liste_plug as $plug) {
292
-			if (isset($infos['_DIR_PLUGINS_SUPPL'][$plug])) {
293
-				$r = plugin_valide_resume($liste_non_classee, $plug, $infos, '_DIR_PLUGINS_SUPPL');
294
-				if (is_array($r)) {
295
-					$invalides = array_merge($invalides, $r);
296
-				}
297
-			}
298
-		}
299
-	}
300
-
301
-	plugin_fixer_procure($liste_non_classee, $infos);
302
-
303
-	// les plugins qui sont dans $liste_non_classee ne sont pas invalides (on a trouve un autre version valide)
304
-	$invalides = array_diff_key($invalides, $liste_non_classee);
305
-
306
-	return array($infos, $liste_non_classee, $invalides);
251
+    $liste_ext = liste_plugin_files(_DIR_PLUGINS_DIST);
252
+    $get_infos = charger_fonction('get_infos', 'plugins');
253
+    $infos = array(
254
+        // lister les extensions qui sont automatiquement actives
255
+        '_DIR_PLUGINS_DIST' => $get_infos($liste_ext, $force, _DIR_PLUGINS_DIST),
256
+        '_DIR_PLUGINS' => $get_infos($liste_plug, $force, _DIR_PLUGINS)
257
+    );
258
+
259
+    // creer une premiere liste non ordonnee mais qui ne retient
260
+    // que les plugins valides, et dans leur derniere version en cas de doublon
261
+    $infos['_DIR_RESTREINT'][''] = $get_infos('./', $force, _DIR_RESTREINT);
262
+    $infos['_DIR_RESTREINT']['SPIP']['version'] = $GLOBALS['spip_version_branche'];
263
+    $infos['_DIR_RESTREINT']['SPIP']['chemin'] = array();
264
+    $liste_non_classee = array(
265
+        'SPIP' => array(
266
+            'nom' => 'SPIP',
267
+            'etat' => 'stable',
268
+            'version' => $GLOBALS['spip_version_branche'],
269
+            'dir_type' => '_DIR_RESTREINT',
270
+            'dir' => '',
271
+        )
272
+    );
273
+
274
+    $invalides = array();
275
+    foreach ($liste_ext as $plug) {
276
+        if (isset($infos['_DIR_PLUGINS_DIST'][$plug])) {
277
+            plugin_valide_resume($liste_non_classee, $plug, $infos, '_DIR_PLUGINS_DIST');
278
+        }
279
+    }
280
+    foreach ($liste_plug as $plug) {
281
+        if (isset($infos['_DIR_PLUGINS'][$plug])) {
282
+            $r = plugin_valide_resume($liste_non_classee, $plug, $infos, '_DIR_PLUGINS');
283
+            if (is_array($r)) {
284
+                $invalides = array_merge($invalides, $r);
285
+            }
286
+        }
287
+    }
288
+
289
+    if (defined('_DIR_PLUGINS_SUPPL') and _DIR_PLUGINS_SUPPL) {
290
+        $infos['_DIR_PLUGINS_SUPPL'] = $get_infos($liste_plug, false, _DIR_PLUGINS_SUPPL);
291
+        foreach ($liste_plug as $plug) {
292
+            if (isset($infos['_DIR_PLUGINS_SUPPL'][$plug])) {
293
+                $r = plugin_valide_resume($liste_non_classee, $plug, $infos, '_DIR_PLUGINS_SUPPL');
294
+                if (is_array($r)) {
295
+                    $invalides = array_merge($invalides, $r);
296
+                }
297
+            }
298
+        }
299
+    }
300
+
301
+    plugin_fixer_procure($liste_non_classee, $infos);
302
+
303
+    // les plugins qui sont dans $liste_non_classee ne sont pas invalides (on a trouve un autre version valide)
304
+    $invalides = array_diff_key($invalides, $liste_non_classee);
305
+
306
+    return array($infos, $liste_non_classee, $invalides);
307 307
 }
308 308
 
309 309
 /**
@@ -323,29 +323,29 @@  discard block
 block discarded – undo
323 323
  *   array description short si on ne le retient pas (pour memorisation dans une table des erreurs)
324 324
  */
325 325
 function plugin_valide_resume(&$liste, $plug, $infos, $dir_type) {
326
-	$i = $infos[$dir_type][$plug];
327
-	$p = strtoupper($i['prefix']);
328
-	$short_desc = array(
329
-		'nom' => $i['nom'],
330
-		'etat' => $i['etat'],
331
-		'version' => $i['version'],
332
-		'dir' => $plug,
333
-		'dir_type' => $dir_type
334
-	);
335
-	if (isset($i['erreur']) and $i['erreur']) {
336
-		$short_desc['erreur'] = $i['erreur'];
337
-		return array($p=>$short_desc);
338
-	}
339
-	if (!plugin_version_compatible($i['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
340
-		return array($p=>$short_desc);
341
-	}
342
-	if (!isset($liste[$p])
343
-		or spip_version_compare($i['version'], $liste[$p]['version'], '>')
344
-	) {
345
-		$liste[$p] = $short_desc;
346
-	}
347
-	// ok le plugin etait deja dans la liste ou on a choisi une version plus recente
348
-	return $p;
326
+    $i = $infos[$dir_type][$plug];
327
+    $p = strtoupper($i['prefix']);
328
+    $short_desc = array(
329
+        'nom' => $i['nom'],
330
+        'etat' => $i['etat'],
331
+        'version' => $i['version'],
332
+        'dir' => $plug,
333
+        'dir_type' => $dir_type
334
+    );
335
+    if (isset($i['erreur']) and $i['erreur']) {
336
+        $short_desc['erreur'] = $i['erreur'];
337
+        return array($p=>$short_desc);
338
+    }
339
+    if (!plugin_version_compatible($i['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
340
+        return array($p=>$short_desc);
341
+    }
342
+    if (!isset($liste[$p])
343
+        or spip_version_compare($i['version'], $liste[$p]['version'], '>')
344
+    ) {
345
+        $liste[$p] = $short_desc;
346
+    }
347
+    // ok le plugin etait deja dans la liste ou on a choisi une version plus recente
348
+    return $p;
349 349
 }
350 350
 
351 351
 /**
@@ -361,46 +361,46 @@  discard block
 block discarded – undo
361 361
  * @param array $infos
362 362
  */
363 363
 function plugin_fixer_procure(&$liste, &$infos) {
364
-	foreach ($liste as $p => $resume) {
365
-		$i = $infos[$resume['dir_type']][$resume['dir']];
366
-		if (isset($i['procure']) and $i['procure']) {
367
-			foreach ($i['procure'] as $procure) {
368
-				$p = strtoupper($procure['nom']);
369
-				$dir = $resume['dir'];
370
-				if ($dir) {
371
-					$dir .= "/";
372
-				}
373
-				$dir .= "procure:" . $procure['nom'];
374
-
375
-				$procure['etat'] = '?';
376
-				$procure['dir_type'] = $resume['dir_type'];
377
-				$procure['dir'] = $dir;
378
-
379
-				// si ce plugin n'est pas deja procure, ou dans une version plus ancienne
380
-				// on ajoute cette version a la liste
381
-				if (!isset($liste[$p])
382
-					or spip_version_compare($procure['version'], $liste[$p]['version'], '>')
383
-				) {
384
-					$liste[$p] = $procure;
385
-
386
-					// on fournit une information minimale pour ne pas perturber la compilation
387
-					$infos[$resume['dir_type']][$dir] = array(
388
-						'prefix' => $procure['nom'],
389
-						'nom' => $procure['nom'],
390
-						'etat' => $procure['etat'],
391
-						'version' => $procure['version'],
392
-						'chemin' => array(),
393
-						'necessite' => array(),
394
-						'utilise' => array(),
395
-						'lib' => array(),
396
-						'menu' => array(),
397
-						'onglet' => array(),
398
-						'procure' => array(),
399
-					);
400
-				}
401
-			}
402
-		}
403
-	}
364
+    foreach ($liste as $p => $resume) {
365
+        $i = $infos[$resume['dir_type']][$resume['dir']];
366
+        if (isset($i['procure']) and $i['procure']) {
367
+            foreach ($i['procure'] as $procure) {
368
+                $p = strtoupper($procure['nom']);
369
+                $dir = $resume['dir'];
370
+                if ($dir) {
371
+                    $dir .= "/";
372
+                }
373
+                $dir .= "procure:" . $procure['nom'];
374
+
375
+                $procure['etat'] = '?';
376
+                $procure['dir_type'] = $resume['dir_type'];
377
+                $procure['dir'] = $dir;
378
+
379
+                // si ce plugin n'est pas deja procure, ou dans une version plus ancienne
380
+                // on ajoute cette version a la liste
381
+                if (!isset($liste[$p])
382
+                    or spip_version_compare($procure['version'], $liste[$p]['version'], '>')
383
+                ) {
384
+                    $liste[$p] = $procure;
385
+
386
+                    // on fournit une information minimale pour ne pas perturber la compilation
387
+                    $infos[$resume['dir_type']][$dir] = array(
388
+                        'prefix' => $procure['nom'],
389
+                        'nom' => $procure['nom'],
390
+                        'etat' => $procure['etat'],
391
+                        'version' => $procure['version'],
392
+                        'chemin' => array(),
393
+                        'necessite' => array(),
394
+                        'utilise' => array(),
395
+                        'lib' => array(),
396
+                        'menu' => array(),
397
+                        'onglet' => array(),
398
+                        'procure' => array(),
399
+                    );
400
+                }
401
+            }
402
+        }
403
+    }
404 404
 }
405 405
 
406 406
 /**
@@ -414,19 +414,19 @@  discard block
 block discarded – undo
414 414
  * @return array
415 415
  */
416 416
 function liste_chemin_plugin($liste, $dir_plugins = _DIR_PLUGINS) {
417
-	foreach ($liste as $prefix => $infos) {
418
-		if (!$dir_plugins
419
-			or (
420
-				defined($infos['dir_type'])
421
-				and constant($infos['dir_type']) == $dir_plugins)
422
-		) {
423
-			$liste[$prefix] = $infos['dir'];
424
-		} else {
425
-			unset($liste[$prefix]);
426
-		}
427
-	}
428
-
429
-	return $liste;
417
+    foreach ($liste as $prefix => $infos) {
418
+        if (!$dir_plugins
419
+            or (
420
+                defined($infos['dir_type'])
421
+                and constant($infos['dir_type']) == $dir_plugins)
422
+        ) {
423
+            $liste[$prefix] = $infos['dir'];
424
+        } else {
425
+            unset($liste[$prefix]);
426
+        }
427
+    }
428
+
429
+    return $liste;
430 430
 }
431 431
 
432 432
 /**
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
  * @return array
442 442
  */
443 443
 function liste_chemin_plugin_actifs($dir_plugins = _DIR_PLUGINS) {
444
-	include_spip('plugins/installer');
444
+    include_spip('plugins/installer');
445 445
 
446
-	return liste_chemin_plugin(liste_plugin_actifs(), $dir_plugins);
446
+    return liste_chemin_plugin(liste_plugin_actifs(), $dir_plugins);
447 447
 }
448 448
 
449 449
 /**
@@ -474,53 +474,53 @@  discard block
 block discarded – undo
474 474
  *                qui n'ont pas satisfait leurs dépendances
475 475
 **/
476 476
 function plugin_trier($infos, $liste_non_classee) {
477
-	$toute_la_liste = $liste_non_classee;
478
-	$liste = $ordre = array();
479
-	$count = 0;
480
-
481
-	while ($c = count($liste_non_classee) and $c != $count) { // tant qu'il reste des plugins a classer, et qu'on ne stagne pas
482
-		#echo "tour::";var_dump($liste_non_classee);
483
-		$count = $c;
484
-		foreach ($liste_non_classee as $p => $resume) {
485
-			$plug = $resume['dir'];
486
-			$dir_type = $resume['dir_type'];
487
-			$info1 = $infos[$dir_type][$plug];
488
-			// si des plugins sont necessaires,
489
-			// on ne peut inserer qu'apres eux
490
-			foreach ($info1['necessite'] as $need) {
491
-				$nom = strtoupper($need['nom']);
492
-				$compat = isset($need['compatibilite']) ? $need['compatibilite'] : '';
493
-				if (!isset($liste[$nom]) or !plugin_version_compatible($compat, $liste[$nom]['version'])) {
494
-					$info1 = false;
495
-					break;
496
-				}
497
-			}
498
-			if (!$info1) {
499
-				continue;
500
-			}
501
-			// idem si des plugins sont utiles,
502
-			// sauf si ils sont de toute facon absents de la liste
503
-			foreach ($info1['utilise'] as $need) {
504
-				$nom = strtoupper($need['nom']);
505
-				$compat = isset($need['compatibilite']) ? $need['compatibilite'] : '';
506
-				if (isset($toute_la_liste[$nom])) {
507
-					if (!isset($liste[$nom]) or
508
-						!plugin_version_compatible($compat, $liste[$nom]['version'])
509
-					) {
510
-						$info1 = false;
511
-						break;
512
-					}
513
-				}
514
-			}
515
-			if ($info1) {
516
-				$ordre[$p] = $info1;
517
-				$liste[$p] = $liste_non_classee[$p];
518
-				unset($liste_non_classee[$p]);
519
-			}
520
-		}
521
-	}
522
-
523
-	return array($liste, $ordre, $liste_non_classee);
477
+    $toute_la_liste = $liste_non_classee;
478
+    $liste = $ordre = array();
479
+    $count = 0;
480
+
481
+    while ($c = count($liste_non_classee) and $c != $count) { // tant qu'il reste des plugins a classer, et qu'on ne stagne pas
482
+        #echo "tour::";var_dump($liste_non_classee);
483
+        $count = $c;
484
+        foreach ($liste_non_classee as $p => $resume) {
485
+            $plug = $resume['dir'];
486
+            $dir_type = $resume['dir_type'];
487
+            $info1 = $infos[$dir_type][$plug];
488
+            // si des plugins sont necessaires,
489
+            // on ne peut inserer qu'apres eux
490
+            foreach ($info1['necessite'] as $need) {
491
+                $nom = strtoupper($need['nom']);
492
+                $compat = isset($need['compatibilite']) ? $need['compatibilite'] : '';
493
+                if (!isset($liste[$nom]) or !plugin_version_compatible($compat, $liste[$nom]['version'])) {
494
+                    $info1 = false;
495
+                    break;
496
+                }
497
+            }
498
+            if (!$info1) {
499
+                continue;
500
+            }
501
+            // idem si des plugins sont utiles,
502
+            // sauf si ils sont de toute facon absents de la liste
503
+            foreach ($info1['utilise'] as $need) {
504
+                $nom = strtoupper($need['nom']);
505
+                $compat = isset($need['compatibilite']) ? $need['compatibilite'] : '';
506
+                if (isset($toute_la_liste[$nom])) {
507
+                    if (!isset($liste[$nom]) or
508
+                        !plugin_version_compatible($compat, $liste[$nom]['version'])
509
+                    ) {
510
+                        $info1 = false;
511
+                        break;
512
+                    }
513
+                }
514
+            }
515
+            if ($info1) {
516
+                $ordre[$p] = $info1;
517
+                $liste[$p] = $liste_non_classee[$p];
518
+                unset($liste_non_classee[$p]);
519
+            }
520
+        }
521
+    }
522
+
523
+    return array($liste, $ordre, $liste_non_classee);
524 524
 }
525 525
 
526 526
 /**
@@ -537,40 +537,40 @@  discard block
 block discarded – undo
537 537
  *     Répertoire (plugins, plugins-dist, ...) => Couples (prefixes => infos completes) des plugins qu'ils contiennent
538 538
 **/
539 539
 function plugins_erreurs($liste_non_classee, $liste, $infos, $msg = array()) {
540
-	static $erreurs = array();
541
-
542
-	if (!is_array($liste)) {
543
-		$liste = array();
544
-	}
545
-
546
-	// les plugins en erreur ne sont pas actifs ; ils ne doivent pas être dans la liste
547
-	$liste = array_diff_key($liste, $liste_non_classee);
548
-
549
-	foreach ($liste_non_classee as $p => $resume) {
550
-		$dir_type = $resume['dir_type'];
551
-		$plug = $resume['dir'];
552
-		$k = $infos[$dir_type][$plug];
553
-
554
-		$plug = constant($dir_type) . $plug;
555
-		if (!isset($msg[$p])) {
556
-			if (isset($resume['erreur']) and $resume['erreur']) {
557
-				$msg[$p] = array($resume['erreur']);
558
-			}
559
-			elseif (!plugin_version_compatible($k['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
560
-				$msg[$p] = array(plugin_message_incompatibilite($k['compatibilite'], $GLOBALS['spip_version_branche'], 'SPIP', 'necessite'));
561
-			}
562
-			elseif (!$msg[$p] = plugin_necessite($k['necessite'], $liste, 'necessite')) {
563
-				$msg[$p] = plugin_necessite($k['utilise'], $liste, 'utilise');
564
-			}
565
-		} else {
566
-			foreach ($msg[$p] as $c => $l) {
567
-				$msg[$p][$c] = plugin_controler_lib($l['nom'], $l['lien']);
568
-			}
569
-		}
570
-		$erreurs[$plug] = $msg[$p];
571
-	}
572
-
573
-	ecrire_meta('plugin_erreur_activation', serialize($erreurs));
540
+    static $erreurs = array();
541
+
542
+    if (!is_array($liste)) {
543
+        $liste = array();
544
+    }
545
+
546
+    // les plugins en erreur ne sont pas actifs ; ils ne doivent pas être dans la liste
547
+    $liste = array_diff_key($liste, $liste_non_classee);
548
+
549
+    foreach ($liste_non_classee as $p => $resume) {
550
+        $dir_type = $resume['dir_type'];
551
+        $plug = $resume['dir'];
552
+        $k = $infos[$dir_type][$plug];
553
+
554
+        $plug = constant($dir_type) . $plug;
555
+        if (!isset($msg[$p])) {
556
+            if (isset($resume['erreur']) and $resume['erreur']) {
557
+                $msg[$p] = array($resume['erreur']);
558
+            }
559
+            elseif (!plugin_version_compatible($k['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
560
+                $msg[$p] = array(plugin_message_incompatibilite($k['compatibilite'], $GLOBALS['spip_version_branche'], 'SPIP', 'necessite'));
561
+            }
562
+            elseif (!$msg[$p] = plugin_necessite($k['necessite'], $liste, 'necessite')) {
563
+                $msg[$p] = plugin_necessite($k['utilise'], $liste, 'utilise');
564
+            }
565
+        } else {
566
+            foreach ($msg[$p] as $c => $l) {
567
+                $msg[$p][$c] = plugin_controler_lib($l['nom'], $l['lien']);
568
+            }
569
+        }
570
+        $erreurs[$plug] = $msg[$p];
571
+    }
572
+
573
+    ecrire_meta('plugin_erreur_activation', serialize($erreurs));
574 574
 }
575 575
 
576 576
 /**
@@ -585,25 +585,25 @@  discard block
 block discarded – undo
585 585
  *     - Liste des erreurs ou code HTML des erreurs
586 586
 **/
587 587
 function plugin_donne_erreurs($raw = false, $raz = true) {
588
-	if (!isset($GLOBALS['meta']['plugin_erreur_activation'])) {
589
-		return $raw ? array() : '';
590
-	}
591
-	$list = @unserialize($GLOBALS['meta']['plugin_erreur_activation']);
592
-	// Compat ancienne version
593
-	if (!$list) {
594
-		$list = $raw ? array() : $GLOBALS['meta']['plugin_erreur_activation'];
595
-	} elseif (!$raw) {
596
-		foreach ($list as $plug => $msg) {
597
-			$list[$plug] = "<li>" . _T('plugin_impossible_activer', array('plugin' => $plug))
598
-				. "<ul><li>" . implode("</li><li>", $msg) . "</li></ul></li>";
599
-		}
600
-		$list = "<ul>" . join("\n", $list) . "</ul>";
601
-	}
602
-	if ($raz) {
603
-		effacer_meta('plugin_erreur_activation');
604
-	}
605
-
606
-	return $list;
588
+    if (!isset($GLOBALS['meta']['plugin_erreur_activation'])) {
589
+        return $raw ? array() : '';
590
+    }
591
+    $list = @unserialize($GLOBALS['meta']['plugin_erreur_activation']);
592
+    // Compat ancienne version
593
+    if (!$list) {
594
+        $list = $raw ? array() : $GLOBALS['meta']['plugin_erreur_activation'];
595
+    } elseif (!$raw) {
596
+        foreach ($list as $plug => $msg) {
597
+            $list[$plug] = "<li>" . _T('plugin_impossible_activer', array('plugin' => $plug))
598
+                . "<ul><li>" . implode("</li><li>", $msg) . "</li></ul></li>";
599
+        }
600
+        $list = "<ul>" . join("\n", $list) . "</ul>";
601
+    }
602
+    if ($raz) {
603
+        effacer_meta('plugin_erreur_activation');
604
+    }
605
+
606
+    return $list;
607 607
 }
608 608
 
609 609
 /**
@@ -623,21 +623,21 @@  discard block
 block discarded – undo
623 623
  *
624 624
  **/
625 625
 function plugin_necessite($n, $liste, $balise = 'necessite') {
626
-	$msg = array();
627
-	foreach ($n as $need) {
628
-		$id = strtoupper($need['nom']);
629
-		$r = plugin_controler_necessite(
630
-			$liste, 
631
-			$id, 
632
-			isset($need['compatibilite']) ? $need['compatibilite'] : '', 
633
-			$balise
634
-		);
635
-		if ($r) {
636
-			$msg[] = $r;
637
-		}
638
-	}
639
-
640
-	return $msg;
626
+    $msg = array();
627
+    foreach ($n as $need) {
628
+        $id = strtoupper($need['nom']);
629
+        $r = plugin_controler_necessite(
630
+            $liste, 
631
+            $id, 
632
+            isset($need['compatibilite']) ? $need['compatibilite'] : '', 
633
+            $balise
634
+        );
635
+        if ($r) {
636
+            $msg[] = $r;
637
+        }
638
+    }
639
+
640
+    return $msg;
641 641
 }
642 642
 
643 643
 /**
@@ -659,16 +659,16 @@  discard block
 block discarded – undo
659 659
  *    Message d'erreur lorsque la dépendance est absente.
660 660
  **/
661 661
 function plugin_controler_necessite($liste, $nom, $intervalle, $balise) {
662
-	if (isset($liste[$nom]) and plugin_version_compatible($intervalle, $liste[$nom]['version'])) {
663
-		return '';
664
-	}
665
-
666
-	return plugin_message_incompatibilite(
667
-		$intervalle, 
668
-		(isset($liste[$nom]) ? $liste[$nom]['version'] : ""), 
669
-		$nom, 
670
-		$balise
671
-	);
662
+    if (isset($liste[$nom]) and plugin_version_compatible($intervalle, $liste[$nom]['version'])) {
663
+        return '';
664
+    }
665
+
666
+    return plugin_message_incompatibilite(
667
+        $intervalle, 
668
+        (isset($liste[$nom]) ? $liste[$nom]['version'] : ""), 
669
+        $nom, 
670
+        $balise
671
+    );
672 672
 }
673 673
 
674 674
 /**
@@ -685,70 +685,70 @@  discard block
 block discarded – undo
685 685
  */
686 686
 function plugin_message_incompatibilite($intervalle, $version, $nom, $balise) {
687 687
 
688
-	// prendre en compte les erreurs de dépendances à PHP
689
-	// ou à une extension PHP avec des messages d'erreurs dédiés.
690
-	$type = 'plugin';
691
-	if ($nom === 'SPIP') {
692
-		$type = 'spip';
693
-	} elseif ($nom === 'PHP') {
694
-		$type = 'php';
695
-	} elseif (strncmp($nom, 'PHP:', 4) === 0) {
696
-		$type = 'extension_php';
697
-		list(,$nom) = explode(':', $nom, 2);
698
-	}
699
-
700
-	if (preg_match(_EXTRAIRE_INTERVALLE, $intervalle, $regs)) {
701
-		$minimum = $regs[1];
702
-		$maximum = $regs[2];
703
-
704
-		$minimum_inclus = $intervalle{0} == "[";
705
-		$maximum_inclus = substr($intervalle, -1) == "]";
706
-
707
-		if (strlen($minimum)) {
708
-			if ($minimum_inclus and spip_version_compare($version, $minimum, '<')) {
709
-				return _T("plugin_${balise}_${type}", array(
710
-					'plugin' => $nom,
711
-					'version' => ' &ge; ' . $minimum
712
-				));
713
-			}
714
-			if (!$minimum_inclus and spip_version_compare($version, $minimum, '<=')) {
715
-				return _T("plugin_${balise}_${type}", array(
716
-					'plugin' => $nom,
717
-					'version' => ' &gt; ' . $minimum
718
-				));
719
-			}
720
-		}
721
-
722
-		if (strlen($maximum)) {
723
-			if ($maximum_inclus and spip_version_compare($version, $maximum, '>')) {
724
-				return _T("plugin_${balise}_${type}", array(
725
-					'plugin' => $nom,
726
-					'version' => ' &le; ' . $maximum
727
-				));
728
-			}
729
-			if (!$maximum_inclus and spip_version_compare($version, $maximum, '>=')) {
730
-				return _T("plugin_${balise}_plugin", array(
731
-					'plugin' => $nom,
732
-					'version' => ' &lt; ' . $maximum
733
-				));
734
-			}
735
-		}
736
-	}
737
-
738
-	// note : il ne peut pas y avoir d'erreur sur
739
-	// - un 'utilise' sans version.
740
-	// - un 'php' sans version.
741
-	return _T("plugin_necessite_${type}_sans_version", array('plugin' => $nom));
688
+    // prendre en compte les erreurs de dépendances à PHP
689
+    // ou à une extension PHP avec des messages d'erreurs dédiés.
690
+    $type = 'plugin';
691
+    if ($nom === 'SPIP') {
692
+        $type = 'spip';
693
+    } elseif ($nom === 'PHP') {
694
+        $type = 'php';
695
+    } elseif (strncmp($nom, 'PHP:', 4) === 0) {
696
+        $type = 'extension_php';
697
+        list(,$nom) = explode(':', $nom, 2);
698
+    }
699
+
700
+    if (preg_match(_EXTRAIRE_INTERVALLE, $intervalle, $regs)) {
701
+        $minimum = $regs[1];
702
+        $maximum = $regs[2];
703
+
704
+        $minimum_inclus = $intervalle{0} == "[";
705
+        $maximum_inclus = substr($intervalle, -1) == "]";
706
+
707
+        if (strlen($minimum)) {
708
+            if ($minimum_inclus and spip_version_compare($version, $minimum, '<')) {
709
+                return _T("plugin_${balise}_${type}", array(
710
+                    'plugin' => $nom,
711
+                    'version' => ' &ge; ' . $minimum
712
+                ));
713
+            }
714
+            if (!$minimum_inclus and spip_version_compare($version, $minimum, '<=')) {
715
+                return _T("plugin_${balise}_${type}", array(
716
+                    'plugin' => $nom,
717
+                    'version' => ' &gt; ' . $minimum
718
+                ));
719
+            }
720
+        }
721
+
722
+        if (strlen($maximum)) {
723
+            if ($maximum_inclus and spip_version_compare($version, $maximum, '>')) {
724
+                return _T("plugin_${balise}_${type}", array(
725
+                    'plugin' => $nom,
726
+                    'version' => ' &le; ' . $maximum
727
+                ));
728
+            }
729
+            if (!$maximum_inclus and spip_version_compare($version, $maximum, '>=')) {
730
+                return _T("plugin_${balise}_plugin", array(
731
+                    'plugin' => $nom,
732
+                    'version' => ' &lt; ' . $maximum
733
+                ));
734
+            }
735
+        }
736
+    }
737
+
738
+    // note : il ne peut pas y avoir d'erreur sur
739
+    // - un 'utilise' sans version.
740
+    // - un 'php' sans version.
741
+    return _T("plugin_necessite_${type}_sans_version", array('plugin' => $nom));
742 742
 }
743 743
 
744 744
 
745 745
 function plugin_controler_lib($lib, $url) {
746
-	/* Feature sortie du core, voir STP
746
+    /* Feature sortie du core, voir STP
747 747
 	 * if ($url) {
748 748
 		include_spip('inc/charger_plugin');
749 749
 		$url = '<br />'	. bouton_telechargement_plugin($url, 'lib');
750 750
 	}*/
751
-	return _T('plugin_necessite_lib', array('lib' => $lib)) . " <a href='$url'>$url</a>";
751
+    return _T('plugin_necessite_lib', array('lib' => $lib)) . " <a href='$url'>$url</a>";
752 752
 }
753 753
 
754 754
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
  *     true si il y a eu des modifications sur la liste des plugins actifs, false sinon
764 764
  **/
765 765
 function actualise_plugins_actifs($pipe_recherche = false) {
766
-	return ecrire_plugin_actifs('', $pipe_recherche, 'force');
766
+    return ecrire_plugin_actifs('', $pipe_recherche, 'force');
767 767
 }
768 768
 
769 769
 
@@ -790,113 +790,113 @@  discard block
 block discarded – undo
790 790
  **/
791 791
 function ecrire_plugin_actifs($plugin, $pipe_recherche = false, $operation = 'raz') {
792 792
 
793
-	// creer le repertoire cache/ si necessaire ! (installation notamment)
794
-	$cache = sous_repertoire(_DIR_CACHE, '', false, true);
795
-
796
-	// Si on n'a ni cache accessible, ni connexion SQL, on ne peut pas faire grand chose encore.
797
-	if (!$cache and !spip_connect()) {
798
-		return false;
799
-	}
800
-
801
-	if ($operation != 'raz') {
802
-		$plugin_valides = liste_chemin_plugin_actifs();
803
-		$plugin_valides = is_plugin_dir($plugin_valides);
804
-		if (defined('_DIR_PLUGINS_SUPPL') && _DIR_PLUGINS_SUPPL) {
805
-			$plugin_valides_supp = liste_chemin_plugin_actifs(_DIR_PLUGINS_SUPPL);
806
-			$plugin_valides_supp = is_plugin_dir($plugin_valides_supp, _DIR_PLUGINS_SUPPL);
807
-			$plugin_valides = array_merge($plugin_valides, $plugin_valides_supp);
808
-		}
809
-		// si des plugins sont en attentes (coches mais impossible a activer)
810
-		// on les reinjecte ici
811
-		if (isset($GLOBALS['meta']['plugin_attente'])
812
-			and $a = unserialize($GLOBALS['meta']['plugin_attente'])
813
-		) {
814
-			$plugin_valides = $plugin_valides + liste_chemin_plugin($a);
815
-		}
816
-
817
-		if ($operation == 'ajoute') {
818
-			$plugin = array_merge($plugin_valides, $plugin);
819
-		} elseif ($operation == 'enleve') {
820
-			$plugin = array_diff($plugin_valides, $plugin);
821
-		} else {
822
-			$plugin = $plugin_valides;
823
-		}
824
-	}
825
-	$actifs_avant = isset($GLOBALS['meta']['plugin']) ? $GLOBALS['meta']['plugin'] : '';
826
-
827
-	// si une fonction de gestion de dependances existe, l'appeler ici
828
-	if ($ajouter_dependances = charger_fonction("ajouter_dependances", "plugins", true)) {
829
-		$plugin = $ajouter_dependances($plugin);
830
-	}
831
-
832
-	// recharger le xml des plugins a activer
833
-	// on force le reload ici, meme si le fichier xml n'a pas change
834
-	// pour ne pas rater l'ajout ou la suppression d'un fichier fonctions/options/administrations
835
-	// pourra etre evite quand on ne supportera plus les plugin.xml
836
-	// en deplacant la detection de ces fichiers dans la compilation ci dessous
837
-	list($infos, $liste, $invalides) = liste_plugin_valides($plugin, true);
838
-	// trouver l'ordre d'activation
839
-	list($plugin_valides, $ordre, $reste) = plugin_trier($infos, $liste);
840
-	if ($invalides or $reste) {
841
-		plugins_erreurs(array_merge($invalides, $reste), $liste, $infos);
842
-	}
843
-
844
-	// Ignorer les plugins necessitant une lib absente
845
-	// et preparer la meta d'entete Http
846
-	$err = $msg = $header = array();
847
-	foreach ($plugin_valides as $p => $resume) {
848
-		// Les headers ne doivent pas indiquer les versions des extensions PHP, ni la version PHP
849
-		if (0 !== strpos($p, 'PHP:') and $p !== 'PHP') {
850
-			$header[] = $p . ($resume['version'] ? "(" . $resume['version'] . ")" : "");
851
-		}
852
-		if ($resume['dir']) {
853
-			foreach ($infos[$resume['dir_type']][$resume['dir']]['lib'] as $l) {
854
-				if (!find_in_path($l['nom'], 'lib/')) {
855
-					$err[$p] = $resume;
856
-					$msg[$p][] = $l;
857
-					unset($plugin_valides[$p]);
858
-				}
859
-			}
860
-		}
861
-	}
862
-	if ($err) {
863
-		plugins_erreurs($err, '', $infos, $msg);
864
-	}
865
-
866
-	if (isset($GLOBALS['meta']['message_crash_plugins'])) {
867
-		effacer_meta('message_crash_plugins');
868
-	}
869
-	ecrire_meta('plugin', serialize($plugin_valides));
870
-	$liste = array_diff_key($liste, $plugin_valides);
871
-	ecrire_meta('plugin_attente', serialize($liste));
872
-	$header = strtolower(implode(",", $header));
873
-	if (!isset($GLOBALS['spip_header_silencieux']) or !$GLOBALS['spip_header_silencieux']) {
874
-		ecrire_fichier(_DIR_VAR . "config.txt",
875
-			(defined('_HEADER_COMPOSED_BY') ? _HEADER_COMPOSED_BY : "Composed-By: SPIP") . ' ' . $GLOBALS['spip_version_affichee'] . " @ www.spip.net + " . $header);
876
-	} else {
877
-		@unlink(_DIR_VAR . "config.txt");
878
-	}
879
-	// generer charger_plugins_chemin.php
880
-	plugins_precompile_chemin($plugin_valides, $ordre);
881
-	// generer les fichiers
882
-	// - charger_plugins_options.php
883
-	// - charger_plugins_fonctions.php
884
-	plugins_precompile_xxxtions($plugin_valides, $ordre);
885
-	// charger les chemins des plugins et les fichiers d'options 
886
-	// (qui peuvent déclarer / utiliser des pipelines, ajouter d'autres chemins)
887
-	plugins_amorcer_plugins_actifs();
888
-	// mise a jour de la matrice des pipelines
889
-	$prepend_code = pipeline_matrice_precompile($plugin_valides, $ordre, $pipe_recherche);
890
-	// generer le fichier _CACHE_PIPELINE
891
-	pipeline_precompile($prepend_code);
892
-
893
-	if (spip_connect()) {
894
-		// lancer et initialiser les nouveaux crons !
895
-		include_spip('inc/genie');
896
-		genie_queue_watch_dist();
897
-	}
898
-
899
-	return ($GLOBALS['meta']['plugin'] != $actifs_avant);
793
+    // creer le repertoire cache/ si necessaire ! (installation notamment)
794
+    $cache = sous_repertoire(_DIR_CACHE, '', false, true);
795
+
796
+    // Si on n'a ni cache accessible, ni connexion SQL, on ne peut pas faire grand chose encore.
797
+    if (!$cache and !spip_connect()) {
798
+        return false;
799
+    }
800
+
801
+    if ($operation != 'raz') {
802
+        $plugin_valides = liste_chemin_plugin_actifs();
803
+        $plugin_valides = is_plugin_dir($plugin_valides);
804
+        if (defined('_DIR_PLUGINS_SUPPL') && _DIR_PLUGINS_SUPPL) {
805
+            $plugin_valides_supp = liste_chemin_plugin_actifs(_DIR_PLUGINS_SUPPL);
806
+            $plugin_valides_supp = is_plugin_dir($plugin_valides_supp, _DIR_PLUGINS_SUPPL);
807
+            $plugin_valides = array_merge($plugin_valides, $plugin_valides_supp);
808
+        }
809
+        // si des plugins sont en attentes (coches mais impossible a activer)
810
+        // on les reinjecte ici
811
+        if (isset($GLOBALS['meta']['plugin_attente'])
812
+            and $a = unserialize($GLOBALS['meta']['plugin_attente'])
813
+        ) {
814
+            $plugin_valides = $plugin_valides + liste_chemin_plugin($a);
815
+        }
816
+
817
+        if ($operation == 'ajoute') {
818
+            $plugin = array_merge($plugin_valides, $plugin);
819
+        } elseif ($operation == 'enleve') {
820
+            $plugin = array_diff($plugin_valides, $plugin);
821
+        } else {
822
+            $plugin = $plugin_valides;
823
+        }
824
+    }
825
+    $actifs_avant = isset($GLOBALS['meta']['plugin']) ? $GLOBALS['meta']['plugin'] : '';
826
+
827
+    // si une fonction de gestion de dependances existe, l'appeler ici
828
+    if ($ajouter_dependances = charger_fonction("ajouter_dependances", "plugins", true)) {
829
+        $plugin = $ajouter_dependances($plugin);
830
+    }
831
+
832
+    // recharger le xml des plugins a activer
833
+    // on force le reload ici, meme si le fichier xml n'a pas change
834
+    // pour ne pas rater l'ajout ou la suppression d'un fichier fonctions/options/administrations
835
+    // pourra etre evite quand on ne supportera plus les plugin.xml
836
+    // en deplacant la detection de ces fichiers dans la compilation ci dessous
837
+    list($infos, $liste, $invalides) = liste_plugin_valides($plugin, true);
838
+    // trouver l'ordre d'activation
839
+    list($plugin_valides, $ordre, $reste) = plugin_trier($infos, $liste);
840
+    if ($invalides or $reste) {
841
+        plugins_erreurs(array_merge($invalides, $reste), $liste, $infos);
842
+    }
843
+
844
+    // Ignorer les plugins necessitant une lib absente
845
+    // et preparer la meta d'entete Http
846
+    $err = $msg = $header = array();
847
+    foreach ($plugin_valides as $p => $resume) {
848
+        // Les headers ne doivent pas indiquer les versions des extensions PHP, ni la version PHP
849
+        if (0 !== strpos($p, 'PHP:') and $p !== 'PHP') {
850
+            $header[] = $p . ($resume['version'] ? "(" . $resume['version'] . ")" : "");
851
+        }
852
+        if ($resume['dir']) {
853
+            foreach ($infos[$resume['dir_type']][$resume['dir']]['lib'] as $l) {
854
+                if (!find_in_path($l['nom'], 'lib/')) {
855
+                    $err[$p] = $resume;
856
+                    $msg[$p][] = $l;
857
+                    unset($plugin_valides[$p]);
858
+                }
859
+            }
860
+        }
861
+    }
862
+    if ($err) {
863
+        plugins_erreurs($err, '', $infos, $msg);
864
+    }
865
+
866
+    if (isset($GLOBALS['meta']['message_crash_plugins'])) {
867
+        effacer_meta('message_crash_plugins');
868
+    }
869
+    ecrire_meta('plugin', serialize($plugin_valides));
870
+    $liste = array_diff_key($liste, $plugin_valides);
871
+    ecrire_meta('plugin_attente', serialize($liste));
872
+    $header = strtolower(implode(",", $header));
873
+    if (!isset($GLOBALS['spip_header_silencieux']) or !$GLOBALS['spip_header_silencieux']) {
874
+        ecrire_fichier(_DIR_VAR . "config.txt",
875
+            (defined('_HEADER_COMPOSED_BY') ? _HEADER_COMPOSED_BY : "Composed-By: SPIP") . ' ' . $GLOBALS['spip_version_affichee'] . " @ www.spip.net + " . $header);
876
+    } else {
877
+        @unlink(_DIR_VAR . "config.txt");
878
+    }
879
+    // generer charger_plugins_chemin.php
880
+    plugins_precompile_chemin($plugin_valides, $ordre);
881
+    // generer les fichiers
882
+    // - charger_plugins_options.php
883
+    // - charger_plugins_fonctions.php
884
+    plugins_precompile_xxxtions($plugin_valides, $ordre);
885
+    // charger les chemins des plugins et les fichiers d'options 
886
+    // (qui peuvent déclarer / utiliser des pipelines, ajouter d'autres chemins)
887
+    plugins_amorcer_plugins_actifs();
888
+    // mise a jour de la matrice des pipelines
889
+    $prepend_code = pipeline_matrice_precompile($plugin_valides, $ordre, $pipe_recherche);
890
+    // generer le fichier _CACHE_PIPELINE
891
+    pipeline_precompile($prepend_code);
892
+
893
+    if (spip_connect()) {
894
+        // lancer et initialiser les nouveaux crons !
895
+        include_spip('inc/genie');
896
+        genie_queue_watch_dist();
897
+    }
898
+
899
+    return ($GLOBALS['meta']['plugin'] != $actifs_avant);
900 900
 }
901 901
 
902 902
 /**
@@ -915,56 +915,56 @@  discard block
 block discarded – undo
915 915
  *     Couples (prefixe => infos complètes) des plugins qui seront actifs, dans l'ordre de leurs dépendances
916 916
 **/
917 917
 function plugins_precompile_chemin($plugin_valides, $ordre) {
918
-	$chemins = array();
919
-	$contenu = "";
920
-	foreach ($ordre as $p => $info) {
921
-		// $ordre peur contenir des plugins en attente et non valides pour ce hit
922
-		if (isset($plugin_valides[$p])) {
923
-			$dir_type = $plugin_valides[$p]['dir_type'];
924
-			$plug = $plugin_valides[$p]['dir'];
925
-			// definir le plugin, donc le path avant l'include du fichier options
926
-			// permet de faire des include_spip pour attraper un inc_ du plugin
927
-
928
-			$dir = $dir_type . ".'" . $plug . "/'";
929
-
930
-			$prefix = strtoupper(preg_replace(',\W,', '_', $info['prefix']));
931
-			if (
932
-				$prefix !== "SPIP"
933
-				and strpos($dir, ":") === false // exclure le cas des procure:
934
-			) {
935
-				$contenu .= "define('_DIR_PLUGIN_$prefix',$dir);\n";
936
-				foreach ($info['chemin'] as $chemin) {
937
-					if (!isset($chemin['version']) or plugin_version_compatible($chemin['version'],
938
-							$GLOBALS['spip_version_branche'], 'spip')
939
-					) {
940
-						$dir = $chemin['path'];
941
-						if (strlen($dir) and $dir{0} == "/") {
942
-							$dir = substr($dir, 1);
943
-						}
944
-						if (strlen($dir) and $dir == "./") {
945
-							$dir = '';
946
-						}
947
-						if (strlen($dir)) {
948
-							$dir = rtrim($dir, '/') . '/';
949
-						}
950
-						if (!isset($chemin['type']) or $chemin['type'] == 'public') {
951
-							$chemins['public'][] = "_DIR_PLUGIN_$prefix" . (strlen($dir) ? ".'$dir'" : "");
952
-						}
953
-						if (!isset($chemin['type']) or $chemin['type'] == 'prive') {
954
-							$chemins['prive'][] = "_DIR_PLUGIN_$prefix" . (strlen($dir) ? ".'$dir'" : "");
955
-						}
956
-					}
957
-				}
958
-			}
959
-		}
960
-	}
961
-	if (count($chemins)) {
962
-		$contenu .= "if (_DIR_RESTREINT) _chemin(implode(':',array(" . implode(',',
963
-				array_reverse($chemins['public'])) . ")));\n"
964
-			. "else _chemin(implode(':',array(" . implode(',', array_reverse($chemins['prive'])) . ")));\n";
965
-	}
966
-
967
-	ecrire_fichier_php(_CACHE_PLUGINS_PATH, $contenu);
918
+    $chemins = array();
919
+    $contenu = "";
920
+    foreach ($ordre as $p => $info) {
921
+        // $ordre peur contenir des plugins en attente et non valides pour ce hit
922
+        if (isset($plugin_valides[$p])) {
923
+            $dir_type = $plugin_valides[$p]['dir_type'];
924
+            $plug = $plugin_valides[$p]['dir'];
925
+            // definir le plugin, donc le path avant l'include du fichier options
926
+            // permet de faire des include_spip pour attraper un inc_ du plugin
927
+
928
+            $dir = $dir_type . ".'" . $plug . "/'";
929
+
930
+            $prefix = strtoupper(preg_replace(',\W,', '_', $info['prefix']));
931
+            if (
932
+                $prefix !== "SPIP"
933
+                and strpos($dir, ":") === false // exclure le cas des procure:
934
+            ) {
935
+                $contenu .= "define('_DIR_PLUGIN_$prefix',$dir);\n";
936
+                foreach ($info['chemin'] as $chemin) {
937
+                    if (!isset($chemin['version']) or plugin_version_compatible($chemin['version'],
938
+                            $GLOBALS['spip_version_branche'], 'spip')
939
+                    ) {
940
+                        $dir = $chemin['path'];
941
+                        if (strlen($dir) and $dir{0} == "/") {
942
+                            $dir = substr($dir, 1);
943
+                        }
944
+                        if (strlen($dir) and $dir == "./") {
945
+                            $dir = '';
946
+                        }
947
+                        if (strlen($dir)) {
948
+                            $dir = rtrim($dir, '/') . '/';
949
+                        }
950
+                        if (!isset($chemin['type']) or $chemin['type'] == 'public') {
951
+                            $chemins['public'][] = "_DIR_PLUGIN_$prefix" . (strlen($dir) ? ".'$dir'" : "");
952
+                        }
953
+                        if (!isset($chemin['type']) or $chemin['type'] == 'prive') {
954
+                            $chemins['prive'][] = "_DIR_PLUGIN_$prefix" . (strlen($dir) ? ".'$dir'" : "");
955
+                        }
956
+                    }
957
+                }
958
+            }
959
+        }
960
+    }
961
+    if (count($chemins)) {
962
+        $contenu .= "if (_DIR_RESTREINT) _chemin(implode(':',array(" . implode(',',
963
+                array_reverse($chemins['public'])) . ")));\n"
964
+            . "else _chemin(implode(':',array(" . implode(',', array_reverse($chemins['prive'])) . ")));\n";
965
+    }
966
+
967
+    ecrire_fichier_php(_CACHE_PLUGINS_PATH, $contenu);
968 968
 }
969 969
 
970 970
 /**
@@ -982,65 +982,65 @@  discard block
 block discarded – undo
982 982
  *     Couples (prefixe => infos complètes) des plugins qui seront actifs, dans l'ordre de leurs dépendances
983 983
 **/
984 984
 function plugins_precompile_xxxtions($plugin_valides, $ordre) {
985
-	$contenu = array('options' => '', 'fonctions' => '');
986
-	$boutons = array();
987
-	$onglets = array();
988
-	$sign = "";
989
-
990
-	foreach ($ordre as $p => $info) {
991
-		// $ordre peur contenir des plugins en attente et non valides pour ce hit
992
-		if (isset($plugin_valides[$p])) {
993
-			$dir_type = $plugin_valides[$p]['dir_type'];
994
-			$plug = $plugin_valides[$p]['dir'];
995
-			$dir = constant($dir_type);
996
-			$root_dir_type = str_replace('_DIR_', '_ROOT_', $dir_type);
997
-			if ($info['menu']) {
998
-				$boutons = array_merge($boutons, $info['menu']);
999
-			}
1000
-			if ($info['onglet']) {
1001
-				$onglets = array_merge($onglets, $info['onglet']);
1002
-			}
1003
-			foreach ($contenu as $charge => $v) {
1004
-				// si pas declare/detecte a la lecture du paquet.xml,
1005
-				// detecer a nouveau ici puisque son ajout ne provoque pas une modif du paquet.xml
1006
-				// donc ni sa relecture, ni sa detection
1007
-				if (!isset($info[$charge])
1008
-					and $dir // exclure le cas du plugin "SPIP"
1009
-					and strpos($dir, ":") === false // exclure le cas des procure:
1010
-					and file_exists("$dir$plug/paquet.xml") // uniquement pour les paquet.xml
1011
-				) {
1012
-					if (is_readable("$dir$plug/" . ($file = $info['prefix'] . "_" . $charge . ".php"))) {
1013
-						$info[$charge] = array($file);
1014
-					}
1015
-				}
1016
-				if (isset($info[$charge])) {
1017
-					$files = $info[$charge];
1018
-					foreach ($files as $k => $file) {
1019
-						// on genere un if file_exists devant chaque include
1020
-						// pour pouvoir garder le meme niveau d'erreur general
1021
-						$file = trim($file);
1022
-						if (!is_readable("$dir$plug/$file")
1023
-							// uniquement pour les paquet.xml
1024
-							and file_exists("$dir$plug/paquet.xml")
1025
-						) {
1026
-							unset($info[$charge][$k]);
1027
-						} else {
1028
-							$_file = $root_dir_type . ".'$plug/$file'";
1029
-							$contenu[$charge] .= "include_once_check($_file);\n";
1030
-						}
1031
-					}
1032
-				}
1033
-			}
1034
-			$sign .= md5(serialize($info));
1035
-		}
1036
-	}
1037
-
1038
-	$contenu['options'] = "define('_PLUGINS_HASH','" . md5($sign) . "');\n" . $contenu['options'];
1039
-	$contenu['fonctions'] .= plugin_ongletbouton("boutons_plugins", $boutons)
1040
-		. plugin_ongletbouton("onglets_plugins", $onglets);
1041
-
1042
-	ecrire_fichier_php(_CACHE_PLUGINS_OPT, $contenu['options']);
1043
-	ecrire_fichier_php(_CACHE_PLUGINS_FCT, $contenu['fonctions']);
985
+    $contenu = array('options' => '', 'fonctions' => '');
986
+    $boutons = array();
987
+    $onglets = array();
988
+    $sign = "";
989
+
990
+    foreach ($ordre as $p => $info) {
991
+        // $ordre peur contenir des plugins en attente et non valides pour ce hit
992
+        if (isset($plugin_valides[$p])) {
993
+            $dir_type = $plugin_valides[$p]['dir_type'];
994
+            $plug = $plugin_valides[$p]['dir'];
995
+            $dir = constant($dir_type);
996
+            $root_dir_type = str_replace('_DIR_', '_ROOT_', $dir_type);
997
+            if ($info['menu']) {
998
+                $boutons = array_merge($boutons, $info['menu']);
999
+            }
1000
+            if ($info['onglet']) {
1001
+                $onglets = array_merge($onglets, $info['onglet']);
1002
+            }
1003
+            foreach ($contenu as $charge => $v) {
1004
+                // si pas declare/detecte a la lecture du paquet.xml,
1005
+                // detecer a nouveau ici puisque son ajout ne provoque pas une modif du paquet.xml
1006
+                // donc ni sa relecture, ni sa detection
1007
+                if (!isset($info[$charge])
1008
+                    and $dir // exclure le cas du plugin "SPIP"
1009
+                    and strpos($dir, ":") === false // exclure le cas des procure:
1010
+                    and file_exists("$dir$plug/paquet.xml") // uniquement pour les paquet.xml
1011
+                ) {
1012
+                    if (is_readable("$dir$plug/" . ($file = $info['prefix'] . "_" . $charge . ".php"))) {
1013
+                        $info[$charge] = array($file);
1014
+                    }
1015
+                }
1016
+                if (isset($info[$charge])) {
1017
+                    $files = $info[$charge];
1018
+                    foreach ($files as $k => $file) {
1019
+                        // on genere un if file_exists devant chaque include
1020
+                        // pour pouvoir garder le meme niveau d'erreur general
1021
+                        $file = trim($file);
1022
+                        if (!is_readable("$dir$plug/$file")
1023
+                            // uniquement pour les paquet.xml
1024
+                            and file_exists("$dir$plug/paquet.xml")
1025
+                        ) {
1026
+                            unset($info[$charge][$k]);
1027
+                        } else {
1028
+                            $_file = $root_dir_type . ".'$plug/$file'";
1029
+                            $contenu[$charge] .= "include_once_check($_file);\n";
1030
+                        }
1031
+                    }
1032
+                }
1033
+            }
1034
+            $sign .= md5(serialize($info));
1035
+        }
1036
+    }
1037
+
1038
+    $contenu['options'] = "define('_PLUGINS_HASH','" . md5($sign) . "');\n" . $contenu['options'];
1039
+    $contenu['fonctions'] .= plugin_ongletbouton("boutons_plugins", $boutons)
1040
+        . plugin_ongletbouton("onglets_plugins", $onglets);
1041
+
1042
+    ecrire_fichier_php(_CACHE_PLUGINS_OPT, $contenu['options']);
1043
+    ecrire_fichier_php(_CACHE_PLUGINS_FCT, $contenu['fonctions']);
1044 1044
 }
1045 1045
 
1046 1046
 /**
@@ -1059,24 +1059,24 @@  discard block
 block discarded – undo
1059 1059
  * @return string Code php
1060 1060
  */
1061 1061
 function plugin_ongletbouton($nom, $val) {
1062
-	if (!$val) {
1063
-		$val = array();
1064
-	}
1065
-
1066
-	$val = serialize($val);
1067
-	$md5 = md5($val);
1068
-
1069
-	if (!defined("_UPDATED_$nom")) {
1070
-		define("_UPDATED_$nom", $val);
1071
-		define("_UPDATED_md5_$nom", $md5);
1072
-	}
1073
-	$val = "unserialize('" . str_replace("'", "\'", $val) . "')";
1074
-
1075
-	return
1076
-		"if (!function_exists('$nom')) {\n"
1077
-		. "function $nom(){return defined('_UPDATED_$nom')?unserialize(_UPDATED_$nom):$val;}\n"
1078
-		. "function md5_$nom(){return defined('_UPDATED_md5_$nom')?_UPDATED_md5_$nom:'" . $md5 . "';}\n"
1079
-		. "}\n";
1062
+    if (!$val) {
1063
+        $val = array();
1064
+    }
1065
+
1066
+    $val = serialize($val);
1067
+    $md5 = md5($val);
1068
+
1069
+    if (!defined("_UPDATED_$nom")) {
1070
+        define("_UPDATED_$nom", $val);
1071
+        define("_UPDATED_md5_$nom", $md5);
1072
+    }
1073
+    $val = "unserialize('" . str_replace("'", "\'", $val) . "')";
1074
+
1075
+    return
1076
+        "if (!function_exists('$nom')) {\n"
1077
+        . "function $nom(){return defined('_UPDATED_$nom')?unserialize(_UPDATED_$nom):$val;}\n"
1078
+        . "function md5_$nom(){return defined('_UPDATED_md5_$nom')?_UPDATED_md5_$nom:'" . $md5 . "';}\n"
1079
+        . "}\n";
1080 1080
 }
1081 1081
 
1082 1082
 /**
@@ -1091,15 +1091,15 @@  discard block
 block discarded – undo
1091 1091
 **/
1092 1092
 function plugins_amorcer_plugins_actifs() {
1093 1093
 
1094
-	if (@is_readable(_CACHE_PLUGINS_PATH)) {
1095
-		include_once(_CACHE_PLUGINS_PATH);
1096
-	} 
1094
+    if (@is_readable(_CACHE_PLUGINS_PATH)) {
1095
+        include_once(_CACHE_PLUGINS_PATH);
1096
+    } 
1097 1097
 
1098
-	if (@is_readable(_CACHE_PLUGINS_OPT)) {
1099
-		include_once(_CACHE_PLUGINS_OPT);
1100
-	} else {
1101
-		spip_log("pipelines desactives: impossible de produire " . _CACHE_PLUGINS_OPT);
1102
-	}
1098
+    if (@is_readable(_CACHE_PLUGINS_OPT)) {
1099
+        include_once(_CACHE_PLUGINS_OPT);
1100
+    } else {
1101
+        spip_log("pipelines desactives: impossible de produire " . _CACHE_PLUGINS_OPT);
1102
+    }
1103 1103
 }
1104 1104
 
1105 1105
 /**
@@ -1122,136 +1122,136 @@  discard block
 block discarded – undo
1122 1122
  *     Couples (nom du pipeline => Code PHP à insérer au début du pipeline)
1123 1123
 **/
1124 1124
 function pipeline_matrice_precompile($plugin_valides, $ordre, $pipe_recherche) {
1125
-	static $liste_pipe_manquants = array();
1126
-	if (($pipe_recherche) && (!in_array($pipe_recherche, $liste_pipe_manquants))) {
1127
-		$liste_pipe_manquants[] = $pipe_recherche;
1128
-	}
1129
-
1130
-	$prepend_code = array();
1131
-
1132
-	foreach ($ordre as $p => $info) {
1133
-		// $ordre peur contenir des plugins en attente et non valides pour ce hit
1134
-		if (isset($plugin_valides[$p])) {
1135
-			$dir_type = $plugin_valides[$p]['dir_type'];
1136
-			$root_dir_type = str_replace('_DIR_', '_ROOT_', $dir_type);
1137
-			$plug = $plugin_valides[$p]['dir'];
1138
-			$prefix = (($info['prefix'] == "spip") ? "" : $info['prefix'] . "_");
1139
-			if (isset($info['pipeline']) and is_array($info['pipeline'])) {
1140
-				foreach ($info['pipeline'] as $pipe) {
1141
-					$nom = $pipe['nom'];
1142
-					if (isset($pipe['action'])) {
1143
-						$action = $pipe['action'];
1144
-					} else {
1145
-						$action = $nom;
1146
-					}
1147
-					$nomlower = strtolower($nom);
1148
-					if ($nomlower != $nom
1149
-						and isset($GLOBALS['spip_pipeline'][$nom])
1150
-						and !isset($GLOBALS['spip_pipeline'][$nomlower])
1151
-					) {
1152
-						$GLOBALS['spip_pipeline'][$nomlower] = $GLOBALS['spip_pipeline'][$nom];
1153
-						unset($GLOBALS['spip_pipeline'][$nom]);
1154
-					}
1155
-					$nom = $nomlower;
1156
-					// une action vide est une declaration qui ne doit pas etre compilee !
1157
-					if (!isset($GLOBALS['spip_pipeline'][$nom])) // creer le pipeline eventuel
1158
-					{
1159
-						$GLOBALS['spip_pipeline'][$nom] = "";
1160
-					}
1161
-					if ($action) {
1162
-						if (strpos($GLOBALS['spip_pipeline'][$nom], "|$prefix$action") === false) {
1163
-							$GLOBALS['spip_pipeline'][$nom] = preg_replace(",(\|\||$),", "|$prefix$action\\1",
1164
-								$GLOBALS['spip_pipeline'][$nom], 1);
1165
-						}
1166
-						if (isset($pipe['inclure'])) {
1167
-							$GLOBALS['spip_matrice']["$prefix$action"] =
1168
-								"$root_dir_type:$plug/" . $pipe['inclure'];
1169
-						}
1170
-					}
1171
-				}
1172
-			}
1173
-			if (isset($info['genie']) and count($info['genie'])) {
1174
-				if (!isset($prepend_code['taches_generales_cron'])) {
1175
-					$prepend_code['taches_generales_cron'] = "";
1176
-				}
1177
-				foreach ($info['genie'] as $genie) {
1178
-					$nom = $prefix . $genie['nom'];
1179
-					$periode = max(60, intval($genie['periode']));
1180
-					if (charger_fonction($nom, "genie", true)) {
1181
-						$prepend_code['taches_generales_cron'] .= "\$val['$nom'] = $periode;\n";
1182
-					} else {
1183
-						spip_log("Fonction genie_$nom introuvable", _LOG_ERREUR);
1184
-					}
1185
-				}
1186
-			}
1187
-			if (isset($info['style']) and count($info['style'])) {
1188
-				if (!isset($prepend_code['insert_head_css'])) {
1189
-					$prepend_code['insert_head_css'] = "";
1190
-				}
1191
-				if (!isset($prepend_code['header_prive_css'])) {
1192
-					$prepend_code['header_prive_css'] = "";
1193
-				}
1194
-				foreach ($info['style'] as $style) {
1195
-					if (isset($style['path']) and $style['path']) {
1196
-						$code = "if (\$f=timestamp(direction_css(find_in_path('" . addslashes($style['path']) . "')))) ";
1197
-					} else {
1198
-						$code = "if (\$f='" . addslashes($style['url']) . "') ";
1199
-					}
1200
-					$code .= "\$val .= '<link rel=\"stylesheet\" href=\"'.\$f.'\" type=\"text/css\"";
1201
-					if (isset($style['media']) and strlen($style['media'])) {
1202
-						$code .= " media=\"" . addslashes($style['media']) . "\"";
1203
-					}
1204
-					$code .= "/>';\n";
1205
-					if ($style['type'] != 'prive') {
1206
-						$prepend_code['insert_head_css'] .= $code;
1207
-					}
1208
-					if ($style['type'] != 'public') {
1209
-						$prepend_code['header_prive_css'] .= $code;
1210
-					}
1211
-				}
1212
-			}
1213
-			if (!isset($prepend_code['insert_head'])) {
1214
-				$prepend_code['insert_head'] = "";
1215
-			}
1216
-			if (!isset($prepend_code['header_prive'])) {
1217
-				$prepend_code['header_prive'] = "";
1218
-			}
1219
-			if (isset($info['script']) and count($info['script'])) {
1220
-				foreach ($info['script'] as $script) {
1221
-					if (isset($script['path']) and $script['path']) {
1222
-						$code = "if (\$f=timestamp(find_in_path('" . addslashes($script['path']) . "'))) ";
1223
-					} else {
1224
-						$code = "if (\$f='" . addslashes($script['url']) . "') ";
1225
-					}
1226
-					$code .= "\$val .= '<script src=\"'.\$f.'\" type=\"text/javascript\"></script>';\n";
1227
-					if ($script['type'] != 'prive') {
1228
-						$prepend_code['insert_head'] .= $code;
1229
-					}
1230
-					if ($script['type'] != 'public') {
1231
-						$prepend_code['header_prive'] .= $code;
1232
-					}
1233
-				}
1234
-			}
1235
-		}
1236
-	}
1237
-
1238
-	$prepend_code['insert_head'] =
1239
-		"include_once_check(_DIR_RESTREINT . 'inc/pipelines.php');\n"
1240
-		. "\$val = minipipe('f_jQuery', \$val);\n"
1241
-		. $prepend_code['insert_head'];
1242
-	$prepend_code['header_prive'] =
1243
-		"include_once_check(_DIR_RESTREINT . 'inc/pipelines_ecrire.php');\n"
1244
-		. "\$val = minipipe('f_jQuery_prive', \$val);\n"
1245
-		. $prepend_code['header_prive'];
1246
-
1247
-	// on ajoute les pipe qui ont ete recenses manquants
1248
-	foreach ($liste_pipe_manquants as $add_pipe) {
1249
-		if (!isset($GLOBALS['spip_pipeline'][$add_pipe])) {
1250
-			$GLOBALS['spip_pipeline'][$add_pipe] = '';
1251
-		}
1252
-	}
1253
-
1254
-	return $prepend_code;
1125
+    static $liste_pipe_manquants = array();
1126
+    if (($pipe_recherche) && (!in_array($pipe_recherche, $liste_pipe_manquants))) {
1127
+        $liste_pipe_manquants[] = $pipe_recherche;
1128
+    }
1129
+
1130
+    $prepend_code = array();
1131
+
1132
+    foreach ($ordre as $p => $info) {
1133
+        // $ordre peur contenir des plugins en attente et non valides pour ce hit
1134
+        if (isset($plugin_valides[$p])) {
1135
+            $dir_type = $plugin_valides[$p]['dir_type'];
1136
+            $root_dir_type = str_replace('_DIR_', '_ROOT_', $dir_type);
1137
+            $plug = $plugin_valides[$p]['dir'];
1138
+            $prefix = (($info['prefix'] == "spip") ? "" : $info['prefix'] . "_");
1139
+            if (isset($info['pipeline']) and is_array($info['pipeline'])) {
1140
+                foreach ($info['pipeline'] as $pipe) {
1141
+                    $nom = $pipe['nom'];
1142
+                    if (isset($pipe['action'])) {
1143
+                        $action = $pipe['action'];
1144
+                    } else {
1145
+                        $action = $nom;
1146
+                    }
1147
+                    $nomlower = strtolower($nom);
1148
+                    if ($nomlower != $nom
1149
+                        and isset($GLOBALS['spip_pipeline'][$nom])
1150
+                        and !isset($GLOBALS['spip_pipeline'][$nomlower])
1151
+                    ) {
1152
+                        $GLOBALS['spip_pipeline'][$nomlower] = $GLOBALS['spip_pipeline'][$nom];
1153
+                        unset($GLOBALS['spip_pipeline'][$nom]);
1154
+                    }
1155
+                    $nom = $nomlower;
1156
+                    // une action vide est une declaration qui ne doit pas etre compilee !
1157
+                    if (!isset($GLOBALS['spip_pipeline'][$nom])) // creer le pipeline eventuel
1158
+                    {
1159
+                        $GLOBALS['spip_pipeline'][$nom] = "";
1160
+                    }
1161
+                    if ($action) {
1162
+                        if (strpos($GLOBALS['spip_pipeline'][$nom], "|$prefix$action") === false) {
1163
+                            $GLOBALS['spip_pipeline'][$nom] = preg_replace(",(\|\||$),", "|$prefix$action\\1",
1164
+                                $GLOBALS['spip_pipeline'][$nom], 1);
1165
+                        }
1166
+                        if (isset($pipe['inclure'])) {
1167
+                            $GLOBALS['spip_matrice']["$prefix$action"] =
1168
+                                "$root_dir_type:$plug/" . $pipe['inclure'];
1169
+                        }
1170
+                    }
1171
+                }
1172
+            }
1173
+            if (isset($info['genie']) and count($info['genie'])) {
1174
+                if (!isset($prepend_code['taches_generales_cron'])) {
1175
+                    $prepend_code['taches_generales_cron'] = "";
1176
+                }
1177
+                foreach ($info['genie'] as $genie) {
1178
+                    $nom = $prefix . $genie['nom'];
1179
+                    $periode = max(60, intval($genie['periode']));
1180
+                    if (charger_fonction($nom, "genie", true)) {
1181
+                        $prepend_code['taches_generales_cron'] .= "\$val['$nom'] = $periode;\n";
1182
+                    } else {
1183
+                        spip_log("Fonction genie_$nom introuvable", _LOG_ERREUR);
1184
+                    }
1185
+                }
1186
+            }
1187
+            if (isset($info['style']) and count($info['style'])) {
1188
+                if (!isset($prepend_code['insert_head_css'])) {
1189
+                    $prepend_code['insert_head_css'] = "";
1190
+                }
1191
+                if (!isset($prepend_code['header_prive_css'])) {
1192
+                    $prepend_code['header_prive_css'] = "";
1193
+                }
1194
+                foreach ($info['style'] as $style) {
1195
+                    if (isset($style['path']) and $style['path']) {
1196
+                        $code = "if (\$f=timestamp(direction_css(find_in_path('" . addslashes($style['path']) . "')))) ";
1197
+                    } else {
1198
+                        $code = "if (\$f='" . addslashes($style['url']) . "') ";
1199
+                    }
1200
+                    $code .= "\$val .= '<link rel=\"stylesheet\" href=\"'.\$f.'\" type=\"text/css\"";
1201
+                    if (isset($style['media']) and strlen($style['media'])) {
1202
+                        $code .= " media=\"" . addslashes($style['media']) . "\"";
1203
+                    }
1204
+                    $code .= "/>';\n";
1205
+                    if ($style['type'] != 'prive') {
1206
+                        $prepend_code['insert_head_css'] .= $code;
1207
+                    }
1208
+                    if ($style['type'] != 'public') {
1209
+                        $prepend_code['header_prive_css'] .= $code;
1210
+                    }
1211
+                }
1212
+            }
1213
+            if (!isset($prepend_code['insert_head'])) {
1214
+                $prepend_code['insert_head'] = "";
1215
+            }
1216
+            if (!isset($prepend_code['header_prive'])) {
1217
+                $prepend_code['header_prive'] = "";
1218
+            }
1219
+            if (isset($info['script']) and count($info['script'])) {
1220
+                foreach ($info['script'] as $script) {
1221
+                    if (isset($script['path']) and $script['path']) {
1222
+                        $code = "if (\$f=timestamp(find_in_path('" . addslashes($script['path']) . "'))) ";
1223
+                    } else {
1224
+                        $code = "if (\$f='" . addslashes($script['url']) . "') ";
1225
+                    }
1226
+                    $code .= "\$val .= '<script src=\"'.\$f.'\" type=\"text/javascript\"></script>';\n";
1227
+                    if ($script['type'] != 'prive') {
1228
+                        $prepend_code['insert_head'] .= $code;
1229
+                    }
1230
+                    if ($script['type'] != 'public') {
1231
+                        $prepend_code['header_prive'] .= $code;
1232
+                    }
1233
+                }
1234
+            }
1235
+        }
1236
+    }
1237
+
1238
+    $prepend_code['insert_head'] =
1239
+        "include_once_check(_DIR_RESTREINT . 'inc/pipelines.php');\n"
1240
+        . "\$val = minipipe('f_jQuery', \$val);\n"
1241
+        . $prepend_code['insert_head'];
1242
+    $prepend_code['header_prive'] =
1243
+        "include_once_check(_DIR_RESTREINT . 'inc/pipelines_ecrire.php');\n"
1244
+        . "\$val = minipipe('f_jQuery_prive', \$val);\n"
1245
+        . $prepend_code['header_prive'];
1246
+
1247
+    // on ajoute les pipe qui ont ete recenses manquants
1248
+    foreach ($liste_pipe_manquants as $add_pipe) {
1249
+        if (!isset($GLOBALS['spip_pipeline'][$add_pipe])) {
1250
+            $GLOBALS['spip_pipeline'][$add_pipe] = '';
1251
+        }
1252
+    }
1253
+
1254
+    return $prepend_code;
1255 1255
 }
1256 1256
 
1257 1257
 /**
@@ -1278,44 +1278,44 @@  discard block
 block discarded – undo
1278 1278
 **/
1279 1279
 function pipeline_precompile($prepend_code = array()) {
1280 1280
 
1281
-	$content = "";
1282
-	foreach ($GLOBALS['spip_pipeline'] as $action => $pipeline) {
1283
-		$s_inc = "";
1284
-		$s_call = "";
1285
-		$pipe = array_filter(explode('|', $pipeline));
1286
-		// Eclater le pipeline en filtres et appliquer chaque filtre
1287
-		foreach ($pipe as $fonc) {
1288
-			$fonc = trim($fonc);
1289
-			$s_call .= '$val = minipipe(\'' . $fonc . '\', $val);' . "\n";
1290
-			if (isset($GLOBALS['spip_matrice'][$fonc])) {
1291
-				$file = $GLOBALS['spip_matrice'][$fonc];
1292
-				$file = "'$file'";
1293
-				// si un _DIR_XXX: est dans la chaine, on extrait la constante
1294
-				if (preg_match(",(_(DIR|ROOT)_[A-Z_]+):,Ums", $file, $regs)) {
1295
-					$dir = $regs[1];
1296
-					$root_dir = str_replace('_DIR_', '_ROOT_', $dir);
1297
-					if (defined($root_dir)) {
1298
-						$dir = $root_dir;
1299
-					}
1300
-					$file = str_replace($regs[0], "'." . $dir . ".'", $file);
1301
-					$file = str_replace("''.", "", $file);
1302
-					$file = str_replace(constant($dir), '', $file);
1303
-				}
1304
-				$s_inc .= "include_once_check($file);\n";
1305
-			}
1306
-		}
1307
-		if (strlen($s_inc)) {
1308
-			$s_inc = "static \$inc=null;\nif (!\$inc){\n$s_inc\$inc=true;\n}\n";
1309
-		}
1310
-		$content .= "// Pipeline $action \n"
1311
-			. "function execute_pipeline_$action(&\$val){\n"
1312
-			. $s_inc
1313
-			. ((isset($prepend_code[$action]) and strlen($prepend_code[$action])) ? trim($prepend_code[$action]) . "\n" : '')
1314
-			. $s_call
1315
-			. "return \$val;\n}\n";
1316
-	}
1317
-	ecrire_fichier_php(_CACHE_PIPELINES, $content);
1318
-	clear_path_cache();
1281
+    $content = "";
1282
+    foreach ($GLOBALS['spip_pipeline'] as $action => $pipeline) {
1283
+        $s_inc = "";
1284
+        $s_call = "";
1285
+        $pipe = array_filter(explode('|', $pipeline));
1286
+        // Eclater le pipeline en filtres et appliquer chaque filtre
1287
+        foreach ($pipe as $fonc) {
1288
+            $fonc = trim($fonc);
1289
+            $s_call .= '$val = minipipe(\'' . $fonc . '\', $val);' . "\n";
1290
+            if (isset($GLOBALS['spip_matrice'][$fonc])) {
1291
+                $file = $GLOBALS['spip_matrice'][$fonc];
1292
+                $file = "'$file'";
1293
+                // si un _DIR_XXX: est dans la chaine, on extrait la constante
1294
+                if (preg_match(",(_(DIR|ROOT)_[A-Z_]+):,Ums", $file, $regs)) {
1295
+                    $dir = $regs[1];
1296
+                    $root_dir = str_replace('_DIR_', '_ROOT_', $dir);
1297
+                    if (defined($root_dir)) {
1298
+                        $dir = $root_dir;
1299
+                    }
1300
+                    $file = str_replace($regs[0], "'." . $dir . ".'", $file);
1301
+                    $file = str_replace("''.", "", $file);
1302
+                    $file = str_replace(constant($dir), '', $file);
1303
+                }
1304
+                $s_inc .= "include_once_check($file);\n";
1305
+            }
1306
+        }
1307
+        if (strlen($s_inc)) {
1308
+            $s_inc = "static \$inc=null;\nif (!\$inc){\n$s_inc\$inc=true;\n}\n";
1309
+        }
1310
+        $content .= "// Pipeline $action \n"
1311
+            . "function execute_pipeline_$action(&\$val){\n"
1312
+            . $s_inc
1313
+            . ((isset($prepend_code[$action]) and strlen($prepend_code[$action])) ? trim($prepend_code[$action]) . "\n" : '')
1314
+            . $s_call
1315
+            . "return \$val;\n}\n";
1316
+    }
1317
+    ecrire_fichier_php(_CACHE_PIPELINES, $content);
1318
+    clear_path_cache();
1319 1319
 }
1320 1320
 
1321 1321
 
@@ -1328,12 +1328,12 @@  discard block
 block discarded – undo
1328 1328
  *     true si le plugin est actif, false sinon
1329 1329
 **/
1330 1330
 function plugin_est_installe($plug_path) {
1331
-	$plugin_installes = isset($GLOBALS['meta']['plugin_installes']) ? unserialize($GLOBALS['meta']['plugin_installes']) : array();
1332
-	if (!$plugin_installes) {
1333
-		return false;
1334
-	}
1331
+    $plugin_installes = isset($GLOBALS['meta']['plugin_installes']) ? unserialize($GLOBALS['meta']['plugin_installes']) : array();
1332
+    if (!$plugin_installes) {
1333
+        return false;
1334
+    }
1335 1335
 
1336
-	return in_array($plug_path, $plugin_installes);
1336
+    return in_array($plug_path, $plugin_installes);
1337 1337
 }
1338 1338
 
1339 1339
 
@@ -1346,37 +1346,37 @@  discard block
 block discarded – undo
1346 1346
  * @uses plugins_installer_dist()
1347 1347
  **/
1348 1348
 function plugin_installes_meta() {
1349
-	if (isset($GLOBALS['fichier_php_compile_recent'])) {
1350
-		// attendre eventuellement l'invalidation du cache opcode
1351
-		spip_attend_invalidation_opcode_cache($GLOBALS['fichier_php_compile_recent']);
1352
-	}
1353
-
1354
-	$installer_plugins = charger_fonction('installer', 'plugins');
1355
-	$meta_plug_installes = array();
1356
-	foreach (unserialize($GLOBALS['meta']['plugin']) as $prefix => $resume) {
1357
-		if ($plug = $resume['dir']) {
1358
-			$infos = $installer_plugins($plug, 'install', $resume['dir_type']);
1359
-			if ($infos) {
1360
-				if (!is_array($infos) or $infos['install_test'][0]) {
1361
-					$meta_plug_installes[] = $plug;
1362
-				}
1363
-				if (is_array($infos)) {
1364
-					list($ok, $trace) = $infos['install_test'];
1365
-					include_spip('inc/filtres_boites');
1366
-					echo "<div class='install-plugins svp_retour'>"
1367
-						. boite_ouvrir(_T('plugin_titre_installation', array('plugin' => typo($infos['nom']))),
1368
-							($ok ? 'success' : 'error'))
1369
-						. $trace
1370
-						. "<div class='result'>"
1371
-						. ($ok ? ((isset($infos['upgrade']) && $infos['upgrade']) ? _T("plugin_info_upgrade_ok") : _T("plugin_info_install_ok")) : _T("avis_operation_echec"))
1372
-						. "</div>"
1373
-						. boite_fermer()
1374
-						. "</div>";
1375
-				}
1376
-			}
1377
-		}
1378
-	}
1379
-	ecrire_meta('plugin_installes', serialize($meta_plug_installes), 'non');
1349
+    if (isset($GLOBALS['fichier_php_compile_recent'])) {
1350
+        // attendre eventuellement l'invalidation du cache opcode
1351
+        spip_attend_invalidation_opcode_cache($GLOBALS['fichier_php_compile_recent']);
1352
+    }
1353
+
1354
+    $installer_plugins = charger_fonction('installer', 'plugins');
1355
+    $meta_plug_installes = array();
1356
+    foreach (unserialize($GLOBALS['meta']['plugin']) as $prefix => $resume) {
1357
+        if ($plug = $resume['dir']) {
1358
+            $infos = $installer_plugins($plug, 'install', $resume['dir_type']);
1359
+            if ($infos) {
1360
+                if (!is_array($infos) or $infos['install_test'][0]) {
1361
+                    $meta_plug_installes[] = $plug;
1362
+                }
1363
+                if (is_array($infos)) {
1364
+                    list($ok, $trace) = $infos['install_test'];
1365
+                    include_spip('inc/filtres_boites');
1366
+                    echo "<div class='install-plugins svp_retour'>"
1367
+                        . boite_ouvrir(_T('plugin_titre_installation', array('plugin' => typo($infos['nom']))),
1368
+                            ($ok ? 'success' : 'error'))
1369
+                        . $trace
1370
+                        . "<div class='result'>"
1371
+                        . ($ok ? ((isset($infos['upgrade']) && $infos['upgrade']) ? _T("plugin_info_upgrade_ok") : _T("plugin_info_install_ok")) : _T("avis_operation_echec"))
1372
+                        . "</div>"
1373
+                        . boite_fermer()
1374
+                        . "</div>";
1375
+                }
1376
+            }
1377
+        }
1378
+    }
1379
+    ecrire_meta('plugin_installes', serialize($meta_plug_installes), 'non');
1380 1380
 }
1381 1381
 
1382 1382
 /**
@@ -1390,29 +1390,29 @@  discard block
 block discarded – undo
1390 1390
  *     Commentaire : code écrit en tout début de fichier, après la balise PHP ouvrante
1391 1391
 **/
1392 1392
 function ecrire_fichier_php($nom, $contenu, $comment = '') {
1393
-	if (!isset($GLOBALS['fichier_php_compile_recent'])) {
1394
-		$GLOBALS['fichier_php_compile_recent'] = 0;
1395
-	}
1396
-
1397
-	$contenu = '<' . '?php' . "\n" . $comment . "\nif (defined('_ECRIRE_INC_VERSION')) {\n" . $contenu . "}\n?" . '>';
1398
-	// si un fichier existe deja on verifie que son contenu change avant de l'ecraser
1399
-	// si pas de modif on ne touche pas au fichier initial
1400
-	if (file_exists($nom)) {
1401
-		if (substr($nom, -4) == '.php') {
1402
-			$fichier_tmp = substr($nom, 0, -4) . '.tmp.php';
1403
-		}
1404
-		else {
1405
-			$fichier_tmp = $nom . '.tmp';
1406
-		}
1407
-		file_put_contents($fichier_tmp, $contenu);
1408
-		if(md5_file($nom) == md5_file($fichier_tmp)) {
1409
-			$GLOBALS['fichier_php_compile_recent'] = max($GLOBALS['fichier_php_compile_recent'], filemtime($nom));
1410
-			@unlink($fichier_tmp);
1411
-			return;
1412
-		}
1413
-		@unlink($fichier_tmp);
1414
-	}
1415
-	ecrire_fichier($nom, $contenu);
1416
-	$GLOBALS['fichier_php_compile_recent'] = max($GLOBALS['fichier_php_compile_recent'], filemtime($nom));
1417
-	spip_clear_opcode_cache(realpath($nom));
1393
+    if (!isset($GLOBALS['fichier_php_compile_recent'])) {
1394
+        $GLOBALS['fichier_php_compile_recent'] = 0;
1395
+    }
1396
+
1397
+    $contenu = '<' . '?php' . "\n" . $comment . "\nif (defined('_ECRIRE_INC_VERSION')) {\n" . $contenu . "}\n?" . '>';
1398
+    // si un fichier existe deja on verifie que son contenu change avant de l'ecraser
1399
+    // si pas de modif on ne touche pas au fichier initial
1400
+    if (file_exists($nom)) {
1401
+        if (substr($nom, -4) == '.php') {
1402
+            $fichier_tmp = substr($nom, 0, -4) . '.tmp.php';
1403
+        }
1404
+        else {
1405
+            $fichier_tmp = $nom . '.tmp';
1406
+        }
1407
+        file_put_contents($fichier_tmp, $contenu);
1408
+        if(md5_file($nom) == md5_file($fichier_tmp)) {
1409
+            $GLOBALS['fichier_php_compile_recent'] = max($GLOBALS['fichier_php_compile_recent'], filemtime($nom));
1410
+            @unlink($fichier_tmp);
1411
+            return;
1412
+        }
1413
+        @unlink($fichier_tmp);
1414
+    }
1415
+    ecrire_fichier($nom, $contenu);
1416
+    $GLOBALS['fichier_php_compile_recent'] = max($GLOBALS['fichier_php_compile_recent'], filemtime($nom));
1417
+    spip_clear_opcode_cache(realpath($nom));
1418 1418
 }
Please login to merge, or discard this patch.
ecrire/plugins/afficher_plugin.php 2 patches
Indentation   +268 added lines, -268 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 include_spip('inc/charsets');
23 23
 include_spip('inc/texte');
@@ -25,181 +25,181 @@  discard block
 block discarded – undo
25 25
 
26 26
 // http://code.spip.net/@ligne_plug
27 27
 function plugins_afficher_plugin_dist(
28
-	$url_page,
29
-	$plug_file,
30
-	$checked,
31
-	$actif,
32
-	$expose = false,
33
-	$class_li = "item",
34
-	$dir_plugins = _DIR_PLUGINS
28
+    $url_page,
29
+    $plug_file,
30
+    $checked,
31
+    $actif,
32
+    $expose = false,
33
+    $class_li = "item",
34
+    $dir_plugins = _DIR_PLUGINS
35 35
 ) {
36 36
 
37
-	static $id_input = 0;
38
-	static $versions = array();
39
-
40
-	$force_reload = (_request('var_mode') == 'recalcul');
41
-	$get_infos = charger_fonction('get_infos', 'plugins');
42
-	$info = $get_infos($plug_file, $force_reload, $dir_plugins);
43
-	$prefix = $info['prefix'];
44
-	$cfg = "";
45
-	$checkable = ($dir_plugins !== _DIR_PLUGINS_DIST);
46
-	$nom = plugin_nom($info, $dir_plugins, $plug_file);
47
-	$erreur = "";
48
-
49
-	if (!plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
50
-		$info['slogan'] = _T('plugin_info_non_compatible_spip');
51
-		$erreur = http_img_pack("plugin-dis-32.png", _T('plugin_info_non_compatible_spip'), " class='picto_err'",
52
-			_T('plugin_info_non_compatible_spip'));
53
-		$class_li .= " disabled";
54
-		$checkable = false;
55
-	} elseif (isset($info['erreur'])) {
56
-		$class_li .= " error";
57
-		$erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'",
58
-				_T('plugin_info_erreur_xml'))
59
-			. "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>";
60
-		$checkable = false;
61
-	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
62
-		$class_li .= " error";
63
-		$erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)),
64
-				" class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom)))
65
-			. "<div class='erreur'>" . implode("<br />",
66
-				$GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>";
67
-	} else {
68
-		$cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : "";
69
-	}
70
-
71
-	// numerotons les occurrences d'un meme prefix
72
-	$versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
73
-
74
-	$class_li .= ($actif ? " actif" : "") . ($expose ? " on" : "");
75
-
76
-	return "<li id='$prefix$id' class='$class_li'>"
77
-	. ((!$checkable and !$checked)
78
-		? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
79
-	. plugin_resume($info, $dir_plugins, $plug_file, $url_page)
80
-	. $cfg
81
-	. $erreur
82
-	. (($dir_plugins !== _DIR_PLUGINS_DIST and plugin_est_installe($plug_file))
83
-		? plugin_desintalle($plug_file, $nom, $dir_plugins) : '')
84
-	. "<div class='details'>" // pour l'ajax de exec/info_plugin
85
-	. (!$expose ? '' : affiche_bloc_plugin($plug_file, $info, $dir_plugins))
86
-	. "</div>"
87
-	. "</li>";
37
+    static $id_input = 0;
38
+    static $versions = array();
39
+
40
+    $force_reload = (_request('var_mode') == 'recalcul');
41
+    $get_infos = charger_fonction('get_infos', 'plugins');
42
+    $info = $get_infos($plug_file, $force_reload, $dir_plugins);
43
+    $prefix = $info['prefix'];
44
+    $cfg = "";
45
+    $checkable = ($dir_plugins !== _DIR_PLUGINS_DIST);
46
+    $nom = plugin_nom($info, $dir_plugins, $plug_file);
47
+    $erreur = "";
48
+
49
+    if (!plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
50
+        $info['slogan'] = _T('plugin_info_non_compatible_spip');
51
+        $erreur = http_img_pack("plugin-dis-32.png", _T('plugin_info_non_compatible_spip'), " class='picto_err'",
52
+            _T('plugin_info_non_compatible_spip'));
53
+        $class_li .= " disabled";
54
+        $checkable = false;
55
+    } elseif (isset($info['erreur'])) {
56
+        $class_li .= " error";
57
+        $erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'",
58
+                _T('plugin_info_erreur_xml'))
59
+            . "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>";
60
+        $checkable = false;
61
+    } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
62
+        $class_li .= " error";
63
+        $erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)),
64
+                " class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom)))
65
+            . "<div class='erreur'>" . implode("<br />",
66
+                $GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>";
67
+    } else {
68
+        $cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : "";
69
+    }
70
+
71
+    // numerotons les occurrences d'un meme prefix
72
+    $versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
73
+
74
+    $class_li .= ($actif ? " actif" : "") . ($expose ? " on" : "");
75
+
76
+    return "<li id='$prefix$id' class='$class_li'>"
77
+    . ((!$checkable and !$checked)
78
+        ? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
79
+    . plugin_resume($info, $dir_plugins, $plug_file, $url_page)
80
+    . $cfg
81
+    . $erreur
82
+    . (($dir_plugins !== _DIR_PLUGINS_DIST and plugin_est_installe($plug_file))
83
+        ? plugin_desintalle($plug_file, $nom, $dir_plugins) : '')
84
+    . "<div class='details'>" // pour l'ajax de exec/info_plugin
85
+    . (!$expose ? '' : affiche_bloc_plugin($plug_file, $info, $dir_plugins))
86
+    . "</div>"
87
+    . "</li>";
88 88
 }
89 89
 
90 90
 function plugin_bouton_config($nom, $infos, $dir) {
91
-	// la verification se base sur le filesystem
92
-	// il faut donc n'utiliser que des minuscules, par convention
93
-	$prefix = strtolower($infos['prefix']);
94
-	// si paquet.xml fournit un squelette, le prendre
95
-	if (isset($infos['config']) and $infos['config']) {
96
-		return recuperer_fond("$dir$nom/" . $infos['config'],
97
-			array(
98
-				'script' => 'configurer_' . $prefix,
99
-				'nom' => $nom
100
-			));
101
-	}
102
-
103
-	// si le plugin CFG est la, l'essayer
104
-	if (defined('_DIR_PLUGIN_CFG')) {
105
-		if (include_spip('inc/cfg')) // test CFG version >= 1.0.5
106
-		{
107
-			if ($cfg = icone_lien_cfg("$dir$nom", "cfg")) {
108
-				return "<div class='cfg_link'>$cfg</div>";
109
-			}
110
-		}
111
-	}
112
-
113
-	// sinon prendre le squelette std sur le nom std
114
-	return recuperer_fond("prive/squelettes/inclure/cfg",
115
-		array(
116
-			'script' => 'configurer_' . $prefix,
117
-			'nom' => $nom
118
-		));
91
+    // la verification se base sur le filesystem
92
+    // il faut donc n'utiliser que des minuscules, par convention
93
+    $prefix = strtolower($infos['prefix']);
94
+    // si paquet.xml fournit un squelette, le prendre
95
+    if (isset($infos['config']) and $infos['config']) {
96
+        return recuperer_fond("$dir$nom/" . $infos['config'],
97
+            array(
98
+                'script' => 'configurer_' . $prefix,
99
+                'nom' => $nom
100
+            ));
101
+    }
102
+
103
+    // si le plugin CFG est la, l'essayer
104
+    if (defined('_DIR_PLUGIN_CFG')) {
105
+        if (include_spip('inc/cfg')) // test CFG version >= 1.0.5
106
+        {
107
+            if ($cfg = icone_lien_cfg("$dir$nom", "cfg")) {
108
+                return "<div class='cfg_link'>$cfg</div>";
109
+            }
110
+        }
111
+    }
112
+
113
+    // sinon prendre le squelette std sur le nom std
114
+    return recuperer_fond("prive/squelettes/inclure/cfg",
115
+        array(
116
+            'script' => 'configurer_' . $prefix,
117
+            'nom' => $nom
118
+        ));
119 119
 }
120 120
 
121 121
 // checkbox pour activer ou desactiver
122 122
 // si ce n'est pas une extension
123 123
 
124 124
 function plugin_checkbox($id_input, $file, $actif) {
125
-	$name = substr(md5($file), 0, 16);
126
-
127
-	return "<div class='check'>\n"
128
-	. "<input type='checkbox' name='s$name' id='label_$id_input'"
129
-	. ($actif ? " checked='checked'" : "")
130
-	. " class='checkbox'  value='O' />"
131
-	. "\n<label for='label_$id_input'>" . _T('activer_plugin') . "</label>"
132
-	. "</div>";
125
+    $name = substr(md5($file), 0, 16);
126
+
127
+    return "<div class='check'>\n"
128
+    . "<input type='checkbox' name='s$name' id='label_$id_input'"
129
+    . ($actif ? " checked='checked'" : "")
130
+    . " class='checkbox'  value='O' />"
131
+    . "\n<label for='label_$id_input'>" . _T('activer_plugin') . "</label>"
132
+    . "</div>";
133 133
 }
134 134
 
135 135
 function plugin_nom($info, $dir_plugins, $plug_file) {
136
-	$prefix = $info['prefix'];
137
-	$dir = "$dir_plugins$plug_file";
138
-	// Si dtd paquet, on traite le nom soit par son item de langue soit par sa valeur immediate a l'index "nom"
139
-	if ($info['dtd'] == "paquet") {
140
-		$nom = PtoBR(plugin_propre("{$prefix}_nom", "$dir/lang/paquet-$prefix"));
141
-		if (!$nom) {
142
-			$nom = PtoBR(propre($info['nom']));
143
-		}
144
-	} else {
145
-		$nom = typo(attribut_html($info['nom']));
146
-	}
147
-
148
-	return trim($nom);
136
+    $prefix = $info['prefix'];
137
+    $dir = "$dir_plugins$plug_file";
138
+    // Si dtd paquet, on traite le nom soit par son item de langue soit par sa valeur immediate a l'index "nom"
139
+    if ($info['dtd'] == "paquet") {
140
+        $nom = PtoBR(plugin_propre("{$prefix}_nom", "$dir/lang/paquet-$prefix"));
141
+        if (!$nom) {
142
+            $nom = PtoBR(propre($info['nom']));
143
+        }
144
+    } else {
145
+        $nom = typo(attribut_html($info['nom']));
146
+    }
147
+
148
+    return trim($nom);
149 149
 }
150 150
 
151 151
 // Cartouche Resume
152 152
 function plugin_resume($info, $dir_plugins, $plug_file, $url_page) {
153
-	$prefix = $info['prefix'];
154
-	$dir = "$dir_plugins$plug_file";
155
-	$slogan = PtoBR(plugin_propre($info['slogan'], "$dir/lang/paquet-$prefix"));
156
-	// une seule ligne dans le slogan : couper si besoin
157
-	if (($p = strpos($slogan, "<br />")) !== false) {
158
-		$slogan = substr($slogan, 0, $p);
159
-	}
160
-	// couper par securite
161
-	$slogan = couper($slogan, 80);
162
-
163
-	$nom = plugin_nom($info, $dir_plugins, $plug_file);
164
-
165
-	$url = parametre_url($url_page, "plugin", substr($dir, strlen(_DIR_RACINE)));
166
-
167
-	if (isset($info['logo']) and $i = trim($info['logo'])) {
168
-		include_spip("inc/filtres_images_mini");
169
-		$i = inserer_attribut(image_reduire("$dir/$i", 32), 'alt', '');
170
-		$i = "<div class='icon'><a href='$url' rel='info'>$i</a></div>";
171
-	} else {
172
-		$i = '';
173
-	}
174
-
175
-	return "<div class='resume'>"
176
-	. "<h3><a href='$url' rel='info'>"
177
-	. $nom
178
-	. "</a></h3>"
179
-	. " <span class='version'>" . $info['version'] . "</span>"
180
-	. " <span class='etat'> - "
181
-	. plugin_etat_en_clair($info['etat'])
182
-	. "</span>"
183
-	. "<div class='short'>" . $slogan . "</div>"
184
-	. $i
185
-	. "</div>";
153
+    $prefix = $info['prefix'];
154
+    $dir = "$dir_plugins$plug_file";
155
+    $slogan = PtoBR(plugin_propre($info['slogan'], "$dir/lang/paquet-$prefix"));
156
+    // une seule ligne dans le slogan : couper si besoin
157
+    if (($p = strpos($slogan, "<br />")) !== false) {
158
+        $slogan = substr($slogan, 0, $p);
159
+    }
160
+    // couper par securite
161
+    $slogan = couper($slogan, 80);
162
+
163
+    $nom = plugin_nom($info, $dir_plugins, $plug_file);
164
+
165
+    $url = parametre_url($url_page, "plugin", substr($dir, strlen(_DIR_RACINE)));
166
+
167
+    if (isset($info['logo']) and $i = trim($info['logo'])) {
168
+        include_spip("inc/filtres_images_mini");
169
+        $i = inserer_attribut(image_reduire("$dir/$i", 32), 'alt', '');
170
+        $i = "<div class='icon'><a href='$url' rel='info'>$i</a></div>";
171
+    } else {
172
+        $i = '';
173
+    }
174
+
175
+    return "<div class='resume'>"
176
+    . "<h3><a href='$url' rel='info'>"
177
+    . $nom
178
+    . "</a></h3>"
179
+    . " <span class='version'>" . $info['version'] . "</span>"
180
+    . " <span class='etat'> - "
181
+    . plugin_etat_en_clair($info['etat'])
182
+    . "</span>"
183
+    . "<div class='short'>" . $slogan . "</div>"
184
+    . $i
185
+    . "</div>";
186 186
 }
187 187
 
188 188
 function plugin_desintalle($plug_file, $nom, $dir_plugins = null) {
189
-	if (!$dir_plugins) {
190
-		$dir_plugins = _DIR_PLUGINS;
191
-	}
189
+    if (!$dir_plugins) {
190
+        $dir_plugins = _DIR_PLUGINS;
191
+    }
192 192
 
193
-	$action = redirige_action_auteur('desinstaller_plugin', "$dir_plugins::$plug_file", 'admin_plugin');
194
-	$text = _T('bouton_desinstaller');
195
-	$text2 = _T('info_desinstaller_plugin');
196
-	$file = basename($plug_file);
193
+    $action = redirige_action_auteur('desinstaller_plugin', "$dir_plugins::$plug_file", 'admin_plugin');
194
+    $text = _T('bouton_desinstaller');
195
+    $text2 = _T('info_desinstaller_plugin');
196
+    $file = basename($plug_file);
197 197
 
198
-	return "<div class='actions'>[" .
199
-	"<a href='$action'
198
+    return "<div class='actions'>[" .
199
+    "<a href='$action'
200 200
 		onclick='return confirm(\"$text $nom ?\\n$text2\")'>"
201
-	. $text
202
-	. "</a>]</div>";
201
+    . $text
202
+    . "</a>]</div>";
203 203
 }
204 204
 
205 205
 /**
@@ -213,133 +213,133 @@  discard block
 block discarded – undo
213 213
  *     Traduction de l'état dans la langue en cours
214 214
  **/
215 215
 function plugin_etat_en_clair($etat) {
216
-	if (!in_array($etat, array('stable', 'test', 'experimental'))) {
217
-		$etat = 'developpement';
218
-	}
216
+    if (!in_array($etat, array('stable', 'test', 'experimental'))) {
217
+        $etat = 'developpement';
218
+    }
219 219
 
220
-	return _T('plugin_etat_' . $etat);
220
+    return _T('plugin_etat_' . $etat);
221 221
 }
222 222
 
223 223
 // http://code.spip.net/@plugin_propre
224 224
 function plugin_propre($texte, $module = '') {
225
-	// retirer le retour a la racine du module, car le find_in_path se fait depuis la racine
226
-	if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) {
227
-		$module = substr($module, strlen(_DIR_RACINE));
228
-	}
229
-	if (preg_match("|^\w+_[\w_]+$|", $texte)) {
230
-		$texte = _T(($module ? "$module:" : '') . $texte, array(), array('force' => false));
231
-	}
232
-
233
-	return propre($texte);
225
+    // retirer le retour a la racine du module, car le find_in_path se fait depuis la racine
226
+    if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) {
227
+        $module = substr($module, strlen(_DIR_RACINE));
228
+    }
229
+    if (preg_match("|^\w+_[\w_]+$|", $texte)) {
230
+        $texte = _T(($module ? "$module:" : '') . $texte, array(), array('force' => false));
231
+    }
232
+
233
+    return propre($texte);
234 234
 }
235 235
 
236 236
 
237 237
 // http://code.spip.net/@affiche_bloc_plugin
238 238
 function affiche_bloc_plugin($plug_file, $info, $dir_plugins = null) {
239
-	if (!$dir_plugins) {
240
-		$dir_plugins = _DIR_PLUGINS;
241
-	}
242
-
243
-	$prefix = $info['prefix'];
244
-	$dir = "$dir_plugins$plug_file/lang/paquet-$prefix";
245
-
246
-	$s = "";
247
-	// TODO: le traiter_multi ici n'est pas beau
248
-	// cf. description du plugin/_stable_/ortho/plugin.xml
249
-	// concerne les anciens plugin.xml donc on devrait plus en avoir besoin
250
-	$description = "";
251
-	if (isset($info['description'])) {
252
-		$description = plugin_propre($info['description'], $dir);
253
-	}
254
-
255
-	if (isset($info['documentation'])
256
-		and $lien = $info['documentation']
257
-	) {
258
-		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
259
-	}
260
-	$s .= "<dd class='desc'>" . $description . "</dd>\n";
261
-
262
-	if (isset($info['auteur'])) {
263
-		if (is_array($info['auteur'])) {
264
-			$a = formater_credits($info['auteur'], ', ');
265
-		} // pour compat mais ne doit plus arriver
266
-		else {
267
-			$a = trim($info['auteur']);
268
-		}
269
-		if ($a) {
270
-			$s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a,
271
-					$dir)) . "</dd>\n";
272
-		}
273
-	}
274
-
275
-	if (isset($info['credit'])) {
276
-		if ($a = formater_credits($info['credit'], ', ')) {
277
-			$s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a,
278
-					$dir)) . "</dd>\n";
279
-		}
280
-	}
281
-
282
-	if (isset($info['licence'])) {
283
-		if (is_array($info['licence'])) {
284
-			$a = formater_credits($info['licence'], ', ');
285
-		} // pour compat mais ne doit plus arriver
286
-		else {
287
-			$a = trim($info['licence']);
288
-		}
289
-		if ($a) {
290
-			$s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a,
291
-					$dir)) . "</dd>\n";
292
-		}
293
-	}
294
-
295
-	$s = "<dl class='description'>$s</dl>";
296
-
297
-	//
298
-	// Ajouter les infos techniques
299
-	//
300
-	$infotech = array();
301
-
302
-	$version = "<dt>" . _T('version') . "</dt><dd>" . $info['version'];
303
-	// Version SVN
304
-	if ($svn_revision = version_svn_courante($dir_plugins . $plug_file)) {
305
-		$version .= ($svn_revision < 0 ? ' SVN' : '') . ' [' . abs($svn_revision) . ']';
306
-	}
307
-	$version .= "</dd>";
308
-	$infotech[] = $version;
309
-	$infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("$dir_plugins$plug_file") . "</dd>";
310
-	// source zip le cas echeant
311
-	$infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
312
-		and preg_match(',^source:(.*)$,m', $log, $r))
313
-		? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>"
314
-		: '';
315
-
316
-	$infotech[] = !$info['necessite'] ? '' :
317
-		('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ',
318
-				array_map('array_shift', $info['necessite'])) . '</dd>');
319
-
320
-	$s .= "<dl class='tech'>"
321
-		. join('', $infotech)
322
-		. "</dl>";
323
-
324
-
325
-	return $s;
239
+    if (!$dir_plugins) {
240
+        $dir_plugins = _DIR_PLUGINS;
241
+    }
242
+
243
+    $prefix = $info['prefix'];
244
+    $dir = "$dir_plugins$plug_file/lang/paquet-$prefix";
245
+
246
+    $s = "";
247
+    // TODO: le traiter_multi ici n'est pas beau
248
+    // cf. description du plugin/_stable_/ortho/plugin.xml
249
+    // concerne les anciens plugin.xml donc on devrait plus en avoir besoin
250
+    $description = "";
251
+    if (isset($info['description'])) {
252
+        $description = plugin_propre($info['description'], $dir);
253
+    }
254
+
255
+    if (isset($info['documentation'])
256
+        and $lien = $info['documentation']
257
+    ) {
258
+        $description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
259
+    }
260
+    $s .= "<dd class='desc'>" . $description . "</dd>\n";
261
+
262
+    if (isset($info['auteur'])) {
263
+        if (is_array($info['auteur'])) {
264
+            $a = formater_credits($info['auteur'], ', ');
265
+        } // pour compat mais ne doit plus arriver
266
+        else {
267
+            $a = trim($info['auteur']);
268
+        }
269
+        if ($a) {
270
+            $s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a,
271
+                    $dir)) . "</dd>\n";
272
+        }
273
+    }
274
+
275
+    if (isset($info['credit'])) {
276
+        if ($a = formater_credits($info['credit'], ', ')) {
277
+            $s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a,
278
+                    $dir)) . "</dd>\n";
279
+        }
280
+    }
281
+
282
+    if (isset($info['licence'])) {
283
+        if (is_array($info['licence'])) {
284
+            $a = formater_credits($info['licence'], ', ');
285
+        } // pour compat mais ne doit plus arriver
286
+        else {
287
+            $a = trim($info['licence']);
288
+        }
289
+        if ($a) {
290
+            $s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a,
291
+                    $dir)) . "</dd>\n";
292
+        }
293
+    }
294
+
295
+    $s = "<dl class='description'>$s</dl>";
296
+
297
+    //
298
+    // Ajouter les infos techniques
299
+    //
300
+    $infotech = array();
301
+
302
+    $version = "<dt>" . _T('version') . "</dt><dd>" . $info['version'];
303
+    // Version SVN
304
+    if ($svn_revision = version_svn_courante($dir_plugins . $plug_file)) {
305
+        $version .= ($svn_revision < 0 ? ' SVN' : '') . ' [' . abs($svn_revision) . ']';
306
+    }
307
+    $version .= "</dd>";
308
+    $infotech[] = $version;
309
+    $infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("$dir_plugins$plug_file") . "</dd>";
310
+    // source zip le cas echeant
311
+    $infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
312
+        and preg_match(',^source:(.*)$,m', $log, $r))
313
+        ? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>"
314
+        : '';
315
+
316
+    $infotech[] = !$info['necessite'] ? '' :
317
+        ('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ',
318
+                array_map('array_shift', $info['necessite'])) . '</dd>');
319
+
320
+    $s .= "<dl class='tech'>"
321
+        . join('', $infotech)
322
+        . "</dl>";
323
+
324
+
325
+    return $s;
326 326
 }
327 327
 
328 328
 function formater_credits($infos, $sep = ', ') {
329
-	$texte = '';
330
-
331
-	foreach ($infos as $_credit) {
332
-		if ($texte) {
333
-			$texte .= $sep;
334
-		}
335
-		// Si le credit en cours n'est pas un array c'est donc un copyright
336
-		$texte .=
337
-			(!is_array($_credit))
338
-				? PtoBR(propre($_credit))
339
-				: ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
340
-				$_credit['nom'] .
341
-				($_credit['url'] ? '</a>' : '');
342
-	}
343
-
344
-	return $texte;
329
+    $texte = '';
330
+
331
+    foreach ($infos as $_credit) {
332
+        if ($texte) {
333
+            $texte .= $sep;
334
+        }
335
+        // Si le credit en cours n'est pas un array c'est donc un copyright
336
+        $texte .=
337
+            (!is_array($_credit))
338
+                ? PtoBR(propre($_credit))
339
+                : ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
340
+                $_credit['nom'] .
341
+                ($_credit['url'] ? '</a>' : '');
342
+    }
343
+
344
+    return $texte;
345 345
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -34 removed lines patch added patch discarded remove patch
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 		$class_li .= " error";
57 57
 		$erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'",
58 58
 				_T('plugin_info_erreur_xml'))
59
-			. "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>";
59
+			. "<div class='erreur'>".join('<br >', $info['erreur'])."</div>";
60 60
 		$checkable = false;
61
-	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
61
+	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])) {
62 62
 		$class_li .= " error";
63 63
 		$erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)),
64 64
 				" class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom)))
65
-			. "<div class='erreur'>" . implode("<br />",
66
-				$GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>";
65
+			. "<div class='erreur'>".implode("<br />",
66
+				$GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])."</div>";
67 67
 	} else {
68 68
 		$cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : "";
69 69
 	}
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 	// numerotons les occurrences d'un meme prefix
72 72
 	$versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
73 73
 
74
-	$class_li .= ($actif ? " actif" : "") . ($expose ? " on" : "");
74
+	$class_li .= ($actif ? " actif" : "").($expose ? " on" : "");
75 75
 
76 76
 	return "<li id='$prefix$id' class='$class_li'>"
77 77
 	. ((!$checkable and !$checked)
78
-		? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
78
+		? '' : plugin_checkbox(++$id_input, $dir_plugins.$plug_file, $checked))
79 79
 	. plugin_resume($info, $dir_plugins, $plug_file, $url_page)
80 80
 	. $cfg
81 81
 	. $erreur
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 	$prefix = strtolower($infos['prefix']);
94 94
 	// si paquet.xml fournit un squelette, le prendre
95 95
 	if (isset($infos['config']) and $infos['config']) {
96
-		return recuperer_fond("$dir$nom/" . $infos['config'],
96
+		return recuperer_fond("$dir$nom/".$infos['config'],
97 97
 			array(
98
-				'script' => 'configurer_' . $prefix,
98
+				'script' => 'configurer_'.$prefix,
99 99
 				'nom' => $nom
100 100
 			));
101 101
 	}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	// sinon prendre le squelette std sur le nom std
114 114
 	return recuperer_fond("prive/squelettes/inclure/cfg",
115 115
 		array(
116
-			'script' => 'configurer_' . $prefix,
116
+			'script' => 'configurer_'.$prefix,
117 117
 			'nom' => $nom
118 118
 		));
119 119
 }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	. "<input type='checkbox' name='s$name' id='label_$id_input'"
129 129
 	. ($actif ? " checked='checked'" : "")
130 130
 	. " class='checkbox'  value='O' />"
131
-	. "\n<label for='label_$id_input'>" . _T('activer_plugin') . "</label>"
131
+	. "\n<label for='label_$id_input'>"._T('activer_plugin')."</label>"
132 132
 	. "</div>";
133 133
 }
134 134
 
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 	. "<h3><a href='$url' rel='info'>"
177 177
 	. $nom
178 178
 	. "</a></h3>"
179
-	. " <span class='version'>" . $info['version'] . "</span>"
179
+	. " <span class='version'>".$info['version']."</span>"
180 180
 	. " <span class='etat'> - "
181 181
 	. plugin_etat_en_clair($info['etat'])
182 182
 	. "</span>"
183
-	. "<div class='short'>" . $slogan . "</div>"
183
+	. "<div class='short'>".$slogan."</div>"
184 184
 	. $i
185 185
 	. "</div>";
186 186
 }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	$text2 = _T('info_desinstaller_plugin');
196 196
 	$file = basename($plug_file);
197 197
 
198
-	return "<div class='actions'>[" .
198
+	return "<div class='actions'>[".
199 199
 	"<a href='$action'
200 200
 		onclick='return confirm(\"$text $nom ?\\n$text2\")'>"
201 201
 	. $text
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		$etat = 'developpement';
218 218
 	}
219 219
 
220
-	return _T('plugin_etat_' . $etat);
220
+	return _T('plugin_etat_'.$etat);
221 221
 }
222 222
 
223 223
 // http://code.spip.net/@plugin_propre
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$module = substr($module, strlen(_DIR_RACINE));
228 228
 	}
229 229
 	if (preg_match("|^\w+_[\w_]+$|", $texte)) {
230
-		$texte = _T(($module ? "$module:" : '') . $texte, array(), array('force' => false));
230
+		$texte = _T(($module ? "$module:" : '').$texte, array(), array('force' => false));
231 231
 	}
232 232
 
233 233
 	return propre($texte);
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
 	if (isset($info['documentation'])
256 256
 		and $lien = $info['documentation']
257 257
 	) {
258
-		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
258
+		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>"._T('en_savoir_plus').'</a></em></p>';
259 259
 	}
260
-	$s .= "<dd class='desc'>" . $description . "</dd>\n";
260
+	$s .= "<dd class='desc'>".$description."</dd>\n";
261 261
 
262 262
 	if (isset($info['auteur'])) {
263 263
 		if (is_array($info['auteur'])) {
@@ -267,15 +267,15 @@  discard block
 block discarded – undo
267 267
 			$a = trim($info['auteur']);
268 268
 		}
269 269
 		if ($a) {
270
-			$s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a,
271
-					$dir)) . "</dd>\n";
270
+			$s .= "<dt class='auteurs'>"._T('public:par_auteur')."</dt><dd class='auteurs'>".PtoBR(propre($a,
271
+					$dir))."</dd>\n";
272 272
 		}
273 273
 	}
274 274
 
275 275
 	if (isset($info['credit'])) {
276 276
 		if ($a = formater_credits($info['credit'], ', ')) {
277
-			$s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a,
278
-					$dir)) . "</dd>\n";
277
+			$s .= "<dt class='credits'>"._T('plugin_info_credit')."</dt><dd class='credits'>".PtoBR(propre($a,
278
+					$dir))."</dd>\n";
279 279
 		}
280 280
 	}
281 281
 
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 			$a = trim($info['licence']);
288 288
 		}
289 289
 		if ($a) {
290
-			$s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a,
291
-					$dir)) . "</dd>\n";
290
+			$s .= "<dt class='licence'>"._T('intitule_licence')."</dt><dd class='licence'>".PtoBR(propre($a,
291
+					$dir))."</dd>\n";
292 292
 		}
293 293
 	}
294 294
 
@@ -299,23 +299,22 @@  discard block
 block discarded – undo
299 299
 	//
300 300
 	$infotech = array();
301 301
 
302
-	$version = "<dt>" . _T('version') . "</dt><dd>" . $info['version'];
302
+	$version = "<dt>"._T('version')."</dt><dd>".$info['version'];
303 303
 	// Version SVN
304
-	if ($svn_revision = version_svn_courante($dir_plugins . $plug_file)) {
305
-		$version .= ($svn_revision < 0 ? ' SVN' : '') . ' [' . abs($svn_revision) . ']';
304
+	if ($svn_revision = version_svn_courante($dir_plugins.$plug_file)) {
305
+		$version .= ($svn_revision < 0 ? ' SVN' : '').' ['.abs($svn_revision).']';
306 306
 	}
307 307
 	$version .= "</dd>";
308 308
 	$infotech[] = $version;
309
-	$infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("$dir_plugins$plug_file") . "</dd>";
309
+	$infotech[] = "<dt>"._T('repertoire_plugins')."</dt><dd>".joli_repertoire("$dir_plugins$plug_file")."</dd>";
310 310
 	// source zip le cas echeant
311
-	$infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
311
+	$infotech[] = (lire_fichier($dir_plugins.$plug_file.'/install.log', $log)
312 312
 		and preg_match(',^source:(.*)$,m', $log, $r))
313
-		? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>"
313
+		? '<dt>'._T('plugin_source').'</dt><dd>'.trim($r[1])."</dd>"
314 314
 		: '';
315 315
 
316
-	$infotech[] = !$info['necessite'] ? '' :
317
-		('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ',
318
-				array_map('array_shift', $info['necessite'])) . '</dd>');
316
+	$infotech[] = !$info['necessite'] ? '' : ('<dt>'._T('plugin_info_necessite').'</dt><dd>'.join(' ',
317
+				array_map('array_shift', $info['necessite'])).'</dd>');
319 318
 
320 319
 	$s .= "<dl class='tech'>"
321 320
 		. join('', $infotech)
@@ -336,8 +335,8 @@  discard block
 block discarded – undo
336 335
 		$texte .=
337 336
 			(!is_array($_credit))
338 337
 				? PtoBR(propre($_credit))
339
-				: ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
340
-				$_credit['nom'] .
338
+				: ($_credit['url'] ? '<a href="'.$_credit['url'].'">' : '').
339
+				$_credit['nom'].
341 340
 				($_credit['url'] ? '</a>' : '');
342 341
 	}
343 342
 
Please login to merge, or discard this patch.