Completed
Push — master ( d54fc1...89cac1 )
by cam
01:11
created
ecrire/plugins/infos_plugin.php 2 patches
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -17,116 +17,116 @@  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
 // lecture d'un texte ecrit en pseudo-xml issu d'un fichier plugin.xml
24 24
 // et conversion approximative en tableau PHP.
25 25
 function plugins_infos_plugin($desc, $plug = '', $dir_plugins = _DIR_PLUGINS) {
26
-	include_spip('inc/xml');
27
-	$arbre = spip_xml_parse($desc);
28
-
29
-	$verifie_conformite = charger_fonction('verifie_conformite', 'plugins');
30
-	$verifie_conformite($plug, $arbre, $dir_plugins);
31
-
32
-	include_spip('inc/charsets');
33
-
34
-	// On renvoie la DTD utilisee
35
-	$ret['dtd'] = "plugin";
36
-
37
-	if (isset($arbre['categorie'])) {
38
-		$ret['categorie'] = trim(spip_xml_aplatit($arbre['categorie']));
39
-	}
40
-	if (isset($arbre['nom'])) {
41
-		$ret['nom'] = charset2unicode(spip_xml_aplatit($arbre['nom']));
42
-	}
43
-	if (isset($arbre['icon'])) {
44
-		$ret['logo'] = trim(spip_xml_aplatit($arbre['icon']));
45
-	}
46
-	if (isset($arbre['auteur'])) {
47
-		$ret['auteur'][] = trim(spip_xml_aplatit($arbre['auteur']));
48
-	} // garder le 1er niveau en tableau mais traiter le multi possible
49
-	if (isset($arbre['licence'])) {
50
-		$ret['licence'][] = trim(spip_xml_aplatit($arbre['licence']));
51
-	}
52
-	if (isset($arbre['version'])) {
53
-		$ret['version'] = trim(spip_xml_aplatit($arbre['version']));
54
-	}
55
-	if (isset($arbre['version_base'])) {
56
-		$ret['schema'] = trim(spip_xml_aplatit($arbre['version_base']));
57
-	}
58
-	if (isset($arbre['etat'])) {
59
-		$ret['etat'] = trim(spip_xml_aplatit($arbre['etat']));
60
-	}
61
-
62
-	$ret['description'] = $ret['slogan'] = "";
63
-	if (isset($arbre['slogan'])) {
64
-		$ret['slogan'] = trim(spip_xml_aplatit($arbre['slogan']));
65
-	}
66
-	if (isset($arbre['description'])) {
67
-		$ret['description'] = trim(spip_xml_aplatit($arbre['description']));
68
-	}
69
-
70
-	if (isset($arbre['lien'])) {
71
-		$ret['documentation'] = trim(join(' ', $arbre['lien']));
72
-		if ($ret['documentation']) {
73
-			// le lien de doc doit etre une url et c'est tout
74
-			if (!tester_url_absolue($ret['documentation'])) {
75
-				$ret['documentation'] = "";
76
-			}
77
-		}
78
-	}
79
-
80
-	if (isset($arbre['options'])) {
81
-		$ret['options'] = $arbre['options'];
82
-	}
83
-	if (isset($arbre['fonctions'])) {
84
-		$ret['fonctions'] = $arbre['fonctions'];
85
-	}
86
-	if (isset($arbre['prefix'][0])) {
87
-		$ret['prefix'] = trim(array_pop($arbre['prefix']));
88
-	}
89
-	if (isset($arbre['install'])) {
90
-		$ret['install'] = $arbre['install'];
91
-	}
92
-	if (isset($arbre['meta'])) {
93
-		$ret['meta'] = trim(spip_xml_aplatit($arbre['meta']));
94
-	}
95
-
96
-	$necessite = info_plugin_normalise_necessite(isset($arbre['necessite']) ? $arbre['necessite'] : '');
97
-	$ret['compatibilite'] = isset($necessite['compatible']) ? $necessite['compatible'] : '';
98
-	$ret['necessite'] = $necessite['necessite'];
99
-	$ret['lib'] = $necessite['lib'];
100
-	$ret['utilise'] = info_plugin_normalise_utilise(isset($arbre['utilise']) ? $arbre['utilise'] : '');
101
-	$ret['procure'] = info_plugin_normalise_procure(isset($arbre['procure']) ? $arbre['procure'] : '');
102
-	$ret['chemin'] = info_plugin_normalise_chemin(isset($arbre['path']) ? $arbre['path'] : '');
103
-
104
-	if (isset($arbre['pipeline'])) {
105
-		$ret['pipeline'] = $arbre['pipeline'];
106
-	}
107
-
108
-	$extraire_boutons = charger_fonction('extraire_boutons', 'plugins');
109
-	$les_boutons = $extraire_boutons($arbre);
110
-	$ret['menu'] = $les_boutons['bouton'];
111
-	$ret['onglet'] = $les_boutons['onglet'];
112
-
113
-	$ret['traduire'] = isset($arbre['traduire']) ? $arbre['traduire'] : '';
114
-
115
-	if (isset($arbre['config'])) {
116
-		$ret['config'] = spip_xml_aplatit($arbre['config']);
117
-	}
118
-	if (isset($arbre['noisette'])) {
119
-		$ret['noisette'] = $arbre['noisette'];
120
-	}
121
-
122
-	if (isset($arbre['erreur'])) {
123
-		$ret['erreur'] = $arbre['erreur'];
124
-		if ($plug) {
125
-			spip_log("infos_plugin $plug " . @join(' ', $arbre['erreur']));
126
-		}
127
-	}
128
-
129
-	return $ret;
26
+    include_spip('inc/xml');
27
+    $arbre = spip_xml_parse($desc);
28
+
29
+    $verifie_conformite = charger_fonction('verifie_conformite', 'plugins');
30
+    $verifie_conformite($plug, $arbre, $dir_plugins);
31
+
32
+    include_spip('inc/charsets');
33
+
34
+    // On renvoie la DTD utilisee
35
+    $ret['dtd'] = "plugin";
36
+
37
+    if (isset($arbre['categorie'])) {
38
+        $ret['categorie'] = trim(spip_xml_aplatit($arbre['categorie']));
39
+    }
40
+    if (isset($arbre['nom'])) {
41
+        $ret['nom'] = charset2unicode(spip_xml_aplatit($arbre['nom']));
42
+    }
43
+    if (isset($arbre['icon'])) {
44
+        $ret['logo'] = trim(spip_xml_aplatit($arbre['icon']));
45
+    }
46
+    if (isset($arbre['auteur'])) {
47
+        $ret['auteur'][] = trim(spip_xml_aplatit($arbre['auteur']));
48
+    } // garder le 1er niveau en tableau mais traiter le multi possible
49
+    if (isset($arbre['licence'])) {
50
+        $ret['licence'][] = trim(spip_xml_aplatit($arbre['licence']));
51
+    }
52
+    if (isset($arbre['version'])) {
53
+        $ret['version'] = trim(spip_xml_aplatit($arbre['version']));
54
+    }
55
+    if (isset($arbre['version_base'])) {
56
+        $ret['schema'] = trim(spip_xml_aplatit($arbre['version_base']));
57
+    }
58
+    if (isset($arbre['etat'])) {
59
+        $ret['etat'] = trim(spip_xml_aplatit($arbre['etat']));
60
+    }
61
+
62
+    $ret['description'] = $ret['slogan'] = "";
63
+    if (isset($arbre['slogan'])) {
64
+        $ret['slogan'] = trim(spip_xml_aplatit($arbre['slogan']));
65
+    }
66
+    if (isset($arbre['description'])) {
67
+        $ret['description'] = trim(spip_xml_aplatit($arbre['description']));
68
+    }
69
+
70
+    if (isset($arbre['lien'])) {
71
+        $ret['documentation'] = trim(join(' ', $arbre['lien']));
72
+        if ($ret['documentation']) {
73
+            // le lien de doc doit etre une url et c'est tout
74
+            if (!tester_url_absolue($ret['documentation'])) {
75
+                $ret['documentation'] = "";
76
+            }
77
+        }
78
+    }
79
+
80
+    if (isset($arbre['options'])) {
81
+        $ret['options'] = $arbre['options'];
82
+    }
83
+    if (isset($arbre['fonctions'])) {
84
+        $ret['fonctions'] = $arbre['fonctions'];
85
+    }
86
+    if (isset($arbre['prefix'][0])) {
87
+        $ret['prefix'] = trim(array_pop($arbre['prefix']));
88
+    }
89
+    if (isset($arbre['install'])) {
90
+        $ret['install'] = $arbre['install'];
91
+    }
92
+    if (isset($arbre['meta'])) {
93
+        $ret['meta'] = trim(spip_xml_aplatit($arbre['meta']));
94
+    }
95
+
96
+    $necessite = info_plugin_normalise_necessite(isset($arbre['necessite']) ? $arbre['necessite'] : '');
97
+    $ret['compatibilite'] = isset($necessite['compatible']) ? $necessite['compatible'] : '';
98
+    $ret['necessite'] = $necessite['necessite'];
99
+    $ret['lib'] = $necessite['lib'];
100
+    $ret['utilise'] = info_plugin_normalise_utilise(isset($arbre['utilise']) ? $arbre['utilise'] : '');
101
+    $ret['procure'] = info_plugin_normalise_procure(isset($arbre['procure']) ? $arbre['procure'] : '');
102
+    $ret['chemin'] = info_plugin_normalise_chemin(isset($arbre['path']) ? $arbre['path'] : '');
103
+
104
+    if (isset($arbre['pipeline'])) {
105
+        $ret['pipeline'] = $arbre['pipeline'];
106
+    }
107
+
108
+    $extraire_boutons = charger_fonction('extraire_boutons', 'plugins');
109
+    $les_boutons = $extraire_boutons($arbre);
110
+    $ret['menu'] = $les_boutons['bouton'];
111
+    $ret['onglet'] = $les_boutons['onglet'];
112
+
113
+    $ret['traduire'] = isset($arbre['traduire']) ? $arbre['traduire'] : '';
114
+
115
+    if (isset($arbre['config'])) {
116
+        $ret['config'] = spip_xml_aplatit($arbre['config']);
117
+    }
118
+    if (isset($arbre['noisette'])) {
119
+        $ret['noisette'] = $arbre['noisette'];
120
+    }
121
+
122
+    if (isset($arbre['erreur'])) {
123
+        $ret['erreur'] = $arbre['erreur'];
124
+        if ($plug) {
125
+            spip_log("infos_plugin $plug " . @join(' ', $arbre['erreur']));
126
+        }
127
+    }
128
+
129
+    return $ret;
130 130
 }
131 131
 
132 132
 
@@ -153,27 +153,27 @@  discard block
 block discarded – undo
153 153
  *     Liste des necessite modifiés.
154 154
  */
155 155
 function info_plugin_normalise_necessite($necessite) {
156
-	$res = array('necessite' => array(), 'lib' => array());
157
-
158
-	if (is_array($necessite)) {
159
-		foreach ($necessite as $need) {
160
-			$id = $need['id'];
161
-			$v = isset($need['version']) ? $need['version'] : '';
162
-
163
-			// Necessite SPIP version x ?
164
-			if (strtoupper($id) == 'SPIP') {
165
-				$res['compatible'] = $v;
166
-			} else {
167
-				if (preg_match(',^lib:\s*([^\s]*),i', $id, $r)) {
168
-					$res['lib'][] = array('nom' => $r[1], 'id' => $r[1], 'lien' => $need['src']);
169
-				} else {
170
-					$res['necessite'][] = array('id' => $id, 'nom' => $id, 'version' => $v, 'compatibilite' => $v);
171
-				}
172
-			}
173
-		}
174
-	}
175
-
176
-	return $res;
156
+    $res = array('necessite' => array(), 'lib' => array());
157
+
158
+    if (is_array($necessite)) {
159
+        foreach ($necessite as $need) {
160
+            $id = $need['id'];
161
+            $v = isset($need['version']) ? $need['version'] : '';
162
+
163
+            // Necessite SPIP version x ?
164
+            if (strtoupper($id) == 'SPIP') {
165
+                $res['compatible'] = $v;
166
+            } else {
167
+                if (preg_match(',^lib:\s*([^\s]*),i', $id, $r)) {
168
+                    $res['lib'][] = array('nom' => $r[1], 'id' => $r[1], 'lien' => $need['src']);
169
+                } else {
170
+                    $res['necessite'][] = array('id' => $id, 'nom' => $id, 'version' => $v, 'compatibilite' => $v);
171
+                }
172
+            }
173
+        }
174
+    }
175
+
176
+    return $res;
177 177
 }
178 178
 
179 179
 /**
@@ -189,17 +189,17 @@  discard block
 block discarded – undo
189 189
  *    Liste des utilise modifiés.
190 190
  */
191 191
 function info_plugin_normalise_utilise($utilise) {
192
-	$res = array();
192
+    $res = array();
193 193
 
194
-	if (is_array($utilise)) {
195
-		foreach ($utilise as $need) {
196
-			$id = $need['id'];
197
-			$v = isset($need['version']) ? $need['version'] : '';
198
-			$res[] = array('nom' => $id, 'id' => $id, 'version' => $v, 'compatibilite' => $v);
199
-		}
200
-	}
194
+    if (is_array($utilise)) {
195
+        foreach ($utilise as $need) {
196
+            $id = $need['id'];
197
+            $v = isset($need['version']) ? $need['version'] : '';
198
+            $res[] = array('nom' => $id, 'id' => $id, 'version' => $v, 'compatibilite' => $v);
199
+        }
200
+    }
201 201
 
202
-	return $res;
202
+    return $res;
203 203
 }
204 204
 
205 205
 /**
@@ -213,17 +213,17 @@  discard block
 block discarded – undo
213 213
  *    Liste des procure modifiés.
214 214
  */
215 215
 function info_plugin_normalise_procure($procure) {
216
-	$res = array();
216
+    $res = array();
217 217
 
218
-	if (is_array($procure)) {
219
-		foreach ($procure as $need) {
220
-			$id = $need['id'];
221
-			$v = $need['version'];
222
-			$res[] = array('nom' => $id, 'id' => $id, 'version' => $v);
223
-		}
224
-	}
218
+    if (is_array($procure)) {
219
+        foreach ($procure as $need) {
220
+            $id = $need['id'];
221
+            $v = $need['version'];
222
+            $res[] = array('nom' => $id, 'id' => $id, 'version' => $v);
223
+        }
224
+    }
225 225
 
226
-	return $res;
226
+    return $res;
227 227
 }
228 228
 
229 229
 /**
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
  *    Liste des chemins modifiés.
238 238
  */
239 239
 function info_plugin_normalise_chemin($chemins) {
240
-	$res = array();
240
+    $res = array();
241 241
 
242
-	if (is_array($chemins)) {
243
-		foreach ($chemins as $c) {
244
-			$c['path'] = $c['dir'];
245
-			$res[] = $c;
246
-		}
247
-	}
242
+    if (is_array($chemins)) {
243
+        foreach ($chemins as $c) {
244
+            $c['path'] = $c['dir'];
245
+            $res[] = $c;
246
+        }
247
+    }
248 248
 
249
-	return $res;
249
+    return $res;
250 250
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
 	if (isset($arbre['erreur'])) {
123 123
 		$ret['erreur'] = $arbre['erreur'];
124 124
 		if ($plug) {
125
-			spip_log("infos_plugin $plug " . @join(' ', $arbre['erreur']));
125
+			spip_log("infos_plugin $plug ".@join(' ', $arbre['erreur']));
126 126
 		}
127 127
 	}
128 128
 
Please login to merge, or discard this patch.
ecrire/plugins/extraire_pipelines.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 
@@ -21,26 +21,26 @@  discard block
 block discarded – undo
21 21
  * @param array $arbre
22 22
  */
23 23
 function plugins_extraire_pipelines_dist(&$arbre) {
24
-	$pipeline = array();
25
-	if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) {
26
-		foreach ($pipes as $tag => $p) {
27
-			if (!is_array($p[0])) {
28
-				list($tag, $att) = spip_xml_decompose_tag($tag);
29
-				$pipeline[] = $att;
30
-			} else {
31
-				foreach ($p as $pipe) {
32
-					$att = array();
33
-					if (is_array($pipe)) {
34
-						foreach ($pipe as $k => $t) {
35
-							$att[$k] = trim(end($t));
36
-						}
37
-					}
38
-					$pipeline[] = $att;
39
-				}
40
-			}
41
-		}
42
-		unset($arbre[$tag]);
43
-	}
24
+    $pipeline = array();
25
+    if (spip_xml_match_nodes(',^pipeline,', $arbre, $pipes)) {
26
+        foreach ($pipes as $tag => $p) {
27
+            if (!is_array($p[0])) {
28
+                list($tag, $att) = spip_xml_decompose_tag($tag);
29
+                $pipeline[] = $att;
30
+            } else {
31
+                foreach ($p as $pipe) {
32
+                    $att = array();
33
+                    if (is_array($pipe)) {
34
+                        foreach ($pipe as $k => $t) {
35
+                            $att[$k] = trim(end($t));
36
+                        }
37
+                    }
38
+                    $pipeline[] = $att;
39
+                }
40
+            }
41
+        }
42
+        unset($arbre[$tag]);
43
+    }
44 44
 
45
-	return $pipeline;
45
+    return $pipeline;
46 46
 }
Please login to merge, or discard this patch.
ecrire/plugins/get_infos.php 2 patches
Indentation   +101 added lines, -101 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
 /**
@@ -33,110 +33,110 @@  discard block
 block discarded – undo
33 33
  * @return array
34 34
  */
35 35
 function plugins_get_infos_dist($plug = false, $reload = false, $dir = _DIR_PLUGINS, $clean_old = false) {
36
-	static $cache = '';
37
-	static $filecache = '';
38
-
39
-	if ($cache === '') {
40
-		$filecache = _DIR_TMP . "plugin_xml_cache.gz";
41
-		if (is_file($filecache)) {
42
-			lire_fichier($filecache, $contenu);
43
-			$cache = unserialize($contenu);
44
-		}
45
-		if (!is_array($cache)) {
46
-			$cache = array();
47
-		}
48
-	}
49
-
50
-	if (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') {
51
-		$reload = true;
52
-	}
53
-
54
-	if ($plug === false) {
55
-		ecrire_fichier($filecache, serialize($cache));
56
-
57
-		return $cache;
58
-	} elseif (is_string($plug)) {
59
-		$res = plugins_get_infos_un($plug, $reload, $dir, $cache);
60
-	} elseif (is_array($plug)) {
61
-		$res = false;
62
-		if (!$reload) {
63
-			$reload = -1;
64
-		}
65
-		foreach ($plug as $nom) {
66
-			$res |= plugins_get_infos_un($nom, $reload, $dir, $cache);
67
-		}
68
-
69
-		// Nettoyer le cache des vieux plugins qui ne sont plus la
70
-		if ($clean_old and isset($cache[$dir]) and count($cache[$dir])) {
71
-			foreach (array_keys($cache[$dir]) as $p) {
72
-				if (!in_array($p, $plug)) {
73
-					unset($cache[$dir][$p]);
74
-				}
75
-			}
76
-		}
77
-	}
78
-	if ($res) {
79
-		ecrire_fichier($filecache, serialize($cache));
80
-	}
81
-	if (!isset($cache[$dir])) {
82
-		return array();
83
-	}
84
-	if (is_string($plug)) {
85
-		return isset($cache[$dir][$plug]) ? $cache[$dir][$plug] : array();
86
-	} else {
87
-		return $cache[$dir];
88
-	}
36
+    static $cache = '';
37
+    static $filecache = '';
38
+
39
+    if ($cache === '') {
40
+        $filecache = _DIR_TMP . "plugin_xml_cache.gz";
41
+        if (is_file($filecache)) {
42
+            lire_fichier($filecache, $contenu);
43
+            $cache = unserialize($contenu);
44
+        }
45
+        if (!is_array($cache)) {
46
+            $cache = array();
47
+        }
48
+    }
49
+
50
+    if (defined('_VAR_MODE') and _VAR_MODE == 'recalcul') {
51
+        $reload = true;
52
+    }
53
+
54
+    if ($plug === false) {
55
+        ecrire_fichier($filecache, serialize($cache));
56
+
57
+        return $cache;
58
+    } elseif (is_string($plug)) {
59
+        $res = plugins_get_infos_un($plug, $reload, $dir, $cache);
60
+    } elseif (is_array($plug)) {
61
+        $res = false;
62
+        if (!$reload) {
63
+            $reload = -1;
64
+        }
65
+        foreach ($plug as $nom) {
66
+            $res |= plugins_get_infos_un($nom, $reload, $dir, $cache);
67
+        }
68
+
69
+        // Nettoyer le cache des vieux plugins qui ne sont plus la
70
+        if ($clean_old and isset($cache[$dir]) and count($cache[$dir])) {
71
+            foreach (array_keys($cache[$dir]) as $p) {
72
+                if (!in_array($p, $plug)) {
73
+                    unset($cache[$dir][$p]);
74
+                }
75
+            }
76
+        }
77
+    }
78
+    if ($res) {
79
+        ecrire_fichier($filecache, serialize($cache));
80
+    }
81
+    if (!isset($cache[$dir])) {
82
+        return array();
83
+    }
84
+    if (is_string($plug)) {
85
+        return isset($cache[$dir][$plug]) ? $cache[$dir][$plug] : array();
86
+    } else {
87
+        return $cache[$dir];
88
+    }
89 89
 }
90 90
 
91 91
 
92 92
 function plugins_get_infos_un($plug, $reload, $dir, &$cache) {
93
-	if (!is_readable($file = "$dir$plug/" . ($desc = "paquet") . ".xml")) {
94
-		if (!is_readable($file = "$dir$plug/" . ($desc = "plugin") . ".xml")) {
95
-			return false;
96
-		}
97
-	}
98
-
99
-	if (($time = intval(@filemtime($file))) < 0) {
100
-		return false;
101
-	}
102
-	$md5 = md5_file($file);
103
-
104
-	$pcache = isset($cache[$dir][$plug])
105
-		? $cache[$dir][$plug] : array('filemtime' => 0, 'md5_file' => '');
106
-
107
-	// si le cache est valide
108
-	if ((intval($reload) <= 0)
109
-		and ($time > 0)
110
-		and ($time <= $pcache['filemtime'])
111
-		and $md5 == $pcache['md5_file']
112
-	) {
113
-		return false;
114
-	}
115
-
116
-	// si on arrive pas a lire le fichier, se contenter du cache
117
-	if (!($texte = spip_file_get_contents($file))) {
118
-		return false;
119
-	}
120
-
121
-	$f = charger_fonction('infos_' . $desc, 'plugins');
122
-	$ret = $f($texte, $plug, $dir);
123
-	$ret['filemtime'] = $time;
124
-	$ret['md5_file'] = $md5;
125
-	// Si on lit le paquet.xml de SPIP, on rajoute un procure php afin que les plugins puissent
126
-	// utiliser un necessite php. SPIP procure donc la version php courante du serveur.
127
-	// chaque librairie php est aussi procurée, par exemple 'php:curl'.
128
-	if (isset($ret['prefix']) and $ret['prefix'] == 'spip') {
129
-		$ret['procure']['php'] = array('nom' => 'php', 'version' => phpversion());
130
-		foreach (get_loaded_extensions() as $ext) {
131
-			$ret['procure']['php:' . $ext] = array('nom' => 'php:' . $ext, 'version' => phpversion($ext));
132
-		}
133
-	}
134
-	$diff = ($ret != $pcache);
135
-
136
-	if ($diff) {
137
-		$cache[$dir][$plug] = $ret;
93
+    if (!is_readable($file = "$dir$plug/" . ($desc = "paquet") . ".xml")) {
94
+        if (!is_readable($file = "$dir$plug/" . ($desc = "plugin") . ".xml")) {
95
+            return false;
96
+        }
97
+    }
98
+
99
+    if (($time = intval(@filemtime($file))) < 0) {
100
+        return false;
101
+    }
102
+    $md5 = md5_file($file);
103
+
104
+    $pcache = isset($cache[$dir][$plug])
105
+        ? $cache[$dir][$plug] : array('filemtime' => 0, 'md5_file' => '');
106
+
107
+    // si le cache est valide
108
+    if ((intval($reload) <= 0)
109
+        and ($time > 0)
110
+        and ($time <= $pcache['filemtime'])
111
+        and $md5 == $pcache['md5_file']
112
+    ) {
113
+        return false;
114
+    }
115
+
116
+    // si on arrive pas a lire le fichier, se contenter du cache
117
+    if (!($texte = spip_file_get_contents($file))) {
118
+        return false;
119
+    }
120
+
121
+    $f = charger_fonction('infos_' . $desc, 'plugins');
122
+    $ret = $f($texte, $plug, $dir);
123
+    $ret['filemtime'] = $time;
124
+    $ret['md5_file'] = $md5;
125
+    // Si on lit le paquet.xml de SPIP, on rajoute un procure php afin que les plugins puissent
126
+    // utiliser un necessite php. SPIP procure donc la version php courante du serveur.
127
+    // chaque librairie php est aussi procurée, par exemple 'php:curl'.
128
+    if (isset($ret['prefix']) and $ret['prefix'] == 'spip') {
129
+        $ret['procure']['php'] = array('nom' => 'php', 'version' => phpversion());
130
+        foreach (get_loaded_extensions() as $ext) {
131
+            $ret['procure']['php:' . $ext] = array('nom' => 'php:' . $ext, 'version' => phpversion($ext));
132
+        }
133
+    }
134
+    $diff = ($ret != $pcache);
135
+
136
+    if ($diff) {
137
+        $cache[$dir][$plug] = $ret;
138 138
 #		echo count($cache[$dir]), $dir,$plug, " $reloadc<br>"; 
139
-	}
139
+    }
140 140
 
141
-	return $diff;
141
+    return $diff;
142 142
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	static $filecache = '';
38 38
 
39 39
 	if ($cache === '') {
40
-		$filecache = _DIR_TMP . "plugin_xml_cache.gz";
40
+		$filecache = _DIR_TMP."plugin_xml_cache.gz";
41 41
 		if (is_file($filecache)) {
42 42
 			lire_fichier($filecache, $contenu);
43 43
 			$cache = unserialize($contenu);
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 
91 91
 
92 92
 function plugins_get_infos_un($plug, $reload, $dir, &$cache) {
93
-	if (!is_readable($file = "$dir$plug/" . ($desc = "paquet") . ".xml")) {
94
-		if (!is_readable($file = "$dir$plug/" . ($desc = "plugin") . ".xml")) {
93
+	if (!is_readable($file = "$dir$plug/".($desc = "paquet").".xml")) {
94
+		if (!is_readable($file = "$dir$plug/".($desc = "plugin").".xml")) {
95 95
 			return false;
96 96
 		}
97 97
 	}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		return false;
119 119
 	}
120 120
 
121
-	$f = charger_fonction('infos_' . $desc, 'plugins');
121
+	$f = charger_fonction('infos_'.$desc, 'plugins');
122 122
 	$ret = $f($texte, $plug, $dir);
123 123
 	$ret['filemtime'] = $time;
124 124
 	$ret['md5_file'] = $md5;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	if (isset($ret['prefix']) and $ret['prefix'] == 'spip') {
129 129
 		$ret['procure']['php'] = array('nom' => 'php', 'version' => phpversion());
130 130
 		foreach (get_loaded_extensions() as $ext) {
131
-			$ret['procure']['php:' . $ext] = array('nom' => 'php:' . $ext, 'version' => phpversion($ext));
131
+			$ret['procure']['php:'.$ext] = array('nom' => 'php:'.$ext, 'version' => phpversion($ext));
132 132
 		}
133 133
 	}
134 134
 	$diff = ($ret != $pcache);
Please login to merge, or discard this patch.
ecrire/plugins/verifie_conformite.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 	}
49 49
 	if (is_null($p)) {
50
-		$arbre = array('erreur' => array(_T('erreur_plugin_tag_plugin_absent') . " : $plug"));
50
+		$arbre = array('erreur' => array(_T('erreur_plugin_tag_plugin_absent')." : $plug"));
51 51
 		$silence = true;
52 52
 	} else {
53 53
 		$arbre = $p;
@@ -82,15 +82,15 @@  discard block
 block discarded – undo
82 82
 		if (isset($arbre['etat'])) {
83 83
 			$etat = trim(end($arbre['etat']));
84 84
 			if (!in_array($etat, $etats)) {
85
-				$arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'";
85
+				$arbre['erreur'][] = _T('erreur_plugin_etat_inconnu')." : '$etat'";
86 86
 			}
87 87
 		}
88 88
 		if (isset($arbre['options'])) {
89 89
 			foreach ($arbre['options'] as $optfile) {
90 90
 				$optfile = trim($optfile);
91
-				if (!@is_readable($dir_plugins . "$plug/$optfile")) {
91
+				if (!@is_readable($dir_plugins."$plug/$optfile")) {
92 92
 					if (!$silence) {
93
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
93
+						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $optfile";
94 94
 					}
95 95
 				}
96 96
 			}
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 		if (isset($arbre['fonctions'])) {
99 99
 			foreach ($arbre['fonctions'] as $optfile) {
100 100
 				$optfile = trim($optfile);
101
-				if (!@is_readable($dir_plugins . "$plug/$optfile")) {
101
+				if (!@is_readable($dir_plugins."$plug/$optfile")) {
102 102
 					if (!$silence) {
103
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
103
+						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $optfile";
104 104
 					}
105 105
 				}
106 106
 			}
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 			// verif que la methode a un nom autorise
135 135
 			if (in_array(strtolower($action), $liste_methodes_reservees)) {
136 136
 				if (!$silence) {
137
-					$arbre['erreur'][] = _T("erreur_plugin_nom_fonction_interdit") . " : $action";
137
+					$arbre['erreur'][] = _T("erreur_plugin_nom_fonction_interdit")." : $action";
138 138
 				}
139 139
 			}
140 140
 			if (isset($pipe['inclure'])) {
141
-				$inclure = $dir_plugins . "$plug/" . $pipe['inclure'];
141
+				$inclure = $dir_plugins."$plug/".$pipe['inclure'];
142 142
 				if (!@is_readable($inclure)) {
143 143
 					if (!$silence) {
144
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure";
144
+						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $inclure";
145 145
 					}
146 146
 				}
147 147
 			}
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
 			foreach ($arbre['noisette'] as $k => $nut) {
208 208
 				$nut = preg_replace(',[.]html$,uims', '', trim($nut));
209 209
 				$arbre['noisette'][$k] = $nut;
210
-				if (!@is_readable($dir_plugins . "$plug/$nut.html")) {
210
+				if (!@is_readable($dir_plugins."$plug/$nut.html")) {
211 211
 					if (!$silence) {
212
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut";
212
+						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent')." : $nut";
213 213
 					}
214 214
 				}
215 215
 			}
Please login to merge, or discard this patch.
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 include_spip('inc/xml');
@@ -19,208 +19,208 @@  discard block
 block discarded – undo
19 19
 
20 20
 // https://code.spip.net/@plugin_verifie_conformite
21 21
 function plugins_verifie_conformite_dist($plug, &$arbre, $dir_plugins = _DIR_PLUGINS) {
22
-	static $etats = array('dev', 'experimental', 'test', 'stable');
22
+    static $etats = array('dev', 'experimental', 'test', 'stable');
23 23
 
24
-	$matches = array();
25
-	$silence = false;
26
-	$p = null;
27
-	// chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP
28
-	if ($n = spip_xml_match_nodes(",^plugin(\s|$),", $arbre, $matches)) {
29
-		// version de SPIP
30
-		$vspip = $GLOBALS['spip_version_branche'];
31
-		foreach ($matches as $tag => $sous) {
32
-			list($tagname, $atts) = spip_xml_decompose_tag($tag);
33
-			if ($tagname == 'plugin' and is_array($sous)) {
34
-				// On rajoute la condition sur $n :
35
-				// -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait
36
-				//    un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise
37
-				//    de la meme facon.
38
-				if (!isset($atts['spip'])
39
-					or $n == 1
40
-					or plugin_version_compatible($atts['spip'], $vspip, 'spip')
41
-				) {
42
-					// on prend la derniere declaration avec ce nom
43
-					$p = end($sous);
44
-					$compat_spip = isset($atts['spip']) ? $atts['spip'] : '';
45
-				}
46
-			}
47
-		}
48
-	}
49
-	if (is_null($p)) {
50
-		$arbre = array('erreur' => array(_T('erreur_plugin_tag_plugin_absent') . " : $plug"));
51
-		$silence = true;
52
-	} else {
53
-		$arbre = $p;
54
-	}
55
-	if (!is_array($arbre)) {
56
-		$arbre = array();
57
-	}
58
-	// verification de la conformite du plugin avec quelques
59
-	// precautions elementaires
60
-	if (!isset($arbre['nom'])) {
61
-		if (!$silence) {
62
-			$arbre['erreur'][] = _T('erreur_plugin_nom_manquant');
63
-		}
64
-		$arbre['nom'] = array("");
65
-	}
66
-	if (!isset($arbre['version'])) {
67
-		if (!$silence) {
68
-			$arbre['erreur'][] = _T('erreur_plugin_version_manquant');
69
-		}
70
-		$arbre['version'] = array("");
71
-	}
72
-	if (!isset($arbre['prefix'])) {
73
-		if (!$silence) {
74
-			$arbre['erreur'][] = _T('erreur_plugin_prefix_manquant');
75
-		}
76
-		$arbre['prefix'] = array("");
77
-	} else {
78
-		$prefix = trim(end($arbre['prefix']));
79
-		if (strtoupper($prefix) == 'SPIP' and $plug != "./") {
80
-			$arbre['erreur'][] = _T('erreur_plugin_prefix_interdit');
81
-		}
82
-		if (isset($arbre['etat'])) {
83
-			$etat = trim(end($arbre['etat']));
84
-			if (!in_array($etat, $etats)) {
85
-				$arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'";
86
-			}
87
-		}
88
-		if (isset($arbre['options'])) {
89
-			foreach ($arbre['options'] as $optfile) {
90
-				$optfile = trim($optfile);
91
-				if (!@is_readable($dir_plugins . "$plug/$optfile")) {
92
-					if (!$silence) {
93
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
94
-					}
95
-				}
96
-			}
97
-		}
98
-		if (isset($arbre['fonctions'])) {
99
-			foreach ($arbre['fonctions'] as $optfile) {
100
-				$optfile = trim($optfile);
101
-				if (!@is_readable($dir_plugins . "$plug/$optfile")) {
102
-					if (!$silence) {
103
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
104
-					}
105
-				}
106
-			}
107
-		}
108
-		$fonctions = array();
109
-		if (isset($arbre['fonctions'])) {
110
-			$fonctions = $arbre['fonctions'];
111
-		}
112
-		$liste_methodes_reservees = array(
113
-			'__construct',
114
-			'__destruct',
115
-			'plugin',
116
-			'install',
117
-			'uninstall',
118
-			strtolower($prefix)
119
-		);
24
+    $matches = array();
25
+    $silence = false;
26
+    $p = null;
27
+    // chercher la declaration <plugin spip='...'> a prendre pour cette version de SPIP
28
+    if ($n = spip_xml_match_nodes(",^plugin(\s|$),", $arbre, $matches)) {
29
+        // version de SPIP
30
+        $vspip = $GLOBALS['spip_version_branche'];
31
+        foreach ($matches as $tag => $sous) {
32
+            list($tagname, $atts) = spip_xml_decompose_tag($tag);
33
+            if ($tagname == 'plugin' and is_array($sous)) {
34
+                // On rajoute la condition sur $n :
35
+                // -- en effet si $n==1 on a pas plus a choisir la balise que l'on ait
36
+                //    un attribut spip ou pas. Cela permet de traiter tous les cas mono-balise
37
+                //    de la meme facon.
38
+                if (!isset($atts['spip'])
39
+                    or $n == 1
40
+                    or plugin_version_compatible($atts['spip'], $vspip, 'spip')
41
+                ) {
42
+                    // on prend la derniere declaration avec ce nom
43
+                    $p = end($sous);
44
+                    $compat_spip = isset($atts['spip']) ? $atts['spip'] : '';
45
+                }
46
+            }
47
+        }
48
+    }
49
+    if (is_null($p)) {
50
+        $arbre = array('erreur' => array(_T('erreur_plugin_tag_plugin_absent') . " : $plug"));
51
+        $silence = true;
52
+    } else {
53
+        $arbre = $p;
54
+    }
55
+    if (!is_array($arbre)) {
56
+        $arbre = array();
57
+    }
58
+    // verification de la conformite du plugin avec quelques
59
+    // precautions elementaires
60
+    if (!isset($arbre['nom'])) {
61
+        if (!$silence) {
62
+            $arbre['erreur'][] = _T('erreur_plugin_nom_manquant');
63
+        }
64
+        $arbre['nom'] = array("");
65
+    }
66
+    if (!isset($arbre['version'])) {
67
+        if (!$silence) {
68
+            $arbre['erreur'][] = _T('erreur_plugin_version_manquant');
69
+        }
70
+        $arbre['version'] = array("");
71
+    }
72
+    if (!isset($arbre['prefix'])) {
73
+        if (!$silence) {
74
+            $arbre['erreur'][] = _T('erreur_plugin_prefix_manquant');
75
+        }
76
+        $arbre['prefix'] = array("");
77
+    } else {
78
+        $prefix = trim(end($arbre['prefix']));
79
+        if (strtoupper($prefix) == 'SPIP' and $plug != "./") {
80
+            $arbre['erreur'][] = _T('erreur_plugin_prefix_interdit');
81
+        }
82
+        if (isset($arbre['etat'])) {
83
+            $etat = trim(end($arbre['etat']));
84
+            if (!in_array($etat, $etats)) {
85
+                $arbre['erreur'][] = _T('erreur_plugin_etat_inconnu') . " : '$etat'";
86
+            }
87
+        }
88
+        if (isset($arbre['options'])) {
89
+            foreach ($arbre['options'] as $optfile) {
90
+                $optfile = trim($optfile);
91
+                if (!@is_readable($dir_plugins . "$plug/$optfile")) {
92
+                    if (!$silence) {
93
+                        $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
94
+                    }
95
+                }
96
+            }
97
+        }
98
+        if (isset($arbre['fonctions'])) {
99
+            foreach ($arbre['fonctions'] as $optfile) {
100
+                $optfile = trim($optfile);
101
+                if (!@is_readable($dir_plugins . "$plug/$optfile")) {
102
+                    if (!$silence) {
103
+                        $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $optfile";
104
+                    }
105
+                }
106
+            }
107
+        }
108
+        $fonctions = array();
109
+        if (isset($arbre['fonctions'])) {
110
+            $fonctions = $arbre['fonctions'];
111
+        }
112
+        $liste_methodes_reservees = array(
113
+            '__construct',
114
+            '__destruct',
115
+            'plugin',
116
+            'install',
117
+            'uninstall',
118
+            strtolower($prefix)
119
+        );
120 120
 
121
-		$extraire_pipelines = charger_fonction("extraire_pipelines", "plugins");
122
-		$arbre['pipeline'] = $extraire_pipelines($arbre);
123
-		foreach ($arbre['pipeline'] as $pipe) {
124
-			if (!isset($pipe['nom'])) {
125
-				if (!$silence) {
126
-					$arbre['erreur'][] = _T("erreur_plugin_nom_pipeline_non_defini");
127
-				}
128
-			}
129
-			if (isset($pipe['action'])) {
130
-				$action = $pipe['action'];
131
-			} else {
132
-				$action = $pipe['nom'];
133
-			}
134
-			// verif que la methode a un nom autorise
135
-			if (in_array(strtolower($action), $liste_methodes_reservees)) {
136
-				if (!$silence) {
137
-					$arbre['erreur'][] = _T("erreur_plugin_nom_fonction_interdit") . " : $action";
138
-				}
139
-			}
140
-			if (isset($pipe['inclure'])) {
141
-				$inclure = $dir_plugins . "$plug/" . $pipe['inclure'];
142
-				if (!@is_readable($inclure)) {
143
-					if (!$silence) {
144
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure";
145
-					}
146
-				}
147
-			}
148
-		}
149
-		$necessite = array();
150
-		$spip_trouve = false;
151
-		if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) {
152
-			foreach (array_keys($needs) as $tag) {
153
-				list($tag, $att) = spip_xml_decompose_tag($tag);
154
-				if (!isset($att['id'])) {
155
-					if (!$silence) {
156
-						$arbre['erreur'][] = _T('erreur_plugin_attribut_balise_manquant',
157
-							array('attribut' => 'id', 'balise' => $att));
158
-					}
159
-				} else {
160
-					$necessite[] = $att;
161
-				}
162
-				if (strtolower($att['id']) == 'spip') {
163
-					$spip_trouve = true;
164
-				}
165
-			}
166
-		}
167
-		if ($compat_spip and !$spip_trouve) {
168
-			$necessite[] = array('id' => 'spip', 'version' => $compat_spip);
169
-		}
170
-		$arbre['necessite'] = $necessite;
171
-		$utilise = array();
172
-		if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) {
173
-			foreach (array_keys($uses) as $tag) {
174
-				list($tag, $att) = spip_xml_decompose_tag($tag);
175
-				if (!isset($att['id'])) {
176
-					if (!$silence) {
177
-						$arbre['erreur'][] = _T('erreur_plugin_attribut_balise_manquant',
178
-							array('attribut' => 'id', 'balise' => $att));
179
-					}
180
-				} else {
181
-					$utilise[] = $att;
182
-				}
183
-			}
184
-		}
185
-		$arbre['utilise'] = $utilise;
186
-		$procure = array();
187
-		if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) {
188
-			foreach (array_keys($uses) as $tag) {
189
-				list($tag, $att) = spip_xml_decompose_tag($tag);
190
-				$procure[] = $att;
191
-			}
192
-		}
193
-		$arbre['procure'] = $procure;
194
-		$path = array();
195
-		if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) {
196
-			foreach (array_keys($paths) as $tag) {
197
-				list($tag, $att) = spip_xml_decompose_tag($tag);
198
-				$att['path'] = $att['dir']; // ancienne syntaxe
199
-				$path[] = $att;
200
-			}
201
-		} else {
202
-			$path = array(array('dir' => ''));
203
-		} // initialiser par defaut
204
-		$arbre['path'] = $path;
205
-		// exposer les noisettes
206
-		if (isset($arbre['noisette'])) {
207
-			foreach ($arbre['noisette'] as $k => $nut) {
208
-				$nut = preg_replace(',[.]html$,uims', '', trim($nut));
209
-				$arbre['noisette'][$k] = $nut;
210
-				if (!@is_readable($dir_plugins . "$plug/$nut.html")) {
211
-					if (!$silence) {
212
-						$arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut";
213
-					}
214
-				}
215
-			}
216
-		}
217
-		$traduire = array();
218
-		if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) {
219
-			foreach (array_keys($trads) as $tag) {
220
-				list($tag, $att) = spip_xml_decompose_tag($tag);
221
-				$traduire[] = $att;
222
-			}
223
-		}
224
-		$arbre['traduire'] = $traduire;
225
-	}
121
+        $extraire_pipelines = charger_fonction("extraire_pipelines", "plugins");
122
+        $arbre['pipeline'] = $extraire_pipelines($arbre);
123
+        foreach ($arbre['pipeline'] as $pipe) {
124
+            if (!isset($pipe['nom'])) {
125
+                if (!$silence) {
126
+                    $arbre['erreur'][] = _T("erreur_plugin_nom_pipeline_non_defini");
127
+                }
128
+            }
129
+            if (isset($pipe['action'])) {
130
+                $action = $pipe['action'];
131
+            } else {
132
+                $action = $pipe['nom'];
133
+            }
134
+            // verif que la methode a un nom autorise
135
+            if (in_array(strtolower($action), $liste_methodes_reservees)) {
136
+                if (!$silence) {
137
+                    $arbre['erreur'][] = _T("erreur_plugin_nom_fonction_interdit") . " : $action";
138
+                }
139
+            }
140
+            if (isset($pipe['inclure'])) {
141
+                $inclure = $dir_plugins . "$plug/" . $pipe['inclure'];
142
+                if (!@is_readable($inclure)) {
143
+                    if (!$silence) {
144
+                        $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $inclure";
145
+                    }
146
+                }
147
+            }
148
+        }
149
+        $necessite = array();
150
+        $spip_trouve = false;
151
+        if (spip_xml_match_nodes(',^necessite,', $arbre, $needs)) {
152
+            foreach (array_keys($needs) as $tag) {
153
+                list($tag, $att) = spip_xml_decompose_tag($tag);
154
+                if (!isset($att['id'])) {
155
+                    if (!$silence) {
156
+                        $arbre['erreur'][] = _T('erreur_plugin_attribut_balise_manquant',
157
+                            array('attribut' => 'id', 'balise' => $att));
158
+                    }
159
+                } else {
160
+                    $necessite[] = $att;
161
+                }
162
+                if (strtolower($att['id']) == 'spip') {
163
+                    $spip_trouve = true;
164
+                }
165
+            }
166
+        }
167
+        if ($compat_spip and !$spip_trouve) {
168
+            $necessite[] = array('id' => 'spip', 'version' => $compat_spip);
169
+        }
170
+        $arbre['necessite'] = $necessite;
171
+        $utilise = array();
172
+        if (spip_xml_match_nodes(',^utilise,', $arbre, $uses)) {
173
+            foreach (array_keys($uses) as $tag) {
174
+                list($tag, $att) = spip_xml_decompose_tag($tag);
175
+                if (!isset($att['id'])) {
176
+                    if (!$silence) {
177
+                        $arbre['erreur'][] = _T('erreur_plugin_attribut_balise_manquant',
178
+                            array('attribut' => 'id', 'balise' => $att));
179
+                    }
180
+                } else {
181
+                    $utilise[] = $att;
182
+                }
183
+            }
184
+        }
185
+        $arbre['utilise'] = $utilise;
186
+        $procure = array();
187
+        if (spip_xml_match_nodes(',^procure,', $arbre, $uses)) {
188
+            foreach (array_keys($uses) as $tag) {
189
+                list($tag, $att) = spip_xml_decompose_tag($tag);
190
+                $procure[] = $att;
191
+            }
192
+        }
193
+        $arbre['procure'] = $procure;
194
+        $path = array();
195
+        if (spip_xml_match_nodes(',^chemin,', $arbre, $paths)) {
196
+            foreach (array_keys($paths) as $tag) {
197
+                list($tag, $att) = spip_xml_decompose_tag($tag);
198
+                $att['path'] = $att['dir']; // ancienne syntaxe
199
+                $path[] = $att;
200
+            }
201
+        } else {
202
+            $path = array(array('dir' => ''));
203
+        } // initialiser par defaut
204
+        $arbre['path'] = $path;
205
+        // exposer les noisettes
206
+        if (isset($arbre['noisette'])) {
207
+            foreach ($arbre['noisette'] as $k => $nut) {
208
+                $nut = preg_replace(',[.]html$,uims', '', trim($nut));
209
+                $arbre['noisette'][$k] = $nut;
210
+                if (!@is_readable($dir_plugins . "$plug/$nut.html")) {
211
+                    if (!$silence) {
212
+                        $arbre['erreur'][] = _T('erreur_plugin_fichier_absent') . " : $nut";
213
+                    }
214
+                }
215
+            }
216
+        }
217
+        $traduire = array();
218
+        if (spip_xml_match_nodes(',^traduire,', $arbre, $trads)) {
219
+            foreach (array_keys($trads) as $tag) {
220
+                list($tag, $att) = spip_xml_decompose_tag($tag);
221
+                $traduire[] = $att;
222
+            }
223
+        }
224
+        $arbre['traduire'] = $traduire;
225
+    }
226 226
 }
Please login to merge, or discard this patch.
ecrire/plugins/extraire_boutons.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 /**
@@ -21,30 +21,30 @@  discard block
 block discarded – undo
21 21
  * @return <type>
22 22
  */
23 23
 function plugins_extraire_boutons_dist($arbre) {
24
-	$ret = array('bouton' => array(), 'onglet' => array());
25
-	// recuperer les boutons et onglets si necessaire
26
-	spip_xml_match_nodes(",^(bouton|onglet)\s,", $arbre, $les_boutons);
27
-	if (is_array($les_boutons) && count($les_boutons)) {
28
-		$ret['bouton'] = array();
29
-		$ret['onglet'] = array();
30
-		foreach ($les_boutons as $bouton => $val) {
31
-			$bouton = spip_xml_decompose_tag($bouton);
32
-			$type = reset($bouton);
33
-			$bouton = end($bouton);
34
-			if (isset($bouton['id'])) {
35
-				$id = $bouton['id'];
36
-				$val = reset($val);
37
-				if (is_array($val)) {
38
-					$ret[$type][$id]['parent'] = isset($bouton['parent']) ? $bouton['parent'] : '';
39
-					$ret[$type][$id]['position'] = isset($bouton['position']) ? $bouton['position'] : '';
40
-					$ret[$type][$id]['titre'] = isset($val['titre']) ? trim(spip_xml_aplatit($val['titre'])) : '';
41
-					$ret[$type][$id]['icone'] = isset($val['icone']) ? trim(end($val['icone'])) : '';
42
-					$ret[$type][$id]['action'] = isset($val['url']) ? trim(end($val['url'])) : '';
43
-					$ret[$type][$id]['parametres'] = isset($val['args']) ? trim(end($val['args'])) : '';
44
-				}
45
-			}
46
-		}
47
-	}
24
+    $ret = array('bouton' => array(), 'onglet' => array());
25
+    // recuperer les boutons et onglets si necessaire
26
+    spip_xml_match_nodes(",^(bouton|onglet)\s,", $arbre, $les_boutons);
27
+    if (is_array($les_boutons) && count($les_boutons)) {
28
+        $ret['bouton'] = array();
29
+        $ret['onglet'] = array();
30
+        foreach ($les_boutons as $bouton => $val) {
31
+            $bouton = spip_xml_decompose_tag($bouton);
32
+            $type = reset($bouton);
33
+            $bouton = end($bouton);
34
+            if (isset($bouton['id'])) {
35
+                $id = $bouton['id'];
36
+                $val = reset($val);
37
+                if (is_array($val)) {
38
+                    $ret[$type][$id]['parent'] = isset($bouton['parent']) ? $bouton['parent'] : '';
39
+                    $ret[$type][$id]['position'] = isset($bouton['position']) ? $bouton['position'] : '';
40
+                    $ret[$type][$id]['titre'] = isset($val['titre']) ? trim(spip_xml_aplatit($val['titre'])) : '';
41
+                    $ret[$type][$id]['icone'] = isset($val['icone']) ? trim(end($val['icone'])) : '';
42
+                    $ret[$type][$id]['action'] = isset($val['url']) ? trim(end($val['url'])) : '';
43
+                    $ret[$type][$id]['parametres'] = isset($val['args']) ? trim(end($val['args'])) : '';
44
+                }
45
+            }
46
+        }
47
+    }
48 48
 
49
-	return $ret;
49
+    return $ret;
50 50
 }
Please login to merge, or discard this patch.
ecrire/plugins/afficher_repertoires.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 				$plug = $liste_plugins[$key];
59 59
 				$actif = @isset($fast_liste_plugins_actifs[$plug]);
60 60
 				$id = substr(md5($plug), 0, 16);
61
-				$res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug), $actif,
62
-						'menu-entree') . "\n";
61
+				$res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE.$plug), $actif,
62
+						'menu-entree')."\n";
63 63
 				unset($liste_plugins[$key]);
64 64
 			}
65 65
 		}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 	}
102 102
 	$chemin = "";
103 103
 	if (count($tcom)) {
104
-		$chemin .= implode("/", $tcom) . "/";
104
+		$chemin .= implode("/", $tcom)."/";
105 105
 	}
106 106
 	// ouvrir les repertoires jusqu'a la cible
107 107
 	while ($open = array_shift($ttarg)) {
108
-		$visible = @isset($deplie[$chemin . $open]);
109
-		$chemin .= $open . "/";
108
+		$visible = @isset($deplie[$chemin.$open]);
109
+		$chemin .= $open."/";
110 110
 		$output .= "<li>";
111 111
 		$output .= bouton_block_depliable($chemin, $visible);
112 112
 		$output .= debut_block_depliable($visible);
Please login to merge, or discard this patch.
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -11,64 +11,64 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 // https://code.spip.net/@affiche_arbre_plugins
18 18
 function plugins_afficher_repertoires_dist($url_page, $liste_plugins, $liste_plugins_actifs) {
19
-	$ligne_plug = charger_fonction('afficher_plugin', 'plugins');
20
-	$racine = basename(_DIR_PLUGINS);
21
-	$init_dir = $current_dir = "";
22
-	// liste des repertoires deplies : construit en remontant l'arbo de chaque plugin actif
23
-	// des qu'un path est deja note deplie on s'arrete
24
-	$deplie = array($racine => true);
25
-	$fast_liste_plugins_actifs = array();
26
-	foreach ($liste_plugins_actifs as $key => $plug) {
27
-		$chemin_plug = chemin_plug($racine, $plug);
28
-		$fast_liste_plugins_actifs[$chemin_plug] = true;
29
-		$dir = dirname($chemin_plug);
30
-		$maxiter = 100;
31
-		while (strlen($dir) && !isset($deplie[$dir]) && $dir != $racine && $maxiter-- > 0) {
32
-			$deplie[$dir] = true;
33
-			$dir = dirname($dir);
34
-		}
35
-	}
19
+    $ligne_plug = charger_fonction('afficher_plugin', 'plugins');
20
+    $racine = basename(_DIR_PLUGINS);
21
+    $init_dir = $current_dir = "";
22
+    // liste des repertoires deplies : construit en remontant l'arbo de chaque plugin actif
23
+    // des qu'un path est deja note deplie on s'arrete
24
+    $deplie = array($racine => true);
25
+    $fast_liste_plugins_actifs = array();
26
+    foreach ($liste_plugins_actifs as $key => $plug) {
27
+        $chemin_plug = chemin_plug($racine, $plug);
28
+        $fast_liste_plugins_actifs[$chemin_plug] = true;
29
+        $dir = dirname($chemin_plug);
30
+        $maxiter = 100;
31
+        while (strlen($dir) && !isset($deplie[$dir]) && $dir != $racine && $maxiter-- > 0) {
32
+            $deplie[$dir] = true;
33
+            $dir = dirname($dir);
34
+        }
35
+    }
36 36
 
37
-	// index repertoires --> plugin
38
-	$dir_index = array();
39
-	foreach ($liste_plugins as $key => $plug) {
40
-		$liste_plugins[$key] = chemin_plug($racine, $plug);
41
-		$dir_index[dirname($liste_plugins[$key])][] = $key;
42
-	}
37
+    // index repertoires --> plugin
38
+    $dir_index = array();
39
+    foreach ($liste_plugins as $key => $plug) {
40
+        $liste_plugins[$key] = chemin_plug($racine, $plug);
41
+        $dir_index[dirname($liste_plugins[$key])][] = $key;
42
+    }
43 43
 
44
-	$visible = @isset($deplie[$current_dir]);
45
-	$maxiter = 1000;
44
+    $visible = @isset($deplie[$current_dir]);
45
+    $maxiter = 1000;
46 46
 
47
-	$res = '';
48
-	while (count($liste_plugins) && $maxiter--) {
49
-		// le rep suivant
50
-		$dir = dirname(reset($liste_plugins));
51
-		if ($dir != $current_dir) {
52
-			$res .= tree_open_close_dir($current_dir, $dir, $deplie);
53
-		}
47
+    $res = '';
48
+    while (count($liste_plugins) && $maxiter--) {
49
+        // le rep suivant
50
+        $dir = dirname(reset($liste_plugins));
51
+        if ($dir != $current_dir) {
52
+            $res .= tree_open_close_dir($current_dir, $dir, $deplie);
53
+        }
54 54
 
55
-		// d'abord tous les plugins du rep courant
56
-		if (isset($dir_index[$current_dir])) {
57
-			foreach ($dir_index[$current_dir] as $key) {
58
-				$plug = $liste_plugins[$key];
59
-				$actif = @isset($fast_liste_plugins_actifs[$plug]);
60
-				$id = substr(md5($plug), 0, 16);
61
-				$res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug), $actif,
62
-						'menu-entree') . "\n";
63
-				unset($liste_plugins[$key]);
64
-			}
65
-		}
66
-	}
67
-	$res .= tree_open_close_dir($current_dir, $init_dir, true);
55
+        // d'abord tous les plugins du rep courant
56
+        if (isset($dir_index[$current_dir])) {
57
+            foreach ($dir_index[$current_dir] as $key) {
58
+                $plug = $liste_plugins[$key];
59
+                $actif = @isset($fast_liste_plugins_actifs[$plug]);
60
+                $id = substr(md5($plug), 0, 16);
61
+                $res .= $ligne_plug($url_page, str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug), $actif,
62
+                        'menu-entree') . "\n";
63
+                unset($liste_plugins[$key]);
64
+            }
65
+        }
66
+    }
67
+    $res .= tree_open_close_dir($current_dir, $init_dir, true);
68 68
 
69
-	return "<ul class='menu-liste plugins'>"
70
-	. $res
71
-	. "</ul>";
69
+    return "<ul class='menu-liste plugins'>"
70
+    . $res
71
+    . "</ul>";
72 72
 }
73 73
 
74 74
 
@@ -76,44 +76,44 @@  discard block
 block discarded – undo
76 76
 // une fonction pour aider...
77 77
 // https://code.spip.net/@chemin_plug
78 78
 function chemin_plug($racine, $plug) {
79
-	return preg_replace(',[^/]+/\.\./,', '', "$racine/$plug");
79
+    return preg_replace(',[^/]+/\.\./,', '', "$racine/$plug");
80 80
 }
81 81
 
82 82
 // https://code.spip.net/@tree_open_close_dir
83 83
 function tree_open_close_dir(&$current, $target, $deplie = array()) {
84
-	if ($current == $target) {
85
-		return "";
86
-	}
87
-	$tcur = explode("/", $current);
88
-	$ttarg = explode("/", $target);
89
-	$tcom = array();
90
-	$output = "";
91
-	// la partie commune
92
-	while (reset($tcur) == reset($ttarg)) {
93
-		$tcom[] = array_shift($tcur);
94
-		array_shift($ttarg);
95
-	}
96
-	// fermer les repertoires courant jusqu'au point de fork
97
-	while ($close = array_pop($tcur)) {
98
-		$output .= "</ul>\n";
99
-		$output .= fin_block();
100
-		$output .= "</li>\n";
101
-	}
102
-	$chemin = "";
103
-	if (count($tcom)) {
104
-		$chemin .= implode("/", $tcom) . "/";
105
-	}
106
-	// ouvrir les repertoires jusqu'a la cible
107
-	while ($open = array_shift($ttarg)) {
108
-		$visible = @isset($deplie[$chemin . $open]);
109
-		$chemin .= $open . "/";
110
-		$output .= "<li>";
111
-		$output .= bouton_block_depliable($chemin, $visible);
112
-		$output .= debut_block_depliable($visible);
84
+    if ($current == $target) {
85
+        return "";
86
+    }
87
+    $tcur = explode("/", $current);
88
+    $ttarg = explode("/", $target);
89
+    $tcom = array();
90
+    $output = "";
91
+    // la partie commune
92
+    while (reset($tcur) == reset($ttarg)) {
93
+        $tcom[] = array_shift($tcur);
94
+        array_shift($ttarg);
95
+    }
96
+    // fermer les repertoires courant jusqu'au point de fork
97
+    while ($close = array_pop($tcur)) {
98
+        $output .= "</ul>\n";
99
+        $output .= fin_block();
100
+        $output .= "</li>\n";
101
+    }
102
+    $chemin = "";
103
+    if (count($tcom)) {
104
+        $chemin .= implode("/", $tcom) . "/";
105
+    }
106
+    // ouvrir les repertoires jusqu'a la cible
107
+    while ($open = array_shift($ttarg)) {
108
+        $visible = @isset($deplie[$chemin . $open]);
109
+        $chemin .= $open . "/";
110
+        $output .= "<li>";
111
+        $output .= bouton_block_depliable($chemin, $visible);
112
+        $output .= debut_block_depliable($visible);
113 113
 
114
-		$output .= "<ul>\n";
115
-	}
116
-	$current = $target;
114
+        $output .= "<ul>\n";
115
+    }
116
+    $current = $target;
117 117
 
118
-	return $output;
118
+    return $output;
119 119
 }
Please login to merge, or discard this patch.
ecrire/plugins/afficher_liste.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	asort($liste_plugins);
65 65
 	$exposed = urldecode(_request('plugin'));
66 66
 
67
-	$block_par_lettre = false;//count($liste_plugins)>10;
67
+	$block_par_lettre = false; //count($liste_plugins)>10;
68 68
 	$fast_liste_plugins_actifs = array();
69 69
 	$fast_liste_plugins_checked = array();
70 70
 	if (is_array($liste_plugins_actifs)) {
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 		$actif = isset($fast_liste_plugins_actifs[$plug]);
90 90
 		$checked = isset($fast_liste_plugins_checked[$plug]);
91 91
 		$block_actif = $block_actif | $actif;
92
-		$expose = ($exposed and ($exposed == $plug or $exposed == $dir_plugins . $plug or $exposed == substr($dir_plugins,
93
-					strlen(_DIR_RACINE)) . $plug));
94
-		$block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, "item", $dir_plugins) . "\n";
92
+		$expose = ($exposed and ($exposed == $plug or $exposed == $dir_plugins.$plug or $exposed == substr($dir_plugins,
93
+					strlen(_DIR_RACINE)).$plug));
94
+		$block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, "item", $dir_plugins)."\n";
95 95
 	}
96 96
 	$res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block;
97 97
 	$class = basename($dir_plugins);
Please login to merge, or discard this patch.
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 include_spip('inc/charsets');
17 17
 
@@ -28,88 +28,88 @@  discard block
 block discarded – undo
28 28
  * @return string
29 29
  */
30 30
 function plugins_afficher_liste_dist(
31
-	$url_page,
32
-	$liste_plugins,
33
-	$liste_plugins_checked,
34
-	$liste_plugins_actifs,
35
-	$dir_plugins = _DIR_PLUGINS,
36
-	$afficher_un = 'afficher_plugin'
31
+    $url_page,
32
+    $liste_plugins,
33
+    $liste_plugins_checked,
34
+    $liste_plugins_actifs,
35
+    $dir_plugins = _DIR_PLUGINS,
36
+    $afficher_un = 'afficher_plugin'
37 37
 ) {
38
-	$get_infos = charger_fonction('get_infos', 'plugins');
39
-	$ligne_plug = charger_fonction($afficher_un, 'plugins');
38
+    $get_infos = charger_fonction('get_infos', 'plugins');
39
+    $ligne_plug = charger_fonction($afficher_un, 'plugins');
40 40
 
41
-	$all_infos = $get_infos($liste_plugins, false, $dir_plugins);
41
+    $all_infos = $get_infos($liste_plugins, false, $dir_plugins);
42 42
 
43
-	$all_infos = pipeline('filtrer_liste_plugins',
44
-		array(
45
-			'args' => array(
46
-				'liste_plugins' => $liste_plugins,
47
-				'liste_plugins_checked' => $liste_plugins_checked,
48
-				'liste_plugins_actifs' => $liste_plugins_actifs,
49
-				'dir_plugins' => $dir_plugins
50
-			),
51
-			'data' => $all_infos
52
-		)
53
-	);
43
+    $all_infos = pipeline('filtrer_liste_plugins',
44
+        array(
45
+            'args' => array(
46
+                'liste_plugins' => $liste_plugins,
47
+                'liste_plugins_checked' => $liste_plugins_checked,
48
+                'liste_plugins_actifs' => $liste_plugins_actifs,
49
+                'dir_plugins' => $dir_plugins
50
+            ),
51
+            'data' => $all_infos
52
+        )
53
+    );
54 54
 
55
-	$liste_plugins = array_flip($liste_plugins);
56
-	foreach ($liste_plugins as $chemin => $v) {
57
-		// des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte.
58
-		if (isset($all_infos[$chemin])) {
59
-			$liste_plugins[$chemin] = strtoupper(trim(typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom']))))));
60
-		} else {
61
-			unset($liste_plugins[$chemin]);
62
-		}
63
-	}
64
-	asort($liste_plugins);
65
-	$exposed = urldecode(_request('plugin'));
55
+    $liste_plugins = array_flip($liste_plugins);
56
+    foreach ($liste_plugins as $chemin => $v) {
57
+        // des plugins ont pu etre enleves de la liste par le pipeline. On en tient compte.
58
+        if (isset($all_infos[$chemin])) {
59
+            $liste_plugins[$chemin] = strtoupper(trim(typo(translitteration(unicode2charset(html2unicode($all_infos[$chemin]['nom']))))));
60
+        } else {
61
+            unset($liste_plugins[$chemin]);
62
+        }
63
+    }
64
+    asort($liste_plugins);
65
+    $exposed = urldecode(_request('plugin'));
66 66
 
67
-	$block_par_lettre = false;//count($liste_plugins)>10;
68
-	$fast_liste_plugins_actifs = array();
69
-	$fast_liste_plugins_checked = array();
70
-	if (is_array($liste_plugins_actifs)) {
71
-		$fast_liste_plugins_actifs = array_flip($liste_plugins_actifs);
72
-	}
73
-	if (is_array($liste_plugins_checked)) {
74
-		$fast_liste_plugins_checked = array_flip($liste_plugins_checked);
75
-	}
67
+    $block_par_lettre = false;//count($liste_plugins)>10;
68
+    $fast_liste_plugins_actifs = array();
69
+    $fast_liste_plugins_checked = array();
70
+    if (is_array($liste_plugins_actifs)) {
71
+        $fast_liste_plugins_actifs = array_flip($liste_plugins_actifs);
72
+    }
73
+    if (is_array($liste_plugins_checked)) {
74
+        $fast_liste_plugins_checked = array_flip($liste_plugins_checked);
75
+    }
76 76
 
77
-	$res = '';
78
-	$block = '';
79
-	$initiale = '';
80
-	$block_actif = false;
81
-	foreach ($liste_plugins as $plug => $nom) {
82
-		if (($i = substr($nom, 0, 1)) !== $initiale) {
83
-			$res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block;
84
-			$initiale = $i;
85
-			$block = '';
86
-			$block_actif = false;
87
-		}
88
-		// le rep suivant
89
-		$actif = isset($fast_liste_plugins_actifs[$plug]);
90
-		$checked = isset($fast_liste_plugins_checked[$plug]);
91
-		$block_actif = $block_actif | $actif;
92
-		$expose = ($exposed and ($exposed == $plug or $exposed == $dir_plugins . $plug or $exposed == substr($dir_plugins,
93
-					strlen(_DIR_RACINE)) . $plug));
94
-		$block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, "item", $dir_plugins) . "\n";
95
-	}
96
-	$res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block;
97
-	$class = basename($dir_plugins);
77
+    $res = '';
78
+    $block = '';
79
+    $initiale = '';
80
+    $block_actif = false;
81
+    foreach ($liste_plugins as $plug => $nom) {
82
+        if (($i = substr($nom, 0, 1)) !== $initiale) {
83
+            $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block;
84
+            $initiale = $i;
85
+            $block = '';
86
+            $block_actif = false;
87
+        }
88
+        // le rep suivant
89
+        $actif = isset($fast_liste_plugins_actifs[$plug]);
90
+        $checked = isset($fast_liste_plugins_checked[$plug]);
91
+        $block_actif = $block_actif | $actif;
92
+        $expose = ($exposed and ($exposed == $plug or $exposed == $dir_plugins . $plug or $exposed == substr($dir_plugins,
93
+                    strlen(_DIR_RACINE)) . $plug));
94
+        $block .= $ligne_plug($url_page, $plug, $checked, $actif, $expose, "item", $dir_plugins) . "\n";
95
+    }
96
+    $res .= $block_par_lettre ? affiche_block_initiale($initiale, $block, $block_actif) : $block;
97
+    $class = basename($dir_plugins);
98 98
 
99
-	return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : "";
99
+    return $res ? "<ul class='liste-items plugins $class'>$res</ul>" : "";
100 100
 }
101 101
 
102 102
 
103 103
 // https://code.spip.net/@affiche_block_initiale
104 104
 function affiche_block_initiale($initiale, $block, $block_actif) {
105
-	if (strlen($block)) {
106
-		return "<li class='item'>"
107
-		. bouton_block_depliable($initiale, $block_actif ? true : false)
108
-		. debut_block_depliable($block_actif)
109
-		. "<ul>$block</ul>"
110
-		. fin_block()
111
-		. "</li>";
112
-	}
105
+    if (strlen($block)) {
106
+        return "<li class='item'>"
107
+        . bouton_block_depliable($initiale, $block_actif ? true : false)
108
+        . debut_block_depliable($block_actif)
109
+        . "<ul>$block</ul>"
110
+        . fin_block()
111
+        . "</li>";
112
+    }
113 113
 
114
-	return "";
114
+    return "";
115 115
 }
Please login to merge, or discard this patch.
ecrire/urls/page.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 # attention toutefois seuls '' et '=' figurent dans les modes de compatibilite
24 24
 define('_separateur_urls_page', '');
25 25
 # on peut indiquer '' si on a installe le .htaccess
26
-define('_debut_urls_page', get_spip_script('./') . '?');
26
+define('_debut_urls_page', get_spip_script('./').'?');
27 27
 #######
28 28
 
29 29
 
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 		}
38 38
 	}
39 39
 
40
-	$url = _debut_urls_page . $type . _separateur_urls_page
41
-		. $id . _terminaison_urls_page;
40
+	$url = _debut_urls_page.$type._separateur_urls_page
41
+		. $id._terminaison_urls_page;
42 42
 
43 43
 	if ($args) {
44 44
 		$args = strpos($url, '?') ? "&$args" : "?$args";
45 45
 	}
46 46
 
47
-	return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : '');
47
+	return _DIR_RACINE.$url.$args.($ancre ? "#$ancre" : '');
48 48
 }
49 49
 
50 50
 // retrouve le fond et les parametres d'une URL abregee
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 define('URLS_PAGE_EXEMPLE', 'spip.php?article12');
@@ -30,74 +30,74 @@  discard block
 block discarded – undo
30 30
 // https://code.spip.net/@_generer_url_page
31 31
 function _generer_url_page($type, $id, $args = '', $ancre = '') {
32 32
 
33
-	if ($generer_url_externe = charger_fonction("generer_url_$type", 'urls', true)) {
34
-		$url = $generer_url_externe($id, $args, $ancre);
35
-		if (null != $url) {
36
-			return $url;
37
-		}
38
-	}
33
+    if ($generer_url_externe = charger_fonction("generer_url_$type", 'urls', true)) {
34
+        $url = $generer_url_externe($id, $args, $ancre);
35
+        if (null != $url) {
36
+            return $url;
37
+        }
38
+    }
39 39
 
40
-	$url = _debut_urls_page . $type . _separateur_urls_page
41
-		. $id . _terminaison_urls_page;
40
+    $url = _debut_urls_page . $type . _separateur_urls_page
41
+        . $id . _terminaison_urls_page;
42 42
 
43
-	if ($args) {
44
-		$args = strpos($url, '?') ? "&$args" : "?$args";
45
-	}
43
+    if ($args) {
44
+        $args = strpos($url, '?') ? "&$args" : "?$args";
45
+    }
46 46
 
47
-	return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : '');
47
+    return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : '');
48 48
 }
49 49
 
50 50
 // retrouve le fond et les parametres d'une URL abregee
51 51
 // le contexte deja existant est fourni dans args sous forme de tableau ou query string
52 52
 // https://code.spip.net/@urls_page_dist
53 53
 function urls_page_dist($i, &$entite, $args = '', $ancre = '') {
54
-	if (is_numeric($i)) {
55
-		return _generer_url_page($entite, $i, $args, $ancre);
56
-	}
54
+    if (is_numeric($i)) {
55
+        return _generer_url_page($entite, $i, $args, $ancre);
56
+    }
57 57
 
58
-	// traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23
59
-	if ($GLOBALS['profondeur_url'] > 0 and $entite == 'sommaire') {
60
-		return array(array(), '404');
61
-	}
58
+    // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23
59
+    if ($GLOBALS['profondeur_url'] > 0 and $entite == 'sommaire') {
60
+        return array(array(), '404');
61
+    }
62 62
 
63
-	// voir s'il faut recuperer le id_* implicite et les &debut_xx;
64
-	if (is_array($args)) {
65
-		$contexte = $args;
66
-	} else {
67
-		parse_str($args, $contexte);
68
-	}
69
-	include_spip('inc/urls');
70
-	$r = nettoyer_url_page($i, $contexte);
71
-	if ($r) {
72
-		array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici
73
-		return $r;
74
-	}
63
+    // voir s'il faut recuperer le id_* implicite et les &debut_xx;
64
+    if (is_array($args)) {
65
+        $contexte = $args;
66
+    } else {
67
+        parse_str($args, $contexte);
68
+    }
69
+    include_spip('inc/urls');
70
+    $r = nettoyer_url_page($i, $contexte);
71
+    if ($r) {
72
+        array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici
73
+        return $r;
74
+    }
75 75
 
76
-	/*
76
+    /*
77 77
 	 * Le bloc qui suit sert a faciliter les transitions depuis
78 78
 	 * le mode 'urls-propres' vers les modes 'urls-standard' et 'url-html'
79 79
 	 * Il est inutile de le recopier si vous personnalisez vos URLs
80 80
 	 * et votre .htaccess
81 81
 	 */
82
-	// Si on est revenu en mode html, mais c'est une ancienne url_propre
83
-	// on ne redirige pas, on assume le nouveau contexte (si possible)
84
-	$url = $i;
85
-	$url_propre = isset($url)
86
-		? $url
87
-		: (isset($_SERVER['REDIRECT_url_propre'])
88
-			? $_SERVER['REDIRECT_url_propre']
89
-			: (isset($_ENV['url_propre'])
90
-				? $_ENV['url_propre']
91
-				: ''
92
-			));
93
-	if ($url_propre) {
94
-		if ($GLOBALS['profondeur_url'] <= 0) {
95
-			$urls_anciennes = charger_fonction('propres', 'urls', true);
96
-		} else {
97
-			$urls_anciennes = charger_fonction('arbo', 'urls', true);
98
-		}
82
+    // Si on est revenu en mode html, mais c'est une ancienne url_propre
83
+    // on ne redirige pas, on assume le nouveau contexte (si possible)
84
+    $url = $i;
85
+    $url_propre = isset($url)
86
+        ? $url
87
+        : (isset($_SERVER['REDIRECT_url_propre'])
88
+            ? $_SERVER['REDIRECT_url_propre']
89
+            : (isset($_ENV['url_propre'])
90
+                ? $_ENV['url_propre']
91
+                : ''
92
+            ));
93
+    if ($url_propre) {
94
+        if ($GLOBALS['profondeur_url'] <= 0) {
95
+            $urls_anciennes = charger_fonction('propres', 'urls', true);
96
+        } else {
97
+            $urls_anciennes = charger_fonction('arbo', 'urls', true);
98
+        }
99 99
 
100
-		return $urls_anciennes ? $urls_anciennes($url_propre, $entite, $contexte) : '';
101
-	}
102
-	/* Fin du bloc compatibilite url-propres */
100
+        return $urls_anciennes ? $urls_anciennes($url_propre, $entite, $contexte) : '';
101
+    }
102
+    /* Fin du bloc compatibilite url-propres */
103 103
 }
Please login to merge, or discard this patch.
ecrire/xml/interfaces.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 define('_REGEXP_DOCTYPE',
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 define('_REGEXP_ENTITY_DEF', '/^%(' . _SUB_REGEXP_SYMBOL . '+);/');
34 34
 define('_REGEXP_TYPE_XML', 'PUBLIC|SYSTEM|INCLUDE|IGNORE|CDATA');
35 35
 define('_REGEXP_ENTITY_DECL', '/^<!ENTITY\s+(%?)\s*(' .
36
-	_SUB_REGEXP_SYMBOL .
37
-	'+;?)\s+(' .
38
-	_REGEXP_TYPE_XML .
39
-	')?\s*(' .
40
-	"('([^']*)')" .
41
-	'|("([^"]*)")' .
42
-	'|\s*(%' . _SUB_REGEXP_SYMBOL . '+;)\s*' .
43
-	')\s*(--.*?--)?("([^"]*)")?\s*>\s*(.*)$/s');
36
+    _SUB_REGEXP_SYMBOL .
37
+    '+;?)\s+(' .
38
+    _REGEXP_TYPE_XML .
39
+    ')?\s*(' .
40
+    "('([^']*)')" .
41
+    '|("([^"]*)")' .
42
+    '|\s*(%' . _SUB_REGEXP_SYMBOL . '+;)\s*' .
43
+    ')\s*(--.*?--)?("([^"]*)")?\s*>\s*(.*)$/s');
44 44
 
45 45
 define('_REGEXP_INCLUDE_USE', '/^<!\[\s*%\s*([^;]*);\s*\[\s*(.*)$/s');
46 46
 
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
  * Document Type Compilation
51 51
  **/
52 52
 class DTC {
53
-	public $macros = array();
54
-	public $elements = array();
55
-	public $peres = array();
56
-	public $attributs = array();
57
-	public $entites = array();
58
-	public $regles = array();
59
-	public $pcdata = array();
53
+    public $macros = array();
54
+    public $elements = array();
55
+    public $peres = array();
56
+    public $attributs = array();
57
+    public $entites = array();
58
+    public $regles = array();
59
+    public $pcdata = array();
60 60
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -23,23 +23,23 @@
 block discarded – undo
23 23
 
24 24
 define('_SUB_REGEXP_SYMBOL', '[\w_:.-]');
25 25
 
26
-define('_REGEXP_NMTOKEN', '/^' . _SUB_REGEXP_SYMBOL . '+$/');
26
+define('_REGEXP_NMTOKEN', '/^'._SUB_REGEXP_SYMBOL.'+$/');
27 27
 
28
-define('_REGEXP_NMTOKENS', '/^(' . _SUB_REGEXP_SYMBOL . '+\s*)*$/');
28
+define('_REGEXP_NMTOKENS', '/^('._SUB_REGEXP_SYMBOL.'+\s*)*$/');
29 29
 
30
-define('_REGEXP_ID', '/^[A-Za-z_:]' . _SUB_REGEXP_SYMBOL . '*$/');
30
+define('_REGEXP_ID', '/^[A-Za-z_:]'._SUB_REGEXP_SYMBOL.'*$/');
31 31
 
32
-define('_REGEXP_ENTITY_USE', '/%(' . _SUB_REGEXP_SYMBOL . '+);/');
33
-define('_REGEXP_ENTITY_DEF', '/^%(' . _SUB_REGEXP_SYMBOL . '+);/');
32
+define('_REGEXP_ENTITY_USE', '/%('._SUB_REGEXP_SYMBOL.'+);/');
33
+define('_REGEXP_ENTITY_DEF', '/^%('._SUB_REGEXP_SYMBOL.'+);/');
34 34
 define('_REGEXP_TYPE_XML', 'PUBLIC|SYSTEM|INCLUDE|IGNORE|CDATA');
35
-define('_REGEXP_ENTITY_DECL', '/^<!ENTITY\s+(%?)\s*(' .
36
-	_SUB_REGEXP_SYMBOL .
37
-	'+;?)\s+(' .
38
-	_REGEXP_TYPE_XML .
39
-	')?\s*(' .
40
-	"('([^']*)')" .
41
-	'|("([^"]*)")' .
42
-	'|\s*(%' . _SUB_REGEXP_SYMBOL . '+;)\s*' .
35
+define('_REGEXP_ENTITY_DECL', '/^<!ENTITY\s+(%?)\s*('.
36
+	_SUB_REGEXP_SYMBOL.
37
+	'+;?)\s+('.
38
+	_REGEXP_TYPE_XML.
39
+	')?\s*('.
40
+	"('([^']*)')".
41
+	'|("([^"]*)")'.
42
+	'|\s*(%'._SUB_REGEXP_SYMBOL.'+;)\s*'.
43 43
 	')\s*(--.*?--)?("([^"]*)")?\s*>\s*(.*)$/s');
44 44
 
45 45
 define('_REGEXP_INCLUDE_USE', '/^<!\[\s*%\s*([^;]*);\s*\[\s*(.*)$/s');
Please login to merge, or discard this patch.