Completed
Push — master ( 09834f...75dce3 )
by cam
02:05
created
ecrire/inc/bandeau.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			$_id = $e['id_table_objet'];
52 52
 			if (isset($contexte[$_id]) && ($id = (int) $contexte[$_id])) {
53 53
 				$table = $e['table_objet_sql'];
54
-				$row = sql_fetsel('*', $table, "$_id=" . (int) $id);
54
+				$row = sql_fetsel('*', $table, "$_id=".(int) $id);
55 55
 				if (isset($row['id_rubrique'])) {
56 56
 					$contexte['id_rubrique'] = $row['id_rubrique'];
57 57
 					if (isset($row['id_secteur'])) {
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 				$boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position)
116 116
 					+ [
117 117
 						$id => new Bouton(
118
-							($icones && !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '',  // icone
119
-							$infos['titre'],  // titre
118
+							($icones && !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '', // icone
119
+							$infos['titre'], // titre
120 120
 							(isset($infos['action']) && $infos['action']) ? $infos['action'] : null,
121 121
 							(isset($infos['parametres']) && $infos['parametres']) ? $infos['parametres'] : null
122 122
 						)
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 				$boutons_admin = array_slice($boutons_admin, 0, $position)
134 134
 					+ [
135 135
 						$id => new Bouton(
136
-							($icones && isset($infos['icone']) && $infos['icone']) ? find_in_theme($infos['icone']) : '',  // icone
137
-							$infos['titre'],  // titre
136
+							($icones && isset($infos['icone']) && $infos['icone']) ? find_in_theme($infos['icone']) : '', // icone
137
+							$infos['titre'], // titre
138 138
 							(isset($infos['action']) && $infos['action']) ? $infos['action'] : null,
139 139
 							(isset($infos['parametres']) && $infos['parametres']) ? $infos['parametres'] : null
140 140
 						)
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		$url = str_replace('&', '&', $url);
222 222
 		while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) {
223 223
 			if ($matches[2] == 'id_secteur' && !isset($contexte['id_secteur']) && isset($contexte['id_rubrique'])) {
224
-				$contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . (int) $contexte['id_rubrique']);
224
+				$contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.(int) $contexte['id_rubrique']);
225 225
 			}
226 226
 			$val = _request($matches[2], $contexte);
227 227
 			$url = parametre_url($url, $matches[1], $val ?: '', '&');
Please login to merge, or discard this patch.
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  **/
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 
24 24
 include_spip('inc/boutons');
@@ -38,33 +38,33 @@  discard block
 block discarded – undo
38 38
  *     contexte
39 39
  **/
40 40
 function definir_barre_contexte($contexte = null) {
41
-	if (is_null($contexte)) {
42
-		$contexte = $_GET;
43
-	} elseif (is_string($contexte)) {
44
-		$contexte = unserialize($contexte);
45
-	}
46
-	if (!isset($contexte['id_rubrique']) && isset($contexte['exec'])) {
47
-		if (!function_exists('trouver_objet_exec')) {
48
-			include_spip('inc/pipelines_ecrire');
49
-		}
50
-		if ($e = trouver_objet_exec($contexte['exec'])) {
51
-			$_id = $e['id_table_objet'];
52
-			if (isset($contexte[$_id]) && ($id = (int) $contexte[$_id])) {
53
-				$table = $e['table_objet_sql'];
54
-				$row = sql_fetsel('*', $table, "$_id=" . (int) $id);
55
-				if (isset($row['id_rubrique'])) {
56
-					$contexte['id_rubrique'] = $row['id_rubrique'];
57
-					if (isset($row['id_secteur'])) {
58
-						$contexte['id_secteur'] = $row['id_secteur'];
59
-					}
60
-				} elseif (isset($row['id_groupe'])) {
61
-					// TODO supprimer ce bloc quand https://core.spip.net/issues/3844 sera réalisé
62
-					$contexte['id_groupe'] = $row['id_groupe'];
63
-				}
64
-			}
65
-		}
66
-	}
67
-	return $contexte;
41
+    if (is_null($contexte)) {
42
+        $contexte = $_GET;
43
+    } elseif (is_string($contexte)) {
44
+        $contexte = unserialize($contexte);
45
+    }
46
+    if (!isset($contexte['id_rubrique']) && isset($contexte['exec'])) {
47
+        if (!function_exists('trouver_objet_exec')) {
48
+            include_spip('inc/pipelines_ecrire');
49
+        }
50
+        if ($e = trouver_objet_exec($contexte['exec'])) {
51
+            $_id = $e['id_table_objet'];
52
+            if (isset($contexte[$_id]) && ($id = (int) $contexte[$_id])) {
53
+                $table = $e['table_objet_sql'];
54
+                $row = sql_fetsel('*', $table, "$_id=" . (int) $id);
55
+                if (isset($row['id_rubrique'])) {
56
+                    $contexte['id_rubrique'] = $row['id_rubrique'];
57
+                    if (isset($row['id_secteur'])) {
58
+                        $contexte['id_secteur'] = $row['id_secteur'];
59
+                    }
60
+                } elseif (isset($row['id_groupe'])) {
61
+                    // TODO supprimer ce bloc quand https://core.spip.net/issues/3844 sera réalisé
62
+                    $contexte['id_groupe'] = $row['id_groupe'];
63
+                }
64
+            }
65
+        }
66
+    }
67
+    return $contexte;
68 68
 }
69 69
 
70 70
 /**
@@ -80,89 +80,89 @@  discard block
 block discarded – undo
80 80
  * @return array
81 81
  */
82 82
 function definir_barre_boutons($contexte = [], $icones = true, $autorise = true) {
83
-	include_spip('inc/autoriser');
84
-	$boutons_admin = [];
83
+    include_spip('inc/autoriser');
84
+    $boutons_admin = [];
85 85
 
86
-	// les boutons du core, issus de ecrire/paquet.xml
87
-	$liste_boutons = [];
86
+    // les boutons du core, issus de ecrire/paquet.xml
87
+    $liste_boutons = [];
88 88
 
89
-	// ajouter les boutons issus des plugin via paquet.xml
90
-	if (
91
-		function_exists('boutons_plugins')
92
-		&& is_array($liste_boutons_plugins = boutons_plugins())
93
-	) {
94
-		$liste_boutons = &$liste_boutons_plugins;
95
-	}
89
+    // ajouter les boutons issus des plugin via paquet.xml
90
+    if (
91
+        function_exists('boutons_plugins')
92
+        && is_array($liste_boutons_plugins = boutons_plugins())
93
+    ) {
94
+        $liste_boutons = &$liste_boutons_plugins;
95
+    }
96 96
 
97
-	foreach ($liste_boutons as $id => $infos) {
98
-		$parent = '';
99
-		// les boutons principaux ne sont pas soumis a autorisation
100
-		if (
101
-			!isset($infos['parent'])
102
-			|| !($parent = $infos['parent'])
103
-			|| !$autorise
104
-			|| autoriser('menu', "_$id", 0, null, ['contexte' => $contexte])
105
-		) {
106
-			if (
107
-				$parent
108
-				&& ($parent = preg_replace(',^bando_,', 'menu_', (string) $parent))
109
-				&& isset($boutons_admin[$parent])
110
-			) {
111
-				$position = (isset($infos['position']) && strlen((string) $infos['position'])) ? (int) $infos['position'] : count($boutons_admin[$parent]->sousmenu);
112
-				if ($position < 0) {
113
-					$position = count($boutons_admin[$parent]->sousmenu) + 1 + $position;
114
-				}
115
-				$boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position)
116
-					+ [
117
-						$id => new Bouton(
118
-							($icones && !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '',  // icone
119
-							$infos['titre'],  // titre
120
-							(isset($infos['action']) && $infos['action']) ? $infos['action'] : null,
121
-							(isset($infos['parametres']) && $infos['parametres']) ? $infos['parametres'] : null
122
-						)
123
-					]
124
-					+ array_slice($boutons_admin[$parent]->sousmenu, $position, 100);
125
-			}
126
-			if (
127
-				!$parent
128
-				// provisoire, eviter les vieux boutons
129
-				&& !in_array($id, ['forum', 'statistiques_visites'])
130
-				&& (!$autorise || autoriser('menugrandeentree', "_$id", 0, null, ['contexte' => $contexte]))
131
-			) {
132
-				$position = (isset($infos['position']) && $infos['position']) ? $infos['position'] : count($boutons_admin);
133
-				$boutons_admin = array_slice($boutons_admin, 0, $position)
134
-					+ [
135
-						$id => new Bouton(
136
-							($icones && isset($infos['icone']) && $infos['icone']) ? find_in_theme($infos['icone']) : '',  // icone
137
-							$infos['titre'],  // titre
138
-							(isset($infos['action']) && $infos['action']) ? $infos['action'] : null,
139
-							(isset($infos['parametres']) && $infos['parametres']) ? $infos['parametres'] : null
140
-						)
141
-					]
142
-					+ array_slice($boutons_admin, $position, 100);
143
-			}
144
-		}
145
-	}
146
-	$boutons_admin = pipeline('ajouter_menus', $boutons_admin);
97
+    foreach ($liste_boutons as $id => $infos) {
98
+        $parent = '';
99
+        // les boutons principaux ne sont pas soumis a autorisation
100
+        if (
101
+            !isset($infos['parent'])
102
+            || !($parent = $infos['parent'])
103
+            || !$autorise
104
+            || autoriser('menu', "_$id", 0, null, ['contexte' => $contexte])
105
+        ) {
106
+            if (
107
+                $parent
108
+                && ($parent = preg_replace(',^bando_,', 'menu_', (string) $parent))
109
+                && isset($boutons_admin[$parent])
110
+            ) {
111
+                $position = (isset($infos['position']) && strlen((string) $infos['position'])) ? (int) $infos['position'] : count($boutons_admin[$parent]->sousmenu);
112
+                if ($position < 0) {
113
+                    $position = count($boutons_admin[$parent]->sousmenu) + 1 + $position;
114
+                }
115
+                $boutons_admin[$parent]->sousmenu = array_slice($boutons_admin[$parent]->sousmenu, 0, $position)
116
+                    + [
117
+                        $id => new Bouton(
118
+                            ($icones && !empty($infos['icone'])) ? find_in_theme($infos['icone']) : '',  // icone
119
+                            $infos['titre'],  // titre
120
+                            (isset($infos['action']) && $infos['action']) ? $infos['action'] : null,
121
+                            (isset($infos['parametres']) && $infos['parametres']) ? $infos['parametres'] : null
122
+                        )
123
+                    ]
124
+                    + array_slice($boutons_admin[$parent]->sousmenu, $position, 100);
125
+            }
126
+            if (
127
+                !$parent
128
+                // provisoire, eviter les vieux boutons
129
+                && !in_array($id, ['forum', 'statistiques_visites'])
130
+                && (!$autorise || autoriser('menugrandeentree', "_$id", 0, null, ['contexte' => $contexte]))
131
+            ) {
132
+                $position = (isset($infos['position']) && $infos['position']) ? $infos['position'] : count($boutons_admin);
133
+                $boutons_admin = array_slice($boutons_admin, 0, $position)
134
+                    + [
135
+                        $id => new Bouton(
136
+                            ($icones && isset($infos['icone']) && $infos['icone']) ? find_in_theme($infos['icone']) : '',  // icone
137
+                            $infos['titre'],  // titre
138
+                            (isset($infos['action']) && $infos['action']) ? $infos['action'] : null,
139
+                            (isset($infos['parametres']) && $infos['parametres']) ? $infos['parametres'] : null
140
+                        )
141
+                    ]
142
+                    + array_slice($boutons_admin, $position, 100);
143
+            }
144
+        }
145
+    }
146
+    $boutons_admin = pipeline('ajouter_menus', $boutons_admin);
147 147
 
148
-	// définir les favoris et positions d’origine
149
-	if ($boutons_admin) {
150
-		$menus_favoris = obtenir_menus_favoris();
151
-		$i = 1;
152
-		foreach ($boutons_admin as $key => $menu) {
153
-			$menu->favori = (int) table_valeur($menus_favoris, $key, false);
154
-			$menu->position = $i++;
155
-			if ($menu->sousmenu) {
156
-				$j = 1;
157
-				foreach ($menu->sousmenu as $key => $bouton) {
158
-					$bouton->favori = (int) table_valeur($menus_favoris, $key, false);
159
-					$bouton->position = $j++;
160
-				}
161
-			}
162
-		}
163
-	}
148
+    // définir les favoris et positions d’origine
149
+    if ($boutons_admin) {
150
+        $menus_favoris = obtenir_menus_favoris();
151
+        $i = 1;
152
+        foreach ($boutons_admin as $key => $menu) {
153
+            $menu->favori = (int) table_valeur($menus_favoris, $key, false);
154
+            $menu->position = $i++;
155
+            if ($menu->sousmenu) {
156
+                $j = 1;
157
+                foreach ($menu->sousmenu as $key => $bouton) {
158
+                    $bouton->favori = (int) table_valeur($menus_favoris, $key, false);
159
+                    $bouton->position = $j++;
160
+                }
161
+            }
162
+        }
163
+    }
164 164
 
165
-	return $boutons_admin;
165
+    return $boutons_admin;
166 166
 }
167 167
 
168 168
 /**
@@ -174,22 +174,22 @@  discard block
 block discarded – undo
174 174
  * @return Bouton[]
175 175
  */
176 176
 function trier_boutons_enfants_par_alpha($menus, $avec_favoris = false) {
177
-	foreach ($menus as $menu) {
178
-		if ($menu->sousmenu) {
179
-			$libelles = $isfavoris = $favoris = [];
180
-			foreach ($menu->sousmenu as $key => $item) {
181
-				$libelles[$key] = strtolower(translitteration(_T($item->libelle)));
182
-				$isfavoris[$key] = (bool) $item->favori;
183
-				$favoris[$key] = $item->favori;
184
-			}
185
-			if ($avec_favoris) {
186
-				array_multisort($isfavoris, SORT_DESC, $favoris, SORT_ASC, $libelles, SORT_ASC, $menu->sousmenu);
187
-			} else {
188
-				array_multisort($libelles, SORT_ASC, $menu->sousmenu);
189
-			}
190
-		}
191
-	}
192
-	return $menus;
177
+    foreach ($menus as $menu) {
178
+        if ($menu->sousmenu) {
179
+            $libelles = $isfavoris = $favoris = [];
180
+            foreach ($menu->sousmenu as $key => $item) {
181
+                $libelles[$key] = strtolower(translitteration(_T($item->libelle)));
182
+                $isfavoris[$key] = (bool) $item->favori;
183
+                $favoris[$key] = $item->favori;
184
+            }
185
+            if ($avec_favoris) {
186
+                array_multisort($isfavoris, SORT_DESC, $favoris, SORT_ASC, $libelles, SORT_ASC, $menu->sousmenu);
187
+            } else {
188
+                array_multisort($libelles, SORT_ASC, $menu->sousmenu);
189
+            }
190
+        }
191
+    }
192
+    return $menus;
193 193
 }
194 194
 
195 195
 /**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
  * @return Bouton[]
201 201
  */
202 202
 function trier_boutons_enfants_par_favoris_alpha($menus) {
203
-	return trier_boutons_enfants_par_alpha($menus, true);
203
+    return trier_boutons_enfants_par_alpha($menus, true);
204 204
 }
205 205
 
206 206
 
@@ -213,23 +213,23 @@  discard block
 block discarded – undo
213 213
  * @return string
214 214
  */
215 215
 function bandeau_creer_url($url, $args = '', $contexte = null) {
216
-	if (!preg_match(',[\/\?],', $url)) {
217
-		$url = generer_url_ecrire($url, $args, true);
218
-		// recuperer les parametres du contexte demande par l'url sous la forme
219
-		// &truc=@machin@
220
-		// @machin@ etant remplace par _request('machin')
221
-		$url = str_replace('&amp;', '&', $url);
222
-		while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) {
223
-			if ($matches[2] == 'id_secteur' && !isset($contexte['id_secteur']) && isset($contexte['id_rubrique'])) {
224
-				$contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . (int) $contexte['id_rubrique']);
225
-			}
226
-			$val = _request($matches[2], $contexte);
227
-			$url = parametre_url($url, $matches[1], $val ?: '', '&');
228
-		}
229
-		$url = str_replace('&', '&amp;', $url);
230
-	}
216
+    if (!preg_match(',[\/\?],', $url)) {
217
+        $url = generer_url_ecrire($url, $args, true);
218
+        // recuperer les parametres du contexte demande par l'url sous la forme
219
+        // &truc=@machin@
220
+        // @machin@ etant remplace par _request('machin')
221
+        $url = str_replace('&amp;', '&', $url);
222
+        while (preg_match(',[&?]([a-z_]+)=@([a-z_]+)@,i', $url, $matches)) {
223
+            if ($matches[2] == 'id_secteur' && !isset($contexte['id_secteur']) && isset($contexte['id_rubrique'])) {
224
+                $contexte['id_secteur'] = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . (int) $contexte['id_rubrique']);
225
+            }
226
+            $val = _request($matches[2], $contexte);
227
+            $url = parametre_url($url, $matches[1], $val ?: '', '&');
228
+        }
229
+        $url = str_replace('&', '&amp;', $url);
230
+    }
231 231
 
232
-	return $url;
232
+    return $url;
233 233
 }
234 234
 
235 235
 /**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
  *     Code HTML du bandeau
240 240
  */
241 241
 function inc_bandeau_dist() {
242
-	return recuperer_fond('prive/squelettes/inclure/barre-nav', $_GET);
242
+    return recuperer_fond('prive/squelettes/inclure/barre-nav', $_GET);
243 243
 }
244 244
 
245 245
 
@@ -248,13 +248,13 @@  discard block
 block discarded – undo
248 248
  * @return array
249 249
  */
250 250
 function obtenir_menus_favoris() {
251
-	if (
252
-		isset($GLOBALS['visiteur_session']['prefs']['menus_favoris'])
253
-		&& is_array($GLOBALS['visiteur_session']['prefs']['menus_favoris'])
254
-		&& $GLOBALS['visiteur_session']['prefs']['menus_favoris']
255
-	) {
256
-		return $GLOBALS['visiteur_session']['prefs']['menus_favoris'];
257
-	}
258
-	$definir_menus_favoris = charger_fonction('definir_menus_favoris', 'inc');
259
-	return $definir_menus_favoris();
251
+    if (
252
+        isset($GLOBALS['visiteur_session']['prefs']['menus_favoris'])
253
+        && is_array($GLOBALS['visiteur_session']['prefs']['menus_favoris'])
254
+        && $GLOBALS['visiteur_session']['prefs']['menus_favoris']
255
+    ) {
256
+        return $GLOBALS['visiteur_session']['prefs']['menus_favoris'];
257
+    }
258
+    $definir_menus_favoris = charger_fonction('definir_menus_favoris', 'inc');
259
+    return $definir_menus_favoris();
260 260
 }
Please login to merge, or discard this patch.
ecrire/inc/selectionner.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 	if ($aff_racine) {
55 55
 		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
56
-		$idom3 = $idom . '_selection';
56
+		$idom3 = $idom.'_selection';
57 57
 
58 58
 		$onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;";
59 59
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			'  '
72 72
 		);
73 73
 
74
-		$js_func = $do . '_selection_titre';
74
+		$js_func = $do.'_selection_titre';
75 75
 		$ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');";
76 76
 
77 77
 		$aff_racine = "<div class='petit-item petite-racine item'>"
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
  **/
113 113
 function construire_selectionner_hierarchie($idom, $liste, $racine, $url, $name, $url_init = '') {
114 114
 
115
-	$idom1 = $idom . '_champ_recherche';
116
-	$idom2 = $idom . '_principal';
117
-	$idom3 = $idom . '_selection';
118
-	$idom4 = $idom . '_col_1';
119
-	$idom5 = 'img_' . $idom4;
120
-	$idom6 = $idom . '_fonc';
115
+	$idom1 = $idom.'_champ_recherche';
116
+	$idom2 = $idom.'_principal';
117
+	$idom3 = $idom.'_selection';
118
+	$idom4 = $idom.'_col_1';
119
+	$idom5 = 'img_'.$idom4;
120
+	$idom6 = $idom.'_fonc';
121 121
 
122 122
 	return "<div id='$idom'>"
123 123
 	. "<a id='$idom6' style='visibility: hidden;'"
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 	. http_img_pack(
128 128
 		'loader.svg',
129 129
 		'',
130
-		"class='loader' style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'"
130
+		"class='loader' style='visibility: hidden;float:".$GLOBALS['spip_lang_right']."' id='$idom5'"
131 131
 	)
132 132
 	. ''
133
-	. "<input style='width: 10em;float:" . $GLOBALS['spip_lang_right'] . ";' type='text' class='text search' id='$idom1' placeholder='" . _T('info_rechercher') . "'"
133
+	. "<input style='width: 10em;float:".$GLOBALS['spip_lang_right'].";' type='text' class='text search' id='$idom1' placeholder='"._T('info_rechercher')."'"
134 134
 	// eliminer Return car il provoque la soumission (balise unique)
135 135
 	// et eliminer Tab pour la navigation au clavier
136 136
 	// ce serait encore mieux de ne le faire que s'il y a encore plusieurs
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 
178 178
 	$liste = $id_rubrique;
179 179
 	$id_rubrique = (int) $id_rubrique;
180
-	while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = ' . $id_rubrique)) {
181
-		$liste = $id_rubrique . ",$liste";
180
+	while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = '.$id_rubrique)) {
181
+		$liste = $id_rubrique.",$liste";
182 182
 	}
183 183
 
184 184
 	return explode(',', "0,$liste");
Please login to merge, or discard this patch.
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('inc/filtres');
@@ -45,56 +45,56 @@  discard block
 block discarded – undo
45 45
  **/
46 46
 function inc_selectionner_dist($sel, $idom = '', $exclus = 0, $aff_racine = false, $recur = true, $do = 'aff') {
47 47
 
48
-	if ($recur) {
49
-		$recur = mini_hier($sel);
50
-	} else {
51
-		$sel = 0;
52
-	}
53
-
54
-	if ($aff_racine) {
55
-		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
56
-		$idom3 = $idom . '_selection';
57
-
58
-		$onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;";
59
-
60
-		$ondbClick = strtr(
61
-			str_replace(
62
-				"'",
63
-				'&#8217;',
64
-				str_replace(
65
-					'"',
66
-					'&#34;',
67
-					(string) textebrut(_T('info_racine_site'))
68
-				)
69
-			),
70
-			"\n\r",
71
-			'  '
72
-		);
73
-
74
-		$js_func = $do . '_selection_titre';
75
-		$ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');";
76
-
77
-		$aff_racine = "<div class='petit-item petite-racine item'>"
78
-			. "<a href='#'"
79
-			. 'onclick="'
80
-			. $onClick
81
-			. "\"\nondbclick=\""
82
-			. $ondbClick
83
-			. $onClick
84
-			. '">'
85
-			. _T('info_racine_site')
86
-			. '</a></div>';
87
-	}
88
-
89
-	$url_init = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclus&id=0&col=1&do=$do");
90
-
91
-	$plonger = charger_fonction('plonger', 'inc');
92
-	$plonger_r = $plonger($sel, $idom, $recur, 1, $exclus, $do);
93
-
94
-	// url completee par la fonction JS onkeypress_rechercher
95
-	$url = generer_url_ecrire('rechercher', "exclus=$exclus&rac=$idom&do=$do&type=");
96
-
97
-	return construire_selectionner_hierarchie($idom, $plonger_r, $aff_racine, $url, 'id_parent', $url_init);
48
+    if ($recur) {
49
+        $recur = mini_hier($sel);
50
+    } else {
51
+        $sel = 0;
52
+    }
53
+
54
+    if ($aff_racine) {
55
+        $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
56
+        $idom3 = $idom . '_selection';
57
+
58
+        $onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;";
59
+
60
+        $ondbClick = strtr(
61
+            str_replace(
62
+                "'",
63
+                '&#8217;',
64
+                str_replace(
65
+                    '"',
66
+                    '&#34;',
67
+                    (string) textebrut(_T('info_racine_site'))
68
+                )
69
+            ),
70
+            "\n\r",
71
+            '  '
72
+        );
73
+
74
+        $js_func = $do . '_selection_titre';
75
+        $ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');";
76
+
77
+        $aff_racine = "<div class='petit-item petite-racine item'>"
78
+            . "<a href='#'"
79
+            . 'onclick="'
80
+            . $onClick
81
+            . "\"\nondbclick=\""
82
+            . $ondbClick
83
+            . $onClick
84
+            . '">'
85
+            . _T('info_racine_site')
86
+            . '</a></div>';
87
+    }
88
+
89
+    $url_init = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclus&id=0&col=1&do=$do");
90
+
91
+    $plonger = charger_fonction('plonger', 'inc');
92
+    $plonger_r = $plonger($sel, $idom, $recur, 1, $exclus, $do);
93
+
94
+    // url completee par la fonction JS onkeypress_rechercher
95
+    $url = generer_url_ecrire('rechercher', "exclus=$exclus&rac=$idom&do=$do&type=");
96
+
97
+    return construire_selectionner_hierarchie($idom, $plonger_r, $aff_racine, $url, 'id_parent', $url_init);
98 98
 }
99 99
 
100 100
 /**
@@ -112,58 +112,58 @@  discard block
 block discarded – undo
112 112
  **/
113 113
 function construire_selectionner_hierarchie($idom, $liste, $racine, $url, $name, $url_init = '') {
114 114
 
115
-	$idom1 = $idom . '_champ_recherche';
116
-	$idom2 = $idom . '_principal';
117
-	$idom3 = $idom . '_selection';
118
-	$idom4 = $idom . '_col_1';
119
-	$idom5 = 'img_' . $idom4;
120
-	$idom6 = $idom . '_fonc';
121
-
122
-	return "<div id='$idom'>"
123
-	. "<a id='$idom6' style='visibility: hidden;'"
124
-	. ($url_init ? "\nhref='$url_init'" : '')
125
-	. '></a>'
126
-	. "<div class='recherche_rapide_parent formulaire_recherche'>"
127
-	. http_img_pack(
128
-		'loader.svg',
129
-		'',
130
-		"class='loader' style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'"
131
-	)
132
-	. ''
133
-	. "<input style='width: 10em;float:" . $GLOBALS['spip_lang_right'] . ";' type='text' class='text search' id='$idom1' placeholder='" . _T('info_rechercher') . "'"
134
-	// eliminer Return car il provoque la soumission (balise unique)
135
-	// et eliminer Tab pour la navigation au clavier
136
-	// ce serait encore mieux de ne le faire que s'il y a encore plusieurs
137
-	// resultats retournes par la recherche
138
-	. "\nonkeypress=\"k=event.keyCode;if (k==13 || k==3 || k==9){return false;}\""
139
-	// lancer la recherche apres le filtrage ci-dessus sauf sur le tab (navigation au clavier)
140
-	. "\nonkeyup=\"if(event.keyCode==9){return false;};return onkey_rechercher(this.value,"
141
-	// la destination de la recherche
142
-	. "'$idom4'"
115
+    $idom1 = $idom . '_champ_recherche';
116
+    $idom2 = $idom . '_principal';
117
+    $idom3 = $idom . '_selection';
118
+    $idom4 = $idom . '_col_1';
119
+    $idom5 = 'img_' . $idom4;
120
+    $idom6 = $idom . '_fonc';
121
+
122
+    return "<div id='$idom'>"
123
+    . "<a id='$idom6' style='visibility: hidden;'"
124
+    . ($url_init ? "\nhref='$url_init'" : '')
125
+    . '></a>'
126
+    . "<div class='recherche_rapide_parent formulaire_recherche'>"
127
+    . http_img_pack(
128
+        'loader.svg',
129
+        '',
130
+        "class='loader' style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'"
131
+    )
132
+    . ''
133
+    . "<input style='width: 10em;float:" . $GLOBALS['spip_lang_right'] . ";' type='text' class='text search' id='$idom1' placeholder='" . _T('info_rechercher') . "'"
134
+    // eliminer Return car il provoque la soumission (balise unique)
135
+    // et eliminer Tab pour la navigation au clavier
136
+    // ce serait encore mieux de ne le faire que s'il y a encore plusieurs
137
+    // resultats retournes par la recherche
138
+    . "\nonkeypress=\"k=event.keyCode;if (k==13 || k==3 || k==9){return false;}\""
139
+    // lancer la recherche apres le filtrage ci-dessus sauf sur le tab (navigation au clavier)
140
+    . "\nonkeyup=\"if(event.keyCode==9){return false;};return onkey_rechercher(this.value,"
141
+    // la destination de la recherche
142
+    . "'$idom4'"
143 143
 #	. "this.parentNode.parentNode.parentNode.parentNode.nextSibling.firstChild.id"
144
-	. ",'"
145
-	// l'url effectuant la recherche
146
-	. $url
147
-	. "',"
148
-	// le noeud contenant un gif anime
149
-	// . "'idom5'"
150
-	. 'this.parentNode.previousSibling.firstChild'
151
-	. ",'"
152
-	// la valeur de l'attribut Name a remplir
153
-	. $name
154
-	. "','"
155
-	// noeud invisible memorisant l'URL initiale (pour re-initialisation)
156
-	. $idom6
157
-	. "')\""
158
-	. ' />'
159
-	. "\n</div>"
160
-	. ($racine ? "<div>$racine</div>" : '')
161
-	. "<div id='"
162
-	. $idom2
163
-	. "'><div id='$idom4'"
164
-	. " class=''>"
165
-	. $liste
166
-	. "</div></div>\n<div id='$idom3'></div></div>\n";
144
+    . ",'"
145
+    // l'url effectuant la recherche
146
+    . $url
147
+    . "',"
148
+    // le noeud contenant un gif anime
149
+    // . "'idom5'"
150
+    . 'this.parentNode.previousSibling.firstChild'
151
+    . ",'"
152
+    // la valeur de l'attribut Name a remplir
153
+    . $name
154
+    . "','"
155
+    // noeud invisible memorisant l'URL initiale (pour re-initialisation)
156
+    . $idom6
157
+    . "')\""
158
+    . ' />'
159
+    . "\n</div>"
160
+    . ($racine ? "<div>$racine</div>" : '')
161
+    . "<div id='"
162
+    . $idom2
163
+    . "'><div id='$idom4'"
164
+    . " class=''>"
165
+    . $liste
166
+    . "</div></div>\n<div id='$idom3'></div></div>\n";
167 167
 }
168 168
 
169 169
 /**
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
  **/
176 176
 function mini_hier($id_rubrique) {
177 177
 
178
-	$liste = $id_rubrique;
179
-	$id_rubrique = (int) $id_rubrique;
180
-	while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = ' . $id_rubrique)) {
181
-		$liste = $id_rubrique . ",$liste";
182
-	}
178
+    $liste = $id_rubrique;
179
+    $id_rubrique = (int) $id_rubrique;
180
+    while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = ' . $id_rubrique)) {
181
+        $liste = $id_rubrique . ",$liste";
182
+    }
183 183
 
184
-	return explode(',', "0,$liste");
184
+    return explode(',', "0,$liste");
185 185
 }
Please login to merge, or discard this patch.
ecrire/inc/completer_traduction.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -28,51 +28,51 @@  discard block
 block discarded – undo
28 28
  * @return string Erreur éventuelle
29 29
  */
30 30
 function inc_completer_traduction_dist($objet, $id_objet, $id_trad) {
31
-	// dupliquer tous les liens sauf les auteurs : le nouvel auteur est celui qui traduit
32
-	// cf API editer_liens
33
-	include_spip('action/editer_liens');
34
-	objet_dupliquer_liens($objet, $id_trad, $id_objet, null, ['auteur']);
35
-	$_id_table = id_table_objet($objet);
31
+    // dupliquer tous les liens sauf les auteurs : le nouvel auteur est celui qui traduit
32
+    // cf API editer_liens
33
+    include_spip('action/editer_liens');
34
+    objet_dupliquer_liens($objet, $id_trad, $id_objet, null, ['auteur']);
35
+    $_id_table = id_table_objet($objet);
36 36
 
37
-	// recuperer le logo
38
-	$chercher_logo = charger_fonction('chercher_logo', 'inc');
39
-	include_spip('action/editer_logo');
40
-	foreach (['on', 'off'] as $etat) {
41
-		$logo = $chercher_logo($id_trad, $_id_table, $etat);
42
-		if ($logo && ($file = reset($logo))) {
43
-			logo_modifier($objet, $id_objet, $etat, $file);
44
-		}
45
-	}
37
+    // recuperer le logo
38
+    $chercher_logo = charger_fonction('chercher_logo', 'inc');
39
+    include_spip('action/editer_logo');
40
+    foreach (['on', 'off'] as $etat) {
41
+        $logo = $chercher_logo($id_trad, $_id_table, $etat);
42
+        if ($logo && ($file = reset($logo))) {
43
+            logo_modifier($objet, $id_objet, $etat, $file);
44
+        }
45
+    }
46 46
 
47
-	// dupliquer certains champs
48
-	$trouver_table = charger_fonction('trouver_table', 'base');
49
-	$desc = $trouver_table(table_objet_sql($objet));
50
-	$champs = $set = [];
47
+    // dupliquer certains champs
48
+    $trouver_table = charger_fonction('trouver_table', 'base');
49
+    $desc = $trouver_table(table_objet_sql($objet));
50
+    $champs = $set = [];
51 51
 
52
-	// un éventuel champ 'virtuel' (redirections)
53
-	if (!empty($desc['field']['virtuel'])) {
54
-		$champs[] = 'virtuel';
55
-	}
52
+    // un éventuel champ 'virtuel' (redirections)
53
+    if (!empty($desc['field']['virtuel'])) {
54
+        $champs[] = 'virtuel';
55
+    }
56 56
 
57
-	$data = sql_fetsel('*', $desc['table'], $_id_table . '=' . (int) $id_trad);
57
+    $data = sql_fetsel('*', $desc['table'], $_id_table . '=' . (int) $id_trad);
58 58
 
59
-	foreach ($champs as $c) {
60
-		$set[$c] = $data[$c];
61
-	}
59
+    foreach ($champs as $c) {
60
+        $set[$c] = $data[$c];
61
+    }
62 62
 
63
-	/*
63
+    /*
64 64
 	 * Le pipeline 'pre_edition' sera appelé avec l'action 'completer_traduction'.
65 65
 	 * Des plugins pourront ainsi compléter les champs d'un objet traduit lors d'une nouvelle traduction.
66 66
 	 */
67
-	$err = objet_modifier_champs(
68
-		$objet,
69
-		$id_objet,
70
-		[
71
-			'data' => $data,
72
-			'action' => 'completer_traduction',
73
-		],
74
-		$set
75
-	);
67
+    $err = objet_modifier_champs(
68
+        $objet,
69
+        $id_objet,
70
+        [
71
+            'data' => $data,
72
+            'action' => 'completer_traduction',
73
+        ],
74
+        $set
75
+    );
76 76
 
77
-	return $err;
77
+    return $err;
78 78
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 		$champs[] = 'virtuel';
55 55
 	}
56 56
 
57
-	$data = sql_fetsel('*', $desc['table'], $_id_table . '=' . (int) $id_trad);
57
+	$data = sql_fetsel('*', $desc['table'], $_id_table.'='.(int) $id_trad);
58 58
 
59 59
 	foreach ($champs as $c) {
60 60
 		$set[$c] = $data[$c];
Please login to merge, or discard this patch.
ecrire/inc/svg.php 3 patches
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -164,8 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 	if ($start === false || $start === 'end') {
166 166
 		$svg = str_replace('</svg>', $shapes . '</svg>', $svg);
167
-	}
168
-	else {
167
+	} else {
169 168
 		$p = stripos($svg, '<svg');
170 169
 		$p = strpos($svg, '>', $p);
171 170
 		$svg = substr_replace($svg, $shapes, $p + 1, 0);
@@ -224,8 +223,7 @@  discard block
 block discarded – undo
224 223
 	if (str_starts_with($couleur, 'rgb(')) {
225 224
 		$c = explode(',', substr($couleur, 4));
226 225
 		$couleur = _couleur_dec_to_hex((int) $c[0], (int) $c[1], (int) $c[2]);
227
-	}
228
-	else {
226
+	} else {
229 227
 		$couleur = couleur_html_to_hex($couleur);
230 228
 	}
231 229
 	return '#' . ltrim($couleur, '#');
@@ -281,17 +279,14 @@  discard block
 block discarded – undo
281 279
 			// si pas de height valide, on suppose l'image carree
282 280
 			$viewBox[3] = $width;
283 281
 		}
284
-	}
285
-	else {
282
+	} else {
286 283
 		// si on recupere la taille de la viewbox mais si la viewbox est petite on met un multiplicateur pour la taille finale
287 284
 		$width = $viewBox[2];
288 285
 		if ($width < 1) {
289 286
 			$coeff = max($coeff, 1000);
290
-		}
291
-		elseif ($width < 10) {
287
+		} elseif ($width < 10) {
292 288
 			$coeff = max($coeff, 100);
293
-		}
294
-		elseif ($width < 100) {
289
+		} elseif ($width < 100) {
295 290
 			$coeff = max($coeff, 10);
296 291
 		}
297 292
 	}
@@ -304,16 +299,13 @@  discard block
 block discarded – undo
304 299
 		if (empty($attributs['viewBox'])) {
305 300
 			$viewBox[3] = $height;
306 301
 		}
307
-	}
308
-	else {
302
+	} else {
309 303
 		$height = $viewBox[3];
310 304
 		if ($height < 1) {
311 305
 			$coeff = max($coeff, 1000);
312
-		}
313
-		elseif ($height < 10) {
306
+		} elseif ($height < 10) {
314 307
 			$coeff = max($coeff, 100);
315
-		}
316
-		elseif ($height < 100) {
308
+		} elseif ($height < 100) {
317 309
 			$coeff = max($coeff, 10);
318 310
 		}
319 311
 	}
@@ -454,8 +446,7 @@  discard block
 block discarded – undo
454 446
 			if (isset($attributs['viewBox'])) {
455 447
 				$viewBox = explode(' ', $attributs['viewBox']);
456 448
 				$rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\"/>";
457
-			}
458
-			else {
449
+			} else {
459 450
 				$rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
460 451
 			}
461 452
 			$svg = svg_insert_shapes($svg, $rect);
@@ -484,8 +475,7 @@  discard block
 block discarded – undo
484 475
 			if (isset($attributs['viewBox'])) {
485 476
 				$viewBox = explode(' ', $attributs['viewBox']);
486 477
 				$rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\" opacity=\"$opacity\"/>";
487
-			}
488
-			else {
478
+			} else {
489 479
 				$rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
490 480
 			}
491 481
 			$svg = svg_insert_shapes($svg, $rect, false);
@@ -606,8 +596,7 @@  discard block
 block discarded – undo
606 596
 			$x = (int) $viewBox[0] + (int) ($viewBox[2] / 2);
607 597
 			$mx = -$x;
608 598
 			$transform = "translate($x, 0) $transform translate($mx, 0)";
609
-		}
610
-		else {
599
+		} else {
611 600
 			$transform = 'scale(1,-1)';
612 601
 
613 602
 			$y = (int) $viewBox[1] + (int) ($viewBox[3] / 2);
@@ -666,8 +655,7 @@  discard block
 block discarded – undo
666 655
 			$c = array_shift($colors);
667 656
 			if (strlen($c) == 4) {
668 657
 				$short[] = $c;
669
-			}
670
-			else {
658
+			} else {
671 659
 				$long[] = $c;
672 660
 			}
673 661
 		}
Please login to merge, or discard this patch.
Indentation   +430 added lines, -430 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 if (!defined('IMG_SVG')) {
23
-	// complete 	IMG_BMP | IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM | IMG_WEBP
24
-	define('IMG_SVG', 128);
25
-	define('IMAGETYPE_SVG', 19);
23
+    // complete 	IMG_BMP | IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM | IMG_WEBP
24
+    define('IMG_SVG', 128);
25
+    define('IMAGETYPE_SVG', 19);
26 26
 }
27 27
 
28 28
 /**
@@ -38,35 +38,35 @@  discard block
 block discarded – undo
38 38
  *   false si on a pas pu charger l'image
39 39
  */
40 40
 function svg_charger($fichier, $maxlen = null) {
41
-	if (str_starts_with($fichier, 'data:image/svg+xml')) {
42
-		$image = explode(';', $fichier, 2);
43
-		$image = end($image);
44
-		if (str_starts_with($image, 'base64,')) {
45
-			$image = base64_decode(substr($image, 7));
46
-		}
47
-		if (str_contains($image, '<svg')) {
48
-			return $image;
49
-		}
50
-		// encodage inconnu ou autre format d'image ?
51
-		return false;
52
-	}
53
-	// c'est peut etre deja une image svg ?
54
-	if (str_contains($fichier, '<svg')) {
55
-		return $fichier;
56
-	}
57
-	if (!file_exists($fichier)) {
58
-		include_spip('inc/filtres');
59
-		$fichier  = supprimer_timestamp($fichier);
60
-		if (!file_exists($fichier)) {
61
-			return false;
62
-		}
63
-	}
64
-	$image = is_null($maxlen) ? file_get_contents($fichier) : file_get_contents($fichier, false, null, 0, $maxlen);
65
-	// est-ce bien une image svg ?
66
-	if (str_contains($image, '<svg')) {
67
-		return $image;
68
-	}
69
-	return false;
41
+    if (str_starts_with($fichier, 'data:image/svg+xml')) {
42
+        $image = explode(';', $fichier, 2);
43
+        $image = end($image);
44
+        if (str_starts_with($image, 'base64,')) {
45
+            $image = base64_decode(substr($image, 7));
46
+        }
47
+        if (str_contains($image, '<svg')) {
48
+            return $image;
49
+        }
50
+        // encodage inconnu ou autre format d'image ?
51
+        return false;
52
+    }
53
+    // c'est peut etre deja une image svg ?
54
+    if (str_contains($fichier, '<svg')) {
55
+        return $fichier;
56
+    }
57
+    if (!file_exists($fichier)) {
58
+        include_spip('inc/filtres');
59
+        $fichier  = supprimer_timestamp($fichier);
60
+        if (!file_exists($fichier)) {
61
+            return false;
62
+        }
63
+    }
64
+    $image = is_null($maxlen) ? file_get_contents($fichier) : file_get_contents($fichier, false, null, 0, $maxlen);
65
+    // est-ce bien une image svg ?
66
+    if (str_contains($image, '<svg')) {
67
+        return $image;
68
+    }
69
+    return false;
70 70
 }
71 71
 
72 72
 /**
@@ -75,28 +75,28 @@  discard block
 block discarded – undo
75 75
  * @return array|bool
76 76
  */
77 77
 function svg_lire_balise_svg($fichier) {
78
-	if (!$debut_fichier = svg_charger($fichier, 4096)) {
79
-		return false;
80
-	}
81
-
82
-	if (($ps = stripos($debut_fichier, '<svg')) !== false) {
83
-		$pe = stripos($debut_fichier, '>', $ps);
84
-		$balise_svg = substr($debut_fichier, $ps, $pe - $ps + 1);
85
-
86
-		if (preg_match_all(',([\w:\-]+)=,Uims', $balise_svg, $matches)) {
87
-			if (!function_exists('extraire_attribut')) {
88
-				include_spip('inc/filtres');
89
-			}
90
-			$attributs = [];
91
-			foreach ($matches[1] as $att) {
92
-				$attributs[$att] = extraire_attribut($balise_svg, $att);
93
-			}
94
-
95
-			return [$balise_svg, $attributs];
96
-		}
97
-	}
98
-
99
-	return false;
78
+    if (!$debut_fichier = svg_charger($fichier, 4096)) {
79
+        return false;
80
+    }
81
+
82
+    if (($ps = stripos($debut_fichier, '<svg')) !== false) {
83
+        $pe = stripos($debut_fichier, '>', $ps);
84
+        $balise_svg = substr($debut_fichier, $ps, $pe - $ps + 1);
85
+
86
+        if (preg_match_all(',([\w:\-]+)=,Uims', $balise_svg, $matches)) {
87
+            if (!function_exists('extraire_attribut')) {
88
+                include_spip('inc/filtres');
89
+            }
90
+            $attributs = [];
91
+            foreach ($matches[1] as $att) {
92
+                $attributs[$att] = extraire_attribut($balise_svg, $att);
93
+            }
94
+
95
+            return [$balise_svg, $attributs];
96
+        }
97
+    }
98
+
99
+    return false;
100 100
 }
101 101
 
102 102
 /**
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
  */
107 107
 function svg_lire_attributs($img) {
108 108
 
109
-	if ($svg_infos = svg_lire_balise_svg($img)) {
110
-		[$balise_svg, $attributs] = $svg_infos;
111
-		return $attributs;
112
-	}
109
+    if ($svg_infos = svg_lire_balise_svg($img)) {
110
+        [$balise_svg, $attributs] = $svg_infos;
111
+        return $attributs;
112
+    }
113 113
 
114
-	return false;
114
+    return false;
115 115
 }
116 116
 
117 117
 /**
@@ -121,19 +121,19 @@  discard block
 block discarded – undo
121 121
  * @return bool|float|int
122 122
  */
123 123
 function svg_dimension_to_pixels($dimension, $precision = 2) {
124
-	if (preg_match(',^(-?\d+(\.\d+)?)([^\d]*),i', trim($dimension), $m)) {
125
-		return match (strtolower($m[2])) {
126
-			'%' => false,
127
-			'em' => round($m[1] * 16, $precision),
128
-			'ex' => round($m[1] * 16, $precision),
129
-			'pc' => round($m[1] * 16, $precision),
130
-			'cm' => round($m[1] * 96 / 2.54, $precision),
131
-			'mm' => round($m[1] * 96 / 25.4, $precision),
132
-			'in' => round($m[1] * 96, $precision),
133
-			default => $m[1],
134
-		};
135
-	}
136
-	return false;
124
+    if (preg_match(',^(-?\d+(\.\d+)?)([^\d]*),i', trim($dimension), $m)) {
125
+        return match (strtolower($m[2])) {
126
+            '%' => false,
127
+            'em' => round($m[1] * 16, $precision),
128
+            'ex' => round($m[1] * 16, $precision),
129
+            'pc' => round($m[1] * 16, $precision),
130
+            'cm' => round($m[1] * 96 / 2.54, $precision),
131
+            'mm' => round($m[1] * 96 / 25.4, $precision),
132
+            'in' => round($m[1] * 96, $precision),
133
+            default => $m[1],
134
+        };
135
+    }
136
+    return false;
137 137
 }
138 138
 
139 139
 /**
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
  * @return string
145 145
  */
146 146
 function svg_change_balise_svg($svg, $old_balise_svg, $attributs) {
147
-	$new_balise_svg = '<svg';
148
-	foreach ($attributs as $k => $v) {
149
-		$new_balise_svg .= " $k=\"" . entites_html($v) . '"';
150
-	}
151
-	$new_balise_svg .= '>';
152
-
153
-	$p = strpos($svg, $old_balise_svg);
154
-	return substr_replace($svg, $new_balise_svg, $p, strlen($old_balise_svg));
147
+    $new_balise_svg = '<svg';
148
+    foreach ($attributs as $k => $v) {
149
+        $new_balise_svg .= " $k=\"" . entites_html($v) . '"';
150
+    }
151
+    $new_balise_svg .= '>';
152
+
153
+    $p = strpos($svg, $old_balise_svg);
154
+    return substr_replace($svg, $new_balise_svg, $p, strlen($old_balise_svg));
155 155
 }
156 156
 
157 157
 /**
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
  */
164 164
 function svg_insert_shapes($svg, $shapes, $start = true) {
165 165
 
166
-	if ($start === false || $start === 'end') {
167
-		$svg = str_replace('</svg>', $shapes . '</svg>', $svg);
168
-	}
169
-	else {
170
-		$p = stripos($svg, '<svg');
171
-		$p = strpos($svg, '>', $p);
172
-		$svg = substr_replace($svg, $shapes, $p + 1, 0);
173
-	}
174
-	return $svg;
166
+    if ($start === false || $start === 'end') {
167
+        $svg = str_replace('</svg>', $shapes . '</svg>', $svg);
168
+    }
169
+    else {
170
+        $p = stripos($svg, '<svg');
171
+        $p = strpos($svg, '>', $p);
172
+        $svg = substr_replace($svg, $shapes, $p + 1, 0);
173
+    }
174
+    return $svg;
175 175
 }
176 176
 
177 177
 /**
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
  * @return string
185 185
  */
186 186
 function svg_clip_in_box($svg, $x, $y, $width, $height) {
187
-	$rect = "<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\" />";
188
-	$id = 'clip-' . substr(md5($rect . strlen($svg)), 0, 8);
189
-	$clippath = "<clipPath id=\"$id\">$rect</clipPath>";
190
-	$g = "<g clip-path=\"url(#$id)\">";
191
-	$svg = svg_insert_shapes($svg, $clippath . $g);
192
-	return svg_insert_shapes($svg, '</g>', false);
187
+    $rect = "<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\" />";
188
+    $id = 'clip-' . substr(md5($rect . strlen($svg)), 0, 8);
189
+    $clippath = "<clipPath id=\"$id\">$rect</clipPath>";
190
+    $g = "<g clip-path=\"url(#$id)\">";
191
+    $svg = svg_insert_shapes($svg, $clippath . $g);
192
+    return svg_insert_shapes($svg, '</g>', false);
193 193
 }
194 194
 
195 195
 /**
@@ -200,20 +200,20 @@  discard block
 block discarded – undo
200 200
  * @return bool|string
201 201
  */
202 202
 function svg_redimensionner($img, $new_width, $new_height) {
203
-	if (
204
-		($svg = svg_charger($img))
205
-		&& ($svg_infos = svg_lire_balise_svg($svg))
206
-	) {
207
-		[$balise_svg, $attributs] = $svg_infos;
208
-		if (!isset($attributs['viewBox'])) {
209
-			$attributs['viewBox'] = '0 0 ' . $attributs['width'] . ' ' . $attributs['height'];
210
-		}
211
-		$attributs['width'] = (string) $new_width;
212
-		$attributs['height'] = (string) $new_height;
213
-		return svg_change_balise_svg($svg, $balise_svg, $attributs);
214
-	}
215
-
216
-	return $img;
203
+    if (
204
+        ($svg = svg_charger($img))
205
+        && ($svg_infos = svg_lire_balise_svg($svg))
206
+    ) {
207
+        [$balise_svg, $attributs] = $svg_infos;
208
+        if (!isset($attributs['viewBox'])) {
209
+            $attributs['viewBox'] = '0 0 ' . $attributs['width'] . ' ' . $attributs['height'];
210
+        }
211
+        $attributs['width'] = (string) $new_width;
212
+        $attributs['height'] = (string) $new_height;
213
+        return svg_change_balise_svg($svg, $balise_svg, $attributs);
214
+    }
215
+
216
+    return $img;
217 217
 }
218 218
 
219 219
 /**
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
  * @return string
223 223
  */
224 224
 function svg_couleur_to_hexa($couleur) {
225
-	if (str_starts_with($couleur, 'rgb(')) {
226
-		$c = explode(',', substr($couleur, 4));
227
-		$couleur = _couleur_dec_to_hex((int) $c[0], (int) $c[1], (int) $c[2]);
228
-	}
229
-	else {
230
-		$couleur = couleur_html_to_hex($couleur);
231
-	}
232
-	return '#' . ltrim($couleur, '#');
225
+    if (str_starts_with($couleur, 'rgb(')) {
226
+        $c = explode(',', substr($couleur, 4));
227
+        $couleur = _couleur_dec_to_hex((int) $c[0], (int) $c[1], (int) $c[2]);
228
+    }
229
+    else {
230
+        $couleur = couleur_html_to_hex($couleur);
231
+    }
232
+    return '#' . ltrim($couleur, '#');
233 233
 }
234 234
 
235 235
 /**
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
  * @return array
239 239
  */
240 240
 function svg_couleur_to_rgb($couleur) {
241
-	if (str_starts_with($couleur, 'rgb(')) {
242
-		$c = explode(',', substr($couleur, 4));
243
-		return ['red' => (int) $c[0],'green' => (int) $c[1],'blue' => (int) $c[2]];
244
-	}
245
-	return _couleur_hex_to_dec($couleur);
241
+    if (str_starts_with($couleur, 'rgb(')) {
242
+        $c = explode(',', substr($couleur, 4));
243
+        return ['red' => (int) $c[0],'green' => (int) $c[1],'blue' => (int) $c[2]];
244
+    }
245
+    return _couleur_hex_to_dec($couleur);
246 246
 }
247 247
 
248 248
 
@@ -252,80 +252,80 @@  discard block
 block discarded – undo
252 252
  * @return array
253 253
  */
254 254
 function svg_getimagesize_from_attr($attributs) {
255
-	$width = 350; // default width
256
-	$height = 150; // default height
257
-
258
-	$viewBox = "0 0 $width $height";
259
-	if (isset($attributs['viewBox'])) {
260
-		$viewBox = $attributs['viewBox'];
261
-		$viewBox = preg_replace(',\s+,', ' ', $viewBox);
262
-	}
263
-	// et on la convertit en px
264
-	$viewBox = explode(' ', $viewBox);
265
-	$viewBox = array_map('svg_dimension_to_pixels', $viewBox);
266
-	if (!$viewBox[2]) {
267
-		$viewBox[2] = $width;
268
-	}
269
-	if (!$viewBox[3]) {
270
-		$viewBox[3] = $height;
271
-	}
272
-
273
-	$coeff = 1;
274
-	if (
275
-		isset($attributs['width'])
276
-		&& ($w = svg_dimension_to_pixels($attributs['width']))
277
-	) {
278
-		$width = $w;
279
-		// si on avait pas de viewBox, la construire a partir de ce width
280
-		if (empty($attributs['viewBox'])) {
281
-			$viewBox[2] = $width;
282
-			// si pas de height valide, on suppose l'image carree
283
-			$viewBox[3] = $width;
284
-		}
285
-	}
286
-	else {
287
-		// si on recupere la taille de la viewbox mais si la viewbox est petite on met un multiplicateur pour la taille finale
288
-		$width = $viewBox[2];
289
-		if ($width < 1) {
290
-			$coeff = max($coeff, 1000);
291
-		}
292
-		elseif ($width < 10) {
293
-			$coeff = max($coeff, 100);
294
-		}
295
-		elseif ($width < 100) {
296
-			$coeff = max($coeff, 10);
297
-		}
298
-	}
299
-	if (
300
-		isset($attributs['height'])
301
-		&& ($h = svg_dimension_to_pixels($attributs['height']))
302
-	) {
303
-		$height = $h;
304
-		// si on avait pas de viewBox, la construire a partir de ce height
305
-		if (empty($attributs['viewBox'])) {
306
-			$viewBox[3] = $height;
307
-		}
308
-	}
309
-	else {
310
-		$height = $viewBox[3];
311
-		if ($height < 1) {
312
-			$coeff = max($coeff, 1000);
313
-		}
314
-		elseif ($height < 10) {
315
-			$coeff = max($coeff, 100);
316
-		}
317
-		elseif ($height < 100) {
318
-			$coeff = max($coeff, 10);
319
-		}
320
-	}
321
-
322
-	// arrondir le width et height en pixel in fine
323
-	$width = round($coeff * $width);
324
-	$height = round($coeff * $height);
325
-
326
-	$viewBox = implode(' ', $viewBox);
327
-
328
-	return [$width, $height, $viewBox];
255
+    $width = 350; // default width
256
+    $height = 150; // default height
257
+
258
+    $viewBox = "0 0 $width $height";
259
+    if (isset($attributs['viewBox'])) {
260
+        $viewBox = $attributs['viewBox'];
261
+        $viewBox = preg_replace(',\s+,', ' ', $viewBox);
262
+    }
263
+    // et on la convertit en px
264
+    $viewBox = explode(' ', $viewBox);
265
+    $viewBox = array_map('svg_dimension_to_pixels', $viewBox);
266
+    if (!$viewBox[2]) {
267
+        $viewBox[2] = $width;
268
+    }
269
+    if (!$viewBox[3]) {
270
+        $viewBox[3] = $height;
271
+    }
272
+
273
+    $coeff = 1;
274
+    if (
275
+        isset($attributs['width'])
276
+        && ($w = svg_dimension_to_pixels($attributs['width']))
277
+    ) {
278
+        $width = $w;
279
+        // si on avait pas de viewBox, la construire a partir de ce width
280
+        if (empty($attributs['viewBox'])) {
281
+            $viewBox[2] = $width;
282
+            // si pas de height valide, on suppose l'image carree
283
+            $viewBox[3] = $width;
284
+        }
285
+    }
286
+    else {
287
+        // si on recupere la taille de la viewbox mais si la viewbox est petite on met un multiplicateur pour la taille finale
288
+        $width = $viewBox[2];
289
+        if ($width < 1) {
290
+            $coeff = max($coeff, 1000);
291
+        }
292
+        elseif ($width < 10) {
293
+            $coeff = max($coeff, 100);
294
+        }
295
+        elseif ($width < 100) {
296
+            $coeff = max($coeff, 10);
297
+        }
298
+    }
299
+    if (
300
+        isset($attributs['height'])
301
+        && ($h = svg_dimension_to_pixels($attributs['height']))
302
+    ) {
303
+        $height = $h;
304
+        // si on avait pas de viewBox, la construire a partir de ce height
305
+        if (empty($attributs['viewBox'])) {
306
+            $viewBox[3] = $height;
307
+        }
308
+    }
309
+    else {
310
+        $height = $viewBox[3];
311
+        if ($height < 1) {
312
+            $coeff = max($coeff, 1000);
313
+        }
314
+        elseif ($height < 10) {
315
+            $coeff = max($coeff, 100);
316
+        }
317
+        elseif ($height < 100) {
318
+            $coeff = max($coeff, 10);
319
+        }
320
+    }
321
+
322
+    // arrondir le width et height en pixel in fine
323
+    $width = round($coeff * $width);
324
+    $height = round($coeff * $height);
325
+
326
+    $viewBox = implode(' ', $viewBox);
327
+
328
+    return [$width, $height, $viewBox];
329 329
 }
330 330
 
331 331
 /**
@@ -341,23 +341,23 @@  discard block
 block discarded – undo
341 341
  * @return string
342 342
  */
343 343
 function svg_force_viewBox_px($img, $force_width_and_height = false) {
344
-	if (
345
-		($svg = svg_charger($img))
346
-		&& ($svg_infos = svg_lire_balise_svg($svg))
347
-	) {
348
-		[$balise_svg, $attributs] = $svg_infos;
349
-
350
-		[$width, $height, $viewBox] = svg_getimagesize_from_attr($attributs);
351
-
352
-		if ($force_width_and_height) {
353
-			$attributs['width'] = $width;
354
-			$attributs['height'] = $height;
355
-		}
356
-
357
-		$attributs['viewBox'] = $viewBox;
358
-		return svg_change_balise_svg($svg, $balise_svg, $attributs);
359
-	}
360
-	return $img;
344
+    if (
345
+        ($svg = svg_charger($img))
346
+        && ($svg_infos = svg_lire_balise_svg($svg))
347
+    ) {
348
+        [$balise_svg, $attributs] = $svg_infos;
349
+
350
+        [$width, $height, $viewBox] = svg_getimagesize_from_attr($attributs);
351
+
352
+        if ($force_width_and_height) {
353
+            $attributs['width'] = $width;
354
+            $attributs['height'] = $height;
355
+        }
356
+
357
+        $attributs['viewBox'] = $viewBox;
358
+        return svg_change_balise_svg($svg, $balise_svg, $attributs);
359
+    }
360
+    return $img;
361 361
 }
362 362
 
363 363
 /**
@@ -366,13 +366,13 @@  discard block
 block discarded – undo
366 366
  * @return array|mixed
367 367
  */
368 368
 function svg_extract_couleurs($img) {
369
-	if (
370
-		($svg = svg_charger($img))
371
-		&& preg_match_all('/(#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f])|(rgb\([\s\d]+,[\s\d]+,[\s\d]+\))|(#[0-9a-f][0-9a-f][0-9a-f])/imS', $svg, $matches)
372
-	) {
373
-		return $matches[0];
374
-	}
375
-	return [];
369
+    if (
370
+        ($svg = svg_charger($img))
371
+        && preg_match_all('/(#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f])|(rgb\([\s\d]+,[\s\d]+,[\s\d]+\))|(#[0-9a-f][0-9a-f][0-9a-f])/imS', $svg, $matches)
372
+    ) {
373
+        return $matches[0];
374
+    }
375
+    return [];
376 376
 }
377 377
 
378 378
 /**
@@ -383,58 +383,58 @@  discard block
 block discarded – undo
383 383
  * @return bool|string
384 384
  */
385 385
 function svg_recadrer($img, $new_width, $new_height, $offset_width, $offset_height, $background_color = '') {
386
-	if (
387
-		($svg = svg_force_viewBox_px($img))
388
-		&& ($svg_infos = svg_lire_balise_svg($svg))
389
-	) {
390
-		[$balise_svg, $attributs] = $svg_infos;
391
-		$viewBox = explode(' ', $attributs['viewBox']);
392
-
393
-		$viewport_w = $new_width;
394
-		$viewport_h = $new_height;
395
-		$viewport_ox = $offset_width;
396
-		$viewport_oy = $offset_height;
397
-
398
-		// si on a un width/height qui rescale, il faut rescaler
399
-		if (
400
-			isset($attributs['width'])
401
-			&& ($w = svg_dimension_to_pixels($attributs['width']))
402
-			&& isset($attributs['height'])
403
-			&& ($h = svg_dimension_to_pixels($attributs['height']))
404
-		) {
405
-			$xscale = $viewBox[2] / $w;
406
-			$viewport_w = round($viewport_w * $xscale, 2);
407
-			$viewport_ox = round($viewport_ox * $xscale, 2);
408
-			$yscale = $viewBox[3] / $h;
409
-			$viewport_h = round($viewport_h * $yscale, 2);
410
-			$viewport_oy = round($viewport_oy * $yscale, 2);
411
-		}
412
-
413
-		if ($viewport_w > $viewBox[2] || $viewport_h > $viewBox[3]) {
414
-			$svg = svg_clip_in_box($svg, $viewBox[0], $viewBox[1], $viewBox[2], $viewBox[3]);
415
-		}
416
-
417
-		// maintenant on redefinit la viewBox
418
-		$viewBox[0] += $viewport_ox;
419
-		$viewBox[1] += $viewport_oy;
420
-		$viewBox[2] = $viewport_w;
421
-		$viewBox[3] = $viewport_h;
422
-
423
-		$attributs['viewBox'] = implode(' ', $viewBox);
424
-		$attributs['width'] = (string) $new_width;
425
-		$attributs['height'] = (string) $new_height;
426
-
427
-		$svg = svg_change_balise_svg($svg, $balise_svg, $attributs);
428
-
429
-		// ajouter un background
430
-		if ($background_color && $background_color !== 'transparent') {
431
-			$svg = svg_ajouter_background($svg, $background_color);
432
-		}
433
-
434
-		return $svg;
435
-	}
436
-
437
-	return $img;
386
+    if (
387
+        ($svg = svg_force_viewBox_px($img))
388
+        && ($svg_infos = svg_lire_balise_svg($svg))
389
+    ) {
390
+        [$balise_svg, $attributs] = $svg_infos;
391
+        $viewBox = explode(' ', $attributs['viewBox']);
392
+
393
+        $viewport_w = $new_width;
394
+        $viewport_h = $new_height;
395
+        $viewport_ox = $offset_width;
396
+        $viewport_oy = $offset_height;
397
+
398
+        // si on a un width/height qui rescale, il faut rescaler
399
+        if (
400
+            isset($attributs['width'])
401
+            && ($w = svg_dimension_to_pixels($attributs['width']))
402
+            && isset($attributs['height'])
403
+            && ($h = svg_dimension_to_pixels($attributs['height']))
404
+        ) {
405
+            $xscale = $viewBox[2] / $w;
406
+            $viewport_w = round($viewport_w * $xscale, 2);
407
+            $viewport_ox = round($viewport_ox * $xscale, 2);
408
+            $yscale = $viewBox[3] / $h;
409
+            $viewport_h = round($viewport_h * $yscale, 2);
410
+            $viewport_oy = round($viewport_oy * $yscale, 2);
411
+        }
412
+
413
+        if ($viewport_w > $viewBox[2] || $viewport_h > $viewBox[3]) {
414
+            $svg = svg_clip_in_box($svg, $viewBox[0], $viewBox[1], $viewBox[2], $viewBox[3]);
415
+        }
416
+
417
+        // maintenant on redefinit la viewBox
418
+        $viewBox[0] += $viewport_ox;
419
+        $viewBox[1] += $viewport_oy;
420
+        $viewBox[2] = $viewport_w;
421
+        $viewBox[3] = $viewport_h;
422
+
423
+        $attributs['viewBox'] = implode(' ', $viewBox);
424
+        $attributs['width'] = (string) $new_width;
425
+        $attributs['height'] = (string) $new_height;
426
+
427
+        $svg = svg_change_balise_svg($svg, $balise_svg, $attributs);
428
+
429
+        // ajouter un background
430
+        if ($background_color && $background_color !== 'transparent') {
431
+            $svg = svg_ajouter_background($svg, $background_color);
432
+        }
433
+
434
+        return $svg;
435
+    }
436
+
437
+    return $img;
438 438
 }
439 439
 
440 440
 /**
@@ -444,26 +444,26 @@  discard block
 block discarded – undo
444 444
  * @return bool|string
445 445
  */
446 446
 function svg_ajouter_background($img, $background_color) {
447
-	if (
448
-		($svg = svg_charger($img))
449
-		&& ($svg_infos = svg_lire_balise_svg($svg))
450
-	) {
451
-		if ($background_color && $background_color !== 'transparent') {
452
-			[$balise_svg, $attributs] = $svg_infos;
453
-
454
-			$background_color = svg_couleur_to_hexa($background_color);
455
-			if (isset($attributs['viewBox'])) {
456
-				$viewBox = explode(' ', $attributs['viewBox']);
457
-				$rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\"/>";
458
-			}
459
-			else {
460
-				$rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
461
-			}
462
-			$svg = svg_insert_shapes($svg, $rect);
463
-		}
464
-		return $svg;
465
-	}
466
-	return $img;
447
+    if (
448
+        ($svg = svg_charger($img))
449
+        && ($svg_infos = svg_lire_balise_svg($svg))
450
+    ) {
451
+        if ($background_color && $background_color !== 'transparent') {
452
+            [$balise_svg, $attributs] = $svg_infos;
453
+
454
+            $background_color = svg_couleur_to_hexa($background_color);
455
+            if (isset($attributs['viewBox'])) {
456
+                $viewBox = explode(' ', $attributs['viewBox']);
457
+                $rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\"/>";
458
+            }
459
+            else {
460
+                $rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
461
+            }
462
+            $svg = svg_insert_shapes($svg, $rect);
463
+        }
464
+        return $svg;
465
+    }
466
+    return $img;
467 467
 }
468 468
 
469 469
 
@@ -474,26 +474,26 @@  discard block
 block discarded – undo
474 474
  * @return bool|string
475 475
  */
476 476
 function svg_ajouter_voile($img, $background_color, $opacity) {
477
-	if (
478
-		($svg = svg_charger($img))
479
-		&& ($svg_infos = svg_lire_balise_svg($svg))
480
-	) {
481
-		if ($background_color && $background_color !== 'transparent') {
482
-			[$balise_svg, $attributs] = $svg_infos;
483
-
484
-			$background_color = svg_couleur_to_hexa($background_color);
485
-			if (isset($attributs['viewBox'])) {
486
-				$viewBox = explode(' ', $attributs['viewBox']);
487
-				$rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\" opacity=\"$opacity\"/>";
488
-			}
489
-			else {
490
-				$rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
491
-			}
492
-			$svg = svg_insert_shapes($svg, $rect, false);
493
-		}
494
-		return $svg;
495
-	}
496
-	return $img;
477
+    if (
478
+        ($svg = svg_charger($img))
479
+        && ($svg_infos = svg_lire_balise_svg($svg))
480
+    ) {
481
+        if ($background_color && $background_color !== 'transparent') {
482
+            [$balise_svg, $attributs] = $svg_infos;
483
+
484
+            $background_color = svg_couleur_to_hexa($background_color);
485
+            if (isset($attributs['viewBox'])) {
486
+                $viewBox = explode(' ', $attributs['viewBox']);
487
+                $rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\" opacity=\"$opacity\"/>";
488
+            }
489
+            else {
490
+                $rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
491
+            }
492
+            $svg = svg_insert_shapes($svg, $rect, false);
493
+        }
494
+        return $svg;
495
+    }
496
+    return $img;
497 497
 }
498 498
 
499 499
 
@@ -504,27 +504,27 @@  discard block
 block discarded – undo
504 504
  * @return bool|string
505 505
  */
506 506
 function svg_transformer($img, $attributs) {
507
-	if (
508
-		($svg = svg_charger($img))
509
-		&& ($svg_infos = svg_lire_balise_svg($svg))
510
-	) {
511
-		if ($attributs) {
512
-			[$balise_svg, ] = $svg_infos;
513
-			$g = '<g';
514
-			foreach ($attributs as $k => $v) {
515
-				if (strlen($v)) {
516
-					$g .= " $k=\"" . attribut_html($v) . '"';
517
-				}
518
-			}
519
-			if (strlen($g) > 2) {
520
-				$g .= '>';
521
-				$svg = svg_insert_shapes($svg, $g);
522
-				$svg = svg_insert_shapes($svg, '</g>', false);
523
-			}
524
-		}
525
-		return $svg;
526
-	}
527
-	return $img;
507
+    if (
508
+        ($svg = svg_charger($img))
509
+        && ($svg_infos = svg_lire_balise_svg($svg))
510
+    ) {
511
+        if ($attributs) {
512
+            [$balise_svg, ] = $svg_infos;
513
+            $g = '<g';
514
+            foreach ($attributs as $k => $v) {
515
+                if (strlen($v)) {
516
+                    $g .= " $k=\"" . attribut_html($v) . '"';
517
+                }
518
+            }
519
+            if (strlen($g) > 2) {
520
+                $g .= '>';
521
+                $svg = svg_insert_shapes($svg, $g);
522
+                $svg = svg_insert_shapes($svg, '</g>', false);
523
+            }
524
+        }
525
+        return $svg;
526
+    }
527
+    return $img;
528 528
 }
529 529
 
530 530
 /**
@@ -535,21 +535,21 @@  discard block
 block discarded – undo
535 535
  * @return bool|string
536 536
  */
537 537
 function svg_apply_filter($img, $filter_def) {
538
-	if (
539
-		($svg = svg_charger($img))
540
-		&& ($svg_infos = svg_lire_balise_svg($svg))
541
-	) {
542
-		if ($filter_def) {
543
-			[$balise_svg, ] = $svg_infos;
544
-			$filter_id = 'filter-' . substr(md5($filter_def . strlen($svg)), 0, 8);
545
-			$filter = "<defs><filter id=\"$filter_id\">$filter_def</filter></defs>";
546
-			$g = "<g filter=\"url(#$filter_id)\">";
547
-			$svg = svg_insert_shapes($svg, $filter . $g);
548
-			$svg = svg_insert_shapes($svg, '</g>', false);
549
-		}
550
-		return $svg;
551
-	}
552
-	return $img;
538
+    if (
539
+        ($svg = svg_charger($img))
540
+        && ($svg_infos = svg_lire_balise_svg($svg))
541
+    ) {
542
+        if ($filter_def) {
543
+            [$balise_svg, ] = $svg_infos;
544
+            $filter_id = 'filter-' . substr(md5($filter_def . strlen($svg)), 0, 8);
545
+            $filter = "<defs><filter id=\"$filter_id\">$filter_def</filter></defs>";
546
+            $g = "<g filter=\"url(#$filter_id)\">";
547
+            $svg = svg_insert_shapes($svg, $filter . $g);
548
+            $svg = svg_insert_shapes($svg, '</g>', false);
549
+        }
550
+        return $svg;
551
+    }
552
+    return $img;
553 553
 }
554 554
 
555 555
 /**
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
  * @return string
560 560
  */
561 561
 function svg_filter_blur($img, $blur_width) {
562
-	$blur_width = (int) $blur_width;
563
-	return svg_apply_filter($img, "<feGaussianBlur stdDeviation=\"$blur_width\"/>");
562
+    $blur_width = (int) $blur_width;
563
+    return svg_apply_filter($img, "<feGaussianBlur stdDeviation=\"$blur_width\"/>");
564 564
 }
565 565
 
566 566
 /**
@@ -570,10 +570,10 @@  discard block
 block discarded – undo
570 570
  * @return bool|string
571 571
  */
572 572
 function svg_filter_grayscale($img, $intensity) {
573
-	$value = round(1.0 - $intensity, 2);
574
-	//$filter = "<feColorMatrix type=\"matrix\" values=\"0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\"/>";
575
-	$filter = "<feColorMatrix type=\"saturate\" values=\"$value\"/>";
576
-	return svg_apply_filter($img, $filter);
573
+    $value = round(1.0 - $intensity, 2);
574
+    //$filter = "<feColorMatrix type=\"matrix\" values=\"0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\"/>";
575
+    $filter = "<feColorMatrix type=\"saturate\" values=\"$value\"/>";
576
+    return svg_apply_filter($img, $filter);
577 577
 }
578 578
 
579 579
 /**
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
  * @return bool|string
587 587
  */
588 588
 function svg_filter_sepia($img, $intensity) {
589
-	$filter = '<feColorMatrix type="matrix" values="0.30 0.30 0.30 0.0 0 0.25 0.25 0.25 0.0 0 0.20 0.20 0.20 0.0 0 0.00 0.00 0.00 1 0"/>';
590
-	return svg_apply_filter($img, $filter);
589
+    $filter = '<feColorMatrix type="matrix" values="0.30 0.30 0.30 0.0 0 0.25 0.25 0.25 0.0 0 0.20 0.20 0.20 0.0 0 0.00 0.00 0.00 1 0"/>';
590
+    return svg_apply_filter($img, $filter);
591 591
 }
592 592
 
593 593
 /**
@@ -597,30 +597,30 @@  discard block
 block discarded – undo
597 597
  * @return bool|string
598 598
  */
599 599
 function svg_flip($img, $HorV) {
600
-	if (
601
-		($svg = svg_force_viewBox_px($img))
602
-		&& ($svg_infos = svg_lire_balise_svg($svg))
603
-	) {
604
-		[$balise_svg, $atts] = $svg_infos;
605
-		$viewBox = explode(' ', $atts['viewBox']);
606
-
607
-		if (!in_array($HorV, ['h', 'H'])) {
608
-			$transform = 'scale(-1,1)';
609
-
610
-			$x = (int) $viewBox[0] + (int) ($viewBox[2] / 2);
611
-			$mx = -$x;
612
-			$transform = "translate($x, 0) $transform translate($mx, 0)";
613
-		}
614
-		else {
615
-			$transform = 'scale(1,-1)';
616
-
617
-			$y = (int) $viewBox[1] + (int) ($viewBox[3] / 2);
618
-			$my = -$y;
619
-			$transform = "translate(0, $y) $transform translate(0, $my)";
620
-		}
621
-		return svg_transformer($svg, ['transform' => $transform]);
622
-	}
623
-	return $img;
600
+    if (
601
+        ($svg = svg_force_viewBox_px($img))
602
+        && ($svg_infos = svg_lire_balise_svg($svg))
603
+    ) {
604
+        [$balise_svg, $atts] = $svg_infos;
605
+        $viewBox = explode(' ', $atts['viewBox']);
606
+
607
+        if (!in_array($HorV, ['h', 'H'])) {
608
+            $transform = 'scale(-1,1)';
609
+
610
+            $x = (int) $viewBox[0] + (int) ($viewBox[2] / 2);
611
+            $mx = -$x;
612
+            $transform = "translate($x, 0) $transform translate($mx, 0)";
613
+        }
614
+        else {
615
+            $transform = 'scale(1,-1)';
616
+
617
+            $y = (int) $viewBox[1] + (int) ($viewBox[3] / 2);
618
+            $my = -$y;
619
+            $transform = "translate(0, $y) $transform translate(0, $my)";
620
+        }
621
+        return svg_transformer($svg, ['transform' => $transform]);
622
+    }
623
+    return $img;
624 624
 }
625 625
 
626 626
 /**
@@ -634,19 +634,19 @@  discard block
 block discarded – undo
634 634
  * @return bool|string
635 635
  */
636 636
 function svg_rotate($img, $angle, $center_x, $center_y) {
637
-	if (
638
-		($svg = svg_force_viewBox_px($img))
639
-		&& ($svg_infos = svg_lire_balise_svg($svg))
640
-	) {
641
-		[$balise_svg, $atts] = $svg_infos;
642
-		$viewBox = explode(' ', $atts['viewBox']);
643
-
644
-		$center_x = round($viewBox[0] + $center_x * $viewBox[2]);
645
-		$center_y = round($viewBox[1] + $center_y * $viewBox[3]);
646
-
647
-		return svg_transformer($svg, ['transform' => "rotate($angle $center_x $center_y)"]);
648
-	}
649
-	return $img;
637
+    if (
638
+        ($svg = svg_force_viewBox_px($img))
639
+        && ($svg_infos = svg_lire_balise_svg($svg))
640
+    ) {
641
+        [$balise_svg, $atts] = $svg_infos;
642
+        $viewBox = explode(' ', $atts['viewBox']);
643
+
644
+        $center_x = round($viewBox[0] + $center_x * $viewBox[2]);
645
+        $center_y = round($viewBox[1] + $center_y * $viewBox[3]);
646
+
647
+        return svg_transformer($svg, ['transform' => "rotate($angle $center_x $center_y)"]);
648
+    }
649
+    return $img;
650 650
 }
651 651
 
652 652
 /**
@@ -658,40 +658,40 @@  discard block
 block discarded – undo
658 658
  * @return bool|mixed|string
659 659
  */
660 660
 function svg_filtrer_couleurs($img, $callback_filter) {
661
-	if (
662
-		($svg = svg_force_viewBox_px($img))
663
-		&& ($colors = svg_extract_couleurs($svg))
664
-	) {
665
-		$colors = array_unique($colors);
666
-
667
-		$short = [];
668
-		$long = [];
669
-		while (count($colors)) {
670
-			$c = array_shift($colors);
671
-			if (strlen($c) == 4) {
672
-				$short[] = $c;
673
-			}
674
-			else {
675
-				$long[] = $c;
676
-			}
677
-		}
678
-
679
-		$colors = [...$long, ...$short];
680
-		$new_colors = [];
681
-		$colors = array_flip($colors);
682
-		foreach ($colors as $c => $k) {
683
-			$colors[$c] = "@@@COLOR$$k$@@@";
684
-		}
685
-
686
-
687
-		foreach ($colors as $original => $replace) {
688
-			$new = svg_couleur_to_hexa($original);
689
-			$new_colors[$replace] = $callback_filter($new);
690
-		}
691
-
692
-		$svg = str_replace(array_keys($colors), array_values($colors), $svg);
693
-
694
-		return str_replace(array_keys($new_colors), array_values($new_colors), $svg);
695
-	}
696
-	return $img;
661
+    if (
662
+        ($svg = svg_force_viewBox_px($img))
663
+        && ($colors = svg_extract_couleurs($svg))
664
+    ) {
665
+        $colors = array_unique($colors);
666
+
667
+        $short = [];
668
+        $long = [];
669
+        while (count($colors)) {
670
+            $c = array_shift($colors);
671
+            if (strlen($c) == 4) {
672
+                $short[] = $c;
673
+            }
674
+            else {
675
+                $long[] = $c;
676
+            }
677
+        }
678
+
679
+        $colors = [...$long, ...$short];
680
+        $new_colors = [];
681
+        $colors = array_flip($colors);
682
+        foreach ($colors as $c => $k) {
683
+            $colors[$c] = "@@@COLOR$$k$@@@";
684
+        }
685
+
686
+
687
+        foreach ($colors as $original => $replace) {
688
+            $new = svg_couleur_to_hexa($original);
689
+            $new_colors[$replace] = $callback_filter($new);
690
+        }
691
+
692
+        $svg = str_replace(array_keys($colors), array_values($colors), $svg);
693
+
694
+        return str_replace(array_keys($new_colors), array_values($new_colors), $svg);
695
+    }
696
+    return $img;
697 697
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 	if (!file_exists($fichier)) {
58 58
 		include_spip('inc/filtres');
59
-		$fichier  = supprimer_timestamp($fichier);
59
+		$fichier = supprimer_timestamp($fichier);
60 60
 		if (!file_exists($fichier)) {
61 61
 			return false;
62 62
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 function svg_change_balise_svg($svg, $old_balise_svg, $attributs) {
147 147
 	$new_balise_svg = '<svg';
148 148
 	foreach ($attributs as $k => $v) {
149
-		$new_balise_svg .= " $k=\"" . entites_html($v) . '"';
149
+		$new_balise_svg .= " $k=\"".entites_html($v).'"';
150 150
 	}
151 151
 	$new_balise_svg .= '>';
152 152
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 function svg_insert_shapes($svg, $shapes, $start = true) {
165 165
 
166 166
 	if ($start === false || $start === 'end') {
167
-		$svg = str_replace('</svg>', $shapes . '</svg>', $svg);
167
+		$svg = str_replace('</svg>', $shapes.'</svg>', $svg);
168 168
 	}
169 169
 	else {
170 170
 		$p = stripos($svg, '<svg');
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
  */
186 186
 function svg_clip_in_box($svg, $x, $y, $width, $height) {
187 187
 	$rect = "<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\" />";
188
-	$id = 'clip-' . substr(md5($rect . strlen($svg)), 0, 8);
188
+	$id = 'clip-'.substr(md5($rect.strlen($svg)), 0, 8);
189 189
 	$clippath = "<clipPath id=\"$id\">$rect</clipPath>";
190 190
 	$g = "<g clip-path=\"url(#$id)\">";
191
-	$svg = svg_insert_shapes($svg, $clippath . $g);
191
+	$svg = svg_insert_shapes($svg, $clippath.$g);
192 192
 	return svg_insert_shapes($svg, '</g>', false);
193 193
 }
194 194
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	) {
207 207
 		[$balise_svg, $attributs] = $svg_infos;
208 208
 		if (!isset($attributs['viewBox'])) {
209
-			$attributs['viewBox'] = '0 0 ' . $attributs['width'] . ' ' . $attributs['height'];
209
+			$attributs['viewBox'] = '0 0 '.$attributs['width'].' '.$attributs['height'];
210 210
 		}
211 211
 		$attributs['width'] = (string) $new_width;
212 212
 		$attributs['height'] = (string) $new_height;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	else {
230 230
 		$couleur = couleur_html_to_hex($couleur);
231 231
 	}
232
-	return '#' . ltrim($couleur, '#');
232
+	return '#'.ltrim($couleur, '#');
233 233
 }
234 234
 
235 235
 /**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 function svg_couleur_to_rgb($couleur) {
241 241
 	if (str_starts_with($couleur, 'rgb(')) {
242 242
 		$c = explode(',', substr($couleur, 4));
243
-		return ['red' => (int) $c[0],'green' => (int) $c[1],'blue' => (int) $c[2]];
243
+		return ['red' => (int) $c[0], 'green' => (int) $c[1], 'blue' => (int) $c[2]];
244 244
 	}
245 245
 	return _couleur_hex_to_dec($couleur);
246 246
 }
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 			$background_color = svg_couleur_to_hexa($background_color);
455 455
 			if (isset($attributs['viewBox'])) {
456 456
 				$viewBox = explode(' ', $attributs['viewBox']);
457
-				$rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\"/>";
457
+				$rect = '<rect x="'.$viewBox[0].'" y="'.$viewBox[1].'" width="'.$viewBox[2].'" height="'.$viewBox[3]."\" fill=\"$background_color\"/>";
458 458
 			}
459 459
 			else {
460 460
 				$rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 			$background_color = svg_couleur_to_hexa($background_color);
485 485
 			if (isset($attributs['viewBox'])) {
486 486
 				$viewBox = explode(' ', $attributs['viewBox']);
487
-				$rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\" opacity=\"$opacity\"/>";
487
+				$rect = '<rect x="'.$viewBox[0].'" y="'.$viewBox[1].'" width="'.$viewBox[2].'" height="'.$viewBox[3]."\" fill=\"$background_color\" opacity=\"$opacity\"/>";
488 488
 			}
489 489
 			else {
490 490
 				$rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 			$g = '<g';
514 514
 			foreach ($attributs as $k => $v) {
515 515
 				if (strlen($v)) {
516
-					$g .= " $k=\"" . attribut_html($v) . '"';
516
+					$g .= " $k=\"".attribut_html($v).'"';
517 517
 				}
518 518
 			}
519 519
 			if (strlen($g) > 2) {
@@ -541,10 +541,10 @@  discard block
 block discarded – undo
541 541
 	) {
542 542
 		if ($filter_def) {
543 543
 			[$balise_svg, ] = $svg_infos;
544
-			$filter_id = 'filter-' . substr(md5($filter_def . strlen($svg)), 0, 8);
544
+			$filter_id = 'filter-'.substr(md5($filter_def.strlen($svg)), 0, 8);
545 545
 			$filter = "<defs><filter id=\"$filter_id\">$filter_def</filter></defs>";
546 546
 			$g = "<g filter=\"url(#$filter_id)\">";
547
-			$svg = svg_insert_shapes($svg, $filter . $g);
547
+			$svg = svg_insert_shapes($svg, $filter.$g);
548 548
 			$svg = svg_insert_shapes($svg, '</g>', false);
549 549
 		}
550 550
 		return $svg;
Please login to merge, or discard this patch.
ecrire/src/Afficher/Minipage/Installation.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@
 block discarded – undo
15 15
  * Présentation des pages simplifiées pour installer SPIP
16 16
  **/
17 17
 class Installation extends Admin {
18
-	public const TYPE = 'installation';
18
+    public const TYPE = 'installation';
19 19
 
20
-	protected function setOptions(array $options) {
21
-		$options['titre'] ??= '';
22
-		if (!$options['titre'] || $options['titre'] === 'AUTO') {
23
-			$options['titre'] = _T('info_installation_systeme_publication');
24
-		}
25
-		$options = parent::setOptions($options);
26
-		$options['couleur_fond'] = '#a1124d';
27
-		$options['css_files'][] = find_in_theme('installation.css');
28
-		$options['footer'] = '';
29
-		return $options;
30
-	}
20
+    protected function setOptions(array $options) {
21
+        $options['titre'] ??= '';
22
+        if (!$options['titre'] || $options['titre'] === 'AUTO') {
23
+            $options['titre'] = _T('info_installation_systeme_publication');
24
+        }
25
+        $options = parent::setOptions($options);
26
+        $options['couleur_fond'] = '#a1124d';
27
+        $options['css_files'][] = find_in_theme('installation.css');
28
+        $options['footer'] = '';
29
+        return $options;
30
+    }
31 31
 
32
-	public function page($corps = '', $options = []) {
33
-		$options['titre'] ??= 'AUTO';
34
-		return parent::page($corps, $options);
35
-	}
32
+    public function page($corps = '', $options = []) {
33
+        $options['titre'] ??= 'AUTO';
34
+        return parent::page($corps, $options);
35
+    }
36 36
 }
Please login to merge, or discard this patch.
ecrire/src/Afficher/Minipage/Admin.php 3 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -114,11 +114,9 @@  discard block
 block discarded – undo
114 114
 
115 115
 			if ($statut && test_espace_prive()) {
116 116
 				$footer = bouton_action(_T('public:accueil_site'), generer_url_ecrire('accueil'));
117
-			}
118
-			elseif (!empty($_COOKIE['spip_admin'])) {
117
+			} elseif (!empty($_COOKIE['spip_admin'])) {
119 118
 				$footer = bouton_action(_T('public:lien_connecter'), generer_url_public('login'));
120
-			}
121
-			else {
119
+			} else {
122 120
 				$footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site'] ?? '');
123 121
 			}
124 122
 
@@ -130,12 +128,10 @@  discard block
 block discarded – undo
130 128
 					. $titre
131 129
 					. '</div>';
132 130
 				$options['titre'] = '';
133
-			}
134
-			else {
131
+			} else {
135 132
 				$options['titre'] = $titre;
136 133
 			}
137
-		}
138
-		else {
134
+		} else {
139 135
 			$options['titre'] = $titre;
140 136
 		}
141 137
 		$options['page_title'] = $titre;
Please login to merge, or discard this patch.
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -15,146 +15,146 @@
 block discarded – undo
15 15
  * Présentation des pages simplifiées d’admin pour envoyer un message à un utilisateur
16 16
  **/
17 17
 class Admin extends Page {
18
-	public const TYPE = 'admin';
19
-	protected function setOptions(array $options) {
20
-		$options['couleur_fond'] = '#999';
21
-		if (empty($options['css_files'])) {
22
-			$options['css_files'] = [];
23
-		}
24
-		array_unshift($options['css_files'], find_in_theme('minipres.css'));
25
-
26
-		$options['page_title'] = ($options['titre'] ?? '');
27
-
28
-		return $options;
29
-	}
30
-
31
-
32
-	/**
33
-	 * Retourne le début d'une page HTML minimale (de type installation ou erreur)
34
-	 *
35
-	 * @param array $options
36
-	 * @return string
37
-	 *    Code HTML
38
-	 */
39
-	public function installDebutPage($options = []) {
40
-
41
-		$options = $this->setOptions($options);
42
-		return parent::ouvreBody($options)
43
-			. parent::ouvreCorps($options);
44
-	}
45
-
46
-	/**
47
-	 * Retourne le fin d'une page HTML minimale (de type installation ou erreur)
48
-	 *
49
-	 * @param array $options
50
-	 * @return string
51
-	 *    Code HTML
52
-	 */
53
-	public function installFinPage($options = []) {
54
-
55
-		$options = $this->setOptions($options);
56
-		return parent::fermeCorps($options)
57
-			. parent::fermeBody();
58
-	}
59
-
60
-
61
-	/**
62
-	 * Retourne une page HTML contenant, dans une présentation minimale,
63
-	 * le contenu transmis dans `$corps`.
64
-	 *
65
-	 * Appelée pour afficher un message d’erreur (l’utilisateur n’a pas
66
-	 * accès à cette page par exemple).
67
-	 *
68
-	 * Lorsqu’aucun argument n’est transmis, un header 403 est renvoyé,
69
-	 * ainsi qu’un message indiquant une interdiction d’accès.
70
-	 *
71
-	 * @param string $corps
72
-	 *   Corps de la page
73
-	 * @param array $options
74
-	 * @return string
75
-	 *   HTML de la page
76
-	 * @see  ouvreBody()
77
-	 *   string $titre : Titre à l'affichage (différent de $page_title)
78
-	 *   int $status : status de la page
79
-	 *   string $footer : pied de la box en remplacement du bouton retour par défaut
80
-	 * @uses ouvreBody()
81
-	 * @uses fermeBody()
82
-	 *
83
-	 */
84
-	public function page($corps = '', $options = []) {
85
-
86
-		$footer = '';
87
-
88
-		$titre = $options['titre'] ?? '';
89
-		if (!$titre) {
90
-			if (empty($corps) && !isset($options['status'])) {
91
-				$options['status'] = 403;
92
-			}
93
-
94
-			if (
95
-				!$titre = _request('action')
96
-				&& !$titre = _request('exec')
97
-				&& !$titre = _request('page')
98
-			) {
99
-				$titre = '?';
100
-			}
101
-
102
-			$titre = spip_htmlspecialchars($titre);
103
-
104
-			$titre = ($titre == 'install')
105
-				? _T('avis_espace_interdit')
106
-				: $titre . '&nbsp;: ' . _T('info_acces_interdit');
107
-
108
-			$statut = $GLOBALS['visiteur_session']['statut'] ?? '';
109
-			$nom = $GLOBALS['visiteur_session']['nom'] ?? '';
110
-
111
-			if ($statut != '0minirezo') {
112
-				$titre = _T('info_acces_interdit');
113
-			}
114
-
115
-			if ($statut && test_espace_prive()) {
116
-				$footer = bouton_action(_T('public:accueil_site'), generer_url_ecrire('accueil'));
117
-			}
118
-			elseif (!empty($_COOKIE['spip_admin'])) {
119
-				$footer = bouton_action(_T('public:lien_connecter'), generer_url_public('login'));
120
-			}
121
-			else {
122
-				$footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site'] ?? '');
123
-			}
124
-
125
-			spip_logger('minipres')->info($nom . " $titre " . $_SERVER['REQUEST_URI']);
126
-
127
-			$options['footer'] = $footer;
128
-			if (empty($corps)) {
129
-				$corps = "<div class='msg-alert error'>"
130
-					. $titre
131
-					. '</div>';
132
-				$options['titre'] = '';
133
-			}
134
-			else {
135
-				$options['titre'] = $titre;
136
-			}
137
-		}
138
-		else {
139
-			$options['titre'] = $titre;
140
-		}
141
-		$options['page_title'] = $titre;
142
-
143
-		$options = $this->setOptions($options);
144
-
145
-		$html = parent::page($corps, $options);
146
-
147
-		if (!_AJAX) {
148
-			return $html;
149
-		} else {
150
-			include_spip('inc/headers');
151
-			include_spip('inc/actions');
152
-			$url = self('&', true);
153
-			foreach ($_POST as $v => $c) {
154
-				$url = parametre_url($url, $v, $c, '&');
155
-			}
156
-			ajax_retour('<div>' . $titre . redirige_formulaire($url) . '</div>', false);
157
-			return '';
158
-		}
159
-	}
18
+    public const TYPE = 'admin';
19
+    protected function setOptions(array $options) {
20
+        $options['couleur_fond'] = '#999';
21
+        if (empty($options['css_files'])) {
22
+            $options['css_files'] = [];
23
+        }
24
+        array_unshift($options['css_files'], find_in_theme('minipres.css'));
25
+
26
+        $options['page_title'] = ($options['titre'] ?? '');
27
+
28
+        return $options;
29
+    }
30
+
31
+
32
+    /**
33
+     * Retourne le début d'une page HTML minimale (de type installation ou erreur)
34
+     *
35
+     * @param array $options
36
+     * @return string
37
+     *    Code HTML
38
+     */
39
+    public function installDebutPage($options = []) {
40
+
41
+        $options = $this->setOptions($options);
42
+        return parent::ouvreBody($options)
43
+            . parent::ouvreCorps($options);
44
+    }
45
+
46
+    /**
47
+     * Retourne le fin d'une page HTML minimale (de type installation ou erreur)
48
+     *
49
+     * @param array $options
50
+     * @return string
51
+     *    Code HTML
52
+     */
53
+    public function installFinPage($options = []) {
54
+
55
+        $options = $this->setOptions($options);
56
+        return parent::fermeCorps($options)
57
+            . parent::fermeBody();
58
+    }
59
+
60
+
61
+    /**
62
+     * Retourne une page HTML contenant, dans une présentation minimale,
63
+     * le contenu transmis dans `$corps`.
64
+     *
65
+     * Appelée pour afficher un message d’erreur (l’utilisateur n’a pas
66
+     * accès à cette page par exemple).
67
+     *
68
+     * Lorsqu’aucun argument n’est transmis, un header 403 est renvoyé,
69
+     * ainsi qu’un message indiquant une interdiction d’accès.
70
+     *
71
+     * @param string $corps
72
+     *   Corps de la page
73
+     * @param array $options
74
+     * @return string
75
+     *   HTML de la page
76
+     * @see  ouvreBody()
77
+     *   string $titre : Titre à l'affichage (différent de $page_title)
78
+     *   int $status : status de la page
79
+     *   string $footer : pied de la box en remplacement du bouton retour par défaut
80
+     * @uses ouvreBody()
81
+     * @uses fermeBody()
82
+     *
83
+     */
84
+    public function page($corps = '', $options = []) {
85
+
86
+        $footer = '';
87
+
88
+        $titre = $options['titre'] ?? '';
89
+        if (!$titre) {
90
+            if (empty($corps) && !isset($options['status'])) {
91
+                $options['status'] = 403;
92
+            }
93
+
94
+            if (
95
+                !$titre = _request('action')
96
+                && !$titre = _request('exec')
97
+                && !$titre = _request('page')
98
+            ) {
99
+                $titre = '?';
100
+            }
101
+
102
+            $titre = spip_htmlspecialchars($titre);
103
+
104
+            $titre = ($titre == 'install')
105
+                ? _T('avis_espace_interdit')
106
+                : $titre . '&nbsp;: ' . _T('info_acces_interdit');
107
+
108
+            $statut = $GLOBALS['visiteur_session']['statut'] ?? '';
109
+            $nom = $GLOBALS['visiteur_session']['nom'] ?? '';
110
+
111
+            if ($statut != '0minirezo') {
112
+                $titre = _T('info_acces_interdit');
113
+            }
114
+
115
+            if ($statut && test_espace_prive()) {
116
+                $footer = bouton_action(_T('public:accueil_site'), generer_url_ecrire('accueil'));
117
+            }
118
+            elseif (!empty($_COOKIE['spip_admin'])) {
119
+                $footer = bouton_action(_T('public:lien_connecter'), generer_url_public('login'));
120
+            }
121
+            else {
122
+                $footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site'] ?? '');
123
+            }
124
+
125
+            spip_logger('minipres')->info($nom . " $titre " . $_SERVER['REQUEST_URI']);
126
+
127
+            $options['footer'] = $footer;
128
+            if (empty($corps)) {
129
+                $corps = "<div class='msg-alert error'>"
130
+                    . $titre
131
+                    . '</div>';
132
+                $options['titre'] = '';
133
+            }
134
+            else {
135
+                $options['titre'] = $titre;
136
+            }
137
+        }
138
+        else {
139
+            $options['titre'] = $titre;
140
+        }
141
+        $options['page_title'] = $titre;
142
+
143
+        $options = $this->setOptions($options);
144
+
145
+        $html = parent::page($corps, $options);
146
+
147
+        if (!_AJAX) {
148
+            return $html;
149
+        } else {
150
+            include_spip('inc/headers');
151
+            include_spip('inc/actions');
152
+            $url = self('&', true);
153
+            foreach ($_POST as $v => $c) {
154
+                $url = parametre_url($url, $v, $c, '&');
155
+            }
156
+            ajax_retour('<div>' . $titre . redirige_formulaire($url) . '</div>', false);
157
+            return '';
158
+        }
159
+    }
160 160
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 			$titre = ($titre == 'install')
105 105
 				? _T('avis_espace_interdit')
106
-				: $titre . '&nbsp;: ' . _T('info_acces_interdit');
106
+				: $titre.'&nbsp;: '._T('info_acces_interdit');
107 107
 
108 108
 			$statut = $GLOBALS['visiteur_session']['statut'] ?? '';
109 109
 			$nom = $GLOBALS['visiteur_session']['nom'] ?? '';
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				$footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site'] ?? '');
123 123
 			}
124 124
 
125
-			spip_logger('minipres')->info($nom . " $titre " . $_SERVER['REQUEST_URI']);
125
+			spip_logger('minipres')->info($nom." $titre ".$_SERVER['REQUEST_URI']);
126 126
 
127 127
 			$options['footer'] = $footer;
128 128
 			if (empty($corps)) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			foreach ($_POST as $v => $c) {
154 154
 				$url = parametre_url($url, $v, $c, '&');
155 155
 			}
156
-			ajax_retour('<div>' . $titre . redirige_formulaire($url) . '</div>', false);
156
+			ajax_retour('<div>'.$titre.redirige_formulaire($url).'</div>', false);
157 157
 			return '';
158 158
 		}
159 159
 	}
Please login to merge, or discard this patch.
ecrire/src/Sql/Sqlite/Sqlite.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -8,112 +8,112 @@
 block discarded – undo
8 8
  **/
9 9
 class Sqlite
10 10
 {
11
-	/** @var Requeteur[] Liste des instances de requêteurs créés */
12
-	public static $requeteurs = [];
13
-	/** @var bool[] Pour chaque connexion, flag pour savoir si une transaction est en cours */
14
-	public static $transaction_en_cours = [];
11
+    /** @var Requeteur[] Liste des instances de requêteurs créés */
12
+    public static $requeteurs = [];
13
+    /** @var bool[] Pour chaque connexion, flag pour savoir si une transaction est en cours */
14
+    public static $transaction_en_cours = [];
15 15
 
16 16
 
17
-	/**
18
-	 * Retourne une unique instance du requêteur
19
-	 *
20
-	 * Retourne une instance unique du requêteur pour une connexion SQLite
21
-	 * donnée
22
-	 *
23
-	 * @param string $serveur
24
-	 *    Nom du connecteur
25
-	 * @return Requeteur
26
-	 *    Instance unique du requêteur
27
-	 **/
28
-	public static function requeteur($serveur) {
29
-		if (!isset(static::$requeteurs[$serveur])) {
30
-			static::$requeteurs[$serveur] = new Requeteur($serveur);
31
-		}
17
+    /**
18
+     * Retourne une unique instance du requêteur
19
+     *
20
+     * Retourne une instance unique du requêteur pour une connexion SQLite
21
+     * donnée
22
+     *
23
+     * @param string $serveur
24
+     *    Nom du connecteur
25
+     * @return Requeteur
26
+     *    Instance unique du requêteur
27
+     **/
28
+    public static function requeteur($serveur) {
29
+        if (!isset(static::$requeteurs[$serveur])) {
30
+            static::$requeteurs[$serveur] = new Requeteur($serveur);
31
+        }
32 32
 
33
-		return static::$requeteurs[$serveur];
34
-	}
33
+        return static::$requeteurs[$serveur];
34
+    }
35 35
 
36
-	/**
37
-	 * Prépare le texte d'une requête avant son exécution
38
-	 *
39
-	 * Adapte la requête au format plus ou moins MySQL par un format
40
-	 * compris de SQLite.
41
-	 *
42
-	 * Change les préfixes de tables SPIP par ceux véritables
43
-	 *
44
-	 * @param string $query Requête à préparer
45
-	 * @param string $serveur Nom de la connexion
46
-	 * @return string           Requête préparée
47
-	 */
48
-	public static function traduire_requete($query, $serveur) {
49
-		$requeteur = static::requeteur($serveur);
50
-		$traducteur = new Traducteur($query, $requeteur->prefixe, $requeteur->sqlite_version);
36
+    /**
37
+     * Prépare le texte d'une requête avant son exécution
38
+     *
39
+     * Adapte la requête au format plus ou moins MySQL par un format
40
+     * compris de SQLite.
41
+     *
42
+     * Change les préfixes de tables SPIP par ceux véritables
43
+     *
44
+     * @param string $query Requête à préparer
45
+     * @param string $serveur Nom de la connexion
46
+     * @return string           Requête préparée
47
+     */
48
+    public static function traduire_requete($query, $serveur) {
49
+        $requeteur = static::requeteur($serveur);
50
+        $traducteur = new Traducteur($query, $requeteur->prefixe, $requeteur->sqlite_version);
51 51
 
52
-		return $traducteur->traduire_requete();
53
-	}
52
+        return $traducteur->traduire_requete();
53
+    }
54 54
 
55
-	/**
56
-	 * Démarre une transaction
57
-	 *
58
-	 * @param string $serveur Nom de la connexion
59
-	 **/
60
-	public static function demarrer_transaction($serveur) {
61
-		Sqlite::executer_requete('BEGIN TRANSACTION', $serveur);
62
-		Sqlite::$transaction_en_cours[$serveur] = true;
63
-	}
55
+    /**
56
+     * Démarre une transaction
57
+     *
58
+     * @param string $serveur Nom de la connexion
59
+     **/
60
+    public static function demarrer_transaction($serveur) {
61
+        Sqlite::executer_requete('BEGIN TRANSACTION', $serveur);
62
+        Sqlite::$transaction_en_cours[$serveur] = true;
63
+    }
64 64
 
65
-	/**
66
-	 * Exécute la requête donnée
67
-	 *
68
-	 * @param string $query Requête
69
-	 * @param string $serveur Nom de la connexion
70
-	 * @param null|bool $tracer Demander des statistiques (temps) ?
71
-	 **/
72
-	public static function executer_requete($query, $serveur, $tracer = null) {
73
-		$requeteur = Sqlite::requeteur($serveur);
65
+    /**
66
+     * Exécute la requête donnée
67
+     *
68
+     * @param string $query Requête
69
+     * @param string $serveur Nom de la connexion
70
+     * @param null|bool $tracer Demander des statistiques (temps) ?
71
+     **/
72
+    public static function executer_requete($query, $serveur, $tracer = null) {
73
+        $requeteur = Sqlite::requeteur($serveur);
74 74
 
75
-		return $requeteur->executer_requete($query, $tracer);
76
-	}
75
+        return $requeteur->executer_requete($query, $tracer);
76
+    }
77 77
 
78
-	/**
79
-	 * Obtient l'identifiant de la dernière ligne insérée ou modifiée
80
-	 *
81
-	 * @param string $serveur Nom de la connexion
82
-	 * return int                Identifiant
83
-	 **/
84
-	public static function last_insert_id($serveur) {
85
-		$requeteur = Sqlite::requeteur($serveur);
78
+    /**
79
+     * Obtient l'identifiant de la dernière ligne insérée ou modifiée
80
+     *
81
+     * @param string $serveur Nom de la connexion
82
+     * return int                Identifiant
83
+     **/
84
+    public static function last_insert_id($serveur) {
85
+        $requeteur = Sqlite::requeteur($serveur);
86 86
 
87
-		return $requeteur->last_insert_id();
88
-	}
87
+        return $requeteur->last_insert_id();
88
+    }
89 89
 
90
-	/**
91
-	 * Annule une transaction
92
-	 *
93
-	 * @param string $serveur Nom de la connexion
94
-	 **/
95
-	public static function annuler_transaction($serveur) {
96
-		Sqlite::executer_requete('ROLLBACK', $serveur);
97
-		Sqlite::$transaction_en_cours[$serveur] = false;
98
-	}
90
+    /**
91
+     * Annule une transaction
92
+     *
93
+     * @param string $serveur Nom de la connexion
94
+     **/
95
+    public static function annuler_transaction($serveur) {
96
+        Sqlite::executer_requete('ROLLBACK', $serveur);
97
+        Sqlite::$transaction_en_cours[$serveur] = false;
98
+    }
99 99
 
100
-	/**
101
-	 * Termine une transaction
102
-	 *
103
-	 * @param string $serveur Nom de la connexion
104
-	 **/
105
-	public static function finir_transaction($serveur) {
106
-		// si pas de transaction en cours, ne rien faire et le dire
107
-		if (
108
-			!isset(Sqlite::$transaction_en_cours[$serveur])
109
-			|| Sqlite::$transaction_en_cours[$serveur] == false
110
-		) {
111
-			return false;
112
-		}
113
-		// sinon fermer la transaction et retourner true
114
-		Sqlite::executer_requete('COMMIT', $serveur);
115
-		Sqlite::$transaction_en_cours[$serveur] = false;
100
+    /**
101
+     * Termine une transaction
102
+     *
103
+     * @param string $serveur Nom de la connexion
104
+     **/
105
+    public static function finir_transaction($serveur) {
106
+        // si pas de transaction en cours, ne rien faire et le dire
107
+        if (
108
+            !isset(Sqlite::$transaction_en_cours[$serveur])
109
+            || Sqlite::$transaction_en_cours[$serveur] == false
110
+        ) {
111
+            return false;
112
+        }
113
+        // sinon fermer la transaction et retourner true
114
+        Sqlite::executer_requete('COMMIT', $serveur);
115
+        Sqlite::$transaction_en_cours[$serveur] = false;
116 116
 
117
-		return true;
118
-	}
117
+        return true;
118
+    }
119 119
 }
Please login to merge, or discard this patch.
ecrire/src/Sql/Sqlite/PDOStatement.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@
 block discarded – undo
6 6
  * Pouvoir retrouver le PDO utilisé pour générer un résultat de requête.
7 7
  */
8 8
 final class PDOStatement extends \PDOStatement {
9
-	private function __construct(private \PDO &$PDO) {
10
-	}
9
+    private function __construct(private \PDO &$PDO) {
10
+    }
11 11
 
12
-	public function getPDO(): \PDO {
13
-		return $this->PDO;
14
-	}
12
+    public function getPDO(): \PDO {
13
+        return $this->PDO;
14
+    }
15 15
 }
Please login to merge, or discard this patch.
ecrire/src/Compilateur/Noeud/Idiome.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -7,85 +7,85 @@
 block discarded – undo
7 7
  **/
8 8
 class Idiome
9 9
 {
10
-	/** Type de noeud */
11
-	public string $type = 'idiome';
12
-
13
-	/** Clé de traduction demandée. Exemple 'item_oui' */
14
-	public string $nom_champ = '';
15
-
16
-	/** Module de langue où chercher la clé de traduction. Exemple 'medias' */
17
-	public string $module = '';
18
-
19
-	/** Arguments à passer à la chaîne */
20
-	public array $arg = [];
21
-
22
-	/**
23
-	 * Filtres à appliquer au résultat
24
-	 *
25
-	 *
26
-	 * * FIXME: type unique.
27
-	 * @var false|array
28
-	 *     - false: erreur de syntaxe
29
-	 */
30
-	public $param = [];
31
-
32
-	/** Source des filtres (compatibilité) (?) */
33
-	public array $fonctions = [];
34
-
35
-	/**
36
-	 * Inutilisé, propriété générique de l'AST
37
-	 *
38
-	 * @var string|array
39
-	 */
40
-	public $avant = '';
41
-
42
-	/**
43
-	 * Inutilisé, propriété générique de l'AST
44
-	 *
45
-	 * @var string|array
46
-	 */
47
-	public $apres = '';
48
-
49
-	/** Identifiant de la boucle */
50
-	public string $id_boucle = '';
51
-
52
-	/**
53
-	 * AST du squelette, liste de toutes les boucles
54
-	 *
55
-	 * @var Boucle[]
56
-	 */
57
-	public array $boucles;
58
-
59
-	/** Alias de table d'application de la requête ou nom complet de la table SQL */
60
-	public ?string $type_requete = null;
61
-
62
-	/** Résultat de la compilation: toujours une expression PHP */
63
-	public string $code = '';
64
-
65
-	/**
66
-	 * Interdire les scripts
67
-	 *
68
-	 * @see interdire_scripts()
69
-	 */
70
-	public bool $interdire_scripts = false;
71
-
72
-	/**
73
-	 * Description du squelette
74
-	 *
75
-	 * Sert pour la gestion d'erreur et la production de code dependant du contexte
76
-	 *
77
-	 * Peut contenir les index :
78
-	 * - nom : Nom du fichier de cache
79
-	 * - gram : Nom de la grammaire du squelette (détermine le phraseur à utiliser)
80
-	 * - sourcefile : Chemin du squelette
81
-	 * - squelette : Code du squelette
82
-	 * - id_mere : Identifiant de la boucle parente
83
-	 * - documents : Pour embed et img dans les textes
84
-	 * - session : Pour un cache sessionné par auteur
85
-	 * - niv : Niveau de tabulation
86
-	 */
87
-	public array $descr = [];
88
-
89
-	/** Numéro de ligne dans le code source du squelette */
90
-	public int $ligne = 0;
10
+    /** Type de noeud */
11
+    public string $type = 'idiome';
12
+
13
+    /** Clé de traduction demandée. Exemple 'item_oui' */
14
+    public string $nom_champ = '';
15
+
16
+    /** Module de langue où chercher la clé de traduction. Exemple 'medias' */
17
+    public string $module = '';
18
+
19
+    /** Arguments à passer à la chaîne */
20
+    public array $arg = [];
21
+
22
+    /**
23
+     * Filtres à appliquer au résultat
24
+     *
25
+     *
26
+     * * FIXME: type unique.
27
+     * @var false|array
28
+     *     - false: erreur de syntaxe
29
+     */
30
+    public $param = [];
31
+
32
+    /** Source des filtres (compatibilité) (?) */
33
+    public array $fonctions = [];
34
+
35
+    /**
36
+     * Inutilisé, propriété générique de l'AST
37
+     *
38
+     * @var string|array
39
+     */
40
+    public $avant = '';
41
+
42
+    /**
43
+     * Inutilisé, propriété générique de l'AST
44
+     *
45
+     * @var string|array
46
+     */
47
+    public $apres = '';
48
+
49
+    /** Identifiant de la boucle */
50
+    public string $id_boucle = '';
51
+
52
+    /**
53
+     * AST du squelette, liste de toutes les boucles
54
+     *
55
+     * @var Boucle[]
56
+     */
57
+    public array $boucles;
58
+
59
+    /** Alias de table d'application de la requête ou nom complet de la table SQL */
60
+    public ?string $type_requete = null;
61
+
62
+    /** Résultat de la compilation: toujours une expression PHP */
63
+    public string $code = '';
64
+
65
+    /**
66
+     * Interdire les scripts
67
+     *
68
+     * @see interdire_scripts()
69
+     */
70
+    public bool $interdire_scripts = false;
71
+
72
+    /**
73
+     * Description du squelette
74
+     *
75
+     * Sert pour la gestion d'erreur et la production de code dependant du contexte
76
+     *
77
+     * Peut contenir les index :
78
+     * - nom : Nom du fichier de cache
79
+     * - gram : Nom de la grammaire du squelette (détermine le phraseur à utiliser)
80
+     * - sourcefile : Chemin du squelette
81
+     * - squelette : Code du squelette
82
+     * - id_mere : Identifiant de la boucle parente
83
+     * - documents : Pour embed et img dans les textes
84
+     * - session : Pour un cache sessionné par auteur
85
+     * - niv : Niveau de tabulation
86
+     */
87
+    public array $descr = [];
88
+
89
+    /** Numéro de ligne dans le code source du squelette */
90
+    public int $ligne = 0;
91 91
 }
Please login to merge, or discard this patch.